[antlr-interest] 3.0b5: help with parse puzzle

Paul Shaffer antlr1 at cyberplasm.com
Thu Nov 23 21:11:38 PST 2006


Can you suggest a fix for this?

g file:

grammar s1;
options {
    language = CSharp;
    filter=true;
}
program: string_def+  ;

string_def:  ID '=' (~'\n')+ '\n'     { Console.Out.WriteLine("found string_def"); }   ;

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

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

Input line, it can contain a '\' followed by a 'n' anywhere. Line is terminated in 0D 0A.

testline = "This is a test line I am working on "with difficulty".\n\nSometimes we meet some troublesome characters.\n\nTime's a wastin'."

Runtime error message:

[string_def]: line 0:-1 mismatched token: [@0,0:0='<no text>',<-1>,0:-1]; expecting type '\n'

Can someone interpret what this line says? I don't know how to read it.

If I turn off filtering, I also get a "no viable alt line" error on every . \ and " in the input.

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20061123/82dc3ca5/attachment.html 


More information about the antlr-interest mailing list