Hi All!
I am a newbie here and trying to test out few things with Antlr-v3.
Following is what I have written to parse quoted string and print that
parsed string on console.
For this I referred to StringLiteral definition in Java.g But somehow,
grammar written by me is not working. Am I doing something really
stupid?
Thanks,
Siddharth
Grammar -
grammar Test;
literal : q=quoted
{
System.out.println("q=>"+$q.text);
};
quoted : '"' ( EscapeSequence | ~('\\'|'"') )* '"' ;
fragment
EscapeSequence : '\\' ('\"'|'\''|'\\') ;
WS : (' '|'\r'|'\t'|'\u000C'|'\n') {$channel=HIDDEN;}
;
Errors that I get -
$ java -classpath .:output/:../../antlr-3.1.jar Run
"abcd ABCD"
line 1:1 no viable alternative at character 'a'
line 1:2 no viable alternative at character 'b'
line 1:3 no viable alternative at character 'c'
line 1:4 no viable alternative at character 'd'
line 1:6 no viable alternative at character 'A'
line 1:7 no viable alternative at character 'B'
line 1:8 no viable alternative at character 'C'
line 1:9 no viable alternative at character 'D'
q=>" "
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/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
-~----------~----~----~----~------~----~------~--~---