2012-03-26 3 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

감사합니다. Terence –

+0

구분 기호로 '@'를 사용하여 생성자를 호출 할 때 예외가 발생하는 것이 좋습니다. 이것이 작동하지 않는 이유가 있음을 알기까지 꽤 오랜 시간이 걸렸습니다. – wvdz

+0

좋은 지적. https://github.com/antlr/stringtemplate4/issues/84에 문제가 추가되었습니다. –

관련 문제