From 31be7b4ed9d10d4bc9e4b0a98531d2244bcb1514 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sat, 8 Aug 2020 19:22:28 +0200 Subject: [PATCH] Update php-yacc, remove unused tokens --- composer.json | 2 +- grammar/tokens.y | 8 -- lib/PhpParser/Parser/Php5.php | 19 ++-- lib/PhpParser/Parser/Php7.php | 19 ++-- lib/PhpParser/Parser/Tokens.php | 150 +++++++++++++++----------------- 5 files changed, 90 insertions(+), 108 deletions(-) diff --git a/composer.json b/composer.json index 71595fd..4ad6326 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ }, "require-dev": { "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0", - "ircmaxell/php-yacc": "0.0.5" + "ircmaxell/php-yacc": "^0.0.6" }, "extra": { "branch-alias": { diff --git a/grammar/tokens.y b/grammar/tokens.y index 4f796d8..cbf68bf 100644 --- a/grammar/tokens.y +++ b/grammar/tokens.y @@ -41,8 +41,6 @@ %token T_VARIABLE %token T_NUM_STRING %token T_INLINE_HTML -%token T_CHARACTER -%token T_BAD_CHARACTER %token T_ENCAPSED_AND_WHITESPACE %token T_CONSTANT_ENCAPSED_STRING %token T_ECHO @@ -97,12 +95,6 @@ %token T_FUNC_C %token T_LINE %token T_FILE -%token T_COMMENT -%token T_DOC_COMMENT -%token T_OPEN_TAG -%token T_OPEN_TAG_WITH_ECHO -%token T_CLOSE_TAG -%token T_WHITESPACE %token T_START_HEREDOC %token T_END_HEREDOC %token T_DOLLAR_OPEN_CURLY_BRACES diff --git a/lib/PhpParser/Parser/Php5.php b/lib/PhpParser/Parser/Php5.php index 9899160..5457edc 100644 --- a/lib/PhpParser/Parser/Php5.php +++ b/lib/PhpParser/Parser/Php5.php @@ -17,7 +17,7 @@ use PhpParser\Node\Stmt; */ class Php5 extends \PhpParser\ParserAbstract { - protected $tokenToSymbolMapSize = 398; + protected $tokenToSymbolMapSize = 390; protected $actionTableSize = 1061; protected $gotoTableSize = 580; @@ -227,15 +227,14 @@ class Php5 extends \PhpParser\ParserAbstract 27, 28, 31, 32, 33, 37, 38, 39, 40, 41, 43, 45, 46, 47, 55, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 163, - 163, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 163, - 163, 163, 163, 163, 163, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 153 + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153 ); protected $action = array( diff --git a/lib/PhpParser/Parser/Php7.php b/lib/PhpParser/Parser/Php7.php index d4117f8..6c723e5 100644 --- a/lib/PhpParser/Parser/Php7.php +++ b/lib/PhpParser/Parser/Php7.php @@ -17,7 +17,7 @@ use PhpParser\Node\Stmt; */ class Php7 extends \PhpParser\ParserAbstract { - protected $tokenToSymbolMapSize = 398; + protected $tokenToSymbolMapSize = 390; protected $actionTableSize = 1009; protected $gotoTableSize = 527; @@ -227,15 +227,14 @@ class Php7 extends \PhpParser\ParserAbstract 27, 28, 31, 32, 33, 37, 38, 39, 40, 41, 43, 45, 46, 47, 55, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 163, - 163, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 163, - 163, 163, 163, 163, 163, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 153 + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153 ); protected $action = array( diff --git a/lib/PhpParser/Parser/Tokens.php b/lib/PhpParser/Parser/Tokens.php index f1aa9d2..e2adbb4 100644 --- a/lib/PhpParser/Parser/Tokens.php +++ b/lib/PhpParser/Parser/Tokens.php @@ -68,83 +68,75 @@ final class Tokens const T_VARIABLE = 316; const T_NUM_STRING = 317; const T_INLINE_HTML = 318; - const T_CHARACTER = 319; - const T_BAD_CHARACTER = 320; - const T_ENCAPSED_AND_WHITESPACE = 321; - const T_CONSTANT_ENCAPSED_STRING = 322; - const T_ECHO = 323; - const T_DO = 324; - const T_WHILE = 325; - const T_ENDWHILE = 326; - const T_FOR = 327; - const T_ENDFOR = 328; - const T_FOREACH = 329; - const T_ENDFOREACH = 330; - const T_DECLARE = 331; - const T_ENDDECLARE = 332; - const T_AS = 333; - const T_SWITCH = 334; - const T_MATCH = 335; - const T_ENDSWITCH = 336; - const T_CASE = 337; - const T_DEFAULT = 338; - const T_BREAK = 339; - const T_CONTINUE = 340; - const T_GOTO = 341; - const T_FUNCTION = 342; - const T_FN = 343; - const T_CONST = 344; - const T_RETURN = 345; - const T_TRY = 346; - const T_CATCH = 347; - const T_FINALLY = 348; - const T_THROW = 349; - const T_USE = 350; - const T_INSTEADOF = 351; - const T_GLOBAL = 352; - const T_STATIC = 353; - const T_ABSTRACT = 354; - const T_FINAL = 355; - const T_PRIVATE = 356; - const T_PROTECTED = 357; - const T_PUBLIC = 358; - const T_VAR = 359; - const T_UNSET = 360; - const T_ISSET = 361; - const T_EMPTY = 362; - const T_HALT_COMPILER = 363; - const T_CLASS = 364; - const T_TRAIT = 365; - const T_INTERFACE = 366; - const T_EXTENDS = 367; - const T_IMPLEMENTS = 368; - const T_OBJECT_OPERATOR = 369; - const T_LIST = 370; - const T_ARRAY = 371; - const T_CALLABLE = 372; - const T_CLASS_C = 373; - const T_TRAIT_C = 374; - const T_METHOD_C = 375; - const T_FUNC_C = 376; - const T_LINE = 377; - const T_FILE = 378; - const T_COMMENT = 379; - const T_DOC_COMMENT = 380; - const T_OPEN_TAG = 381; - const T_OPEN_TAG_WITH_ECHO = 382; - const T_CLOSE_TAG = 383; - const T_WHITESPACE = 384; - const T_START_HEREDOC = 385; - const T_END_HEREDOC = 386; - const T_DOLLAR_OPEN_CURLY_BRACES = 387; - const T_CURLY_OPEN = 388; - const T_PAAMAYIM_NEKUDOTAYIM = 389; - const T_NAMESPACE = 390; - const T_NS_C = 391; - const T_DIR = 392; - const T_NS_SEPARATOR = 393; - const T_ELLIPSIS = 394; - const T_NAME_FULLY_QUALIFIED = 395; - const T_NAME_QUALIFIED = 396; - const T_NAME_RELATIVE = 397; + const T_ENCAPSED_AND_WHITESPACE = 319; + const T_CONSTANT_ENCAPSED_STRING = 320; + const T_ECHO = 321; + const T_DO = 322; + const T_WHILE = 323; + const T_ENDWHILE = 324; + const T_FOR = 325; + const T_ENDFOR = 326; + const T_FOREACH = 327; + const T_ENDFOREACH = 328; + const T_DECLARE = 329; + const T_ENDDECLARE = 330; + const T_AS = 331; + const T_SWITCH = 332; + const T_MATCH = 333; + const T_ENDSWITCH = 334; + const T_CASE = 335; + const T_DEFAULT = 336; + const T_BREAK = 337; + const T_CONTINUE = 338; + const T_GOTO = 339; + const T_FUNCTION = 340; + const T_FN = 341; + const T_CONST = 342; + const T_RETURN = 343; + const T_TRY = 344; + const T_CATCH = 345; + const T_FINALLY = 346; + const T_THROW = 347; + const T_USE = 348; + const T_INSTEADOF = 349; + const T_GLOBAL = 350; + const T_STATIC = 351; + const T_ABSTRACT = 352; + const T_FINAL = 353; + const T_PRIVATE = 354; + const T_PROTECTED = 355; + const T_PUBLIC = 356; + const T_VAR = 357; + const T_UNSET = 358; + const T_ISSET = 359; + const T_EMPTY = 360; + const T_HALT_COMPILER = 361; + const T_CLASS = 362; + const T_TRAIT = 363; + const T_INTERFACE = 364; + const T_EXTENDS = 365; + const T_IMPLEMENTS = 366; + const T_OBJECT_OPERATOR = 367; + const T_LIST = 368; + const T_ARRAY = 369; + const T_CALLABLE = 370; + const T_CLASS_C = 371; + const T_TRAIT_C = 372; + const T_METHOD_C = 373; + const T_FUNC_C = 374; + const T_LINE = 375; + const T_FILE = 376; + const T_START_HEREDOC = 377; + const T_END_HEREDOC = 378; + const T_DOLLAR_OPEN_CURLY_BRACES = 379; + const T_CURLY_OPEN = 380; + const T_PAAMAYIM_NEKUDOTAYIM = 381; + const T_NAMESPACE = 382; + const T_NS_C = 383; + const T_DIR = 384; + const T_NS_SEPARATOR = 385; + const T_ELLIPSIS = 386; + const T_NAME_FULLY_QUALIFIED = 387; + const T_NAME_QUALIFIED = 388; + const T_NAME_RELATIVE = 389; }