Hi David, ANTLR's lexer greedily matches characters: the input "PRCLINTON" is being tokenized as a single VALUE-token, not as a PR- and VALUE-token.
Regards, Bart. On Mon, Oct 31, 2011 at 6:24 PM, Weiler-Thiessen, David, SASKATOON, Engineering <david.weiler-thies...@purina.nestle.com> wrote: > Hi > > > > I am trying to parse a string that is a collection of tokens and values. > For example: > > PRCLINTON > > > > Where PR is my token, and CLINTON is the value for the token. > > > > I have started a simple grammar, see below, but it won't parse the sample > above. > > > > message : productionReceipt > > ; > > > > productionReceipt > > : PR VALUE > > ; > > > > PR : 'PR' > > ; > > > > VALUE : ('a'..'z'|'A'..'Z')+ > > ; > > > > > > What am I doing wrong? I get a MisMatchedTokenException in ANTLRWorks. > > David Weiler-Thiessen > Nestlé Purina PetCare > phone: 306-933-0232 > cell: 306-291-9770 > > This e-mail, its electronic document attachments, and the contents of its > website linkages may contain confidential information. This information is > intended solely for use by the individual or entity to whom it is > addressed. If you have received this information in error, please notify > the sender immediately and promptly destroy the material and any > accompanying attachments from your system. > > > 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.