File tree Expand file tree Collapse file tree 3 files changed +131
-0
lines changed Expand file tree Collapse file tree 3 files changed +131
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ const valid_after_heredoc_73 = valid_after_heredoc.concat([
16
16
"/" ,
17
17
"=" ,
18
18
"!" ,
19
+ "." ,
19
20
] ) ;
20
21
21
22
module . exports = {
Original file line number Diff line number Diff line change 27
27
}
28
28
` ;
29
29
30
+ exports [` nowdoc Flexible nowdoc syntax: concatenation right after nowdoc 1` ] = `
31
+ Program {
32
+ " children" : [
33
+ Echo {
34
+ " expressions" : [
35
+ Bin {
36
+ " kind" : " bin" ,
37
+ " left" : Encapsed {
38
+ " kind" : " encapsed" ,
39
+ " label" : " END" ,
40
+ " raw" : " <<<END
41
+
42
+ END " ,
43
+ " type" : " heredoc" ,
44
+ " value" : [
45
+ EncapsedPart {
46
+ " curly" : false ,
47
+ " expression" : String {
48
+ " isDoubleQuote" : false ,
49
+ " kind" : " string" ,
50
+ " raw" : "
51
+ " ,
52
+ " unicode" : false ,
53
+ " value" : " " ,
54
+ },
55
+ " kind" : " encapsedpart" ,
56
+ " syntax" : null ,
57
+ },
58
+ ],
59
+ },
60
+ " right" : String {
61
+ " isDoubleQuote" : true ,
62
+ " kind" : " string" ,
63
+ " raw" : " " " " ,
64
+ " unicode" : false ,
65
+ " value" : " " ,
66
+ },
67
+ " type" : " ." ,
68
+ },
69
+ ],
70
+ " kind" : " echo" ,
71
+ " shortForm" : false ,
72
+ },
73
+ ],
74
+ " errors" : [],
75
+ " kind" : " program" ,
76
+ }
77
+ ` ;
78
+
79
+ exports [` nowdoc Flexible nowdoc syntax: equals right after nowdoc 1` ] = `
80
+ Program {
81
+ " children" : [
82
+ Echo {
83
+ " expressions" : [
84
+ Bin {
85
+ " kind" : " bin" ,
86
+ " left" : Encapsed {
87
+ " kind" : " encapsed" ,
88
+ " label" : " END" ,
89
+ " raw" : " <<<END
90
+
91
+ END " ,
92
+ " type" : " heredoc" ,
93
+ " value" : [
94
+ EncapsedPart {
95
+ " curly" : false ,
96
+ " expression" : String {
97
+ " isDoubleQuote" : false ,
98
+ " kind" : " string" ,
99
+ " raw" : "
100
+ " ,
101
+ " unicode" : false ,
102
+ " value" : " " ,
103
+ },
104
+ " kind" : " encapsedpart" ,
105
+ " syntax" : null ,
106
+ },
107
+ ],
108
+ },
109
+ " right" : String {
110
+ " isDoubleQuote" : true ,
111
+ " kind" : " string" ,
112
+ " raw" : " " " " ,
113
+ " unicode" : false ,
114
+ " value" : " " ,
115
+ },
116
+ " type" : " ==" ,
117
+ },
118
+ ],
119
+ " kind" : " echo" ,
120
+ " shortForm" : false ,
121
+ },
122
+ ],
123
+ " errors" : [],
124
+ " kind" : " program" ,
125
+ }
126
+ ` ;
127
+
30
128
exports [` nowdoc Flexible nowdoc syntax: with variables 1` ] = `
31
129
Program {
32
130
" children" : [
Original file line number Diff line number Diff line change @@ -120,6 +120,38 @@ TEST;
120
120
) . toMatchSnapshot ( ) ;
121
121
} ) ;
122
122
123
+ it ( "Flexible nowdoc syntax: errors in PHP 7.2" , function ( ) {
124
+ expect ( ( ) =>
125
+ parser . parseEval (
126
+ `
127
+ echo <<<END
128
+
129
+ END."";` ,
130
+ { parser : { version : "7.2" } } ,
131
+ ) ,
132
+ ) . toThrow ( ) ;
133
+ } ) ;
134
+
135
+ it ( "Flexible nowdoc syntax: concatenation right after nowdoc" , function ( ) {
136
+ expect (
137
+ parser . parseEval ( `
138
+ echo <<<END
139
+
140
+ END."";
141
+ ` ) ,
142
+ ) . toMatchSnapshot ( ) ;
143
+ } ) ;
144
+
145
+ it ( "Flexible nowdoc syntax: equals right after nowdoc" , function ( ) {
146
+ expect (
147
+ parser . parseEval ( `
148
+ echo <<<END
149
+
150
+ END=="";
151
+ ` ) ,
152
+ ) . toMatchSnapshot ( ) ;
153
+ } ) ;
154
+
123
155
it ( "Flexible nowdoc syntax: 4 spaces of indentation" , function ( ) {
124
156
expect (
125
157
parser . parseEval ( `
You can’t perform that action at this time.
0 commit comments