Repository: metron Updated Branches: refs/heads/master 5c41bf7f3 -> 191d5d84a
METRON-1254: Conditionals as map keys do not function in Stellar closes apache/incubator-metron#801 Project: http://git-wip-us.apache.org/repos/asf/metron/repo Commit: http://git-wip-us.apache.org/repos/asf/metron/commit/191d5d84 Tree: http://git-wip-us.apache.org/repos/asf/metron/tree/191d5d84 Diff: http://git-wip-us.apache.org/repos/asf/metron/diff/191d5d84 Branch: refs/heads/master Commit: 191d5d84ae5ff9f7c464555c6a1285d9c5a702bf Parents: 5c41bf7 Author: cstella <[email protected]> Authored: Mon Oct 30 11:44:51 2017 -0400 Committer: cstella <[email protected]> Committed: Mon Oct 30 11:44:51 2017 -0400 ---------------------------------------------------------------------- .../metron/stellar/common/generated/Stellar.g4 | 5 + .../metron/stellar/common/StellarCompiler.java | 4 +- .../common/generated/StellarBaseListener.java | 12 + .../common/generated/StellarListener.java | 12 + .../stellar/common/generated/StellarParser.java | 538 +++++++++++-------- .../stellar/dsl/functions/BasicStellarTest.java | 19 + 6 files changed, 366 insertions(+), 224 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/metron/blob/191d5d84/metron-stellar/stellar-common/src/main/antlr4/org/apache/metron/stellar/common/generated/Stellar.g4 ---------------------------------------------------------------------- diff --git a/metron-stellar/stellar-common/src/main/antlr4/org/apache/metron/stellar/common/generated/Stellar.g4 b/metron-stellar/stellar-common/src/main/antlr4/org/apache/metron/stellar/common/generated/Stellar.g4 index edd9632..dd92e3d 100644 --- a/metron-stellar/stellar-common/src/main/antlr4/org/apache/metron/stellar/common/generated/Stellar.g4 +++ b/metron-stellar/stellar-common/src/main/antlr4/org/apache/metron/stellar/common/generated/Stellar.g4 @@ -194,6 +194,8 @@ op_list : | op_list COMMA identifier_operand | conditional_expr | op_list COMMA conditional_expr + | comparison_expr + | op_list COMMA comparison_expr ; list_entity : @@ -203,7 +205,9 @@ list_entity : kv_list : identifier_operand COLON transformation_expr + | comparison_expr COLON transformation_expr | kv_list COMMA identifier_operand COLON transformation_expr + | kv_list COMMA comparison_expr COLON transformation_expr ; map_entity : @@ -249,6 +253,7 @@ identifier_operand : | NULL #NullConst | EXISTS LPAREN IDENTIFIER RPAREN #ExistsFunc | LPAREN conditional_expr RPAREN #condExpr_paren + | functions #func ; http://git-wip-us.apache.org/repos/asf/metron/blob/191d5d84/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/StellarCompiler.java ---------------------------------------------------------------------- diff --git a/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/StellarCompiler.java b/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/StellarCompiler.java index fbb5bc0..69564df 100644 --- a/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/StellarCompiler.java +++ b/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/StellarCompiler.java @@ -662,7 +662,7 @@ public class StellarCompiler extends StellarBaseListener { public void exitMap_entity(StellarParser.Map_entityContext ctx) { final FrameContext.Context context = getArgContext(); expression.tokenDeque.push(new Token<>( (tokenDeque, state) -> { - HashMap<String, Object> args = new HashMap<>(); + HashMap<Object, Object> args = new HashMap<>(); Object value = null; for (int i = 0; true; i++) { Token<?> token = popDeque(tokenDeque); @@ -672,7 +672,7 @@ public class StellarCompiler extends StellarBaseListener { if (i % 2 == 0) { value = token.getValue(); } else { - args.put(token.getValue() + "", value); + args.put(token.getValue(), value); } } } http://git-wip-us.apache.org/repos/asf/metron/blob/191d5d84/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarBaseListener.java ---------------------------------------------------------------------- diff --git a/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarBaseListener.java b/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarBaseListener.java index 6e0ae8c..d2806b9 100644 --- a/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarBaseListener.java +++ b/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarBaseListener.java @@ -709,6 +709,18 @@ public class StellarBaseListener implements StellarListener { * * <p>The default implementation does nothing.</p> */ + @Override public void enterFunc(StellarParser.FuncContext ctx) { } + /** + * {@inheritDoc} + * + * <p>The default implementation does nothing.</p> + */ + @Override public void exitFunc(StellarParser.FuncContext ctx) { } + /** + * {@inheritDoc} + * + * <p>The default implementation does nothing.</p> + */ @Override public void enterLambda_without_args(StellarParser.Lambda_without_argsContext ctx) { } /** * {@inheritDoc} http://git-wip-us.apache.org/repos/asf/metron/blob/191d5d84/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarListener.java ---------------------------------------------------------------------- diff --git a/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarListener.java b/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarListener.java index 8b16e00..f07efaa 100644 --- a/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarListener.java +++ b/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarListener.java @@ -679,6 +679,18 @@ public interface StellarListener extends ParseTreeListener { */ void exitCondExpr_paren(StellarParser.CondExpr_parenContext ctx); /** + * Enter a parse tree produced by the {@code func} + * labeled alternative in {@link StellarParser#identifier_operand}. + * @param ctx the parse tree + */ + void enterFunc(StellarParser.FuncContext ctx); + /** + * Exit a parse tree produced by the {@code func} + * labeled alternative in {@link StellarParser#identifier_operand}. + * @param ctx the parse tree + */ + void exitFunc(StellarParser.FuncContext ctx); + /** * Enter a parse tree produced by {@link StellarParser#lambda_without_args}. * @param ctx the parse tree */ http://git-wip-us.apache.org/repos/asf/metron/blob/191d5d84/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarParser.java ---------------------------------------------------------------------- diff --git a/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarParser.java b/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarParser.java index 1ea8a11..3ee2603 100644 --- a/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarParser.java +++ b/metron-stellar/stellar-common/src/main/java/org/apache/metron/stellar/common/generated/StellarParser.java @@ -1194,6 +1194,9 @@ public class StellarParser extends Parser { public Conditional_exprContext conditional_expr() { return getRuleContext(Conditional_exprContext.class,0); } + public Comparison_exprContext comparison_expr() { + return getRuleContext(Comparison_exprContext.class,0); + } public Op_listContext op_list() { return getRuleContext(Op_listContext.class,0); } @@ -1227,7 +1230,7 @@ public class StellarParser extends Parser { int _alt; enterOuterAlt(_localctx, 1); { - setState(152); + setState(153); switch ( getInterpreter().adaptivePredict(_input,8,_ctx) ) { case 1: { @@ -1241,9 +1244,15 @@ public class StellarParser extends Parser { conditional_expr(); } break; + case 3: + { + setState(152); + comparison_expr(0); + } + break; } _ctx.stop = _input.LT(-1); - setState(162); + setState(166); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,10,_ctx); while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { @@ -1251,17 +1260,17 @@ public class StellarParser extends Parser { if ( _parseListeners!=null ) triggerExitRuleEvent(); _prevctx = _localctx; { - setState(160); + setState(164); switch ( getInterpreter().adaptivePredict(_input,9,_ctx) ) { case 1: { _localctx = new Op_listContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_op_list); - setState(154); - if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)"); setState(155); - match(COMMA); + if (!(precpred(_ctx, 5))) throw new FailedPredicateException(this, "precpred(_ctx, 5)"); setState(156); + match(COMMA); + setState(157); identifier_operand(); } break; @@ -1269,18 +1278,30 @@ public class StellarParser extends Parser { { _localctx = new Op_listContext(_parentctx, _parentState); pushNewRecursionContext(_localctx, _startState, RULE_op_list); - setState(157); - if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); setState(158); - match(COMMA); + if (!(precpred(_ctx, 3))) throw new FailedPredicateException(this, "precpred(_ctx, 3)"); setState(159); + match(COMMA); + setState(160); conditional_expr(); } break; + case 3: + { + _localctx = new Op_listContext(_parentctx, _parentState); + pushNewRecursionContext(_localctx, _startState, RULE_op_list); + setState(161); + if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); + setState(162); + match(COMMA); + setState(163); + comparison_expr(0); + } + break; } } } - setState(164); + setState(168); _errHandler.sync(this); _alt = getInterpreter().adaptivePredict(_input,10,_ctx); } @@ -1321,25 +1342,25 @@ public class StellarParser extends Parser { List_entityContext _localctx = new List_entityContext(_ctx, getState()); enterRule(_localctx, 28, RULE_list_entity); try { - setState(171); + setState(175); switch ( getInterpreter().adaptivePredict(_input,11,_ctx) ) { case 1: enterOuterAlt(_localctx, 1); { - setState(165); + setState(169); match(LBRACKET); - setState(166); + setState(170); match(RBRACKET); } break; case 2: enterOuterAlt(_localctx, 2); { - setState(167); + setState(171); match(LBRACKET); - setState(168); + setState(172); op_list(0); - setState(169); + setState(173); match(RBRACKET); } break; @@ -1364,6 +1385,9 @@ public class StellarParser extends Parser { public Transformation_exprContext transformation_expr() { return getRuleContext(Transformation_exprContext.class,0); } + public Comparison_exprContext comparison_expr() { + return getRuleContext(Comparison_exprContext.class,0); + } public Kv_listContext kv_list() { return getRuleContext(Kv_listContext.class,0); } @@ -1397,42 +1421,78 @@ public class StellarParser extends Parser { int _alt; enterOuterAlt(_localctx, 1); { - { - setState(174); - identifier_operand(); - setState(175); - match(COLON); - setState(176); - transformation_expr(); + setState(186); + switch ( getInterpreter().adaptivePredict(_input,12,_ctx) ) { + case 1: + { + setState(178); + identifier_operand(); + setState(179); + match(COLON); + setState(180); + transformation_expr(); + } + break; + case 2: + { + setState(182); + comparison_expr(0); + setState(183); + match(COLON); + setState(184); + transformation_expr(); + } + break; } _ctx.stop = _input.LT(-1); - setState(186); + setState(202); _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,12,_ctx); + _alt = getInterpreter().adaptivePredict(_input,14,_ctx); while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { if ( _parseListeners!=null ) triggerExitRuleEvent(); _prevctx = _localctx; { - { - _localctx = new Kv_listContext(_parentctx, _parentState); - pushNewRecursionContext(_localctx, _startState, RULE_kv_list); - setState(178); - if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(179); - match(COMMA); - setState(180); - identifier_operand(); - setState(181); - match(COLON); - setState(182); - transformation_expr(); + setState(200); + switch ( getInterpreter().adaptivePredict(_input,13,_ctx) ) { + case 1: + { + _localctx = new Kv_listContext(_parentctx, _parentState); + pushNewRecursionContext(_localctx, _startState, RULE_kv_list); + setState(188); + if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)"); + setState(189); + match(COMMA); + setState(190); + identifier_operand(); + setState(191); + match(COLON); + setState(192); + transformation_expr(); + } + break; + case 2: + { + _localctx = new Kv_listContext(_parentctx, _parentState); + pushNewRecursionContext(_localctx, _startState, RULE_kv_list); + setState(194); + if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); + setState(195); + match(COMMA); + setState(196); + comparison_expr(0); + setState(197); + match(COLON); + setState(198); + transformation_expr(); + } + break; } } } - setState(188); + setState(204); _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,12,_ctx); + _alt = getInterpreter().adaptivePredict(_input,14,_ctx); } } } @@ -1471,25 +1531,25 @@ public class StellarParser extends Parser { Map_entityContext _localctx = new Map_entityContext(_ctx, getState()); enterRule(_localctx, 32, RULE_map_entity); try { - setState(195); - switch ( getInterpreter().adaptivePredict(_input,13,_ctx) ) { + setState(211); + switch ( getInterpreter().adaptivePredict(_input,15,_ctx) ) { case 1: enterOuterAlt(_localctx, 1); { - setState(189); + setState(205); match(LBRACE); - setState(190); + setState(206); kv_list(0); - setState(191); + setState(207); match(RBRACE); } break; case 2: enterOuterAlt(_localctx, 2); { - setState(193); + setState(209); match(LBRACE); - setState(194); + setState(210); match(RBRACE); } break; @@ -1588,29 +1648,29 @@ public class StellarParser extends Parser { _ctx = _localctx; _prevctx = _localctx; - setState(198); + setState(214); arithmetic_expr_mul(0); } _ctx.stop = _input.LT(-1); - setState(208); + setState(224); _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,15,_ctx); + _alt = getInterpreter().adaptivePredict(_input,17,_ctx); while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { if ( _parseListeners!=null ) triggerExitRuleEvent(); _prevctx = _localctx; { - setState(206); - switch ( getInterpreter().adaptivePredict(_input,14,_ctx) ) { + setState(222); + switch ( getInterpreter().adaptivePredict(_input,16,_ctx) ) { case 1: { _localctx = new ArithExpr_plusContext(new Arithmetic_exprContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_arithmetic_expr); - setState(200); + setState(216); if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)"); - setState(201); + setState(217); match(PLUS); - setState(202); + setState(218); arithmetic_expr_mul(0); } break; @@ -1618,20 +1678,20 @@ public class StellarParser extends Parser { { _localctx = new ArithExpr_minusContext(new Arithmetic_exprContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_arithmetic_expr); - setState(203); + setState(219); if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(204); + setState(220); match(MINUS); - setState(205); + setState(221); arithmetic_expr_mul(0); } break; } } } - setState(210); + setState(226); _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,15,_ctx); + _alt = getInterpreter().adaptivePredict(_input,17,_ctx); } } } @@ -1728,29 +1788,29 @@ public class StellarParser extends Parser { _ctx = _localctx; _prevctx = _localctx; - setState(212); + setState(228); arithmetic_operands(); } _ctx.stop = _input.LT(-1); - setState(222); + setState(238); _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,17,_ctx); + _alt = getInterpreter().adaptivePredict(_input,19,_ctx); while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { if ( _alt==1 ) { if ( _parseListeners!=null ) triggerExitRuleEvent(); _prevctx = _localctx; { - setState(220); - switch ( getInterpreter().adaptivePredict(_input,16,_ctx) ) { + setState(236); + switch ( getInterpreter().adaptivePredict(_input,18,_ctx) ) { case 1: { _localctx = new ArithExpr_mulContext(new Arithmetic_expr_mulContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_arithmetic_expr_mul); - setState(214); + setState(230); if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)"); - setState(215); + setState(231); match(MUL); - setState(216); + setState(232); arithmetic_expr_mul(3); } break; @@ -1758,20 +1818,20 @@ public class StellarParser extends Parser { { _localctx = new ArithExpr_divContext(new Arithmetic_expr_mulContext(_parentctx, _parentState)); pushNewRecursionContext(_localctx, _startState, RULE_arithmetic_expr_mul); - setState(217); + setState(233); if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)"); - setState(218); + setState(234); match(DIV); - setState(219); + setState(235); arithmetic_expr_mul(2); } break; } } } - setState(224); + setState(240); _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,17,_ctx); + _alt = getInterpreter().adaptivePredict(_input,19,_ctx); } } } @@ -1820,9 +1880,9 @@ public class StellarParser extends Parser { _localctx = new TransformationFuncContext(_localctx); enterOuterAlt(_localctx, 1); { - setState(225); + setState(241); match(IDENTIFIER); - setState(226); + setState(242); func_args(); } } @@ -1971,13 +2031,13 @@ public class StellarParser extends Parser { Arithmetic_operandsContext _localctx = new Arithmetic_operandsContext(_ctx, getState()); enterRule(_localctx, 40, RULE_arithmetic_operands); try { - setState(243); - switch ( getInterpreter().adaptivePredict(_input,18,_ctx) ) { + setState(259); + switch ( getInterpreter().adaptivePredict(_input,20,_ctx) ) { case 1: _localctx = new NumericFunctionsContext(_localctx); enterOuterAlt(_localctx, 1); { - setState(228); + setState(244); functions(); } break; @@ -1985,7 +2045,7 @@ public class StellarParser extends Parser { _localctx = new DoubleLiteralContext(_localctx); enterOuterAlt(_localctx, 2); { - setState(229); + setState(245); match(DOUBLE_LITERAL); } break; @@ -1993,7 +2053,7 @@ public class StellarParser extends Parser { _localctx = new IntLiteralContext(_localctx); enterOuterAlt(_localctx, 3); { - setState(230); + setState(246); match(INT_LITERAL); } break; @@ -2001,7 +2061,7 @@ public class StellarParser extends Parser { _localctx = new LongLiteralContext(_localctx); enterOuterAlt(_localctx, 4); { - setState(231); + setState(247); match(LONG_LITERAL); } break; @@ -2009,7 +2069,7 @@ public class StellarParser extends Parser { _localctx = new FloatLiteralContext(_localctx); enterOuterAlt(_localctx, 5); { - setState(232); + setState(248); match(FLOAT_LITERAL); } break; @@ -2017,7 +2077,7 @@ public class StellarParser extends Parser { _localctx = new VariableContext(_localctx); enterOuterAlt(_localctx, 6); { - setState(233); + setState(249); match(IDENTIFIER); } break; @@ -2025,7 +2085,7 @@ public class StellarParser extends Parser { _localctx = new NaNArithContext(_localctx); enterOuterAlt(_localctx, 7); { - setState(234); + setState(250); match(NAN); } break; @@ -2033,11 +2093,11 @@ public class StellarParser extends Parser { _localctx = new ParenArithContext(_localctx); enterOuterAlt(_localctx, 8); { - setState(235); + setState(251); match(LPAREN); - setState(236); + setState(252); arithmetic_expr(0); - setState(237); + setState(253); match(RPAREN); } break; @@ -2045,11 +2105,11 @@ public class StellarParser extends Parser { _localctx = new CondExprContext(_localctx); enterOuterAlt(_localctx, 9); { - setState(239); + setState(255); match(LPAREN); - setState(240); + setState(256); conditional_expr(); - setState(241); + setState(257); match(RPAREN); } break; @@ -2117,6 +2177,20 @@ public class StellarParser extends Parser { if ( listener instanceof StellarListener ) ((StellarListener)listener).exitStringLiteral(this); } } + public static class FuncContext extends Identifier_operandContext { + public FunctionsContext functions() { + return getRuleContext(FunctionsContext.class,0); + } + public FuncContext(Identifier_operandContext ctx) { copyFrom(ctx); } + @Override + public void enterRule(ParseTreeListener listener) { + if ( listener instanceof StellarListener ) ((StellarListener)listener).enterFunc(this); + } + @Override + public void exitRule(ParseTreeListener listener) { + if ( listener instanceof StellarListener ) ((StellarListener)listener).exitFunc(this); + } + } public static class LambdaWithoutArgsExprContext extends Identifier_operandContext { public Lambda_without_argsContext lambda_without_args() { return getRuleContext(Lambda_without_argsContext.class,0); @@ -2221,13 +2295,13 @@ public class StellarParser extends Parser { enterRule(_localctx, 42, RULE_identifier_operand); int _la; try { - setState(261); - switch ( getInterpreter().adaptivePredict(_input,19,_ctx) ) { + setState(278); + switch ( getInterpreter().adaptivePredict(_input,21,_ctx) ) { case 1: _localctx = new LogicalConstContext(_localctx); enterOuterAlt(_localctx, 1); { - setState(245); + setState(261); _la = _input.LA(1); if ( !(_la==TRUE || _la==FALSE) ) { _errHandler.recoverInline(this); @@ -2240,7 +2314,7 @@ public class StellarParser extends Parser { _localctx = new LambdaWithArgsExprContext(_localctx); enterOuterAlt(_localctx, 2); { - setState(246); + setState(262); lambda_with_args(); } break; @@ -2248,7 +2322,7 @@ public class StellarParser extends Parser { _localctx = new LambdaWithoutArgsExprContext(_localctx); enterOuterAlt(_localctx, 3); { - setState(247); + setState(263); lambda_without_args(); } break; @@ -2256,7 +2330,7 @@ public class StellarParser extends Parser { _localctx = new ArithmeticOperandsContext(_localctx); enterOuterAlt(_localctx, 4); { - setState(248); + setState(264); arithmetic_expr(0); } break; @@ -2264,7 +2338,7 @@ public class StellarParser extends Parser { _localctx = new StringLiteralContext(_localctx); enterOuterAlt(_localctx, 5); { - setState(249); + setState(265); match(STRING_LITERAL); } break; @@ -2272,7 +2346,7 @@ public class StellarParser extends Parser { _localctx = new ListContext(_localctx); enterOuterAlt(_localctx, 6); { - setState(250); + setState(266); list_entity(); } break; @@ -2280,7 +2354,7 @@ public class StellarParser extends Parser { _localctx = new MapConstContext(_localctx); enterOuterAlt(_localctx, 7); { - setState(251); + setState(267); map_entity(); } break; @@ -2288,7 +2362,7 @@ public class StellarParser extends Parser { _localctx = new NullConstContext(_localctx); enterOuterAlt(_localctx, 8); { - setState(252); + setState(268); match(NULL); } break; @@ -2296,13 +2370,13 @@ public class StellarParser extends Parser { _localctx = new ExistsFuncContext(_localctx); enterOuterAlt(_localctx, 9); { - setState(253); + setState(269); match(EXISTS); - setState(254); + setState(270); match(LPAREN); - setState(255); + setState(271); match(IDENTIFIER); - setState(256); + setState(272); match(RPAREN); } break; @@ -2310,14 +2384,22 @@ public class StellarParser extends Parser { _localctx = new CondExpr_parenContext(_localctx); enterOuterAlt(_localctx, 10); { - setState(257); + setState(273); match(LPAREN); - setState(258); + setState(274); conditional_expr(); - setState(259); + setState(275); match(RPAREN); } break; + case 11: + _localctx = new FuncContext(_localctx); + enterOuterAlt(_localctx, 11); + { + setState(277); + functions(); + } + break; } } catch (RecognitionException re) { @@ -2358,13 +2440,13 @@ public class StellarParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(263); + setState(280); match(LPAREN); - setState(264); + setState(281); match(RPAREN); - setState(265); + setState(282); match(LAMBDA_OP); - setState(266); + setState(283); transformation_expr(); } } @@ -2410,31 +2492,31 @@ public class StellarParser extends Parser { Lambda_with_argsContext _localctx = new Lambda_with_argsContext(_ctx, getState()); enterRule(_localctx, 46, RULE_lambda_with_args); try { - setState(278); + setState(295); switch (_input.LA(1)) { case LPAREN: enterOuterAlt(_localctx, 1); { - setState(268); + setState(285); match(LPAREN); - setState(269); + setState(286); lambda_variables(); - setState(270); + setState(287); match(RPAREN); - setState(271); + setState(288); match(LAMBDA_OP); - setState(272); + setState(289); transformation_expr(); } break; case IDENTIFIER: enterOuterAlt(_localctx, 2); { - setState(274); + setState(291); single_lambda_variable(); - setState(275); + setState(292); match(LAMBDA_OP); - setState(276); + setState(293); transformation_expr(); } break; @@ -2485,21 +2567,21 @@ public class StellarParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(280); + setState(297); lambda_variable(); - setState(285); + setState(302); _errHandler.sync(this); _la = _input.LA(1); while (_la==COMMA) { { { - setState(281); + setState(298); match(COMMA); - setState(282); + setState(299); lambda_variable(); } } - setState(287); + setState(304); _errHandler.sync(this); _la = _input.LA(1); } @@ -2540,7 +2622,7 @@ public class StellarParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(288); + setState(305); lambda_variable(); } } @@ -2577,7 +2659,7 @@ public class StellarParser extends Parser { try { enterOuterAlt(_localctx, 1); { - setState(290); + setState(307); match(IDENTIFIER); } } @@ -2617,40 +2699,44 @@ public class StellarParser extends Parser { private boolean op_list_sempred(Op_listContext _localctx, int predIndex) { switch (predIndex) { case 1: - return precpred(_ctx, 3); + return precpred(_ctx, 5); case 2: + return precpred(_ctx, 3); + case 3: return precpred(_ctx, 1); } return true; } private boolean kv_list_sempred(Kv_listContext _localctx, int predIndex) { switch (predIndex) { - case 3: + case 4: + return precpred(_ctx, 2); + case 5: return precpred(_ctx, 1); } return true; } private boolean arithmetic_expr_sempred(Arithmetic_exprContext _localctx, int predIndex) { switch (predIndex) { - case 4: + case 6: return precpred(_ctx, 2); - case 5: + case 7: return precpred(_ctx, 1); } return true; } private boolean arithmetic_expr_mul_sempred(Arithmetic_expr_mulContext _localctx, int predIndex) { switch (predIndex) { - case 6: + case 8: return precpred(_ctx, 2); - case 7: + case 9: return precpred(_ctx, 1); } return true; } public static final String _serializedATN = - "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3/\u0127\4\2\t\2\4"+ + "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\3/\u0138\4\2\t\2\4"+ "\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t"+ "\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+ "\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+ @@ -2661,94 +2747,102 @@ public class StellarParser extends Parser { "\n\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\5\13\u0081\n"+ "\13\3\13\3\13\3\13\3\13\7\13\u0087\n\13\f\13\16\13\u008a\13\13\3\f\3\f"+ "\3\r\3\r\3\16\3\16\3\16\3\16\3\16\3\16\5\16\u0096\n\16\3\17\3\17\3\17"+ - "\5\17\u009b\n\17\3\17\3\17\3\17\3\17\3\17\3\17\7\17\u00a3\n\17\f\17\16"+ - "\17\u00a6\13\17\3\20\3\20\3\20\3\20\3\20\3\20\5\20\u00ae\n\20\3\21\3\21"+ - "\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\7\21\u00bb\n\21\f\21\16"+ - "\21\u00be\13\21\3\22\3\22\3\22\3\22\3\22\3\22\5\22\u00c6\n\22\3\23\3\23"+ - "\3\23\3\23\3\23\3\23\3\23\3\23\3\23\7\23\u00d1\n\23\f\23\16\23\u00d4\13"+ - "\23\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\7\24\u00df\n\24\f\24"+ - "\16\24\u00e2\13\24\3\25\3\25\3\25\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3"+ - "\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\5\26\u00f6\n\26\3\27\3\27\3\27"+ - "\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\5\27"+ - "\u0108\n\27\3\30\3\30\3\30\3\30\3\30\3\31\3\31\3\31\3\31\3\31\3\31\3\31"+ - "\3\31\3\31\3\31\5\31\u0119\n\31\3\32\3\32\3\32\7\32\u011e\n\32\f\32\16"+ - "\32\u0121\13\32\3\33\3\33\3\34\3\34\3\34\2\7\24\34 $&\35\2\4\6\b\n\f\16"+ - "\20\22\24\26\30\32\34\36 \"$&(*,.\60\62\64\66\2\4\3\2\16\23\3\2\f\r\u0137"+ - "\28\3\2\2\2\4E\3\2\2\2\6G\3\2\2\2\bI\3\2\2\2\nK\3\2\2\2\fZ\3\2\2\2\16"+ - "e\3\2\2\2\20i\3\2\2\2\22s\3\2\2\2\24\u0080\3\2\2\2\26\u008b\3\2\2\2\30"+ - "\u008d\3\2\2\2\32\u0095\3\2\2\2\34\u009a\3\2\2\2\36\u00ad\3\2\2\2 \u00af"+ - "\3\2\2\2\"\u00c5\3\2\2\2$\u00c7\3\2\2\2&\u00d5\3\2\2\2(\u00e3\3\2\2\2"+ - "*\u00f5\3\2\2\2,\u0107\3\2\2\2.\u0109\3\2\2\2\60\u0118\3\2\2\2\62\u011a"+ - "\3\2\2\2\64\u0122\3\2\2\2\66\u0124\3\2\2\289\5\4\3\29:\7\2\2\3:\3\3\2"+ - "\2\2;F\5\f\7\2<=\7#\2\2=>\5\4\3\2>?\7$\2\2?F\3\2\2\2@F\5$\23\2AF\5\26"+ - "\f\2BF\5\24\13\2CF\5\16\b\2DF\5\22\n\2E;\3\2\2\2E<\3\2\2\2E@\3\2\2\2E"+ - "A\3\2\2\2EB\3\2\2\2EC\3\2\2\2ED\3\2\2\2F\5\3\2\2\2GH\5\16\b\2H\7\3\2\2"+ - "\2IJ\5\4\3\2J\t\3\2\2\2KL\5\4\3\2L\13\3\2\2\2MN\5\6\4\2NO\7\24\2\2OP\5"+ - "\b\5\2PQ\7\25\2\2QR\5\n\6\2R[\3\2\2\2ST\7\26\2\2TU\5\6\4\2UV\7\27\2\2"+ - "VW\5\b\5\2WX\7\30\2\2XY\5\n\6\2Y[\3\2\2\2ZM\3\2\2\2ZS\3\2\2\2[\r\3\2\2"+ - "\2\\]\5\20\t\2]^\7\t\2\2^_\5\16\b\2_f\3\2\2\2`a\5\20\t\2ab\7\n\2\2bc\5"+ - "\16\b\2cf\3\2\2\2df\5\20\t\2e\\\3\2\2\2e`\3\2\2\2ed\3\2\2\2f\17\3\2\2"+ - "\2gj\5\24\13\2hj\5\22\n\2ig\3\2\2\2ih\3\2\2\2j\21\3\2\2\2kl\5,\27\2lm"+ - "\7\3\2\2mn\5\20\t\2nt\3\2\2\2op\5,\27\2pq\7%\2\2qr\5\20\t\2rt\3\2\2\2"+ - "sk\3\2\2\2so\3\2\2\2t\23\3\2\2\2uv\b\13\1\2vw\7\13\2\2wx\7#\2\2xy\5\16"+ - "\b\2yz\7$\2\2z\u0081\3\2\2\2{|\7#\2\2|}\5\16\b\2}~\7$\2\2~\u0081\3\2\2"+ - "\2\177\u0081\5,\27\2\u0080u\3\2\2\2\u0080{\3\2\2\2\u0080\177\3\2\2\2\u0081"+ - "\u0088\3\2\2\2\u0082\u0083\f\6\2\2\u0083\u0084\5\30\r\2\u0084\u0085\5"+ - "\24\13\7\u0085\u0087\3\2\2\2\u0086\u0082\3\2\2\2\u0087\u008a\3\2\2\2\u0088"+ - "\u0086\3\2\2\2\u0088\u0089\3\2\2\2\u0089\25\3\2\2\2\u008a\u0088\3\2\2"+ - "\2\u008b\u008c\5,\27\2\u008c\27\3\2\2\2\u008d\u008e\t\2\2\2\u008e\31\3"+ - "\2\2\2\u008f\u0090\7#\2\2\u0090\u0091\5\34\17\2\u0091\u0092\7$\2\2\u0092"+ - "\u0096\3\2\2\2\u0093\u0094\7#\2\2\u0094\u0096\7$\2\2\u0095\u008f\3\2\2"+ - "\2\u0095\u0093\3\2\2\2\u0096\33\3\2\2\2\u0097\u0098\b\17\1\2\u0098\u009b"+ - "\5,\27\2\u0099\u009b\5\f\7\2\u009a\u0097\3\2\2\2\u009a\u0099\3\2\2\2\u009b"+ - "\u00a4\3\2\2\2\u009c\u009d\f\5\2\2\u009d\u009e\7\7\2\2\u009e\u00a3\5,"+ - "\27\2\u009f\u00a0\f\3\2\2\u00a0\u00a1\7\7\2\2\u00a1\u00a3\5\f\7\2\u00a2"+ - "\u009c\3\2\2\2\u00a2\u009f\3\2\2\2\u00a3\u00a6\3\2\2\2\u00a4\u00a2\3\2"+ - "\2\2\u00a4\u00a5\3\2\2\2\u00a5\35\3\2\2\2\u00a6\u00a4\3\2\2\2\u00a7\u00a8"+ - "\7!\2\2\u00a8\u00ae\7\"\2\2\u00a9\u00aa\7!\2\2\u00aa\u00ab\5\34\17\2\u00ab"+ - "\u00ac\7\"\2\2\u00ac\u00ae\3\2\2\2\u00ad\u00a7\3\2\2\2\u00ad\u00a9\3\2"+ - "\2\2\u00ae\37\3\2\2\2\u00af\u00b0\b\21\1\2\u00b0\u00b1\5,\27\2\u00b1\u00b2"+ - "\7\25\2\2\u00b2\u00b3\5\4\3\2\u00b3\u00bc\3\2\2\2\u00b4\u00b5\f\3\2\2"+ - "\u00b5\u00b6\7\7\2\2\u00b6\u00b7\5,\27\2\u00b7\u00b8\7\25\2\2\u00b8\u00b9"+ - "\5\4\3\2\u00b9\u00bb\3\2\2\2\u00ba\u00b4\3\2\2\2\u00bb\u00be\3\2\2\2\u00bc"+ - "\u00ba\3\2\2\2\u00bc\u00bd\3\2\2\2\u00bd!\3\2\2\2\u00be\u00bc\3\2\2\2"+ - "\u00bf\u00c0\7\37\2\2\u00c0\u00c1\5 \21\2\u00c1\u00c2\7 \2\2\u00c2\u00c6"+ - "\3\2\2\2\u00c3\u00c4\7\37\2\2\u00c4\u00c6\7 \2\2\u00c5\u00bf\3\2\2\2\u00c5"+ - "\u00c3\3\2\2\2\u00c6#\3\2\2\2\u00c7\u00c8\b\23\1\2\u00c8\u00c9\5&\24\2"+ - "\u00c9\u00d2\3\2\2\2\u00ca\u00cb\f\4\2\2\u00cb\u00cc\7\34\2\2\u00cc\u00d1"+ - "\5&\24\2\u00cd\u00ce\f\3\2\2\u00ce\u00cf\7\33\2\2\u00cf\u00d1\5&\24\2"+ - "\u00d0\u00ca\3\2\2\2\u00d0\u00cd\3\2\2\2\u00d1\u00d4\3\2\2\2\u00d2\u00d0"+ - "\3\2\2\2\u00d2\u00d3\3\2\2\2\u00d3%\3\2\2\2\u00d4\u00d2\3\2\2\2\u00d5"+ - "\u00d6\b\24\1\2\u00d6\u00d7\5*\26\2\u00d7\u00e0\3\2\2\2\u00d8\u00d9\f"+ - "\4\2\2\u00d9\u00da\7\36\2\2\u00da\u00df\5&\24\5\u00db\u00dc\f\3\2\2\u00dc"+ - "\u00dd\7\35\2\2\u00dd\u00df\5&\24\4\u00de\u00d8\3\2\2\2\u00de\u00db\3"+ - "\2\2\2\u00df\u00e2\3\2\2\2\u00e0\u00de\3\2\2\2\u00e0\u00e1\3\2\2\2\u00e1"+ - "\'\3\2\2\2\u00e2\u00e0\3\2\2\2\u00e3\u00e4\7,\2\2\u00e4\u00e5\5\32\16"+ - "\2\u00e5)\3\2\2\2\u00e6\u00f6\5(\25\2\u00e7\u00f6\7)\2\2\u00e8\u00f6\7"+ - "(\2\2\u00e9\u00f6\7+\2\2\u00ea\u00f6\7*\2\2\u00eb\u00f6\7,\2\2\u00ec\u00f6"+ - "\7\32\2\2\u00ed\u00ee\7#\2\2\u00ee\u00ef\5$\23\2\u00ef\u00f0\7$\2\2\u00f0"+ - "\u00f6\3\2\2\2\u00f1\u00f2\7#\2\2\u00f2\u00f3\5\f\7\2\u00f3\u00f4\7$\2"+ - "\2\u00f4\u00f6\3\2\2\2\u00f5\u00e6\3\2\2\2\u00f5\u00e7\3\2\2\2\u00f5\u00e8"+ - "\3\2\2\2\u00f5\u00e9\3\2\2\2\u00f5\u00ea\3\2\2\2\u00f5\u00eb\3\2\2\2\u00f5"+ - "\u00ec\3\2\2\2\u00f5\u00ed\3\2\2\2\u00f5\u00f1\3\2\2\2\u00f6+\3\2\2\2"+ - "\u00f7\u0108\t\3\2\2\u00f8\u0108\5\60\31\2\u00f9\u0108\5.\30\2\u00fa\u0108"+ - "\5$\23\2\u00fb\u0108\7-\2\2\u00fc\u0108\5\36\20\2\u00fd\u0108\5\"\22\2"+ - "\u00fe\u0108\7\31\2\2\u00ff\u0100\7&\2\2\u0100\u0101\7#\2\2\u0101\u0102"+ - "\7,\2\2\u0102\u0108\7$\2\2\u0103\u0104\7#\2\2\u0104\u0105\5\f\7\2\u0105"+ - "\u0106\7$\2\2\u0106\u0108\3\2\2\2\u0107\u00f7\3\2\2\2\u0107\u00f8\3\2"+ - "\2\2\u0107\u00f9\3\2\2\2\u0107\u00fa\3\2\2\2\u0107\u00fb\3\2\2\2\u0107"+ - "\u00fc\3\2\2\2\u0107\u00fd\3\2\2\2\u0107\u00fe\3\2\2\2\u0107\u00ff\3\2"+ - "\2\2\u0107\u0103\3\2\2\2\u0108-\3\2\2\2\u0109\u010a\7#\2\2\u010a\u010b"+ - "\7$\2\2\u010b\u010c\7\4\2\2\u010c\u010d\5\4\3\2\u010d/\3\2\2\2\u010e\u010f"+ - "\7#\2\2\u010f\u0110\5\62\32\2\u0110\u0111\7$\2\2\u0111\u0112\7\4\2\2\u0112"+ - "\u0113\5\4\3\2\u0113\u0119\3\2\2\2\u0114\u0115\5\64\33\2\u0115\u0116\7"+ - "\4\2\2\u0116\u0117\5\4\3\2\u0117\u0119\3\2\2\2\u0118\u010e\3\2\2\2\u0118"+ - "\u0114\3\2\2\2\u0119\61\3\2\2\2\u011a\u011f\5\66\34\2\u011b\u011c\7\7"+ - "\2\2\u011c\u011e\5\66\34\2\u011d\u011b\3\2\2\2\u011e\u0121\3\2\2\2\u011f"+ - "\u011d\3\2\2\2\u011f\u0120\3\2\2\2\u0120\63\3\2\2\2\u0121\u011f\3\2\2"+ - "\2\u0122\u0123\5\66\34\2\u0123\65\3\2\2\2\u0124\u0125\7,\2\2\u0125\67"+ - "\3\2\2\2\30EZeis\u0080\u0088\u0095\u009a\u00a2\u00a4\u00ad\u00bc\u00c5"+ - "\u00d0\u00d2\u00de\u00e0\u00f5\u0107\u0118\u011f"; + "\3\17\5\17\u009c\n\17\3\17\3\17\3\17\3\17\3\17\3\17\3\17\3\17\3\17\7\17"+ + "\u00a7\n\17\f\17\16\17\u00aa\13\17\3\20\3\20\3\20\3\20\3\20\3\20\5\20"+ + "\u00b2\n\20\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\5\21\u00bd\n"+ + "\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21\7\21\u00cb"+ + "\n\21\f\21\16\21\u00ce\13\21\3\22\3\22\3\22\3\22\3\22\3\22\5\22\u00d6"+ + "\n\22\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\7\23\u00e1\n\23\f\23"+ + "\16\23\u00e4\13\23\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\7\24\u00ef"+ + "\n\24\f\24\16\24\u00f2\13\24\3\25\3\25\3\25\3\26\3\26\3\26\3\26\3\26\3"+ + "\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\5\26\u0106\n\26\3\27"+ + "\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27"+ + "\3\27\3\27\5\27\u0119\n\27\3\30\3\30\3\30\3\30\3\30\3\31\3\31\3\31\3\31"+ + "\3\31\3\31\3\31\3\31\3\31\3\31\5\31\u012a\n\31\3\32\3\32\3\32\7\32\u012f"+ + "\n\32\f\32\16\32\u0132\13\32\3\33\3\33\3\34\3\34\3\34\2\7\24\34 $&\35"+ + "\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\60\62\64\66\2\4\3\2\16"+ + "\23\3\2\f\r\u014d\28\3\2\2\2\4E\3\2\2\2\6G\3\2\2\2\bI\3\2\2\2\nK\3\2\2"+ + "\2\fZ\3\2\2\2\16e\3\2\2\2\20i\3\2\2\2\22s\3\2\2\2\24\u0080\3\2\2\2\26"+ + "\u008b\3\2\2\2\30\u008d\3\2\2\2\32\u0095\3\2\2\2\34\u009b\3\2\2\2\36\u00b1"+ + "\3\2\2\2 \u00bc\3\2\2\2\"\u00d5\3\2\2\2$\u00d7\3\2\2\2&\u00e5\3\2\2\2"+ + "(\u00f3\3\2\2\2*\u0105\3\2\2\2,\u0118\3\2\2\2.\u011a\3\2\2\2\60\u0129"+ + "\3\2\2\2\62\u012b\3\2\2\2\64\u0133\3\2\2\2\66\u0135\3\2\2\289\5\4\3\2"+ + "9:\7\2\2\3:\3\3\2\2\2;F\5\f\7\2<=\7#\2\2=>\5\4\3\2>?\7$\2\2?F\3\2\2\2"+ + "@F\5$\23\2AF\5\26\f\2BF\5\24\13\2CF\5\16\b\2DF\5\22\n\2E;\3\2\2\2E<\3"+ + "\2\2\2E@\3\2\2\2EA\3\2\2\2EB\3\2\2\2EC\3\2\2\2ED\3\2\2\2F\5\3\2\2\2GH"+ + "\5\16\b\2H\7\3\2\2\2IJ\5\4\3\2J\t\3\2\2\2KL\5\4\3\2L\13\3\2\2\2MN\5\6"+ + "\4\2NO\7\24\2\2OP\5\b\5\2PQ\7\25\2\2QR\5\n\6\2R[\3\2\2\2ST\7\26\2\2TU"+ + "\5\6\4\2UV\7\27\2\2VW\5\b\5\2WX\7\30\2\2XY\5\n\6\2Y[\3\2\2\2ZM\3\2\2\2"+ + "ZS\3\2\2\2[\r\3\2\2\2\\]\5\20\t\2]^\7\t\2\2^_\5\16\b\2_f\3\2\2\2`a\5\20"+ + "\t\2ab\7\n\2\2bc\5\16\b\2cf\3\2\2\2df\5\20\t\2e\\\3\2\2\2e`\3\2\2\2ed"+ + "\3\2\2\2f\17\3\2\2\2gj\5\24\13\2hj\5\22\n\2ig\3\2\2\2ih\3\2\2\2j\21\3"+ + "\2\2\2kl\5,\27\2lm\7\3\2\2mn\5\20\t\2nt\3\2\2\2op\5,\27\2pq\7%\2\2qr\5"+ + "\20\t\2rt\3\2\2\2sk\3\2\2\2so\3\2\2\2t\23\3\2\2\2uv\b\13\1\2vw\7\13\2"+ + "\2wx\7#\2\2xy\5\16\b\2yz\7$\2\2z\u0081\3\2\2\2{|\7#\2\2|}\5\16\b\2}~\7"+ + "$\2\2~\u0081\3\2\2\2\177\u0081\5,\27\2\u0080u\3\2\2\2\u0080{\3\2\2\2\u0080"+ + "\177\3\2\2\2\u0081\u0088\3\2\2\2\u0082\u0083\f\6\2\2\u0083\u0084\5\30"+ + "\r\2\u0084\u0085\5\24\13\7\u0085\u0087\3\2\2\2\u0086\u0082\3\2\2\2\u0087"+ + "\u008a\3\2\2\2\u0088\u0086\3\2\2\2\u0088\u0089\3\2\2\2\u0089\25\3\2\2"+ + "\2\u008a\u0088\3\2\2\2\u008b\u008c\5,\27\2\u008c\27\3\2\2\2\u008d\u008e"+ + "\t\2\2\2\u008e\31\3\2\2\2\u008f\u0090\7#\2\2\u0090\u0091\5\34\17\2\u0091"+ + "\u0092\7$\2\2\u0092\u0096\3\2\2\2\u0093\u0094\7#\2\2\u0094\u0096\7$\2"+ + "\2\u0095\u008f\3\2\2\2\u0095\u0093\3\2\2\2\u0096\33\3\2\2\2\u0097\u0098"+ + "\b\17\1\2\u0098\u009c\5,\27\2\u0099\u009c\5\f\7\2\u009a\u009c\5\24\13"+ + "\2\u009b\u0097\3\2\2\2\u009b\u0099\3\2\2\2\u009b\u009a\3\2\2\2\u009c\u00a8"+ + "\3\2\2\2\u009d\u009e\f\7\2\2\u009e\u009f\7\7\2\2\u009f\u00a7\5,\27\2\u00a0"+ + "\u00a1\f\5\2\2\u00a1\u00a2\7\7\2\2\u00a2\u00a7\5\f\7\2\u00a3\u00a4\f\3"+ + "\2\2\u00a4\u00a5\7\7\2\2\u00a5\u00a7\5\24\13\2\u00a6\u009d\3\2\2\2\u00a6"+ + "\u00a0\3\2\2\2\u00a6\u00a3\3\2\2\2\u00a7\u00aa\3\2\2\2\u00a8\u00a6\3\2"+ + "\2\2\u00a8\u00a9\3\2\2\2\u00a9\35\3\2\2\2\u00aa\u00a8\3\2\2\2\u00ab\u00ac"+ + "\7!\2\2\u00ac\u00b2\7\"\2\2\u00ad\u00ae\7!\2\2\u00ae\u00af\5\34\17\2\u00af"+ + "\u00b0\7\"\2\2\u00b0\u00b2\3\2\2\2\u00b1\u00ab\3\2\2\2\u00b1\u00ad\3\2"+ + "\2\2\u00b2\37\3\2\2\2\u00b3\u00b4\b\21\1\2\u00b4\u00b5\5,\27\2\u00b5\u00b6"+ + "\7\25\2\2\u00b6\u00b7\5\4\3\2\u00b7\u00bd\3\2\2\2\u00b8\u00b9\5\24\13"+ + "\2\u00b9\u00ba\7\25\2\2\u00ba\u00bb\5\4\3\2\u00bb\u00bd\3\2\2\2\u00bc"+ + "\u00b3\3\2\2\2\u00bc\u00b8\3\2\2\2\u00bd\u00cc\3\2\2\2\u00be\u00bf\f\4"+ + "\2\2\u00bf\u00c0\7\7\2\2\u00c0\u00c1\5,\27\2\u00c1\u00c2\7\25\2\2\u00c2"+ + "\u00c3\5\4\3\2\u00c3\u00cb\3\2\2\2\u00c4\u00c5\f\3\2\2\u00c5\u00c6\7\7"+ + "\2\2\u00c6\u00c7\5\24\13\2\u00c7\u00c8\7\25\2\2\u00c8\u00c9\5\4\3\2\u00c9"+ + "\u00cb\3\2\2\2\u00ca\u00be\3\2\2\2\u00ca\u00c4\3\2\2\2\u00cb\u00ce\3\2"+ + "\2\2\u00cc\u00ca\3\2\2\2\u00cc\u00cd\3\2\2\2\u00cd!\3\2\2\2\u00ce\u00cc"+ + "\3\2\2\2\u00cf\u00d0\7\37\2\2\u00d0\u00d1\5 \21\2\u00d1\u00d2\7 \2\2\u00d2"+ + "\u00d6\3\2\2\2\u00d3\u00d4\7\37\2\2\u00d4\u00d6\7 \2\2\u00d5\u00cf\3\2"+ + "\2\2\u00d5\u00d3\3\2\2\2\u00d6#\3\2\2\2\u00d7\u00d8\b\23\1\2\u00d8\u00d9"+ + "\5&\24\2\u00d9\u00e2\3\2\2\2\u00da\u00db\f\4\2\2\u00db\u00dc\7\34\2\2"+ + "\u00dc\u00e1\5&\24\2\u00dd\u00de\f\3\2\2\u00de\u00df\7\33\2\2\u00df\u00e1"+ + "\5&\24\2\u00e0\u00da\3\2\2\2\u00e0\u00dd\3\2\2\2\u00e1\u00e4\3\2\2\2\u00e2"+ + "\u00e0\3\2\2\2\u00e2\u00e3\3\2\2\2\u00e3%\3\2\2\2\u00e4\u00e2\3\2\2\2"+ + "\u00e5\u00e6\b\24\1\2\u00e6\u00e7\5*\26\2\u00e7\u00f0\3\2\2\2\u00e8\u00e9"+ + "\f\4\2\2\u00e9\u00ea\7\36\2\2\u00ea\u00ef\5&\24\5\u00eb\u00ec\f\3\2\2"+ + "\u00ec\u00ed\7\35\2\2\u00ed\u00ef\5&\24\4\u00ee\u00e8\3\2\2\2\u00ee\u00eb"+ + "\3\2\2\2\u00ef\u00f2\3\2\2\2\u00f0\u00ee\3\2\2\2\u00f0\u00f1\3\2\2\2\u00f1"+ + "\'\3\2\2\2\u00f2\u00f0\3\2\2\2\u00f3\u00f4\7,\2\2\u00f4\u00f5\5\32\16"+ + "\2\u00f5)\3\2\2\2\u00f6\u0106\5(\25\2\u00f7\u0106\7)\2\2\u00f8\u0106\7"+ + "(\2\2\u00f9\u0106\7+\2\2\u00fa\u0106\7*\2\2\u00fb\u0106\7,\2\2\u00fc\u0106"+ + "\7\32\2\2\u00fd\u00fe\7#\2\2\u00fe\u00ff\5$\23\2\u00ff\u0100\7$\2\2\u0100"+ + "\u0106\3\2\2\2\u0101\u0102\7#\2\2\u0102\u0103\5\f\7\2\u0103\u0104\7$\2"+ + "\2\u0104\u0106\3\2\2\2\u0105\u00f6\3\2\2\2\u0105\u00f7\3\2\2\2\u0105\u00f8"+ + "\3\2\2\2\u0105\u00f9\3\2\2\2\u0105\u00fa\3\2\2\2\u0105\u00fb\3\2\2\2\u0105"+ + "\u00fc\3\2\2\2\u0105\u00fd\3\2\2\2\u0105\u0101\3\2\2\2\u0106+\3\2\2\2"+ + "\u0107\u0119\t\3\2\2\u0108\u0119\5\60\31\2\u0109\u0119\5.\30\2\u010a\u0119"+ + "\5$\23\2\u010b\u0119\7-\2\2\u010c\u0119\5\36\20\2\u010d\u0119\5\"\22\2"+ + "\u010e\u0119\7\31\2\2\u010f\u0110\7&\2\2\u0110\u0111\7#\2\2\u0111\u0112"+ + "\7,\2\2\u0112\u0119\7$\2\2\u0113\u0114\7#\2\2\u0114\u0115\5\f\7\2\u0115"+ + "\u0116\7$\2\2\u0116\u0119\3\2\2\2\u0117\u0119\5(\25\2\u0118\u0107\3\2"+ + "\2\2\u0118\u0108\3\2\2\2\u0118\u0109\3\2\2\2\u0118\u010a\3\2\2\2\u0118"+ + "\u010b\3\2\2\2\u0118\u010c\3\2\2\2\u0118\u010d\3\2\2\2\u0118\u010e\3\2"+ + "\2\2\u0118\u010f\3\2\2\2\u0118\u0113\3\2\2\2\u0118\u0117\3\2\2\2\u0119"+ + "-\3\2\2\2\u011a\u011b\7#\2\2\u011b\u011c\7$\2\2\u011c\u011d\7\4\2\2\u011d"+ + "\u011e\5\4\3\2\u011e/\3\2\2\2\u011f\u0120\7#\2\2\u0120\u0121\5\62\32\2"+ + "\u0121\u0122\7$\2\2\u0122\u0123\7\4\2\2\u0123\u0124\5\4\3\2\u0124\u012a"+ + "\3\2\2\2\u0125\u0126\5\64\33\2\u0126\u0127\7\4\2\2\u0127\u0128\5\4\3\2"+ + "\u0128\u012a\3\2\2\2\u0129\u011f\3\2\2\2\u0129\u0125\3\2\2\2\u012a\61"+ + "\3\2\2\2\u012b\u0130\5\66\34\2\u012c\u012d\7\7\2\2\u012d\u012f\5\66\34"+ + "\2\u012e\u012c\3\2\2\2\u012f\u0132\3\2\2\2\u0130\u012e\3\2\2\2\u0130\u0131"+ + "\3\2\2\2\u0131\63\3\2\2\2\u0132\u0130\3\2\2\2\u0133\u0134\5\66\34\2\u0134"+ + "\65\3\2\2\2\u0135\u0136\7,\2\2\u0136\67\3\2\2\2\32EZeis\u0080\u0088\u0095"+ + "\u009b\u00a6\u00a8\u00b1\u00bc\u00ca\u00cc\u00d5\u00e0\u00e2\u00ee\u00f0"+ + "\u0105\u0118\u0129\u0130"; public static final ATN _ATN = new ATNDeserializer().deserialize(_serializedATN.toCharArray()); static { http://git-wip-us.apache.org/repos/asf/metron/blob/191d5d84/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/BasicStellarTest.java ---------------------------------------------------------------------- diff --git a/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/BasicStellarTest.java b/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/BasicStellarTest.java index 21b8a1a..aa4462a 100644 --- a/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/BasicStellarTest.java +++ b/metron-stellar/stellar-common/src/test/java/org/apache/metron/stellar/dsl/functions/BasicStellarTest.java @@ -218,6 +218,25 @@ public class BasicStellarTest { } } + @Test + public void testConditionalsAsMapKeys() { + { + String query = "{ ( RET_TRUE() && y < 50 ) : 'info', y >= 50 : 'warn'}"; + Map<Boolean, String> ret = (Map)run(query, ImmutableMap.of("y", 50)); + Assert.assertEquals(ret.size(), 2); + Assert.assertEquals("warn", ret.get(true)); + Assert.assertEquals("info", ret.get(false)); + } + } + + + @Test + public void testConditionalsAsFunctionArgs() { + { + String query = "RET_TRUE(y < 10)"; + Assert.assertTrue((boolean)run(query, ImmutableMap.of("y", 50))); + } + } @Test public void testFunctionEmptyArgs() {
