Use the debugger, not the interpreter. However your parsing rules are ambiguous - switch from literals to real lexer tokens and look at the error messages that ANTLR works gives you if you try to debug this.
Jim > -----Original Message----- > From: [email protected] [mailto:antlr-interest- > [email protected]] On Behalf Of Ben Corne > Sent: Thursday, March 10, 2011 5:55 AM > To: [email protected] > Subject: [antlr-interest] simple annotation parser > > Hello > > I'm trying to parse the examplary lines: > example1: "//@author Ben Corne" > example2: "//@ this is an example docstring" > > However, when running this in the interpreter window on example 1 or 2, > it always seems to cut off the last last part of the letters in the > resulting > tree: > http://igor.rave.org/annotation.png > > here's my attempt so far: > ------------------------------- > grammar Annotation; > > options { > language = Java; > output = AST; > } > > @header{ > package edu.vub.at.parser; > } > @lexer::header{ > package edu.vub.at.parser; > } > > annotation > : '//@' rule > ; > > rule > : ('\t'|'\n'|' '|'\r')* author > | docstring > ; > > // Documentation rules > author > : 'author'! > (( '\t' | ' ' )+)! > .* > EOF > ; > > docstring > : (( '\t' | ' ')+)! > .* > EOF > ; > ------------------------------- > > 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.
