"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/config/config_parser.yy" between
icinga2-2.11.5.tar.gz and icinga2-2.12.0.tar.gz

About: Icinga 2 is an enterprise grade monitoring system which keeps watch over networks and any conceivable network resource.

config_parser.yy  (icinga2-2.11.5):config_parser.yy  (icinga2-2.12.0)
skipping to change at line 200 skipping to change at line 200
%type <boolean> ignore_specifier %type <boolean> ignore_specifier
%type <cvlist> use_specifier %type <cvlist> use_specifier
%type <cvlist> use_specifier_items %type <cvlist> use_specifier_items
%type <cvitem> use_specifier_item %type <cvitem> use_specifier_item
%type <num> object_declaration %type <num> object_declaration
%right T_FOLLOWS %right T_FOLLOWS
%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
%left T_IDENTIFIER %left T_IDENTIFIER
%left T_BINARY_OR %left T_BINARY_OR
%left T_XOR %left T_XOR
%left T_BINARY_AND %left T_BINARY_AND
%nonassoc T_EQUAL T_NOT_EQUAL %nonassoc T_EQUAL T_NOT_EQUAL
%left T_IN T_NOT_IN %left T_IN T_NOT_IN
%nonassoc T_LESS_THAN T_LESS_THAN_OR_EQUAL T_GREATER_THAN T_GREATER_THAN_OR_EQUA L %nonassoc T_LESS_THAN T_LESS_THAN_OR_EQUAL T_GREATER_THAN T_GREATER_THAN_OR_EQUA L
skipping to change at line 276 skipping to change at line 277
EndFlowControlBlock(this); EndFlowControlBlock(this);
m_IgnoreNewlines.pop(); m_IgnoreNewlines.pop();
std::vector<std::unique_ptr<Expression> > dlist; std::vector<std::unique_ptr<Expression> > dlist;
decltype(llist.size()) num = 0; decltype(llist.size()) num = 0;
for (auto& litem : llist) { for (auto& litem : llist) {
if (!litem.second.SideEffect && num != llist.size() - 1) { if (!litem.second.SideEffect && num != llist.size() - 1) {
yyerror(&litem.second.DebugInfo, NULL, NULL, "Value compu ted is not used."); yyerror(&litem.second.DebugInfo, NULL, NULL, "Value compu ted is not used.");
} }
dlist.push_back(std::move(litem.first)); dlist.emplace_back(std::move(litem.first));
num++; num++;
} }
std::unique_ptr<DictExpression> expr{new DictExpression(std::move(dlist)) }; std::unique_ptr<DictExpression> expr{new DictExpression(std::move(dlist)) };
expr->MakeInline(); expr->MakeInline();
return std::move(expr); return std::move(expr);
} }
#define scanner (context->GetScanner()) #define scanner (context->GetScanner())
%} %}
%% %%
script: statements script: statements
{ {
llist->swap(*$1); llist->swap(*$1);
delete $1; delete $1;
} }
; ;
statements: newlines lterm_items statements: optional_newlines lterm_items
{ {
$$ = $2; $$ = $2;
} }
| lterm_items
; ;
lterm_items: /* empty */ lterm_items: /* empty */
{ {
$$ = new std::vector<std::pair<std::unique_ptr<Expression>, EItem Info> >(); $$ = new std::vector<std::pair<std::unique_ptr<Expression>, EItem Info> >();
} }
| lterm_items_inner | lterm_items_inner
| lterm_items_inner sep | lterm_items_inner sep
; ;
lterm_items_inner: lterm %dprec 2 lterm_items_inner: lterm %dprec 2
{ {
$$ = new std::vector<std::pair<std::unique_ptr<Expression>, EItem Info> >(); $$ = new std::vector<std::pair<std::unique_ptr<Expression>, EItem Info> >();
EItemInfo info = { true, @1 }; $$->emplace_back(std::unique_ptr<Expression>($1), EItemInfo{true,
$$->emplace_back(std::unique_ptr<Expression>($1), info); @1});
} }
| rterm_no_side_effect | rterm_no_side_effect
{ {
$$ = new std::vector<std::pair<std::unique_ptr<Expression>, EItem Info> >(); $$ = new std::vector<std::pair<std::unique_ptr<Expression>, EItem Info> >();
EItemInfo info = { false, @1 }; $$->emplace_back(std::unique_ptr<Expression>($1), EItemInfo{false
$$->emplace_back(std::unique_ptr<Expression>($1), info); , @1});
} }
| lterm_items_inner sep lterm %dprec 1 | lterm_items_inner sep lterm %dprec 1
{ {
if ($1) if ($1)
$$ = $1; $$ = $1;
else else
$$ = new std::vector<std::pair<std::unique_ptr<Expression >, EItemInfo> >(); $$ = new std::vector<std::pair<std::unique_ptr<Expression >, EItemInfo> >();
if ($3) { if ($3) {
EItemInfo info = { true, @3 }; $$->emplace_back(std::unique_ptr<Expression>($3), EItemIn
$$->emplace_back(std::unique_ptr<Expression>($3), info); fo{true, @3});
} }
} }
| lterm_items_inner sep rterm_no_side_effect %dprec 1 | lterm_items_inner sep rterm_no_side_effect %dprec 1
{ {
if ($1) if ($1)
$$ = $1; $$ = $1;
else else
$$ = new std::vector<std::pair<std::unique_ptr<Expression >, EItemInfo> >(); $$ = new std::vector<std::pair<std::unique_ptr<Expression >, EItemInfo> >();
if ($3) { if ($3) {
EItemInfo info = { false, @3 }; $$->emplace_back(std::unique_ptr<Expression>($3), EItemIn
$$->emplace_back(std::unique_ptr<Expression>($3), info); fo{false, @3});
} }
} }
; ;
identifier: T_IDENTIFIER identifier: T_IDENTIFIER
| T_STRING | T_STRING
; ;
object: object:
{ {
skipping to change at line 431 skipping to change at line 427
{ {
$$ = new std::vector<String>(); $$ = new std::vector<String>();
} }
| identifier_items_inner | identifier_items_inner
| identifier_items_inner ',' | identifier_items_inner ','
; ;
identifier_items_inner: identifier identifier_items_inner: identifier
{ {
$$ = new std::vector<String>(); $$ = new std::vector<String>();
$$->push_back(*$1); $$->emplace_back(std::move(*$1));
delete $1; delete $1;
} }
| identifier_items_inner ',' identifier | identifier_items_inner ',' identifier
{ {
if ($1) if ($1)
$$ = $1; $$ = $1;
else else
$$ = new std::vector<String>(); $$ = new std::vector<String>();
$$->push_back(*$3); $$->emplace_back(std::move(*$3));
delete $3; delete $3;
} }
; ;
combined_set_op: T_SET combined_set_op: T_SET
| T_SET_ADD | T_SET_ADD
| T_SET_SUBTRACT | T_SET_SUBTRACT
| T_SET_MULTIPLY | T_SET_MULTIPLY
| T_SET_DIVIDE | T_SET_DIVIDE
| T_SET_MODULO | T_SET_MODULO
skipping to change at line 475 skipping to change at line 471
| rterm combined_set_op rterm | rterm combined_set_op rterm
{ {
$$ = new SetExpression(std::unique_ptr<Expression>($1), $2, std:: unique_ptr<Expression>($3), @$); $$ = new SetExpression(std::unique_ptr<Expression>($1), $2, std:: unique_ptr<Expression>($3), @$);
} }
| T_INCLUDE rterm | T_INCLUDE rterm
{ {
$$ = new IncludeExpression(Utility::DirName(context->GetPath()), std::unique_ptr<Expression>($2), NULL, NULL, IncludeRegular, false, context->Get Zone(), context->GetPackage(), @$); $$ = new IncludeExpression(Utility::DirName(context->GetPath()), std::unique_ptr<Expression>($2), NULL, NULL, IncludeRegular, false, context->Get Zone(), context->GetPackage(), @$);
} }
| T_INCLUDE T_STRING_ANGLE | T_INCLUDE T_STRING_ANGLE
{ {
$$ = new IncludeExpression(Utility::DirName(context->GetPath()), MakeLiteral(*$2), NULL, NULL, IncludeRegular, true, context->GetZone(), context- >GetPackage(), @$); $$ = new IncludeExpression(Utility::DirName(context->GetPath()), MakeLiteral(std::move(*$2)), NULL, NULL, IncludeRegular, true, context->GetZone( ), context->GetPackage(), @$);
delete $2; delete $2;
} }
| T_INCLUDE_RECURSIVE rterm | T_INCLUDE_RECURSIVE rterm
{ {
$$ = new IncludeExpression(Utility::DirName(context->GetPath()), std::unique_ptr<Expression>($2), MakeLiteral("*.conf"), NULL, IncludeRecursive, false, context->GetZone(), context->GetPackage(), @$); $$ = new IncludeExpression(Utility::DirName(context->GetPath()), std::unique_ptr<Expression>($2), MakeLiteral("*.conf"), NULL, IncludeRecursive, false, context->GetZone(), context->GetPackage(), @$);
} }
| T_INCLUDE_RECURSIVE rterm ',' rterm | T_INCLUDE_RECURSIVE rterm ',' rterm
{ {
$$ = new IncludeExpression(Utility::DirName(context->GetPath()), std::unique_ptr<Expression>($2), std::unique_ptr<Expression>($4), NULL, IncludeR ecursive, false, context->GetZone(), context->GetPackage(), @$); $$ = new IncludeExpression(Utility::DirName(context->GetPath()), std::unique_ptr<Expression>($2), std::unique_ptr<Expression>($4), NULL, IncludeR ecursive, false, context->GetZone(), context->GetPackage(), @$);
} }
skipping to change at line 603 skipping to change at line 599
rterm_scope_require_side_effect rterm_scope_require_side_effect
{ {
EndFlowControlBlock(context); EndFlowControlBlock(context);
std::unique_ptr<Expression> expr{$2}; std::unique_ptr<Expression> expr{$2};
BindToScope(expr, ScopeGlobal); BindToScope(expr, ScopeGlobal);
$$ = new SetExpression(std::move(expr), OpSetLiteral, std::unique _ptr<Expression>(new NamespaceExpression(std::unique_ptr<Expression>($4), @$)), @$); $$ = new SetExpression(std::move(expr), OpSetLiteral, std::unique _ptr<Expression>(new NamespaceExpression(std::unique_ptr<Expression>($4), @$)), @$);
} }
| T_USING rterm | T_USING rterm
{ {
std::shared_ptr<Expression> expr{$2}; Expression::Ptr expr{$2};
context->AddImport(expr); context->AddImport(std::move(expr));
$$ = MakeLiteralRaw(); $$ = MakeLiteralRaw();
} }
| apply | apply
| object | object
| T_FOR '(' optional_var identifier T_FOLLOWS optional_var identifier T_I N rterm ')' | T_FOR '(' optional_var identifier T_FOLLOWS optional_var identifier T_I N rterm ')'
{ {
BeginFlowControlBlock(context, FlowControlContinue | FlowControlB reak, true); BeginFlowControlBlock(context, FlowControlContinue | FlowControlB reak, true);
} }
rterm_scope_require_side_effect rterm_scope_require_side_effect
{ {
EndFlowControlBlock(context); EndFlowControlBlock(context);
$$ = new ForExpression(*$4, *$7, std::unique_ptr<Expression>($9), std::unique_ptr<Expression>($12), @$); $$ = new ForExpression(std::move(*$4), std::move(*$7), std::uniqu e_ptr<Expression>($9), std::unique_ptr<Expression>($12), @$);
delete $4; delete $4;
delete $7; delete $7;
} }
| T_FOR '(' optional_var identifier T_IN rterm ')' | T_FOR '(' optional_var identifier T_IN rterm ')'
{ {
BeginFlowControlBlock(context, FlowControlContinue | FlowControlB reak, true); BeginFlowControlBlock(context, FlowControlContinue | FlowControlB reak, true);
} }
rterm_scope_require_side_effect rterm_scope_require_side_effect
{ {
EndFlowControlBlock(context); EndFlowControlBlock(context);
$$ = new ForExpression(*$4, "", std::unique_ptr<Expression>($6), std::unique_ptr<Expression>($9), @$); $$ = new ForExpression(std::move(*$4), "", std::unique_ptr<Expres sion>($6), std::unique_ptr<Expression>($9), @$);
delete $4; delete $4;
} }
| T_FUNCTION identifier '(' identifier_items ')' use_specifier | T_FUNCTION identifier '(' identifier_items ')' use_specifier
{ {
BeginFlowControlBlock(context, FlowControlReturn, false); BeginFlowControlBlock(context, FlowControlReturn, false);
} }
rterm_scope rterm_scope
{ {
EndFlowControlBlock(context); EndFlowControlBlock(context);
std::unique_ptr<FunctionExpression> fexpr{new FunctionExpression( *$2, *$4, std::move(*$6), std::unique_ptr<Expression>($8), @$)}; std::unique_ptr<FunctionExpression> fexpr{new FunctionExpression( *$2, std::move(*$4), std::move(*$6), std::unique_ptr<Expression>($8), @$)};
delete $4; delete $4;
delete $6; delete $6;
$$ = new SetExpression(MakeIndexer(ScopeThis, *$2), OpSetLiteral, std::move(fexpr), @$); $$ = new SetExpression(MakeIndexer(ScopeThis, std::move(*$2)), Op SetLiteral, std::move(fexpr), @$);
delete $2; delete $2;
} }
| T_CONST T_IDENTIFIER T_SET rterm | T_CONST T_IDENTIFIER T_SET rterm
{ {
$$ = new SetConstExpression(*$2, std::unique_ptr<Expression>($4), @$); $$ = new SetConstExpression(std::move(*$2), std::unique_ptr<Expre ssion>($4), @$);
delete $2; delete $2;
} }
| T_VAR rterm | T_VAR rterm
{ {
std::unique_ptr<Expression> expr{$2}; std::unique_ptr<Expression> expr{$2};
BindToScope(expr, ScopeLocal); BindToScope(expr, ScopeLocal);
$$ = new SetExpression(std::move(expr), OpSetLiteral, MakeLiteral (), @$); $$ = new SetExpression(std::move(expr), OpSetLiteral, MakeLiteral (), @$);
} }
| T_VAR rterm combined_set_op rterm | T_VAR rterm combined_set_op rterm
{ {
skipping to change at line 690 skipping to change at line 686
$$ = new TryExceptExpression(std::unique_ptr<Expression>($2), std ::unique_ptr<Expression>($4), @$); $$ = new TryExceptExpression(std::unique_ptr<Expression>($2), std ::unique_ptr<Expression>($4), @$);
} }
| rterm_side_effect | rterm_side_effect
; ;
rterm_items: /* empty */ rterm_items: /* empty */
{ {
$$ = new std::vector<std::unique_ptr<Expression> >(); $$ = new std::vector<std::unique_ptr<Expression> >();
} }
| rterm_items_inner | rterm_items_inner
| rterm_items_inner ',' | rterm_items_inner ',' optional_newlines
| rterm_items_inner ',' newlines
| rterm_items_inner newlines | rterm_items_inner newlines
; ;
rterm_items_inner: rterm rterm_items_inner: rterm
{ {
$$ = new std::vector<std::unique_ptr<Expression> >(); $$ = new std::vector<std::unique_ptr<Expression> >();
$$->emplace_back($1); $$->emplace_back($1);
} }
| rterm_items_inner arraysep rterm | rterm_items_inner ',' optional_newlines rterm
{ {
$$ = $1; $$ = $1;
$$->emplace_back($3); $$->emplace_back($4);
} }
; ;
rterm_array: '[' rterm_array: '['
{ {
context->m_OpenBraces++; context->m_OpenBraces++;
} }
newlines rterm_items ']' optional_newlines rterm_items ']'
{ {
context->m_OpenBraces--; context->m_OpenBraces--;
$$ = new ArrayExpression(std::move(*$4), @$); $$ = new ArrayExpression(std::move(*$4), @$);
delete $4; delete $4;
} }
| '['
{
context->m_OpenBraces++;
}
rterm_items ']'
{
context->m_OpenBraces--;
$$ = new ArrayExpression(std::move(*$3), @$);
delete $3;
}
; ;
rterm_dict: '{' rterm_dict: '{'
{ {
BeginFlowControlBlock(context, 0, false); BeginFlowControlBlock(context, 0, false);
context->m_IgnoreNewlines.push(false); context->m_IgnoreNewlines.push(false);
context->m_OpenBraces++; context->m_OpenBraces++;
} }
statements '}' statements '}'
{ {
EndFlowControlBlock(context); EndFlowControlBlock(context);
context->m_OpenBraces--; context->m_OpenBraces--;
context->m_IgnoreNewlines.pop(); context->m_IgnoreNewlines.pop();
std::vector<std::unique_ptr<Expression> > dlist; std::vector<std::unique_ptr<Expression> > dlist;
for (auto& litem : *$3) { for (auto& litem : *$3) {
if (!litem.second.SideEffect) if (!litem.second.SideEffect)
yyerror(&litem.second.DebugInfo, NULL, NULL, "Val ue computed is not used."); yyerror(&litem.second.DebugInfo, NULL, NULL, "Val ue computed is not used.");
dlist.push_back(std::move(litem.first)); dlist.emplace_back(std::move(litem.first));
} }
delete $3; delete $3;
$$ = new DictExpression(std::move(dlist), @$); $$ = new DictExpression(std::move(dlist), @$);
} }
; ;
rterm_scope_require_side_effect: '{' rterm_scope_require_side_effect: '{'
{ {
context->m_IgnoreNewlines.push(false); context->m_IgnoreNewlines.push(false);
context->m_OpenBraces++; context->m_OpenBraces++;
} }
statements '}' statements '}'
{ {
context->m_OpenBraces--; context->m_OpenBraces--;
context->m_IgnoreNewlines.pop(); context->m_IgnoreNewlines.pop();
std::vector<std::unique_ptr<Expression> > dlist; std::vector<std::unique_ptr<Expression> > dlist;
for (auto& litem : *$3) { for (auto& litem : *$3) {
if (!litem.second.SideEffect) if (!litem.second.SideEffect)
yyerror(&litem.second.DebugInfo, NULL, NULL, "Val ue computed is not used."); yyerror(&litem.second.DebugInfo, NULL, NULL, "Val ue computed is not used.");
dlist.push_back(std::move(litem.first)); dlist.emplace_back(std::move(litem.first));
} }
delete $3; delete $3;
$$ = new DictExpression(std::move(dlist), @$); $$ = new DictExpression(std::move(dlist), @$);
$$->MakeInline(); $$->MakeInline();
} }
; ;
rterm_scope: '{' rterm_scope: '{'
{ {
context->m_IgnoreNewlines.push(false); context->m_IgnoreNewlines.push(false);
skipping to change at line 786 skipping to change at line 771
} }
statements '}' statements '}'
{ {
context->m_OpenBraces--; context->m_OpenBraces--;
context->m_IgnoreNewlines.pop(); context->m_IgnoreNewlines.pop();
std::vector<std::unique_ptr<Expression> > dlist; std::vector<std::unique_ptr<Expression> > dlist;
decltype($3->size()) num = 0; decltype($3->size()) num = 0;
for (auto& litem : *$3) { for (auto& litem : *$3) {
if (!litem.second.SideEffect && num != $3->size() - 1) if (!litem.second.SideEffect && num != $3->size() - 1)
yyerror(&litem.second.DebugInfo, NULL, NULL, "Val ue computed is not used."); yyerror(&litem.second.DebugInfo, NULL, NULL, "Val ue computed is not used.");
dlist.push_back(std::move(litem.first)); dlist.emplace_back(std::move(litem.first));
num++; num++;
} }
delete $3; delete $3;
$$ = new DictExpression(std::move(dlist), @$); $$ = new DictExpression(std::move(dlist), @$);
$$->MakeInline(); $$->MakeInline();
} }
; ;
else_if_branch: T_ELSE T_IF '(' rterm ')' rterm_scope else_if_branch: T_ELSE T_IF '(' rterm ')' rterm_scope
{ {
skipping to change at line 808 skipping to change at line 793
} }
; ;
else_if_branches: /* empty */ else_if_branches: /* empty */
{ {
$$ = new std::vector<std::pair<std::unique_ptr<Expression>, std:: unique_ptr<Expression> > >(); $$ = new std::vector<std::pair<std::unique_ptr<Expression>, std:: unique_ptr<Expression> > >();
} }
| else_if_branches else_if_branch | else_if_branches else_if_branch
{ {
$$ = $1; $$ = $1;
$$->push_back(std::move(*$2)); $$->emplace_back(std::move(*$2));
delete $2; delete $2;
} }
; ;
rterm_side_effect: rterm '(' rterm_items ')' rterm_side_effect: rterm '(' rterm_items ')'
{ {
$$ = new FunctionCallExpression(std::unique_ptr<Expression>($1), std::move(*$3), @$); $$ = new FunctionCallExpression(std::unique_ptr<Expression>($1), std::move(*$3), @$);
delete $3; delete $3;
} }
| T_IF '(' rterm ')' rterm_scope else_if_branches | T_IF '(' rterm ')' rterm_scope else_if_branches
skipping to change at line 850 skipping to change at line 835
std::unique_ptr<Expression> afalse{$8}; std::unique_ptr<Expression> afalse{$8};
for (int i = ebranches.size() - 1; i >= 0; i--) { for (int i = ebranches.size() - 1; i >= 0; i--) {
auto& ebranch = ebranches[i]; auto& ebranch = ebranches[i];
afalse.reset(new ConditionalExpression(std::move(ebranch. first), std::move(ebranch.second), std::move(afalse), @6)); afalse.reset(new ConditionalExpression(std::move(ebranch. first), std::move(ebranch.second), std::move(afalse), @6));
} }
$$ = new ConditionalExpression(std::unique_ptr<Expression>($3), s td::unique_ptr<Expression>($5), std::move(afalse), @$); $$ = new ConditionalExpression(std::unique_ptr<Expression>($3), s td::unique_ptr<Expression>($5), std::move(afalse), @$);
} }
| rterm '?' rterm ':' rterm
{
$$ = new ConditionalExpression(std::unique_ptr<Expression>($1), s
td::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
{ {
$$ = MakeLiteralRaw(*$1); $$ = MakeLiteralRaw(std::move(*$1));
delete $1; delete $1;
} }
| T_NUMBER | T_NUMBER
{ {
$$ = MakeLiteralRaw($1); $$ = MakeLiteralRaw($1);
} }
| T_BOOLEAN | T_BOOLEAN
{ {
$$ = MakeLiteralRaw($1); $$ = MakeLiteralRaw($1);
} }
| T_NULL | T_NULL
{ {
$$ = MakeLiteralRaw(); $$ = MakeLiteralRaw();
} }
| rterm '.' T_IDENTIFIER %dprec 2 | rterm '.' T_IDENTIFIER %dprec 2
{ {
$$ = new IndexerExpression(std::unique_ptr<Expression>($1), MakeL iteral(*$3), @$); $$ = new IndexerExpression(std::unique_ptr<Expression>($1), MakeL iteral(std::move(*$3)), @$);
delete $3; delete $3;
} }
| rterm '[' rterm ']' | rterm '[' rterm ']'
{ {
$$ = new IndexerExpression(std::unique_ptr<Expression>($1), std:: unique_ptr<Expression>($3), @$); $$ = new IndexerExpression(std::unique_ptr<Expression>($1), std:: unique_ptr<Expression>($3), @$);
} }
| T_IDENTIFIER | T_IDENTIFIER
{ {
$$ = new VariableExpression(*$1, context->GetImports(), @1); $$ = new VariableExpression(std::move(*$1), context->GetImports() , @1);
delete $1; delete $1;
} }
| T_MULTIPLY rterm %prec DEREF_OP | T_MULTIPLY rterm %prec DEREF_OP
{ {
$$ = new DerefExpression(std::unique_ptr<Expression>($2), @$); $$ = new DerefExpression(std::unique_ptr<Expression>($2), @$);
} }
| T_BINARY_AND rterm %prec REF_OP | T_BINARY_AND rterm %prec REF_OP
{ {
$$ = new RefExpression(std::unique_ptr<Expression>($2), @$); $$ = new RefExpression(std::unique_ptr<Expression>($2), @$);
} }
skipping to change at line 936 skipping to change at line 925
} }
| identifier T_FOLLOWS | identifier T_FOLLOWS
{ {
BeginFlowControlBlock(context, FlowControlReturn, false); BeginFlowControlBlock(context, FlowControlReturn, false);
} }
rterm_scope %dprec 2 rterm_scope %dprec 2
{ {
EndFlowControlBlock(context); EndFlowControlBlock(context);
std::vector<String> args; std::vector<String> args;
args.push_back(*$1); args.emplace_back(std::move(*$1));
delete $1; delete $1;
$$ = new FunctionExpression("<anonymous>", args, {}, std::unique_ ptr<Expression>($4), @$); $$ = new FunctionExpression("<anonymous>", std::move(args), {}, s td::unique_ptr<Expression>($4), @$);
} }
| identifier T_FOLLOWS rterm %dprec 1 | identifier T_FOLLOWS rterm %dprec 1
{ {
ASSERT(!dynamic_cast<DictExpression *>($3)); ASSERT(!dynamic_cast<DictExpression *>($3));
std::vector<String> args; std::vector<String> args;
args.push_back(*$1); args.emplace_back(std::move(*$1));
delete $1; delete $1;
$$ = new FunctionExpression("<anonymous>", args, {}, std::unique_ ptr<Expression>($3), @$); $$ = new FunctionExpression("<anonymous>", std::move(args), {}, s td::unique_ptr<Expression>($3), @$);
} }
| '(' identifier_items ')' T_FOLLOWS | '(' identifier_items ')' use_specifier T_FOLLOWS
{ {
BeginFlowControlBlock(context, FlowControlReturn, false); BeginFlowControlBlock(context, FlowControlReturn, false);
} }
rterm_scope %dprec 2 rterm_scope %dprec 2
{ {
EndFlowControlBlock(context); EndFlowControlBlock(context);
$$ = new FunctionExpression("<anonymous>", *$2, {}, std::unique_p tr<Expression>($6), @$); $$ = new FunctionExpression("<anonymous>", std::move(*$2), std::m ove(*$4), std::unique_ptr<Expression>($7), @$);
delete $2; delete $2;
delete $4;
} }
| '(' identifier_items ')' T_FOLLOWS rterm %dprec 1 | '(' identifier_items ')' use_specifier T_FOLLOWS rterm %dprec 1
{ {
ASSERT(!dynamic_cast<DictExpression *>($5)); ASSERT(!dynamic_cast<DictExpression *>($6));
$$ = new FunctionExpression("<anonymous>", *$2, {}, std::unique_p tr<Expression>($5), @$); $$ = new FunctionExpression("<anonymous>", std::move(*$2), std::m ove(*$4), std::unique_ptr<Expression>($6), @$);
delete $2; delete $2;
delete $4;
} }
| rterm_array | rterm_array
| '(' | '('
{ {
context->m_OpenBraces++; context->m_OpenBraces++;
} }
rterm ')' rterm ')'
{ {
context->m_OpenBraces--; context->m_OpenBraces--;
$$ = $3; $$ = $3;
skipping to change at line 1007 skipping to change at line 998
| rterm T_MODULO rterm { MakeRBinaryOp<ModuloExpression>(&$$, $1, $3, @1, @3); } | rterm T_MODULO rterm { MakeRBinaryOp<ModuloExpression>(&$$, $1, $3, @1, @3); }
| rterm T_XOR rterm { MakeRBinaryOp<XorExpression>(&$$, $1, $3, @1, @3); } | rterm T_XOR rterm { MakeRBinaryOp<XorExpression>(&$$, $1, $3, @1, @3); }
| T_FUNCTION '(' identifier_items ')' use_specifier | T_FUNCTION '(' identifier_items ')' use_specifier
{ {
BeginFlowControlBlock(context, FlowControlReturn, false); BeginFlowControlBlock(context, FlowControlReturn, false);
} }
rterm_scope rterm_scope
{ {
EndFlowControlBlock(context); EndFlowControlBlock(context);
$$ = new FunctionExpression("<anonymous>", *$3, std::move(*$5), s td::unique_ptr<Expression>($7), @$); $$ = new FunctionExpression("<anonymous>", std::move(*$3), std::m ove(*$5), std::unique_ptr<Expression>($7), @$);
delete $3; delete $3;
delete $5; delete $5;
} }
| T_NULLARY_LAMBDA_BEGIN | T_NULLARY_LAMBDA_BEGIN
{ {
BeginFlowControlBlock(context, FlowControlReturn, false); BeginFlowControlBlock(context, FlowControlReturn, false);
} }
statements T_NULLARY_LAMBDA_END statements T_NULLARY_LAMBDA_END
{ {
EndFlowControlBlock(context); EndFlowControlBlock(context);
std::vector<std::unique_ptr<Expression> > dlist; std::vector<std::unique_ptr<Expression> > dlist;
decltype(dlist.size()) num = 0; decltype(dlist.size()) num = 0;
for (auto& litem : *$3) { for (auto& litem : *$3) {
if (!litem.second.SideEffect && num != $3->size() - 1) if (!litem.second.SideEffect && num != $3->size() - 1)
yyerror(&litem.second.DebugInfo, NULL, NULL, "Val ue computed is not used."); yyerror(&litem.second.DebugInfo, NULL, NULL, "Val ue computed is not used.");
dlist.push_back(std::move(litem.first)); dlist.emplace_back(std::move(litem.first));
num++; num++;
} }
delete $3; delete $3;
std::unique_ptr<DictExpression> aexpr{new DictExpression(std::mov e(dlist), @$)}; std::unique_ptr<DictExpression> aexpr{new DictExpression(std::mov e(dlist), @$)};
aexpr->MakeInline(); aexpr->MakeInline();
$$ = new FunctionExpression("<anonymous>", {}, {}, std::move(aexp r), @$); $$ = new FunctionExpression("<anonymous>", {}, {}, std::move(aexp r), @$);
} }
; ;
skipping to change at line 1093 skipping to change at line 1084
} }
| T_USE '(' use_specifier_items ')' | T_USE '(' use_specifier_items ')'
{ {
$$ = $3; $$ = $3;
} }
; ;
use_specifier_items: use_specifier_item use_specifier_items: use_specifier_item
{ {
$$ = new std::map<String, std::unique_ptr<Expression> >(); $$ = new std::map<String, std::unique_ptr<Expression> >();
$$->insert(std::move(*$1)); $$->emplace(std::move(*$1));
delete $1; delete $1;
} }
| use_specifier_items ',' use_specifier_item | use_specifier_items ',' use_specifier_item
{ {
$$ = $1; $$ = $1;
$$->insert(std::move(*$3)); $$->emplace(std::move(*$3));
delete $3; delete $3;
} }
; ;
use_specifier_item: identifier use_specifier_item: identifier
{ {
$$ = new std::pair<String, std::unique_ptr<Expression> >(*$1, std std::unique_ptr<Expression> var (new VariableExpression(*$1, cont
::unique_ptr<Expression>(new VariableExpression(*$1, context->GetImports(), @1)) ext->GetImports(), @1));
); $$ = new std::pair<String, std::unique_ptr<Expression> >(std::mov
e(*$1), std::move(var));
delete $1; delete $1;
} }
| identifier T_SET rterm | identifier T_SET rterm
{ {
$$ = new std::pair<String, std::unique_ptr<Expression> >(*$1, std ::unique_ptr<Expression>($3)); $$ = new std::pair<String, std::unique_ptr<Expression> >(std::mov e(*$1), std::unique_ptr<Expression>($3));
delete $1; delete $1;
} }
; ;
apply_for_specifier: /* empty */ apply_for_specifier: /* empty */
| T_FOR '(' optional_var identifier T_FOLLOWS optional_var identifier T_I N rterm ')' | T_FOR '(' optional_var identifier T_FOLLOWS optional_var identifier T_I N rterm ')'
{ {
context->m_FKVar.top() = *$4; context->m_FKVar.top() = std::move(*$4);
delete $4; delete $4;
context->m_FVVar.top() = *$7; context->m_FVVar.top() = std::move(*$7);
delete $7; delete $7;
context->m_FTerm.top() = $9; context->m_FTerm.top() = $9;
} }
| T_FOR '(' optional_var identifier T_IN rterm ')' | T_FOR '(' optional_var identifier T_IN rterm ')'
{ {
context->m_FKVar.top() = *$4; context->m_FKVar.top() = std::move(*$4);
delete $4; delete $4;
context->m_FVVar.top() = ""; context->m_FVVar.top() = "";
context->m_FTerm.top() = $6; context->m_FTerm.top() = $6;
} }
; ;
optional_rterm: /* empty */ optional_rterm: /* empty */
{ {
skipping to change at line 1166 skipping to change at line 1158
T_APPLY identifier optional_rterm apply_for_specifier target_type_specifi er use_specifier ignore_specifier T_APPLY identifier optional_rterm apply_for_specifier target_type_specifi er use_specifier ignore_specifier
{ {
BeginFlowControlBlock(context, FlowControlReturn, false); BeginFlowControlBlock(context, FlowControlReturn, false);
} }
rterm_scope_require_side_effect rterm_scope_require_side_effect
{ {
EndFlowControlBlock(context); EndFlowControlBlock(context);
context->m_Apply.pop(); context->m_Apply.pop();
String type = *$3; String type = std::move(*$3);
delete $3; delete $3;
String target = *$6; String target = std::move(*$6);
delete $6; delete $6;
if (!ApplyRule::IsValidSourceType(type)) if (!ApplyRule::IsValidSourceType(type))
BOOST_THROW_EXCEPTION(ScriptError("'apply' cannot be used with type '" + type + "'", @3)); BOOST_THROW_EXCEPTION(ScriptError("'apply' cannot be used with type '" + type + "'", @3));
if (!ApplyRule::IsValidTargetType(type, target)) { if (!ApplyRule::IsValidTargetType(type, target)) {
if (target == "") { if (target == "") {
std::vector<String> types = ApplyRule::GetTargetT ypes(type); std::vector<String> types = ApplyRule::GetTargetT ypes(type);
String typeNames; String typeNames;
skipping to change at line 1223 skipping to change at line 1215
std::unique_ptr<Expression> filter; std::unique_ptr<Expression> filter;
if (ignore) { if (ignore) {
std::unique_ptr<Expression>rex{new LogicalNegateExpressio n(std::move(ignore), DebugInfoRange(@2, @5))}; std::unique_ptr<Expression>rex{new LogicalNegateExpressio n(std::move(ignore), DebugInfoRange(@2, @5))};
filter.reset(new LogicalAndExpression(std::move(assign), std::move(rex), DebugInfoRange(@2, @5))); filter.reset(new LogicalAndExpression(std::move(assign), std::move(rex), DebugInfoRange(@2, @5)));
} else } else
filter.swap(assign); filter.swap(assign);
String fkvar = context->m_FKVar.top(); String fkvar = std::move(context->m_FKVar.top());
context->m_FKVar.pop(); context->m_FKVar.pop();
String fvvar = context->m_FVVar.top(); String fvvar = std::move(context->m_FVVar.top());
context->m_FVVar.pop(); context->m_FVVar.pop();
std::unique_ptr<Expression> fterm{context->m_FTerm.top()}; std::unique_ptr<Expression> fterm{context->m_FTerm.top()};
context->m_FTerm.pop(); context->m_FTerm.pop();
$$ = new ApplyExpression(type, target, std::unique_ptr<Expression >($4), std::move(filter), context->GetPackage(), fkvar, fvvar, std::move(fterm), std::move(*$7), $8, std::unique_ptr<Expression>($10), DebugInfoRange(@2, @8)); $$ = new ApplyExpression(std::move(type), std::move(target), std: :unique_ptr<Expression>($4), std::move(filter), context->GetPackage(), std::move (fkvar), std::move(fvvar), std::move(fterm), std::move(*$7), $8, std::unique_ptr <Expression>($10), DebugInfoRange(@2, @8));
delete $7; delete $7;
} }
; ;
newlines: T_NEWLINE newlines: T_NEWLINE
| T_NEWLINE newlines | T_NEWLINE newlines
; ;
/* required separator */ optional_newlines: /* empty */
sep: ',' newlines
| ','
| ';' newlines
| ';'
| newlines | newlines
; ;
arraysep: ',' newlines /* required separator */
| ',' sep: ',' optional_newlines
| ';' optional_newlines
| newlines
; ;
%% %%
 End of changes. 57 change blocks. 
75 lines changed or deleted 70 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)