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 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 1+ --TEST--
2+ Intersection type and by-ref parameter parsing with comments
3+ --FILE--
4+ <?php
5+
6+ class Test {
7+ function f1 (A & /*
8+ 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 // ** / / * * **/ $ 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+ --EXPECT--
Original file line number Diff line number Diff line change @@ -1368,6 +1368,11 @@ TABS_AND_SPACES [ \t]*
13681368TOKENS [;:,.|^&+-/*=%!~$<>?@]
13691369ANY_CHAR [^]
13701370NEWLINE ("\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})*
13711376
13721377/* compute yyleng before each rule */
13731378<!*> := yyleng = YYCURSOR - SCNG (yy_text);
@@ -1869,7 +1874,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
18691874 RETURN_TOKEN (T_SR);
18701875}
18711876
1872- <ST_IN_SCRIPTING>" &" [ \t\r\n]* (" $" |" ..." ) {
1877+ <ST_IN_SCRIPTING>" &" {OPTIONAL_WHITESPACE_AND_COMMENTS} (" $" |" ..." ) {
18731878 yyless (1 );
18741879 RETURN_TOKEN (T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG);
18751880}
You can’t perform that action at this time.
0 commit comments