[antlr-interest] TokenStreamRewriteEngine: possible to use non-terminals instead of tokens?
saintiss at arklinux.org
Wed Feb 4 06:52:15 PST 2004
-----BEGIN PGP SIGNED MESSAGE-----
I got the TokenStreamRewriteEngine working so that it just gives back the
original string of what was parsed...
Using the java.g grammar, what I would like to do now is delete the type
specifier from a declaration statement:
"int myInt = 7;" => "myInt = 7;"
This should only be done when the declaration is a statement, and not when it
is a class field for example...
So it should only apply for the rule:
: (declaration)=> declaration SEMI!
However, it seems that the rewriteEngine can only delete a range of tokens.
SEMI is a token, but "declaration" is not so it seems (I guess its type is
"void" since that's the return type of the declaration() method?). Still, I
can't put the replace action where the type token is, because that's in the
"identifier" rule, which would mean all identifiers would be deleted...
So is there a way I can "navigate" from "declaration" to the typeSpec and then
to the identifier token in order to remove it?
Thanks in advance,
Ark Linux - Linux for the Masses (http://arklinux.org)
You don't have any cows. The bank will not lend you money to buy cows,
because you don't have any cows to put up as collateral.
You have two cows. Your neighbors pick someone to tell you who gets the milk.
In a world without walls and fences, who needs windows and gates?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
-----END PGP SIGNATURE-----
Yahoo! Groups Links
To visit your group on the web, go to:
To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
Your use of Yahoo! Groups is subject to:
More information about the antlr-interest