alexander wrote:
sorry to bother again ...

i downloaded antlr's sources and a
grep -r "output \?= \?template" `find -name *.g*`

to find any grammars with output=template results in one reference, 
which is commented out:
./tool/src/main/antlr/org/antlr/grammar/v3/ActionTranslator.g:  // 
output=template;  TODO: can we make tokens return templates somehow?

Terence Parr schrieb:
  
also codegen.g
    
do you mean
tool/src/main/antlr2/org/antlr/grammar/v2/codegen.g ?

there is no output using the -> operator :(

however, i was able to get things started(jihaaa).

now i'm looking for a nice solution for something like this:
somerule
     : a=something (b=maybe)?
         -> sometemplate(a={$a.st}, b={$b.st})
     ;
here the b is optional, if it's not there b.st will raise a npe.
  

 
:           {
		$st = %sometemplate();
	}
	a=something              { %{$st}.a = $a;  }
		(
			{b=maybe { %{$st}.b = $b;  }
		)?

or
a=something 
      (  b=maybe
         -> sometemplate(a={$a.st}, b={$b.st})
       | -> sometemplate(a={$a.st})
      )


sometemplate(a, b) ::=
<<
<if(b)>b was here<endif>
......
>>


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to