Indhu Bharathi wrote:
Yes, I've read that page earlier and I understand it (and that is how I've solved the problem for now). Without syntactic predicates I understand ANTLR Lexer will try matching the longer string and might fail in the middle. But when a syntactic predicate (which is a gated semantic predicate) is placed before the production, shouldn't ANTLR first try the predicate and go on and match the production only if the syntactic predicate passes like what Terence says here: http://www.antlr.org/pipermail/antlr-interest/2009-March/033526.html This needs to move antlr-interest, it isn't a bug. grammar Test;1. does not work because ANTLR only looks ahead enough to predict the alt, not to match the alt. so it sees NUMBER, then it only needs to know if there is a DOT or not to select alt 1 or 2. SO it sees a '.' then tells you your floating point number is in error. Hence your grammar is incorrect. You need to left factor for a start, then use a semantic gated predicate to predict the float part (You need to look past the '.' and make sure there is a digit. 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
