[antlr-interest] Problem using my own AST class

Jim Idle jimi at temporal-wave.com
Mon Jul 2 08:44:18 PDT 2007


It may be the point in which you are initializing the line. The column should be zero I think, but the line being zero tends to make me think that perhaps the first token causes the line to be set AFTER you have dealt with it. 

However what are you using to decide the line number for the AST? The line and offset should be in the token itself, so maybe it is just a matter of getting this from somewhere else.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Hélène Ortiz
> Sent: Monday, July 02, 2007 7:42 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Problem using my own AST class
> 
> Hi,
> 
> In order to have column and line set for my AST
> instances, I have created
> my own class which extends CommonAST.
> 
> It works fine, except for one type of command: a
> command with only one word:
> 
> > count
> 
> The resulting AST instance has 0 value for both line
> and column, whereas
> the command :
> 
> > count 10
> 
> generates an AST instance with correct values for line
> and column.
> 
> Any idea ?
> Thanks a lot for your help
> 
> 



More information about the antlr-interest mailing list