File tree Expand file tree Collapse file tree 3 files changed +45
-1
lines changed
tests/type_declarations/intersection_types Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Intersection type parsing interaction with comments
3
+ --FILE--
4
+ <?php
5
+
6
+ class Test {
7
+ function f1 (A & /*
8
+ Comment / comment */ B $ p ) {}
9
+ function f2 (A & // Comment
10
+ B $ p ) {}
11
+ function f3 (A & # Comment
12
+ B $ p ) {}
13
+ function f4 (A & #
14
+ B $ p ) {}
15
+ function f6 (A & /*
16
+ Comment / comment */ $ p ) {}
17
+ function f7 (A & // Comment
18
+ $ p ) {}
19
+ function f8 (A & # Comment
20
+ $ p ) {}
21
+ function f9 (A & #
22
+ $ p ) {}
23
+ }
24
+
25
+ ?>
26
+ --EXPECTF--
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Intersection type parsing interaction with attributes
3
+ --FILE--
4
+ <?php
5
+
6
+ class Test {
7
+ public X & # [Comment ]
8
+ Z $ p4 ;
9
+ }
10
+
11
+ ?>
12
+ --EXPECTF--
13
+ Parse error: syntax error, unexpected token "#[" in %s on line %d
Original file line number Diff line number Diff line change @@ -1368,6 +1368,11 @@ TABS_AND_SPACES [ \t]*
1368
1368
TOKENS [;:,.|^&+-/*=%!~$<>?@]
1369
1369
ANY_CHAR [^]
1370
1370
NEWLINE ("\r"|"\n"|"\r\n")
1371
+ OPTIONAL_WHITESPACE [ \n\r\t]*
1372
+ MULTI_LINE_COMMENT "/*"([^"*"]*"*"+)"/"
1373
+ SINGLE_LINE_COMMENT "//".*[\n\r]
1374
+ HASH_COMMENT "#"(([^"["].*[\n\r])|[\n\r])
1375
+ OPTIONAL_WHITESPACE_AND_COMMENTS ({OPTIONAL_WHITESPACE}|{MULTI_LINE_COMMENT}|{SINGLE_LINE_COMMENT}|{HASH_COMMENT})*
1371
1376
1372
1377
/* compute yyleng before each rule */
1373
1378
<!*> := yyleng = YYCURSOR - SCNG (yy_text);
@@ -1869,7 +1874,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
1869
1874
RETURN_TOKEN (T_SR);
1870
1875
}
1871
1876
1872
- <ST_IN_SCRIPTING>" &" [ \t\r\n]* (" $" |" ..." ) {
1877
+ <ST_IN_SCRIPTING>" &" {OPTIONAL_WHITESPACE_AND_COMMENTS} (" $" |" ..." ) {
1873
1878
yyless (1 );
1874
1879
RETURN_TOKEN (T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG);
1875
1880
}
You can’t perform that action at this time.
0 commit comments