Skip to content

Commit cb8abb6

Browse files
committed
#16 - Revert to original state
1 parent 79be360 commit cb8abb6

2 files changed

Lines changed: 11 additions & 38 deletions

File tree

parser/parser.h

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -670,32 +670,6 @@ static void xx_ret_let_assignment(zval *ret, char *type, zval *operator, xx_pars
670670
parser_add_int(ret, "char", state->active_char);
671671
}
672672

673-
// New helper supporting nested property access assignments where the base is an expression (e.g. this->arr->arr = 1)
674-
static void xx_ret_let_property_access_assignment(zval *ret, zval *operator, zval *left_expr, xx_parser_token *P, zval *expr, xx_scanner_state *state)
675-
{
676-
array_init(ret);
677-
678-
parser_add_str(ret, "assign-type", "property-access");
679-
if (operator) {
680-
parser_add_zval(ret, "operator", operator);
681-
}
682-
/* Store the left expression chain */
683-
parser_add_zval(ret, "left", left_expr);
684-
685-
if (P) {
686-
parser_add_str_free(ret, "property", P->token);
687-
efree(P);
688-
}
689-
690-
if (expr) {
691-
parser_add_zval(ret, "expr", expr);
692-
}
693-
694-
parser_add_str(ret, "file", state->active_file);
695-
parser_add_int(ret, "line", state->active_line);
696-
parser_add_int(ret, "char", state->active_char);
697-
}
698-
699673
static void xx_ret_if_statement(zval *ret, zval *expr, zval *statements, zval *elseif_statements, zval *else_statements, xx_scanner_state *state)
700674
{
701675
array_init(ret);

parser/zephir.lemon

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
%right BITWISE_NOT .
6666
%right PARENTHESES_CLOSE .
6767
%right SBRACKET_OPEN .
68-
%left ARROW .
68+
%right ARROW .
6969

7070
// The following text is included near the beginning of the C source
7171
// code file that implements the parser.
@@ -464,6 +464,10 @@ xx_class_definition(R) ::= xx_class_properties_definition(C) xx_class_consts_def
464464
xx_ret_class_definition(&R, &C, &M, &K, status->scanner_state);
465465
}
466466

467+
xx_class_definition(R) ::= xx_class_consts_definition(K) xx_class_properties_definition(C) xx_class_methods_definition(M) . {
468+
xx_ret_class_definition(&R, &C, &M, &K, status->scanner_state);
469+
}
470+
467471
xx_interface_definition(R) ::= xx_class_consts_definition(C) . {
468472
xx_ret_interface_definition(&R, NULL, &C, status->scanner_state);
469473
}
@@ -1397,10 +1401,6 @@ xx_for_statement(R) ::= FOR IDENTIFIER(K) COMMA IDENTIFIER(V) IN REVERSE xx_comm
13971401
xx_ret_for_statement(&R, &E, K, V, 1, &L, status->scanner_state);
13981402
}
13991403

1400-
xx_for_statement(R) ::= FOR IDENTIFIER(K) COMMA IDENTIFIER(V) IN REVERSE xx_common_expr(E) BRACKET_OPEN BRACKET_CLOSE . {
1401-
xx_ret_for_statement(&R, &E, K, V, 1, NULL, status->scanner_state);
1402-
}
1403-
14041404
xx_for_statement(R) ::= FOR PARENTHESES_OPEN IDENTIFIER(V) IN xx_common_expr(E) PARENTHESES_CLOSE BRACKET_OPEN xx_statement_list(L) BRACKET_CLOSE . {
14051405
xx_ret_for_statement(&R, &E, NULL, V, 0, &L, status->scanner_state);
14061406
}
@@ -1523,13 +1523,12 @@ xx_let_assignment(R) ::= IDENTIFIER(D) ARROW IDENTIFIER(I) SBRACKET_OPEN SBRACKE
15231523
}
15241524

15251525
/* y->x[z][] = {expr} */
1526-
xx_let_assignment(R) ::= IDENTIFIER(D) ARROW IDENTIFIER(I) xx_array_offset_list(X) SBRACKET_OPEN SBRACKET_CLOSE xx_assignment_operator(O) xx_assign_expr(E) . {
1527-
xx_ret_let_assignment(&R, "object-property-array-index-append", &O, D, I, &X, &E, status->scanner_state);
1526+
xx_let_assignment(R) ::= IDENTIFIER(D) ARROW IDENTIFIER(I) xx_array_offset_list(X) xx_assignment_operator(O) xx_assign_expr(E) . {
1527+
xx_ret_let_assignment(&R, "object-property-array-index", &O, D, I, &X, &E, status->scanner_state);
15281528
}
15291529

1530-
/* {expr}->x = {expr} (nested property access) */
1531-
xx_let_assignment(R) ::= xx_common_expr(V) ARROW IDENTIFIER(I) xx_assignment_operator(O) xx_assign_expr(E) . {
1532-
xx_ret_let_property_access_assignment(&R, &O, &V, I, &E, status->scanner_state);
1530+
xx_let_assignment(R) ::= IDENTIFIER(D) ARROW IDENTIFIER(I) xx_array_offset_list(X) SBRACKET_OPEN SBRACKET_CLOSE xx_assignment_operator(O) xx_assign_expr(E) . {
1531+
xx_ret_let_assignment(&R, "object-property-array-index-append", &O, D, I, &X, &E, status->scanner_state);
15331532
}
15341533

15351534
/* y::x = {expr} */
@@ -1995,11 +1994,11 @@ xx_common_expr(R) ::= xx_common_expr(O1) EXCLUSIVE_RANGE xx_common_expr(O2) . {
19951994
}
19961995

19971996
/* y = fetch x, z[k] */
1998-
xx_fetch_expr(R) ::= FETCH IDENTIFIER(O1) COMMA xx_common_expr(E2) . {
1997+
xx_fetch_expr(R) ::= FETCH IDENTIFIER(O1) COMMA xx_common_expr(O2) . {
19991998
{
20001999
zval identifier;
20012000
xx_ret_literal(&identifier, XX_T_IDENTIFIER, O1, status->scanner_state);
2002-
xx_ret_expr(&R, "fetch", &identifier, &E2, NULL, status->scanner_state);
2001+
xx_ret_expr(&R, "fetch", &identifier, &O2, NULL, status->scanner_state);
20032002
}
20042003
}
20052004

0 commit comments

Comments
 (0)