From 5ccfc5866447d36a9b5a05f7f3b103f53137ac72 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Thu, 7 Jun 2012 13:44:39 -0700 Subject: [PATCH] MemberAccess is allowed Word, not just Identifier. --- Cycript.yy.in | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Cycript.yy.in b/Cycript.yy.in index be279e5..ec7c221 100644 --- a/Cycript.yy.in +++ b/Cycript.yy.in @@ -543,18 +543,13 @@ StrictSemi : { driver.Warning(yylloc, "warning, automatic semi-colon insertion required"); } ; -Terminator_ - : ";" - | "\n" StrictSemi - ; - Terminator - : Terminator_ + : ";" | error { if (yychar != yyeof_ && yychar != token::CloseBrace && !yylval.newline_) YYABORT; else { yyerrok; driver.errors_.pop_back(); } } StrictSemi ; TerminatorOpt - : Terminator_ + : ";" | error { yyerrok; driver.errors_.pop_back(); } StrictSemi ; @@ -772,7 +767,7 @@ PropertyName /* 11.2 Left-Hand-Side Expressions {{{ */ MemberAccess : "[" LexPushInOff Expression LexPopIn "]" { $$ = CYNew CYDirectMember(NULL, $3); } - | "." Identifier { $$ = CYNew CYDirectMember(NULL, CYNew CYString($2)); } + | "." IdentifierName { $$ = CYNew CYDirectMember(NULL, CYNew CYString($2)); } | "." AutoComplete { driver.mode_ = CYDriver::AutoDirect; YYACCEPT; } ; @@ -1140,17 +1135,20 @@ ForInStatementInitialiser /* 12.7 The continue Statement {{{ */ ContinueStatement - : "continue" IdentifierOpt Terminator { $$ = CYNew CYContinue($2); } + : "continue" "\n" StrictSemi { $$ = CYNew CYContinue(NULL); } + | "continue" IdentifierOpt Terminator { $$ = CYNew CYContinue($2); } ; /* }}} */ /* 12.8 The break Statement {{{ */ BreakStatement - : "break" IdentifierOpt Terminator { $$ = CYNew CYBreak($2); } + : "break" "\n" StrictSemi { $$ = CYNew CYBreak(NULL); } + | "break" IdentifierOpt Terminator { $$ = CYNew CYBreak($2); } ; /* }}} */ /* 12.9 The return Statement {{{ */ ReturnStatement - : "return" ExpressionOpt Terminator { $$ = CYNew CYReturn($2); } + : "return" "\n" StrictSemi { $$ = CYNew CYReturn(NULL); } + | "return" ExpressionOpt Terminator { $$ = CYNew CYReturn($2); } ; /* }}} */ /* 12.10 The with Statement {{{ */ @@ -1189,7 +1187,8 @@ LabelledStatement /* }}} */ /* 12.13 The throw Statement {{{ */ ThrowStatement - : "throw" Expression Terminator { $$ = CYNew cy::Syntax::Throw($2); } + : "throw" "\n" StrictSemi { YYABORT; } + | "throw" Expression Terminator { $$ = CYNew cy::Syntax::Throw($2); } ; /* }}} */ /* 12.14 The try Statement {{{ */ @@ -1469,7 +1468,7 @@ UnaryExpression_ MemberAccess : "->" "[" Expression "]" { $$ = CYNew CYIndirectMember(NULL, $3); } - | "->" Identifier { $$ = CYNew CYIndirectMember(NULL, CYNew CYString($2)); } + | "->" IdentifierName { $$ = CYNew CYIndirectMember(NULL, CYNew CYString($2)); } | "->" AutoComplete { driver.mode_ = CYDriver::AutoIndirect; YYACCEPT; } ; /* }}} */ -- 2.45.2