[antlr-interest] adding content at end of rule with TokenRewriteStream
Jean Marc Vanel
JeanMarc.Vanel at mathworks.fr
Wed Feb 21 08:32:50 PST 2007
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 <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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070221/89abef92/attachment-0001.html
More information about the antlr-interest
mailing list