Hi there,
I implemented a simple grammar and I want to add support to allow empty
input. Empty input can be for example comments too. So I defined it this way
eat: (bananas)+
|
;
bananas: <lots of stuff here>
LINE_COMMENT : '//' ~('\r' | '\n')* {skip(); };
ETC...
The thing is if I put anything that does not match the grammar, i.e. empty
string, comment, whatever I get the following error when I try to get the
object that will represent my DSL:
java.lang.NullPointerException: null
at
org.antlr.runtime.tree.BaseTreeAdaptor.isNil(BaseTreeAdaptor.java:70)
~[antlr-runtime-3.2.jar:na]
at
org.antlr.runtime.tree.CommonTreeNodeStream.nextElement(CommonTreeNodeStream.java:93)
~[antlr-runtime-3.2.jar:na]
at
org.antlr.runtime.misc.LookaheadStream.fill(LookaheadStream.java:94)
~[antlr-runtime-3.2.jar:na]
at
org.antlr.runtime.misc.LookaheadStream.sync(LookaheadStream.java:88)
~[antlr-runtime-3.2.jar:na]
at org.antlr.runtime.misc.LookaheadStream.LT(LookaheadStream.java:119)
~[antlr-runtime-3.2.jar:na]
at
org.antlr.runtime.tree.CommonTreeNodeStream.LA(CommonTreeNodeStream.java:116)
~[antlr-runtime-3.2.jar:na]
at
com.feedzai.pulse.service.kpi.parser.KpiTree.script(KpiTree.java:85)
~[classes/:na]
Does anyone know how can I achieve this?
Thank you in advance,
Rui Vilao
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
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.