Dear all ANTLR users,

I have question about my rewrite rule - what is wrong with it?

type:
            (ARRAY_OF)* typ1=(simpleType|systemType|objectType)
            ->^(TYPE ^(ARRAY_OFLIST ARRAY_OF*) $typ1)
            ;

I get error when I try to check my rules (with eclipse 3.6).

var i,j:integer;

Console spits out this:

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at
org.deved.antlride.runtime.LaunchParser.invokeRule(LaunchParser.java:202)
    at org.deved.antlride.runtime.LaunchParser.launch(LaunchParser.java:130)
    at org.deved.antlride.runtime.LaunchParser.main(LaunchParser.java:228)

Caused by: org.antlr.runtime.tree.RewriteEmptyStreamException: token typ1
    at
org.antlr.runtime.tree.RewriteRuleElementStream._next(RewriteRuleElementStream.java:157)
    at
org.antlr.runtime.tree.RewriteRuleTokenStream.nextNode(RewriteRuleTokenStream.java:58)
    at Loglan82iParser.type(Loglan82iParser.java:14261)
    at Loglan82iParser.varDecl(Loglan82iParser.java:1464)
    at Loglan82iParser.varDecList(Loglan82iParser.java:1136)
    at Loglan82iParser.declaration(Loglan82iParser.java:892)
    at Loglan82iParser.declarations(Loglan82iParser.java:656)
    at Loglan82iParser.program(Loglan82iParser.java:461)
    ... 7 more

Is it a mistake to use variable like I used? I mean:

rule:
        IDN typ=(type1|type2|typ3)
        ;

My final question: is it wrong to use same var name for many rules ? I
used variable 'typ' in 4 rules. (I don't think It cause the problem, but
I'm not sure)
Ps. I'm using Eclipse (3.6.2) as my IDE and Antlr v3.3

Thank you in advance.
Adam.

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.

Reply via email to