[antlr-interest] Nested multi-line comments
Graham Wideman
gwlist at grahamwideman.com
Sat Oct 24 18:03:26 PDT 2009
Peter:
I surmise from this that your main test routine is trying to call g.ML_COMMENT, when it should be calling the top level (starting) lexer rule method:
g.code();
-- Graham
At 10/25/2009 01:03 AM, Peter Boughton wrote:
>Thanks John, but this doesn't appear to be working.
>(I'm using antlr 3.2 with antlrworks 1.3)
>
>I tried it both as provided and with changing the comment start/end
>characters, and both of these give the same error in the generated
>Java code:
>
> C:\tmp\antlr\__Test__.java:14: cannot find symbol
> symbol : method ML_COMMENT()
> location: class cfml_comment_testParser
> g.ML_COMMENT();
> ^
> 1 error
>
>I'm testing this with a very basic set of rules at the moment:
>
> grammar cfml_comment_test;
>
> ML_COMMENT : NESTED_COMMENTARY { $channel=HIDDEN; } ;
>
> fragment NESTED_COMMENTARY :
> '<!---'
> ( options {greedy=false;} : . )*
> ( NESTED_COMMENTARY ( options {greedy=false;} : . )* )*
> '--->'
> ;
>
> WS : ( ' ' | '\t' | '\n' | '\r' ) {$channel=HIDDEN;} ;
>
> TEXT: ~'<' ;
>
> code: ( ML_COMMENT | WS | TEXT )+;
More information about the antlr-interest
mailing list