[antlr-interest] ANTLR IDE 2.0.0: Syntax question on '.'

Graham Wideman gwlist at grahamwideman.com
Tue Feb 23 12:09:36 PST 2010


Hi Edgar,

Nice looking work on the grammar + railroad output page, as you showed here:

http://antlrv3ide.sourceforge.net/resources/ANTLRv3/ANTLRv3.html#block

Now the challenge is to get the railroad diagrams to wrap :-).

Anyhow, I spotted something that had me puzzled.  In various rules the page referenced above seems to be using dot inside single quotes to mean "any character".  I wonder whether this is an error, or is my understanding messed up?

Example:

ML_COMMENT ::= '/*' '.'* '*/' 

Wouldn't the single-quoted dot just match literal dots only?  Or is dot special inside single-quote strings (ie: STRING_LITERAL)? But if that was the case, then shouldn't that special aspect of dot show up in the STRING_LITERAL grammar?

Anyhow, I tried the above rule for ML_COMMENT in AntlrWorks and it only wanted to match comments that contained only dots.

So my comment on all this is basically:

/*.....................*/

:-)

-- Graham



More information about the antlr-interest mailing list