Make encapsed strings fully dereferencable

This commit is contained in:
Nikita Popov 2020-02-22 20:49:11 +01:00
parent 6770deda3d
commit ad696ee75d
3 changed files with 276 additions and 240 deletions

View File

@ -853,6 +853,9 @@ dereferencable_scalar:
| T_CONSTANT_ENCAPSED_STRING
{ $attrs = attributes(); $attrs['kind'] = strKind($1);
$$ = new Scalar\String_(Scalar\String_::parse($1), $attrs); }
| '"' encaps_list '"'
{ $attrs = attributes(); $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED;
parseEncapsed($2, '"', true); $$ = new Scalar\Encapsed($2, $attrs); }
;
scalar:
@ -872,9 +875,6 @@ scalar:
{ $$ = $this->parseDocString($1, $2, $3, attributes(), stackAttributes(#3), true); }
| T_START_HEREDOC T_END_HEREDOC
{ $$ = $this->parseDocString($1, '', $2, attributes(), stackAttributes(#2), true); }
| '"' encaps_list '"'
{ $attrs = attributes(); $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED;
parseEncapsed($2, '"', true); $$ = new Scalar\Encapsed($2, $attrs); }
| T_START_HEREDOC encaps_list T_END_HEREDOC
{ $$ = $this->parseDocString($1, $2, $3, attributes(), stackAttributes(#3), true); }
;

View File

@ -18,7 +18,7 @@ use PhpParser\Node\Stmt;
class Php7 extends \PhpParser\ParserAbstract
{
protected $tokenToSymbolMapSize = 394;
protected $actionTableSize = 923;
protected $actionTableSize = 917;
protected $gotoTableSize = 499;
protected $invalidSymbol = 159;
@ -240,94 +240,93 @@ class Php7 extends \PhpParser\ParserAbstract
96, 97, 98, 683,-32766,-32766,-32766, -219, -219, -219,
-32766,-32766,-32766, 365,-32766,-32766,-32766,-32766,-32766,-32766,
-32767,-32767,-32767,-32767,-32767, 425, 426, 905, 906, 907,
904, 903, 902, 613, 741, 789, 367, 368, 844, 905,
906, 907, 904, 903, 902, -263, 0, 614, 615, 616,
617, 618, 619, 620, 9, 1075, 681, 96, 97, 98,
768, 28, -219, 621, 622, 623, 624, 625, 626, 627,
904, 903, 902, 613, 741, 789, 367, 368, 0, 905,
906, 907, 904, 903, 902, 533, 21, 614, 615, 616,
617, 618, 619, 620, 784, 397, 681, 96, 97, 98,
768, 844, -219, 621, 622, 623, 624, 625, 626, 627,
628, 629, 630, 631, 651, 652, 653, 654, 655, 643,
644, 645, 673, 646, 647, 632, 633, 634, 635, 636,
637, 638, 675, 676, 677, 678, 679, 680, 639, 640,
641, 642, 672, 663, 661, 662, 658, 659, 134, 650,
656, 657, 664, 665, 667, 666, 668, 669,-32766, 76,
77, 78, 121, 660, 671, 670, 766, 45, 46, 416,
47, 48, 690, 275, 1037, 75, 49, 50, 381, 51,
30, 576, 79, 80, 81, 82, 83, 84, 85, 86,
641, 642, 672, 663, 661, 662, 658, 659, -263, 650,
656, 657, 664, 665, 667, 666, 668, 669, 274, 76,
77, 78, 9, 660, 671, 670, 766, 45, 46, 416,
47, 48, 690, 28, 1037, 75, 49, 50, 820, 51,
30, 121, 79, 80, 81, 82, 83, 84, 85, 86,
87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
97, 98, 99, 100, 101, 256, 248, 559, -462, 225,
-32766,-32766,-32766, 52, 53, 119, -178, 820, 102, 54,
397, 55, 228, 229, 56, 57, 58, 59, 60, 61,
62, 63, -263, 24, 237, 64, 363, 417,-32766,-32766,
-32766, 1042, 1043, 418, 706, 1075, 707, 755,-32766, 1041,
36, 20, 419, 1075, 420, 130, 421, -177, 422,-32766,
881, 423, 533, 21, 499, 38, 39, 364, 372, 366,
-462, 40, 424, 235, 560, 65, 1025, 369, 300, 286,
247, 883, 24, 233, -462, 273, 427, 428, 429, 352,
-461, -462, 1093, -465, 1075, 580, 430, 431, 1041, 1047,
1048, 1049, 1050, 1044, 1045, 251, 581,-32766, 849, 850,
439, 1051, 1046, 369, 688, 685, 574, 1112, 66,-32766,
265, 689, 270, 275, 126, 685, 582, 285, 1018,-32766,
-239, 275,-32766,-32766,-32766, 1025,-32766, 821,-32766, 236,
-32766, 398, 230,-32766, 784, 463, 431,-32766,-32766,-32766,
-234, 301, -461,-32766,-32766, 1075, -460,-32766, 224,-32766,
-32766, 331, -298, -178, -298, 137, -461, 68,-32766, 683,
268, 24, 275, -461, 256, -464, 29, 231,-32766, 897,
1097, 857, 439, 1075, 685, 369, 1096, 1041,-32766, 1018,
304,-32766,-32766,-32766, 233,-32766, 125,-32766,-32766,-32766,
357, 858,-32766, 1055, -177,-32766,-32766,-32766,-32766, 256,
308, -276,-32766,-32766, 1075, 768,-32766, 1018, -460,-32766,
331, 99, 100, 101, 256, 248, 768,-32766, 585, 589,
-32766, 356, -460, 275, 430, 431, 685, 102, 506, -460,
-32766, 42, 127,-32766,-32766,-32766, 806,-32766, 1018,-32766,
359,-32766,-32766, 274,-32766, 69, 68,-32766,-32766,-32766,
-32766, 275, 133, 326,-32766,-32766, 360, 1121,-32766, 361,
1122,-32766, 331, -495, 362, -495,-32766, 849, 850,-32766,
548, 549, 685, 486, 44,-32766,-32766, 232, 32,-32766,
-32766,-32766, 275,-32766, 587,-32766, -299,-32766, -299, -92,
-32766, 849, 850, 254,-32766,-32766,-32766, 125, 116,-32766,
-32766,-32766, 849, 850,-32766, 388, 117,-32766, 331, 122,
234, 377, 378,-32766, 118,-32766, 123, 849, 850, 685,
408, 129, 8,-32766, 526, 527,-32766,-32766,-32766,-32766,
-32766, 706,-32766, 707,-32766, 136, 255,-32766, 768, 768,
138,-32766,-32766,-32766, 139,-32766,-32766,-32766,-32766, -83,
303,-32766, 685, 249,-32766, 331,-32766, 120, 124,-32766,
-32766,-32766,-32766,-32766, 588,-32766, 591,-32766, 765,-32766,
-32766, 882, 597, 132,-32766,-32766,-32766, 780, 257, 258,
-32766,-32766, 290, 102,-32766, 248, 43,-32766, 331, 131,
556, 685,-32766, 1123, 688,-32766, 472, 911, 534, 551,
-32766, 568, 683, -81, 686,-32766, 685, 524, 266, 269,
-32766, 790, 1018,-32766,-32766,-32766, 467,-32766, 791,-32766,
272,-32766, 10, 1054,-32766,-32766, -4, 385,-32766,-32766,
-32766, 539, 540, 267,-32766,-32766, 552, 334,-32766, -419,
-32766,-32766, 331, 1057, 5, -431, 685, 12, 782,-32766,
-32766, 0, 0,-32766,-32766,-32766, 575,-32766, 0,-32766,
0,-32766, 0, 0,-32766, 0, 0, 0,-32766,-32766,
-32766, 0, 0, 0,-32766,-32766, 0, 0,-32766,-32766,
0,-32766, 331, 592, 302, 0, 0, 0, 0,-32766,
97, 98, 99, 100, 101, 225, 248, 559, -462,-32766,
706, 256, 707, 52, 53, 1025, 398, 580, 102, 54,
388, 55, 228, 229, 56, 57, 58, 59, 60, 61,
62, 63, 1093, 24, 237, 64, 363, 417,-32766,-32766,
-32766, 1043, 1044, 418, 587, 1075, 130, 755,-32766, 1041,
36, 20, 419, 1075, 420, 352, 421, -178, 422,-32766,
506, 423, -299, -177, -299, 38, 39, 364, 372, 366,
-462, 40, 424, 42, 560, 65, 1025, 369, 300, 286,
134, 883, 688, 233, -462, 1112, 427, 428, 429, 1121,
235, -462, 1122, -465, 1075, -263, 430, 431, 821, 1048,
1049, 1050, 1051, 1045, 1046, 251, 247,-32766, 581, 683,
439, 1052, 1047, 369, 849, 850, 574, 499, 66,-32766,
265, 689, 270, 275, 126, 685, 137, 881, 1018,-32766,
857, 275,-32766,-32766,-32766, 254,-32766, 768,-32766, 357,
-32766, -461, 230,-32766, 29, 231, -234,-32766,-32766,-32766,
-32766,-32766,-32766,-32766,-32766, 1075, 118,-32766, 256,-32766,
-32766, 331,-32766,-32766,-32766, 99, 100, 101,-32766, 248,
1075,-32766, 275,-32766,-32766,-32766,-32766,-32766,-32766, 582,
-460, 102, 127,-32766, 685,-32766,-32766,-32766,-32766, 1018,
273,-32766,-32766,-32766, 233,-32766, 125,-32766,-32766,-32766,
685, 858,-32766, -461, -178,-32766,-32766,-32766,-32766, 256,
-177, 224,-32766,-32766, 285, 585,-32766, -461, 256,-32766,
331, 589, 463, 408, -461, 8, -464,-32766, 768, -298,
-32766, -298, 1097, 275, 548, 549, 685, 268, 1096, 706,
-32766, 707, -460,-32766,-32766,-32766, 897,-32766, 275,-32766,
381,-32766,-32766, 576,-32766, 69, -460,-32766,-32766,-32766,
-32766, 849, 850, -460,-32766,-32766, 301, 439,-32766, 304,
369,-32766, 331, -495, 308, -495,-32766, 356, -276,-32766,
1056, 32, 685, 486, 359,-32766,-32766, 232, 360,-32766,
-32766,-32766, 361,-32766, 362,-32766, -83,-32766, 44, 806,
-32766, 133, 326, 24,-32766,-32766,-32766, 125, 116,-32766,
-32766,-32766, 849, 850,-32766, 1075, 117,-32766, 331, 1041,
234, 849, 850,-32766, 122,-32766,-32766,-32766,-32766, 685,
123, 119, 129,-32766, -239, 768,-32766,-32766,-32766,-32766,
-32766, 768,-32766, -92,-32766, 377, 378,-32766, 136, 1018,
138,-32766,-32766,-32766, 139,-32766,-32766,-32766,-32766, 249,
255,-32766, 685, 780,-32766, 331,-32766, 431, 124,-32766,
-32766,-32766,-32766,-32766, 303,-32766, 588,-32766, 591,-32766,
-32766, 120, 526, 527,-32766,-32766,-32766, 765, 68, 132,
-32766,-32766, 270, 275,-32766, 849, 850,-32766, 331, 882,
597, 257,-32766, 258, 290,-32766, 248, 102, 685, 43,
-32766, 131, 556, 1123, 683, 472, 685,-32766, 551, 534,
-32766, 540, 686,-32766,-32766,-32766, 269,-32766, 467,-32766,
688,-32766, 911, 524,-32766,-32766, -4, 568,-32766,-32766,
-32766, 790, 267, 539,-32766,-32766, 791, 266,-32766, -81,
-32766,-32766, 331, 10, -419, 385, 685, 782, 552,-32766,
-32766, 1055, 34,-32766,-32766,-32766, 1057,-32766, 1042,-32766,
1018,-32766, 0, 35,-32766, 0, 0, 0,-32766,-32766,
-32766, 272, 0, 0,-32766,-32766, 5, 236,-32766,-32766,
0,-32766, 331, 0, 0, 0, 0, 0, 0,-32766,
31, 103, 104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 339, -137, -137, -137, 340, 343,
381, 469, 353, 354, 996,-32766,-32766,-32766, 577,-32766,
-137, 34, -137, 35, -137, 595, -137, 596, 746, 365,
823, 348, 940, 942, 807, 365,-32766, 264,-32766,-32766,
-32766, 425, 426, -460, 814, 877, 878, 425, 426, 804,
698, 789, 367, 368, 815, 744, 741, 789, 367, 368,
802, -218, -218, -218, 886, 889, 890, 365, 887, 888,
768, 288,-32766,-32766,-32766, 894, 768, -489, -4, 425,
426, 579, 768, 742, -137,-32766,-32766,-32766, 741, 789,
367, 368, 583,-32766, 584,-32766,-32766,-32766,-32766,-32766,
-32766, 586, 590, 283, 284, -460,-32766, 346,-32766,-32766,
-32766,-32766,-32766, 347, 768, 1118, -218, 578, -487, -460,
-32766,-32766,-32766, 1120, 701, 788, -460,-32766,-32766,-32766,
700, 710, 787, 711, 708, 1119, 786, 1006, 709, 775,
783,-32766, 773,-32766,-32766,-32766,-32766, 812,-32766, 813,
-32766,-32766, 1117, 1076, 1069, 1083, 1088, 1091, 0, -465,
0, -464, -463, 23, 25, 26, 33, 37, 41, 67,
70, 71, 72, 73, 74, 128, 135, 140, 227, 241,
242, 243, 244, 245, 246, 287, 349, 351, 0, -237,
-235, -234, 14, 15, 16, 17, 19, 323, 399, 401,
404, 406, 407, 414, 565, 1029, 979, 1039, 859, 1010,
-92, 13, 18, 22, 260, 322, 496, 520, 0, 567,
983, 980, 1094, 0, 0, 1038, 1067, 1068, 1082, 1115,
530, 0, 1056
112, 113, 114, 115, 334, -137, -137, -137, 12, 24,
302, 339, 595, 340, -489,-32766,-32766,-32766, 343,-32766,
-137, 1075, -137, 381, -137, 1041, -137, 469, 353, 365,
354, 348, 940, 942, 596, 365,-32766, 264,-32766,-32766,
746, 425, 426, -460, 823, 807, 814, 425, 426, 877,
698, 789, 367, 368, 878, 1018, 741, 789, 367, 368,
804, -218, -218, -218, 815, 744, 802, 365, 886, 889,
890, 288, 430, 431, 887, 888, 768, 768, -4, 425,
426, 894, 768, -487, -137,-32766,-32766,-32766, 741, 789,
367, 368, 592, 575, 68, 577, 579, 583, 270, 275,
584, 586, 590, 283, 284, -460,-32766, 346,-32766,-32766,
-32766,-32766,-32766,-32766, 768, 742, -218, 347, 578, -460,
-32766,-32766,-32766, 1118, 1120, 701, -460, -465, 788, 700,
710, 787, 711, 708, 1119, 786, 1006, 709, 775, 783,
773,-32766, 812,-32766,-32766,-32766,-32766, 813, 1117, 1076,
1069, 1083, 1088, 1091, 0, -464, -463, 23, 25, 26,
0, 33, 37, 41, 67, 70, 71, 72, 73, 74,
128, 135, 140, 227, 241, 242, 243, 244, 245, 246,
287, 349, 351, 0, -237, -235, -234, 14, 15, 16,
17, 19, 323, 399, 401, 404, 406, 407, 414, 565,
1029, 979, 1039, 859, 1010, -92, 13, 18, 22, 260,
322, 496, 520, 567, 983, 980, 1094, 0, -431, 996,
0, 1038, 1067, 1068, 1082, 1115, 530
);
protected $actionCheck = array(
@ -336,100 +335,99 @@ class Php7 extends \PhpParser\ParserAbstract
48, 49, 50, 78, 8, 9, 10, 97, 98, 99,
8, 9, 29, 103, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41, 115, 116, 114, 115, 116,
117, 118, 119, 55, 124, 125, 126, 127, 1, 114,
115, 116, 117, 118, 119, 7, 0, 69, 70, 71,
72, 73, 74, 75, 7, 80, 78, 48, 49, 50,
150, 7, 152, 85, 86, 87, 88, 89, 90, 91,
117, 118, 119, 55, 124, 125, 126, 127, 0, 114,
115, 116, 117, 118, 119, 73, 74, 69, 70, 71,
72, 73, 74, 75, 1, 30, 78, 48, 49, 50,
150, 1, 152, 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, 13, 131,
132, 133, 134, 135, 136, 137, 138, 139, 8, 8,
122, 123, 124, 125, 126, 127, 128, 129, 7, 131,
132, 133, 134, 135, 136, 137, 138, 139, 68, 8,
9, 10, 7, 145, 146, 147, 1, 2, 3, 4,
5, 6, 1, 158, 1, 151, 11, 12, 148, 14,
29, 151, 31, 32, 33, 34, 35, 36, 37, 38,
5, 6, 1, 7, 1, 151, 11, 12, 30, 14,
29, 7, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, 52, 53, 29, 55, 78, 68, 13,
8, 9, 10, 48, 49, 13, 7, 30, 67, 54,
30, 56, 57, 58, 59, 60, 61, 62, 63, 64,
65, 66, 154, 68, 69, 70, 71, 72, 8, 9,
10, 76, 77, 78, 103, 80, 105, 82, 1, 84,
85, 86, 87, 80, 89, 7, 91, 7, 93, 29,
1, 96, 73, 74, 1, 100, 101, 102, 103, 104,
130, 106, 107, 7, 145, 110, 1, 148, 113, 114,
7, 152, 68, 36, 144, 7, 121, 122, 123, 148,
68, 151, 1, 153, 80, 30, 131, 132, 84, 134,
135, 136, 137, 138, 139, 140, 30, 1, 132, 133,
145, 146, 147, 148, 80, 78, 151, 83, 153, 72,
155, 150, 157, 158, 151, 78, 30, 7, 114, 82,
154, 158, 85, 86, 87, 1, 89, 150, 91, 36,
93, 151, 36, 96, 1, 83, 132, 100, 101, 102,
154, 7, 130, 106, 107, 80, 68, 110, 95, 1,
113, 114, 103, 154, 105, 13, 144, 153, 121, 78,
111, 68, 158, 151, 29, 153, 142, 143, 72, 120,
1, 1, 145, 80, 78, 148, 7, 84, 82, 114,
49, 50, 51, 52, 53, 13, 55, 78, 68, 8,
103, 29, 105, 48, 49, 1, 151, 30, 67, 54,
130, 56, 57, 58, 59, 60, 61, 62, 63, 64,
65, 66, 1, 68, 69, 70, 71, 72, 8, 9,
10, 76, 77, 78, 151, 80, 7, 82, 1, 84,
85, 86, 87, 80, 89, 148, 91, 7, 93, 29,
49, 96, 103, 7, 105, 100, 101, 102, 103, 104,
130, 106, 107, 68, 145, 110, 1, 148, 113, 114,
13, 152, 80, 36, 144, 83, 121, 122, 123, 78,
7, 151, 81, 153, 80, 154, 131, 132, 150, 134,
135, 136, 137, 138, 139, 140, 7, 1, 30, 78,
145, 146, 147, 148, 132, 133, 151, 1, 153, 72,
155, 150, 157, 158, 151, 78, 13, 1, 114, 82,
1, 158, 85, 86, 87, 130, 89, 150, 91, 125,
93, 68, 36, 96, 142, 143, 154, 100, 101, 102,
8, 9, 10, 106, 107, 80, 151, 110, 29, 1,
113, 114, 8, 9, 10, 51, 52, 53, 121, 55,
80, 29, 158, 31, 32, 33, 34, 35, 72, 30,
68, 67, 151, 29, 78, 31, 32, 33, 82, 114,
7, 85, 86, 87, 36, 89, 149, 91, 151, 93,
125, 154, 96, 141, 154, 1, 100, 101, 102, 29,
7, 152, 106, 107, 80, 150, 110, 114, 130, 113,
114, 51, 52, 53, 29, 55, 150, 121, 30, 30,
72, 7, 144, 158, 131, 132, 78, 67, 49, 151,
82, 68, 151, 85, 86, 87, 150, 89, 114, 91,
7, 93, 1, 68, 96, 149, 153, 151, 100, 101,
102, 158, 98, 99, 106, 107, 7, 78, 110, 7,
81, 113, 114, 154, 7, 156, 72, 132, 133, 121,
73, 74, 78, 79, 68, 1, 82, 36, 13, 85,
86, 87, 158, 89, 151, 91, 103, 93, 105, 154,
96, 132, 133, 130, 100, 101, 102, 149, 15, 151,
106, 107, 132, 133, 110, 130, 15, 113, 114, 15,
36, 103, 104, 72, 151, 121, 15, 132, 133, 78,
103, 15, 105, 82, 108, 109, 85, 86, 87, 1,
89, 103, 91, 105, 93, 15, 130, 96, 150, 150,
78, 154, 96, 130, 154, 1, 100, 101, 102, 29,
154, 95, 106, 107, 7, 30, 110, 144, 29, 113,
114, 30, 83, 103, 151, 105, 153, 121, 150, 103,
72, 105, 1, 158, 73, 74, 78, 111, 7, 103,
82, 105, 130, 85, 86, 87, 120, 89, 158, 91,
148, 93, 1, 151, 96, 149, 144, 151, 100, 101,
102, 132, 133, 151, 106, 107, 7, 145, 110, 7,
148, 113, 114, 154, 7, 156, 72, 7, 152, 121,
141, 13, 78, 79, 7, 1, 82, 36, 7, 85,
86, 87, 7, 89, 7, 91, 30, 93, 68, 150,
96, 98, 99, 68, 100, 101, 102, 149, 15, 151,
106, 107, 132, 133, 110, 80, 15, 113, 114, 84,
36, 132, 133, 72, 15, 121, 8, 9, 10, 78,
15, 13, 15, 82, 154, 150, 85, 86, 87, 1,
89, 150, 91, 154, 93, 103, 104, 96, 15, 114,
15, 100, 101, 102, 15, 151, 72, 106, 107, 30,
144, 110, 78, 30, 113, 114, 82, 151, 30, 85,
86, 87, 121, 89, 30, 91, 30, 93, 30, 1,
96, 150, 151, 30, 100, 101, 102, 36, 34, 34,
106, 107, 34, 67, 110, 55, 68, 113, 114, 68,
75, 78, 151, 81, 80, 121, 87, 80, 88, 92,
72, 90, 78, 95, 78, 83, 78, 111, 128, 112,
82, 125, 114, 85, 86, 87, 83, 89, 125, 91,
128, 93, 95, 141, 96, 151, 0, 95, 100, 101,
102, 94, 97, 129, 106, 107, 97, 148, 110, 144,
72, 113, 114, 141, 144, 155, 78, 144, 149, 121,
82, -1, -1, 85, 86, 87, 151, 89, -1, 91,
-1, 93, -1, -1, 96, -1, -1, -1, 100, 101,
102, -1, -1, -1, 106, 107, -1, -1, 110, 151,
-1, 113, 114, 152, 144, -1, -1, -1, -1, 121,
130, 110, 78, 36, 113, 114, 82, 132, 30, 85,
86, 87, 121, 89, 144, 91, 30, 93, 30, 1,
96, 151, 108, 109, 100, 101, 102, 30, 153, 30,
106, 107, 157, 158, 110, 132, 133, 113, 114, 150,
151, 34, 151, 34, 34, 121, 55, 67, 78, 68,
72, 68, 75, 81, 78, 87, 78, 83, 92, 88,
82, 97, 78, 85, 86, 87, 112, 89, 83, 91,
80, 93, 80, 111, 96, 151, 0, 90, 100, 101,
102, 125, 129, 94, 106, 107, 125, 128, 110, 95,
72, 113, 114, 95, 144, 95, 78, 149, 97, 121,
82, 141, 150, 85, 86, 87, 141, 89, 157, 91,
114, 93, -1, 150, 96, -1, -1, -1, 100, 101,
102, 128, -1, -1, 106, 107, 144, 36, 110, 151,
-1, 113, 114, -1, -1, -1, -1, -1, -1, 121,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 148, 73, 74, 75, 148, 148,
148, 148, 148, 148, 155, 8, 9, 10, 151, 151,
88, 150, 90, 150, 92, 150, 94, 150, 150, 103,
150, 105, 57, 58, 150, 103, 29, 111, 31, 32,
33, 115, 116, 68, 150, 150, 150, 115, 116, 150,
124, 125, 126, 127, 150, 150, 124, 125, 126, 127,
25, 26, 27, 28, 148, 73, 74, 75, 144, 68,
144, 148, 150, 148, 153, 8, 9, 10, 148, 151,
88, 80, 90, 148, 92, 84, 94, 148, 148, 103,
148, 105, 57, 58, 150, 103, 29, 111, 31, 32,
150, 115, 116, 68, 150, 150, 150, 115, 116, 150,
124, 125, 126, 127, 150, 114, 124, 125, 126, 127,
150, 97, 98, 99, 150, 150, 150, 103, 150, 150,
150, 145, 8, 9, 10, 150, 150, 153, 152, 115,
116, 151, 150, 152, 152, 8, 9, 10, 124, 125,
126, 127, 151, 29, 151, 31, 32, 33, 34, 35,
36, 151, 151, 151, 151, 130, 29, 151, 31, 32,
33, 34, 35, 151, 150, 152, 152, 151, 153, 144,
8, 9, 10, 152, 152, 152, 151, 8, 9, 10,
150, 145, 131, 132, 150, 150, 150, 150, 152, 115,
116, 150, 150, 153, 152, 8, 9, 10, 124, 125,
126, 127, 152, 151, 153, 151, 151, 151, 157, 158,
151, 151, 151, 151, 151, 130, 29, 151, 31, 32,
33, 34, 35, 36, 150, 152, 152, 151, 151, 144,
8, 9, 10, 152, 152, 152, 151, 153, 152, 152,
152, 152, 152, 152, 152, 152, 152, 152, 152, 152,
152, 29, 152, 31, 32, 33, 34, 152, 29, 152,
31, 32, 152, 152, 152, 152, 152, 152, -1, 153,
152, 29, 152, 31, 32, 33, 34, 152, 152, 152,
152, 152, 152, 152, -1, 153, 153, 153, 153, 153,
-1, 153, 153, 153, 153, 153, 153, 153, 153, 153,
153, 153, 153, 153, 153, 153, 153, 153, 153, 153,
153, 153, 153, 153, 153, 153, 153, 153, -1, 154,
153, 153, 153, -1, 154, 154, 154, 154, 154, 154,
154, 154, 154, 154, 154, 154, 154, 154, 154, 154,
154, 154, 154, 154, 154, 154, 154, 154, 154, 154,
154, 154, 154, 154, 154, 154, 154, 154, -1, 154,
154, 154, 154, -1, -1, 156, 156, 156, 156, 156,
156, -1, 157
154, 154, 154, 154, 154, 154, 154, -1, 155, 155,
-1, 156, 156, 156, 156, 156, 156
);
protected $actionBase = array(
0, 622, 616, -70, 654, 153, 109, 609, -2, -2,
-55, -2, -2, 256, 378, 378, 379, 378, 245, 276,
610, 610, 610, 227, 286, 286, 286, 286, 338, 384,
0, 622, 616, -70, 654, 153, 109, 615, -2, -2,
-55, -2, -2, 258, 365, 365, 371, 365, 167, 329,
617, 617, 617, 227, 286, 286, 286, 286, 338, 384,
518, 431, 464, 558, 558, 558, 558, 558, 558, 558,
558, 558, 558, 558, 558, 558, 558, 558, 558, 558,
558, 558, 558, 558, 558, 558, 558, 558, 558, 558,
@ -441,50 +439,50 @@ class Php7 extends \PhpParser\ParserAbstract
558, 558, 558, 558, 558, 558, 558, 558, 558, 558,
558, 558, 558, 558, 558, 558, 558, 558, 558, 558,
558, 558, 558, 558, 558, 558, 558, 558, 558, 558,
558, 151, 151, 167, 243, 455, 750, 756, 752, 748,
747, 751, 757, 690, 691, 533, 692, 693, 694, 695,
753, 764, 749, 755, 131, 131, 131, 131, 131, 131,
558, 151, 151, 128, 296, 448, 745, 750, 747, 743,
742, 746, 751, 686, 687, 539, 688, 689, 690, 691,
748, 760, 744, 749, 131, 131, 131, 131, 131, 131,
131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
131, 130, 182, 22, 16, 16, 16, 16, 16, 16,
131, 181, 498, 22, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 210, 210, 210, 809,
697, 802, 665, 767, 754, 3, 3, 3, 3, 3,
-28, -28, -28, -28, 283, 283, 239, 194, 194, 194,
194, 194, 194, 194, 194, 194, 194, 255, 373, 29,
29, 156, 156, 156, 156, 156, 156, 325, 314, 360,
375, 242, 492, 765, 271, 271, 349, 349, 349, 120,
202, 350, 350, 350, 121, 523, 488, 488, 488, 488,
214, 214, 488, 488, 369, 4, 299, 268, 268, 396,
268, 268, 268, 418, 418, 418, 398, 217, 10, 512,
217, 615, 656, 758, 525, 685, 529, 687, 353, 554,
-5, 555, -5, -5, -5, 406, 169, 387, 746, 151,
485, 151, 151, 151, 151, 716, 151, 151, 151, 151,
151, 151, 170, 151, 57, 411, 167, 323, 323, 538,
323, 398, 520, 365, 642, 230, 520, 520, 520, 643,
646, 58, 176, 652, 189, 407, 503, 503, 514, 514,
507, 531, 503, 503, 503, 503, 503, 700, 700, 514,
504, 514, 507, 705, 514, 531, 531, 514, 514, 503,
514, 700, 531, 135, 423, 324, 363, 531, 531, 439,
470, 503, 482, 482, 442, 514, 246, 228, 514, 74,
494, 700, 700, 494, 253, 531, 258, 565, 567, 486,
489, 513, 300, 513, 513, 404, 486, 513, 531, 513,
447, 67, 504, 383, 513, 66, 706, 707, 509, 708,
703, 709, 723, 710, 495, 476, 483, 715, 704, 711,
702, 701, 528, 553, 473, 481, 490, 508, 699, 552,
506, 506, 506, 508, 696, 506, 506, 506, 506, 506,
506, 506, 506, 473, 759, 530, 499, 717, 484, 479,
522, 491, 557, 472, 553, 553, 621, 480, 549, 516,
716, 741, 712, 561, 496, 732, 718, 521, 546, 550,
719, 720, 733, 742, 620, 743, 653, 511, 661, 553,
662, 506, 655, 614, 760, 761, 698, 473, 762, 728,
734, 534, 535, 735, 551, 663, 502, 763, 668, 744,
631, 633, 563, 729, 725, 736, 669, 737, 738, 670,
568, 500, 726, 527, 724, 115, 722, 640, 671, 672,
673, 674, 675, 713, 570, 730, 497, 731, 727, 574,
584, 510, 676, 332, 585, 515, 519, 586, 714, 524,
505, 589, 594, 745, 677, 721, 595, 678, 740, 498,
552, 493, 487, 517, 501, 641, 739, 526, 600, 604,
605, 606, 680, 608, 0, 0, 0, 0, 0, 0,
16, 16, 16, 16, 16, 16, 210, 210, 210, 697,
334, 802, 665, 322, 767, 3, 3, 3, 3, 3,
-28, -28, -28, -28, 631, 631, 306, 415, 415, 415,
415, 415, 415, 415, 415, 415, 415, 194, 139, 29,
29, 360, 360, 360, 360, 360, 360, 369, 255, 309,
162, 319, 505, 491, 211, 211, 443, 443, 443, 120,
253, 294, 294, 294, 87, 525, 536, 536, 536, 536,
182, 182, 536, 536, 191, 4, 299, 292, 292, 410,
292, 292, 292, 316, 316, 316, 422, 302, 282, 514,
302, 621, 657, 752, 504, 680, 541, 685, 185, 570,
270, 572, 270, 270, 270, 454, -8, 341, 741, 151,
490, 151, 151, 151, 151, 711, 151, 151, 151, 151,
151, 151, 45, 151, 80, 429, 128, 73, 73, 550,
73, 422, 531, 70, 642, 236, 531, 531, 531, 643,
646, 121, 172, 656, 230, 300, 510, 510, 516, 516,
532, 507, 510, 510, 510, 510, 510, 694, 694, 516,
530, 516, 532, 700, 516, 507, 507, 516, 516, 510,
516, 694, 507, 154, 457, 439, 442, 507, 507, 461,
499, 510, 533, 533, 465, 516, 263, 219, 516, 146,
493, 694, 694, 493, 279, 507, 363, 552, 574, 502,
488, 509, 387, 509, 509, 450, 502, 509, 507, 509,
467, 135, 530, 447, 509, 58, 701, 702, 446, 703,
698, 704, 718, 705, 632, 496, 501, 710, 699, 706,
696, 695, 537, 569, 473, 481, 522, 521, 693, 565,
520, 520, 520, 521, 664, 520, 520, 520, 520, 520,
520, 520, 520, 473, 755, 556, 508, 712, 489, 546,
540, 495, 634, 500, 569, 569, 653, 753, 754, 524,
711, 736, 707, 492, 497, 727, 713, 630, 553, 555,
714, 715, 728, 737, 635, 738, 661, 523, 662, 569,
663, 520, 620, 551, 756, 757, 692, 473, 758, 723,
729, 547, 549, 730, 560, 666, 512, 759, 667, 739,
636, 639, 503, 724, 720, 731, 668, 732, 733, 669,
580, 511, 721, 529, 719, 247, 717, 640, 670, 671,
672, 673, 674, 708, 584, 725, 506, 726, 722, 585,
586, 513, 675, 293, 589, 515, 519, 594, 709, 526,
517, 600, 604, 740, 676, 716, 605, 677, 735, 534,
565, 554, 494, 538, 527, 641, 734, 528, 606, 608,
609, 610, 678, 614, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 145, 145, 145, 145, -2, -2, -2, 0, 0,
@ -509,19 +507,19 @@ class Php7 extends \PhpParser\ParserAbstract
131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
131, 131, 0, 131, 131, 131, 131, 131, 131, 131,
350, 350, 350, 350, 217, 217, -67, 217, 217, 217,
217, 217, 217, 217, 217, 217, 217, 217, -67, 350,
350, 217, 217, 217, 217, 217, 217, 217, 217, 217,
217, 214, 214, 214, -5, -5, 217, 217, 217, 0,
0, 0, 0, 0, 503, 214, 217, 217, 217, 217,
0, 0, 217, 217, 504, -5, 359, 0, 0, 0,
0, 0, 0, 503, 503, 503, 504, 0, 503, 214,
0, 323, 151, 359, 344, 344, 344, 344, 0, 503,
0, 503, 0, 0, 0, 0, 0, 0, 531, 0,
700, 0, 0, 0, 0, 514, 0, 0, 0, 0,
0, 0, 0, 0, 504, 0, 0, 0, 0, 504,
0, 0, 506, 0, 516, 0, 506, 506, 506, 516,
516, 0, 0, 516
294, 294, 294, 294, 302, 302, -67, 302, 302, 302,
302, 302, 302, 302, 302, 302, 302, 302, -67, 294,
294, 302, 302, 302, 302, 302, 302, 302, 302, 302,
302, 182, 182, 182, 270, 270, 302, 302, 302, 0,
0, 0, 0, 0, 510, 182, 302, 302, 302, 302,
0, 0, 302, 302, 530, 270, 411, 0, 0, 0,
0, 0, 0, 510, 510, 510, 530, 0, 510, 182,
0, 73, 151, 411, 383, 383, 383, 383, 0, 510,
0, 510, 0, 0, 0, 0, 0, 0, 507, 0,
694, 0, 0, 0, 0, 516, 0, 0, 0, 0,
0, 0, 0, 0, 530, 0, 0, 0, 0, 530,
0, 0, 520, 0, 524, 0, 520, 520, 520, 524,
524, 0, 0, 524
);
protected $actionDefault = array(
@ -550,7 +548,7 @@ class Php7 extends \PhpParser\ParserAbstract
370, 371, 372, 373,32767,32767,32767,32767,32767,32767,
32767,32767,32767,32767,32767, 94,32767,32767, 296, 358,
359, 253, 253, 253, 253, 253, 253, 253,32767,32767,
253,32767,32767,32767,32767,32767,32767,32767,32767, 452,
253,32767,32767,32767,32767,32767,32767,32767,32767, 453,
375, 353, 354, 352,32767, 430,32767,32767,32767,32767,
32767, 432,32767, 92,32767,32767,32767, 341, 343, 424,
501, 324, 504,32767,32767, 94, 418,32767,32767,32767,
@ -568,7 +566,7 @@ class Php7 extends \PhpParser\ParserAbstract
181, 255, 93, 255, 255, 93, 409, 255, 179, 255,
91, 91,32767, 91, 255,32767,32767,32767, 85,32767,
32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
32767,32767,32767, 420,32767, 440,32767, 453, 472,32767,
32767,32767,32767, 420,32767, 440,32767, 454, 472,32767,
361, 362, 364,32767, 462, 386, 387, 388, 389, 390,
391, 392, 394, 502,32767, 423,32767,32767,32767, 87,
121, 272,32767, 512, 87, 421,32767, 512,32767,32767,
@ -776,7 +774,7 @@ class Php7 extends \PhpParser\ParserAbstract
124, 127, 128, 128, 129, 130, 130, 130, 75, 75,
63, 63, 63, 120, 120, 120, 132, 132, 121, 121,
123, 123, 123, 126, 126, 137, 137, 137, 86, 139,
139, 139, 122, 122, 122, 122, 122, 122, 122, 122,
139, 139, 139, 122, 122, 122, 122, 122, 122, 122,
122, 122, 122, 122, 122, 122, 122, 122, 49, 49,
135, 135, 135, 131, 131, 131, 140, 140, 140, 140,
140, 140, 56, 56, 56, 98, 98, 98, 98, 143,
@ -832,8 +830,8 @@ class Php7 extends \PhpParser\ParserAbstract
4, 2, 1, 3, 2, 2, 2, 4, 1, 1,
1, 2, 3, 1, 1, 1, 1, 1, 0, 3,
0, 1, 1, 0, 1, 1, 3, 3, 3, 4,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 3, 2, 3, 3, 0, 1,
1, 1, 3, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 3, 2, 3, 0, 1,
1, 3, 1, 1, 3, 1, 1, 4, 4, 4,
1, 4, 1, 1, 3, 1, 4, 2, 2, 1,
3, 1, 4, 4, 3, 3, 3, 1, 3, 1,
@ -2201,50 +2199,50 @@ class Php7 extends \PhpParser\ParserAbstract
$this->semValue = new Scalar\String_(Scalar\String_::parse($this->semStack[$stackPos-(1-1)]), $attrs);
},
442 => function ($stackPos) {
$this->semValue = $this->parseLNumber($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
$attrs = $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED;
foreach ($this->semStack[$stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', true); } }; $this->semValue = new Scalar\Encapsed($this->semStack[$stackPos-(3-2)], $attrs);
},
443 => function ($stackPos) {
$this->semValue = new Scalar\DNumber(Scalar\DNumber::parse($this->semStack[$stackPos-(1-1)]), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
$this->semValue = $this->parseLNumber($this->semStack[$stackPos-(1-1)], $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
},
444 => function ($stackPos) {
$this->semValue = new Scalar\MagicConst\Line($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
$this->semValue = new Scalar\DNumber(Scalar\DNumber::parse($this->semStack[$stackPos-(1-1)]), $this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
},
445 => function ($stackPos) {
$this->semValue = new Scalar\MagicConst\File($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
$this->semValue = new Scalar\MagicConst\Line($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
},
446 => function ($stackPos) {
$this->semValue = new Scalar\MagicConst\Dir($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
$this->semValue = new Scalar\MagicConst\File($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
},
447 => function ($stackPos) {
$this->semValue = new Scalar\MagicConst\Class_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
$this->semValue = new Scalar\MagicConst\Dir($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
},
448 => function ($stackPos) {
$this->semValue = new Scalar\MagicConst\Trait_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
$this->semValue = new Scalar\MagicConst\Class_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
},
449 => function ($stackPos) {
$this->semValue = new Scalar\MagicConst\Method($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
$this->semValue = new Scalar\MagicConst\Trait_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
},
450 => function ($stackPos) {
$this->semValue = new Scalar\MagicConst\Function_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
$this->semValue = new Scalar\MagicConst\Method($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
},
451 => function ($stackPos) {
$this->semValue = new Scalar\MagicConst\Namespace_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
$this->semValue = new Scalar\MagicConst\Function_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
},
452 => function ($stackPos) {
$this->semValue = $this->semStack[$stackPos-(1-1)];
$this->semValue = new Scalar\MagicConst\Namespace_($this->startAttributeStack[$stackPos-(1-1)] + $this->endAttributes);
},
453 => function ($stackPos) {
$this->semValue = $this->semStack[$stackPos-(1-1)];
},
454 => function ($stackPos) {
$this->semValue = $this->parseDocString($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)], true);
$this->semValue = $this->semStack[$stackPos-(1-1)];
},
455 => function ($stackPos) {
$this->semValue = $this->parseDocString($this->semStack[$stackPos-(2-1)], '', $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(2-2)] + $this->endAttributeStack[$stackPos-(2-2)], true);
$this->semValue = $this->parseDocString($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)], true);
},
456 => function ($stackPos) {
$attrs = $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes; $attrs['kind'] = Scalar\String_::KIND_DOUBLE_QUOTED;
foreach ($this->semStack[$stackPos-(3-2)] as $s) { if ($s instanceof Node\Scalar\EncapsedStringPart) { $s->value = Node\Scalar\String_::parseEscapeSequences($s->value, '"', true); } }; $this->semValue = new Scalar\Encapsed($this->semStack[$stackPos-(3-2)], $attrs);
$this->semValue = $this->parseDocString($this->semStack[$stackPos-(2-1)], '', $this->semStack[$stackPos-(2-2)], $this->startAttributeStack[$stackPos-(2-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(2-2)] + $this->endAttributeStack[$stackPos-(2-2)], true);
},
457 => function ($stackPos) {
$this->semValue = $this->parseDocString($this->semStack[$stackPos-(3-1)], $this->semStack[$stackPos-(3-2)], $this->semStack[$stackPos-(3-3)], $this->startAttributeStack[$stackPos-(3-1)] + $this->endAttributes, $this->startAttributeStack[$stackPos-(3-3)] + $this->endAttributeStack[$stackPos-(3-3)], true);

View File

@ -5,6 +5,8 @@ Uniform variable syntax in PHP 7 (misc)
A::A[0];
A::A[0][1][2];
"string"->length();
"foo$bar"[0];
"foo$bar"->length();
(clone $obj)->b[0](1);
[0, 1][0] = 1;
-----
@ -67,6 +69,42 @@ array(
)
)
3: Stmt_Expression(
expr: Expr_ArrayDimFetch(
var: Scalar_Encapsed(
parts: array(
0: Scalar_EncapsedStringPart(
value: foo
)
1: Expr_Variable(
name: bar
)
)
)
dim: Scalar_LNumber(
value: 0
)
)
)
4: Stmt_Expression(
expr: Expr_MethodCall(
var: Scalar_Encapsed(
parts: array(
0: Scalar_EncapsedStringPart(
value: foo
)
1: Expr_Variable(
name: bar
)
)
)
name: Identifier(
name: length
)
args: array(
)
)
)
5: Stmt_Expression(
expr: Expr_FuncCall(
name: Expr_ArrayDimFetch(
var: Expr_PropertyFetch(
@ -94,7 +132,7 @@ array(
)
)
)
4: Stmt_Expression(
6: Stmt_Expression(
expr: Expr_Assign(
var: Expr_ArrayDimFetch(
var: Expr_Array(