[antlr-interest] Quick question about .stg file and output.

Alfredo Perez J. xentastic at gmail.com
Mon Jan 31 08:32:47 PST 2011


Hello, first of all, never got to thank Gordon Tyler for the response
I got to my last question, it really helped me, thank you!

Now I have another quick question, been searching around and not sure
if it's possible.

Let's say I have a .stg file that has something like this:

sometmp(arg1) ::= <<
Here is arg1: <arg1>
>>

Now, think I need to put a random character like * every 2 characters
in arg1, so the output would be like: "ar*g1*" instead of just arg1
(assuming arg1 contains "arg1").
Is it possible to "format" or manipulate in any way the text I get
from invocations between < > in the .stg file?  Or do I need to be
sure to give the correct format before giving it to the template.
(Like making sure in the .g file I do something to squeeze those *'s
into the arg1 in sometmp rewrite rule). That's what I'm doing right
now and it works, but just wondering if I could just modifiy something
in the .stg so I wouldn't need to compile again if instead of *'s now
I need % or any other character.


More information about the antlr-interest mailing list