On Jan 16, 2009, at 4:47 PM, Gerald Rosenberg wrote:

> At 03:40 PM 1/16/2009, Jim Idle wrote:
>> Gerald Rosenberg wrote:
>>> At 01:20 PM 1/16/2009, Jim Idle wrote:
>>
>> Hence, because the reference parser is simple, and does not know  
>> anything about the object it will generate code to reference, there  
>> is no way to protect you from the NPE, hence there is nothing to  
>> fix per se.
>
> Hmmm, if the code gen is smart enough to break up
>
> gDecl .setName($k. start .getStartIndex());
>
> to produce this
>
> gDecl .setName((k != null ? ((CommonToken) k.start ) :  
> null ).getStartIndex());

it only sees $k.start...nothing beyond.

> then it should be able to produce this instead
>
> gDecl .setName((k != null ? ((CommonToken)  
> k.start .getStartIndex()) : null ));

unfortunately, can't see past start in $x.y action translator.

> I did see Ter's note that the current code gen analysis is not  
> looking far enough ahead to handle this.  But, that is just one of  
> those minor, no-doubt short-lived practical inconveniences. ;-)

actually, it's 'cause I don't know what language people are using; or  
how to eval what's around the $x.y

>> It's one of those things that you have to garner some extra  
>> knowledge from by looking at the code, which you have done :-)
>
> I have to say that I am doing this less and less and, always now,  
> the issues are these kind of odd code generation issues.  The  
> evolution of Antlr as a language has been amazing to watch.  Still,  
> I look forward to when lifting the cover will not be required except  
> in the most exceptional of circumstances.

me too!

Ter

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to