From d3941d9fccfddc1359ac45fa2093d2b7fe3a94af Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Tue, 15 Dec 2015 16:31:36 -0800 Subject: [PATCH] Remove "!super" hack: "super" is always a keyword. --- Parser.ypp.in | 10 ++++------ Scanner.lpp.in | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Parser.ypp.in b/Parser.ypp.in index b895588..cd605d5 100644 --- a/Parser.ypp.in +++ b/Parser.ypp.in @@ -329,7 +329,6 @@ _finline int yylex(cy::parser::semantic_type *semantic, CYLocation *location, CY %token _return_ "return" %token _return__ "!return" %token _super_ "super" -%token _super__ "!super" %token _switch_ "switch" %token _this_ "this" %token _throw_ "throw" @@ -745,7 +744,6 @@ Word | "return" { $$ = CYNew CYWord("return"); } | "!return" { $$ = CYNew CYWord("return"); } | "super" { $$ = CYNew CYWord("super"); } - | "!super" { $$ = CYNew CYWord("super"); } | "switch" { $$ = CYNew CYWord("switch"); } | "this" { $$ = CYNew CYWord("this"); } | "throw" { $$ = CYNew CYWord("throw"); } @@ -1015,8 +1013,8 @@ MemberExpression ; SuperProperty - : LexSetRegExp "!super" "[" Expression "]" { $$ = CYNew CYSuperAccess($4); } - | LexSetRegExp "!super" "." IdentifierName { $$ = CYNew CYSuperAccess(CYNew CYString($4)); } + : LexSetRegExp "super" { if (!driver.super_.top()) CYERR(@2, "invalid super"); } "[" Expression "]" { $$ = CYNew CYSuperAccess($5); } + | LexSetRegExp "super" { if (!driver.super_.top()) CYERR(@2, "invalid super"); } "." IdentifierName { $$ = CYNew CYSuperAccess(CYNew CYString($5)); } ; MetaProperty @@ -1044,7 +1042,7 @@ CallExpression ; SuperCall - : LexSetRegExp "!super" Arguments { $$ = CYNew CYSuperCall($3); } + : LexSetRegExp "super" { if (!driver.super_.top()) CYERR(@2, "invalid super"); } Arguments { $$ = CYNew CYSuperCall($4); } ; Arguments @@ -2021,7 +2019,7 @@ SelectorList MessageExpression : "[" LexPushInOff AssignmentExpressionClassic { driver.contexts_.push_back($3); } SelectorList "]" LexPopIn { driver.contexts_.pop_back(); } { $$ = CYNew CYSendDirect($3, $5); } - | "[" LexPushInOff LexSetRegExp "!super" { driver.context_ = NULL; } SelectorList "]" LexPopIn { $$ = CYNew CYSendSuper($6); } + | "[" LexPushInOff LexSetRegExp "super" { driver.context_ = NULL; } SelectorList "]" LexPopIn { $$ = CYNew CYSendSuper($6); } ; SelectorExpression_ diff --git a/Scanner.lpp.in b/Scanner.lpp.in index 2a858c1..c775f91 100644 --- a/Scanner.lpp.in +++ b/Scanner.lpp.in @@ -505,7 +505,7 @@ XMLName {XMLNameStart}{XMLNamePart}* "set" L /*III*/ F(tk::_set_, hi::Meta); "short" L /*FII*/ F(tk::_short_, hi::Type); "static" L /*FS?*/ F(tk::_static_, hi::Meta); -"super" L /*FFK*/ F(yyextra->super_.top() ? tk::_super__ : tk::_super_, hi::Constant); +"super" L /*FFK*/ F(tk::_super_, hi::Constant); "switch" L /*KKK*/ F(tk::_switch_, hi::Control); "synchronized" L /*FII*/ F(tk::_synchronized_, hi::Meta); "this" L /*KKK*/ F(tk::_this_, hi::Constant); -- 2.47.2