mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.3'
* PHP-8.3: Fix comments between -> and keyword
This commit is contained in:
26
Zend/tests/gh14961.phpt
Normal file
26
Zend/tests/gh14961.phpt
Normal file
@@ -0,0 +1,26 @@
|
||||
--TEST--
|
||||
GH-14961: Comment between -> and keyword
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class C {
|
||||
public $class = C::class;
|
||||
}
|
||||
|
||||
$c = new C();
|
||||
$c->/* comment */class = 42;
|
||||
var_dump($c->/** doc comment */class);
|
||||
var_dump($c->
|
||||
// line comment
|
||||
class);
|
||||
var_dump($c->
|
||||
# hash comment
|
||||
class);
|
||||
var_dump($c?->/* comment */class);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(42)
|
||||
int(42)
|
||||
int(42)
|
||||
int(42)
|
||||
@@ -1597,12 +1597,6 @@ OPTIONAL_WHITESPACE_OR_COMMENTS ({WHITESPACE}|{MULTI_LINE_COMMENT}|{SINGLE_LINE_
|
||||
RETURN_TOKEN_WITH_STR(T_STRING, 0);
|
||||
}
|
||||
|
||||
<ST_LOOKING_FOR_PROPERTY>{ANY_CHAR} {
|
||||
yyless(0);
|
||||
yy_pop_state();
|
||||
goto restart;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"::" {
|
||||
RETURN_TOKEN(T_PAAMAYIM_NEKUDOTAYIM);
|
||||
}
|
||||
@@ -2389,7 +2383,7 @@ inline_char_handler:
|
||||
}
|
||||
|
||||
|
||||
<ST_IN_SCRIPTING>"#"|"//" {
|
||||
<ST_IN_SCRIPTING,ST_LOOKING_FOR_PROPERTY>"#"|"//" {
|
||||
while (YYCURSOR < YYLIMIT) {
|
||||
switch (*YYCURSOR++) {
|
||||
case '\r':
|
||||
@@ -2413,7 +2407,7 @@ inline_char_handler:
|
||||
RETURN_OR_SKIP_TOKEN(T_COMMENT);
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"/*"|"/**"{WHITESPACE} {
|
||||
<ST_IN_SCRIPTING,ST_LOOKING_FOR_PROPERTY>"/*"|"/**"{WHITESPACE} {
|
||||
int doc_com;
|
||||
|
||||
if (yyleng > 2) {
|
||||
@@ -2449,6 +2443,12 @@ inline_char_handler:
|
||||
RETURN_OR_SKIP_TOKEN(T_COMMENT);
|
||||
}
|
||||
|
||||
<ST_LOOKING_FOR_PROPERTY>{ANY_CHAR} {
|
||||
yyless(0);
|
||||
yy_pop_state();
|
||||
goto restart;
|
||||
}
|
||||
|
||||
<ST_IN_SCRIPTING>"?>"{NEWLINE}? {
|
||||
BEGIN(INITIAL);
|
||||
if (yytext[yyleng-1] != '>') {
|
||||
|
||||
Reference in New Issue
Block a user