[antlr-interest] tree grammar question: how to say "anything"
    Terence Parr 
    parrt at cs.usfca.edu
       
    Fri Aug 17 13:06:58 PDT 2007
    
    
  
On Aug 17, 2007, at 9:15 AM, Andy Tripp wrote:
> If I have the following parser rule, with no rewrite:
>
> guid:
>   '{' ~('}')* '}'
>   ;
>
> ...and assume I have some other parser rule:
>
> otherRule:
>    'A' ^(GUID guid) 'B'
>    ;
that ^(...) is in a tree parser, right?
> What would my tree grammar rule for guid look like?
> I need Something like:
>
> myGuidTreeRule:
>    GUID blah*
>    ;
wildcard . matches either a single node if leaf or whole subtree if  
root.  will that help?
Ter
>
> ...where I want "blah" to mean "any AST whatsoever" (or I guess
> actually "any AST other than a StringLiteral with text '}')
> Does the treegrammar grammar have any such construct? If not,
> can I do it "by hand" somehow?
    
    
More information about the antlr-interest
mailing list