File tree 8 files changed +61658
-61690
lines changed
8 files changed +61658
-61690
lines changed Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ module.exports = function defineGrammar(dialect) {
148
148
149
149
text : _ => repeat1 ( choice (
150
150
token ( prec ( - 1 , / < / ) ) ,
151
- / [ ^ \s < ] [ ^ < ] * / ,
151
+ token ( prec ( 1 , / [ ^ \s < ] [ ^ < ] * / ) ) ,
152
152
) ) ,
153
153
154
154
_statement : $ => choice (
@@ -1553,7 +1553,7 @@ module.exports = function defineGrammar(dialect) {
1553
1553
keyword ( 'static' ) ,
1554
1554
) ,
1555
1555
1556
- comment : _ => token ( prec ( - 1 , choice (
1556
+ comment : _ => token ( choice (
1557
1557
seq (
1558
1558
choice ( '//' , / # [ ^ ? \[ ? \r ? \n ] / ) ,
1559
1559
repeat ( / [ ^ ? \r ? \n ] | \? [ ^ > \r \n ] / ) ,
@@ -1565,7 +1565,7 @@ module.exports = function defineGrammar(dialect) {
1565
1565
/ [ ^ * ] * \* + ( [ ^ / * ] [ ^ * ] * \* + ) * / ,
1566
1566
'/' ,
1567
1567
) ,
1568
- ) ) ) ,
1568
+ ) ) ,
1569
1569
1570
1570
_semicolon : $ => choice ( $ . _automatic_semicolon , ';' ) ,
1571
1571
} ,
Original file line number Diff line number Diff line change @@ -164,7 +164,6 @@ foo(void: null);
164
164
function: (name)
165
165
arguments: (arguments (argument name: (name) (null))))))
166
166
167
-
168
167
=========================================
169
168
#221: Error when closing tag is in a string
170
169
=========================================
@@ -209,3 +208,26 @@ $foo = '?>';
209
208
(assignment_expression
210
209
left: (variable_name (name))
211
210
right: (string (string_value)))))
211
+
212
+ =========================================
213
+ #223: Error with comment inside binary expression
214
+ =========================================
215
+
216
+ <?php
217
+ if (
218
+ true
219
+ // this is a comment
220
+ || false
221
+ ) {}
222
+
223
+ ---
224
+
225
+ (program
226
+ (php_tag)
227
+ (if_statement
228
+ condition: (parenthesized_expression
229
+ (binary_expression
230
+ left: (boolean)
231
+ (comment)
232
+ right: (boolean)))
233
+ body: (compound_statement)))
Original file line number Diff line number Diff line change @@ -455,6 +455,7 @@ okay to do';
455
455
'#valid regexp#';
456
456
'hello#world';
457
457
'hello//world';
458
+ '//hello world';
458
459
'/*valid regexp*/';
459
460
'/*valid regexp';
460
461
@@ -474,6 +475,7 @@ okay to do';
474
475
(expression_statement (string (string_value)))
475
476
(expression_statement (string (string_value)))
476
477
(expression_statement (string (string_value)))
478
+ (expression_statement (string (string_value)))
477
479
(expression_statement (string (string_value))))
478
480
479
481
=========================================
Original file line number Diff line number Diff line change 6
6
OMG ;
7
7
// <- string
8
8
9
- echo true , TRUE , false , FALSE
9
+ echo true , TRUE , false , FALSE ;
10
10
// ^ constant.builtin
11
11
// ^ constant.builtin
12
12
// ^ constant.builtin
13
13
// ^ constant.builtin
14
14
15
- echo PI_314
15
+ echo PI_314 ;
16
16
// ^ constant
17
17
18
- echo __DIR__
19
- // ^ constant.builtin
18
+ echo __DIR__ ;
19
+ // ^ constant.builtin
Original file line number Diff line number Diff line change 98
98
}
99
99
},
100
100
{
101
- "type" : " PATTERN" ,
102
- "value" : " [^\\ s<][^<]*"
101
+ "type" : " TOKEN" ,
102
+ "content" : {
103
+ "type" : " PREC" ,
104
+ "value" : 1 ,
105
+ "content" : {
106
+ "type" : " PATTERN" ,
107
+ "value" : " [^\\ s<][^<]*"
108
+ }
109
+ }
103
110
}
104
111
]
105
112
}
8980
8987
"comment" : {
8981
8988
"type" : " TOKEN" ,
8982
8989
"content" : {
8983
- "type" : " PREC" ,
8984
- "value" : -1 ,
8985
- "content" : {
8986
- "type" : " CHOICE" ,
8987
- "members" : [
8988
- {
8989
- "type" : " SEQ" ,
8990
- "members" : [
8991
- {
8992
- "type" : " CHOICE" ,
8993
- "members" : [
8994
- {
8995
- "type" : " STRING" ,
8996
- "value" : " //"
8997
- },
8998
- {
8999
- "type" : " PATTERN" ,
9000
- "value" : " #[^?\\ [?\\ r?\\ n]"
9001
- }
9002
- ]
9003
- },
9004
- {
9005
- "type" : " REPEAT" ,
9006
- "content" : {
8990
+ "type" : " CHOICE" ,
8991
+ "members" : [
8992
+ {
8993
+ "type" : " SEQ" ,
8994
+ "members" : [
8995
+ {
8996
+ "type" : " CHOICE" ,
8997
+ "members" : [
8998
+ {
8999
+ "type" : " STRING" ,
9000
+ "value" : " //"
9001
+ },
9002
+ {
9007
9003
"type" : " PATTERN" ,
9008
- "value" : " [^?\\ r ?\\ n]| \\ ?[^> \\ r \\ n]"
9004
+ "value" : " # [^?\\ [ ?\\ r? \\ n]"
9009
9005
}
9010
- },
9011
- {
9012
- "type" : " CHOICE" ,
9013
- "members" : [
9014
- {
9015
- "type" : " PATTERN" ,
9016
- "value" : " \\ ?\\ r?\\ n"
9017
- },
9018
- {
9019
- "type" : " BLANK"
9020
- }
9021
- ]
9022
- }
9023
- ]
9024
- },
9025
- {
9026
- "type" : " STRING" ,
9027
- "value" : " #"
9028
- },
9029
- {
9030
- "type" : " SEQ" ,
9031
- "members" : [
9032
- {
9033
- "type" : " STRING" ,
9034
- "value" : " /*"
9035
- },
9036
- {
9006
+ ]
9007
+ },
9008
+ {
9009
+ "type" : " REPEAT" ,
9010
+ "content" : {
9037
9011
"type" : " PATTERN" ,
9038
- "value" : " [^*]*\\ *+([^/*][^*]*\\ *+)*"
9039
- },
9040
- {
9041
- "type" : " STRING" ,
9042
- "value" : " /"
9012
+ "value" : " [^?\\ r?\\ n]|\\ ?[^>\\ r\\ n]"
9043
9013
}
9044
- ]
9045
- }
9046
- ]
9047
- }
9014
+ },
9015
+ {
9016
+ "type" : " CHOICE" ,
9017
+ "members" : [
9018
+ {
9019
+ "type" : " PATTERN" ,
9020
+ "value" : " \\ ?\\ r?\\ n"
9021
+ },
9022
+ {
9023
+ "type" : " BLANK"
9024
+ }
9025
+ ]
9026
+ }
9027
+ ]
9028
+ },
9029
+ {
9030
+ "type" : " STRING" ,
9031
+ "value" : " #"
9032
+ },
9033
+ {
9034
+ "type" : " SEQ" ,
9035
+ "members" : [
9036
+ {
9037
+ "type" : " STRING" ,
9038
+ "value" : " /*"
9039
+ },
9040
+ {
9041
+ "type" : " PATTERN" ,
9042
+ "value" : " [^*]*\\ *+([^/*][^*]*\\ *+)*"
9043
+ },
9044
+ {
9045
+ "type" : " STRING" ,
9046
+ "value" : " /"
9047
+ }
9048
+ ]
9049
+ }
9050
+ ]
9048
9051
}
9049
9052
},
9050
9053
"_semicolon" : {
You can’t perform that action at this time.
0 commit comments