[antlr-interest] Antlr bug?

Miguel Ping miguel.ping at gmail.com
Mon Apr 16 16:40:13 PDT 2007


Hi all,

I'm writing a sql 2 java translator, and I have a strange bug.

I got this query:

SELECT  p.prop1, a.prop2, b.prop3, c.prop4 from properties
>

and antlr generates me this tree:

select
> SELECT_LIST
>    COLUMN_REFERENCE_LIST
>       TABLE_ID
>          p
>       .
>       prop1
>    ,
>    COLUMN_REFERENCE_LIST
>       TABLE_ID
>          c
>       .
>       prop4
>    ,
>    COLUMN_REFERENCE_LIST
>       TABLE_ID
>          c
>       .
>       prop4
>    ,
>    COLUMN_REFERENCE_LIST
>       TABLE_ID
>          c
>       .
>       prop4
> from
> TABLE_REFERENCE_LIST
>    TABLE_ID
>       properties


If you notice carefully, antlr is replacing all identifiers (table and
column ids)with the last one, except for the first. the tree should be
reading p,a,b,c TABLE_ID's and prop1,2,3,4 . This happens for an arbitrarily
big column list; only the first one gets it right. I think I may have a bug
with some list creation in my parser, but debugging in antlrworks (great
work btw, debugger is really neat) shows me the correct identifiers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070417/0a262323/attachment.html 


More information about the antlr-interest mailing list