Still one more;)<br><br>In treeSpec there is functionality missing to support suffixes. E.g. <br><br>r: ^(a b)+;<br><br>will not parse. Fixed it with this:<br><br><i>treeSpec<br> : '^(' element ( element )+ ')' ebnfSuffix? -> ^(TREE_BEGIN element+ ebnfSuffix?)<br>
;<br><br></i>Best regards,<br>Jens<br><br><div class="gmail_quote">2008/7/8 Jens Boeykens <<a href="mailto:jens.boeykens@gmail.com">jens.boeykens@gmail.com</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Another error in ANTLRv3.g:<br><br><i>rewrite_tree_element<br> : rewrite_tree_atom<br> | rewrite_tree_atom ebnfSuffix<br> -> ^( ebnfSuffix ^(BLOCK["BLOCK"] ^(ALT["ALT"] rewrite_tree_atom EOA["EOA"]) EOB["EOB"]))<br>
| rewrite_tree<br> ( ebnfSuffix<br> -> ^(<b>ebnfSuffix</b> ^(BLOCK["BLOCK"] ^(ALT["ALT"] rewrite_tree EOA["EOA"]) EOB["EOB"]))<br> | -> rewrite_tree<br>
)<br> | rewrite_tree_ebnf<br> ;</i><br><br><br>The 3rd alternative did not include the ebnfSuffix in the tree. It seems nothing needs to be changed in ANTLRv3Tree.g but I don't fully understand the transition of rewrite_tree_element from ANTLRv3.g to ANTLRv3Tree.g so I could be mistaken here.<br>
<font color="#888888">
<br>Jens</font><div><div></div><div class="Wj3C7c"><br><br><div class="gmail_quote">2008/7/8 Jens Boeykens <<a href="mailto:jens.boeykens@gmail.com" target="_blank">jens.boeykens@gmail.com</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Another detail for rule rewrite_tree_atom that I am not sure if it is correct:<br><br>In ANTLRv3.g : ^(TOKEN_REF ARG_ACTION?)<br>In ANTLRv3Tree.g: ^(TOKEN_REF ARG_ACTION)<br><br>The question mark dissapeared. I added it in my code, but not sure if it is necessary...<br>
<br>Another thing I did not understand very well (probably my own fault ;) ) :<br>There is a rule called "rewrite_template_block" which is defined, but no other rule seems to be using it. Does this make the rule obsolete? I noticed this because I have not yet encountered a testcase where the rule was used, so I am not sure wether I should write more tests or the rule is indeed obsolete.<br>
<br>Kind regards<br><br><div class="gmail_quote">2008/7/8 Jens Boeykens <<a href="mailto:jens.boeykens@gmail.com" target="_blank">jens.boeykens@gmail.com</a>>:<div><div></div><div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thanks it worked!!<br><br>I've encounterd another issue with ANTLRv3.g but it's not a very important one. When you end your grammar with a single line comment like<br><br>// this is my comment<eof><br><br>thus no '\n' at the end but directly end of file, the parser will complain it is looking for a '\n'.<br>
<br>Jens<br><br><div class="gmail_quote">2008/7/7 Terence Parr <<a href="mailto:parrt@cs.usfca.edu" target="_blank">parrt@cs.usfca.edu</a>>:<div><div></div><div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><br>
On Jul 7, 2008, at 2:23 PM, Jens Boeykens wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
block(blok, optionsSpec, alternative, rewrite, eob) ::= <<<br>
<alternative,rewrite: {alt,rw | <alt> <rw> | }><br>
>><br>
<br>
I have one '|' too many in my output:<br>
r: a -> int | b -> char |;<br>
</blockquote>
<br>
Use <...; separator="|"><br>
</blockquote>
<br>
Sorry I can't find the exact syntax to use here. Remember I need 2 lists here.<br>
<alternative,rewrite; separator=" | "> and <alternative rewrite; separator=" | "> give errors...<br>
</blockquote>
<br></div>
Oh, sorry.<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<alternative,rewrite: {alt,rw | <alt> <rw>}; separator="|"><br>
</blockquote></blockquote></blockquote>
<br>
Should work<br>
Ter<br>
</blockquote></div></div></div><br>
</blockquote></div></div></div><br>
</blockquote></div><br>
</div></div></blockquote></div><br>