I finally upgraded my ANTLR version from 3.0.1 to 3.1
I'm using ANTLRWorks 1.2b5 and and C# libraries that came with ANTLR v3.1b1
(since I couldn't find any in 3.1)
I have a tree grammar with a line that looks like:
block : thelb=LBRACE (blockExprList)? RBRACE ->
^(BLOCK[$thelb] blockExprList?);
In the previous version of ANTLR, this did what I expected - create a BLOCK
node with syntax information taken from the LBRACE token. Now, it just gives me
a null pointer exception, claiming that thelb is null.
The input is:
{ 1; }
My full grammar consists of the following:
grammar LangTest;
options
{language = 'CSharp2';
output=AST;
ASTLabelType=CommonTree;
}
tokens {
PROG;
BLOCK;
}
prog : topLevelExprList? -> ^(PROG topLevelExprList?)
;
topLevelExprList
: (blockExpr)+
;
blockExpr
: statement
;
statement
: (block)=>block
| emptyStatement
| numericLiteral SEMI!
;
emptyStatement
: emptyExpr SEMI!
;
emptyExpr
:
;
block : thelb=LBRACE (blockExprList)? RBRACE ->
^(BLOCK[$thelb] blockExprList?);
blockExprList
: (blockExpr)+
;
numericLiteral
: DECIMALLITERAL;
WS :
(' '
| '\t'
| '\n'
| '\r'
| '\u000C')
{ $channel = HIDDEN; }
;
LBRACE : '{';
RBRACE : '}';
SEMI : ';' ;
DECIMALLITERAL
: INT;
fragment
INT
: ('0' | '1'..'9' ('0'..'9')*);
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address