[antlr-interest] ANTLR 3.0b3 : Bug ? Rule actions executed when filter=false but not when filter=true...

David CROSSON david.crosson at wanadoo.fr
Fri Aug 4 02:13:41 PDT 2006


Hello,
  sorry for posting again this message, but I don't see why
using the same data, rule and token actions are executed when
options {filter=false}; but when I use options {filter=true}
only token actions are executed !

The following example gives :

when filter=false : 
  CALLED FROM TOKEN
  CALLED FROM TOKEN
  CALLED FROM TOKEN
  CALLED FROM RULE

when filter=true :
  CALLED FROM TOKEN
  CALLED FROM TOKEN
  CALLED FROM TOKEN



-----------------------------
  grammar TryIt2Parser;
  options {
    filter=true;
    output=AST;
  }
  go : A+ {System.out.println("CALLED FROM RULE"); }
     ;
  A : 'A' {System.out.println("CALLED FROM TOKEN");}
    ;
-----------------------------
Called from the following code :
  CharStream in = new ANTLRStringStream("AAA");
  TryIt2ParserLexer lexer = new TryIt2ParserLexer(in);
  CommonTokenStream tokens = new CommonTokenStream(lexer);
  TryIt2Parser parser = new TryIt2Parser(tokens);
  parser.go();


Regards,
David


More information about the antlr-interest mailing list