[antlr-interest] adding content at end of rule with TokenRewriteStream

Terence Parr parrt at cs.usfca.edu
Wed Feb 21 11:51:02 PST 2007


Hi.  Try using $rule1.stop attribute to get last token.
Ter
On Feb 21, 2007, at 8:32 AM, Jean Marc Vanel wrote:

> Suppose I have such rules :
>
>
>
> rule1 : A B* C?
>
> rule2 : A BB? C*
>
> rule3 : A BBB* C*
>
>
>
> I’d like to add content after C (when C is present ), using  
> TokenRewriteStream.insertAfter() .
>
> When C is not present, calling . insertAfter( C.stop, “my  
> content” ) triggers a NullPointerException.
>
>
>
> In all the « tweak »  example, one only adds content around  
> unconditional items, i.e. ones with cardinality 1 or + .
>
>
>
> Thanks
>
>
>
> Jean Marc Vanel
> Developer
> Journal: file://///fr-vanelj-dev.mathworks.fr/Aslrtwn/scp_project/ 
> perso/jvanel/journal.html
> The MathWorks      Tel : +33 (0)1 41 14 67 24
> 20 rue Troyon      Cell: +33 (0)6 89 16 29 52
> 92316 Sèvres       Fax : +33 (0)1 41 14 67 15
> France             Web : http://www.mathworks.fr
>
>
>



More information about the antlr-interest mailing list