token = tk::_yield__;
break;
- case tk::EqualRight:
- if (driver.newline_ == CYDriver::NewLineLast)
- token = tk::EqualRight_;
- break;
-
case tk::HyphenHyphen:
if (driver.newline_ == CYDriver::NewLineLast)
token = tk::HyphenHyphen_;
goto lex;
break;
- case tk::OpenBrace:
- if (driver.newline_ == CYDriver::NewLineLast)
- token = tk::OpenBrace_;
- break;
-
case tk::PlusPlus:
if (driver.newline_ == CYDriver::NewLineLast)
token = tk::PlusPlus_;
yyla.type = yytranslate_(token::to); \
} while (false)
+#define CYLIN(from) do { \
+ CYLEX(); \
+ if (yyla.type == yytranslate_(token::from) && driver.newline_ == CYDriver::NewLineLast) \
+ yyla.type = yytranslate_(token::from ## _); \
+} while (false)
+
#define CYERR(location, message) do { \
error(location, message); \
YYABORT; \
;
UnaryExpression
- : %prec "" PostfixExpression { $$ = $1; }
+ : %prec "" PostfixExpression LexOpenBrace { $$ = $1; }
| LexSetRegExp UnaryExpression_ { $$ = $2; }
;
/* }}} */
;
/* }}} */
/* 14.2 Arrow Function Definitions {{{ */
+LexEqualRight
+ : { CYLIN(EqualRight); }
+ ;
+
ArrowFunction
- : LexSetRegExp ArrowParameters "=>" LexNoBrace ConciseBody { $$ = CYNew CYFatArrow($2, $5); }
+ : LexSetRegExp ArrowParameters LexEqualRight "=>" LexNoBrace ConciseBody { $$ = CYNew CYFatArrow($2, $6); }
;
ArrowParameters
| LexSetRegExp { $$ = NULL; }
;
+LexOpenBrace
+ : { CYLIN(OpenBrace); }
+ ;
+
RubyProcExpression
: "{" RubyProcParametersOpt StatementListOpt "}" { $$ = CYNew CYRubyProc($2, $3); }
;
;
PostfixExpression
- : PostfixExpression RubyProcExpression { $$ = CYNew CYRubyBlock($1, $2); }
+ : PostfixExpression LexOpenBrace RubyProcExpression { $$ = CYNew CYRubyBlock($1, $3); }
;
/* }}} */