FYI: http://stackoverflow.com/questions/6847971/antlr-identifier-with-whitespace
On Wed, Jul 27, 2011 at 7:39 PM, Lukas Glowania <lukas.glowa...@rub.de>wrote: > Hi, > > i want identifiers that can contain whitespace. > > |grammar WhitespaceInSymbols; > > premise : ( options {greedy=false;} : 'IF' ) id=ID{ > System.out.println($id.text); > }; > > ID : ('a'..'z'|'A'..'Z')+ (' '('a'..'z'|'A'..'Z')+)* > ; > > WS : ' '+ {skip();} > ; > | > > When i test this with "IF statement analyzed" i get a > MissingTokenException and the output "IF statement analyzed". > I thought, that by using greedy=false i could tell ANTLR to exit afer > 'IF' and take it as a token. But instead the IF is part of the ID. Is > there a way to achieve my goal? I already tried some variations of the > greed=false-option, but without success. > Thanks in advance! > > > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address > 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 il-antlr-inter...@googlegroups.com. To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.