[antlr-interest] accepting nested code blocks
Espák Miklós
espakm at gmail.com
Tue Oct 13 09:33:32 PDT 2009
Hi,
I want to create a lexer rule accepting nested code blocks.
I tried out the example of the Definitive ANTLR Reference (Section 4.3), but
it does not work.
It accepts only such inputs which do not contain any character other than
curly braces. Moreover, one closing brace is enough.
The error is the following:
MismatchedTokenException: line 1:1 mismatched input UNKNOW expecting 125
The original code of the book:
fragment
CODE[boolean stripCurlies]:
'{' ( CODE[stripCurlies] | ~('{' |'}' ) )* '}'
{
if ( stripCurlies ) {
setText(getText().substring(1, getText().length()));
}
}
;
The simplified version of the rule results the same:
fragment
Block: '{' ( Block | ~('{'|'}') )* '}';
I use ANTLR 3.2.
Does anybody have an idea, how to get around this?
Thanks,
Miklos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091013/dcf56e53/attachment.html
More information about the antlr-interest
mailing list