[antlr-interest] Unexpected token in a rewrite rule

Luca Belluccini lucabelluccini at gmail.com
Thu Jun 17 06:50:32 PDT 2010


Our grammar is quite complex (similar to Python one, with INDENT DEDENT
stuff and so on...) and it's attached to the mail.
We would like to use templates and rewrite.
I encountered this rule:
pointer :
| 'pointer' '.' t=(SDT | ID) ID (',' ID)* -> ( 'pointer' '.' t ID )+
| 'pointer' '.' t=(SDT | ID) ID -> pointer(type={$t.text},name={$ID.text})
;

I wrote this one because I saw a little example at
http://www.stringtemplate.org/wiki/display/~admin/2008/04/11/Rewrite+rules.
In the grammar options I placed:
output = template;
rewrite = true;

I would like to know if it is possible to do so, cause of when generating
the code, I get a "Unexpected token (" at first alternative, after the ->
Accordingly to the page on the stringtemplate wiki, It should work...
Let me know.
Thanks in advance,

L.B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: twyncat.g
Type: application/octet-stream
Size: 12552 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20100617/1ffbd5c9/attachment.obj 


More information about the antlr-interest mailing list