What if you place all your keyword rules before the TEXT rule? I can't remember if ordering matters in ANTLR like it does in Xtext. I'm assuming it does since Xtext uses ANTLR.
- Darin -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Peter Hull Sent: Wednesday, July 07, 2010 12:58 PM To: [email protected] Subject: [antlr-interest] keywords and arbitrary text Hi all, here is a quick question from a new user. I have a simple language I want to parse. Each line is a separate command and each command looks something like KEYWORD param param... e.g. SetGate 10 4.5 However there's a title command that can take any text up to the end of line, e.g Title Configuration 1 or even Title This is a Title I had a rule TEXT: ~('\n'|'\r')+ but this (I think) matched all the keywords too, even if I used tokens {...} Is there a way to say that the TEXT token is only to be used after Title? I saw something on island grammars but I couldn't understand it to be honest. Pete 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 [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.
