[stringtemplate-interest] Attribute not found exception?

Jeremy Gray jgray at siberra.com
Tue Mar 28 14:03:07 PST 2006


To chime in with my company's perspective:

We would very much like to be able to set all sorts of attributes that
may or may not be used in the various templates that can be applied, so
any checks and balances can't really be applied from that end, at least
not in the sense of "setRequiredAttribute" and the like.

That said, on some occasions it can be useful to determine whether or
not a template is referring to an unpopulated attribute, especially on
an automated basis.

With the above in mind, I'm wondering if the thread starter's needs
might be met, at least in part, through the addition of a feature that
would allow for programmatic control over the value to be output when an
attribute cannot be resolved. Under normal operations this would
continue to be an empty string. Under automated testing, for example,
this could be changed to something arbitrary that would never otherwise
appear in normal output (eg. !!!MISSING_ATTRIBUTE!!!). A testing
process, human or otherwise, could then detect such output with relative
ease.

Jeremy Gray

-----Original Message-----
From: stringtemplate-interest-bounces at antlr.org
[mailto:stringtemplate-interest-bounces at antlr.org] On Behalf Of Terence
Parr
Sent: Tuesday, March 28, 2006 1:15 PM
To: StringTemplate
Subject: Re: [stringtemplate-interest] Attribute not found exception?


On Mar 28, 2006, at 12:59 PM, David Moshal wrote:

> Ter - I think the question was a little different. In actual use,  
> the system doesn't complain if you set an attribute which
> doesn't exist, which becomes very hard to debug. One needs to look  
> at the generated code.

Oh!  Right, Yes, that is a very big problem!  You are right. the  
problem is, how do you know what the complete set of attributes is?

Ter

> Dave
>
>
> On 3/28/06, Terence Parr <parrt at cs.usfca.edu> wrote:
> On Mar 28, 2006, at 11:00 AM, David Moshal wrote:
>
> > I too have thought this might be useful at times, and was wondering
> > if the api could be extended to support this,
> > ie:
> >
> > setRequiredAttribute (...);
>
> Sometimes you want it and sometimes you don't in same app.  You want
> attributes with no value to be blank w/o an IF:
>
> $if(foo)$foo$endif$
>
> Ter
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
>

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




More information about the stringtemplate-interest mailing list