[stringtemplate-interest] Passing values into templates
Ben Hood
0x6e6562 at gmail.com
Sun Apr 20 01:28:41 PDT 2008
On 20 Apr 2008, at 06:26, Terence Parr wrote:
>
> On Apr 19, 2008, at 4:32 PM, Ben Hood wrote:
>>> Eg:
>>> return <readBytes("length= next - 0x20")>;
>>
>> If I do this, i.e. return <readBytes(length="next - 0x20")>; then I
>> run into this error:
>>
>> action parse error in group GenricReader line 7; template context is
>> [decode]
>> line 1:1: unexpected token: readBytes
>
>
> problem is in template decode it appears. did you terminate it?
> Ter
I've tried to break the problem down into it's simplest form.
If I do this:
decode() ::= <<
int next = <readByte()>;
if (next <ge()> 0x20 && next <le()> 0x2f) {
return <readBytes(length="next - 0x20")>;
}
>>
readBytes(length) ::= "inputStream.readBytes(<length>)"
I get this error:
action parse error in group GenricReader line 8; template context is
[decode]
line 1:1: unexpected token: readBytes
If I change it to this
decode() ::= <<
int next = <readByte()>;
if (next <ge()> 0x20 && next <le()> 0x2f) {
return <readBytes("next - 0x20")>;
}
>>
readBytes(length) ::= "inputStream.readBytes(<length>)"
I get this error:
action parse error in group GenricReader line 15; template context is
[readBytes]
line 1:7: expecting LPAREN, found 'null'
Maybe I'm doing something fundamentally wrong.
Ben
More information about the stringtemplate-interest
mailing list