Skip to content

Commit

Permalink
Allow if/else in rterms
Browse files Browse the repository at this point in the history
refs #8074
  • Loading branch information
gunnarbeutner committed Dec 14, 2014
1 parent b40e95d commit 262bfb7
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions lib/config/config_parser.yy
Expand Up @@ -141,8 +141,8 @@ static void MakeRBinaryOp(Expression** result, Expression *left, Expression *rig
%token T_LESS_THAN "< (T_LESS_THAN)"
%token T_GREATER_THAN "> (T_GREATER_THAN)"

%token T_CONST "const (T_CONST)"
%token T_LOCAL "local (T_LOCAL)"
%token T_GLOBAL "global (T_GLOBAL)"
%token T_USE "use (T_USE)"
%token <type> T_TYPE_DICTIONARY "dictionary (T_TYPE_DICTIONARY)"
%token <type> T_TYPE_ARRAY "array (T_TYPE_ARRAY)"
Expand Down Expand Up @@ -642,23 +642,6 @@ lterm: type
$$ = new ForExpression($3, "", $5, aexpr, DebugInfoRange(@1, @7));
free($3);
}
| T_IF '(' rterm ')' rterm_scope
{
DictExpression *atrue = dynamic_cast<DictExpression *>($5);
atrue->MakeInline();

$$ = new ConditionalExpression($3, atrue, NULL, DebugInfoRange(@1, @5));
}
| T_IF '(' rterm ')' rterm_scope T_ELSE rterm_scope
{
DictExpression *atrue = dynamic_cast<DictExpression *>($5);
atrue->MakeInline();

DictExpression *afalse = dynamic_cast<DictExpression *>($7);
afalse->MakeInline();

$$ = new ConditionalExpression($3, atrue, afalse, DebugInfoRange(@1, @7));
}
| T_FUNCTION identifier '(' identifier_items ')' use_specifier rterm_scope
{
DictExpression *aexpr = dynamic_cast<DictExpression *>($7);
Expand Down Expand Up @@ -864,6 +847,23 @@ rterm: T_STRING
$$ = new FunctionExpression(*$2, new std::map<String, Expression *>(), $5, DebugInfoRange(@1, @5));
delete $2;
}
| T_IF '(' rterm ')' rterm_scope
{
DictExpression *atrue = dynamic_cast<DictExpression *>($5);
atrue->MakeInline();

$$ = new ConditionalExpression($3, atrue, NULL, DebugInfoRange(@1, @5));
}
| T_IF '(' rterm ')' rterm_scope T_ELSE rterm_scope
{
DictExpression *atrue = dynamic_cast<DictExpression *>($5);
atrue->MakeInline();

DictExpression *afalse = dynamic_cast<DictExpression *>($7);
afalse->MakeInline();

$$ = new ConditionalExpression($3, atrue, afalse, DebugInfoRange(@1, @7));
}
;

target_type_specifier: /* empty */
Expand Down

0 comments on commit 262bfb7

Please sign in to comment.