Stringtemplate-4: using "@" as custom separator

When using StringTemplate 4.0.2 the following object construct:

ST st = new ST("@myToken@", '@', '@');


throws an exception:

1:8: '@' came as a complete surprise to me
Exception in thread "main" org.stringtemplate.v4.compiler.STException
    at org.stringtemplate.v4.compiler.Compiler.reportMessageAndThrowSTException(
    at org.stringtemplate.v4.compiler.Compiler.compile(
    at org.stringtemplate.v4.STGroup.compile(
    at org.stringtemplate.v4.ST.<init>(
    at org.stringtemplate.v4.ST.<init>(


Is there any special way to use the "@" character as a custom delimiter, or is it just not allowed?


source to share

1 answer

@ is used to define scopes and is a reserved operator.



All Articles