[antlr-interest] Using labels in actions of a tree parser

Oliver B. Fischer o.b.fischer at gmx.de
Wed Aug 13 14:04:22 PDT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

But is there a way to get access to the tree node itself? I tried to use
the ".tree" attribute, but it leads to an compile error, since .tree
isn't translated to ".getTree()".

So, what can I do to get the tree node?

Bye

Oliver

Oliver B. Fischer schrieb:
| Dear all,
|
| I would like to use labels in the actions of my tree parser to have an
| alternative way to access the tree nodes. Unfortunately ANTLR reports an
| error I can't understand.
|
| Here is my action definition:
|
|
| term returns [DataType rt]
|   : factor { $rt = $factor.rt; }
|     -> template(f={$factor.st})"<f>"
|   | ^(ASTERISK t1=term t2=term)
|   | ^(SLASH t1=term t2=term)
|   | ^(AND t=term term)
|     { System.out.println($t); }
|   ;
|


- --
Oliver B. Fischer, Schönhauser Allee 64, 10437 Berlin
Tel. +49 30 44793251, Mobil: +49 178 7903538
Mail: o.b.fischer at gmx.de Blog: http://www.sw-blog.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkijTFYACgkQbyc4N0PdoAzBFwCgzYfQHP9luDnCwF8/doZXw+w8
McgAn3TiHdDJ6sPO/UDbOFbuXcEBjvLh
=uzjK
-----END PGP SIGNATURE-----


More information about the antlr-interest mailing list