X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/a0be43fc10f28843e7a477d0c5354ea5e82b3140..975cde38d8631f5e80bb54b3fbd87ce7d4aa2766:/Cycript.yy.in diff --git a/Cycript.yy.in b/Cycript.yy.in index cd63aec..465b32b 100644 --- a/Cycript.yy.in +++ b/Cycript.yy.in @@ -234,6 +234,7 @@ int cylex(YYSTYPE *, cy::location *, void *); %token True "true" // ES3/ES5/WIE/JSC Reserved +%token Auto "auto" %token Break "break" %token Case "case" %token Catch "catch" @@ -531,15 +532,15 @@ LexSetRegExp ; LexNoBrace - : { if (yychar == yyempty_) driver.nobrace_ = true; else if (yychar == token::OpenBrace || yychar == token::OpenBrace_) yychar = token::OpenBrace__; } + : { if (yychar == yyempty_) driver.no_.OpenBrace = true; else if (yychar == token::OpenBrace || yychar == token::OpenBrace_) yychar = token::OpenBrace__; } ; LexNoFunction - : { if (yychar == token::Function) yychar = token::Function_; } + : { if (yychar == yyempty_) driver.no_.Function = true; else if (yychar == token::Function) yychar = token::Function_; } ; LexNoAtImplementation - : { if (yychar == token::AtImplementation) yychar = token::AtImplementation_; } + : { if (yychar == yyempty_) driver.no_.AtImplementation = true; else if (yychar == token::AtImplementation) yychar = token::AtImplementation_; } ; LexSetStatement @@ -551,6 +552,10 @@ BRACE : "{" | "\n{" ; + +Var_ + : "var" + ; /* }}} */ /* 7.6 Identifier Names and Identifiers {{{ */ @@ -565,6 +570,7 @@ NewLineOpt Word : Identifier { $$ = $1; } + | "auto" { $$ = $1; } | "break" NewLineOpt { $$ = $1; } | "case" { $$ = $1; } | "catch" { $$ = $1; } @@ -1048,7 +1054,7 @@ StatementList StatementListOpt : StatementList { $$ = $1; } - | LexSetRegExp { $$ = NULL; } + | LexSetStatement LexSetRegExp { $$ = NULL; } ; StatementListItem @@ -1080,7 +1086,7 @@ LetOrConst /* }}} */ /* 12.2.2 Variable Statement {{{ */ VariableStatement - : "var" VariableDeclarationList Terminator { $$ = CYNew CYVar($2); } + : Var_ VariableDeclarationList Terminator { $$ = CYNew CYVar($2); } ; VariableDeclarationList_ @@ -1156,7 +1162,7 @@ IterationStatement ForStatementInitialiser : ExpressionOpt { $$ = $1; } - | LexSetRegExp "var" VariableDeclarationList { $$ = CYNew CYForDeclarations($3); } + | LexSetRegExp Var_ VariableDeclarationList { $$ = CYNew CYForDeclarations($3); } ; /* }}} */ /* 12.6.4 The for-in and for-of Statements {{{ */ @@ -1167,7 +1173,7 @@ IterationStatement ForInStatementInitialiser : LeftHandSideExpression { $$ = $1; } - | LexSetRegExp "var" VariableDeclaration { $$ = $3; } + | LexSetRegExp Var_ VariableDeclaration { $$ = $3; } ; /* }}} */ @@ -1312,7 +1318,7 @@ ProgramBody ProgramBodyOpt : ProgramBody { $$ = $1; } - | { $$ = NULL; } + | LexSetStatement LexSetRegExp { $$ = NULL; } ; /* }}} */ @@ -1485,7 +1491,7 @@ ImportPath ; StatementListItem - : "@import" ImportPath { $$ = CYNew CYImport(); } + : LexSetStatement LexSetRegExp "@import" ImportPath { $$ = CYNew CYImport(); } ; /* }}} */ /* Cycript (Objective-C): Boxed Expressions {{{ */ @@ -1521,6 +1527,11 @@ MemberAccess | "->" AutoComplete { driver.mode_ = CYDriver::AutoIndirect; YYACCEPT; } ; /* }}} */ +/* Cycript (C): auto Compatibility {{{ */ +Var_ + : "auto" + ; +/* }}} */ @end /* YUI: Documentation Comments {{{ */