[antlr-interest] wildcard isn't?

Jack Tanner ihok at hotmail.com
Thu Aug 2 09:26:00 PDT 2007


I have the following grammar:

line	:	comment? EOL ;
comment	:	'#' .* ;
EOL	:	'\r' | '\n' | '\r\n' ;

It fails on this input:

# foo/bar

The error relates to the slash between foo and bar. I can modify the grammar as
follows:

comment	:	'#' ( . | '/')* ;

It works fine then, but it seems bizarre that the . wildcard doesn't consume the
slash. Is that a bug, or am I misunderstanding the wildcard?




More information about the antlr-interest mailing list