[antlr-interest] RewriteEmptyStreamException when changing from quoted string to token?
Jon Schewe
jpschewe at mtu.net
Fri Jan 4 08:32:38 PST 2008
I have the following parser rule and lexer rule (others exist as well).
I'm using antlr 3.0.1. If I change '*' in multExpr to PRODUCT then at
runtime I get an exception. If I leave it at '*', all is fine. What am
I doing wrong here?
[junit] token PRODUCT
[junit] org.antlr.runtime.tree.RewriteEmptyStreamException: token
PRODUCT
[junit] at
org.antlr.runtime.tree.RewriteRuleElementStream._next(RewriteRuleElementStream.java:158)
[junit] at
org.antlr.runtime.tree.RewriteRuleTokenStream.next(RewriteRuleTokenStream.java:57)
/**
* @param negate if true, negate all expressions by multiplying by -1
*/
multExpr[boolean negate]
: atom ('*' atom)* -> {negate}? ^(PRODUCT ^(NUMBER DOUBLE["-1"])
atom+)
-> ^(PRODUCT atom+)
;
PRODUCT : '*' ;
--
Jon Schewe | http://mtu.net/~jpschewe
If you see an attachment named signature.asc, this is my digital
signature.
See http://www.gnupg.org for more information.
For I am convinced that neither death nor life, neither angels
nor demons, neither the present nor the future, nor any
powers, neither height nor depth, nor anything else in all
creation, will be able to separate us from the love of God that
is in Christ Jesus our Lord. - Romans 8:38-39
More information about the antlr-interest
mailing list