ANTLR code question about a sample presented in a tutorila that is not compatible with 2.7.2 version
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jose_Carlos
Posted On:   Sunday, March 14, 2004 08:51 AM

I tried to run the sample to detect multiple-line comments with the code that is presented in an ANTLR tutorial: // multiple-line comments ML_COMMENT : ""/*"" ( { LA(2)!='/' }? '*' | (' '|"" ""|' ') { newline(); } | ~('*'|' '|"" ""|' ') )* ""*/"" { $setType(Token.SKIP); } ; but the version 2.7.2 gives the following error: subrule cannot be inverted. only subroules of the form (T1|T2|T3....) or ('C'1|'C2'|'C3'.....)can be inverted. What could be a solution to that problem? regards jc    More>>

I tried to run the sample to detect multiple-line comments with the code that is presented in an ANTLR tutorial:

// multiple-line comments
ML_COMMENT
: ""/*""
( { LA(2)!='/' }? '*'
| ('
'|""
""|'
') { newline(); }
| ~('*'|'
'|""
""|'
')
)*
""*/""
{ $setType(Token.SKIP); }
;

but the version 2.7.2 gives the following error:
subrule cannot be inverted. only subroules of the form (T1|T2|T3....) or ('C'1|'C2'|'C3'.....)can be inverted.

What could be a solution to that problem?

regards

jc

   <<Less
About | Sitemap | Contact