[antlr-interest] Grammar problem, probably silly....
Ruth Karl
ruth.karl at gmx.de
Tue Jun 5 10:10:25 PDT 2007
Hi,
I have been trying quite a while now, but I keep getting a
MismatchedTokenException with the following simplified test grammar:
grammar JSP;
options {
language = CSharp;
output = AST;
}
@members {
boolean xmlDoc = false;
boolean outputEnabled = false;
}
@lexer::members {
boolean tagMode = false;
}
// Parser rules
jsp : oroot (content)* croot EOF
;
oroot : OPENTAG OROOT CLOSETAG
;
croot : OPENTAG '/jsp:root' CLOSETAG
;
content : TEXT
;
// Lexer rules
OPENTAG : '<' { tagMode = true; }
;
CLOSETAG : '>' { tagMode = false; }
;
TEXT : {!tagMode}?=> (~'<')+
;
OROOT : 'jsp:root'
;
The exception occurs when I print
<jsp:root>ljlj</jsp:root>
in the interpreter and tell it to start from jsp rule.
it says (4!=5), according to the generated files this is OROOT=5 and
OPENTAG=4.
Could anyone please help me with that???
Thanks a lot!
Ruth
More information about the antlr-interest
mailing list