File tree Expand file tree Collapse file tree 6 files changed +610
-558
lines changed
test/code/parser/errorHandling Expand file tree Collapse file tree 6 files changed +610
-558
lines changed Original file line number Diff line number Diff line change @@ -915,6 +915,7 @@ object_property:
915
915
T_STRING { $$ = $1 ; }
916
916
| ' {' expr ' }' { $$ = $2 ; }
917
917
| variable_without_objects { $$ = $1 ; }
918
+ | error { $$ = Expr\Error[]; }
918
919
;
919
920
920
921
list_expr :
Original file line number Diff line number Diff line change @@ -793,6 +793,7 @@ property_name:
793
793
T_STRING { $$ = $1 ; }
794
794
| ' {' expr ' }' { $$ = $2 ; }
795
795
| simple_variable { $$ = Expr\Variable[$1 ]; }
796
+ | error { $$ = Expr\Error[]; }
796
797
;
797
798
798
799
list_expr :
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace PhpParser \Node \Expr ;
4
+
5
+ use PhpParser \Node \Expr ;
6
+
7
+ /**
8
+ * Error node used during parsing with error recovery.
9
+ *
10
+ * An error node may be placed at a position where an expression is required, but an error occurred.
11
+ * Error nodes will not be present if the parser is run in throwOnError mode (the default).
12
+ */
13
+ class Error extends Expr
14
+ {
15
+ /**
16
+ * Constructs an error node.
17
+ *
18
+ * @param array $attributes Additional attributes
19
+ */
20
+ public function __construct (array $ attributes = array ()) {
21
+ parent ::__construct ($ attributes );
22
+ }
23
+
24
+ public function getSubNodeNames () {
25
+ return array ();
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments