Greetings! On Sun, 2010-08-29 at 07:40 -0700, Ted Hoise wrote: > VERY simple example > > rule : 'H' ; > > When I test this very simple rule, it works (in Antlrworks and Eclipse) of > course for input 'H', but it also works for input 'fH', resulting in a token > 'fH'. I do I suppress this behavior: it seems like an error should occur. >
Unable to reproduce. When I run your examples from the command line I do indeed get an error on the second example. Maybe there is something unexpected/unusual about your test rig? (i have attached the grammar i used in my test so you can compare it to yours) Hope this helps -jbb
grammar Test; options { output = AST; ASTLabelType = CommonTree; } @members { private static final String [] x = new String[] { "H", "fH" }; public static void main(String [] args) { for( int i = 0; i < x.length; ++i ) { try { System.out.println("about to parse:`"+x[i]+"`"); TestLexer lexer = new TestLexer(new ANTLRStringStream(x[i])); CommonTokenStream tokens = new CommonTokenStream(lexer); TestParser parser = new TestParser(tokens); TestParser.rule_return p_result = parser.rule(); CommonTree ast = p_result.tree; if( ast == null ) { System.out.println("resultant tree: is NULL"); } else { System.out.println("resultant tree: " + ast.toStringTree()); } System.out.println(); } catch(Exception e) { e.printStackTrace(); } } } } rule : 'H' ;
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 il-antlr-inter...@googlegroups.com. To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.