[antlr-interest] Beginner's problem

Bryan Ewbank ewbank at gmail.com
Mon Aug 15 11:02:55 PDT 2005


I don't understand the question.  You talk about tree walker, but then
ask a question (I think) about scanner/lex operations.

If you are processing a tree of:

   #(FUNC function a1 a2 ... )

you can do something like this to add the intermediate node:

   a: #(FUNC nm ( arg )* );
   arg: old_arg { ## = #( #[QUOTE,"'"], ##); };

---------

If you are attempting to change the sequence of tokens scanned from

   NAME LEFTPAREN NAME COMMA NAME ... RIGHTPAREN

into

   NAME LEFTPAREN QUOTE NAME QUOTE COMMA ... QUOTE RIGHTPAREN

Then I'll have to leave it for others, as I don't use an antlr lexer...

On 8/14/05, vaphel at op.pl <vaphel at op.pl> wrote:
> I'm writing a tree walker and I try my tree walker modify an expresion:
> function(arg1, arg2, arg3) to function('arg1','arg2','arg3') but I don't
> know, how I can do it.
> 
> I tried to add a node QUOT (='\'') after a current node equal "("and ","
> and before ")" and "," but I can't find a method which can insert a node
> between current and next node.


More information about the antlr-interest mailing list