There are a few problems with that method I have overcome:
1. It uses sempreds. Sempreds break the heavy optimizations I'm working on integrating into the ANTLR compiler. 2. It uses actions. Mine also uses an action, but it's a simple one that could easily be altered for a different target. It's also easier to make use of this rule across languages with varying number semantics (alterations to the rule would likely be minimal if required). Interleaved actions also hurt the optimizer; here I restricted it to the @after section but I can move it to NextToken() later if necessary. 3. There are several places in the IntelliSense engine where it doesn't matter whether or not the number is valid. For those I disable the classifier and its messages to favor IDE response times. In a setting where these are not issues, I really understand where you're coming from with your rule. It's a great example of the measures a compiler designer should take to make the system able to provide clearly understandable, localized messages in the face of a wide variety of errors, and more people should work like that. Nevertheless, I still think ANTLR is generating incorrect code for way I originally tried to structure the rule. Sam From: [email protected] [mailto:[email protected]] On Behalf Of Jim Idle Sent: Wednesday, April 22, 2009 11:52 AM Cc: [email protected] Subject: Re: [antlr-interest] Relaxed number format lexer problem Sam Harwell wrote: I'm using a heavily relaxed NUMBER token in my lexer so I can provide better error messages. The problem I'm having occurs when input such as 1..2 is reached. The '..' should be an OP_RANGE token, not part of the number. Please check the wiki for things like this, this is an FAQ witch a complete example: http://www.antlr.org/wiki/display/ANTLR3/Lexer+grammar+for+floating+poin t%2C+dot%2C+range%2C+time+specs 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
