[antlr-interest] Re: Manually insert a node into an automatically contructed tree

Terence Parr parrt at cs.usfca.edu
Sat Mar 13 09:06:10 PST 2004


On Mar 13, 2004, at 4:20 AM, oliver_kellogg wrote:

> Terence Parr wrote:
>
>>> Is it possible to insert an artificial (dummy) item in the tree
>>> that is automatically constructed for a rule?
>>
>> Yes. It looks like you are doing so below...doesn't that work?
>
> It does work for the C++ targeted grammar, but it
> doesn't for the Java targeted one which I am currently
> working on:
>
> AdaParser.java:7061: exception antlr.RecognitionException is never
> thrown in body of corresponding try statement
>
> This happens while translating the method empty_component_items()
> which is produced by the rule
>
> empty_component_items :
>   { #empty_component_items =
>     #(#[COMPONENT_ITEMS,
>        "COMPONENT_ITEMS"], #empty_component_items); }
>   ;

Oh, sorry about that...that rule has no content to match.  Put this 
imaginary root generation code in the rule where you actually match 
stuff that needs an imaginary root.

:)

Ter
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!
Cofounder, http://www.peerscope.com pure link sharing





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list