Helo,

I'm trying to create a Tree Grammar to walk my ASTs, and I encountered a
problem:

I have these tree grammar rules (which are relevant, I guess):

query_specification
        : ^(selectClause (^(INTO intoClause))? (^(FROM fromClause))? (^(WHERE
whereClause))? (^(GROUP groupbyClause))? (^(HAVING havingClause))?)
        ;

selectClause
        :
        ^(SELECT ALL? DISTINCT? (^(TOP INT (PERCENT)? (WITH TIES)?))?
^(SELECTLIST selectList))
        ;
selectList
        : selectItem+
        | selectAssignment+
        ;

And for an AST like:

(SELECT (SELECTLIST (CONSTANT 1) (CONSTANT 2)) (FROM myTab)))

I got MismatchedTokenException for the FROM clause. But if I put (^(FROM
fromClause))? into the selectClause rule:

selectClause
        :
        ^(SELECT ALL? DISTINCT? (^(TOP INT (PERCENT)? (WITH TIES)?))?
^(SELECTLIST selectList) (^(FROM fromClause))?)
        ;

It can walk the tree. Why?


 Thanks,
   Zoli


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