X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/cac61857bcc00ddc1e354756e11b24e93b8edbf3..534fb6da44730df33f71e88b7a14253eb8212eb7:/Cycript.y diff --git a/Cycript.y b/Cycript.y index 6a304b3..f1cbcfe 100644 --- a/Cycript.y +++ b/Cycript.y @@ -107,8 +107,8 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %defines -%glr-parser -%expect 1 +//%glr-parser +//%expect 1 %debug @@ -178,6 +178,11 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %token AtSelector "@selector" %token AtEnd "@end" +%token False "false" +%token Null "null" +%token True "true" + +// ES3/ES5/WIE/JSC Reserved %token Break "break" %token Case "case" %token Catch "catch" @@ -186,7 +191,6 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %token Delete "delete" %token Do "do" %token Else "else" -%token False "false" %token Finally "finally" %token For "for" %token Function "function" @@ -194,12 +198,10 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %token In "in" %token InstanceOf "instanceof" %token New "new" -%token Null "null" %token Return "return" %token Switch "switch" %token This "this" %token Throw "throw" -%token True "true" %token Try "try" %token TypeOf "typeof" %token Var "var" @@ -207,40 +209,53 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %token While "while" %token With "with" -%token Abstract "abstract" -%token Boolean "boolean" -%token Byte "byte" -%token Char "char" -%token Class "class" -%token Const "const" +// ES3/IE6 Future, ES5/JSC Reserved %token Debugger "debugger" -%token Double "double" + +// ES3/ES5/IE6 Future, JSC Reserved +%token Const "const" + +// ES3/ES5/IE6/JSC Future +%token Class "class" %token Enum "enum" %token Export "export" %token Extends "extends" -%token Final "final" -%token Float "float" -%token Goto "goto" -%token Implements "implements" %token Import "import" -%token Int "int" -%token Interface "interface" -%token Long "long" -%token Native "native" -%token Package "package" -%token Private "private" -%token Protected "protected" -%token Public "public" -%token Short "short" -%token Static "static" %token Super "super" -%token Synchronized "synchronized" -%token Throws "throws" -%token Transient "transient" -%token Volatile "volatile" -%token Each "each" +// ES3 Future, ES5 Strict Future +%token Implements "implements" +%token Interface "interface" +%token Package "package" +%token Private "private" +%token Protected "protected" +%token Public "public" +%token Static "static" + +// ES3 Future +%token Abstract "abstract" +%token Boolean "boolean" +%token Byte "byte" +%token Char "char" +%token Double "double" +%token Final "final" +%token Float "float" +%token Goto "goto" +%token Int "int" +%token Long "long" +%token Native "native" +%token Short "short" +%token Synchronized "synchronized" +%token Throws "throws" +%token Transient "transient" +%token Volatile "volatile" + +// ES5 Strict %token Let "let" +%token Yield "yield" + +// Woah?! +%token Each "each" %token Identifier_ %token NumericLiteral @@ -335,7 +350,7 @@ int cylex(YYSTYPE *lvalp, cy::location *llocp, void *scanner); %type LabelledStatement %type LeftHandSideExpression %type LeftHandSideExpressionNoBF -%type LetStatement +//%type LetStatement %type Literal %type LogicalANDExpression %type LogicalANDExpressionNoBF @@ -459,13 +474,9 @@ WordOpt Word : Identifier { $$ = $1; } - | "abstract" { $$ = $1; } - | "boolean" { $$ = $1; } | "break" NewLineOpt { $$ = $1; } - | "byte" { $$ = $1; } | "case" { $$ = $1; } | "catch" { $$ = $1; } - | "char" { $$ = $1; } | "class" { $$ = $1; } | "const" { $$ = $1; } | "continue" NewLineOpt { $$ = $1; } @@ -473,57 +484,66 @@ Word | "default" { $$ = $1; } | "delete" { $$ = $1; } | "do" { $$ = $1; } - | "double" { $$ = $1; } | "else" { $$ = $1; } | "enum" { $$ = $1; } | "export" { $$ = $1; } | "extends" { $$ = $1; } | "false" { $$ = $1; } - | "final" { $$ = $1; } | "finally" { $$ = $1; } - | "float" { $$ = $1; } | "for" { $$ = $1; } | "function" { $$ = $1; } - | "goto" { $$ = $1; } | "if" { $$ = $1; } - | "implements" { $$ = $1; } | "import" { $$ = $1; } /* XXX: | "in" { $$ = $1; } */ /* XXX: | "instanceof" { $$ = $1; } */ - | "int" { $$ = $1; } - | "interface" { $$ = $1; } - | "long" { $$ = $1; } - | "native" { $$ = $1; } | "new" { $$ = $1; } | "null" { $$ = $1; } - | "package" { $$ = $1; } - | "private" { $$ = $1; } - | "protected" { $$ = $1; } - | "public" { $$ = $1; } | "return" NewLineOpt { $$ = $1; } - | "short" { $$ = $1; } - | "static" { $$ = $1; } | "super" { $$ = $1; } | "switch" { $$ = $1; } - | "synchronized" { $$ = $1; } | "this" { $$ = $1; } | "throw" NewLineOpt { $$ = $1; } - | "throws" { $$ = $1; } - | "transient" { $$ = $1; } | "true" { $$ = $1; } | "try" { $$ = $1; } | "typeof" { $$ = $1; } | "var" { $$ = $1; } | "void" { $$ = $1; } - | "volatile" { $$ = $1; } | "while" { $$ = $1; } | "with" { $$ = $1; } ; Identifier : Identifier_ { $$ = $1; } - | "each" { $$ = $1; } + + | "implements" { $$ = $1; } + | "interface" { $$ = $1; } + | "package" { $$ = $1; } + | "private" { $$ = $1; } + | "protected" { $$ = $1; } + | "public" { $$ = $1; } + | "static" { $$ = $1; } + + | "abstract" { $$ = $1; } + | "boolean" { $$ = $1; } + | "byte" { $$ = $1; } + | "char" { $$ = $1; } + | "double" { $$ = $1; } + | "final" { $$ = $1; } + | "float" { $$ = $1; } + | "goto" { $$ = $1; } + | "int" { $$ = $1; } + | "long" { $$ = $1; } + | "native" { $$ = $1; } + | "short" { $$ = $1; } + | "synchronized" { $$ = $1; } + | "throws" { $$ = $1; } + | "transient" { $$ = $1; } + | "volatile" { $$ = $1; } + | "let" { $$ = $1; } + | "yield" { $$ = $1; } + + | "each" { $$ = $1; } ; IdentifierOpt @@ -1384,7 +1404,7 @@ ForInStatement : "for" "each" "(" ForInStatementInitialiser "in" Expression ")" Statement { $$ = new(driver.pool_) CYForEachIn($4, $6, $8); } ; /* }}} */ -/* JavaScript 1.7: Let Statements {{{ */ +/* JavaScript 1.7: Let Statements {{{ *//* LetStatement : "let" "(" VariableDeclarationList ")" Block_ { $$ = new(driver.pool_) CYLet($3, $5); } ; @@ -1392,6 +1412,6 @@ LetStatement Statement : LetStatement ; -/* }}} */ +*//* }}} */ %%