[antlr-interest] how to allow keywords as variables
Ruslan Zasukhin
sunshine at public.kherson.ua
Thu Jun 5 23:22:21 PDT 2003
on 6/6/03 1:57, mzukowski at yci.com at mzukowski at yci.com wrote:
> 2.7.2 still does not hoist, with the exception of hoisting from lexer rules
> into the nextToken() method.
>
> Ter's method would look like
>
> id_or_keyword:
> ID
> |"if"
> |"else"
> ;
>
> But this still can be cumbersome and generate lots of ambiguities which you
> might need to straighten out with syntactic predicates.
Okay, I see.
It seems I also have hear in mp3 word about ability resolve this using stack
of context state.
What about this?
For example
"drop" "table" { ExpectIdNow = true; } ID
And in lexer
ID:
if( ExpectIdNow )
then allow ID or keyword
else
keywords only.
Or something such?
--
Best regards,
Ruslan Zasukhin [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com
To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list