mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 22:54:57 +02:00
DSL: introduce x?y:z
This commit is contained in:
parent
b3eb9c6a07
commit
5c347ef7bd
@ -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_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
|
%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
|
%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_OR
|
||||||
%left T_LOGICAL_AND
|
%left T_LOGICAL_AND
|
||||||
%left T_RETURN T_BREAK T_CONTINUE
|
%left T_RETURN T_BREAK T_CONTINUE
|
||||||
@ -831,6 +832,10 @@ rterm_side_effect: rterm '(' rterm_items ')'
|
|||||||
|
|
||||||
$$ = new ConditionalExpression(std::unique_ptr<Expression>($3), std::unique_ptr<Expression>($5), std::move(afalse), @$);
|
$$ = new ConditionalExpression(std::unique_ptr<Expression>($3), std::unique_ptr<Expression>($5), std::move(afalse), @$);
|
||||||
}
|
}
|
||||||
|
| rterm '?' rterm ':' rterm
|
||||||
|
{
|
||||||
|
$$ = new ConditionalExpression(std::unique_ptr<Expression>($1), std::unique_ptr<Expression>($3), std::unique_ptr<Expression>($5), @$);
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
rterm_no_side_effect_no_dict: T_STRING
|
rterm_no_side_effect_no_dict: T_STRING
|
||||||
|
Loading…
x
Reference in New Issue
Block a user