]> granicus.if.org Git - icinga2/commitdiff
Make braces around constant expressions optional.
authorGunnar Beutner <gunnar.beutner@netways.de>
Wed, 19 Mar 2014 08:38:45 +0000 (09:38 +0100)
committerGunnar Beutner <gunnar.beutner@netways.de>
Wed, 19 Mar 2014 11:46:23 +0000 (12:46 +0100)
Refs #5789

doc/4.1-configuration-syntax.md
lib/config/config_parser.yy

index 5f71388ef8da7425eea201e54caf282f6cc38bb0..f8a869cbd19aaca5bf3ec01c448cad483daa1a6b 100644 (file)
@@ -317,14 +317,14 @@ Constants cannot be changed once they are set.
 Simple calculations can be performed using the constant expression syntax:
 
     {
-      check_interval = (15 * 60)
+      check_interval = 30 + 60
     }
 
-Valid operators include ~, +, -, *, /, == and !=. The default precedence rules can be
+Valid operators include ~, +, -, *, /, ==,  !=, in and !in. The default precedence rules can be
 overridden by grouping expressions using parentheses:
 
     {
-      check_interval ((15 * 60) / 2)
+      check_interval (30 + 60) / 2
     }
 
 Global constants may be used in constant expressions.
@@ -334,7 +334,7 @@ Global constants may be used in constant expressions.
     ...
 
     {
-      check_interval = (MyCheckInterval / 2.5)
+      check_interval = MyCheckInterval / 2.5
     }
 
 > **Note**
index 57118d03c912e60a361dbb3da51a16776b8de007..749b3aafee4154b1db7cd0569ab6cf47811294e2 100644 (file)
@@ -123,7 +123,6 @@ using namespace icinga;
 %type <num> partial_specifier
 %type <slist> object_inherits_list
 %type <slist> object_inherits_specifier
-%type <aexpr> aterm
 %type <aexpr> aexpression
 %type <num> variable_decl
 %left T_LOGICAL_OR
@@ -584,11 +583,6 @@ simplevalue: T_STRING
        }
        ;
 
-aterm: '(' aexpression ')'
-       {
-               $$ = $2;
-       }
-
 aexpression: simplevalue
        {
                $$ = new Value(make_shared<AExpression>(AEReturn, AValue(ATSimple, *$1), yylloc));
@@ -700,7 +694,7 @@ value: simplevalue
                ExpressionList::Ptr exprl = ExpressionList::Ptr($1);
                $$ = new Value(exprl);
        }
-       | aterm
+       | aexpression
        {
                AExpression::Ptr aexpr = *$1;
                $$ = new Value(aexpr->Evaluate(Dictionary::Ptr()));
@@ -712,7 +706,7 @@ optional_template: /* empty */
        | T_TEMPLATE
        ;
 
-apply: T_APPLY optional_template identifier identifier T_TO identifier T_WHERE aterm
+apply: T_APPLY optional_template identifier identifier T_TO identifier T_WHERE aexpression
        {
                if (!ApplyRule::IsValidCombination($3, $6)) {
                        BOOST_THROW_EXCEPTION(std::invalid_argument("'apply' cannot be used with types '" + String($3) + "' and '" + String($6) + "'."));