[prev in list] [next in list] [prev in thread] [next in thread] 

List:       stringtemplate-interest
Subject:    [stringtemplate-interest] Bug? group-file argument resolution
From:       Graham Wideman <gwlist () grahamwideman ! com>
Date:       2009-06-01 2:54:39
Message-ID: 4.1.20090531194155.015ac428 () grahamwideman ! com
[Download RAW message or body]

[Attachment #2 (text/html)]

<html>
Hi folks:<br>
<br>
I posted something similar a few days ago, but the subject line was
perhaps mangled, and anyhow here's a simplified version.&nbsp; (I thought
to submit this to the bug tracker, but apparently a different account is
needed... is that available for mortals?)<br>
<br>
The following cases seem to illustrate that there's a problem with the
requirement for stg's to declare formal arguments:<br>
<br>
-----------------------------------<br>
group test;<br>
<br>
outer() ::= &lt;&lt;<br>
inner: &lt;inner()&gt;<br>
&gt;&gt;<br>
<br>
inner() ::= &lt;&lt;<br>
argX: &lt;argX&gt;<br>
&gt;&gt;<br>
-----------------------------------<br>
<br>
Given those templates,<br>
<br>
<font size=1>&nbsp;&nbsp; StringTemplate st =
stg.getInstanceOf(&quot;inner&quot;);<br>
&nbsp;&nbsp; String s = toString();<br>
<br>
</font>... provokes no error, but...<br>
<br>
&nbsp;&nbsp; StringTemplate st =
stg.getInstanceOf(&quot;outer&quot;);<br>
&nbsp;&nbsp; String s = toString()<br>
<br>
results in:<br>
<font size=4>&quot;Error: no such attribute: argX in template context
[outer inner]&quot;<br>
<br>
</font>I think the latter is correct (ie: there SHOULD be an error
message), as it agrees with the docs which say:<br>
----------------<br>
&quot;When using a group file format to specify templates, you must
specify the formal arguments for that template. If you try to access an
attribute that is not formally defined in that template or an enclosing
template, you will get a InvalidOperationException.&quot;<br>
----------------<br>
<br>
So, I think that the no-error-message case is a bug.<br>
<br>
Comments?<br>
<br>
-- Graham </html>



_______________________________________________
stringtemplate-interest mailing list
stringtemplate-interest@antlr.org
http://www.antlr.org/mailman/listinfo/stringtemplate-interest


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic