From: Jay Freeman (saurik) Date: Wed, 13 Jun 2012 00:17:42 +0000 (-0700) Subject: Allow usage of C++11 auto keyword. X-Git-Tag: v0.9.458~8 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/a87d7060233fff3ecbbc29d0e7e978f3587684ab Allow usage of C++11 auto keyword. --- diff --git a/Cycript.l.in b/Cycript.l.in index 1923a34..f311c69 100644 --- a/Cycript.l.in +++ b/Cycript.l.in @@ -258,6 +258,7 @@ XMLName {XMLNameStart}{XMLNamePart}* "null" L C I(null, Null(), tk::Null); "true" L C I(true, True(), tk::True); +"auto" L C I(word, Word("auto"), tk::Auto); "break" L R I(word, Word("break"), tk::Break); "case" L C I(word, Word("case"), tk::Case); "catch" L C I(word, Word("catch"), tk::Catch); diff --git a/Cycript.yy.in b/Cycript.yy.in index cd63aec..aa5f535 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" @@ -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; } @@ -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; } ; /* }}} */ @@ -1521,6 +1527,11 @@ MemberAccess | "->" AutoComplete { driver.mode_ = CYDriver::AutoIndirect; YYACCEPT; } ; /* }}} */ +/* Cycript (C): auto Compatibility {{{ */ +Var_ + : "auto" + ; +/* }}} */ @end /* YUI: Documentation Comments {{{ */