[antlr-interest] Comments/newlines

Bryan Ewbank ewbank at gmail.com
Thu Sep 29 16:26:02 PDT 2005


Given your sample file, is EOL by itself an acceptable statement, or
is this an error?

One way to parse the comments is to consume from "//" up to, but not
including, the next EOL character.  Or, use the EOL token to consume a
literal EOL with an optional preceeding "//" style comment.


> x = y // some comment
> // some comment
> x = y
>
> I want to parse both obviously language statement as
>     IDENTIFIER EQ IDENTIFIER EOL


More information about the antlr-interest mailing list