Adrian Ber wrote:
Add a predicate to make sure the terminating quote is present, if it is not then the alt will fail and you can let the lexer return just the single quote. HTML is not an easy thing to parse using an ANTLR grammar; I would not suggest this as your first grammar :-( STRING : (DQUOTE_STRING)?=> DQUOTE_STRING | (SQUOTE_STRING)?=> SQUOTE_STRING | '"' { $type = DQUOTE; } | '\' { $type = SQUOTE; } ; fragment SQUOTE : '\'' ; fragment DQUOTE : '"'; fragment SQUOTE_STRING : '\'' (ESC|~('\''|'\\'|'\n'|'\r'))* '\'' ; fragment DQUOTE_STRING : '"' (ESC|~('"'|'\\'|'\n'|'\r'))* '"' ; It is always worth experimenting Jim --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~--- |
List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
