[antlr-interest] Optional tokens
John B. Brodie
jbb at acm.org
Sun May 22 20:44:30 PDT 2005
Greetings!
On Mon, 23 May 2005 00:12:47 -0300 hammett <hammett at uol.com.br> wrote:
>I'm struggling with my grammar where I need to express that SEMI or NEWLINE
>is required to signal the end of my statements while should be totally
>ignored elsewhere.
...snip...
>Being concrete
>
>-- --
># a comment (Token.SKIP)
>
>class MyClass
>
> def self.initialize
> x, y = 1, 2
> puts x, y
> end
>
>end
>-- --
>
>Any help would be great!
I am sorry that I will not be very helpful in your quest, but I have to
ask the following. Do you really expect that:
x ; , ; y ; = ; 1 ; , ; 2
would parse to the same AST as:
x, y = 1, 2
you did say that SEMI is to be totally ignored anywhere except at the
end of a statement...
and so just where does a statement end anyway? (answering this may
lead you to the answer of your original question)
Just Asking...
-jbb
More information about the antlr-interest
mailing list