[antlr-interest] v3 c# code gen: filter=true problem

Paul Shaffer antlr1 at cyberplasm.com
Fri Nov 24 13:33:10 PST 2006


At 04:51 AM 11/24/2006, Micheal J wrote:
>Hi,
>
>Don't think filtering mode is implemented for parsers in v3 [yet?].
>
>For lexers, the FuzzyJava filtering example works fine.
>
>What does your grammar look like?

Test case for grammer is below. If filter=true nothing is matched, even the 
input lines I know will match the string_def rule. If false the correct 
matches are found. I'm sure I completely misunderstand the purpose of 
filter or where to use it. The fuzzyJava example is just a lexer, perhaps 
that's my problem.


grammar s1;

options {
         language = CSharp;
         filter=true;
}

program: string_def* ;

string_def: LINE { Console.Out.WriteLine("string_def: " + $LINE.Text); } ;

LINE: ID WS* '=' (~'\n')+ '\n' ;

ID  :   ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')* ;

WS  :   (' '|'\n'|'\r')+ {$channel=HIDDEN;} ;




More information about the antlr-interest mailing list