Commits

Anonymous committed b1ee94a

Unified assexpr and target and named the conglomerate target which is less offensive :)

  • Participants
  • Parent commits 84a51f0

Comments (0)

Files changed (1)

File arana/grammar.y

 %type small_stmts  { ArStmtSeq * }
 %type small_stmt   { ArStmtNode * }
 %type expr         { ArExprNode * }
-%type assexpr      { ArExprNode * }
 %type interp_items { ArExprSeq * }
 %type interp_item  { ArExprNode * }
 %type exprlist     { ArExprSeq * }
 
 statement(A) ::= IF expr(B) suite(C) ELSE suite(D). { A = AR_AST(If, B, C, D); }
 statement(A) ::= IF expr(B) suite(C).            { A = AR_AST(If, B, C, NULL); }
-statement(A) ::= FOR assexpr(B) IN expr(C) suite(D).
+statement(A) ::= FOR target(B) IN expr(C) suite(D).
 						   { A = AR_AST(For, B, C, D); }
 //statement(A) ::= DEF NAME(B) LPAREN arglist(C) RPAREN suite(D).
 //                               { A = AR_AST(def_stmt, AR_AS_CHARP(B), C, D); }
 small_stmt(A) ::= exprlist(B) COMMA.
                         { A = AR_AST(ExprStmt, AR_AST(Tuple, B, AR_CTX_Load)); }
 
-// assignment expressions
-assexpr(A) ::= NAME(B).      { A = AR_AST(Name, AR_AS_CHARP(B), AR_CTX_Store); }
-assexpr(A) ::= expr(B) DOT NAME(C).
-                 { A = AR_AST(Attribute, B, AR_AST(Literal, C), AR_CTX_Store); }
-assexpr(A) ::= expr(B) DOT LBRACKET expr(C) RBRACKET.
-                                  { A = AR_AST(Attribute, B, C, AR_CTX_Store); }
-assexpr(A) ::= LPAREN RPAREN.         { A = AR_AST(Tuple, NULL, AR_CTX_Store); }
-assexpr(A) ::= LPAREN exprlist(B) RPAREN.
-                                     { AR_AST_MAYBE_TUPLE(A, B, AR_CTX_Store); }
-assexpr(A) ::= LPAREN exprlist(B) COMMA RPAREN.
-                                         { A = AR_AST(Tuple, B, AR_CTX_Store); }
-
 // simple expressions (literals and names)
 expr(A) ::= CONST(B).                                { A = AR_AST(Literal, B); }
 expr(A) ::= INTERP_START INTERP_END.     { A = AR_AST(Literal, AR_STRING("")); }
                                   { A = AR_AST(Attribute, B, C, AR_CTX_Store); }
 target(A) ::= expr(B) LBRACKET expr(C) RBRACKET.
                                   { A = AR_AST(Subscript, B, C, AR_CTX_Store); }
+target(A) ::= LPAREN RPAREN.          { A = AR_AST(Tuple, NULL, AR_CTX_Store); }
+target(A) ::= LPAREN exprlist(B) RPAREN.
+                                     { AR_AST_MAYBE_TUPLE(A, B, AR_CTX_Store); }
+target(A) ::= LPAREN exprlist(B) COMMA RPAREN.
+                                         { A = AR_AST(Tuple, B, AR_CTX_Store); }