andrew b
andrew b

Reputation: 205

Stringtemplate-4: using '@' as a custom delimiter

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?

Upvotes: 3

Views: 1059

Answers (1)

Terence Parr
Terence Parr

Reputation: 5962

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

Upvotes: 3

Related Questions