Hi All,

ANTLR grammar acts funny when it encounters a TOKEN in a String. How should
I make the ANTLR escape the letter found in the String is not a TOKEN.

Help will be appreciated.

Thanks
Hiten

Example
text_content.txt
funny boys are Tom Hardy Donald
serious guys are not funny either

grammar
options {
    language=Java;
    k=1;
}

start
  : 'funny' call_funny_parse
  | 'serious' call_serious_parse
  ;

call_funny_parse
@init {
  ArrayList<String> person = new ArrayList<String>(); //this should contain
Tom Hardy Donald
}
  : jackT=TOKEN    //boys
    macT=TOKEN   //are
    (nextPersonT=TOKEN { person.add($nextPersonT.text); })* // Tom Hardy
Donald
  ;

call_serious_parse
@init {
  String line = "";
}
  : (stringT=TOKEN { line = line + $stringT.text; })* // This is where is
fails and says 'funny' is expecting something else

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 [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.

Reply via email to