[antlr-interest] python-lang parser to python target
Benjamin Niemann
pink at odahoda.de
Sun Jul 27 03:25:58 PDT 2008
Hi Aaron,
I checked your grammar, but for me the { pass } "hack" works correctly.
Can you send me the generated PythonLexer.py that contains the bug?
-Ben
On Wed, Jul 23, 2008 at 7:41 PM, Aaron Maxwell <amax at redsymbol.net> wrote:
> On Wednesday 23 July 2008 10:18:23 am you wrote:
> [regarding empty elif clause in lexer]
>> > Can someone suggest a fix? I tried just putting { pass;} in there,
>> > but it is not placed at the correct indentation level. Plus that is just
>> > hackish.
>>
>> Mmm.. that should work. This is the only way to get empty alternatives
>> to work right now, and I've used it several times without problems.
>> I'll have a look at the code and checkout why it doesn't work in this
>> case - but probably not before the weekend.
>
> I wrote it like this:
>
> {{{
> CONTINUED_LINE
> : '\\' ('\r')? '\n' (' '|'\t')* { $channel=HIDDEN; }
> ( nl=NEWLINE
> {self.emit(ClassicToken(type=NEWLINE,text=nl.getText()))}
> | {pass;}
> )
> ;
> }}}
>
> I also tried "{ pass;}", i.e. manually placing four spaces in there - both
> produced the same lexer code. Is that the right syntax?
>
> --
> Aaron Maxwell
> http://redsymbol.net
>
More information about the antlr-interest
mailing list