Wednesday, 15 June 2011

curly braclet in a StringTemplate -



curly braclet in a StringTemplate -

the next stringtemplate gives me "invalid character '}'" exception because of closing curly brace after return null;:

$statementlist:{statement | public t $statement$(x x) { homecoming null; } }$

i want have output like:

public t statement1(x x) {return null; } public t statement2(x x) {return null; }

how can escape closing curly brace?

i couldn't find way of escaping characters, did manage work using unicode character curly braces instead.

statementtemplate(statementlist) ::= << <statementlist:{statement | public t <statement>(x x) <\u007b> homecoming null; <\u007d> }> >>

which produced:

public t statement1(x x) { homecoming null; } public t statement2(x x) { homecoming null; } public t statement3(x x) { homecoming null; }

stringtemplate stringtemplate-4

No comments:

Post a Comment