[antlr-interest] How to come up with catch-all rules?

Geoffrey Zhu gzhu at peak6.com
Fri Nov 17 11:27:02 PST 2006


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?
 
Best regards,
Geoffrey
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20061117/2e6a6300/attachment.html 


More information about the antlr-interest mailing list