From 54ab4dd924a68f70646216ea02e3927921785360 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sat, 13 Dec 2014 12:18:26 +0100 Subject: [PATCH] Implement support for lambdas refs #8030 --- lib/config/config_parser.yy | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/config/config_parser.yy b/lib/config/config_parser.yy index 54ffb43cc..b9f4dab9d 100644 --- a/lib/config/config_parser.yy +++ b/lib/config/config_parser.yy @@ -222,7 +222,7 @@ static void MakeRBinaryOp(Expression** result, Expression *left, Expression *rig %right '!' '~' %left '.' '(' '[' %right ';' ',' -%right T_NEWLINE +%right T_NEWLINE T_FOLLOWS %{ int yylex(YYSTYPE *lvalp, YYLTYPE *llocp, void *scanner); @@ -869,6 +869,27 @@ rterm_without_indexer: T_STRING $$ = new FunctionExpression("", *$3, $5, aexpr, DebugInfoRange(@1, @5)); delete $3; } + | identifier T_FOLLOWS rterm + { + DictExpression *aexpr = dynamic_cast($3); + if (aexpr) + aexpr->MakeInline(); + + std::vector args; + args.push_back($1); + free($1); + + $$ = new FunctionExpression("", args, new std::map(), $3, DebugInfoRange(@1, @3)); + } + | T_BINARY_OR identifier_items T_BINARY_OR T_FOLLOWS rterm + { + DictExpression *aexpr = dynamic_cast($5); + if (aexpr) + aexpr->MakeInline(); + + $$ = new FunctionExpression("", *$2, new std::map(), $5, DebugInfoRange(@1, @5)); + delete $2; + } ; target_type_specifier: /* empty */