Reputation: 31
I am using G Unit for the first time for testing Antlr3 grammar but while running the tests, I am getting NullPointerException.
Exception occurs only when there is a method call in the action part of the grammar rule.
Example:
identifier
: name=ID
{
obj.identStmt($name.text, this.currentLine, this.currentPos);
}
;
ID: ('a'..'z'|'A'..'Z')+;
While debugging, I get NullPointerException at:
obj.identStmt($name.text, this.currentLine, this.currentPos);
I want to know if it is possible to write G unit test case for such a scenario and if yes then how and what I am doing wrong.
Thanks in advance.
Upvotes: 0
Views: 104
Reputation:
If i were u , i would use
ID : Identifier (Identifier)+;
Identifier : ('a'..'z'|'A'..'Z');
Just a thought , Your grammar stating that Id ca
Upvotes: 0