]> git.saurik.com Git - cycript.git/blobdiff - Cycript.y
Started working on making the build environment more portable.
[cycript.git] / Cycript.y
index 14acf8dd00212d94363904447fb0210467c05d33..7fdc17245fea856fea26cefd64074652cb0ebc2d 100644 (file)
--- a/Cycript.y
+++ b/Cycript.y
@@ -80,6 +80,7 @@ typedef struct {
         CYMessageParameter *messageParameter_;
         CYNull *null_;
         CYNumber *number_;
+        CYProgram *program_;
         CYProperty *property_;
         CYPropertyName *propertyName_;
         CYSelectorPart *selector_;
@@ -757,7 +758,7 @@ UnaryExpression_
     | "\n++" UnaryExpression { $$ = new(driver.pool_) CYPreIncrement($2); }
     | "--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
     | "\n--" UnaryExpression { $$ = new(driver.pool_) CYPreDecrement($2); }
-    | "+" UnaryExpression { $$ = $2; }
+    | "+" UnaryExpression { $$ = new(driver.pool_) CYAffirm($2); }
     | "-" UnaryExpression { $$ = new(driver.pool_) CYNegate($2); }
     | "~" UnaryExpression { $$ = new(driver.pool_) CYBitwiseNot($2); }
     | "!" UnaryExpression { $$ = new(driver.pool_) CYLogicalNot($2); }
@@ -1244,7 +1245,7 @@ DefaultClause
 /* }}} */
 /* 12.12 Labelled Statements {{{ */
 LabelledStatement
-    : Identifier ":" Statement { $3->AddLabel($1); $$ = $3; }
+    : Identifier ":" Statement { $$ = new(driver.pool_) CYLabel($1, $3); }
     ;
 /* }}} */
 /* 12.13 The throw Statement {{{ */
@@ -1293,7 +1294,7 @@ FunctionBody
 /* }}} */
 /* 14 Program {{{ */
 Program
-    : SourceElements { driver.program_ = $1; }
+    : SourceElements { driver.program_ = new(driver.pool_) CYProgram($1); }
     ;
 
 SourceElements
@@ -1438,7 +1439,8 @@ UnaryExpression_
     ;
 
 MemberAccess
-    : "->" Identifier { $$ = new(driver.pool_) CYIndirectMember(NULL, new(driver.pool_) CYString($2)); }
+    : "->" "[" Expression "]" { $$ = new(driver.pool_) CYIndirectMember(NULL, $3); }
+    | "->" Identifier { $$ = new(driver.pool_) CYIndirectMember(NULL, new(driver.pool_) CYString($2)); }
     ;
 /* }}} */
 /* ECMAScript5: Object Literal Trailing Comma {{{ */