[antlr-interest] two requests

Dmitry Lizorkin lizorkin at ispras.ru
Wed Oct 3 04:21:43 PDT 2007


Hello!

1. When both a rewriting rule and a ^ operator suffix in the matching part 
are presented, e.g,

g_Field
 : G_IDENTIFIER ':'^ -> ^(AST_FIELD G_IDENTIFIER)
 ;


ANTLR reports a very non-obvious (at least for me) error message:

error(10):  internal error: test.g : java.lang.IllegalArgumentException: 
Can't find template tokenRefRuleRootTrack.st

The meaning behind this error message is quite hard to locate, as niether 
the initial reason for the problem nor the line number within the grammar 
are reported. Could the error message for this case be improved in the 
future versions of ANTLR ?

2. If the following rewriting rule is written

G_IDENTIFIER
 : ('a'..'z' | 'A'..'Z') ('a'..'z' | 'A'..'Z' | '0'..'9' | '_')*
   -> ^(AST_ID G_IDENTIFIER)
 ;

ANTLR crashes with a java.lang.NullPointerException. The rewriting rule 
above may be syntactically/semantically incorrect, but I definitely would 
not expect ANTLR to crash in the case. Could this be a kind of a bug?

Dmitry



More information about the antlr-interest mailing list