3

When using StringTemplate 4.0.2 the following object construction:

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

produces the 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(Compiler.java:213)
    at org.stringtemplate.v4.compiler.Compiler.compile(Compiler.java:143)
    at org.stringtemplate.v4.STGroup.compile(STGroup.java:427)
    at org.stringtemplate.v4.ST.<init>(ST.java:142)
    at org.stringtemplate.v4.ST.<init>(ST.java:136)

Is there some special way to use the '@' character as a custom delimiter or is it simply not allowed?

andrew b
  • 205
  • 2
  • 6

1 Answers1

3

@ is used for defining regions and is a reserved operator.

Terence Parr
  • 5,912
  • 26
  • 32
  • It might be an idea to throw an exception when calling the constructor with '@' as delimiter. It took me quite a while to find out this was the reason it wasn't working. – wvdz May 27 '14 at 11:54