4 /******************************************************************************
6 * Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.org) *
8 * This program is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU General Public License *
10 * as published by the Free Software Foundation; either version 2 *
11 * of the License, or (at your option) any later version. *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the Free Software Foundation *
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
21 ******************************************************************************/
23 #include "config/i2-config.hpp"
24 #include "config/configitembuilder.hpp"
25 #include "config/configtype.hpp"
26 #include "config/configcompiler.hpp"
27 #include "config/configcompilercontext.hpp"
28 #include "config/typerule.hpp"
29 #include "config/typerulelist.hpp"
30 #include "config/expression.hpp"
31 #include "config/applyrule.hpp"
32 #include "config/objectrule.hpp"
33 #include "base/value.hpp"
34 #include "base/utility.hpp"
35 #include "base/array.hpp"
36 #include "base/scriptvariable.hpp"
37 #include "base/exception.hpp"
38 #include "base/dynamictype.hpp"
39 #include "base/configerror.hpp"
42 #include <boost/foreach.hpp>
44 #define YYLTYPE icinga::DebugInfo
45 #define YYERROR_VERBOSE
47 #define YYLLOC_DEFAULT(Current, Rhs, N) \
50 (Current).Path = YYRHSLOC(Rhs, 1).Path; \
51 (Current).FirstLine = YYRHSLOC(Rhs, 1).FirstLine; \
52 (Current).FirstColumn = YYRHSLOC(Rhs, 1).FirstColumn; \
53 (Current).LastLine = YYRHSLOC(Rhs, N).LastLine; \
54 (Current).LastColumn = YYRHSLOC(Rhs, N).LastColumn; \
56 (Current).Path = YYRHSLOC(Rhs, 0).Path; \
57 (Current).FirstLine = (Current).LastLine = \
58 YYRHSLOC(Rhs, 0).LastLine; \
59 (Current).FirstColumn = (Current).LastColumn = \
60 YYRHSLOC(Rhs, 0).LastColumn; \
64 #define YY_LOCATION_PRINT(file, loc) \
66 std::ostringstream msgbuf; \
68 std::string str = msgbuf.str(); \
69 fputs(str.c_str(), file); \
72 using namespace icinga;
74 int ignore_newlines = 0;
76 static void MakeRBinaryOp(Value** result, Expression::OpCallback& op, Value *left, Value *right, DebugInfo& diLeft, DebugInfo& diRight)
78 *result = new Value(new Expression(op, *left, *right, DebugInfoRange(diLeft, diRight)));
91 %parse-param { ConfigCompiler *context }
92 %lex-param { void *scanner }
97 icinga::Value *variant;
98 icinga::Expression::OpCallback op;
100 icinga::TypeSpecifier type;
101 std::vector<String> *slist;
105 %token T_NEWLINE "new-line"
106 %token <text> T_STRING
107 %token <text> T_STRING_ANGLE
108 %token <num> T_NUMBER
110 %token <text> T_IDENTIFIER
112 %token <csop> T_SET "= (T_SET)"
113 %token <csop> T_SET_ADD "+= (T_SET_ADD)"
114 %token <csop> T_SET_SUBTRACT "-= (T_SET_SUBTRACT)"
115 %token <csop> T_SET_MULTIPLY "*= (T_SET_MULTIPLY)"
116 %token <csop> T_SET_DIVIDE "/= (T_SET_DIVIDE)"
118 %token <op> T_SHIFT_LEFT "<< (T_SHIFT_LEFT)"
119 %token <op> T_SHIFT_RIGHT ">> (T_SHIFT_RIGHT)"
120 %token <op> T_EQUAL "== (T_EQUAL)"
121 %token <op> T_NOT_EQUAL "!= (T_NOT_EQUAL)"
122 %token <op> T_IN "in (T_IN)"
123 %token <op> T_NOT_IN "!in (T_NOT_IN)"
124 %token <op> T_LOGICAL_AND "&& (T_LOGICAL_AND)"
125 %token <op> T_LOGICAL_OR "|| (T_LOGICAL_OR)"
126 %token <op> T_LESS_THAN_OR_EQUAL "<= (T_LESS_THAN_OR_EQUAL)"
127 %token <op> T_GREATER_THAN_OR_EQUAL ">= (T_GREATER_THAN_OR_EQUAL)"
128 %token <op> T_PLUS "+ (T_PLUS)"
129 %token <op> T_MINUS "- (T_MINUS)"
130 %token <op> T_MULTIPLY "* (T_MULTIPLY)"
131 %token <op> T_DIVIDE_OP "/ (T_DIVIDE_OP)"
132 %token <op> T_BINARY_AND "& (T_BINARY_AND)"
133 %token <op> T_BINARY_OR "| (T_BINARY_OR)"
134 %token <op> T_LESS_THAN "< (T_LESS_THAN)"
135 %token <op> T_GREATER_THAN "> (T_GREATER_THAN)"
137 %token T_CONST "const (T_CONST)"
138 %token <type> T_TYPE_DICTIONARY "dictionary (T_TYPE_DICTIONARY)"
139 %token <type> T_TYPE_ARRAY "array (T_TYPE_ARRAY)"
140 %token <type> T_TYPE_NUMBER "number (T_TYPE_NUMBER)"
141 %token <type> T_TYPE_STRING "string (T_TYPE_STRING)"
142 %token <type> T_TYPE_SCALAR "scalar (T_TYPE_SCALAR)"
143 %token <type> T_TYPE_ANY "any (T_TYPE_ANY)"
144 %token <type> T_TYPE_NAME "name (T_TYPE_NAME)"
145 %token T_VALIDATOR "%validator (T_VALIDATOR)"
146 %token T_REQUIRE "%require (T_REQUIRE)"
147 %token T_ATTRIBUTE "%attribute (T_ATTRIBUTE)"
148 %token T_TYPE "type (T_TYPE)"
149 %token T_OBJECT "object (T_OBJECT)"
150 %token T_TEMPLATE "template (T_TEMPLATE)"
151 %token T_INCLUDE "include (T_INCLUDE)"
152 %token T_INCLUDE_RECURSIVE "include_recursive (T_INCLUDE_RECURSIVE)"
153 %token T_LIBRARY "library (T_LIBRARY)"
154 %token T_INHERITS "inherits (T_INHERITS)"
155 %token T_APPLY "apply (T_APPLY)"
156 %token T_TO "to (T_TO)"
157 %token T_WHERE "where (T_WHERE)"
158 %token T_IMPORT "import (T_IMPORT)"
159 %token T_ASSIGN "assign (T_ASSIGN)"
160 %token T_IGNORE "ignore (T_IGNORE)"
161 %token T_APPLY_FOR "for (T_APPLY_FOR)"
162 %token T_FUNCTION "function (T_FUNCTION)"
163 %token T_RETURN "return (T_RETURN)"
164 %token T_FOR "for (T_FOR)"
165 %token T_FOLLOWS "=> (T_FOLLOWS)"
167 %type <text> identifier
168 %type <array> rterm_items
169 %type <array> rterm_items_inner
170 %type <array> identifier_items
171 %type <array> identifier_items_inner
172 %type <array> indexer
173 %type <array> indexer_items
174 %type <variant> indexer_item
175 %type <array> lterm_items
176 %type <array> lterm_items_inner
177 %type <variant> typerulelist
178 %type <csop> combined_set_op
180 %type <variant> rterm
181 %type <variant> rterm_array
182 %type <variant> rterm_scope
183 %type <variant> lterm
184 %type <variant> object
185 %type <variant> apply
186 %type <variant> optional_rterm
187 %type <text> target_type_specifier
195 %left T_EQUAL T_NOT_EQUAL
196 %left T_LESS_THAN T_LESS_THAN_OR_EQUAL T_GREATER_THAN T_GREATER_THAN_OR_EQUAL
197 %left T_SHIFT_LEFT T_SHIFT_RIGHT
199 %left T_MULTIPLY T_DIVIDE_OP
205 int yylex(YYSTYPE *lvalp, YYLTYPE *llocp, void *scanner);
207 void yyerror(YYLTYPE *locp, ConfigCompiler *, const char *err)
209 std::ostringstream message;
210 message << *locp << ": " << err;
211 ConfigCompilerContext::GetInstance()->AddMessage(true, message.str(), *locp);
214 int yyparse(ConfigCompiler *context);
216 static std::stack<bool> m_Abstract;
218 static std::stack<TypeRuleList::Ptr> m_RuleLists;
219 static ConfigType::Ptr m_Type;
221 static Dictionary::Ptr m_ModuleScope;
223 static std::stack<bool> m_Apply;
224 static std::stack<bool> m_ObjectAssign;
225 static std::stack<bool> m_SeenAssign;
226 static std::stack<Expression::Ptr> m_Assign;
227 static std::stack<Expression::Ptr> m_Ignore;
228 static std::stack<String> m_FKVar;
229 static std::stack<String> m_FVVar;
230 static std::stack<Expression::Ptr> m_FTerm;
232 void ConfigCompiler::Compile(void)
234 m_ModuleScope = new Dictionary();
236 m_Abstract = std::stack<bool>();
237 m_RuleLists = std::stack<TypeRuleList::Ptr>();
239 m_Apply = std::stack<bool>();
240 m_ObjectAssign = std::stack<bool>();
241 m_SeenAssign = std::stack<bool>();
242 m_Assign = std::stack<Expression::Ptr>();
243 m_Ignore = std::stack<Expression::Ptr>();
244 m_FKVar = std::stack<String>();
245 m_FVVar = std::stack<String>();
246 m_FTerm = std::stack<Expression::Ptr>();
250 } catch (const ConfigError& ex) {
251 const DebugInfo *di = boost::get_error_info<errinfo_debuginfo>(ex);
252 ConfigCompilerContext::GetInstance()->AddMessage(true, ex.what(), di ? *di : DebugInfo());
253 } catch (const std::exception& ex) {
254 ConfigCompilerContext::GetInstance()->AddMessage(true, DiagnosticInformation(ex));
258 #define scanner (context->GetScanner())
263 statements: /* empty */
264 | statements statement
267 statement: type | include | include_recursive | library | constant
273 Expression::Ptr aexpr = *$1;
274 aexpr->Evaluate(m_ModuleScope);
279 include: T_INCLUDE rterm sep
281 Expression::Ptr aexpr = *$2;
284 context->HandleInclude(aexpr->Evaluate(m_ModuleScope), false, DebugInfoRange(@1, @2));
286 | T_INCLUDE T_STRING_ANGLE
288 context->HandleInclude($2, true, DebugInfoRange(@1, @2));
293 include_recursive: T_INCLUDE_RECURSIVE rterm
295 Expression::Ptr aexpr = *$2;
298 context->HandleIncludeRecursive(aexpr->Evaluate(m_ModuleScope), "*.conf", DebugInfoRange(@1, @2));
300 | T_INCLUDE_RECURSIVE rterm ',' rterm
302 Expression::Ptr aexpr1 = *$2;
305 Expression::Ptr aexpr2 = *$4;
308 context->HandleIncludeRecursive(aexpr1->Evaluate(m_ModuleScope), aexpr2->Evaluate(m_ModuleScope), DebugInfoRange(@1, @4));
312 library: T_LIBRARY T_STRING sep
314 context->HandleLibrary($2);
319 constant: T_CONST identifier T_SET rterm sep
321 Expression::Ptr aexpr = *$4;
324 ScriptVariable::Ptr sv = ScriptVariable::Set($2, aexpr->Evaluate(m_ModuleScope));
325 sv->SetConstant(true);
331 identifier: T_IDENTIFIER
338 type: T_TYPE identifier
340 String name = String($2);
343 m_Type = ConfigType::GetByName(name);
346 m_Type = new ConfigType(name, DebugInfoRange(@1, @2));
350 type_inherits_specifier typerulelist sep
352 TypeRuleList::Ptr ruleList = *$5;
355 m_Type->GetRuleList()->AddRules(ruleList);
356 m_Type->GetRuleList()->AddRequires(ruleList);
358 String validator = ruleList->GetValidator();
359 if (!validator.IsEmpty())
360 m_Type->GetRuleList()->SetValidator(validator);
366 m_RuleLists.push(new TypeRuleList());
371 $$ = new Value(m_RuleLists.top());
376 typerules: typerules_inner
377 | typerules_inner sep
379 typerules_inner: /* empty */
381 | typerules_inner sep typerule
384 typerule: T_REQUIRE T_STRING
386 m_RuleLists.top()->AddRequire($2);
389 | T_VALIDATOR T_STRING
391 m_RuleLists.top()->SetValidator($2);
394 | T_ATTRIBUTE type T_STRING
396 TypeRule rule($2, String(), $3, TypeRuleList::Ptr(), DebugInfoRange(@1, @3));
399 m_RuleLists.top()->AddRule(rule);
401 | T_ATTRIBUTE T_TYPE_NAME '(' identifier ')' T_STRING
403 TypeRule rule($2, $4, $6, TypeRuleList::Ptr(), DebugInfoRange(@1, @6));
407 m_RuleLists.top()->AddRule(rule);
409 | T_ATTRIBUTE type T_STRING typerulelist
411 TypeRule rule($2, String(), $3, *$4, DebugInfoRange(@1, @4));
414 m_RuleLists.top()->AddRule(rule);
418 type_inherits_specifier: /* empty */
419 | T_INHERITS identifier
421 m_Type->SetParent($2);
426 type: T_TYPE_DICTIONARY
440 m_Abstract.push(false);
441 m_ObjectAssign.push(true);
442 m_SeenAssign.push(false);
443 m_Assign.push(MakeLiteral(false));
444 m_Ignore.push(MakeLiteral(false));
446 object_declaration identifier rterm rterm_scope
448 m_ObjectAssign.pop();
450 Array::Ptr args = new Array();
452 args->Add(m_Abstract.top());
462 Expression::Ptr exprl = *$5;
466 if (m_SeenAssign.top() && !ObjectRule::IsValidSourceType(type))
467 BOOST_THROW_EXCEPTION(ConfigError("object rule 'assign' cannot be used for type '" + type + "'") << errinfo_debuginfo(DebugInfoRange(@2, @3)));
471 Expression::Ptr rex = new Expression(&Expression::OpLogicalNegate, m_Ignore.top(), DebugInfoRange(@2, @5));
474 Expression::Ptr filter = new Expression(&Expression::OpLogicalAnd, m_Assign.top(), rex, DebugInfoRange(@2, @5));
479 args->Add(context->GetZone());
481 $$ = new Value(new Expression(&Expression::OpObject, args, exprl, DebugInfoRange(@2, @5)));
485 object_declaration: T_OBJECT
488 m_Abstract.top() = true;
491 identifier_items: identifier_items_inner
495 | identifier_items_inner ','
501 identifier_items_inner: /* empty */
511 | identifier_items_inner ',' identifier
526 $$->Add(MakeLiteral($1));
529 | identifier indexer_items
532 $$->Insert(0, MakeLiteral($1));
537 indexer_items: indexer_item
543 | indexer_items indexer_item
551 indexer_item: '.' identifier
553 $$ = new Value(MakeLiteral($2));
562 combined_set_op: T_SET
572 lterm_items: /* empty */
580 | lterm_items_inner sep
585 lterm_items_inner: lterm
591 | lterm_items_inner sep lterm
603 lterm: indexer combined_set_op rterm
605 $$ = new Value(new Expression(&Expression::OpSet, MakeArray(Array::Ptr($1), $2), *$3, DebugInfoRange(@1, @3)));
610 Expression::Ptr avar = new Expression(&Expression::OpVariable, "type", DebugInfoRange(@1, @2));
611 $$ = new Value(new Expression(&Expression::OpImport, avar, *$2, DebugInfoRange(@1, @2)));
614 | T_ASSIGN T_WHERE rterm
616 if ((m_Apply.empty() || !m_Apply.top()) && (m_ObjectAssign.empty() || !m_ObjectAssign.top()))
617 BOOST_THROW_EXCEPTION(ConfigError("'assign' keyword not valid in this context."));
619 m_SeenAssign.top() = true;
621 m_Assign.top() = new Expression(&Expression::OpLogicalOr, m_Assign.top(), *$3, DebugInfoRange(@1, @3));
624 $$ = new Value(MakeLiteral());
626 | T_IGNORE T_WHERE rterm
628 if ((m_Apply.empty() || !m_Apply.top()) && (m_ObjectAssign.empty() || !m_ObjectAssign.top()))
629 BOOST_THROW_EXCEPTION(ConfigError("'ignore' keyword not valid in this context."));
631 m_Ignore.top() = new Expression(&Expression::OpLogicalOr, m_Ignore.top(), *$3, DebugInfoRange(@1, @3));
634 $$ = new Value(MakeLiteral());
638 Expression::Ptr aname = MakeLiteral("__result");
639 $$ = new Value(new Expression(&Expression::OpSet, MakeArray(MakeArray(MakeLiteral(aname)), OpSetLiteral), *$2, DebugInfoRange(@1, @2)));
657 rterm_items: /* empty */
665 | rterm_items_inner arraysep
671 rterm_items_inner: rterm
677 | rterm_items_inner arraysep rterm
685 rterm_array: '[' newlines rterm_items newlines ']'
687 $$ = new Value(new Expression(&Expression::OpArray, Array::Ptr($3), DebugInfoRange(@1, @5)));
689 | '[' newlines rterm_items ']'
691 $$ = new Value(new Expression(&Expression::OpArray, Array::Ptr($3), DebugInfoRange(@1, @4)));
693 | '[' rterm_items newlines ']'
695 $$ = new Value(new Expression(&Expression::OpArray, Array::Ptr($2), DebugInfoRange(@1, @4)));
697 | '[' rterm_items ']'
699 $$ = new Value(new Expression(&Expression::OpArray, Array::Ptr($2), DebugInfoRange(@1, @3)));
703 rterm_scope: '{' newlines lterm_items newlines '}'
705 $$ = new Value(new Expression(&Expression::OpDict, Array::Ptr($3), DebugInfoRange(@1, @5)));
707 | '{' newlines lterm_items '}'
709 $$ = new Value(new Expression(&Expression::OpDict, Array::Ptr($3), DebugInfoRange(@1, @4)));
711 | '{' lterm_items newlines '}'
713 $$ = new Value(new Expression(&Expression::OpDict, Array::Ptr($2), DebugInfoRange(@1, @4)));
715 | '{' lterm_items '}'
717 $$ = new Value(new Expression(&Expression::OpDict, Array::Ptr($2), DebugInfoRange(@1, @3)));
723 $$ = new Value(MakeLiteral($1));
728 $$ = new Value(MakeLiteral($1));
732 $$ = new Value(MakeLiteral());
734 | rterm '.' T_IDENTIFIER
736 $$ = new Value(new Expression(&Expression::OpIndexer, *$1, MakeLiteral($3), DebugInfoRange(@1, @3)));
740 | rterm '(' rterm_items ')'
742 $$ = new Value(new Expression(&Expression::OpFunctionCall, *$1, MakeLiteral(Array::Ptr($3)), DebugInfoRange(@1, @4)));
747 $$ = new Value(new Expression(&Expression::OpVariable, $1, @1));
752 $$ = new Value(new Expression(&Expression::OpLogicalNegate, *$2, DebugInfoRange(@1, @2)));
757 $$ = new Value(new Expression(&Expression::OpNegate, *$2, DebugInfoRange(@1, @2)));
760 | rterm '[' rterm ']'
762 $$ = new Value(new Expression(&Expression::OpIndexer, *$1, *$3, DebugInfoRange(@1, @4)));
783 | rterm T_LOGICAL_OR rterm { MakeRBinaryOp(&$$, $2, $1, $3, @1, @3); }
784 | rterm T_LOGICAL_AND rterm { MakeRBinaryOp(&$$, $2, $1, $3, @1, @3); }
785 | rterm T_BINARY_OR rterm { MakeRBinaryOp(&$$, $2, $1, $3, @1, @3); }
786 | rterm T_BINARY_AND rterm { MakeRBinaryOp(&$$, $2, $1, $3, @1, @3); }
787 | rterm T_IN rterm { MakeRBinaryOp(&$$, $2, $1, $3, @1, @3); }
788 | rterm T_NOT_IN rterm { MakeRBinaryOp(&$$, $2, $1, $3, @1, @3); }
789 | rterm T_EQUAL rterm { MakeRBinaryOp(&$$, $2, $1, $3, @1, @3); }
790 | rterm T_NOT_EQUAL rterm { MakeRBinaryOp(&$$, $2, $1, $3, @1, @3); }
791 | rterm T_LESS_THAN rterm { MakeRBinaryOp(&$$, $2, $1, $3, @1, @3); }
792 | rterm T_LESS_THAN_OR_EQUAL rterm { MakeRBinaryOp(&$$, $2, $1, $3, @1, @3); }
793 | rterm T_GREATER_THAN rterm { MakeRBinaryOp(&$$, $2, $1, $3, @1, @3); }
794 | rterm T_GREATER_THAN_OR_EQUAL rterm { MakeRBinaryOp(&$$, $2, $1, $3, @1, @3); }
795 | rterm T_SHIFT_LEFT rterm { MakeRBinaryOp(&$$, $2, $1, $3, @1, @3); }
796 | rterm T_SHIFT_RIGHT rterm { MakeRBinaryOp(&$$, $2, $1, $3, @1, @3); }
797 | rterm T_PLUS rterm { MakeRBinaryOp(&$$, $2, $1, $3, @1, @3); }
798 | rterm T_MINUS rterm { MakeRBinaryOp(&$$, $2, $1, $3, @1, @3); }
799 | rterm T_MULTIPLY rterm { MakeRBinaryOp(&$$, $2, $1, $3, @1, @3); }
800 | rterm T_DIVIDE_OP rterm { MakeRBinaryOp(&$$, $2, $1, $3, @1, @3); }
801 | T_FUNCTION identifier '(' identifier_items ')' rterm_scope
803 Expression::Ptr aexpr = *$6;
807 $$ = new Value(new Expression(&Expression::OpFunction, MakeArray($2, aexpr), Array::Ptr($4), DebugInfoRange(@1, @6)));
810 | T_FUNCTION '(' identifier_items ')' rterm_scope
812 Expression::Ptr aexpr = *$5;
816 $$ = new Value(new Expression(&Expression::OpFunction, MakeArray(Empty, aexpr), Array::Ptr($3), DebugInfoRange(@1, @5)));
818 | T_FOR '(' identifier T_FOLLOWS identifier T_IN rterm ')' rterm_scope
820 Expression::Ptr aexpr = *$7;
823 Expression::Ptr ascope = *$9;
826 $$ = new Value(new Expression(&Expression::OpFor, MakeArray($3, $5, aexpr), ascope, DebugInfoRange(@1, @9)));
830 | T_FOR '(' identifier T_IN rterm ')' rterm_scope
832 Expression::Ptr aexpr = *$5;
835 Expression::Ptr ascope = *$7;
838 $$ = new Value(new Expression(&Expression::OpFor, MakeArray($3, Empty, aexpr), ascope, DebugInfoRange(@1, @7)));
843 target_type_specifier: /* empty */
853 apply_for_specifier: /* empty */
854 | T_APPLY_FOR '(' identifier T_FOLLOWS identifier T_IN rterm ')'
865 | T_APPLY_FOR '(' identifier T_IN rterm ')'
877 optional_rterm: /* empty */
879 $$ = new Value(MakeLiteral(Empty));
890 m_SeenAssign.push(false);
891 m_Assign.push(MakeLiteral(false));
892 m_Ignore.push(MakeLiteral(false));
895 m_FTerm.push(Expression::Ptr());
897 T_APPLY identifier optional_rterm apply_for_specifier target_type_specifier rterm
903 Expression::Ptr aname = *$4;
908 if (!ApplyRule::IsValidSourceType(type))
909 BOOST_THROW_EXCEPTION(ConfigError("'apply' cannot be used with type '" + type + "'") << errinfo_debuginfo(DebugInfoRange(@2, @3)));
911 if (!ApplyRule::IsValidTargetType(type, target)) {
913 std::vector<String> types = ApplyRule::GetTargetTypes(type);
916 for (std::vector<String>::size_type i = 0; i < types.size(); i++) {
917 if (typeNames != "") {
918 if (i == types.size() - 1)
924 typeNames += "'" + types[i] + "'";
927 BOOST_THROW_EXCEPTION(ConfigError("'apply' target type is ambiguous (can be one of " + typeNames + "): use 'to' to specify a type") << errinfo_debuginfo(DebugInfoRange(@2, @3)));
929 BOOST_THROW_EXCEPTION(ConfigError("'apply' target type '" + target + "' is invalid") << errinfo_debuginfo(DebugInfoRange(@2, @5)));
932 Expression::Ptr exprl = *$7;
938 if (!m_SeenAssign.top())
939 BOOST_THROW_EXCEPTION(ConfigError("'apply' is missing 'assign'") << errinfo_debuginfo(DebugInfoRange(@2, @3)));
943 Expression::Ptr rex = new Expression(&Expression::OpLogicalNegate, m_Ignore.top(), DebugInfoRange(@2, @5));
946 Expression::Ptr filter = new Expression(&Expression::OpLogicalAnd, m_Assign.top(), rex, DebugInfoRange(@2, @5));
949 String fkvar = m_FKVar.top();
952 String fvvar = m_FVVar.top();
955 Expression::Ptr fterm = m_FTerm.top();
958 Array::Ptr args = new Array();
967 $$ = new Value(new Expression(&Expression::OpApply, args, exprl, DebugInfoRange(@2, @5)));
975 /* required separator */
983 arraysep: ',' newlines