Referring to The Definitive ANTLR Reference, page 220
"You can also have multiple command queues to get multiple rewrites from a
single pass over the input such as generating both a C file and its header
file (see the TokenRewriteStream Javadoc for an example)"
said example:
/* You can also have multiple "instruction streams" and get multiple
* rewrites from a single pass over the input. Just name the instruction
* streams and use that name again when printing the buffer. This could be
* useful for generating a C file and also its header file--all from the
* same buffer:
*
* tokens.insertAfter("pass1", t, "text to put after t");}
* tokens.insertAfter("pass2", u, "text after u");}
* System.out.println(tokens.toString("pass1"));
* System.out.println(tokens.toString("pass2"));
*
* If you don't use named rewrite streams, a "default" stream is used as
* the first example shows.
*/
I don't see how to apply this in the context of the CMinus.g 1pass rewriter.
This example uses inline template definitions to rewrite, and the syntax for
doing that:
... -> template-name(<<attribute-assignment-list>>)
doesn't have any obvious way to specify the non-default instruction
stream... to generate a replace(String,...) instead of replace(...) in the
parser file.
If this functionality is enabled, the documentation for getting to it is not
obvious. Is this a V2/V3 issue? The tweak example seems like it might be
closer than 1pass rewriter, but it doesn't look consistent with the book's
techniques.
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.