[antlr-interest] book, online doc discrepancy?

Mathew Yeates myeates at jpl.nasa.gov
Mon Jan 7 12:57:39 PST 2008


Well, str(hello) doesn't work. It seems like attributes are not being 
checked when writing.

Terence Parr wrote:
>
> On Jan 7, 2008, at 10:58 AM, Mathew Yeates wrote:
>
>> Using StringTemplate the book says to do (using Python)
>>
>> hello=stringtemplate.StringTemplate("Hello, <name>")
>> hello.setAttribute("name","World")
>> print hello.toString() #is an error :AttributeError: 'StringTemplate' 
>> object has no attribute 'toString'
>
> must be a python difference.  how do you convert to string in python? 
> use that not .toString()
>
> Ter
>>
>>
>> if I do
>> print str(hello) I get Hello, <name>
>>
>> But the online docs say to use $name$ and hello["name"] = "World"
>> and this works.
>>
>>
>> ????
>>
>> Mathew
>>
>>
>>
>
>




More information about the antlr-interest mailing list