[antlr-interest] Bug in comments

Mitra, Raj rsm at ti.com
Tue Nov 18 02:13:18 PST 2008


Hi,

This looks like a bug (version 3.1.1), can anyone please confirm?

Here is an edited version of T.g (from the antlr book):

{---------start of file -----
grammar T;
/*
// ASSIGN='='
*/
/** Match things like "call foo;" */
r : 'call' ID ';' {System.out.println("invoke "+$ID.text);} ;
ID: 'a'..'z' + ;
WS: (' ' |'\n' |'\r' )+ {$channel=HIDDEN;} ; // ignore whitespace
---------end of file-----}

Here, the only extra lines I have added are the comments.
Here is the error I get when I run antlr:

ANTLR Parser Generator  Version 3.1.1
error(10):  internal error: Exception T.g:3:9: expecting '*', found 'N'@org.antlr.tool.ANTLRLexer.nextToken(ANTLRLexer.java:333): unexpected stream error from parsing T.g
error(150):  grammar file T.g has no rules
error(100): T.g:0:0: syntax error: assign.types: <AST>:1:9: unexpected AST node: T
error(100): T.g:0:0: syntax error: define: <AST>:1:9: unexpected AST node: T

This happens with both kinds of comments: "//" as well as "/*...*/"

Best Regards
Raj


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20081118/bb837af4/attachment.html 


More information about the antlr-interest mailing list