[antlr-interest] C Runtime problem with $channel=HIDDEN and SKIP()

Buğra Gedik bgedik at gmail.com
Sun Oct 26 22:40:45 PDT 2008


Apparently, putting tstream->discardOffChannel = ANTLR3_FALSE;
into the driver program solves the issue with the hidden tokens not showing
up in $text->chars. However, I think it will be better to keep the defaults
same with the other runtimes.

2008/10/26 Buğra Gedik <bgedik at gmail.com>

> Adding the line "LEXSTATE->tokenStartCharIndex += $text->size -1;" after
> the SKIP() fixes the SKIP bug.
> But then, the behavior of SKIP and $channel=HIDDEN become the same with
> respect to my original problem, that is when I print the rule text using
> $text->chars, I do not get the hidden or skipped tokens. This seems to be
> the expected behavior with skip() in Java runtime. However, with
> $channel=hidden in Java runtime, I get the hidden chars in the text of the
> rule, using $text, which is inconsistent with the C runtime.
>
> Cheers,
> -bugra
>
>
>
> On Sun, Oct 26, 2008 at 8:52 PM, Buğra Gedik <bgedik at gmail.com> wrote:
>
>> Hi (Jim),
>> With the C runtime when using $channel=HIDDEN the hidden tokens DO NOT
>> appear when printing a rule with $text->chars, whereas with the Java runtime
>> they appear (which I assume is the expected behaviour). The problem can be
>> solved by using SKIP() instead with the C runtime, but the SKIP function has
>> a bug (I saw it the official list of bugs), it messes up the next token
>> (includes the spaces).
>>
>> I'm using 3.1 (not 3.1.1). Any plans on fixing these? Or, are they fixed
>> in 3.1.1?
>>
>> Cheers,
>> -bugra
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081027/1efefd2f/attachment.html 


More information about the antlr-interest mailing list