Hello, I'm just starting with ANTLR and try to build a VCard parser. This is the data I like to parse:
BEGIN:VCARD VERSION:3.0 N:Mustermann;Max FN:Max Mustermann ORG:Wikipedia URL:http://de.wikipedia.org/ EMAIL;TYPE=INTERNET:[email protected] TEL;TYPE=voice,work,pref:+49 1234 56788 ADR;TYPE=intl,work,postal,parcel:;;Musterstraße 1;Musterstadt;;12345;Germany END:VCARD My very first try is this: grammar VCard; BEGIN : 'BEGIN:VCARD'; END : 'END:VCARD'; VCARD : BEGIN LINE+ END; LINE : KEY DP VALUE; KEY : ~':'; DP : ':'; VALUE : ('a'..'z' |'A'..'Z' )+; But this is only a first step. I couldn't get a more complex rule to work, A problem that I open get is the message: "The following token definitions can never be matched because prior tokens match the same input" Even if I don't use that token somewhere, Could anyone maybe explain me why this very simple grammar doesn't work: grammar test; KEY : ('a'..'z' |'A'..'Z' )+; VALUE : ('a'..'z' |'A'..'Z' )+; LINE : KEY '=' VALUE; => "The following token definitions can never be matched because prior tokens match the same input: VALUE" How would I do this very simple key/value example? regards Andreas 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 -~----------~----~----~----~------~----~------~--~---
