From 5c347ef7bdc211874954712bd75bbee93e3dca26 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Fri, 23 Aug 2019 11:05:55 +0200 Subject: [PATCH] DSL: introduce x?y:z --- lib/config/config_parser.yy | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/config/config_parser.yy b/lib/config/config_parser.yy index e5307a813..fe5bf9052 100644 --- a/lib/config/config_parser.yy +++ b/lib/config/config_parser.yy @@ -197,6 +197,7 @@ static void MakeRBinaryOp(Expression** result, Expression *left, Expression *rig %right T_INCLUDE T_INCLUDE_RECURSIVE T_INCLUDE_ZONES T_OBJECT T_TEMPLATE T_APPLY T_IMPORT T_ASSIGN T_IGNORE T_WHERE %right T_FUNCTION T_FOR %left T_SET T_SET_ADD T_SET_SUBTRACT T_SET_MULTIPLY T_SET_DIVIDE T_SET_MODULO T_SET_XOR T_SET_BINARY_AND T_SET_BINARY_OR +%right '?' ':' %left T_LOGICAL_OR %left T_LOGICAL_AND %left T_RETURN T_BREAK T_CONTINUE @@ -831,6 +832,10 @@ rterm_side_effect: rterm '(' rterm_items ')' $$ = new ConditionalExpression(std::unique_ptr($3), std::unique_ptr($5), std::move(afalse), @$); } + | rterm '?' rterm ':' rterm + { + $$ = new ConditionalExpression(std::unique_ptr($1), std::unique_ptr($3), std::unique_ptr($5), @$); + } ; rterm_no_side_effect_no_dict: T_STRING