2012-03-26 9 views
3

は、カスタム区切り文字として:Stringtemplate-4:使用して '@' 以下のオブジェクトの建設をStringTemplateを4.0.2使用している場合

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) 

いくつかの特別な方法にはあります:

ST st = new ST("@[email protected]", '@', '@'); 

が例外を生成します'@'文字をカスタム区切り文字として使用するか、単に許可されないのですか?

答えて

3

@は領域を定義するために使用され、予約された演算子です。

+0

おかげで、ありがとうテレンス –

+0

デリミタとして '@'を付けてコンストラクタを呼び出すときに例外をスローすることが考えられます。これが動作していなかった理由がわかってから私はかなりの時間がかかりました。 – wvdz

+0

良い点。問題をhttps://github.com/antlr/stringtemplate4/issues/84に追加しました –

関連する問題