diff --git a/oap-formats/oap-template/src/main/antlr4/TemplateGrammar.g4 b/oap-formats/oap-template/src/main/antlr4/TemplateGrammar.g4 index 566db01d94..a6a94bd061 100644 --- a/oap-formats/oap-template/src/main/antlr4/TemplateGrammar.g4 +++ b/oap-formats/oap-template/src/main/antlr4/TemplateGrammar.g4 @@ -36,12 +36,12 @@ elements[Map aliases] returns [Elements ret = new Elements()] element[Map aliases] returns [Element ret] : t=text { $ret = new TextElement( $t.text ); } | comment { $ret = new TextElement( $comment.text.substring(1) ); } - | expression[aliases] { $ret = new ExpressionElement( $expression.ret ); } + | expression[aliases] { $ret = new ExpressionElement( $expression.ret, $expression.trimLeft, $expression.trimRight ); } | blockIfElement[aliases] { $ret = $blockIfElement.ret; } ; blockIfElement[Map aliases] returns [BlockIfElement ret] - : STARTBLOCKIF BLOCK_IF_CONTENT BLOCK_IF_RBRACE + : (STARTBLOCKIF | STARTBLOCKIF_LTRIM) BLOCK_IF_CONTENT BLOCK_IF_RBRACE thenBranch=blockBody[aliases] ( STARTBLOCKELSE elseBranch=blockBody[aliases] )? STARTBLOCKEND @@ -49,7 +49,8 @@ blockIfElement[Map aliases] returns [BlockIfElement ret] $ret = new BlockIfElement( StringUtils.trim( $BLOCK_IF_CONTENT.text ), $thenBranch.ret, - $elseBranch.ctx != null ? $elseBranch.ret : null + $elseBranch.ctx != null ? $elseBranch.ret : null, + $start.getType() == STARTBLOCKIF_LTRIM ); } ; @@ -68,9 +69,11 @@ comment : STARTESCEXPR expressionContent RBRACE; -expression[Map aliases] returns [String ret] - : (STARTEXPR|STARTEXPR2) expressionContent (RBRACE|RBRACE2) { +expression[Map aliases] returns [String ret, boolean trimLeft, boolean trimRight] + : (STARTEXPR|STARTEXPR2|STARTEXPR2_LTRIM) expressionContent (RBRACE|RBRACE2|RBRACE2_RTRIM) { $ret = StringUtils.trim( $expressionContent.text ); + $trimLeft = $start.getType() == STARTEXPR2_LTRIM; + $trimRight = _input.LT(-1).getType() == RBRACE2_RTRIM; String alias = aliases.get( $ret ); if( alias != null ) $ret = alias; }; diff --git a/oap-formats/oap-template/src/main/antlr4/TemplateLexer.g4 b/oap-formats/oap-template/src/main/antlr4/TemplateLexer.g4 index 0508993fdc..4ac8637202 100644 --- a/oap-formats/oap-template/src/main/antlr4/TemplateLexer.g4 +++ b/oap-formats/oap-template/src/main/antlr4/TemplateLexer.g4 @@ -10,13 +10,15 @@ fragment EndExpr2 : '}}' ; -STARTBLOCKIF : '{{%' [ \t]* 'if' [ \t]+ -> pushMode(BlockIfContent) ; -STARTBLOCKELSE : '{{%' [ \t]* 'else' [ \t]* '}}' ; -STARTBLOCKEND : '{{%' [ \t]* 'end' [ \t]* '}}' ; +STARTBLOCKIF_LTRIM : '{{%-' [ \t]* 'if' [ \t]+ -> pushMode(BlockIfContent) ; +STARTBLOCKIF : '{{%' [ \t]* 'if' [ \t]+ -> pushMode(BlockIfContent) ; +STARTBLOCKELSE : '{{%' [ \t]* 'else' [ \t]* '}}' ; +STARTBLOCKEND : '{{%' [ \t]* 'end' [ \t]* '}}' ; -STARTESCEXPR: StartEscExpr -> pushMode(Expression) ; -STARTEXPR : StartExpr -> pushMode(Expression) ; -STARTEXPR2 : StartExpr2 -> pushMode(Expression2) ; +STARTESCEXPR : StartEscExpr -> pushMode(Expression) ; +STARTEXPR : StartExpr -> pushMode(Expression) ; +STARTEXPR2_LTRIM : '{{-' -> pushMode(Expression2) ; +STARTEXPR2 : StartExpr2 -> pushMode(Expression2) ; TEXT : . ; @@ -29,10 +31,11 @@ EXPRESSION : . ; mode Expression2; -LBRACE2 : LBrace -> pushMode(Expression) ; -RBRACE2 : EndExpr2-> popMode ; +LBRACE2 : LBrace -> pushMode(Expression) ; +RBRACE2_RTRIM : '-}}' -> popMode ; +RBRACE2 : EndExpr2 -> popMode ; -EXPRESSION2 : . ; +EXPRESSION2 : . ; mode BlockIfContent; BLOCK_IF_CONTENT : ~[}]+ ; diff --git a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateGrammar.interp b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateGrammar.interp index 88bff44fc5..effed033d2 100644 --- a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateGrammar.interp +++ b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateGrammar.interp @@ -6,29 +6,35 @@ null null null null +'{{-' null null null null null null +'-}}' +null null null '}}' token symbolic names: null +STARTBLOCKIF_LTRIM STARTBLOCKIF STARTBLOCKELSE STARTBLOCKEND STARTESCEXPR STARTEXPR +STARTEXPR2_LTRIM STARTEXPR2 TEXT LBRACE RBRACE EXPRESSION LBRACE2 +RBRACE2_RTRIM RBRACE2 EXPRESSION2 BLOCK_IF_CONTENT @@ -46,4 +52,4 @@ expressionContent atn: -[4, 1, 15, 79, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 1, 0, 1, 0, 1, 0, 5, 0, 20, 8, 0, 10, 0, 12, 0, 23, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 39, 8, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 47, 8, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 5, 3, 55, 8, 3, 10, 3, 12, 3, 58, 9, 3, 1, 4, 4, 4, 61, 8, 4, 11, 4, 12, 4, 62, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 4, 7, 75, 8, 7, 11, 7, 12, 7, 76, 1, 7, 0, 0, 8, 0, 2, 4, 6, 8, 10, 12, 14, 0, 3, 1, 0, 5, 6, 2, 0, 9, 9, 12, 12, 1, 0, 8, 13, 78, 0, 21, 1, 0, 0, 0, 2, 38, 1, 0, 0, 0, 4, 40, 1, 0, 0, 0, 6, 56, 1, 0, 0, 0, 8, 60, 1, 0, 0, 0, 10, 64, 1, 0, 0, 0, 12, 68, 1, 0, 0, 0, 14, 74, 1, 0, 0, 0, 16, 17, 3, 2, 1, 0, 17, 18, 6, 0, -1, 0, 18, 20, 1, 0, 0, 0, 19, 16, 1, 0, 0, 0, 20, 23, 1, 0, 0, 0, 21, 19, 1, 0, 0, 0, 21, 22, 1, 0, 0, 0, 22, 24, 1, 0, 0, 0, 23, 21, 1, 0, 0, 0, 24, 25, 5, 0, 0, 1, 25, 1, 1, 0, 0, 0, 26, 27, 3, 8, 4, 0, 27, 28, 6, 1, -1, 0, 28, 39, 1, 0, 0, 0, 29, 30, 3, 10, 5, 0, 30, 31, 6, 1, -1, 0, 31, 39, 1, 0, 0, 0, 32, 33, 3, 12, 6, 0, 33, 34, 6, 1, -1, 0, 34, 39, 1, 0, 0, 0, 35, 36, 3, 4, 2, 0, 36, 37, 6, 1, -1, 0, 37, 39, 1, 0, 0, 0, 38, 26, 1, 0, 0, 0, 38, 29, 1, 0, 0, 0, 38, 32, 1, 0, 0, 0, 38, 35, 1, 0, 0, 0, 39, 3, 1, 0, 0, 0, 40, 41, 5, 1, 0, 0, 41, 42, 5, 14, 0, 0, 42, 43, 5, 15, 0, 0, 43, 46, 3, 6, 3, 0, 44, 45, 5, 2, 0, 0, 45, 47, 3, 6, 3, 0, 46, 44, 1, 0, 0, 0, 46, 47, 1, 0, 0, 0, 47, 48, 1, 0, 0, 0, 48, 49, 5, 3, 0, 0, 49, 50, 6, 2, -1, 0, 50, 5, 1, 0, 0, 0, 51, 52, 3, 2, 1, 0, 52, 53, 6, 3, -1, 0, 53, 55, 1, 0, 0, 0, 54, 51, 1, 0, 0, 0, 55, 58, 1, 0, 0, 0, 56, 54, 1, 0, 0, 0, 56, 57, 1, 0, 0, 0, 57, 7, 1, 0, 0, 0, 58, 56, 1, 0, 0, 0, 59, 61, 5, 7, 0, 0, 60, 59, 1, 0, 0, 0, 61, 62, 1, 0, 0, 0, 62, 60, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 9, 1, 0, 0, 0, 64, 65, 5, 4, 0, 0, 65, 66, 3, 14, 7, 0, 66, 67, 5, 9, 0, 0, 67, 11, 1, 0, 0, 0, 68, 69, 7, 0, 0, 0, 69, 70, 3, 14, 7, 0, 70, 71, 7, 1, 0, 0, 71, 72, 6, 6, -1, 0, 72, 13, 1, 0, 0, 0, 73, 75, 7, 2, 0, 0, 74, 73, 1, 0, 0, 0, 75, 76, 1, 0, 0, 0, 76, 74, 1, 0, 0, 0, 76, 77, 1, 0, 0, 0, 77, 15, 1, 0, 0, 0, 6, 21, 38, 46, 56, 62, 76] \ No newline at end of file +[4, 1, 18, 79, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 1, 0, 1, 0, 1, 0, 5, 0, 20, 8, 0, 10, 0, 12, 0, 23, 9, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 39, 8, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 47, 8, 2, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 5, 3, 55, 8, 3, 10, 3, 12, 3, 58, 9, 3, 1, 4, 4, 4, 61, 8, 4, 11, 4, 12, 4, 62, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 4, 7, 75, 8, 7, 11, 7, 12, 7, 76, 1, 7, 0, 0, 8, 0, 2, 4, 6, 8, 10, 12, 14, 0, 4, 1, 0, 1, 2, 1, 0, 6, 8, 2, 0, 11, 11, 14, 15, 2, 0, 10, 13, 15, 16, 78, 0, 21, 1, 0, 0, 0, 2, 38, 1, 0, 0, 0, 4, 40, 1, 0, 0, 0, 6, 56, 1, 0, 0, 0, 8, 60, 1, 0, 0, 0, 10, 64, 1, 0, 0, 0, 12, 68, 1, 0, 0, 0, 14, 74, 1, 0, 0, 0, 16, 17, 3, 2, 1, 0, 17, 18, 6, 0, -1, 0, 18, 20, 1, 0, 0, 0, 19, 16, 1, 0, 0, 0, 20, 23, 1, 0, 0, 0, 21, 19, 1, 0, 0, 0, 21, 22, 1, 0, 0, 0, 22, 24, 1, 0, 0, 0, 23, 21, 1, 0, 0, 0, 24, 25, 5, 0, 0, 1, 25, 1, 1, 0, 0, 0, 26, 27, 3, 8, 4, 0, 27, 28, 6, 1, -1, 0, 28, 39, 1, 0, 0, 0, 29, 30, 3, 10, 5, 0, 30, 31, 6, 1, -1, 0, 31, 39, 1, 0, 0, 0, 32, 33, 3, 12, 6, 0, 33, 34, 6, 1, -1, 0, 34, 39, 1, 0, 0, 0, 35, 36, 3, 4, 2, 0, 36, 37, 6, 1, -1, 0, 37, 39, 1, 0, 0, 0, 38, 26, 1, 0, 0, 0, 38, 29, 1, 0, 0, 0, 38, 32, 1, 0, 0, 0, 38, 35, 1, 0, 0, 0, 39, 3, 1, 0, 0, 0, 40, 41, 7, 0, 0, 0, 41, 42, 5, 17, 0, 0, 42, 43, 5, 18, 0, 0, 43, 46, 3, 6, 3, 0, 44, 45, 5, 3, 0, 0, 45, 47, 3, 6, 3, 0, 46, 44, 1, 0, 0, 0, 46, 47, 1, 0, 0, 0, 47, 48, 1, 0, 0, 0, 48, 49, 5, 4, 0, 0, 49, 50, 6, 2, -1, 0, 50, 5, 1, 0, 0, 0, 51, 52, 3, 2, 1, 0, 52, 53, 6, 3, -1, 0, 53, 55, 1, 0, 0, 0, 54, 51, 1, 0, 0, 0, 55, 58, 1, 0, 0, 0, 56, 54, 1, 0, 0, 0, 56, 57, 1, 0, 0, 0, 57, 7, 1, 0, 0, 0, 58, 56, 1, 0, 0, 0, 59, 61, 5, 9, 0, 0, 60, 59, 1, 0, 0, 0, 61, 62, 1, 0, 0, 0, 62, 60, 1, 0, 0, 0, 62, 63, 1, 0, 0, 0, 63, 9, 1, 0, 0, 0, 64, 65, 5, 5, 0, 0, 65, 66, 3, 14, 7, 0, 66, 67, 5, 11, 0, 0, 67, 11, 1, 0, 0, 0, 68, 69, 7, 1, 0, 0, 69, 70, 3, 14, 7, 0, 70, 71, 7, 2, 0, 0, 71, 72, 6, 6, -1, 0, 72, 13, 1, 0, 0, 0, 73, 75, 7, 3, 0, 0, 74, 73, 1, 0, 0, 0, 75, 76, 1, 0, 0, 0, 76, 74, 1, 0, 0, 0, 76, 77, 1, 0, 0, 0, 77, 15, 1, 0, 0, 0, 6, 21, 38, 46, 56, 62, 76] \ No newline at end of file diff --git a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateGrammar.java b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateGrammar.java index 520b7918b7..0bf93d3845 100644 --- a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateGrammar.java +++ b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateGrammar.java @@ -28,9 +28,10 @@ public class TemplateGrammar extends TemplateGrammarAdaptor { protected static final PredictionContextCache _sharedContextCache = new PredictionContextCache(); public static final int - STARTBLOCKIF=1, STARTBLOCKELSE=2, STARTBLOCKEND=3, STARTESCEXPR=4, STARTEXPR=5, - STARTEXPR2=6, TEXT=7, LBRACE=8, RBRACE=9, EXPRESSION=10, LBRACE2=11, RBRACE2=12, - EXPRESSION2=13, BLOCK_IF_CONTENT=14, BLOCK_IF_RBRACE=15; + STARTBLOCKIF_LTRIM=1, STARTBLOCKIF=2, STARTBLOCKELSE=3, STARTBLOCKEND=4, + STARTESCEXPR=5, STARTEXPR=6, STARTEXPR2_LTRIM=7, STARTEXPR2=8, TEXT=9, + LBRACE=10, RBRACE=11, EXPRESSION=12, LBRACE2=13, RBRACE2_RTRIM=14, RBRACE2=15, + EXPRESSION2=16, BLOCK_IF_CONTENT=17, BLOCK_IF_RBRACE=18; public static final int RULE_elements = 0, RULE_element = 1, RULE_blockIfElement = 2, RULE_blockBody = 3, RULE_text = 4, RULE_comment = 5, RULE_expression = 6, RULE_expressionContent = 7; @@ -44,16 +45,17 @@ private static String[] makeRuleNames() { private static String[] makeLiteralNames() { return new String[] { - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, "'}}'" + null, null, null, null, null, null, null, "'{{-'", null, null, null, + null, null, null, "'-}}'", null, null, null, "'}}'" }; } private static final String[] _LITERAL_NAMES = makeLiteralNames(); private static String[] makeSymbolicNames() { return new String[] { - null, "STARTBLOCKIF", "STARTBLOCKELSE", "STARTBLOCKEND", "STARTESCEXPR", - "STARTEXPR", "STARTEXPR2", "TEXT", "LBRACE", "RBRACE", "EXPRESSION", - "LBRACE2", "RBRACE2", "EXPRESSION2", "BLOCK_IF_CONTENT", "BLOCK_IF_RBRACE" + null, "STARTBLOCKIF_LTRIM", "STARTBLOCKIF", "STARTBLOCKELSE", "STARTBLOCKEND", + "STARTESCEXPR", "STARTEXPR", "STARTEXPR2_LTRIM", "STARTEXPR2", "TEXT", + "LBRACE", "RBRACE", "EXPRESSION", "LBRACE2", "RBRACE2_RTRIM", "RBRACE2", + "EXPRESSION2", "BLOCK_IF_CONTENT", "BLOCK_IF_RBRACE" }; } private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); @@ -154,7 +156,7 @@ public final ElementsContext elements(Map aliases) throws Recogni setState(21); _errHandler.sync(this); _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 242L) != 0)) { + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 998L) != 0)) { { { setState(16); @@ -241,14 +243,16 @@ public final ElementContext element(Map aliases) throws Recogniti } break; case STARTEXPR: + case STARTEXPR2_LTRIM: case STARTEXPR2: enterOuterAlt(_localctx, 3); { setState(32); ((ElementContext)_localctx).expression = expression(aliases); - ((ElementContext)_localctx).ret = new ExpressionElement( ((ElementContext)_localctx).expression.ret ); + ((ElementContext)_localctx).ret = new ExpressionElement( ((ElementContext)_localctx).expression.ret, ((ElementContext)_localctx).expression.trimLeft, ((ElementContext)_localctx).expression.trimRight ); } break; + case STARTBLOCKIF_LTRIM: case STARTBLOCKIF: enterOuterAlt(_localctx, 4); { @@ -279,10 +283,11 @@ public static class BlockIfElementContext extends ParserRuleContext { public Token BLOCK_IF_CONTENT; public BlockBodyContext thenBranch; public BlockBodyContext elseBranch; - public TerminalNode STARTBLOCKIF() { return getToken(TemplateGrammar.STARTBLOCKIF, 0); } public TerminalNode BLOCK_IF_CONTENT() { return getToken(TemplateGrammar.BLOCK_IF_CONTENT, 0); } public TerminalNode BLOCK_IF_RBRACE() { return getToken(TemplateGrammar.BLOCK_IF_RBRACE, 0); } public TerminalNode STARTBLOCKEND() { return getToken(TemplateGrammar.STARTBLOCKEND, 0); } + public TerminalNode STARTBLOCKIF() { return getToken(TemplateGrammar.STARTBLOCKIF, 0); } + public TerminalNode STARTBLOCKIF_LTRIM() { return getToken(TemplateGrammar.STARTBLOCKIF_LTRIM, 0); } public List blockBody() { return getRuleContexts(BlockBodyContext.class); } @@ -314,7 +319,15 @@ public final BlockIfElementContext blockIfElement(Map aliases) th enterOuterAlt(_localctx, 1); { setState(40); - match(STARTBLOCKIF); + _la = _input.LA(1); + if ( !(_la==STARTBLOCKIF_LTRIM || _la==STARTBLOCKIF) ) { + _errHandler.recoverInline(this); + } + else { + if ( _input.LA(1)==Token.EOF ) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } setState(41); ((BlockIfElementContext)_localctx).BLOCK_IF_CONTENT = match(BLOCK_IF_CONTENT); setState(42); @@ -339,7 +352,8 @@ public final BlockIfElementContext blockIfElement(Map aliases) th ((BlockIfElementContext)_localctx).ret = new BlockIfElement( StringUtils.trim( (((BlockIfElementContext)_localctx).BLOCK_IF_CONTENT!=null?((BlockIfElementContext)_localctx).BLOCK_IF_CONTENT.getText():null) ), ((BlockIfElementContext)_localctx).thenBranch.ret, - ((BlockIfElementContext)_localctx).elseBranch != null ? ((BlockIfElementContext)_localctx).elseBranch.ret : null + ((BlockIfElementContext)_localctx).elseBranch != null ? ((BlockIfElementContext)_localctx).elseBranch.ret : null, + _localctx.start.getType() == STARTBLOCKIF_LTRIM ); } @@ -392,7 +406,7 @@ public final BlockBodyContext blockBody(Map aliases) throws Recog setState(56); _errHandler.sync(this); _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 242L) != 0)) { + while ((((_la) & ~0x3f) == 0 && ((1L << _la) & 998L) != 0)) { { { setState(51); @@ -527,14 +541,18 @@ public final CommentContext comment() throws RecognitionException { public static class ExpressionContext extends ParserRuleContext { public Map aliases; public String ret; + public boolean trimLeft; + public boolean trimRight; public ExpressionContentContext expressionContent; public ExpressionContentContext expressionContent() { return getRuleContext(ExpressionContentContext.class,0); } public TerminalNode STARTEXPR() { return getToken(TemplateGrammar.STARTEXPR, 0); } public TerminalNode STARTEXPR2() { return getToken(TemplateGrammar.STARTEXPR2, 0); } + public TerminalNode STARTEXPR2_LTRIM() { return getToken(TemplateGrammar.STARTEXPR2_LTRIM, 0); } public TerminalNode RBRACE() { return getToken(TemplateGrammar.RBRACE, 0); } public TerminalNode RBRACE2() { return getToken(TemplateGrammar.RBRACE2, 0); } + public TerminalNode RBRACE2_RTRIM() { return getToken(TemplateGrammar.RBRACE2_RTRIM, 0); } public ExpressionContext(ParserRuleContext parent, int invokingState) { super(parent, invokingState); } public ExpressionContext(ParserRuleContext parent, int invokingState, Map aliases) { super(parent, invokingState); @@ -560,7 +578,7 @@ public final ExpressionContext expression(Map aliases) throws Rec { setState(68); _la = _input.LA(1); - if ( !(_la==STARTEXPR || _la==STARTEXPR2) ) { + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 448L) != 0)) ) { _errHandler.recoverInline(this); } else { @@ -572,7 +590,7 @@ public final ExpressionContext expression(Map aliases) throws Rec ((ExpressionContext)_localctx).expressionContent = expressionContent(); setState(70); _la = _input.LA(1); - if ( !(_la==RBRACE || _la==RBRACE2) ) { + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 51200L) != 0)) ) { _errHandler.recoverInline(this); } else { @@ -582,6 +600,8 @@ public final ExpressionContext expression(Map aliases) throws Rec } ((ExpressionContext)_localctx).ret = StringUtils.trim( (((ExpressionContext)_localctx).expressionContent!=null?_input.getText(((ExpressionContext)_localctx).expressionContent.start,((ExpressionContext)_localctx).expressionContent.stop):null) ); + ((ExpressionContext)_localctx).trimLeft = _localctx.start.getType() == STARTEXPR2_LTRIM; + ((ExpressionContext)_localctx).trimRight = _input.LT(-1).getType() == RBRACE2_RTRIM; String alias = aliases.get( _localctx.ret ); if( alias != null ) ((ExpressionContext)_localctx).ret = alias; @@ -656,7 +676,7 @@ public final ExpressionContentContext expressionContent() throws RecognitionExce { setState(73); _la = _input.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 16128L) != 0)) ) { + if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & 113664L) != 0)) ) { _errHandler.recoverInline(this); } else { @@ -688,7 +708,7 @@ public final ExpressionContentContext expressionContent() throws RecognitionExce } public static final String _serializedATN = - "\u0004\u0001\u000fO\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+ + "\u0004\u0001\u0012O\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001\u0002"+ "\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004\u0007\u0004\u0002"+ "\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007\u0007\u0007\u0001"+ "\u0000\u0001\u0000\u0001\u0000\u0005\u0000\u0014\b\u0000\n\u0000\f\u0000"+ @@ -701,40 +721,41 @@ public final ExpressionContentContext expressionContent() throws RecognitionExce "\u0004\u0004=\b\u0004\u000b\u0004\f\u0004>\u0001\u0005\u0001\u0005\u0001"+ "\u0005\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001"+ "\u0006\u0001\u0007\u0004\u0007K\b\u0007\u000b\u0007\f\u0007L\u0001\u0007"+ - "\u0000\u0000\b\u0000\u0002\u0004\u0006\b\n\f\u000e\u0000\u0003\u0001\u0000"+ - "\u0005\u0006\u0002\u0000\t\t\f\f\u0001\u0000\b\rN\u0000\u0015\u0001\u0000"+ - "\u0000\u0000\u0002&\u0001\u0000\u0000\u0000\u0004(\u0001\u0000\u0000\u0000"+ - "\u00068\u0001\u0000\u0000\u0000\b<\u0001\u0000\u0000\u0000\n@\u0001\u0000"+ - "\u0000\u0000\fD\u0001\u0000\u0000\u0000\u000eJ\u0001\u0000\u0000\u0000"+ - "\u0010\u0011\u0003\u0002\u0001\u0000\u0011\u0012\u0006\u0000\uffff\uffff"+ - "\u0000\u0012\u0014\u0001\u0000\u0000\u0000\u0013\u0010\u0001\u0000\u0000"+ - "\u0000\u0014\u0017\u0001\u0000\u0000\u0000\u0015\u0013\u0001\u0000\u0000"+ - "\u0000\u0015\u0016\u0001\u0000\u0000\u0000\u0016\u0018\u0001\u0000\u0000"+ - "\u0000\u0017\u0015\u0001\u0000\u0000\u0000\u0018\u0019\u0005\u0000\u0000"+ - "\u0001\u0019\u0001\u0001\u0000\u0000\u0000\u001a\u001b\u0003\b\u0004\u0000"+ - "\u001b\u001c\u0006\u0001\uffff\uffff\u0000\u001c\'\u0001\u0000\u0000\u0000"+ - "\u001d\u001e\u0003\n\u0005\u0000\u001e\u001f\u0006\u0001\uffff\uffff\u0000"+ - "\u001f\'\u0001\u0000\u0000\u0000 !\u0003\f\u0006\u0000!\"\u0006\u0001"+ - "\uffff\uffff\u0000\"\'\u0001\u0000\u0000\u0000#$\u0003\u0004\u0002\u0000"+ - "$%\u0006\u0001\uffff\uffff\u0000%\'\u0001\u0000\u0000\u0000&\u001a\u0001"+ - "\u0000\u0000\u0000&\u001d\u0001\u0000\u0000\u0000& \u0001\u0000\u0000"+ - "\u0000&#\u0001\u0000\u0000\u0000\'\u0003\u0001\u0000\u0000\u0000()\u0005"+ - "\u0001\u0000\u0000)*\u0005\u000e\u0000\u0000*+\u0005\u000f\u0000\u0000"+ - "+.\u0003\u0006\u0003\u0000,-\u0005\u0002\u0000\u0000-/\u0003\u0006\u0003"+ - "\u0000.,\u0001\u0000\u0000\u0000./\u0001\u0000\u0000\u0000/0\u0001\u0000"+ - "\u0000\u000001\u0005\u0003\u0000\u000012\u0006\u0002\uffff\uffff\u0000"+ - "2\u0005\u0001\u0000\u0000\u000034\u0003\u0002\u0001\u000045\u0006\u0003"+ - "\uffff\uffff\u000057\u0001\u0000\u0000\u000063\u0001\u0000\u0000\u0000"+ - "7:\u0001\u0000\u0000\u000086\u0001\u0000\u0000\u000089\u0001\u0000\u0000"+ - "\u00009\u0007\u0001\u0000\u0000\u0000:8\u0001\u0000\u0000\u0000;=\u0005"+ - "\u0007\u0000\u0000<;\u0001\u0000\u0000\u0000=>\u0001\u0000\u0000\u0000"+ - "><\u0001\u0000\u0000\u0000>?\u0001\u0000\u0000\u0000?\t\u0001\u0000\u0000"+ - "\u0000@A\u0005\u0004\u0000\u0000AB\u0003\u000e\u0007\u0000BC\u0005\t\u0000"+ - "\u0000C\u000b\u0001\u0000\u0000\u0000DE\u0007\u0000\u0000\u0000EF\u0003"+ - "\u000e\u0007\u0000FG\u0007\u0001\u0000\u0000GH\u0006\u0006\uffff\uffff"+ - "\u0000H\r\u0001\u0000\u0000\u0000IK\u0007\u0002\u0000\u0000JI\u0001\u0000"+ - "\u0000\u0000KL\u0001\u0000\u0000\u0000LJ\u0001\u0000\u0000\u0000LM\u0001"+ - "\u0000\u0000\u0000M\u000f\u0001\u0000\u0000\u0000\u0006\u0015&.8>L"; + "\u0000\u0000\b\u0000\u0002\u0004\u0006\b\n\f\u000e\u0000\u0004\u0001\u0000"+ + "\u0001\u0002\u0001\u0000\u0006\b\u0002\u0000\u000b\u000b\u000e\u000f\u0002"+ + "\u0000\n\r\u000f\u0010N\u0000\u0015\u0001\u0000\u0000\u0000\u0002&\u0001"+ + "\u0000\u0000\u0000\u0004(\u0001\u0000\u0000\u0000\u00068\u0001\u0000\u0000"+ + "\u0000\b<\u0001\u0000\u0000\u0000\n@\u0001\u0000\u0000\u0000\fD\u0001"+ + "\u0000\u0000\u0000\u000eJ\u0001\u0000\u0000\u0000\u0010\u0011\u0003\u0002"+ + "\u0001\u0000\u0011\u0012\u0006\u0000\uffff\uffff\u0000\u0012\u0014\u0001"+ + "\u0000\u0000\u0000\u0013\u0010\u0001\u0000\u0000\u0000\u0014\u0017\u0001"+ + "\u0000\u0000\u0000\u0015\u0013\u0001\u0000\u0000\u0000\u0015\u0016\u0001"+ + "\u0000\u0000\u0000\u0016\u0018\u0001\u0000\u0000\u0000\u0017\u0015\u0001"+ + "\u0000\u0000\u0000\u0018\u0019\u0005\u0000\u0000\u0001\u0019\u0001\u0001"+ + "\u0000\u0000\u0000\u001a\u001b\u0003\b\u0004\u0000\u001b\u001c\u0006\u0001"+ + "\uffff\uffff\u0000\u001c\'\u0001\u0000\u0000\u0000\u001d\u001e\u0003\n"+ + "\u0005\u0000\u001e\u001f\u0006\u0001\uffff\uffff\u0000\u001f\'\u0001\u0000"+ + "\u0000\u0000 !\u0003\f\u0006\u0000!\"\u0006\u0001\uffff\uffff\u0000\""+ + "\'\u0001\u0000\u0000\u0000#$\u0003\u0004\u0002\u0000$%\u0006\u0001\uffff"+ + "\uffff\u0000%\'\u0001\u0000\u0000\u0000&\u001a\u0001\u0000\u0000\u0000"+ + "&\u001d\u0001\u0000\u0000\u0000& \u0001\u0000\u0000\u0000&#\u0001\u0000"+ + "\u0000\u0000\'\u0003\u0001\u0000\u0000\u0000()\u0007\u0000\u0000\u0000"+ + ")*\u0005\u0011\u0000\u0000*+\u0005\u0012\u0000\u0000+.\u0003\u0006\u0003"+ + "\u0000,-\u0005\u0003\u0000\u0000-/\u0003\u0006\u0003\u0000.,\u0001\u0000"+ + "\u0000\u0000./\u0001\u0000\u0000\u0000/0\u0001\u0000\u0000\u000001\u0005"+ + "\u0004\u0000\u000012\u0006\u0002\uffff\uffff\u00002\u0005\u0001\u0000"+ + "\u0000\u000034\u0003\u0002\u0001\u000045\u0006\u0003\uffff\uffff\u0000"+ + "57\u0001\u0000\u0000\u000063\u0001\u0000\u0000\u00007:\u0001\u0000\u0000"+ + "\u000086\u0001\u0000\u0000\u000089\u0001\u0000\u0000\u00009\u0007\u0001"+ + "\u0000\u0000\u0000:8\u0001\u0000\u0000\u0000;=\u0005\t\u0000\u0000<;\u0001"+ + "\u0000\u0000\u0000=>\u0001\u0000\u0000\u0000><\u0001\u0000\u0000\u0000"+ + ">?\u0001\u0000\u0000\u0000?\t\u0001\u0000\u0000\u0000@A\u0005\u0005\u0000"+ + "\u0000AB\u0003\u000e\u0007\u0000BC\u0005\u000b\u0000\u0000C\u000b\u0001"+ + "\u0000\u0000\u0000DE\u0007\u0001\u0000\u0000EF\u0003\u000e\u0007\u0000"+ + "FG\u0007\u0002\u0000\u0000GH\u0006\u0006\uffff\uffff\u0000H\r\u0001\u0000"+ + "\u0000\u0000IK\u0007\u0003\u0000\u0000JI\u0001\u0000\u0000\u0000KL\u0001"+ + "\u0000\u0000\u0000LJ\u0001\u0000\u0000\u0000LM\u0001\u0000\u0000\u0000"+ + "M\u000f\u0001\u0000\u0000\u0000\u0006\u0015&.8>L"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateGrammar.tokens b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateGrammar.tokens index 231b14eda4..0a27d1b66b 100644 --- a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateGrammar.tokens +++ b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateGrammar.tokens @@ -1,16 +1,21 @@ -STARTBLOCKIF=1 -STARTBLOCKELSE=2 -STARTBLOCKEND=3 -STARTESCEXPR=4 -STARTEXPR=5 -STARTEXPR2=6 -TEXT=7 -LBRACE=8 -RBRACE=9 -EXPRESSION=10 -LBRACE2=11 -RBRACE2=12 -EXPRESSION2=13 -BLOCK_IF_CONTENT=14 -BLOCK_IF_RBRACE=15 -'}}'=15 +STARTBLOCKIF_LTRIM=1 +STARTBLOCKIF=2 +STARTBLOCKELSE=3 +STARTBLOCKEND=4 +STARTESCEXPR=5 +STARTEXPR=6 +STARTEXPR2_LTRIM=7 +STARTEXPR2=8 +TEXT=9 +LBRACE=10 +RBRACE=11 +EXPRESSION=12 +LBRACE2=13 +RBRACE2_RTRIM=14 +RBRACE2=15 +EXPRESSION2=16 +BLOCK_IF_CONTENT=17 +BLOCK_IF_RBRACE=18 +'{{-'=7 +'-}}'=14 +'}}'=18 diff --git a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexer.interp b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexer.interp index f7d19578b0..5bd6dba90f 100644 --- a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexer.interp +++ b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexer.interp @@ -6,29 +6,35 @@ null null null null +'{{-' null null null null null null +'-}}' +null null null '}}' token symbolic names: null +STARTBLOCKIF_LTRIM STARTBLOCKIF STARTBLOCKELSE STARTBLOCKEND STARTESCEXPR STARTEXPR +STARTEXPR2_LTRIM STARTEXPR2 TEXT LBRACE RBRACE EXPRESSION LBRACE2 +RBRACE2_RTRIM RBRACE2 EXPRESSION2 BLOCK_IF_CONTENT @@ -39,11 +45,13 @@ StartEscExpr StartExpr StartExpr2 EndExpr2 +STARTBLOCKIF_LTRIM STARTBLOCKIF STARTBLOCKELSE STARTBLOCKEND STARTESCEXPR STARTEXPR +STARTEXPR2_LTRIM STARTEXPR2 TEXT LBrace @@ -52,6 +60,7 @@ LBRACE RBRACE EXPRESSION LBRACE2 +RBRACE2_RTRIM RBRACE2 EXPRESSION2 BLOCK_IF_CONTENT @@ -68,4 +77,4 @@ Expression2 BlockIfContent atn: -[4, 0, 15, 174, 6, -1, 6, -1, 6, -1, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 5, 4, 65, 8, 4, 10, 4, 12, 4, 68, 9, 4, 1, 4, 1, 4, 1, 4, 1, 4, 4, 4, 74, 8, 4, 11, 4, 12, 4, 75, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 85, 8, 5, 10, 5, 12, 5, 88, 9, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 96, 8, 5, 10, 5, 12, 5, 99, 9, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 5, 6, 109, 8, 6, 10, 6, 12, 6, 112, 9, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 5, 6, 119, 8, 6, 10, 6, 12, 6, 122, 9, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 13, 1, 13, 1, 14, 1, 14, 1, 14, 1, 14, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 17, 1, 17, 1, 18, 1, 18, 1, 19, 4, 19, 166, 8, 19, 11, 19, 12, 19, 167, 1, 20, 1, 20, 1, 20, 1, 20, 1, 20, 0, 0, 21, 4, 0, 6, 0, 8, 0, 10, 0, 12, 1, 14, 2, 16, 3, 18, 4, 20, 5, 22, 6, 24, 7, 26, 0, 28, 0, 30, 8, 32, 9, 34, 10, 36, 11, 38, 12, 40, 13, 42, 14, 44, 15, 4, 0, 1, 2, 3, 2, 2, 0, 9, 9, 32, 32, 1, 0, 125, 125, 171, 0, 12, 1, 0, 0, 0, 0, 14, 1, 0, 0, 0, 0, 16, 1, 0, 0, 0, 0, 18, 1, 0, 0, 0, 0, 20, 1, 0, 0, 0, 0, 22, 1, 0, 0, 0, 0, 24, 1, 0, 0, 0, 1, 30, 1, 0, 0, 0, 1, 32, 1, 0, 0, 0, 1, 34, 1, 0, 0, 0, 2, 36, 1, 0, 0, 0, 2, 38, 1, 0, 0, 0, 2, 40, 1, 0, 0, 0, 3, 42, 1, 0, 0, 0, 3, 44, 1, 0, 0, 0, 4, 46, 1, 0, 0, 0, 6, 50, 1, 0, 0, 0, 8, 53, 1, 0, 0, 0, 10, 56, 1, 0, 0, 0, 12, 59, 1, 0, 0, 0, 14, 79, 1, 0, 0, 0, 16, 103, 1, 0, 0, 0, 18, 126, 1, 0, 0, 0, 20, 130, 1, 0, 0, 0, 22, 134, 1, 0, 0, 0, 24, 138, 1, 0, 0, 0, 26, 140, 1, 0, 0, 0, 28, 142, 1, 0, 0, 0, 30, 144, 1, 0, 0, 0, 32, 148, 1, 0, 0, 0, 34, 152, 1, 0, 0, 0, 36, 154, 1, 0, 0, 0, 38, 158, 1, 0, 0, 0, 40, 162, 1, 0, 0, 0, 42, 165, 1, 0, 0, 0, 44, 169, 1, 0, 0, 0, 46, 47, 5, 36, 0, 0, 47, 48, 5, 36, 0, 0, 48, 49, 5, 123, 0, 0, 49, 5, 1, 0, 0, 0, 50, 51, 5, 36, 0, 0, 51, 52, 5, 123, 0, 0, 52, 7, 1, 0, 0, 0, 53, 54, 5, 123, 0, 0, 54, 55, 5, 123, 0, 0, 55, 9, 1, 0, 0, 0, 56, 57, 5, 125, 0, 0, 57, 58, 5, 125, 0, 0, 58, 11, 1, 0, 0, 0, 59, 60, 5, 123, 0, 0, 60, 61, 5, 123, 0, 0, 61, 62, 5, 37, 0, 0, 62, 66, 1, 0, 0, 0, 63, 65, 7, 0, 0, 0, 64, 63, 1, 0, 0, 0, 65, 68, 1, 0, 0, 0, 66, 64, 1, 0, 0, 0, 66, 67, 1, 0, 0, 0, 67, 69, 1, 0, 0, 0, 68, 66, 1, 0, 0, 0, 69, 70, 5, 105, 0, 0, 70, 71, 5, 102, 0, 0, 71, 73, 1, 0, 0, 0, 72, 74, 7, 0, 0, 0, 73, 72, 1, 0, 0, 0, 74, 75, 1, 0, 0, 0, 75, 73, 1, 0, 0, 0, 75, 76, 1, 0, 0, 0, 76, 77, 1, 0, 0, 0, 77, 78, 6, 4, 0, 0, 78, 13, 1, 0, 0, 0, 79, 80, 5, 123, 0, 0, 80, 81, 5, 123, 0, 0, 81, 82, 5, 37, 0, 0, 82, 86, 1, 0, 0, 0, 83, 85, 7, 0, 0, 0, 84, 83, 1, 0, 0, 0, 85, 88, 1, 0, 0, 0, 86, 84, 1, 0, 0, 0, 86, 87, 1, 0, 0, 0, 87, 89, 1, 0, 0, 0, 88, 86, 1, 0, 0, 0, 89, 90, 5, 101, 0, 0, 90, 91, 5, 108, 0, 0, 91, 92, 5, 115, 0, 0, 92, 93, 5, 101, 0, 0, 93, 97, 1, 0, 0, 0, 94, 96, 7, 0, 0, 0, 95, 94, 1, 0, 0, 0, 96, 99, 1, 0, 0, 0, 97, 95, 1, 0, 0, 0, 97, 98, 1, 0, 0, 0, 98, 100, 1, 0, 0, 0, 99, 97, 1, 0, 0, 0, 100, 101, 5, 125, 0, 0, 101, 102, 5, 125, 0, 0, 102, 15, 1, 0, 0, 0, 103, 104, 5, 123, 0, 0, 104, 105, 5, 123, 0, 0, 105, 106, 5, 37, 0, 0, 106, 110, 1, 0, 0, 0, 107, 109, 7, 0, 0, 0, 108, 107, 1, 0, 0, 0, 109, 112, 1, 0, 0, 0, 110, 108, 1, 0, 0, 0, 110, 111, 1, 0, 0, 0, 111, 113, 1, 0, 0, 0, 112, 110, 1, 0, 0, 0, 113, 114, 5, 101, 0, 0, 114, 115, 5, 110, 0, 0, 115, 116, 5, 100, 0, 0, 116, 120, 1, 0, 0, 0, 117, 119, 7, 0, 0, 0, 118, 117, 1, 0, 0, 0, 119, 122, 1, 0, 0, 0, 120, 118, 1, 0, 0, 0, 120, 121, 1, 0, 0, 0, 121, 123, 1, 0, 0, 0, 122, 120, 1, 0, 0, 0, 123, 124, 5, 125, 0, 0, 124, 125, 5, 125, 0, 0, 125, 17, 1, 0, 0, 0, 126, 127, 3, 4, 0, 0, 127, 128, 1, 0, 0, 0, 128, 129, 6, 7, 1, 0, 129, 19, 1, 0, 0, 0, 130, 131, 3, 6, 1, 0, 131, 132, 1, 0, 0, 0, 132, 133, 6, 8, 1, 0, 133, 21, 1, 0, 0, 0, 134, 135, 3, 8, 2, 0, 135, 136, 1, 0, 0, 0, 136, 137, 6, 9, 2, 0, 137, 23, 1, 0, 0, 0, 138, 139, 9, 0, 0, 0, 139, 25, 1, 0, 0, 0, 140, 141, 5, 123, 0, 0, 141, 27, 1, 0, 0, 0, 142, 143, 5, 125, 0, 0, 143, 29, 1, 0, 0, 0, 144, 145, 3, 26, 11, 0, 145, 146, 1, 0, 0, 0, 146, 147, 6, 13, 1, 0, 147, 31, 1, 0, 0, 0, 148, 149, 3, 28, 12, 0, 149, 150, 1, 0, 0, 0, 150, 151, 6, 14, 3, 0, 151, 33, 1, 0, 0, 0, 152, 153, 9, 0, 0, 0, 153, 35, 1, 0, 0, 0, 154, 155, 3, 26, 11, 0, 155, 156, 1, 0, 0, 0, 156, 157, 6, 16, 1, 0, 157, 37, 1, 0, 0, 0, 158, 159, 3, 10, 3, 0, 159, 160, 1, 0, 0, 0, 160, 161, 6, 17, 3, 0, 161, 39, 1, 0, 0, 0, 162, 163, 9, 0, 0, 0, 163, 41, 1, 0, 0, 0, 164, 166, 8, 1, 0, 0, 165, 164, 1, 0, 0, 0, 166, 167, 1, 0, 0, 0, 167, 165, 1, 0, 0, 0, 167, 168, 1, 0, 0, 0, 168, 43, 1, 0, 0, 0, 169, 170, 5, 125, 0, 0, 170, 171, 5, 125, 0, 0, 171, 172, 1, 0, 0, 0, 172, 173, 6, 20, 3, 0, 173, 45, 1, 0, 0, 0, 11, 0, 1, 2, 3, 66, 75, 86, 97, 110, 120, 167, 4, 5, 3, 0, 5, 1, 0, 5, 2, 0, 4, 0, 0] \ No newline at end of file +[4, 0, 18, 213, 6, -1, 6, -1, 6, -1, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 2, 9, 7, 9, 2, 10, 7, 10, 2, 11, 7, 11, 2, 12, 7, 12, 2, 13, 7, 13, 2, 14, 7, 14, 2, 15, 7, 15, 2, 16, 7, 16, 2, 17, 7, 17, 2, 18, 7, 18, 2, 19, 7, 19, 2, 20, 7, 20, 2, 21, 7, 21, 2, 22, 7, 22, 2, 23, 7, 23, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, 3, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 5, 4, 72, 8, 4, 10, 4, 12, 4, 75, 9, 4, 1, 4, 1, 4, 1, 4, 1, 4, 4, 4, 81, 8, 4, 11, 4, 12, 4, 82, 1, 4, 1, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 5, 5, 92, 8, 5, 10, 5, 12, 5, 95, 9, 5, 1, 5, 1, 5, 1, 5, 1, 5, 4, 5, 101, 8, 5, 11, 5, 12, 5, 102, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 5, 6, 112, 8, 6, 10, 6, 12, 6, 115, 9, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 5, 6, 123, 8, 6, 10, 6, 12, 6, 126, 9, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 5, 7, 136, 8, 7, 10, 7, 12, 7, 139, 9, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 5, 7, 146, 8, 7, 10, 7, 12, 7, 149, 9, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 9, 1, 9, 1, 9, 1, 9, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 10, 1, 11, 1, 11, 1, 11, 1, 11, 1, 12, 1, 12, 1, 13, 1, 13, 1, 14, 1, 14, 1, 15, 1, 15, 1, 15, 1, 15, 1, 16, 1, 16, 1, 16, 1, 16, 1, 17, 1, 17, 1, 18, 1, 18, 1, 18, 1, 18, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 19, 1, 20, 1, 20, 1, 20, 1, 20, 1, 21, 1, 21, 1, 22, 4, 22, 205, 8, 22, 11, 22, 12, 22, 206, 1, 23, 1, 23, 1, 23, 1, 23, 1, 23, 0, 0, 24, 4, 0, 6, 0, 8, 0, 10, 0, 12, 1, 14, 2, 16, 3, 18, 4, 20, 5, 22, 6, 24, 7, 26, 8, 28, 9, 30, 0, 32, 0, 34, 10, 36, 11, 38, 12, 40, 13, 42, 14, 44, 15, 46, 16, 48, 17, 50, 18, 4, 0, 1, 2, 3, 2, 2, 0, 9, 9, 32, 32, 1, 0, 125, 125, 212, 0, 12, 1, 0, 0, 0, 0, 14, 1, 0, 0, 0, 0, 16, 1, 0, 0, 0, 0, 18, 1, 0, 0, 0, 0, 20, 1, 0, 0, 0, 0, 22, 1, 0, 0, 0, 0, 24, 1, 0, 0, 0, 0, 26, 1, 0, 0, 0, 0, 28, 1, 0, 0, 0, 1, 34, 1, 0, 0, 0, 1, 36, 1, 0, 0, 0, 1, 38, 1, 0, 0, 0, 2, 40, 1, 0, 0, 0, 2, 42, 1, 0, 0, 0, 2, 44, 1, 0, 0, 0, 2, 46, 1, 0, 0, 0, 3, 48, 1, 0, 0, 0, 3, 50, 1, 0, 0, 0, 4, 52, 1, 0, 0, 0, 6, 56, 1, 0, 0, 0, 8, 59, 1, 0, 0, 0, 10, 62, 1, 0, 0, 0, 12, 65, 1, 0, 0, 0, 14, 86, 1, 0, 0, 0, 16, 106, 1, 0, 0, 0, 18, 130, 1, 0, 0, 0, 20, 153, 1, 0, 0, 0, 22, 157, 1, 0, 0, 0, 24, 161, 1, 0, 0, 0, 26, 167, 1, 0, 0, 0, 28, 171, 1, 0, 0, 0, 30, 173, 1, 0, 0, 0, 32, 175, 1, 0, 0, 0, 34, 177, 1, 0, 0, 0, 36, 181, 1, 0, 0, 0, 38, 185, 1, 0, 0, 0, 40, 187, 1, 0, 0, 0, 42, 191, 1, 0, 0, 0, 44, 197, 1, 0, 0, 0, 46, 201, 1, 0, 0, 0, 48, 204, 1, 0, 0, 0, 50, 208, 1, 0, 0, 0, 52, 53, 5, 36, 0, 0, 53, 54, 5, 36, 0, 0, 54, 55, 5, 123, 0, 0, 55, 5, 1, 0, 0, 0, 56, 57, 5, 36, 0, 0, 57, 58, 5, 123, 0, 0, 58, 7, 1, 0, 0, 0, 59, 60, 5, 123, 0, 0, 60, 61, 5, 123, 0, 0, 61, 9, 1, 0, 0, 0, 62, 63, 5, 125, 0, 0, 63, 64, 5, 125, 0, 0, 64, 11, 1, 0, 0, 0, 65, 66, 5, 123, 0, 0, 66, 67, 5, 123, 0, 0, 67, 68, 5, 37, 0, 0, 68, 69, 5, 45, 0, 0, 69, 73, 1, 0, 0, 0, 70, 72, 7, 0, 0, 0, 71, 70, 1, 0, 0, 0, 72, 75, 1, 0, 0, 0, 73, 71, 1, 0, 0, 0, 73, 74, 1, 0, 0, 0, 74, 76, 1, 0, 0, 0, 75, 73, 1, 0, 0, 0, 76, 77, 5, 105, 0, 0, 77, 78, 5, 102, 0, 0, 78, 80, 1, 0, 0, 0, 79, 81, 7, 0, 0, 0, 80, 79, 1, 0, 0, 0, 81, 82, 1, 0, 0, 0, 82, 80, 1, 0, 0, 0, 82, 83, 1, 0, 0, 0, 83, 84, 1, 0, 0, 0, 84, 85, 6, 4, 0, 0, 85, 13, 1, 0, 0, 0, 86, 87, 5, 123, 0, 0, 87, 88, 5, 123, 0, 0, 88, 89, 5, 37, 0, 0, 89, 93, 1, 0, 0, 0, 90, 92, 7, 0, 0, 0, 91, 90, 1, 0, 0, 0, 92, 95, 1, 0, 0, 0, 93, 91, 1, 0, 0, 0, 93, 94, 1, 0, 0, 0, 94, 96, 1, 0, 0, 0, 95, 93, 1, 0, 0, 0, 96, 97, 5, 105, 0, 0, 97, 98, 5, 102, 0, 0, 98, 100, 1, 0, 0, 0, 99, 101, 7, 0, 0, 0, 100, 99, 1, 0, 0, 0, 101, 102, 1, 0, 0, 0, 102, 100, 1, 0, 0, 0, 102, 103, 1, 0, 0, 0, 103, 104, 1, 0, 0, 0, 104, 105, 6, 5, 0, 0, 105, 15, 1, 0, 0, 0, 106, 107, 5, 123, 0, 0, 107, 108, 5, 123, 0, 0, 108, 109, 5, 37, 0, 0, 109, 113, 1, 0, 0, 0, 110, 112, 7, 0, 0, 0, 111, 110, 1, 0, 0, 0, 112, 115, 1, 0, 0, 0, 113, 111, 1, 0, 0, 0, 113, 114, 1, 0, 0, 0, 114, 116, 1, 0, 0, 0, 115, 113, 1, 0, 0, 0, 116, 117, 5, 101, 0, 0, 117, 118, 5, 108, 0, 0, 118, 119, 5, 115, 0, 0, 119, 120, 5, 101, 0, 0, 120, 124, 1, 0, 0, 0, 121, 123, 7, 0, 0, 0, 122, 121, 1, 0, 0, 0, 123, 126, 1, 0, 0, 0, 124, 122, 1, 0, 0, 0, 124, 125, 1, 0, 0, 0, 125, 127, 1, 0, 0, 0, 126, 124, 1, 0, 0, 0, 127, 128, 5, 125, 0, 0, 128, 129, 5, 125, 0, 0, 129, 17, 1, 0, 0, 0, 130, 131, 5, 123, 0, 0, 131, 132, 5, 123, 0, 0, 132, 133, 5, 37, 0, 0, 133, 137, 1, 0, 0, 0, 134, 136, 7, 0, 0, 0, 135, 134, 1, 0, 0, 0, 136, 139, 1, 0, 0, 0, 137, 135, 1, 0, 0, 0, 137, 138, 1, 0, 0, 0, 138, 140, 1, 0, 0, 0, 139, 137, 1, 0, 0, 0, 140, 141, 5, 101, 0, 0, 141, 142, 5, 110, 0, 0, 142, 143, 5, 100, 0, 0, 143, 147, 1, 0, 0, 0, 144, 146, 7, 0, 0, 0, 145, 144, 1, 0, 0, 0, 146, 149, 1, 0, 0, 0, 147, 145, 1, 0, 0, 0, 147, 148, 1, 0, 0, 0, 148, 150, 1, 0, 0, 0, 149, 147, 1, 0, 0, 0, 150, 151, 5, 125, 0, 0, 151, 152, 5, 125, 0, 0, 152, 19, 1, 0, 0, 0, 153, 154, 3, 4, 0, 0, 154, 155, 1, 0, 0, 0, 155, 156, 6, 8, 1, 0, 156, 21, 1, 0, 0, 0, 157, 158, 3, 6, 1, 0, 158, 159, 1, 0, 0, 0, 159, 160, 6, 9, 1, 0, 160, 23, 1, 0, 0, 0, 161, 162, 5, 123, 0, 0, 162, 163, 5, 123, 0, 0, 163, 164, 5, 45, 0, 0, 164, 165, 1, 0, 0, 0, 165, 166, 6, 10, 2, 0, 166, 25, 1, 0, 0, 0, 167, 168, 3, 8, 2, 0, 168, 169, 1, 0, 0, 0, 169, 170, 6, 11, 2, 0, 170, 27, 1, 0, 0, 0, 171, 172, 9, 0, 0, 0, 172, 29, 1, 0, 0, 0, 173, 174, 5, 123, 0, 0, 174, 31, 1, 0, 0, 0, 175, 176, 5, 125, 0, 0, 176, 33, 1, 0, 0, 0, 177, 178, 3, 30, 13, 0, 178, 179, 1, 0, 0, 0, 179, 180, 6, 15, 1, 0, 180, 35, 1, 0, 0, 0, 181, 182, 3, 32, 14, 0, 182, 183, 1, 0, 0, 0, 183, 184, 6, 16, 3, 0, 184, 37, 1, 0, 0, 0, 185, 186, 9, 0, 0, 0, 186, 39, 1, 0, 0, 0, 187, 188, 3, 30, 13, 0, 188, 189, 1, 0, 0, 0, 189, 190, 6, 18, 1, 0, 190, 41, 1, 0, 0, 0, 191, 192, 5, 45, 0, 0, 192, 193, 5, 125, 0, 0, 193, 194, 5, 125, 0, 0, 194, 195, 1, 0, 0, 0, 195, 196, 6, 19, 3, 0, 196, 43, 1, 0, 0, 0, 197, 198, 3, 10, 3, 0, 198, 199, 1, 0, 0, 0, 199, 200, 6, 20, 3, 0, 200, 45, 1, 0, 0, 0, 201, 202, 9, 0, 0, 0, 202, 47, 1, 0, 0, 0, 203, 205, 8, 1, 0, 0, 204, 203, 1, 0, 0, 0, 205, 206, 1, 0, 0, 0, 206, 204, 1, 0, 0, 0, 206, 207, 1, 0, 0, 0, 207, 49, 1, 0, 0, 0, 208, 209, 5, 125, 0, 0, 209, 210, 5, 125, 0, 0, 210, 211, 1, 0, 0, 0, 211, 212, 6, 23, 3, 0, 212, 51, 1, 0, 0, 0, 13, 0, 1, 2, 3, 73, 82, 93, 102, 113, 124, 137, 147, 206, 4, 5, 3, 0, 5, 1, 0, 5, 2, 0, 4, 0, 0] \ No newline at end of file diff --git a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexer.java b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexer.java index 222a3c0d77..ccb241b011 100644 --- a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexer.java +++ b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexer.java @@ -19,9 +19,10 @@ public class TemplateLexer extends Lexer { protected static final PredictionContextCache _sharedContextCache = new PredictionContextCache(); public static final int - STARTBLOCKIF=1, STARTBLOCKELSE=2, STARTBLOCKEND=3, STARTESCEXPR=4, STARTEXPR=5, - STARTEXPR2=6, TEXT=7, LBRACE=8, RBRACE=9, EXPRESSION=10, LBRACE2=11, RBRACE2=12, - EXPRESSION2=13, BLOCK_IF_CONTENT=14, BLOCK_IF_RBRACE=15; + STARTBLOCKIF_LTRIM=1, STARTBLOCKIF=2, STARTBLOCKELSE=3, STARTBLOCKEND=4, + STARTESCEXPR=5, STARTEXPR=6, STARTEXPR2_LTRIM=7, STARTEXPR2=8, TEXT=9, + LBRACE=10, RBRACE=11, EXPRESSION=12, LBRACE2=13, RBRACE2_RTRIM=14, RBRACE2=15, + EXPRESSION2=16, BLOCK_IF_CONTENT=17, BLOCK_IF_RBRACE=18; public static final int Expression=1, Expression2=2, BlockIfContent=3; public static String[] channelNames = { @@ -34,26 +35,28 @@ public class TemplateLexer extends Lexer { private static String[] makeRuleNames() { return new String[] { - "StartEscExpr", "StartExpr", "StartExpr2", "EndExpr2", "STARTBLOCKIF", - "STARTBLOCKELSE", "STARTBLOCKEND", "STARTESCEXPR", "STARTEXPR", "STARTEXPR2", - "TEXT", "LBrace", "RBrace", "LBRACE", "RBRACE", "EXPRESSION", "LBRACE2", - "RBRACE2", "EXPRESSION2", "BLOCK_IF_CONTENT", "BLOCK_IF_RBRACE" + "StartEscExpr", "StartExpr", "StartExpr2", "EndExpr2", "STARTBLOCKIF_LTRIM", + "STARTBLOCKIF", "STARTBLOCKELSE", "STARTBLOCKEND", "STARTESCEXPR", "STARTEXPR", + "STARTEXPR2_LTRIM", "STARTEXPR2", "TEXT", "LBrace", "RBrace", "LBRACE", + "RBRACE", "EXPRESSION", "LBRACE2", "RBRACE2_RTRIM", "RBRACE2", "EXPRESSION2", + "BLOCK_IF_CONTENT", "BLOCK_IF_RBRACE" }; } public static final String[] ruleNames = makeRuleNames(); private static String[] makeLiteralNames() { return new String[] { - null, null, null, null, null, null, null, null, null, null, null, null, - null, null, null, "'}}'" + null, null, null, null, null, null, null, "'{{-'", null, null, null, + null, null, null, "'-}}'", null, null, null, "'}}'" }; } private static final String[] _LITERAL_NAMES = makeLiteralNames(); private static String[] makeSymbolicNames() { return new String[] { - null, "STARTBLOCKIF", "STARTBLOCKELSE", "STARTBLOCKEND", "STARTESCEXPR", - "STARTEXPR", "STARTEXPR2", "TEXT", "LBRACE", "RBRACE", "EXPRESSION", - "LBRACE2", "RBRACE2", "EXPRESSION2", "BLOCK_IF_CONTENT", "BLOCK_IF_RBRACE" + null, "STARTBLOCKIF_LTRIM", "STARTBLOCKIF", "STARTBLOCKELSE", "STARTBLOCKEND", + "STARTESCEXPR", "STARTEXPR", "STARTEXPR2_LTRIM", "STARTEXPR2", "TEXT", + "LBRACE", "RBRACE", "EXPRESSION", "LBRACE2", "RBRACE2_RTRIM", "RBRACE2", + "EXPRESSION2", "BLOCK_IF_CONTENT", "BLOCK_IF_RBRACE" }; } private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); @@ -115,108 +118,134 @@ public TemplateLexer(CharStream input) { public ATN getATN() { return _ATN; } public static final String _serializedATN = - "\u0004\u0000\u000f\u00ae\u0006\uffff\uffff\u0006\uffff\uffff\u0006\uffff"+ + "\u0004\u0000\u0012\u00d5\u0006\uffff\uffff\u0006\uffff\uffff\u0006\uffff"+ "\uffff\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001\u0007\u0001"+ "\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004\u0007\u0004"+ "\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007\u0007\u0007"+ "\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b\u0007\u000b"+ "\u0002\f\u0007\f\u0002\r\u0007\r\u0002\u000e\u0007\u000e\u0002\u000f\u0007"+ "\u000f\u0002\u0010\u0007\u0010\u0002\u0011\u0007\u0011\u0002\u0012\u0007"+ - "\u0012\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014\u0001\u0000\u0001"+ + "\u0012\u0002\u0013\u0007\u0013\u0002\u0014\u0007\u0014\u0002\u0015\u0007"+ + "\u0015\u0002\u0016\u0007\u0016\u0002\u0017\u0007\u0017\u0001\u0000\u0001"+ "\u0000\u0001\u0000\u0001\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001"+ "\u0002\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0003\u0001"+ - "\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0005\u0004A\b"+ - "\u0004\n\u0004\f\u0004D\t\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001"+ - "\u0004\u0004\u0004J\b\u0004\u000b\u0004\f\u0004K\u0001\u0004\u0001\u0004"+ - "\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0005\u0005"+ - "U\b\u0005\n\u0005\f\u0005X\t\u0005\u0001\u0005\u0001\u0005\u0001\u0005"+ - "\u0001\u0005\u0001\u0005\u0001\u0005\u0005\u0005`\b\u0005\n\u0005\f\u0005"+ - "c\t\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0006\u0001\u0006"+ - "\u0001\u0006\u0001\u0006\u0001\u0006\u0005\u0006m\b\u0006\n\u0006\f\u0006"+ - "p\t\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+ - "\u0005\u0006w\b\u0006\n\u0006\f\u0006z\t\u0006\u0001\u0006\u0001\u0006"+ - "\u0001\u0006\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\b\u0001"+ - "\b\u0001\b\u0001\b\u0001\t\u0001\t\u0001\t\u0001\t\u0001\n\u0001\n\u0001"+ - "\u000b\u0001\u000b\u0001\f\u0001\f\u0001\r\u0001\r\u0001\r\u0001\r\u0001"+ - "\u000e\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000f\u0001\u000f\u0001"+ - "\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011\u0001"+ - "\u0011\u0001\u0011\u0001\u0012\u0001\u0012\u0001\u0013\u0004\u0013\u00a6"+ - "\b\u0013\u000b\u0013\f\u0013\u00a7\u0001\u0014\u0001\u0014\u0001\u0014"+ - "\u0001\u0014\u0001\u0014\u0000\u0000\u0015\u0004\u0000\u0006\u0000\b\u0000"+ - "\n\u0000\f\u0001\u000e\u0002\u0010\u0003\u0012\u0004\u0014\u0005\u0016"+ - "\u0006\u0018\u0007\u001a\u0000\u001c\u0000\u001e\b \t\"\n$\u000b&\f(\r"+ - "*\u000e,\u000f\u0004\u0000\u0001\u0002\u0003\u0002\u0002\u0000\t\t \u0001"+ - "\u0000}}\u00ab\u0000\f\u0001\u0000\u0000\u0000\u0000\u000e\u0001\u0000"+ - "\u0000\u0000\u0000\u0010\u0001\u0000\u0000\u0000\u0000\u0012\u0001\u0000"+ - "\u0000\u0000\u0000\u0014\u0001\u0000\u0000\u0000\u0000\u0016\u0001\u0000"+ - "\u0000\u0000\u0000\u0018\u0001\u0000\u0000\u0000\u0001\u001e\u0001\u0000"+ - "\u0000\u0000\u0001 \u0001\u0000\u0000\u0000\u0001\"\u0001\u0000\u0000"+ - "\u0000\u0002$\u0001\u0000\u0000\u0000\u0002&\u0001\u0000\u0000\u0000\u0002"+ - "(\u0001\u0000\u0000\u0000\u0003*\u0001\u0000\u0000\u0000\u0003,\u0001"+ - "\u0000\u0000\u0000\u0004.\u0001\u0000\u0000\u0000\u00062\u0001\u0000\u0000"+ - "\u0000\b5\u0001\u0000\u0000\u0000\n8\u0001\u0000\u0000\u0000\f;\u0001"+ - "\u0000\u0000\u0000\u000eO\u0001\u0000\u0000\u0000\u0010g\u0001\u0000\u0000"+ - "\u0000\u0012~\u0001\u0000\u0000\u0000\u0014\u0082\u0001\u0000\u0000\u0000"+ - "\u0016\u0086\u0001\u0000\u0000\u0000\u0018\u008a\u0001\u0000\u0000\u0000"+ - "\u001a\u008c\u0001\u0000\u0000\u0000\u001c\u008e\u0001\u0000\u0000\u0000"+ - "\u001e\u0090\u0001\u0000\u0000\u0000 \u0094\u0001\u0000\u0000\u0000\""+ - "\u0098\u0001\u0000\u0000\u0000$\u009a\u0001\u0000\u0000\u0000&\u009e\u0001"+ - "\u0000\u0000\u0000(\u00a2\u0001\u0000\u0000\u0000*\u00a5\u0001\u0000\u0000"+ - "\u0000,\u00a9\u0001\u0000\u0000\u0000./\u0005$\u0000\u0000/0\u0005$\u0000"+ - "\u000001\u0005{\u0000\u00001\u0005\u0001\u0000\u0000\u000023\u0005$\u0000"+ - "\u000034\u0005{\u0000\u00004\u0007\u0001\u0000\u0000\u000056\u0005{\u0000"+ - "\u000067\u0005{\u0000\u00007\t\u0001\u0000\u0000\u000089\u0005}\u0000"+ - "\u00009:\u0005}\u0000\u0000:\u000b\u0001\u0000\u0000\u0000;<\u0005{\u0000"+ - "\u0000<=\u0005{\u0000\u0000=>\u0005%\u0000\u0000>B\u0001\u0000\u0000\u0000"+ - "?A\u0007\u0000\u0000\u0000@?\u0001\u0000\u0000\u0000AD\u0001\u0000\u0000"+ - "\u0000B@\u0001\u0000\u0000\u0000BC\u0001\u0000\u0000\u0000CE\u0001\u0000"+ - "\u0000\u0000DB\u0001\u0000\u0000\u0000EF\u0005i\u0000\u0000FG\u0005f\u0000"+ - "\u0000GI\u0001\u0000\u0000\u0000HJ\u0007\u0000\u0000\u0000IH\u0001\u0000"+ - "\u0000\u0000JK\u0001\u0000\u0000\u0000KI\u0001\u0000\u0000\u0000KL\u0001"+ - "\u0000\u0000\u0000LM\u0001\u0000\u0000\u0000MN\u0006\u0004\u0000\u0000"+ - "N\r\u0001\u0000\u0000\u0000OP\u0005{\u0000\u0000PQ\u0005{\u0000\u0000"+ - "QR\u0005%\u0000\u0000RV\u0001\u0000\u0000\u0000SU\u0007\u0000\u0000\u0000"+ - "TS\u0001\u0000\u0000\u0000UX\u0001\u0000\u0000\u0000VT\u0001\u0000\u0000"+ - "\u0000VW\u0001\u0000\u0000\u0000WY\u0001\u0000\u0000\u0000XV\u0001\u0000"+ - "\u0000\u0000YZ\u0005e\u0000\u0000Z[\u0005l\u0000\u0000[\\\u0005s\u0000"+ - "\u0000\\]\u0005e\u0000\u0000]a\u0001\u0000\u0000\u0000^`\u0007\u0000\u0000"+ - "\u0000_^\u0001\u0000\u0000\u0000`c\u0001\u0000\u0000\u0000a_\u0001\u0000"+ - "\u0000\u0000ab\u0001\u0000\u0000\u0000bd\u0001\u0000\u0000\u0000ca\u0001"+ - "\u0000\u0000\u0000de\u0005}\u0000\u0000ef\u0005}\u0000\u0000f\u000f\u0001"+ - "\u0000\u0000\u0000gh\u0005{\u0000\u0000hi\u0005{\u0000\u0000ij\u0005%"+ - "\u0000\u0000jn\u0001\u0000\u0000\u0000km\u0007\u0000\u0000\u0000lk\u0001"+ - "\u0000\u0000\u0000mp\u0001\u0000\u0000\u0000nl\u0001\u0000\u0000\u0000"+ - "no\u0001\u0000\u0000\u0000oq\u0001\u0000\u0000\u0000pn\u0001\u0000\u0000"+ - "\u0000qr\u0005e\u0000\u0000rs\u0005n\u0000\u0000st\u0005d\u0000\u0000"+ - "tx\u0001\u0000\u0000\u0000uw\u0007\u0000\u0000\u0000vu\u0001\u0000\u0000"+ - "\u0000wz\u0001\u0000\u0000\u0000xv\u0001\u0000\u0000\u0000xy\u0001\u0000"+ - "\u0000\u0000y{\u0001\u0000\u0000\u0000zx\u0001\u0000\u0000\u0000{|\u0005"+ - "}\u0000\u0000|}\u0005}\u0000\u0000}\u0011\u0001\u0000\u0000\u0000~\u007f"+ - "\u0003\u0004\u0000\u0000\u007f\u0080\u0001\u0000\u0000\u0000\u0080\u0081"+ - "\u0006\u0007\u0001\u0000\u0081\u0013\u0001\u0000\u0000\u0000\u0082\u0083"+ - "\u0003\u0006\u0001\u0000\u0083\u0084\u0001\u0000\u0000\u0000\u0084\u0085"+ - "\u0006\b\u0001\u0000\u0085\u0015\u0001\u0000\u0000\u0000\u0086\u0087\u0003"+ - "\b\u0002\u0000\u0087\u0088\u0001\u0000\u0000\u0000\u0088\u0089\u0006\t"+ - "\u0002\u0000\u0089\u0017\u0001\u0000\u0000\u0000\u008a\u008b\t\u0000\u0000"+ - "\u0000\u008b\u0019\u0001\u0000\u0000\u0000\u008c\u008d\u0005{\u0000\u0000"+ - "\u008d\u001b\u0001\u0000\u0000\u0000\u008e\u008f\u0005}\u0000\u0000\u008f"+ - "\u001d\u0001\u0000\u0000\u0000\u0090\u0091\u0003\u001a\u000b\u0000\u0091"+ - "\u0092\u0001\u0000\u0000\u0000\u0092\u0093\u0006\r\u0001\u0000\u0093\u001f"+ - "\u0001\u0000\u0000\u0000\u0094\u0095\u0003\u001c\f\u0000\u0095\u0096\u0001"+ - "\u0000\u0000\u0000\u0096\u0097\u0006\u000e\u0003\u0000\u0097!\u0001\u0000"+ - "\u0000\u0000\u0098\u0099\t\u0000\u0000\u0000\u0099#\u0001\u0000\u0000"+ - "\u0000\u009a\u009b\u0003\u001a\u000b\u0000\u009b\u009c\u0001\u0000\u0000"+ - "\u0000\u009c\u009d\u0006\u0010\u0001\u0000\u009d%\u0001\u0000\u0000\u0000"+ - "\u009e\u009f\u0003\n\u0003\u0000\u009f\u00a0\u0001\u0000\u0000\u0000\u00a0"+ - "\u00a1\u0006\u0011\u0003\u0000\u00a1\'\u0001\u0000\u0000\u0000\u00a2\u00a3"+ - "\t\u0000\u0000\u0000\u00a3)\u0001\u0000\u0000\u0000\u00a4\u00a6\b\u0001"+ - "\u0000\u0000\u00a5\u00a4\u0001\u0000\u0000\u0000\u00a6\u00a7\u0001\u0000"+ - "\u0000\u0000\u00a7\u00a5\u0001\u0000\u0000\u0000\u00a7\u00a8\u0001\u0000"+ - "\u0000\u0000\u00a8+\u0001\u0000\u0000\u0000\u00a9\u00aa\u0005}\u0000\u0000"+ - "\u00aa\u00ab\u0005}\u0000\u0000\u00ab\u00ac\u0001\u0000\u0000\u0000\u00ac"+ - "\u00ad\u0006\u0014\u0003\u0000\u00ad-\u0001\u0000\u0000\u0000\u000b\u0000"+ - "\u0001\u0002\u0003BKVanx\u00a7\u0004\u0005\u0003\u0000\u0005\u0001\u0000"+ - "\u0005\u0002\u0000\u0004\u0000\u0000"; + "\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0005"+ + "\u0004H\b\u0004\n\u0004\f\u0004K\t\u0004\u0001\u0004\u0001\u0004\u0001"+ + "\u0004\u0001\u0004\u0004\u0004Q\b\u0004\u000b\u0004\f\u0004R\u0001\u0004"+ + "\u0001\u0004\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005"+ + "\u0005\u0005\\\b\u0005\n\u0005\f\u0005_\t\u0005\u0001\u0005\u0001\u0005"+ + "\u0001\u0005\u0001\u0005\u0004\u0005e\b\u0005\u000b\u0005\f\u0005f\u0001"+ + "\u0005\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001"+ + "\u0006\u0005\u0006p\b\u0006\n\u0006\f\u0006s\t\u0006\u0001\u0006\u0001"+ + "\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0005\u0006{\b"+ + "\u0006\n\u0006\f\u0006~\t\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001"+ + "\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0005\u0007\u0088"+ + "\b\u0007\n\u0007\f\u0007\u008b\t\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+ + "\u0001\u0007\u0001\u0007\u0005\u0007\u0092\b\u0007\n\u0007\f\u0007\u0095"+ + "\t\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\b\u0001\b\u0001\b\u0001"+ + "\b\u0001\t\u0001\t\u0001\t\u0001\t\u0001\n\u0001\n\u0001\n\u0001\n\u0001"+ + "\n\u0001\n\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\f\u0001"+ + "\f\u0001\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000f\u0001\u000f\u0001"+ + "\u000f\u0001\u000f\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001"+ + "\u0011\u0001\u0011\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0012\u0001"+ + "\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0013\u0001"+ + "\u0014\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0015\u0001\u0015\u0001"+ + "\u0016\u0004\u0016\u00cd\b\u0016\u000b\u0016\f\u0016\u00ce\u0001\u0017"+ + "\u0001\u0017\u0001\u0017\u0001\u0017\u0001\u0017\u0000\u0000\u0018\u0004"+ + "\u0000\u0006\u0000\b\u0000\n\u0000\f\u0001\u000e\u0002\u0010\u0003\u0012"+ + "\u0004\u0014\u0005\u0016\u0006\u0018\u0007\u001a\b\u001c\t\u001e\u0000"+ + " \u0000\"\n$\u000b&\f(\r*\u000e,\u000f.\u00100\u00112\u0012\u0004\u0000"+ + "\u0001\u0002\u0003\u0002\u0002\u0000\t\t \u0001\u0000}}\u00d4\u0000\f"+ + "\u0001\u0000\u0000\u0000\u0000\u000e\u0001\u0000\u0000\u0000\u0000\u0010"+ + "\u0001\u0000\u0000\u0000\u0000\u0012\u0001\u0000\u0000\u0000\u0000\u0014"+ + "\u0001\u0000\u0000\u0000\u0000\u0016\u0001\u0000\u0000\u0000\u0000\u0018"+ + "\u0001\u0000\u0000\u0000\u0000\u001a\u0001\u0000\u0000\u0000\u0000\u001c"+ + "\u0001\u0000\u0000\u0000\u0001\"\u0001\u0000\u0000\u0000\u0001$\u0001"+ + "\u0000\u0000\u0000\u0001&\u0001\u0000\u0000\u0000\u0002(\u0001\u0000\u0000"+ + "\u0000\u0002*\u0001\u0000\u0000\u0000\u0002,\u0001\u0000\u0000\u0000\u0002"+ + ".\u0001\u0000\u0000\u0000\u00030\u0001\u0000\u0000\u0000\u00032\u0001"+ + "\u0000\u0000\u0000\u00044\u0001\u0000\u0000\u0000\u00068\u0001\u0000\u0000"+ + "\u0000\b;\u0001\u0000\u0000\u0000\n>\u0001\u0000\u0000\u0000\fA\u0001"+ + "\u0000\u0000\u0000\u000eV\u0001\u0000\u0000\u0000\u0010j\u0001\u0000\u0000"+ + "\u0000\u0012\u0082\u0001\u0000\u0000\u0000\u0014\u0099\u0001\u0000\u0000"+ + "\u0000\u0016\u009d\u0001\u0000\u0000\u0000\u0018\u00a1\u0001\u0000\u0000"+ + "\u0000\u001a\u00a7\u0001\u0000\u0000\u0000\u001c\u00ab\u0001\u0000\u0000"+ + "\u0000\u001e\u00ad\u0001\u0000\u0000\u0000 \u00af\u0001\u0000\u0000\u0000"+ + "\"\u00b1\u0001\u0000\u0000\u0000$\u00b5\u0001\u0000\u0000\u0000&\u00b9"+ + "\u0001\u0000\u0000\u0000(\u00bb\u0001\u0000\u0000\u0000*\u00bf\u0001\u0000"+ + "\u0000\u0000,\u00c5\u0001\u0000\u0000\u0000.\u00c9\u0001\u0000\u0000\u0000"+ + "0\u00cc\u0001\u0000\u0000\u00002\u00d0\u0001\u0000\u0000\u000045\u0005"+ + "$\u0000\u000056\u0005$\u0000\u000067\u0005{\u0000\u00007\u0005\u0001\u0000"+ + "\u0000\u000089\u0005$\u0000\u00009:\u0005{\u0000\u0000:\u0007\u0001\u0000"+ + "\u0000\u0000;<\u0005{\u0000\u0000<=\u0005{\u0000\u0000=\t\u0001\u0000"+ + "\u0000\u0000>?\u0005}\u0000\u0000?@\u0005}\u0000\u0000@\u000b\u0001\u0000"+ + "\u0000\u0000AB\u0005{\u0000\u0000BC\u0005{\u0000\u0000CD\u0005%\u0000"+ + "\u0000DE\u0005-\u0000\u0000EI\u0001\u0000\u0000\u0000FH\u0007\u0000\u0000"+ + "\u0000GF\u0001\u0000\u0000\u0000HK\u0001\u0000\u0000\u0000IG\u0001\u0000"+ + "\u0000\u0000IJ\u0001\u0000\u0000\u0000JL\u0001\u0000\u0000\u0000KI\u0001"+ + "\u0000\u0000\u0000LM\u0005i\u0000\u0000MN\u0005f\u0000\u0000NP\u0001\u0000"+ + "\u0000\u0000OQ\u0007\u0000\u0000\u0000PO\u0001\u0000\u0000\u0000QR\u0001"+ + "\u0000\u0000\u0000RP\u0001\u0000\u0000\u0000RS\u0001\u0000\u0000\u0000"+ + "ST\u0001\u0000\u0000\u0000TU\u0006\u0004\u0000\u0000U\r\u0001\u0000\u0000"+ + "\u0000VW\u0005{\u0000\u0000WX\u0005{\u0000\u0000XY\u0005%\u0000\u0000"+ + "Y]\u0001\u0000\u0000\u0000Z\\\u0007\u0000\u0000\u0000[Z\u0001\u0000\u0000"+ + "\u0000\\_\u0001\u0000\u0000\u0000][\u0001\u0000\u0000\u0000]^\u0001\u0000"+ + "\u0000\u0000^`\u0001\u0000\u0000\u0000_]\u0001\u0000\u0000\u0000`a\u0005"+ + "i\u0000\u0000ab\u0005f\u0000\u0000bd\u0001\u0000\u0000\u0000ce\u0007\u0000"+ + "\u0000\u0000dc\u0001\u0000\u0000\u0000ef\u0001\u0000\u0000\u0000fd\u0001"+ + "\u0000\u0000\u0000fg\u0001\u0000\u0000\u0000gh\u0001\u0000\u0000\u0000"+ + "hi\u0006\u0005\u0000\u0000i\u000f\u0001\u0000\u0000\u0000jk\u0005{\u0000"+ + "\u0000kl\u0005{\u0000\u0000lm\u0005%\u0000\u0000mq\u0001\u0000\u0000\u0000"+ + "np\u0007\u0000\u0000\u0000on\u0001\u0000\u0000\u0000ps\u0001\u0000\u0000"+ + "\u0000qo\u0001\u0000\u0000\u0000qr\u0001\u0000\u0000\u0000rt\u0001\u0000"+ + "\u0000\u0000sq\u0001\u0000\u0000\u0000tu\u0005e\u0000\u0000uv\u0005l\u0000"+ + "\u0000vw\u0005s\u0000\u0000wx\u0005e\u0000\u0000x|\u0001\u0000\u0000\u0000"+ + "y{\u0007\u0000\u0000\u0000zy\u0001\u0000\u0000\u0000{~\u0001\u0000\u0000"+ + "\u0000|z\u0001\u0000\u0000\u0000|}\u0001\u0000\u0000\u0000}\u007f\u0001"+ + "\u0000\u0000\u0000~|\u0001\u0000\u0000\u0000\u007f\u0080\u0005}\u0000"+ + "\u0000\u0080\u0081\u0005}\u0000\u0000\u0081\u0011\u0001\u0000\u0000\u0000"+ + "\u0082\u0083\u0005{\u0000\u0000\u0083\u0084\u0005{\u0000\u0000\u0084\u0085"+ + "\u0005%\u0000\u0000\u0085\u0089\u0001\u0000\u0000\u0000\u0086\u0088\u0007"+ + "\u0000\u0000\u0000\u0087\u0086\u0001\u0000\u0000\u0000\u0088\u008b\u0001"+ + "\u0000\u0000\u0000\u0089\u0087\u0001\u0000\u0000\u0000\u0089\u008a\u0001"+ + "\u0000\u0000\u0000\u008a\u008c\u0001\u0000\u0000\u0000\u008b\u0089\u0001"+ + "\u0000\u0000\u0000\u008c\u008d\u0005e\u0000\u0000\u008d\u008e\u0005n\u0000"+ + "\u0000\u008e\u008f\u0005d\u0000\u0000\u008f\u0093\u0001\u0000\u0000\u0000"+ + "\u0090\u0092\u0007\u0000\u0000\u0000\u0091\u0090\u0001\u0000\u0000\u0000"+ + "\u0092\u0095\u0001\u0000\u0000\u0000\u0093\u0091\u0001\u0000\u0000\u0000"+ + "\u0093\u0094\u0001\u0000\u0000\u0000\u0094\u0096\u0001\u0000\u0000\u0000"+ + "\u0095\u0093\u0001\u0000\u0000\u0000\u0096\u0097\u0005}\u0000\u0000\u0097"+ + "\u0098\u0005}\u0000\u0000\u0098\u0013\u0001\u0000\u0000\u0000\u0099\u009a"+ + "\u0003\u0004\u0000\u0000\u009a\u009b\u0001\u0000\u0000\u0000\u009b\u009c"+ + "\u0006\b\u0001\u0000\u009c\u0015\u0001\u0000\u0000\u0000\u009d\u009e\u0003"+ + "\u0006\u0001\u0000\u009e\u009f\u0001\u0000\u0000\u0000\u009f\u00a0\u0006"+ + "\t\u0001\u0000\u00a0\u0017\u0001\u0000\u0000\u0000\u00a1\u00a2\u0005{"+ + "\u0000\u0000\u00a2\u00a3\u0005{\u0000\u0000\u00a3\u00a4\u0005-\u0000\u0000"+ + "\u00a4\u00a5\u0001\u0000\u0000\u0000\u00a5\u00a6\u0006\n\u0002\u0000\u00a6"+ + "\u0019\u0001\u0000\u0000\u0000\u00a7\u00a8\u0003\b\u0002\u0000\u00a8\u00a9"+ + "\u0001\u0000\u0000\u0000\u00a9\u00aa\u0006\u000b\u0002\u0000\u00aa\u001b"+ + "\u0001\u0000\u0000\u0000\u00ab\u00ac\t\u0000\u0000\u0000\u00ac\u001d\u0001"+ + "\u0000\u0000\u0000\u00ad\u00ae\u0005{\u0000\u0000\u00ae\u001f\u0001\u0000"+ + "\u0000\u0000\u00af\u00b0\u0005}\u0000\u0000\u00b0!\u0001\u0000\u0000\u0000"+ + "\u00b1\u00b2\u0003\u001e\r\u0000\u00b2\u00b3\u0001\u0000\u0000\u0000\u00b3"+ + "\u00b4\u0006\u000f\u0001\u0000\u00b4#\u0001\u0000\u0000\u0000\u00b5\u00b6"+ + "\u0003 \u000e\u0000\u00b6\u00b7\u0001\u0000\u0000\u0000\u00b7\u00b8\u0006"+ + "\u0010\u0003\u0000\u00b8%\u0001\u0000\u0000\u0000\u00b9\u00ba\t\u0000"+ + "\u0000\u0000\u00ba\'\u0001\u0000\u0000\u0000\u00bb\u00bc\u0003\u001e\r"+ + "\u0000\u00bc\u00bd\u0001\u0000\u0000\u0000\u00bd\u00be\u0006\u0012\u0001"+ + "\u0000\u00be)\u0001\u0000\u0000\u0000\u00bf\u00c0\u0005-\u0000\u0000\u00c0"+ + "\u00c1\u0005}\u0000\u0000\u00c1\u00c2\u0005}\u0000\u0000\u00c2\u00c3\u0001"+ + "\u0000\u0000\u0000\u00c3\u00c4\u0006\u0013\u0003\u0000\u00c4+\u0001\u0000"+ + "\u0000\u0000\u00c5\u00c6\u0003\n\u0003\u0000\u00c6\u00c7\u0001\u0000\u0000"+ + "\u0000\u00c7\u00c8\u0006\u0014\u0003\u0000\u00c8-\u0001\u0000\u0000\u0000"+ + "\u00c9\u00ca\t\u0000\u0000\u0000\u00ca/\u0001\u0000\u0000\u0000\u00cb"+ + "\u00cd\b\u0001\u0000\u0000\u00cc\u00cb\u0001\u0000\u0000\u0000\u00cd\u00ce"+ + "\u0001\u0000\u0000\u0000\u00ce\u00cc\u0001\u0000\u0000\u0000\u00ce\u00cf"+ + "\u0001\u0000\u0000\u0000\u00cf1\u0001\u0000\u0000\u0000\u00d0\u00d1\u0005"+ + "}\u0000\u0000\u00d1\u00d2\u0005}\u0000\u0000\u00d2\u00d3\u0001\u0000\u0000"+ + "\u0000\u00d3\u00d4\u0006\u0017\u0003\u0000\u00d43\u0001\u0000\u0000\u0000"+ + "\r\u0000\u0001\u0002\u0003IR]fq|\u0089\u0093\u00ce\u0004\u0005\u0003\u0000"+ + "\u0005\u0001\u0000\u0005\u0002\u0000\u0004\u0000\u0000"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { diff --git a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexer.tokens b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexer.tokens index 231b14eda4..0a27d1b66b 100644 --- a/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexer.tokens +++ b/oap-formats/oap-template/src/main/java-antlr-generated/oap/template/TemplateLexer.tokens @@ -1,16 +1,21 @@ -STARTBLOCKIF=1 -STARTBLOCKELSE=2 -STARTBLOCKEND=3 -STARTESCEXPR=4 -STARTEXPR=5 -STARTEXPR2=6 -TEXT=7 -LBRACE=8 -RBRACE=9 -EXPRESSION=10 -LBRACE2=11 -RBRACE2=12 -EXPRESSION2=13 -BLOCK_IF_CONTENT=14 -BLOCK_IF_RBRACE=15 -'}}'=15 +STARTBLOCKIF_LTRIM=1 +STARTBLOCKIF=2 +STARTBLOCKELSE=3 +STARTBLOCKEND=4 +STARTESCEXPR=5 +STARTEXPR=6 +STARTEXPR2_LTRIM=7 +STARTEXPR2=8 +TEXT=9 +LBRACE=10 +RBRACE=11 +EXPRESSION=12 +LBRACE2=13 +RBRACE2_RTRIM=14 +RBRACE2=15 +EXPRESSION2=16 +BLOCK_IF_CONTENT=17 +BLOCK_IF_RBRACE=18 +'{{-'=7 +'-}}'=14 +'}}'=18 diff --git a/oap-formats/oap-template/src/main/java/oap/template/render/TemplateAstUtils.java b/oap-formats/oap-template/src/main/java/oap/template/render/TemplateAstUtils.java index 7cc6a8001a..76eab1751d 100644 --- a/oap-formats/oap-template/src/main/java/oap/template/render/TemplateAstUtils.java +++ b/oap-formats/oap-template/src/main/java/oap/template/render/TemplateAstUtils.java @@ -59,6 +59,8 @@ import java.util.Optional; import static oap.template.ErrorStrategy.IGNORE; +import static org.apache.commons.lang3.StringUtils.stripEnd; +import static org.apache.commons.lang3.StringUtils.stripStart; @Slf4j public class TemplateAstUtils { @@ -437,8 +439,34 @@ private static AstRender wrap( Exprs exprs, Func function, TemplateType parentTe return list.head(); } + @SuppressWarnings( "checkstyle:ModifiedControlVariable" ) + private static void applyWhitespaceTrim( List elements ) { + for( int i = 0; i < elements.size(); i++ ) { + Element el = elements.get( i ); + boolean ltrim = el instanceof ExpressionElement e && e.trimLeft + || el instanceof BlockIfElement b && b.trimLeft; + boolean rtrim = el instanceof ExpressionElement e3 && e3.trimRight; + + if( ltrim && i > 0 && elements.get( i - 1 ) instanceof TextElement prev ) { + String trimmed = stripEnd( prev.text, " \t\r\n" ); + if( trimmed.isEmpty() ) { + elements.remove( i - 1 ); + i--; + } else { + elements.set( i - 1, new TextElement( trimmed ) ); + } + } + if( rtrim && i + 1 < elements.size() && elements.get( i + 1 ) instanceof TextElement next ) { + String trimmed = stripStart( next.text, " \t\r\n" ); + if( trimmed.isEmpty() ) elements.remove( i + 1 ); + else elements.set( i + 1, new TextElement( trimmed ) ); + } + } + } + @SuppressWarnings( "checkstyle:OverloadMethodsDeclarationOrder" ) public static AstRenderRoot toAst( Elements elements, TemplateType templateType, Map> builtInFunction, ErrorStrategy errorStrategy ) { + applyWhitespaceTrim( elements.elements ); AstRenderRoot astRoot = new AstRenderRoot( templateType ); for( Element element : elements.elements ) { AstRender astRender; diff --git a/oap-formats/oap-template/src/main/java/oap/template/tree/BlockIfElement.java b/oap-formats/oap-template/src/main/java/oap/template/tree/BlockIfElement.java index 034f6e881d..29ac4a10a0 100644 --- a/oap-formats/oap-template/src/main/java/oap/template/tree/BlockIfElement.java +++ b/oap-formats/oap-template/src/main/java/oap/template/tree/BlockIfElement.java @@ -34,16 +34,23 @@ public class BlockIfElement implements Element { public final Elements thenElements; @Nullable public final Elements elseElements; + public final boolean trimLeft; public BlockIfElement( String conditionPath, Elements thenElements, @Nullable Elements elseElements ) { + this( conditionPath, thenElements, elseElements, false ); + } + + public BlockIfElement( String conditionPath, Elements thenElements, @Nullable Elements elseElements, boolean trimLeft ) { this.conditionPath = conditionPath; this.thenElements = thenElements; this.elseElements = elseElements; + this.trimLeft = trimLeft; } @Override public String print() { - StringBuilder sb = new StringBuilder( "BLOCK_IF " ).append( conditionPath ).append( '\n' ); + StringBuilder sb = new StringBuilder( "BLOCK_IF" ).append( trimLeft ? "_LTRIM" : "" ) + .append( ' ' ).append( conditionPath ).append( '\n' ); sb.append( " THEN\n" ).append( thenElements.print() ); if( elseElements != null ) { sb.append( " ELSE\n" ).append( elseElements.print() ); diff --git a/oap-formats/oap-template/src/main/java/oap/template/tree/ExpressionElement.java b/oap-formats/oap-template/src/main/java/oap/template/tree/ExpressionElement.java index 9fd34fafd1..e6b3b18521 100644 --- a/oap-formats/oap-template/src/main/java/oap/template/tree/ExpressionElement.java +++ b/oap-formats/oap-template/src/main/java/oap/template/tree/ExpressionElement.java @@ -31,13 +31,21 @@ @Slf4j public class ExpressionElement implements Element { public final String expression; + public final boolean trimLeft; + public final boolean trimRight; public ExpressionElement( String expression ) { + this( expression, false, false ); + } + + public ExpressionElement( String expression, boolean trimLeft, boolean trimRight ) { this.expression = expression; + this.trimLeft = trimLeft; + this.trimRight = trimRight; } @Override public String print() { - return "EXPR '" + expression + "'"; + return "EXPR '" + expression + "'" + ( trimLeft ? " TRIML" : "" ) + ( trimRight ? " TRIMR" : "" ); } } diff --git a/oap-formats/oap-template/src/test/java/oap/template/AbstractTemplateEngineTest.java b/oap-formats/oap-template/src/test/java/oap/template/AbstractTemplateEngineTest.java new file mode 100644 index 0000000000..d7f780ac36 --- /dev/null +++ b/oap-formats/oap-template/src/test/java/oap/template/AbstractTemplateEngineTest.java @@ -0,0 +1,28 @@ +package oap.template; + +import oap.testng.Fixtures; +import oap.testng.TestDirectoryFixture; +import oap.util.Dates; +import org.testng.annotations.BeforeMethod; + +import java.lang.reflect.Method; + +public abstract class AbstractTemplateEngineTest extends Fixtures { + protected final TestDirectoryFixture testDirectoryFixture; + protected TemplateEngine engine; + protected String testMethodName; + + protected AbstractTemplateEngineTest() { + testDirectoryFixture = fixture( new TestDirectoryFixture() ); + } + + @BeforeMethod + public void beforeCMethod() { + engine = new TemplateEngine( Dates.d( 10 ) ); + } + + @BeforeMethod + public void nameBefore( Method method ) { + testMethodName = method.getName(); + } +} diff --git a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConcatenationTest.java b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConcatenationTest.java index 49b1b58ca6..bed54cce3d 100644 --- a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConcatenationTest.java +++ b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConcatenationTest.java @@ -25,32 +25,14 @@ package oap.template; import oap.reflect.TypeRef; -import oap.testng.Fixtures; -import oap.util.Dates; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.lang.reflect.Method; import java.util.Optional; import static oap.template.TemplateAccumulators.STRING; import static org.assertj.core.api.Assertions.assertThat; -public class TemplateEngineConcatenationTest extends Fixtures { - private TemplateEngine engine; - private String testMethodName; - - @BeforeClass - public void beforeClass() { - engine = new TemplateEngine( Dates.d( 10 ) ); - } - - @BeforeMethod - public void nameBefore( Method method ) { - testMethodName = method.getName(); - } - +public class TemplateEngineConcatenationTest extends AbstractTemplateEngineTest { @Test public void testConcatenation() { var c = new TestTemplateClass(); diff --git a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConditionTest.java b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConditionTest.java index f46d5969ab..e21326facf 100644 --- a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConditionTest.java +++ b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineConditionTest.java @@ -25,38 +25,14 @@ package oap.template; import oap.reflect.TypeRef; -import oap.testng.Fixtures; -import oap.testng.TestDirectoryFixture; -import oap.util.Dates; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.lang.reflect.Method; - import static oap.template.ErrorStrategy.ERROR; import static oap.template.TemplateAccumulators.STRING; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -public class TemplateEngineConditionTest extends Fixtures { - private final TestDirectoryFixture testDirectoryFixture; - private TemplateEngine engine; - private String testMethodName; - - public TemplateEngineConditionTest() { - testDirectoryFixture = fixture( new TestDirectoryFixture() ); - } - - @BeforeMethod - public void beforeCMethod() { - engine = new TemplateEngine( Dates.d( 10 ) ); - } - - @BeforeMethod - public void nameBefore( Method method ) { - testMethodName = method.getName(); - } - +public class TemplateEngineConditionTest extends AbstractTemplateEngineTest { @Test public void testIfConditionTrue() { TestTemplateClass c = new TestTemplateClass(); @@ -229,20 +205,4 @@ public void testBlockIfUnknownFieldThrows() { .isInstanceOf( TemplateException.class ); } - public static class TestPrimitiveTemplateAccumulatorString extends TemplateAccumulatorString { - @Override - public void accept( boolean b ) { - super.accept( b + "_b" ); - } - - @Override - public void accept( int i ) { - super.accept( i + "_i" ); - } - - @Override - public TemplateAccumulatorString newInstance() { - return new TestPrimitiveTemplateAccumulatorString(); - } - } } diff --git a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineEnumTest.java b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineEnumTest.java index 67336fafd5..2bf652d98b 100644 --- a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineEnumTest.java +++ b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineEnumTest.java @@ -25,32 +25,14 @@ package oap.template; import oap.reflect.TypeRef; -import oap.testng.Fixtures; -import oap.util.Dates; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.lang.reflect.Method; import java.util.List; import static oap.template.TemplateAccumulators.STRING; import static org.assertj.core.api.Assertions.assertThat; -public class TemplateEngineEnumTest extends Fixtures { - private TemplateEngine engine; - private String testMethodName; - - @BeforeClass - public void beforeClass() { - engine = new TemplateEngine( Dates.d( 10 ) ); - } - - @BeforeMethod - public void nameBefore( Method method ) { - testMethodName = method.getName(); - } - +public class TemplateEngineEnumTest extends AbstractTemplateEngineTest { @Test public void testEnumField() { var c = new TestTemplateClass(); diff --git a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineFunctionsTest.java b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineFunctionsTest.java index 42afcbc3f0..8a5dcb46b3 100644 --- a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineFunctionsTest.java +++ b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineFunctionsTest.java @@ -25,13 +25,8 @@ package oap.template; import oap.reflect.TypeRef; -import oap.testng.Fixtures; -import oap.util.Dates; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.lang.reflect.Method; import java.util.List; import java.util.Map; @@ -39,21 +34,7 @@ import static oap.template.TemplateAccumulators.STRING; import static org.assertj.core.api.Assertions.assertThat; -public class TemplateEngineFunctionsTest extends Fixtures { - - private TemplateEngine engine; - private String testMethodName; - - @BeforeClass - public void beforeClass() { - engine = new TemplateEngine( Dates.d( 10 ) ); - } - - @BeforeMethod - public void nameBefore( Method method ) { - testMethodName = method.getName(); - } - +public class TemplateEngineFunctionsTest extends AbstractTemplateEngineTest { @Test public void testMethod() { TestTemplateClass c = new TestTemplateClass(); diff --git a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineOrTest.java b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineOrTest.java index 9cee9fc2f8..79f0b2cdb7 100644 --- a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineOrTest.java +++ b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineOrTest.java @@ -25,32 +25,14 @@ package oap.template; import oap.reflect.TypeRef; -import oap.testng.Fixtures; -import oap.util.Dates; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.lang.reflect.Method; import java.util.List; import static oap.template.TemplateAccumulators.STRING; import static org.assertj.core.api.Assertions.assertThat; -public class TemplateEngineOrTest extends Fixtures { - private TemplateEngine engine; - private String testMethodName; - - @BeforeClass - public void beforeClass() { - engine = new TemplateEngine( Dates.d( 10 ) ); - } - - @BeforeMethod - public void nameBefore( Method method ) { - testMethodName = method.getName(); - } - +public class TemplateEngineOrTest extends AbstractTemplateEngineTest { @Test public void testOrEmptyString() { TestTemplateClass c = new TestTemplateClass(); diff --git a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineTest.java b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineTest.java index cc100ee61d..43875868fa 100644 --- a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineTest.java +++ b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineTest.java @@ -25,17 +25,13 @@ package oap.template; import oap.reflect.TypeRef; -import oap.testng.Fixtures; -import oap.testng.TestDirectoryFixture; import oap.util.Dates; import org.apache.commons.io.FileUtils; import org.codehaus.plexus.util.StringUtils; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import java.io.File; import java.io.IOException; -import java.lang.reflect.Method; import java.util.List; import java.util.Map; import java.util.Optional; @@ -49,25 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -public class TemplateEngineTest extends Fixtures { - private final TestDirectoryFixture testDirectoryFixture; - private TemplateEngine engine; - private String testMethodName; - - public TemplateEngineTest() { - testDirectoryFixture = fixture( new TestDirectoryFixture() ); - } - - @BeforeMethod - public void beforeCMethod() { - engine = new TemplateEngine( Dates.d( 10 ) ); - } - - @BeforeMethod - public void nameBefore( Method method ) { - testMethodName = method.getName(); - } - +public class TemplateEngineTest extends AbstractTemplateEngineTest { @Test public void testRenderStringText() { assertThat( engine.getTemplate( testMethodName, new TypeRef>() {}, "sdkjf hdkfgj d$...{}", STRING, null ).render( null ).get() ) @@ -525,33 +503,4 @@ public void testCacheClassFormatError() throws IOException { assertThat( engine2.getTemplate( testMethodName, new TypeRef() {}, "{{ field }}\t{{ field }}", new TestTemplateAccumulatorString(), null ) .render( c ).get() ).isEqualTo( "12\t12" ); } - - public static class TestTemplateAccumulatorString extends TemplateAccumulatorString { - @Override - public void accept( String text ) { - super.accept( text + "2" ); - } - - @Override - public TemplateAccumulatorString newInstance() { - return new TestTemplateAccumulatorString(); - } - } - - public static class TestPrimitiveTemplateAccumulatorString extends TemplateAccumulatorString { - @Override - public void accept( boolean b ) { - super.accept( b + "_b" ); - } - - @Override - public void accept( int i ) { - super.accept( i + "_i" ); - } - - @Override - public TemplateAccumulatorString newInstance() { - return new TestPrimitiveTemplateAccumulatorString(); - } - } } diff --git a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineTrimTest.java b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineTrimTest.java new file mode 100644 index 0000000000..781ba33e04 --- /dev/null +++ b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineTrimTest.java @@ -0,0 +1,130 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) Open Application Platform Authors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package oap.template; + +import oap.reflect.TypeRef; +import oap.testng.Fixtures; +import oap.testng.TestDirectoryFixture; +import oap.util.Dates; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import java.lang.reflect.Method; + +import static oap.template.TemplateAccumulators.STRING; +import static org.assertj.core.api.Assertions.assertThat; + +public class TemplateEngineTrimTest extends Fixtures { + private final TestDirectoryFixture testDirectoryFixture; + private TemplateEngine engine; + private String testMethodName; + + public TemplateEngineTrimTest() { + testDirectoryFixture = fixture( new TestDirectoryFixture() ); + } + + @BeforeMethod + public void beforeCMethod() { + engine = new TemplateEngine( Dates.d( 10 ) ); + } + + @BeforeMethod + public void nameBefore( Method method ) { + testMethodName = method.getName(); + } + + + @Test + public void testTrimLeft() { + TestTemplateClass c = new TestTemplateClass(); + c.field = "test"; + assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, + "aa {{- field }}", STRING, null ).render( c ).get() ) + .isEqualTo( "aatest" ); + } + + @Test + public void testTrimRight() { + TestTemplateClass c = new TestTemplateClass(); + c.field = "test"; + assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, + "{{ field -}} bb", STRING, null ).render( c ).get() ) + .isEqualTo( "testbb" ); + } + + @Test + public void testTrimBoth() { + TestTemplateClass c = new TestTemplateClass(); + c.field = "test"; + assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, + "aa {{- field -}} \nbb", STRING, null ).render( c ).get() ) + .isEqualTo( "aatestbb" ); + } + + @Test + public void testTrimMultipleSpaces() { + TestTemplateClass c = new TestTemplateClass(); + c.field = "test"; + assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, + "aa \t{{- field -}}\t\n bb", STRING, null ).render( c ).get() ) + .isEqualTo( "aatestbb" ); + } + + @Test + public void testTrimNoAdjacentText() { + TestTemplateClass c = new TestTemplateClass(); + c.field = "test"; + assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, + "{{- field -}}", STRING, null ).render( c ).get() ) + .isEqualTo( "test" ); + } + + @Test + public void testBlockIfLTrim() { + TestTemplateClass c = new TestTemplateClass(); + c.booleanField = true; + c.field = "world"; + assertThat( engine.getTemplate( testMethodName, new TypeRef() {}, + "aa\n{{%- if booleanField }}{{ field }}{{% end }}", STRING, null ).render( c ).get() ) + .isEqualTo( "aaworld" ); + } + + public static class TestPrimitiveTemplateAccumulatorString extends TemplateAccumulatorString { + @Override + public void accept( boolean b ) { + super.accept( b + "_b" ); + } + + @Override + public void accept( int i ) { + super.accept( i + "_i" ); + } + + @Override + public TemplateAccumulatorString newInstance() { + return new TestPrimitiveTemplateAccumulatorString(); + } + } +} diff --git a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineTypesTest.java b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineTypesTest.java index 0e982014fc..b04d2d54e9 100644 --- a/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineTypesTest.java +++ b/oap-formats/oap-template/src/test/java/oap/template/TemplateEngineTypesTest.java @@ -25,13 +25,8 @@ package oap.template; import oap.reflect.TypeRef; -import oap.testng.Fixtures; -import oap.util.Dates; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import java.lang.reflect.Method; import java.util.Optional; import static oap.template.ErrorStrategy.ERROR; @@ -39,24 +34,11 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -public class TemplateEngineTypesTest extends Fixtures { - private TemplateEngine engine; - private String testMethodName; - - @BeforeClass - public void beforeClass() { - engine = new TemplateEngine( Dates.d( 10 ) ); - } - - @BeforeMethod - public void nameBefore( Method method ) { - testMethodName = method.getName(); - } - +public class TemplateEngineTypesTest extends AbstractTemplateEngineTest { @Test public void testTypes() { - var templateAccumulator = new TemplateEngineTest.TestPrimitiveTemplateAccumulatorString(); - var templateClass = new TestTemplateClass(); + TestPrimitiveTemplateAccumulatorString templateAccumulator = new TestPrimitiveTemplateAccumulatorString(); + TestTemplateClass templateClass = new TestTemplateClass(); templateClass.booleanField = true; templateClass.booleanObjectField = true; templateClass.intField = 1; @@ -77,8 +59,8 @@ public void testTypes() { @Test public void testObjectReference() { - var templateAccumulator = new TemplateEngineTest.TestPrimitiveTemplateAccumulatorString(); - var templateClass = new TestTemplateClass(); + TestPrimitiveTemplateAccumulatorString templateAccumulator = new TestPrimitiveTemplateAccumulatorString(); + TestTemplateClass templateClass = new TestTemplateClass(); templateClass.child = new TestTemplateClass(); templateClass.child.intField = 100; @@ -91,8 +73,8 @@ public void testObjectReference() { @Test public void testObjectReferenceWithConcatenation() { - var templateAccumulator = new TemplateEngineTest.TestPrimitiveTemplateAccumulatorString(); - var templateClass = new TestTemplateClass(); + TestPrimitiveTemplateAccumulatorString templateAccumulator = new TestPrimitiveTemplateAccumulatorString(); + TestTemplateClass templateClass = new TestTemplateClass(); templateClass.child = new TestTemplateClass(); templateClass.child.child = new TestTemplateClass(); templateClass.child.child.field = "v1"; @@ -107,8 +89,8 @@ public void testObjectReferenceWithConcatenation() { @Test public void testNullableObjectReference() { - var templateAccumulator = new TemplateEngineTest.TestPrimitiveTemplateAccumulatorString(); - var templateClass = new TestTemplateClass(); + TestPrimitiveTemplateAccumulatorString templateAccumulator = new TestPrimitiveTemplateAccumulatorString(); + TestTemplateClass templateClass = new TestTemplateClass(); templateClass.childNullable = new TestTemplateClass(); templateClass.childNullable.intField = 100; @@ -121,7 +103,7 @@ public void testNullableObjectReference() { @Test public void testDefaultBoolean() { - var c = new TestTemplateClass(); + TestTemplateClass c = new TestTemplateClass(); c.childNullable = null; c.childOpt = Optional.empty(); diff --git a/oap-formats/oap-template/src/test/java/oap/template/TestPrimitiveTemplateAccumulatorString.java b/oap-formats/oap-template/src/test/java/oap/template/TestPrimitiveTemplateAccumulatorString.java new file mode 100644 index 0000000000..177d9a1d4e --- /dev/null +++ b/oap-formats/oap-template/src/test/java/oap/template/TestPrimitiveTemplateAccumulatorString.java @@ -0,0 +1,18 @@ +package oap.template; + +public class TestPrimitiveTemplateAccumulatorString extends TemplateAccumulatorString { + @Override + public void accept( boolean b ) { + super.accept( b + "_b" ); + } + + @Override + public void accept( int i ) { + super.accept( i + "_i" ); + } + + @Override + public TemplateAccumulatorString newInstance() { + return new TestPrimitiveTemplateAccumulatorString(); + } +} diff --git a/oap-formats/oap-template/src/test/java/oap/template/TestTemplateAccumulatorString.java b/oap-formats/oap-template/src/test/java/oap/template/TestTemplateAccumulatorString.java new file mode 100644 index 0000000000..0ee81d9fc2 --- /dev/null +++ b/oap-formats/oap-template/src/test/java/oap/template/TestTemplateAccumulatorString.java @@ -0,0 +1,13 @@ +package oap.template; + +public class TestTemplateAccumulatorString extends TemplateAccumulatorString { + @Override + public void accept( String text ) { + super.accept( text + "2" ); + } + + @Override + public TemplateAccumulatorString newInstance() { + return new TestTemplateAccumulatorString(); + } +} diff --git a/pom.xml b/pom.xml index d4e529f8a3..0e2d12e1a4 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ - 25.5.3 + 25.5.4 25.0.1 25.0.0