Skip to content

Fix GH-14937: Bison parser generates different zendtokentype constants #18861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: PHP-8.3
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
296 changes: 148 additions & 148 deletions Zend/zend_language_parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -86,163 +86,163 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
%precedence T_ELSEIF
%precedence T_ELSE

%token <ast> T_LNUMBER "integer"
%token <ast> T_DNUMBER "floating-point number"
%token <ast> T_STRING "identifier"
%token <ast> T_NAME_FULLY_QUALIFIED "fully qualified name"
%token <ast> T_NAME_RELATIVE "namespace-relative name"
%token <ast> T_NAME_QUALIFIED "namespaced name"
%token <ast> T_VARIABLE "variable"
%token <ast> T_INLINE_HTML
%token <ast> T_ENCAPSED_AND_WHITESPACE "string content"
%token <ast> T_CONSTANT_ENCAPSED_STRING "quoted string"
%token <ast> T_STRING_VARNAME "variable name"
%token <ast> T_NUM_STRING "number"

%token <ident> T_INCLUDE "'include'"
%token <ident> T_INCLUDE_ONCE "'include_once'"
%token <ident> T_EVAL "'eval'"
%token <ident> T_REQUIRE "'require'"
%token <ident> T_REQUIRE_ONCE "'require_once'"
%token <ident> T_LOGICAL_OR "'or'"
%token <ident> T_LOGICAL_XOR "'xor'"
%token <ident> T_LOGICAL_AND "'and'"
%token <ident> T_PRINT "'print'"
%token <ident> T_YIELD "'yield'"
%token <ident> T_YIELD_FROM "'yield from'"
%token <ident> T_INSTANCEOF "'instanceof'"
%token <ident> T_NEW "'new'"
%token <ident> T_CLONE "'clone'"
%token <ident> T_EXIT "'exit'"
%token <ident> T_IF "'if'"
%token <ident> T_ELSEIF "'elseif'"
%token <ident> T_ELSE "'else'"
%token <ident> T_ENDIF "'endif'"
%token <ident> T_ECHO "'echo'"
%token <ident> T_DO "'do'"
%token <ident> T_WHILE "'while'"
%token <ident> T_ENDWHILE "'endwhile'"
%token <ident> T_FOR "'for'"
%token <ident> T_ENDFOR "'endfor'"
%token <ident> T_FOREACH "'foreach'"
%token <ident> T_ENDFOREACH "'endforeach'"
%token <ident> T_DECLARE "'declare'"
%token <ident> T_ENDDECLARE "'enddeclare'"
%token <ident> T_AS "'as'"
%token <ident> T_SWITCH "'switch'"
%token <ident> T_ENDSWITCH "'endswitch'"
%token <ident> T_CASE "'case'"
%token <ident> T_DEFAULT "'default'"
%token <ident> T_MATCH "'match'"
%token <ident> T_BREAK "'break'"
%token <ident> T_CONTINUE "'continue'"
%token <ident> T_GOTO "'goto'"
%token <ident> T_FUNCTION "'function'"
%token <ident> T_FN "'fn'"
%token <ident> T_CONST "'const'"
%token <ident> T_RETURN "'return'"
%token <ident> T_TRY "'try'"
%token <ident> T_CATCH "'catch'"
%token <ident> T_FINALLY "'finally'"
%token <ident> T_THROW "'throw'"
%token <ident> T_USE "'use'"
%token <ident> T_INSTEADOF "'insteadof'"
%token <ident> T_GLOBAL "'global'"
%token <ident> T_STATIC "'static'"
%token <ident> T_ABSTRACT "'abstract'"
%token <ident> T_FINAL "'final'"
%token <ident> T_PRIVATE "'private'"
%token <ident> T_PROTECTED "'protected'"
%token <ident> T_PUBLIC "'public'"
%token <ident> T_READONLY "'readonly'"
%token <ident> T_VAR "'var'"
%token <ident> T_UNSET "'unset'"
%token <ident> T_ISSET "'isset'"
%token <ident> T_EMPTY "'empty'"
%token <ident> T_HALT_COMPILER "'__halt_compiler'"
%token <ident> T_CLASS "'class'"
%token <ident> T_TRAIT "'trait'"
%token <ident> T_INTERFACE "'interface'"
%token <ident> T_ENUM "'enum'"
%token <ident> T_EXTENDS "'extends'"
%token <ident> T_IMPLEMENTS "'implements'"
%token <ident> T_NAMESPACE "'namespace'"
%token <ident> T_LIST "'list'"
%token <ident> T_ARRAY "'array'"
%token <ident> T_CALLABLE "'callable'"
%token <ident> T_LINE "'__LINE__'"
%token <ident> T_FILE "'__FILE__'"
%token <ident> T_DIR "'__DIR__'"
%token <ident> T_CLASS_C "'__CLASS__'"
%token <ident> T_TRAIT_C "'__TRAIT__'"
%token <ident> T_METHOD_C "'__METHOD__'"
%token <ident> T_FUNC_C "'__FUNCTION__'"
%token <ident> T_NS_C "'__NAMESPACE__'"
%token <ast> T_LNUMBER 260 "integer"
%token <ast> T_DNUMBER 261 "floating-point number"
%token <ast> T_STRING 262 "identifier"
%token <ast> T_NAME_FULLY_QUALIFIED 263 "fully qualified name"
%token <ast> T_NAME_RELATIVE 264 "namespace-relative name"
%token <ast> T_NAME_QUALIFIED 265 "namespaced name"
%token <ast> T_VARIABLE 266 "variable"
%token <ast> T_INLINE_HTML 267
%token <ast> T_ENCAPSED_AND_WHITESPACE 268 "string content"
%token <ast> T_CONSTANT_ENCAPSED_STRING 269 "quoted string"
%token <ast> T_STRING_VARNAME 270 "variable name"
%token <ast> T_NUM_STRING 271 "number"

%token <ident> T_INCLUDE 272 "'include'"
%token <ident> T_INCLUDE_ONCE 273 "'include_once'"
%token <ident> T_EVAL 274 "'eval'"
%token <ident> T_REQUIRE 275 "'require'"
%token <ident> T_REQUIRE_ONCE 276 "'require_once'"
%token <ident> T_LOGICAL_OR 277 "'or'"
%token <ident> T_LOGICAL_XOR 278 "'xor'"
%token <ident> T_LOGICAL_AND 279 "'and'"
%token <ident> T_PRINT 280 "'print'"
%token <ident> T_YIELD 281 "'yield'"
%token <ident> T_YIELD_FROM 282 "'yield from'"
%token <ident> T_INSTANCEOF 283 "'instanceof'"
%token <ident> T_NEW 284 "'new'"
%token <ident> T_CLONE 285 "'clone'"
%token <ident> T_EXIT 286 "'exit'"
%token <ident> T_IF 287 "'if'"
%token <ident> T_ELSEIF 288 "'elseif'"
%token <ident> T_ELSE 289 "'else'"
%token <ident> T_ENDIF 290 "'endif'"
%token <ident> T_ECHO 291 "'echo'"
%token <ident> T_DO 292 "'do'"
%token <ident> T_WHILE 293 "'while'"
%token <ident> T_ENDWHILE 294 "'endwhile'"
%token <ident> T_FOR 295 "'for'"
%token <ident> T_ENDFOR 296 "'endfor'"
%token <ident> T_FOREACH 297 "'foreach'"
%token <ident> T_ENDFOREACH 298 "'endforeach'"
%token <ident> T_DECLARE 299 "'declare'"
%token <ident> T_ENDDECLARE 300 "'enddeclare'"
%token <ident> T_AS 301 "'as'"
%token <ident> T_SWITCH 302 "'switch'"
%token <ident> T_ENDSWITCH 303 "'endswitch'"
%token <ident> T_CASE 304 "'case'"
%token <ident> T_DEFAULT 305 "'default'"
%token <ident> T_MATCH 306 "'match'"
%token <ident> T_BREAK 307 "'break'"
%token <ident> T_CONTINUE 308 "'continue'"
%token <ident> T_GOTO 309 "'goto'"
%token <ident> T_FUNCTION 310 "'function'"
%token <ident> T_FN 311 "'fn'"
%token <ident> T_CONST 312 "'const'"
%token <ident> T_RETURN 313 "'return'"
%token <ident> T_TRY 314 "'try'"
%token <ident> T_CATCH 315 "'catch'"
%token <ident> T_FINALLY 316 "'finally'"
%token <ident> T_THROW 317 "'throw'"
%token <ident> T_USE 318 "'use'"
%token <ident> T_INSTEADOF 319 "'insteadof'"
%token <ident> T_GLOBAL 320 "'global'"
%token <ident> T_STATIC 321 "'static'"
%token <ident> T_ABSTRACT 322 "'abstract'"
%token <ident> T_FINAL 323 "'final'"
%token <ident> T_PRIVATE 324 "'private'"
%token <ident> T_PROTECTED 325 "'protected'"
%token <ident> T_PUBLIC 326 "'public'"
%token <ident> T_READONLY 327 "'readonly'"
%token <ident> T_VAR 328 "'var'"
%token <ident> T_UNSET 329 "'unset'"
%token <ident> T_ISSET 330 "'isset'"
%token <ident> T_EMPTY 331 "'empty'"
%token <ident> T_HALT_COMPILER 332 "'__halt_compiler'"
%token <ident> T_CLASS 333 "'class'"
%token <ident> T_TRAIT 334 "'trait'"
%token <ident> T_INTERFACE 335 "'interface'"
%token <ident> T_ENUM 336 "'enum'"
%token <ident> T_EXTENDS 337 "'extends'"
%token <ident> T_IMPLEMENTS 338 "'implements'"
%token <ident> T_NAMESPACE 339 "'namespace'"
%token <ident> T_LIST 340 "'list'"
%token <ident> T_ARRAY 341 "'array'"
%token <ident> T_CALLABLE 342 "'callable'"
%token <ident> T_LINE 343 "'__LINE__'"
%token <ident> T_FILE 344 "'__FILE__'"
%token <ident> T_DIR 345 "'__DIR__'"
%token <ident> T_CLASS_C 346 "'__CLASS__'"
%token <ident> T_TRAIT_C 347 "'__TRAIT__'"
%token <ident> T_METHOD_C 348 "'__METHOD__'"
%token <ident> T_FUNC_C 349 "'__FUNCTION__'"
%token <ident> T_NS_C 350 "'__NAMESPACE__'"

%token END 0 "end of file"
%token T_ATTRIBUTE "'#['"
%token T_PLUS_EQUAL "'+='"
%token T_MINUS_EQUAL "'-='"
%token T_MUL_EQUAL "'*='"
%token T_DIV_EQUAL "'/='"
%token T_CONCAT_EQUAL "'.='"
%token T_MOD_EQUAL "'%='"
%token T_AND_EQUAL "'&='"
%token T_OR_EQUAL "'|='"
%token T_XOR_EQUAL "'^='"
%token T_SL_EQUAL "'<<='"
%token T_SR_EQUAL "'>>='"
%token T_COALESCE_EQUAL "'??='"
%token T_BOOLEAN_OR "'||'"
%token T_BOOLEAN_AND "'&&'"
%token T_IS_EQUAL "'=='"
%token T_IS_NOT_EQUAL "'!='"
%token T_IS_IDENTICAL "'==='"
%token T_IS_NOT_IDENTICAL "'!=='"
%token T_IS_SMALLER_OR_EQUAL "'<='"
%token T_IS_GREATER_OR_EQUAL "'>='"
%token T_SPACESHIP "'<=>'"
%token T_SL "'<<'"
%token T_SR "'>>'"
%token T_INC "'++'"
%token T_DEC "'--'"
%token T_INT_CAST "'(int)'"
%token T_DOUBLE_CAST "'(double)'"
%token T_STRING_CAST "'(string)'"
%token T_ARRAY_CAST "'(array)'"
%token T_OBJECT_CAST "'(object)'"
%token T_BOOL_CAST "'(bool)'"
%token T_UNSET_CAST "'(unset)'"
%token T_OBJECT_OPERATOR "'->'"
%token T_NULLSAFE_OBJECT_OPERATOR "'?->'"
%token T_DOUBLE_ARROW "'=>'"
%token T_COMMENT "comment"
%token T_DOC_COMMENT "doc comment"
%token T_OPEN_TAG "open tag"
%token T_OPEN_TAG_WITH_ECHO "'<?='"
%token T_CLOSE_TAG "'?>'"
%token T_WHITESPACE "whitespace"
%token T_START_HEREDOC "heredoc start"
%token T_END_HEREDOC "heredoc end"
%token T_DOLLAR_OPEN_CURLY_BRACES "'${'"
%token T_CURLY_OPEN "'{$'"
%token T_PAAMAYIM_NEKUDOTAYIM "'::'"
%token T_NS_SEPARATOR "'\\'"
%token T_ELLIPSIS "'...'"
%token T_COALESCE "'??'"
%token T_POW "'**'"
%token T_POW_EQUAL "'**='"
%token T_ATTRIBUTE 351 "'#['"
%token T_PLUS_EQUAL 352 "'+='"
%token T_MINUS_EQUAL 353 "'-='"
%token T_MUL_EQUAL 354 "'*='"
%token T_DIV_EQUAL 355 "'/='"
%token T_CONCAT_EQUAL 356 "'.='"
%token T_MOD_EQUAL 357 "'%='"
%token T_AND_EQUAL 358 "'&='"
%token T_OR_EQUAL 359 "'|='"
%token T_XOR_EQUAL 360 "'^='"
%token T_SL_EQUAL 361 "'<<='"
%token T_SR_EQUAL 362 "'>>='"
%token T_COALESCE_EQUAL 363 "'??='"
%token T_BOOLEAN_OR 364 "'||'"
%token T_BOOLEAN_AND 365 "'&&'"
%token T_IS_EQUAL 366 "'=='"
%token T_IS_NOT_EQUAL 367 "'!='"
%token T_IS_IDENTICAL 368 "'==='"
%token T_IS_NOT_IDENTICAL 369 "'!=='"
%token T_IS_SMALLER_OR_EQUAL 370 "'<='"
%token T_IS_GREATER_OR_EQUAL 371 "'>='"
%token T_SPACESHIP 372 "'<=>'"
%token T_SL 373 "'<<'"
%token T_SR 374 "'>>'"
%token T_INC 375 "'++'"
%token T_DEC 376 "'--'"
%token T_INT_CAST 377 "'(int)'"
%token T_DOUBLE_CAST 378 "'(double)'"
%token T_STRING_CAST 379 "'(string)'"
%token T_ARRAY_CAST 380 "'(array)'"
%token T_OBJECT_CAST 381 "'(object)'"
%token T_BOOL_CAST 382 "'(bool)'"
%token T_UNSET_CAST 383 "'(unset)'"
%token T_OBJECT_OPERATOR 384 "'->'"
%token T_NULLSAFE_OBJECT_OPERATOR 385 "'?->'"
%token T_DOUBLE_ARROW 386 "'=>'"
%token T_COMMENT 387 "comment"
%token T_DOC_COMMENT 388 "doc comment"
%token T_OPEN_TAG 389 "open tag"
%token T_OPEN_TAG_WITH_ECHO 390 "'<?='"
%token T_CLOSE_TAG 391 "'?>'"
%token T_WHITESPACE 392 "whitespace"
%token T_START_HEREDOC 393 "heredoc start"
%token T_END_HEREDOC 394 "heredoc end"
%token T_DOLLAR_OPEN_CURLY_BRACES 395 "'${'"
%token T_CURLY_OPEN 396 "'{$'"
%token T_PAAMAYIM_NEKUDOTAYIM 397 "'::'"
%token T_NS_SEPARATOR 398 "'\\'"
%token T_ELLIPSIS 399 "'...'"
%token T_COALESCE 400 "'??'"
%token T_POW 401 "'**'"
%token T_POW_EQUAL 402 "'**='"
/* We need to split the & token in two to avoid a shift/reduce conflict. For T1&$v and T1&T2,
* with only one token lookahead, bison does not know whether to reduce T1 as a complete type,
* or shift to continue parsing an intersection type. */
%token T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG "'&'"
%token T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG 403 "'&'"
/* Bison warns on duplicate token literals, so use a different dummy value here.
* It will be fixed up by zend_yytnamerr() later. */
%token T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG "amp"
%token T_BAD_CHARACTER "invalid character"
%token T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG 404 "amp"
%token T_BAD_CHARACTER 405 "invalid character"

/* Token used to force a parse error from the lexer */
%token T_ERROR
%token T_ERROR 406

%type <ast> top_statement namespace_name name statement function_declaration_statement
%type <ast> class_declaration_statement trait_declaration_statement legacy_namespace_name
Expand Down
Loading