Use Identifier for property names as well

This commit is contained in:
Nikita Popov 2016-12-23 00:25:45 +01:00
parent f46c909b5a
commit d32d937d47
5 changed files with 1334 additions and 1293 deletions

View File

@ -516,9 +516,13 @@ property_declaration_list:
| property_declaration_list ',' property_declaration { push($1, $3); }
;
property_decl_name:
T_VARIABLE { $$ = maybeMakeIdent(parseVar($1)); }
;
property_declaration:
T_VARIABLE { $$ = Stmt\PropertyProperty[parseVar($1), null]; }
| T_VARIABLE '=' static_scalar { $$ = Stmt\PropertyProperty[parseVar($1), $3]; }
property_decl_name { $$ = Stmt\PropertyProperty[$1, null]; }
| property_decl_name '=' static_scalar { $$ = Stmt\PropertyProperty[$1, $3]; }
;
expr_list:

View File

@ -521,9 +521,13 @@ property_declaration_list:
| property_declaration_list ',' property_declaration { push($1, $3); }
;
property_decl_name:
T_VARIABLE { $$ = maybeMakeIdent(parseVar($1)); }
;
property_declaration:
T_VARIABLE { $$ = Stmt\PropertyProperty[parseVar($1), null]; }
| T_VARIABLE '=' expr { $$ = Stmt\PropertyProperty[parseVar($1), $3]; }
property_decl_name { $$ = Stmt\PropertyProperty[$1, null]; }
| property_decl_name '=' expr { $$ = Stmt\PropertyProperty[$1, $3]; }
;
expr_list:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -12,6 +12,8 @@ class Foo {
A::b as c;
d as public e;
}
public $foo, $bar = 42;
}
interface Bar {}
trait Baz {}
@ -127,6 +129,25 @@ array(
)
)
)
3: Stmt_Property(
flags: MODIFIER_PUBLIC (1)
props: array(
0: Stmt_PropertyProperty(
name: Identifier(
name: foo
)
default: null
)
1: Stmt_PropertyProperty(
name: Identifier(
name: bar
)
default: Scalar_LNumber(
value: 42
)
)
)
)
)
)
2: Stmt_Interface(