[antlr-interest] A question about extracting comments
Bogdan Mitu
bogdan_mt at yahoo.com
Fri Oct 11 08:43:39 PDT 2002
Hi,
If you use k=4, you will probably get rid of the nondeterminism, since "rem
" contains a space, while IDENT doesn't.
But are you sure "rem " it's what you really want? What about "rem" followed
by a tab?
Regards,
Bogdan
--- Fan Yang <yhhf_dy at yahoo.com> wrote:
> Hi everybody,
>
> I'm new to Antlr. I want to develop a parser for a language. In the
> language it uses REM and ' as keywords for comment. I wrote the
> following grammar to deal with comments. for ' kind of comments is
> ok. But it is obviously that "rem " is nondeterminism upon IDENT. But
> I don't know how to remove it. Would you please help me erase the
> nondeterminism error.
>
> thanks a lot.
>
> COMMENT
> : "rem "
> | '\'' (~('\n'|'\r'))* ('\n'|'\r'('\n')?)
> {$setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP); newline();}
> ;
>
> IDENT
> options {testLiterals=true;}
> :('a'..'z'|'_') ('a'..'z'|'_'|'0'..'9')*
> ;
>
> WS_
> :(' '
> | '\t'
> ){ _ttype = ANTLR_USE_NAMESPACE(antlr)Token.SKIP; }
> ;
>
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list