From e86b36f8d786878adf0d1f21afaea5cb8ffbbe3c Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 11 Dec 2014 13:12:35 +0100 Subject: [PATCH] Remove the __ prefix from some of the lexer tokens fixes #7883 --- lib/config/config_lexer.ll | 13 +++--- lib/config/config_parser.yy | 83 ++++++++++++++++++------------------- 2 files changed, 47 insertions(+), 49 deletions(-) diff --git a/lib/config/config_lexer.ll b/lib/config/config_lexer.ll index 86a6933aa..c21e3a1a1 100644 --- a/lib/config/config_lexer.ll +++ b/lib/config/config_lexer.ll @@ -186,13 +186,12 @@ where return T_WHERE; import return T_IMPORT; assign return T_ASSIGN; ignore return T_IGNORE; -for return T_APPLY_FOR; -__function return T_FUNCTION; -__return return T_RETURN; -__for return T_FOR; -__signal return T_SIGNAL; -__if return T_IF; -__else return T_ELSE; +function return T_FUNCTION; +return return T_RETURN; +for return T_FOR; +signal return T_SIGNAL; +if return T_IF; +else return T_ELSE; =\> return T_FOLLOWS; \<\< return T_SHIFT_LEFT; \>\> return T_SHIFT_RIGHT; diff --git a/lib/config/config_parser.yy b/lib/config/config_parser.yy index 09855dc19..bef34dd59 100644 --- a/lib/config/config_parser.yy +++ b/lib/config/config_parser.yy @@ -166,7 +166,6 @@ static void MakeRBinaryOp(Expression** result, Expression *left, Expression *rig %token T_IMPORT "import (T_IMPORT)" %token T_ASSIGN "assign (T_ASSIGN)" %token T_IGNORE "ignore (T_IGNORE)" -%token T_APPLY_FOR "for (T_APPLY_FOR)" %token T_FUNCTION "function (T_FUNCTION)" %token T_RETURN "return (T_RETURN)" %token T_FOR "for (T_FOR)" @@ -660,6 +659,45 @@ lterm: type { $$ = $1; } + | T_SIGNAL identifier T_SET_ADD rterm + { + $$ = new SlotExpression($2, $4, DebugInfoRange(@1, @4)); + free($2); + } + | T_FOR '(' identifier T_FOLLOWS identifier T_IN rterm ')' rterm_scope + { + DictExpression *aexpr = dynamic_cast($9); + aexpr->MakeInline(); + + $$ = new ForExpression($3, $5, $7, aexpr, DebugInfoRange(@1, @9)); + free($3); + free($5); + } + | T_FOR '(' identifier T_IN rterm ')' rterm_scope + { + DictExpression *aexpr = dynamic_cast($7); + aexpr->MakeInline(); + + $$ = new ForExpression($3, "", $5, aexpr, DebugInfoRange(@1, @7)); + free($3); + } + | T_IF '(' rterm ')' rterm_scope + { + DictExpression *atrue = dynamic_cast($5); + atrue->MakeInline(); + + $$ = new ConditionalExpression($3, atrue, NULL, DebugInfoRange(@1, @5)); + } + | T_IF '(' rterm ')' rterm_scope T_ELSE rterm_scope + { + DictExpression *atrue = dynamic_cast($5); + atrue->MakeInline(); + + DictExpression *afalse = dynamic_cast($7); + afalse->MakeInline(); + + $$ = new ConditionalExpression($3, atrue, afalse, DebugInfoRange(@1, @7)); + } | rterm { $$ = $1; @@ -825,45 +863,6 @@ rterm_without_indexer: T_STRING $$ = new FunctionExpression("", *$3, $5, aexpr, DebugInfoRange(@1, @5)); delete $3; } - | T_SIGNAL identifier T_SET_ADD rterm - { - $$ = new SlotExpression($2, $4, DebugInfoRange(@1, @4)); - free($2); - } - | T_FOR '(' identifier T_FOLLOWS identifier T_IN rterm ')' rterm_scope - { - DictExpression *aexpr = dynamic_cast($9); - aexpr->MakeInline(); - - $$ = new ForExpression($3, $5, $7, aexpr, DebugInfoRange(@1, @9)); - free($3); - free($5); - } - | T_FOR '(' identifier T_IN rterm ')' rterm_scope - { - DictExpression *aexpr = dynamic_cast($7); - aexpr->MakeInline(); - - $$ = new ForExpression($3, "", $5, aexpr, DebugInfoRange(@1, @7)); - free($3); - } - | T_IF '(' rterm ')' rterm_scope - { - DictExpression *atrue = dynamic_cast($5); - atrue->MakeInline(); - - $$ = new ConditionalExpression($3, atrue, NULL, DebugInfoRange(@1, @5)); - } - | T_IF '(' rterm ')' rterm_scope T_ELSE rterm_scope - { - DictExpression *atrue = dynamic_cast($5); - atrue->MakeInline(); - - DictExpression *afalse = dynamic_cast($7); - afalse->MakeInline(); - - $$ = new ConditionalExpression($3, atrue, afalse, DebugInfoRange(@1, @7)); - } ; target_type_specifier: /* empty */ @@ -911,7 +910,7 @@ use_specifier_item: identifier ; apply_for_specifier: /* empty */ - | T_APPLY_FOR '(' identifier T_FOLLOWS identifier T_IN rterm ')' + | T_FOR '(' identifier T_FOLLOWS identifier T_IN rterm ')' { context->m_FKVar.top() = $3; free($3); @@ -921,7 +920,7 @@ apply_for_specifier: /* empty */ context->m_FTerm.top() = $7; } - | T_APPLY_FOR '(' identifier T_IN rterm ')' + | T_FOR '(' identifier T_IN rterm ')' { context->m_FKVar.top() = $3; free($3); -- 2.49.0