You're absolutely right, sry I gave up so early on ANTLR. Now everything works fine and I'm surprised how easy it is to work with it. Thank you for your help!
2011/5/15 John B. Brodie <[email protected]> > You have chosen a rule name that clashes with a Java class name, e.g. > Integer. > > Select another name for your current Integer lexer rule. > > In my opinion this is not an ANTLR problem, rather it is a user error. > > On Sat, 2011-05-14 at 23:45 +0200, Dominik Halfkann wrote: > > Here are the generated java parts. But I think it's weird, if it's not an > > ANTLR problem, that would mean ANTLR builts java-files with errors, > doesn't > > it? :o > > Moreover, I've copy-pasted this gramma part from an example ( > > http://www.antlr.org/wiki/display/ANTLR3/Expression+evaluator), so this > > shouldn't happen at all. :( > > I will check the problem with eclipse late on, but It's weird that the > > generated .java is incorrect imo. > > > > public final int mathAtom() throws RecognitionException { > > int value = 0; > > Token i=null; > > int e = 0; > > > > [...] > > i=(Token)match(input,Integer,FOLLOW_Integer_in_mathAtom984); if > > (state.failed) return value; > > [...] > > value = Integer.parseInt((i!=null?i.getText():null)); > > [...] > > } > > > > 2011/5/14 Jeff Hair <[email protected]> > > > > > http://www.coderanch.com/t/379354/java/java/int-not-dereferenced-means > > > > > > < > http://www.coderanch.com/t/379354/java/java/int-not-dereferenced-means > >Doesn't > > > look like it's an ANTLR problem. Check the data type of value. > > > > > > On Sat, May 14, 2011 at 8:50 AM, Dominik Halfkann < > > > [email protected]> wrote: > > > > > >> Hello everybody, > > >> > > >> I have a problem with ANTLR and I hope it's ok that I'm asking that > here. > > >> I > > >> also posted something in the forum, but it seems to be very inactive > > >> depending on other posts I saw there... > > >> > > >> (from http://www.jguru.com/forums/view.jsp?EID=1639158) > > >> When I want to debug/compile my grammar, I allways get the error > message: > > >> > > >> [14:03:38] D:\[...]\ANTLR Parser\output\SGLParser.java:2532: int > > >> cannot be dereferenced > > >> [14:03:38] value = > > >> Integer.parseInt((i!=null?i.getText():null)); > > >> > > >> I don't have an explanation for that, maybe someone can help me here. > Here > > >> are the important code fragments: > > >> > > >> grammar SGL; > > >> options { > > >> backtrack = true; > > >> memoize = true; > > >> } > > >> > > >> [...] > > >> > > >> mathAtom returns [int value] > > >> : '(' e=mathExpression ')' {$value = $e.value;} > > >> | i=Integer {$value = Integer.parseInt($i.text);} > > >> ; > > >> > > >> [...] > > >> > > >> Integer > > >> : '0'..'9'+ > > >> ; > > >> > > >> > > >> Thank you in advance > > >> > > >> Dominik > > >> > > >> List: http://www.antlr.org/mailman/listinfo/antlr-interest > > >> Unsubscribe: > > >> > http://www.antlr.org/mailman/options/antlr-interest/your-email-address > > >> > > > > > > > > > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address > > > > 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.
