]> git.saurik.com Git - cycript.git/commitdiff
Remove "!super" hack: "super" is always a keyword.
authorJay Freeman (saurik) <saurik@saurik.com>
Wed, 16 Dec 2015 00:31:36 +0000 (16:31 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Wed, 16 Dec 2015 00:31:36 +0000 (16:31 -0800)
Parser.ypp.in
Scanner.lpp.in

index b8955888b20dcd6f5bda1521f678e23b79e3ab89..cd605d51a84878c0a3c79df5054b68967f18892a 100644 (file)
@@ -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 _return_ "return"
 %token _return__ "!return"
 %token _super_ "super"
-%token _super__ "!super"
 %token _switch_ "switch"
 %token _this_ "this"
 %token _throw_ "throw"
 %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"); }
     | "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"); }
     | "switch" { $$ = CYNew CYWord("switch"); }
     | "this" { $$ = CYNew CYWord("this"); }
     | "throw" { $$ = CYNew CYWord("throw"); }
@@ -1015,8 +1013,8 @@ MemberExpression
     ;
 
 SuperProperty
     ;
 
 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
     ;
 
 MetaProperty
@@ -1044,7 +1042,7 @@ CallExpression
     ;
 
 SuperCall
     ;
 
 SuperCall
-    : LexSetRegExp "!super" Arguments { $$ = CYNew CYSuperCall($3); }
+    : LexSetRegExp "super" { if (!driver.super_.top()) CYERR(@2, "invalid super"); } Arguments { $$ = CYNew CYSuperCall($4); }
     ;
 
 Arguments
     ;
 
 Arguments
@@ -2021,7 +2019,7 @@ SelectorList
 
 MessageExpression
     : "[" LexPushInOff AssignmentExpressionClassic { driver.contexts_.push_back($3); } SelectorList "]" LexPopIn { driver.contexts_.pop_back(); } { $$ = CYNew CYSendDirect($3, $5); }
 
 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_
     ;
 
 SelectorExpression_
index 2a858c1739b43d7d394343f8cdadefc06d6495d3..c775f91769ec5e84ed46b2b15434bd9bb0aa8bd0 100644 (file)
@@ -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);
 "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);
 "switch"          L /*KKK*/ F(tk::_switch_, hi::Control);
 "synchronized"    L /*FII*/ F(tk::_synchronized_, hi::Meta);
 "this"            L /*KKK*/ F(tk::_this_, hi::Constant);