[antlr-interest] How to come up with catch-all rules?
David Holroyd
dave at badgers-in-foil.co.uk
Fri Nov 17 12:03:01 PST 2006
On Fri, Nov 17, 2006 at 01:27:02PM -0600, Geoffrey Zhu wrote:
> Hi All,
>
> I am writing a code generator with ANTLR 2.x. Like ANTLR itself, the
> program is going to generate a framework and fill in handwritten code in
> the right places. For example, in the following code:
>
> handler abc_name (x, y, z)
> {
> //hand-written code here
> }
>
> I'd like my code generator to dump the handwritten code between the {
> and } to an output file, without the code generator caring about the
> syntax of those code. But I cannot seem to be able to come up with a
> rule that can match arbitrary text between { and }. One thing I can come
> up with is { #include "file_name"} and have my code in a separate file,
> but this is extremely awkward.
>
> Does anyone know how to best solve this problem?
This 'parrt' guy does:
http://fisheye2.cenqua.com/browse/antlr/src/org/antlr/tool/antlr.g?r=3244#l1186
;)
dave
--
http://david.holroyd.me.uk/
More information about the antlr-interest
mailing list