[antlr-interest] Creation of new tree nodes

Gavin Lambert antlr at mirality.co.nz
Sat Aug 23 03:43:45 PDT 2008


At 17:07 23/08/2008, Greg Smolyn wrote:
 >However, ANTLR 3.1 seems to be unhappy with the syntax.
[...]
 >	| ^(STMT expression) -> { 
$statement::DocumentWriteContents!=null
 >}?
 >                              ^(STMT
 >                                (BLOCK
 >                                 (STMT (VAR["var"] 
(ASSIGN["="]
 >Identifier["_SL_temp"] (CALL (BYFIELD Identifier["document"]
 >Identifier["createElement"]) (ARGS StringLiteral["'div'"])))))
 >                                 (STMT (ASSIGN["var"] (BYFIELD
 >Identifier["_SL_Temp"] Identifier["innerHTML"])
 >$statement::DocumentWriteContents ))
 >                                 (STMT (CALL (BYFIELD (BYFIELD
 >Identifier["document"] Identifier["body"])
 >Identifier["appendChild"])
 >(ARGS Identifier["_SL_Temp"])))))
 >                            -> ^(STMT expression)

Wow, that's a long rewrite.

Anyway, you need to either lose the extra parentheses (to get a 
flat list) or add extra ^s (to get subtrees).



More information about the antlr-interest mailing list