From 944a343f0f6d5572dbb924587f001cc6d8241cf0 Mon Sep 17 00:00:00 2001 From: z7zmey Date: Thu, 7 Jun 2018 02:25:27 +0300 Subject: [PATCH] php5: save all comments --- php5/parser.go | 10 + php5/php5.go | 5888 ++++++++++++++++++++++++++++++------------------ php5/php5.y | 3026 ++++++++++++++++++------- php7/parser.go | 5 - php7/php7.go | 580 +++-- php7/php7.y | 33 +- 6 files changed, 6228 insertions(+), 3314 deletions(-) diff --git a/php5/parser.go b/php5/parser.go index c134e6f..7d353c5 100644 --- a/php5/parser.go +++ b/php5/parser.go @@ -106,3 +106,13 @@ func (l *Parser) GetComments() parser.Comments { func (l *Parser) GetPositions() parser.Positions { return l.positions } + +// helpers + +func lastNode(nn []node.Node) node.Node { + return nn[len(nn)-1] +} + +func firstNode(nn []node.Node) node.Node { + return nn[0] +} diff --git a/php5/php5.go b/php5/php5.go index 2a96dba..92ccf10 100644 --- a/php5/php5.go +++ b/php5/php5.go @@ -8,6 +8,7 @@ import ( "strconv" "strings" + "github.com/z7zmey/php-parser/comment" "github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node/expr" "github.com/z7zmey/php-parser/node/expr/assign" @@ -19,7 +20,7 @@ import ( "github.com/z7zmey/php-parser/scanner" ) -//line php5/php5.y:21 +//line php5/php5.y:22 type yySymType struct { yys int node node.Node @@ -345,7 +346,7 @@ const yyEofCode = 1 const yyErrCode = 2 const yyInitialStackSize = 16 -//line php5/php5.y:4005 +//line php5/php5.y:5483 type simpleIndirectReference struct { all []*expr.Variable @@ -455,12 +456,12 @@ var yyExca = [...]int{ -1, 462, 104, 435, 105, 435, - 147, 514, - 158, 514, - -2, 433, - -1, 463, 147, 515, 158, 515, + -2, 433, + -1, 463, + 147, 516, + 158, 516, -2, 430, -1, 464, 104, 435, @@ -478,10 +479,10 @@ var yyExca = [...]int{ -2, 433, -1, 493, 146, 472, - -2, 516, + -2, 517, -1, 499, 146, 472, - -2, 517, + -2, 518, -1, 521, 78, 332, -2, 369, @@ -506,362 +507,391 @@ var yyExca = [...]int{ 144, 309, 147, 309, -2, 433, - -1, 681, + -1, 682, 78, 334, -2, 371, - -1, 779, - 134, 0, - 135, 0, - 136, 0, - 137, 0, - -2, 397, -1, 780, 134, 0, 135, 0, 136, 0, 137, 0, - -2, 398, + -2, 397, -1, 781, 134, 0, 135, 0, 136, 0, 137, 0, - -2, 399, + -2, 398, -1, 782, 134, 0, 135, 0, 136, 0, 137, 0, - -2, 400, + -2, 399, -1, 783, - 138, 0, - 139, 0, - 165, 0, - 166, 0, - -2, 401, + 134, 0, + 135, 0, + 136, 0, + 137, 0, + -2, 400, -1, 784, 138, 0, 139, 0, 165, 0, 166, 0, - -2, 402, + -2, 401, -1, 785, 138, 0, 139, 0, 165, 0, 166, 0, - -2, 403, + -2, 402, -1, 786, 138, 0, 139, 0, 165, 0, 166, 0, + -2, 403, + -1, 787, + 138, 0, + 139, 0, + 165, 0, + 166, 0, -2, 404, - -1, 789, + -1, 790, 78, 333, -2, 370, - -1, 839, + -1, 840, 37, 201, -2, 198, - -1, 879, + -1, 880, 31, 128, 32, 128, 33, 128, 143, 128, -2, 0, - -1, 914, + -1, 915, 95, 140, -2, 0, - -1, 916, + -1, 917, 31, 127, 32, 127, 33, 127, 143, 127, -2, 0, - -1, 943, + -1, 944, 93, 136, 94, 136, 95, 136, -2, 0, - -1, 971, + -1, 972, 29, 189, -2, 4, - -1, 980, + -1, 981, 147, 142, -2, 147, - -1, 997, + -1, 998, 144, 193, -2, 195, } const yyPrivate = 57344 -const yyLast = 9012 +const yyLast = 8982 var yyAct = [...]int{ - 102, 571, 843, 565, 1006, 965, 714, 807, 420, 826, - 123, 131, 606, 200, 340, 918, 734, 567, 452, 815, - 474, 683, 296, 594, 461, 592, 421, 61, 579, 142, - 319, 315, 39, 98, 264, 390, 158, 517, 130, 2, - 444, 115, 289, 978, 959, 118, 138, 140, 447, 544, - 145, 485, 937, 657, 663, 664, 228, 228, 162, 477, - 657, 331, 934, 941, 7, 940, 931, 821, 330, 737, - 653, 6, 43, 26, 655, 654, 709, 653, 562, 939, - 657, 267, 44, 516, 656, 658, 659, 358, 432, 665, - 325, 656, 658, 659, 953, 932, 1002, 653, 735, 921, - 251, 655, 654, 793, 298, 954, 897, 853, 153, 933, - 586, 656, 658, 659, 270, 728, 665, 137, 586, 543, - 898, 493, 272, 121, 192, 204, 311, 632, 192, 316, - 320, 618, 585, 323, 114, 258, 329, 241, 633, 5, - 510, 305, 619, 586, 450, 121, 121, 192, 499, 121, - 121, 657, 663, 664, 511, 560, 339, 141, 677, 678, - 126, 228, 121, 494, 310, 179, 561, 39, 653, 179, - 182, 183, 655, 654, 159, 475, 357, 201, 556, 162, - 506, 976, 656, 658, 659, 675, 676, 665, 179, 557, - 177, 176, 359, 267, 507, 228, 178, 180, 181, 929, - 178, 180, 181, 907, 117, 175, 360, 906, 355, 177, - 176, 350, 904, 241, 126, 271, 121, 104, 861, 178, - 180, 181, 356, 228, 175, 351, 270, 386, 126, 229, - 121, 425, 230, 352, 272, 312, 210, 211, 212, 213, - 214, 215, 216, 217, 218, 219, 220, 221, 233, 313, - 302, 133, 657, 451, 855, 791, 595, 745, 301, 639, - 232, 232, 228, 717, 300, 134, 620, 631, 120, 653, - 456, 630, 624, 231, 231, 333, 451, 336, 393, 209, - 451, 623, 611, 229, 597, 273, 230, 453, 610, 749, - 120, 120, 353, 228, 303, 120, 596, 229, 265, 595, - 230, 473, 233, 440, 748, 449, 604, 120, 294, 446, - 295, 293, 287, 281, 131, 396, 233, 1018, 509, 160, - 977, 490, 513, 254, 241, 253, 521, 271, 1001, 950, - 915, 472, 885, 882, 504, 870, 825, 814, 930, 727, - 39, 449, 693, 434, 634, 492, 449, 740, 491, 502, - 498, 399, 505, 497, 625, 716, 621, 463, 465, 521, - 430, 120, 428, 307, 913, 232, 541, 1013, 980, 892, - 467, 484, 7, 139, 297, 120, 471, 297, 231, 6, - 486, 824, 479, 480, 818, 809, 808, 192, 548, 495, - 593, 682, 436, 437, 439, 546, 552, 273, 448, 232, - 587, 572, 564, 572, 577, 572, 580, 458, 228, 551, - 265, 400, 231, 537, 344, 288, 278, 345, 437, 436, - 436, 295, 437, 275, 274, 588, 39, 232, 179, 182, - 183, 250, 222, 196, 448, 189, 191, 195, 194, 448, - 231, 144, 122, 1010, 876, 1009, 999, 5, 490, 177, - 176, 135, 539, 989, 984, 540, 615, 983, 923, 178, - 180, 181, 188, 190, 175, 912, 232, 609, 449, 449, - 703, 704, 492, 498, 880, 491, 497, 811, 805, 231, - 804, 309, 798, 308, 712, 1019, 699, 400, 581, 228, - 703, 704, 547, 545, 542, 501, 449, 232, 616, 449, - 614, 449, 398, 446, 348, 617, 156, 981, 316, 905, - 231, 126, 320, 605, 637, 638, 975, 521, 917, 891, - 641, 642, 890, 888, 681, 732, 521, 578, 306, 197, - 435, 179, 39, 521, 521, 521, 521, 521, 192, 645, - 224, 225, 648, 531, 874, 802, 803, 830, 635, 695, - 696, 650, 572, 257, 652, 710, 647, 700, 228, 228, - 228, 448, 448, 521, 7, 572, 718, 295, 726, 39, - 39, 6, 91, 126, 515, 731, 531, 572, 580, 179, - 126, 810, 729, 125, 612, 267, 259, 228, 228, 448, - 730, 438, 448, 713, 448, 705, 739, 707, 680, 455, - 723, 702, 424, 125, 295, 733, 987, 128, 129, 295, - 687, 504, 232, 738, 126, 459, 742, 741, 270, 736, - 126, 454, 126, 569, 570, 231, 272, 295, 228, 971, - 228, 518, 427, 426, 304, 512, 744, 449, 299, 5, - 126, 446, 573, 124, 754, 574, 282, 286, 469, 686, - 260, 261, 132, 816, 521, 521, 521, 521, 521, 521, + 102, 571, 844, 565, 1007, 966, 715, 61, 420, 827, + 123, 131, 919, 200, 340, 594, 567, 607, 452, 816, + 461, 808, 474, 735, 592, 684, 138, 140, 421, 142, + 145, 390, 39, 98, 444, 579, 264, 517, 118, 319, + 158, 315, 331, 330, 447, 7, 6, 544, 485, 130, + 2, 43, 26, 979, 960, 938, 228, 228, 162, 477, + 935, 942, 289, 941, 44, 670, 658, 664, 665, 672, + 673, 674, 675, 678, 679, 932, 822, 940, 658, 1003, + 251, 267, 738, 654, 258, 710, 662, 656, 655, 562, + 153, 658, 664, 665, 661, 654, 663, 657, 659, 660, + 676, 677, 666, 516, 298, 358, 325, 204, 654, 657, + 659, 660, 656, 655, 270, 736, 241, 137, 933, 794, + 954, 898, 657, 659, 660, 192, 311, 666, 729, 316, + 320, 955, 934, 323, 922, 899, 329, 854, 633, 5, + 543, 510, 126, 619, 121, 586, 121, 192, 586, 634, + 121, 658, 664, 665, 620, 511, 339, 141, 678, 679, + 585, 228, 159, 560, 114, 475, 179, 39, 654, 977, + 556, 586, 656, 655, 561, 310, 357, 115, 930, 162, + 432, 557, 657, 659, 660, 676, 677, 666, 179, 182, + 183, 718, 241, 267, 506, 228, 201, 178, 180, 181, + 908, 493, 296, 121, 359, 450, 595, 121, 507, 177, + 176, 229, 352, 355, 230, 907, 905, 104, 360, 178, + 180, 181, 862, 228, 175, 856, 270, 356, 117, 386, + 233, 425, 350, 658, 664, 665, 672, 673, 674, 675, + 678, 679, 312, 494, 792, 271, 351, 126, 746, 121, + 654, 1019, 640, 662, 656, 655, 313, 133, 272, 658, + 393, 661, 228, 663, 657, 659, 660, 676, 677, 666, + 456, 134, 301, 231, 231, 333, 654, 336, 300, 750, + 302, 612, 632, 717, 232, 232, 499, 611, 121, 120, + 631, 120, 126, 228, 121, 303, 423, 741, 265, 604, + 625, 624, 446, 241, 605, 1002, 595, 160, 978, 273, + 126, 597, 121, 596, 131, 396, 229, 931, 509, 230, + 473, 305, 513, 749, 294, 293, 521, 287, 440, 281, + 254, 253, 951, 451, 916, 233, 886, 451, 492, 463, + 39, 436, 437, 498, 491, 883, 541, 871, 120, 497, + 484, 472, 120, 7, 6, 658, 826, 271, 815, 521, + 502, 229, 486, 505, 230, 295, 728, 437, 436, 436, + 272, 437, 654, 584, 694, 635, 656, 655, 231, 229, + 233, 626, 230, 430, 399, 428, 657, 659, 660, 232, + 307, 666, 548, 546, 120, 914, 552, 593, 233, 1014, + 981, 572, 893, 572, 577, 572, 580, 139, 228, 297, + 265, 825, 231, 819, 126, 126, 121, 121, 451, 439, + 683, 273, 877, 232, 587, 588, 39, 564, 448, 297, + 810, 809, 192, 120, 551, 434, 400, 458, 537, 120, + 231, 449, 353, 344, 288, 278, 345, 5, 275, 274, + 250, 232, 539, 295, 222, 540, 616, 120, 196, 195, + 194, 144, 467, 122, 448, 492, 498, 453, 471, 448, + 581, 491, 497, 179, 479, 480, 1011, 449, 1010, 231, + 135, 495, 449, 229, 268, 1000, 230, 269, 990, 228, + 232, 985, 617, 615, 177, 176, 446, 984, 618, 704, + 705, 490, 233, 233, 178, 180, 181, 924, 316, 175, + 231, 913, 320, 309, 504, 308, 881, 521, 126, 812, + 400, 232, 704, 705, 682, 806, 521, 805, 799, 713, + 700, 547, 39, 521, 521, 521, 521, 521, 545, 542, + 501, 398, 348, 531, 91, 7, 6, 156, 636, 646, + 982, 649, 572, 906, 653, 711, 606, 701, 228, 228, + 228, 120, 120, 521, 1020, 572, 719, 976, 727, 39, + 39, 918, 892, 891, 889, 732, 531, 572, 580, 733, + 578, 306, 730, 197, 435, 267, 192, 228, 228, 714, + 125, 448, 448, 706, 179, 708, 740, 224, 225, 875, + 724, 831, 803, 804, 449, 449, 295, 518, 743, 731, + 811, 681, 734, 455, 613, 739, 742, 126, 270, 448, + 126, 737, 448, 424, 448, 231, 126, 179, 490, 228, + 745, 228, 449, 703, 446, 449, 232, 449, 259, 5, + 651, 755, 257, 438, 696, 697, 125, 610, 988, 688, + 124, 459, 648, 128, 129, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, 521, - 521, 789, 743, 521, 54, 758, 321, 756, 295, 757, - 864, 573, 317, 232, 574, 508, 259, 720, 573, 750, - 595, 574, 463, 322, 790, 792, 231, 285, 62, 126, - 521, 121, 132, 126, 468, 121, 486, 228, 126, 271, - 121, 457, 263, 799, 576, 404, 402, 795, 208, 572, - 448, 831, 207, 985, 531, 827, 572, 850, 819, 823, - 226, 234, 1007, 531, 45, 725, 828, 813, 295, 832, - 531, 531, 531, 531, 531, 851, 295, 856, 423, 453, - 260, 261, 232, 232, 232, 742, 986, 609, 163, 796, - 559, 858, 239, 338, 1017, 231, 231, 231, 229, 991, - 531, 230, 268, 957, 955, 269, 925, 229, 521, 273, - 230, 232, 232, 45, 521, 521, 896, 233, 259, 584, - 893, 233, 265, 438, 231, 231, 233, 847, 848, 849, - 846, 845, 844, 599, 878, 601, 600, 228, 550, 228, - 877, 1003, 521, 883, 881, 572, 889, 884, 998, 854, - 875, 960, 232, 800, 232, 935, 901, 859, 860, 820, - 126, 760, 900, 572, 903, 231, 759, 231, 722, 651, - 39, 649, 259, 1, 646, 259, 120, 284, 602, 887, - 120, 470, 260, 261, 259, 120, 514, 228, 899, 438, - 521, 531, 531, 531, 531, 531, 531, 531, 531, 531, + 521, 521, 790, 759, 521, 463, 573, 126, 757, 574, + 758, 515, 321, 295, 638, 639, 454, 721, 132, 486, + 642, 643, 260, 261, 800, 295, 231, 842, 793, 791, + 427, 521, 972, 843, 426, 304, 841, 232, 228, 848, + 849, 850, 847, 846, 845, 299, 126, 687, 126, 469, + 572, 817, 832, 865, 531, 282, 286, 572, 851, 820, + 512, 508, 259, 531, 295, 259, 829, 438, 814, 271, + 531, 531, 531, 531, 531, 322, 852, 833, 743, 317, + 448, 595, 272, 857, 859, 457, 468, 848, 849, 850, + 847, 846, 845, 449, 744, 231, 231, 231, 569, 570, + 531, 573, 263, 576, 574, 285, 232, 232, 232, 521, + 192, 504, 751, 295, 295, 521, 521, 573, 132, 404, + 574, 402, 265, 208, 231, 231, 260, 261, 295, 260, + 261, 876, 895, 273, 207, 232, 232, 986, 228, 828, + 228, 878, 824, 521, 884, 882, 572, 890, 885, 879, + 1008, 179, 182, 183, 801, 726, 45, 987, 189, 191, + 821, 559, 259, 901, 572, 904, 231, 438, 231, 338, + 1018, 39, 177, 176, 62, 54, 259, 232, 992, 232, + 888, 284, 178, 180, 181, 188, 190, 175, 228, 900, + 519, 521, 531, 531, 531, 531, 531, 531, 531, 531, 531, 531, 531, 531, 531, 531, 531, 531, 531, 531, - 531, 531, 531, 531, 531, 531, 531, 531, 519, 259, - 531, 922, 481, 259, 283, 908, 449, 395, 256, 39, - 446, 324, 521, 936, 203, 285, 260, 261, 469, 260, - 261, 232, 202, 199, 136, 879, 909, 531, 260, 261, - 829, 519, 521, 747, 231, 521, 873, 753, 521, 863, - 572, 962, 572, 970, 39, 445, 39, 812, 703, 704, - 706, 703, 704, 608, 39, 589, 39, 39, 590, 591, - 521, 684, 255, 260, 261, 572, 970, 260, 261, 956, - 982, 839, 958, 39, 994, 961, 964, 39, 39, 521, - 963, 572, 902, 483, 993, 895, 572, 995, 838, 997, - 835, 566, 1005, 1004, 914, 724, 916, 979, 394, 448, - 389, 164, 39, 572, 1011, 531, 924, 341, 926, 927, - 1012, 531, 531, 697, 572, 1015, 992, 538, 928, 919, - 39, 232, 919, 232, 290, 558, 460, 161, 157, 318, - 314, 943, 127, 403, 231, 947, 231, 575, 948, 531, - 401, 335, 944, 1008, 39, 343, 938, 528, 607, 996, - 39, 969, 945, 968, 967, 966, 837, 836, 834, 40, - 568, 15, 14, 822, 972, 719, 801, 694, 11, 249, - 75, 232, 76, 116, 266, 64, 89, 598, 90, 520, - 101, 74, 12, 326, 231, 100, 99, 531, 79, 519, - 119, 526, 3, 990, 41, 0, 0, 0, 519, 0, - 0, 0, 0, 0, 0, 519, 519, 519, 519, 519, - 0, 0, 0, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 0, 0, 0, 1014, 531, - 0, 0, 0, 0, 0, 519, 0, 1020, 0, 0, - 169, 171, 170, 192, 0, 0, 0, 0, 0, 531, - 0, 0, 531, 0, 0, 531, 209, 685, 0, 0, - 0, 0, 0, 0, 688, 689, 690, 691, 692, 0, - 0, 0, 0, 0, 0, 0, 0, 531, 0, 0, - 0, 0, 167, 168, 179, 182, 183, 184, 185, 186, - 187, 189, 191, 0, 0, 0, 531, 809, 808, 0, - 0, 0, 0, 193, 173, 177, 176, 0, 0, 0, - 0, 0, 172, 0, 174, 178, 180, 181, 188, 190, - 175, 0, 0, 0, 0, 0, 519, 519, 519, 519, + 531, 531, 531, 531, 531, 531, 531, 531, 531, 923, + 909, 531, 958, 519, 446, 470, 260, 261, 796, 163, + 39, 226, 234, 521, 937, 813, 704, 705, 239, 285, + 260, 261, 855, 707, 704, 705, 880, 910, 531, 259, + 860, 861, 956, 521, 45, 231, 521, 874, 926, 521, + 453, 572, 963, 572, 971, 39, 232, 39, 610, 599, + 797, 601, 600, 897, 259, 39, 894, 39, 39, 283, + 259, 521, 550, 1004, 999, 256, 572, 971, 961, 936, + 957, 983, 902, 959, 39, 126, 962, 761, 39, 39, + 521, 760, 572, 723, 652, 994, 650, 572, 996, 647, + 998, 602, 469, 260, 261, 915, 514, 917, 980, 481, + 395, 324, 203, 39, 572, 1012, 531, 925, 202, 927, + 928, 1013, 531, 531, 199, 572, 1016, 993, 260, 261, + 920, 39, 136, 920, 260, 261, 1, 830, 748, 754, + 448, 864, 944, 445, 609, 231, 948, 231, 589, 949, + 531, 842, 590, 449, 591, 39, 232, 843, 232, 685, + 841, 39, 255, 946, 840, 995, 965, 964, 903, 483, + 896, 519, 839, 836, 566, 973, 1006, 1005, 725, 394, + 519, 389, 164, 341, 698, 538, 929, 519, 519, 519, + 519, 519, 290, 460, 161, 231, 157, 318, 531, 314, + 127, 403, 575, 401, 991, 335, 232, 945, 1009, 343, + 939, 848, 849, 850, 847, 846, 845, 519, 528, 608, + 997, 970, 969, 968, 967, 838, 169, 171, 170, 192, + 837, 835, 40, 568, 15, 14, 823, 720, 802, 1015, + 531, 695, 11, 686, 249, 75, 76, 116, 1021, 266, + 689, 690, 691, 692, 693, 64, 834, 89, 598, 90, + 531, 520, 101, 531, 74, 12, 531, 326, 167, 168, + 179, 182, 183, 184, 185, 186, 187, 189, 191, 100, + 99, 79, 119, 810, 809, 526, 3, 41, 531, 193, + 173, 177, 176, 0, 0, 0, 0, 0, 172, 0, + 174, 178, 180, 181, 188, 190, 175, 531, 0, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, 519, - 519, 519, 519, 0, 0, 519, 0, 0, 0, 0, + 519, 519, 519, 519, 519, 519, 0, 0, 519, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 668, 666, 667, 0, 0, 0, 0, - 0, 0, 519, 0, 0, 761, 762, 763, 764, 765, - 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, - 776, 777, 778, 779, 780, 781, 782, 783, 784, 785, - 786, 788, 0, 0, 685, 670, 669, 657, 663, 664, - 671, 672, 673, 674, 677, 678, 668, 666, 667, 0, - 0, 869, 0, 0, 653, 0, 679, 661, 655, 654, - 0, 0, 0, 0, 0, 660, 0, 662, 656, 658, - 659, 675, 676, 665, 0, 0, 0, 0, 0, 0, - 519, 0, 0, 0, 0, 0, 519, 519, 670, 669, - 657, 663, 664, 671, 672, 673, 674, 677, 678, 0, - 0, 0, 0, 0, 0, 31, 0, 653, 867, 679, - 661, 655, 654, 0, 519, 0, 0, 0, 660, 0, - 662, 656, 658, 659, 675, 676, 665, 0, 0, 147, - 151, 155, 0, 0, 0, 165, 0, 0, 0, 868, - 0, 0, 51, 198, 0, 871, 872, 0, 206, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 223, - 0, 0, 519, 235, 236, 237, 238, 0, 154, 240, - 0, 242, 243, 244, 245, 246, 247, 248, 0, 252, - 0, 0, 0, 0, 262, 205, 0, 0, 0, 276, - 277, 0, 279, 280, 0, 0, 0, 0, 227, 227, - 0, 0, 0, 291, 519, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 0, 0, 0, - 0, 910, 0, 0, 519, 0, 0, 519, 0, 0, - 519, 0, 670, 669, 657, 663, 664, 671, 672, 673, - 674, 677, 678, 0, 0, 240, 0, 0, 209, 0, - 342, 653, 519, 679, 661, 655, 654, 0, 0, 0, - 0, 0, 660, 942, 662, 656, 658, 659, 675, 676, - 665, 519, 0, 361, 362, 363, 364, 365, 366, 367, - 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, - 378, 379, 380, 381, 382, 383, 384, 385, 0, 387, - 0, 155, 0, 354, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 406, 408, 409, 410, 411, - 412, 413, 414, 415, 416, 417, 418, 419, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 391, 392, 670, - 669, 657, 663, 664, 671, 672, 673, 674, 677, 678, - 0, 0, 0, 0, 0, 0, 240, 0, 653, 433, - 433, 661, 655, 654, 0, 422, 441, 0, 0, 660, - 0, 662, 656, 658, 659, 675, 676, 665, 0, 0, - 155, 155, 0, 0, 466, 0, 0, 433, 0, 0, - 0, 0, 0, 433, 291, 0, 0, 0, 0, 433, - 433, 0, 0, 155, 443, 0, 433, 496, 0, 0, - 0, 0, 500, 0, 0, 0, 0, 462, 464, 0, - 0, 0, 83, 84, 72, 0, 105, 106, 126, 88, - 121, 0, 0, 0, 0, 478, 95, 0, 0, 0, - 487, 0, 0, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 45, 0, 0, 0, 549, - 0, 0, 0, 0, 0, 0, 553, 81, 82, 0, - 349, 0, 0, 0, 0, 0, 0, 52, 96, 0, - 94, 110, 111, 112, 107, 108, 209, 0, 0, 0, - 0, 0, 93, 0, 555, 0, 0, 143, 113, 109, - 103, 489, 85, 86, 87, 0, 0, 0, 0, 80, - 53, 155, 911, 0, 78, 42, 149, 0, 0, 0, - 0, 0, 55, 56, 0, 65, 66, 67, 68, 69, - 70, 71, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 668, 666, 667, 0, 0, 0, 0, 582, 0, - 583, 0, 0, 0, 0, 0, 0, 613, 92, 77, - 0, 0, 0, 0, 63, 482, 97, 0, 0, 488, - 58, 57, 59, 60, 73, 120, 0, 0, 0, 0, - 0, 626, 628, 670, 669, 657, 663, 664, 671, 672, - 673, 674, 677, 678, 667, 636, 0, 0, 0, 0, - 0, 0, 653, 0, 679, 661, 655, 654, 0, 0, - 0, 0, 0, 660, 0, 662, 656, 658, 659, 675, - 676, 665, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 478, 0, 0, 670, 669, 657, 663, 664, 671, - 672, 673, 674, 677, 678, 0, 192, 0, 342, 701, - 0, 0, 0, 653, 0, 679, 661, 655, 654, 0, - 711, 0, 0, 0, 660, 0, 662, 656, 658, 659, - 675, 676, 665, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 179, 182, 183, - 184, 185, 186, 187, 189, 191, 0, 0, 0, 433, - 391, 715, 715, 169, 171, 170, 192, 173, 177, 176, - 746, 0, 0, 0, 0, 0, 433, 751, 178, 180, - 181, 188, 190, 175, 0, 155, 0, 0, 0, 422, - 422, 0, 0, 0, 0, 0, 0, 0, 0, 155, - 0, 0, 668, 666, 667, 167, 168, 179, 182, 183, - 184, 185, 186, 187, 189, 191, 0, 0, 0, 862, - 0, 0, 462, 0, 0, 841, 193, 173, 177, 176, - 478, 842, 478, 0, 840, 172, 487, 174, 178, 180, - 181, 188, 190, 175, 670, 669, 657, 663, 664, 671, - 672, 673, 674, 677, 678, 0, 0, 0, 0, 0, - 0, 0, 797, 653, 0, 679, 661, 655, 654, 806, - 0, 0, 0, 0, 660, 0, 662, 656, 658, 659, - 675, 676, 665, 0, 0, 847, 848, 849, 846, 845, - 844, 657, 663, 664, 671, 672, 673, 674, 677, 678, - 0, 0, 0, 852, 0, 0, 433, 0, 653, 0, - 0, 661, 655, 654, 433, 433, 0, 0, 0, 817, - 0, 865, 656, 658, 659, 675, 676, 665, 0, 0, - 894, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 4, 0, 83, 84, 72, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 669, 667, 668, 0, 0, 519, 0, 0, 0, 0, + 0, 0, 762, 763, 764, 765, 766, 767, 768, 769, + 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, + 780, 781, 782, 783, 784, 785, 786, 787, 789, 0, + 0, 686, 671, 670, 658, 664, 665, 672, 673, 674, + 675, 678, 679, 0, 0, 669, 667, 668, 870, 0, + 0, 654, 0, 680, 662, 656, 655, 0, 0, 0, + 0, 0, 661, 0, 663, 657, 659, 660, 676, 677, + 666, 0, 0, 519, 0, 0, 0, 0, 0, 519, + 519, 0, 0, 0, 0, 0, 0, 671, 670, 658, + 664, 665, 672, 673, 674, 675, 678, 679, 0, 0, + 0, 0, 31, 0, 0, 798, 654, 519, 680, 662, + 656, 655, 0, 0, 0, 0, 0, 661, 0, 663, + 657, 659, 660, 676, 677, 666, 147, 151, 155, 0, + 0, 0, 165, 0, 0, 0, 869, 0, 0, 51, + 198, 0, 872, 873, 0, 206, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 519, 223, 0, 0, 0, + 235, 236, 237, 238, 192, 154, 240, 0, 242, 243, + 244, 245, 246, 247, 248, 0, 252, 0, 0, 0, + 0, 262, 205, 0, 0, 0, 276, 277, 0, 279, + 280, 0, 0, 0, 0, 227, 227, 519, 0, 0, + 291, 0, 0, 167, 168, 179, 182, 183, 184, 185, + 186, 187, 189, 191, 0, 0, 0, 519, 911, 0, + 519, 0, 0, 519, 193, 173, 177, 176, 0, 0, + 0, 0, 0, 172, 0, 174, 178, 180, 181, 188, + 190, 175, 240, 0, 0, 519, 0, 342, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 943, 0, 0, 0, 519, 0, 0, 0, 0, 0, + 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 382, 383, 384, 385, 0, 387, 0, 155, 0, + 354, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 406, 408, 409, 410, 411, 412, 413, 414, + 415, 416, 417, 418, 419, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 391, 392, 671, 670, 658, 664, + 665, 672, 673, 674, 675, 678, 679, 0, 0, 0, + 0, 0, 0, 240, 0, 654, 433, 433, 662, 656, + 655, 0, 422, 441, 0, 0, 661, 0, 663, 657, + 659, 660, 676, 677, 666, 0, 0, 155, 465, 0, + 0, 466, 0, 0, 433, 0, 0, 0, 0, 0, + 433, 291, 0, 0, 0, 0, 433, 433, 0, 0, + 155, 443, 0, 433, 496, 0, 0, 0, 0, 500, + 0, 0, 0, 0, 462, 464, 0, 0, 0, 83, + 84, 72, 0, 105, 106, 126, 88, 121, 0, 0, + 0, 0, 478, 95, 0, 0, 0, 487, 0, 0, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 45, 0, 0, 0, 549, 0, 0, 0, + 0, 0, 0, 553, 81, 82, 0, 0, 0, 0, + 621, 0, 0, 0, 52, 96, 0, 94, 110, 111, + 112, 107, 108, 209, 0, 0, 0, 0, 0, 93, + 0, 555, 0, 0, 143, 113, 109, 103, 489, 85, + 86, 87, 0, 0, 0, 0, 80, 53, 155, 912, + 0, 78, 42, 149, 0, 0, 0, 0, 0, 55, + 56, 0, 65, 66, 67, 68, 69, 70, 71, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 669, 667, + 668, 0, 0, 0, 0, 582, 0, 583, 0, 0, + 0, 0, 0, 0, 614, 92, 77, 0, 0, 0, + 0, 63, 482, 97, 0, 0, 488, 58, 57, 59, + 60, 73, 120, 0, 0, 0, 0, 0, 627, 629, + 671, 670, 658, 664, 665, 672, 673, 674, 675, 678, + 679, 668, 637, 0, 0, 0, 0, 0, 0, 654, + 0, 680, 662, 656, 655, 0, 0, 0, 0, 0, + 661, 0, 663, 657, 659, 660, 676, 677, 666, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 478, 0, + 0, 671, 670, 658, 664, 665, 672, 673, 674, 675, + 678, 679, 0, 0, 192, 342, 702, 0, 0, 0, + 654, 0, 680, 662, 656, 655, 0, 712, 0, 0, + 0, 661, 0, 663, 657, 659, 660, 676, 677, 666, + 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 0, 0, 0, 179, 182, 183, 184, 185, + 186, 187, 189, 191, 558, 0, 433, 391, 716, 716, + 0, 669, 667, 668, 0, 173, 177, 176, 747, 0, + 0, 0, 0, 209, 433, 752, 178, 180, 181, 188, + 190, 175, 0, 155, 0, 0, 422, 422, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 155, 0, 0, + 0, 0, 0, 671, 670, 658, 664, 665, 672, 673, + 674, 675, 678, 679, 169, 171, 170, 192, 0, 0, + 462, 0, 654, 868, 680, 662, 656, 655, 478, 0, + 478, 0, 0, 661, 487, 663, 657, 659, 660, 676, + 677, 666, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 0, 0, 167, 168, 179, 182, + 183, 184, 185, 186, 187, 189, 191, 807, 0, 0, + 863, 0, 0, 0, 0, 0, 0, 193, 173, 177, + 176, 0, 0, 0, 0, 209, 172, 0, 174, 178, + 180, 181, 188, 190, 175, 0, 0, 0, 0, 0, + 0, 853, 0, 0, 433, 0, 0, 0, 0, 0, + 0, 0, 433, 433, 0, 0, 0, 818, 0, 866, + 0, 0, 0, 0, 0, 0, 0, 210, 211, 212, + 213, 214, 215, 216, 217, 218, 219, 220, 221, 0, + 0, 0, 0, 4, 0, 83, 84, 72, 18, 105, + 106, 13, 88, 121, 349, 30, 0, 0, 0, 95, + 29, 20, 19, 0, 21, 0, 33, 0, 34, 342, + 209, 22, 0, 0, 0, 23, 24, 38, 45, 16, + 25, 36, 0, 0, 37, 10, 0, 27, 0, 32, + 81, 82, 8, 46, 48, 50, 0, 0, 0, 0, + 52, 96, 0, 94, 110, 111, 112, 107, 108, 0, + 0, 0, 0, 0, 0, 93, 0, 716, 0, 422, + 9, 113, 109, 103, 0, 85, 86, 87, 0, 0, + 0, 0, 80, 53, 0, 0, 0, 78, 42, 28, + 47, 49, 0, 0, 0, 55, 56, 0, 65, 66, + 67, 68, 69, 70, 71, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 478, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 92, 77, 17, 645, 35, 0, 63, 0, 97, + 0, 0, 0, 58, 57, 59, 60, 73, 120, 4, + 0, 83, 84, 72, 18, 105, 106, 13, 88, 121, + 0, 30, 0, 0, 0, 95, 29, 20, 19, 0, + 21, 0, 33, 0, 34, 0, 0, 22, 0, 0, + 0, 23, 24, 38, 45, 16, 25, 36, 0, 0, + 37, 10, 0, 27, 0, 32, 81, 82, 8, 46, + 48, 50, 0, 0, 0, 0, 52, 96, 0, 94, + 110, 111, 112, 107, 108, 0, 0, 0, 0, 0, + 0, 93, 0, 0, 0, 0, 9, 113, 109, 103, + 0, 85, 86, 87, 0, 0, 0, 0, 80, 53, + 0, 0, 0, 78, 42, 28, 47, 49, 0, 0, + 0, 55, 56, 0, 65, 66, 67, 68, 69, 70, + 71, 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, 92, 77, 17, + 503, 35, 0, 63, 0, 97, 0, 0, 0, 58, + 57, 59, 60, 73, 120, 4, 0, 83, 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, 29, 20, 19, 0, 21, 0, 33, 0, - 34, 342, 0, 22, 0, 0, 0, 23, 24, 38, + 34, 0, 0, 22, 0, 0, 0, 23, 24, 38, 45, 16, 25, 36, 0, 0, 37, 10, 0, 27, 0, 32, 81, 82, 8, 46, 48, 50, 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, 112, 107, - 108, 0, 0, 0, 0, 0, 0, 93, 0, 715, - 0, 422, 9, 113, 109, 103, 0, 85, 86, 87, + 108, 0, 0, 0, 0, 0, 0, 93, 0, 0, + 0, 0, 9, 113, 109, 103, 0, 85, 86, 87, 0, 0, 0, 0, 80, 53, 0, 0, 0, 78, 42, 28, 47, 49, 0, 0, 0, 55, 56, 0, 65, 66, 67, 68, 69, 70, 71, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 478, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 92, 77, 17, 644, 35, 0, 63, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 92, 77, 17, 0, 35, 0, 63, 0, 97, 0, 0, 0, 58, 57, 59, 60, 73, - 120, 4, 0, 83, 84, 72, 18, 105, 106, 13, + 120, 328, 0, 83, 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, 29, 20, 19, 0, 21, 0, 33, 0, 34, 0, 0, 22, - 0, 0, 0, 23, 24, 38, 45, 16, 25, 36, - 0, 0, 37, 10, 0, 27, 0, 32, 81, 82, - 8, 46, 48, 50, 0, 0, 0, 0, 52, 96, + 0, 0, 0, 23, 24, 38, 45, 0, 25, 36, + 0, 0, 37, 0, 0, 27, 0, 32, 81, 82, + 332, 46, 48, 50, 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, 112, 107, 108, 0, 0, 0, - 0, 0, 0, 93, 0, 0, 0, 0, 9, 113, + 0, 0, 0, 93, 0, 0, 0, 0, 143, 113, 109, 103, 0, 85, 86, 87, 0, 0, 0, 0, 80, 53, 0, 0, 0, 78, 42, 28, 47, 49, 0, 0, 0, 55, 56, 0, 65, 66, 67, 68, 69, 70, 71, 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, 92, - 77, 17, 503, 35, 0, 63, 0, 97, 0, 0, - 0, 58, 57, 59, 60, 73, 120, 4, 0, 83, + 77, 17, 1022, 35, 0, 63, 0, 97, 0, 0, + 0, 58, 57, 59, 60, 73, 120, 328, 0, 83, 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, 29, 20, 19, 0, 21, 0, 33, 0, 34, 0, 0, 22, 0, 0, 0, 23, - 24, 38, 45, 16, 25, 36, 0, 0, 37, 10, - 0, 27, 0, 32, 81, 82, 8, 46, 48, 50, + 24, 38, 45, 0, 25, 36, 0, 0, 37, 0, + 0, 27, 0, 32, 81, 82, 332, 46, 48, 50, 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, 112, 107, 108, 0, 0, 0, 0, 0, 0, 93, - 0, 0, 0, 0, 9, 113, 109, 103, 0, 85, + 0, 0, 0, 0, 143, 113, 109, 103, 0, 85, 86, 87, 0, 0, 0, 0, 80, 53, 0, 0, 0, 78, 42, 28, 47, 49, 0, 0, 0, 55, 56, 0, 65, 66, 67, 68, 69, 70, 71, 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, 92, 77, 17, 0, 35, + 0, 0, 0, 0, 0, 92, 77, 17, 1017, 35, 0, 63, 0, 97, 0, 0, 0, 58, 57, 59, 60, 73, 120, 328, 0, 83, 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, @@ -877,11 +907,11 @@ var yyAct = [...]int{ 67, 68, 69, 70, 71, 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, 92, 77, 17, 1021, 35, 0, 63, 0, 97, + 0, 92, 77, 17, 1001, 35, 0, 63, 0, 97, 0, 0, 0, 58, 57, 59, 60, 73, 120, 328, 0, 83, 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, 29, 20, 19, 0, - 21, 0, 33, 0, 34, 0, 0, 22, 0, 0, + 21, 989, 33, 0, 34, 0, 0, 22, 0, 0, 0, 23, 24, 38, 45, 0, 25, 36, 0, 0, 37, 0, 0, 27, 0, 32, 81, 82, 332, 46, 48, 50, 0, 0, 0, 0, 52, 96, 0, 94, @@ -893,10 +923,10 @@ var yyAct = [...]int{ 71, 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, 92, 77, 17, - 1016, 35, 0, 63, 0, 97, 0, 0, 0, 58, + 0, 35, 0, 63, 0, 97, 0, 0, 0, 58, 57, 59, 60, 73, 120, 328, 0, 83, 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, - 0, 95, 29, 20, 19, 0, 21, 0, 33, 0, + 0, 95, 29, 20, 19, 0, 21, 0, 33, 975, 34, 0, 0, 22, 0, 0, 0, 23, 24, 38, 45, 0, 25, 36, 0, 0, 37, 0, 0, 27, 0, 32, 81, 82, 332, 46, 48, 50, 0, 0, @@ -908,11 +938,11 @@ var yyAct = [...]int{ 65, 66, 67, 68, 69, 70, 71, 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, 92, 77, 17, 1000, 35, 0, 63, + 0, 0, 0, 92, 77, 17, 0, 35, 0, 63, 0, 97, 0, 0, 0, 58, 57, 59, 60, 73, 120, 328, 0, 83, 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, 29, 20, - 19, 0, 21, 988, 33, 0, 34, 0, 0, 22, + 19, 0, 21, 0, 33, 0, 34, 0, 0, 22, 0, 0, 0, 23, 24, 38, 45, 0, 25, 36, 0, 0, 37, 0, 0, 27, 0, 32, 81, 82, 332, 46, 48, 50, 0, 0, 0, 0, 52, 96, @@ -924,11 +954,11 @@ var yyAct = [...]int{ 69, 70, 71, 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, 92, - 77, 17, 0, 35, 0, 63, 0, 97, 0, 0, + 77, 17, 974, 35, 0, 63, 0, 97, 0, 0, 0, 58, 57, 59, 60, 73, 120, 328, 0, 83, 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, 29, 20, 19, 0, 21, 0, - 33, 974, 34, 0, 0, 22, 0, 0, 0, 23, + 33, 0, 34, 0, 0, 22, 0, 0, 0, 23, 24, 38, 45, 0, 25, 36, 0, 0, 37, 0, 0, 27, 0, 32, 81, 82, 332, 46, 48, 50, 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, @@ -939,7 +969,7 @@ var yyAct = [...]int{ 56, 0, 65, 66, 67, 68, 69, 70, 71, 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, 92, 77, 17, 0, 35, + 0, 0, 0, 0, 0, 92, 77, 17, 953, 35, 0, 63, 0, 97, 0, 0, 0, 58, 57, 59, 60, 73, 120, 328, 0, 83, 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, @@ -955,7 +985,7 @@ var yyAct = [...]int{ 67, 68, 69, 70, 71, 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, 92, 77, 17, 973, 35, 0, 63, 0, 97, + 0, 92, 77, 17, 952, 35, 0, 63, 0, 97, 0, 0, 0, 58, 57, 59, 60, 73, 120, 328, 0, 83, 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, 29, 20, 19, 0, @@ -971,11 +1001,11 @@ var yyAct = [...]int{ 71, 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, 92, 77, 17, - 952, 35, 0, 63, 0, 97, 0, 0, 0, 58, + 950, 35, 0, 63, 0, 97, 0, 0, 0, 58, 57, 59, 60, 73, 120, 328, 0, 83, 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, 29, 20, 19, 0, 21, 0, 33, 0, - 34, 0, 0, 22, 0, 0, 0, 23, 24, 38, + 34, 887, 0, 22, 0, 0, 0, 23, 24, 38, 45, 0, 25, 36, 0, 0, 37, 0, 0, 27, 0, 32, 81, 82, 332, 46, 48, 50, 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, 112, 107, @@ -986,89 +1016,11 @@ var yyAct = [...]int{ 65, 66, 67, 68, 69, 70, 71, 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, 92, 77, 17, 951, 35, 0, 63, + 0, 0, 0, 92, 77, 17, 0, 35, 0, 63, 0, 97, 0, 0, 0, 58, 57, 59, 60, 73, 120, 328, 0, 83, 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, 29, 20, - 19, 0, 21, 0, 33, 0, 34, 0, 0, 22, - 0, 0, 0, 23, 24, 38, 45, 0, 25, 36, - 0, 0, 37, 0, 0, 27, 0, 32, 81, 82, - 332, 46, 48, 50, 0, 0, 0, 0, 52, 96, - 0, 94, 110, 111, 112, 107, 108, 0, 0, 0, - 0, 0, 0, 93, 0, 0, 0, 0, 143, 113, - 109, 103, 0, 85, 86, 87, 0, 0, 0, 0, - 80, 53, 0, 0, 0, 78, 42, 28, 47, 49, - 0, 0, 0, 55, 56, 0, 65, 66, 67, 68, - 69, 70, 71, 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, 92, - 77, 17, 949, 35, 0, 63, 0, 97, 0, 0, - 0, 58, 57, 59, 60, 73, 120, 328, 0, 83, - 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, - 0, 0, 0, 95, 29, 20, 19, 0, 21, 0, - 33, 0, 34, 886, 0, 22, 0, 0, 0, 23, - 24, 38, 45, 0, 25, 36, 0, 0, 37, 0, - 0, 27, 0, 32, 81, 82, 332, 46, 48, 50, - 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, - 112, 107, 108, 0, 0, 0, 0, 0, 0, 93, - 0, 0, 0, 0, 143, 113, 109, 103, 0, 85, - 86, 87, 0, 0, 0, 0, 80, 53, 0, 0, - 0, 78, 42, 28, 47, 49, 0, 0, 0, 55, - 56, 0, 65, 66, 67, 68, 69, 70, 71, 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, 92, 77, 17, 0, 35, - 0, 63, 0, 97, 0, 0, 0, 58, 57, 59, - 60, 73, 120, 328, 0, 83, 84, 72, 18, 105, - 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, - 29, 20, 19, 698, 21, 0, 33, 0, 34, 0, - 0, 22, 0, 0, 0, 23, 24, 38, 45, 0, - 25, 36, 0, 0, 37, 0, 0, 27, 0, 32, - 81, 82, 332, 46, 48, 50, 0, 0, 0, 0, - 52, 96, 0, 94, 110, 111, 112, 107, 108, 0, - 0, 0, 0, 0, 0, 93, 0, 0, 0, 0, - 143, 113, 109, 103, 0, 85, 86, 87, 0, 0, - 0, 0, 80, 53, 0, 0, 0, 78, 42, 28, - 47, 49, 0, 0, 0, 55, 56, 0, 65, 66, - 67, 68, 69, 70, 71, 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, 92, 77, 17, 0, 35, 0, 63, 0, 97, - 0, 0, 0, 58, 57, 59, 60, 73, 120, 328, - 0, 83, 84, 72, 18, 105, 106, 13, 88, 121, - 0, 30, 0, 0, 0, 95, 29, 20, 19, 0, - 21, 0, 33, 0, 34, 0, 0, 22, 0, 0, - 0, 23, 24, 38, 45, 0, 25, 36, 0, 0, - 37, 0, 0, 27, 0, 32, 81, 82, 332, 46, - 48, 50, 0, 0, 0, 0, 52, 96, 0, 94, - 110, 111, 112, 107, 108, 0, 0, 0, 0, 0, - 0, 93, 0, 0, 0, 0, 143, 113, 109, 103, - 0, 85, 86, 87, 0, 0, 0, 0, 80, 53, - 0, 0, 0, 78, 42, 28, 47, 49, 0, 0, - 0, 55, 56, 0, 65, 66, 67, 68, 69, 70, - 71, 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, 92, 77, 17, - 563, 35, 0, 63, 0, 97, 0, 0, 0, 58, - 57, 59, 60, 73, 120, 328, 0, 83, 84, 72, - 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, - 0, 95, 29, 20, 19, 0, 21, 0, 33, 0, - 34, 0, 0, 22, 0, 0, 0, 23, 24, 38, - 45, 0, 25, 36, 0, 0, 37, 0, 0, 27, - 0, 32, 81, 82, 332, 46, 48, 50, 0, 0, - 0, 0, 52, 96, 0, 94, 110, 111, 112, 107, - 108, 0, 0, 0, 0, 0, 0, 93, 0, 0, - 0, 0, 143, 113, 109, 103, 0, 85, 86, 87, - 0, 0, 0, 0, 80, 53, 0, 0, 0, 78, - 42, 28, 47, 49, 0, 0, 0, 55, 56, 0, - 65, 66, 67, 68, 69, 70, 71, 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, 92, 77, 17, 327, 35, 0, 63, - 0, 97, 0, 0, 0, 58, 57, 59, 60, 73, - 120, 328, 0, 83, 84, 72, 18, 105, 106, 13, - 88, 121, 0, 30, 0, 0, 0, 95, 29, 20, - 19, 0, 21, 0, 33, 0, 34, 0, 0, 22, + 19, 699, 21, 0, 33, 0, 34, 0, 0, 22, 0, 0, 0, 23, 24, 38, 45, 0, 25, 36, 0, 0, 37, 0, 0, 27, 0, 32, 81, 82, 332, 46, 48, 50, 0, 0, 0, 0, 52, 96, @@ -1081,37 +1033,53 @@ var yyAct = [...]int{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 77, 17, 0, 35, 0, 63, 0, 97, 0, 0, - 0, 58, 57, 59, 60, 73, 120, 83, 84, 72, - 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, - 0, 95, 29, 20, 19, 0, 21, 0, 33, 0, - 34, 0, 0, 22, 0, 0, 0, 23, 24, 38, - 45, 0, 25, 36, 0, 0, 37, 0, 0, 27, - 0, 32, 81, 82, 0, 0, 0, 0, 0, 0, - 0, 0, 52, 96, 0, 94, 110, 111, 112, 107, - 108, 0, 0, 0, 0, 0, 0, 93, 0, 0, - 0, 0, 143, 113, 109, 103, 0, 85, 86, 87, - 0, 0, 0, 0, 80, 53, 0, 0, 0, 78, - 42, 28, 0, 0, 0, 0, 0, 55, 56, 0, - 65, 66, 67, 68, 69, 70, 71, 0, 0, 0, + 0, 58, 57, 59, 60, 73, 120, 328, 0, 83, + 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, + 0, 0, 0, 95, 29, 20, 19, 0, 21, 0, + 33, 0, 34, 0, 0, 22, 0, 0, 0, 23, + 24, 38, 45, 0, 25, 36, 0, 0, 37, 0, + 0, 27, 0, 32, 81, 82, 332, 46, 48, 50, + 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, + 112, 107, 108, 0, 0, 0, 0, 0, 0, 93, + 0, 0, 0, 0, 143, 113, 109, 103, 0, 85, + 86, 87, 0, 0, 0, 0, 80, 53, 0, 0, + 0, 78, 42, 28, 47, 49, 0, 0, 0, 55, + 56, 0, 65, 66, 67, 68, 69, 70, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 92, 77, 17, 0, 35, 946, 63, - 0, 97, 0, 0, 0, 58, 57, 59, 60, 73, - 120, 83, 84, 72, 18, 105, 106, 13, 88, 121, + 0, 0, 0, 0, 0, 92, 77, 17, 563, 35, + 0, 63, 0, 97, 0, 0, 0, 58, 57, 59, + 60, 73, 120, 328, 0, 83, 84, 72, 18, 105, + 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, + 29, 20, 19, 0, 21, 0, 33, 0, 34, 0, + 0, 22, 0, 0, 0, 23, 24, 38, 45, 0, + 25, 36, 0, 0, 37, 0, 0, 27, 0, 32, + 81, 82, 332, 46, 48, 50, 0, 0, 0, 0, + 52, 96, 0, 94, 110, 111, 112, 107, 108, 0, + 0, 0, 0, 0, 0, 93, 0, 0, 0, 0, + 143, 113, 109, 103, 0, 85, 86, 87, 0, 0, + 0, 0, 80, 53, 0, 0, 0, 78, 42, 28, + 47, 49, 0, 0, 0, 55, 56, 0, 65, 66, + 67, 68, 69, 70, 71, 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, 92, 77, 17, 327, 35, 0, 63, 0, 97, + 0, 0, 0, 58, 57, 59, 60, 73, 120, 328, + 0, 83, 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, 29, 20, 19, 0, 21, 0, 33, 0, 34, 0, 0, 22, 0, 0, 0, 23, 24, 38, 45, 0, 25, 36, 0, 0, - 37, 0, 0, 27, 0, 32, 81, 82, 0, 0, - 0, 0, 0, 0, 0, 0, 52, 96, 0, 94, + 37, 0, 0, 27, 0, 32, 81, 82, 332, 46, + 48, 50, 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, 112, 107, 108, 0, 0, 0, 0, 0, 0, 93, 0, 0, 0, 0, 143, 113, 109, 103, 0, 85, 86, 87, 0, 0, 0, 0, 80, 53, - 0, 0, 0, 78, 42, 28, 0, 0, 0, 0, + 0, 0, 0, 78, 42, 28, 47, 49, 0, 0, 0, 55, 56, 0, 65, 66, 67, 68, 69, 70, 71, 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, 92, 77, 17, - 0, 35, 920, 63, 0, 97, 0, 0, 0, 58, + 0, 35, 0, 63, 0, 97, 0, 0, 0, 58, 57, 59, 60, 73, 120, 83, 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, 29, 20, 19, 0, 21, 0, 33, 0, 34, 0, @@ -1126,7 +1094,7 @@ var yyAct = [...]int{ 67, 68, 69, 70, 71, 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, 92, 77, 17, 0, 35, 721, 63, 0, 97, + 0, 92, 77, 17, 0, 35, 947, 63, 0, 97, 0, 0, 0, 58, 57, 59, 60, 73, 120, 83, 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, 29, 20, 19, 0, 21, 0, @@ -1142,7 +1110,7 @@ var yyAct = [...]int{ 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, 92, 77, 17, 0, 35, - 337, 63, 0, 97, 0, 0, 0, 58, 57, 59, + 921, 63, 0, 97, 0, 0, 0, 58, 57, 59, 60, 73, 120, 83, 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, 29, 20, 19, 0, 21, 0, 33, 0, 34, 0, 0, 22, @@ -1157,7 +1125,7 @@ var yyAct = [...]int{ 69, 70, 71, 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, 92, - 77, 17, 0, 35, 334, 63, 0, 97, 0, 0, + 77, 17, 0, 35, 722, 63, 0, 97, 0, 0, 0, 58, 57, 59, 60, 73, 120, 83, 84, 72, 18, 105, 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, 29, 20, 19, 0, 21, 0, 33, 0, @@ -1169,22 +1137,174 @@ var yyAct = [...]int{ 0, 0, 143, 113, 109, 103, 0, 85, 86, 87, 0, 0, 0, 0, 80, 53, 0, 0, 0, 78, 42, 28, 0, 0, 0, 0, 0, 55, 56, 0, + 65, 66, 67, 68, 69, 70, 71, 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, 92, 77, 17, 0, 35, 337, 63, + 0, 97, 0, 0, 0, 58, 57, 59, 60, 73, + 120, 83, 84, 72, 18, 105, 106, 13, 88, 121, + 0, 30, 0, 0, 0, 95, 29, 20, 19, 0, + 21, 0, 33, 0, 34, 0, 0, 22, 0, 0, + 0, 23, 24, 38, 45, 0, 25, 36, 0, 0, + 37, 0, 0, 27, 0, 32, 81, 82, 0, 0, + 0, 0, 0, 0, 0, 0, 52, 96, 0, 94, + 110, 111, 112, 107, 108, 0, 0, 0, 0, 0, + 0, 93, 0, 0, 0, 0, 143, 113, 109, 103, + 0, 85, 86, 87, 0, 0, 0, 0, 80, 53, + 0, 0, 0, 78, 42, 28, 0, 0, 0, 0, + 0, 55, 56, 0, 65, 66, 67, 68, 69, 70, + 71, 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, 92, 77, 17, + 0, 35, 334, 63, 0, 97, 0, 0, 0, 58, + 57, 59, 60, 73, 120, 83, 84, 72, 18, 105, + 106, 13, 88, 121, 0, 30, 0, 0, 0, 95, + 29, 20, 19, 0, 21, 0, 33, 0, 34, 0, + 0, 22, 0, 0, 0, 23, 24, 38, 45, 0, + 25, 36, 0, 0, 37, 0, 0, 27, 0, 32, + 81, 82, 0, 0, 0, 0, 0, 0, 0, 0, + 52, 96, 0, 94, 110, 111, 112, 107, 108, 0, + 0, 0, 0, 0, 0, 93, 0, 0, 0, 0, + 143, 113, 109, 103, 0, 85, 86, 87, 0, 0, + 0, 0, 80, 53, 0, 0, 0, 78, 42, 28, + 0, 0, 0, 0, 0, 55, 56, 0, 65, 66, + 67, 68, 69, 70, 71, 83, 84, 72, 0, 105, + 106, 126, 88, 121, 0, 0, 0, 0, 0, 95, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 92, 77, 17, 0, 35, 0, 63, 45, 97, + 0, 0, 0, 58, 57, 59, 60, 73, 120, 0, + 81, 82, 0, 0, 0, 0, 0, 0, 0, 0, + 52, 96, 0, 94, 110, 111, 112, 107, 108, 0, + 0, 0, 0, 0, 0, 93, 0, 0, 0, 0, + 143, 113, 109, 103, 489, 85, 86, 87, 0, 0, + 0, 0, 80, 53, 0, 0, 0, 78, 148, 149, + 0, 0, 0, 0, 0, 55, 56, 0, 65, 66, + 67, 68, 69, 70, 71, 83, 84, 72, 0, 105, + 106, 126, 88, 121, 0, 0, 0, 0, 0, 95, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 92, 77, 0, 0, 0, 0, 63, 45, 97, + 0, 0, 488, 58, 57, 59, 60, 73, 120, 0, + 81, 82, 0, 0, 0, 0, 0, 0, 0, 0, + 52, 96, 0, 94, 110, 111, 112, 107, 108, 0, + 0, 0, 0, 0, 0, 93, 0, 0, 0, 0, + 143, 113, 109, 103, 0, 85, 86, 87, 0, 0, + 0, 0, 80, 53, 0, 0, 0, 78, 148, 149, + 0, 0, 0, 0, 0, 55, 56, 0, 65, 66, + 67, 68, 69, 70, 71, 83, 84, 72, 0, 105, + 106, 126, 88, 121, 0, 0, 0, 0, 0, 95, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 92, 77, 0, 0, 0, 0, 63, 45, 97, + 0, 0, 867, 58, 57, 59, 60, 73, 120, 0, + 81, 82, 0, 0, 0, 0, 0, 0, 0, 0, + 52, 96, 0, 94, 110, 111, 112, 107, 108, 0, + 0, 0, 0, 0, 0, 93, 0, 0, 0, 0, + 143, 113, 109, 103, 0, 85, 86, 87, 0, 0, + 0, 0, 80, 53, 0, 0, 0, 78, 148, 149, + 0, 0, 0, 0, 0, 55, 56, 0, 65, 66, + 67, 68, 69, 70, 71, 83, 84, 72, 0, 105, + 106, 126, 88, 121, 0, 0, 0, 0, 0, 95, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 92, 77, 0, 0, 0, 0, 63, 45, 97, + 0, 0, 630, 58, 57, 59, 60, 73, 120, 0, + 81, 82, 0, 0, 0, 0, 0, 0, 0, 0, + 52, 96, 0, 94, 110, 111, 112, 107, 108, 0, + 0, 0, 0, 0, 0, 93, 0, 0, 0, 0, + 143, 113, 109, 103, 0, 85, 86, 87, 0, 0, + 0, 0, 80, 53, 0, 0, 0, 78, 148, 149, + 0, 0, 0, 0, 0, 55, 56, 0, 65, 66, + 67, 68, 69, 70, 71, 83, 84, 72, 0, 105, + 106, 126, 88, 121, 0, 0, 0, 0, 0, 95, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 92, 77, 0, 0, 0, 0, 63, 45, 97, + 0, 0, 628, 58, 57, 59, 60, 73, 120, 0, + 81, 82, 0, 0, 0, 0, 0, 0, 0, 0, + 52, 96, 0, 94, 110, 111, 112, 107, 108, 0, + 0, 0, 0, 0, 0, 93, 0, 0, 0, 0, + 143, 113, 109, 103, 0, 85, 86, 87, 0, 0, + 0, 0, 80, 53, 0, 0, 0, 78, 148, 149, + 0, 0, 0, 0, 0, 55, 56, 0, 65, 66, + 67, 68, 69, 70, 71, 83, 84, 72, 0, 105, + 106, 126, 88, 121, 0, 0, 0, 0, 0, 95, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 92, 77, 0, 0, 0, 0, 63, 45, 97, + 0, 0, 292, 58, 57, 59, 60, 73, 120, 0, + 81, 82, 0, 0, 0, 0, 0, 0, 0, 0, + 52, 96, 0, 94, 110, 111, 112, 107, 108, 0, + 0, 0, 0, 0, 0, 93, 0, 0, 0, 0, + 143, 113, 109, 103, 0, 85, 86, 87, 0, 0, + 0, 0, 80, 53, 0, 0, 0, 78, 42, 149, + 0, 0, 0, 0, 0, 55, 56, 0, 65, 66, + 67, 68, 69, 70, 71, 0, 0, 83, 84, 72, + 0, 105, 106, 126, 88, 121, 0, 0, 0, 0, + 0, 95, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 92, 77, 0, 0, 0, 0, 63, 431, 97, + 45, 0, 0, 58, 57, 59, 60, 73, 120, 0, + 0, 0, 81, 82, 0, 0, 0, 0, 0, 0, + 0, 0, 52, 96, 0, 94, 110, 111, 112, 107, + 108, 0, 0, 0, 0, 0, 0, 93, 0, 0, + 0, 0, 143, 113, 109, 103, 0, 85, 86, 87, + 0, 0, 0, 0, 80, 53, 0, 0, 0, 78, + 148, 149, 0, 0, 0, 0, 0, 55, 56, 0, 65, 66, 67, 68, 69, 70, 71, 83, 84, 72, 0, 105, 106, 126, 88, 121, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 92, 77, 17, 0, 35, 0, 63, + 0, 0, 0, 92, 77, 0, 0, 0, 0, 63, + 45, 97, 0, 0, 407, 58, 57, 59, 60, 73, + 120, 0, 81, 82, 0, 0, 0, 0, 0, 0, + 0, 0, 52, 96, 0, 94, 110, 111, 112, 107, + 108, 0, 0, 0, 0, 0, 0, 93, 0, 0, + 0, 0, 143, 113, 109, 103, 0, 85, 86, 87, + 0, 0, 0, 0, 80, 53, 0, 0, 0, 78, + 148, 149, 0, 0, 0, 0, 0, 55, 56, 0, + 65, 66, 67, 68, 69, 70, 71, 83, 84, 72, + 0, 105, 106, 126, 88, 121, 0, 0, 0, 0, + 0, 95, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 92, 77, 0, 0, 0, 388, 63, 45, 97, 0, 0, 0, 58, 57, 59, 60, 73, 120, 0, 81, 82, 0, 0, 0, 0, 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, 112, 107, 108, 0, 0, 0, 0, 0, 0, 93, 0, 0, - 0, 0, 143, 113, 109, 103, 489, 85, 86, 87, + 0, 0, 143, 113, 109, 103, 0, 85, 86, 87, 0, 0, 0, 0, 80, 53, 0, 0, 0, 78, 148, 149, 0, 0, 0, 0, 0, 55, 56, 0, 65, 66, 67, 68, 69, 70, 71, 83, 84, 72, 0, 105, 106, 126, 88, 121, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 92, 77, 0, 0, 152, 0, 63, + 45, 97, 0, 0, 0, 58, 57, 59, 60, 73, + 120, 0, 81, 82, 0, 0, 0, 0, 0, 0, + 0, 0, 52, 96, 0, 94, 110, 111, 112, 107, + 108, 0, 0, 0, 0, 0, 0, 93, 0, 0, + 0, 0, 143, 113, 109, 103, 0, 85, 86, 87, + 0, 0, 0, 0, 80, 53, 0, 0, 0, 78, + 148, 149, 0, 0, 0, 0, 0, 55, 56, 0, + 65, 66, 67, 68, 69, 70, 71, 83, 84, 72, + 0, 105, 106, 126, 88, 121, 0, 0, 0, 0, + 0, 95, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 92, 77, 0, 0, 150, 0, 63, + 45, 97, 0, 0, 0, 58, 57, 59, 60, 73, + 120, 0, 81, 82, 0, 0, 0, 0, 0, 0, + 0, 0, 52, 96, 0, 94, 110, 111, 112, 107, + 108, 0, 0, 0, 0, 0, 0, 93, 0, 0, + 0, 0, 143, 113, 109, 103, 0, 85, 86, 87, + 0, 0, 0, 0, 80, 53, 0, 0, 0, 78, + 148, 149, 0, 0, 0, 0, 0, 55, 56, 0, + 65, 66, 67, 68, 69, 70, 71, 83, 84, 72, + 0, 105, 106, 126, 88, 121, 0, 0, 0, 0, + 0, 95, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 92, 77, 0, 0, 146, 0, 63, + 45, 97, 0, 0, 0, 58, 57, 59, 60, 73, + 120, 0, 81, 82, 0, 0, 0, 0, 0, 0, + 0, 0, 52, 96, 0, 94, 110, 111, 112, 107, + 108, 0, 0, 0, 0, 0, 0, 93, 0, 0, + 0, 0, 143, 113, 109, 103, 0, 85, 86, 87, + 0, 0, 0, 0, 80, 53, 0, 0, 0, 78, + 148, 149, 0, 0, 0, 0, 0, 55, 56, 0, + 65, 66, 67, 68, 69, 70, 71, 83, 84, 72, + 0, 105, 106, 126, 442, 121, 0, 0, 0, 0, + 0, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 77, 0, 0, 0, 0, 63, - 45, 97, 0, 0, 488, 58, 57, 59, 60, 73, + 45, 97, 0, 0, 0, 58, 57, 59, 60, 73, 120, 0, 81, 82, 0, 0, 0, 0, 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, 112, 107, 108, 0, 0, 0, 0, 0, 0, 93, 0, 0, @@ -1195,296 +1315,174 @@ var yyAct = [...]int{ 0, 105, 106, 126, 88, 121, 0, 0, 0, 0, 0, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 77, 0, 0, 0, 0, 63, - 45, 97, 0, 0, 866, 58, 57, 59, 60, 73, - 120, 0, 81, 82, 0, 0, 0, 0, 0, 0, - 0, 0, 52, 96, 0, 94, 110, 111, 112, 107, - 108, 0, 0, 0, 0, 0, 0, 93, 0, 0, - 0, 0, 143, 113, 109, 103, 0, 85, 86, 87, - 0, 0, 0, 0, 80, 53, 0, 0, 0, 78, - 148, 149, 0, 0, 0, 0, 0, 55, 56, 0, - 65, 66, 67, 68, 69, 70, 71, 83, 84, 72, - 0, 105, 106, 126, 88, 121, 0, 0, 0, 0, - 0, 95, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 92, 77, 0, 0, 0, 0, 63, - 45, 97, 0, 0, 629, 58, 57, 59, 60, 73, - 120, 0, 81, 82, 0, 0, 0, 0, 0, 0, - 0, 0, 52, 96, 0, 94, 110, 111, 112, 107, - 108, 0, 0, 0, 0, 0, 0, 93, 0, 0, - 0, 0, 143, 113, 109, 103, 0, 85, 86, 87, - 0, 0, 0, 0, 80, 53, 0, 0, 0, 78, - 148, 149, 0, 0, 0, 0, 0, 55, 56, 0, - 65, 66, 67, 68, 69, 70, 71, 83, 84, 72, - 0, 105, 106, 126, 88, 121, 0, 0, 0, 0, - 0, 95, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 92, 77, 0, 0, 0, 0, 63, - 45, 97, 0, 0, 627, 58, 57, 59, 60, 73, - 120, 0, 81, 82, 0, 0, 0, 0, 0, 0, - 0, 0, 52, 96, 0, 94, 110, 111, 112, 107, - 108, 0, 0, 0, 0, 0, 0, 93, 0, 0, - 0, 0, 143, 113, 109, 103, 0, 85, 86, 87, - 0, 0, 0, 0, 80, 53, 0, 0, 0, 78, - 148, 149, 0, 0, 0, 0, 0, 55, 56, 0, - 65, 66, 67, 68, 69, 70, 71, 83, 84, 72, - 0, 105, 106, 126, 88, 121, 0, 0, 0, 0, - 0, 95, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 92, 77, 0, 0, 0, 0, 63, - 45, 97, 0, 0, 292, 58, 57, 59, 60, 73, + 45, 97, 0, 0, 0, 58, 57, 59, 60, 73, 120, 0, 81, 82, 0, 0, 0, 0, 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, 112, 107, 108, 0, 0, 0, 0, 0, 0, 93, 0, 0, 0, 0, 143, 113, 109, 103, 0, 85, 86, 87, 0, 0, 0, 0, 80, 53, 0, 0, 0, 78, 42, 149, 0, 0, 0, 0, 0, 55, 56, 0, - 65, 66, 67, 68, 69, 70, 71, 0, 0, 83, - 84, 72, 0, 105, 106, 126, 88, 121, 0, 0, - 0, 0, 0, 95, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 92, 77, 0, 0, 0, 0, 63, - 431, 97, 45, 0, 0, 58, 57, 59, 60, 73, - 120, 0, 0, 0, 81, 82, 0, 0, 0, 0, - 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, - 112, 107, 108, 0, 0, 0, 0, 0, 0, 93, - 0, 0, 0, 0, 143, 113, 109, 103, 0, 85, - 86, 87, 0, 0, 0, 0, 80, 53, 0, 0, - 0, 78, 148, 149, 0, 0, 0, 0, 0, 55, - 56, 0, 65, 66, 67, 68, 69, 70, 71, 83, - 84, 72, 0, 105, 106, 126, 88, 121, 0, 0, - 0, 0, 0, 95, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 92, 77, 0, 0, 0, - 0, 63, 45, 97, 0, 0, 407, 58, 57, 59, - 60, 73, 120, 0, 81, 82, 0, 0, 0, 0, - 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, - 112, 107, 108, 0, 0, 0, 0, 0, 0, 93, - 0, 0, 0, 0, 143, 113, 109, 103, 0, 85, - 86, 87, 0, 0, 0, 0, 80, 53, 0, 0, - 0, 78, 148, 149, 0, 0, 0, 0, 0, 55, - 56, 0, 65, 66, 67, 68, 69, 70, 71, 83, - 84, 72, 0, 105, 106, 126, 88, 121, 0, 0, - 0, 0, 0, 95, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 92, 77, 0, 0, 0, - 388, 63, 45, 97, 0, 0, 0, 58, 57, 59, - 60, 73, 120, 0, 81, 82, 0, 0, 0, 0, - 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, - 112, 107, 108, 0, 0, 0, 0, 0, 0, 93, - 0, 0, 0, 0, 143, 113, 109, 103, 0, 85, - 86, 87, 0, 0, 0, 0, 80, 53, 0, 0, - 0, 78, 148, 149, 0, 0, 0, 0, 0, 55, - 56, 0, 65, 66, 67, 68, 69, 70, 71, 83, - 84, 72, 0, 105, 106, 126, 88, 121, 0, 0, - 0, 0, 0, 95, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 92, 77, 0, 0, 152, - 0, 63, 45, 97, 0, 0, 0, 58, 57, 59, - 60, 73, 120, 0, 81, 82, 0, 0, 0, 0, - 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, - 112, 107, 108, 0, 0, 0, 0, 0, 0, 93, - 0, 0, 0, 0, 143, 113, 109, 103, 0, 85, - 86, 87, 0, 0, 0, 0, 80, 53, 0, 0, - 0, 78, 148, 149, 0, 0, 0, 0, 0, 55, - 56, 0, 65, 66, 67, 68, 69, 70, 71, 83, - 84, 72, 0, 105, 106, 126, 88, 121, 0, 0, - 0, 0, 0, 95, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 92, 77, 0, 0, 150, - 0, 63, 45, 97, 0, 0, 0, 58, 57, 59, - 60, 73, 120, 0, 81, 82, 0, 0, 0, 0, - 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, - 112, 107, 108, 0, 0, 0, 0, 0, 0, 93, - 0, 0, 0, 0, 143, 113, 109, 103, 0, 85, - 86, 87, 0, 0, 0, 0, 80, 53, 0, 0, - 0, 78, 148, 149, 0, 0, 0, 0, 0, 55, - 56, 0, 65, 66, 67, 68, 69, 70, 71, 83, - 84, 72, 0, 105, 106, 126, 88, 121, 0, 0, - 0, 0, 0, 95, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 92, 77, 0, 0, 146, - 0, 63, 45, 97, 0, 0, 0, 58, 57, 59, - 60, 73, 120, 0, 81, 82, 0, 0, 0, 0, - 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, - 112, 107, 108, 0, 0, 0, 0, 0, 0, 93, - 0, 0, 0, 0, 143, 113, 109, 103, 0, 85, - 86, 87, 0, 0, 0, 0, 80, 53, 0, 0, - 0, 78, 148, 149, 0, 0, 0, 0, 0, 55, - 56, 0, 65, 66, 67, 68, 69, 70, 71, 83, - 84, 72, 0, 105, 106, 126, 442, 121, 0, 0, - 0, 0, 0, 95, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 92, 77, 0, 0, 0, - 0, 63, 45, 97, 0, 0, 0, 58, 57, 59, - 60, 73, 120, 0, 81, 82, 0, 0, 0, 0, - 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, - 112, 107, 108, 0, 0, 0, 0, 0, 0, 93, - 0, 0, 0, 0, 143, 113, 109, 103, 0, 85, - 86, 87, 0, 0, 0, 0, 80, 53, 0, 0, - 0, 78, 148, 149, 0, 0, 0, 0, 0, 55, - 56, 0, 65, 66, 67, 68, 69, 70, 71, 83, - 84, 72, 0, 105, 106, 126, 88, 121, 0, 0, - 0, 0, 0, 95, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 92, 77, 0, 0, 0, - 0, 63, 45, 97, 0, 0, 0, 58, 57, 59, - 60, 73, 120, 0, 81, 82, 0, 0, 0, 0, - 0, 0, 0, 0, 52, 96, 0, 94, 110, 111, - 112, 107, 108, 0, 841, 0, 0, 0, 0, 93, - 842, 0, 0, 840, 143, 113, 109, 103, 0, 85, - 86, 87, 0, 0, 0, 0, 80, 53, 0, 0, - 0, 78, 42, 149, 0, 0, 0, 0, 0, 55, - 56, 0, 65, 66, 67, 68, 69, 70, 71, 0, - 0, 169, 171, 170, 192, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 847, 848, 849, 846, 845, 844, - 0, 0, 0, 0, 0, 92, 77, 794, 0, 0, - 0, 63, 0, 97, 0, 0, 0, 58, 57, 59, - 60, 73, 120, 167, 168, 179, 182, 183, 184, 185, - 186, 187, 189, 191, 0, 0, 668, 666, 667, 833, - 0, 0, 0, 857, 193, 173, 177, 176, 0, 0, - 0, 0, 0, 172, 0, 174, 178, 180, 181, 188, - 190, 175, 755, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 670, 669, - 657, 663, 664, 671, 672, 673, 674, 677, 678, 0, - 0, 169, 171, 170, 192, 0, 0, 653, 0, 679, - 661, 655, 654, 0, 0, 0, 0, 0, 660, 0, - 662, 656, 658, 659, 675, 676, 665, 0, 0, 0, + 65, 66, 67, 68, 69, 70, 71, 0, 0, 169, + 171, 170, 192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 167, 168, 179, 182, 183, 184, 185, - 186, 187, 189, 191, 169, 171, 170, 192, 0, 0, - 0, 0, 0, 0, 193, 173, 177, 176, 0, 0, - 0, 0, 0, 172, 0, 174, 178, 180, 181, 188, - 190, 175, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 167, 168, 179, 182, - 183, 184, 185, 186, 187, 189, 191, 0, 0, 0, - 752, 169, 171, 170, 192, 0, 0, 193, 173, 177, - 176, 0, 0, 0, 0, 0, 172, 0, 174, 178, - 180, 181, 188, 190, 175, 0, 0, 0, 0, 0, + 0, 0, 0, 92, 77, 795, 0, 0, 0, 63, + 0, 97, 0, 0, 0, 58, 57, 59, 60, 73, + 120, 167, 168, 179, 182, 183, 184, 185, 186, 187, + 189, 191, 0, 0, 669, 667, 668, 0, 0, 0, + 0, 858, 193, 173, 177, 176, 0, 0, 0, 0, + 0, 172, 0, 174, 178, 180, 181, 188, 190, 175, + 756, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 671, 670, 658, 664, + 665, 672, 673, 674, 675, 678, 679, 0, 0, 169, + 171, 170, 192, 0, 0, 654, 0, 680, 662, 656, + 655, 0, 0, 0, 0, 0, 661, 0, 663, 657, + 659, 660, 676, 677, 666, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 167, 168, 179, 182, 183, 184, 185, - 186, 187, 189, 191, 0, 0, 0, 708, 169, 171, - 170, 192, 0, 0, 193, 173, 177, 176, 0, 0, - 0, 0, 0, 172, 0, 174, 178, 180, 181, 188, - 190, 175, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 167, 168, 179, 182, 183, 184, 185, 186, 187, 189, - 191, 0, 0, 0, 643, 169, 171, 170, 192, 0, - 0, 193, 173, 177, 176, 0, 0, 0, 0, 0, - 172, 0, 174, 178, 180, 181, 188, 190, 175, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 167, 168, 179, - 182, 183, 184, 185, 186, 187, 189, 191, 0, 0, - 0, 640, 169, 171, 170, 192, 0, 0, 193, 173, - 177, 176, 0, 0, 0, 0, 0, 172, 0, 174, - 178, 180, 181, 188, 190, 175, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 167, 168, 179, 182, 183, 184, - 185, 186, 187, 189, 191, 169, 171, 170, 192, 0, - 0, 0, 622, 0, 0, 193, 173, 177, 176, 0, - 0, 0, 0, 0, 172, 0, 174, 178, 180, 181, - 188, 190, 175, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 167, 168, 179, - 182, 183, 184, 185, 186, 187, 189, 191, 0, 0, - 0, 603, 169, 171, 170, 192, 0, 0, 193, 173, - 177, 176, 0, 0, 0, 0, 0, 172, 0, 174, - 178, 180, 181, 188, 190, 175, 476, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 167, 168, 179, 182, 183, 184, - 185, 186, 187, 189, 191, 169, 171, 170, 192, 0, - 554, 0, 0, 0, 0, 193, 173, 177, 176, 0, - 0, 0, 0, 0, 172, 0, 174, 178, 180, 181, - 188, 190, 175, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 167, 168, 179, - 182, 183, 184, 185, 186, 187, 189, 191, 169, 171, - 170, 192, 0, 0, 0, 0, 0, 0, 193, 173, - 177, 176, 0, 0, 0, 0, 0, 172, 0, 174, - 178, 180, 181, 188, 190, 175, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 405, 0, 0, 0, - 167, 168, 179, 182, 183, 184, 185, 186, 187, 189, - 191, 0, 0, 0, 0, 0, 0, 0, 429, 0, - 0, 193, 173, 177, 176, 169, 171, 170, 192, 0, - 172, 0, 174, 178, 180, 181, 188, 190, 175, 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, 0, 167, 168, 179, - 182, 183, 184, 185, 186, 187, 189, 191, 169, 171, - 170, 192, 0, 0, 0, 0, 0, 0, 193, 173, - 177, 176, 0, 0, 0, 0, 0, 172, 0, 174, - 178, 180, 181, 188, 190, 175, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 167, 168, 179, 182, 183, 184, 185, 186, 187, 189, - 191, 169, 171, 170, 192, 397, 0, 0, 0, 0, - 0, 193, 173, 177, 176, 0, 0, 0, 0, 0, - 172, 0, 174, 178, 180, 181, 188, 190, 175, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 167, 168, 179, 182, 183, 184, 185, - 186, 187, 189, 191, 169, 171, 170, 192, 347, 0, - 0, 0, 0, 0, 193, 173, 177, 176, 0, 0, - 0, 0, 0, 172, 0, 174, 178, 180, 181, 188, - 190, 175, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 167, 168, 179, 182, - 183, 184, 185, 186, 187, 189, 191, 169, 171, 170, - 192, 346, 0, 0, 0, 0, 0, 193, 173, 177, - 176, 0, 0, 0, 0, 0, 172, 0, 174, 178, - 180, 181, 188, 190, 175, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 668, 666, 667, 167, - 168, 179, 182, 183, 184, 185, 186, 187, 189, 191, - 0, 0, 0, 0, 166, 0, 0, 0, 0, 0, - 193, 173, 177, 176, 0, 0, 0, 0, 0, 172, - 0, 174, 178, 180, 181, 188, 190, 175, 670, 669, - 657, 663, 664, 671, 672, 673, 674, 677, 678, 169, - 171, 170, 192, 0, 0, 0, 0, 653, 0, 679, - 661, 655, 654, 0, 0, 0, 0, 0, 660, 0, - 662, 656, 658, 659, 675, 676, 665, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 666, - 667, 167, 168, 179, 182, 183, 184, 185, 186, 187, - 189, 191, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 167, 168, 179, 182, 183, 184, 185, 186, 187, + 189, 191, 169, 171, 170, 192, 0, 0, 0, 0, 0, 0, 193, 173, 177, 176, 0, 0, 0, 0, 0, 172, 0, 174, 178, 180, 181, 188, 190, 175, - 670, 669, 657, 663, 664, 671, 672, 673, 674, 677, - 678, 171, 170, 192, 0, 0, 0, 0, 0, 653, - 0, 679, 661, 655, 654, 0, 0, 0, 0, 0, - 660, 0, 662, 656, 658, 659, 675, 676, 665, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 167, 168, 179, 182, 183, 184, + 185, 186, 187, 189, 191, 0, 0, 0, 753, 169, + 171, 170, 192, 0, 0, 193, 173, 177, 176, 0, + 0, 0, 0, 0, 172, 0, 174, 178, 180, 181, + 188, 190, 175, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 167, 168, 179, 182, 183, 184, 185, 186, 187, + 189, 191, 0, 0, 0, 709, 169, 171, 170, 192, + 0, 0, 193, 173, 177, 176, 0, 0, 0, 0, + 0, 172, 0, 174, 178, 180, 181, 188, 190, 175, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 167, 168, + 179, 182, 183, 184, 185, 186, 187, 189, 191, 0, + 0, 0, 644, 169, 171, 170, 192, 0, 0, 193, + 173, 177, 176, 0, 0, 0, 0, 0, 172, 0, + 174, 178, 180, 181, 188, 190, 175, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 167, 168, 179, 182, 183, + 184, 185, 186, 187, 189, 191, 0, 0, 0, 641, + 169, 171, 170, 192, 0, 0, 193, 173, 177, 176, + 0, 0, 0, 0, 0, 172, 0, 174, 178, 180, + 181, 188, 190, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 167, 168, 179, 182, 183, 184, 185, 186, - 187, 189, 191, 170, 192, 0, 0, 0, 0, 0, - 0, 0, 0, 193, 173, 177, 176, 0, 0, 0, + 187, 189, 191, 169, 171, 170, 192, 0, 0, 0, + 623, 0, 0, 193, 173, 177, 176, 0, 0, 0, 0, 0, 172, 0, 174, 178, 180, 181, 188, 190, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 167, 168, 179, 182, 183, + 184, 185, 186, 187, 189, 191, 169, 171, 170, 192, + 0, 0, 0, 622, 0, 0, 193, 173, 177, 176, + 0, 0, 0, 0, 0, 172, 0, 174, 178, 180, + 181, 188, 190, 175, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 167, 168, + 179, 182, 183, 184, 185, 186, 187, 189, 191, 0, + 0, 0, 603, 169, 171, 170, 192, 0, 0, 193, + 173, 177, 176, 0, 0, 0, 0, 0, 172, 0, + 174, 178, 180, 181, 188, 190, 175, 476, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 167, 168, 179, 182, 183, + 184, 185, 186, 187, 189, 191, 169, 171, 170, 192, + 0, 554, 0, 0, 0, 0, 193, 173, 177, 176, + 0, 0, 0, 0, 0, 172, 0, 174, 178, 180, + 181, 188, 190, 175, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 167, 168, + 179, 182, 183, 184, 185, 186, 187, 189, 191, 169, + 171, 170, 192, 0, 0, 0, 0, 0, 0, 193, + 173, 177, 176, 0, 0, 0, 0, 0, 172, 0, + 174, 178, 180, 181, 188, 190, 175, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 405, 0, 0, + 0, 167, 168, 179, 182, 183, 184, 185, 186, 187, + 189, 191, 0, 0, 0, 0, 0, 0, 0, 429, + 0, 0, 193, 173, 177, 176, 169, 171, 170, 192, + 0, 172, 0, 174, 178, 180, 181, 188, 190, 175, + 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, 0, 167, 168, + 179, 182, 183, 184, 185, 186, 187, 189, 191, 169, + 171, 170, 192, 0, 0, 0, 0, 0, 0, 193, + 173, 177, 176, 0, 0, 0, 0, 0, 172, 0, + 174, 178, 180, 181, 188, 190, 175, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 167, 168, 179, 182, 183, 184, 185, 186, 187, + 189, 191, 169, 171, 170, 192, 397, 0, 0, 0, + 0, 0, 193, 173, 177, 176, 0, 0, 0, 0, + 0, 172, 0, 174, 178, 180, 181, 188, 190, 175, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 167, 168, 179, 182, 183, 184, + 185, 186, 187, 189, 191, 169, 171, 170, 192, 347, + 0, 0, 0, 0, 0, 193, 173, 177, 176, 0, + 0, 0, 0, 0, 172, 0, 174, 178, 180, 181, + 188, 190, 175, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 167, 168, 179, + 182, 183, 184, 185, 186, 187, 189, 191, 169, 171, + 170, 192, 346, 0, 0, 0, 0, 0, 193, 173, + 177, 176, 0, 0, 0, 0, 0, 172, 0, 174, + 178, 180, 181, 188, 190, 175, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 669, 667, 668, + 167, 168, 179, 182, 183, 184, 185, 186, 187, 189, + 191, 0, 0, 0, 0, 166, 0, 0, 0, 0, + 0, 193, 173, 177, 176, 0, 0, 0, 0, 0, + 172, 0, 174, 178, 180, 181, 188, 190, 175, 671, + 670, 658, 664, 665, 672, 673, 674, 675, 678, 679, + 169, 171, 170, 192, 0, 0, 0, 0, 654, 0, + 680, 662, 656, 655, 0, 0, 0, 0, 0, 661, + 0, 663, 657, 659, 660, 676, 677, 666, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 667, 668, 167, 168, 179, 182, 183, 184, 185, 186, + 187, 189, 191, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 193, 173, 177, 176, 0, 0, 0, + 0, 0, 172, 0, 174, 178, 180, 181, 188, 190, + 175, 671, 670, 658, 664, 665, 672, 673, 674, 675, + 678, 679, 171, 170, 192, 0, 0, 0, 0, 0, + 654, 0, 680, 662, 656, 655, 0, 0, 0, 0, + 0, 661, 0, 663, 657, 659, 660, 676, 677, 666, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 167, 168, 179, 182, 183, 184, 185, - 186, 187, 189, 191, 192, 0, 0, 0, 0, 0, + 186, 187, 189, 191, 170, 192, 0, 0, 0, 0, 0, 0, 0, 0, 193, 173, 177, 176, 0, 0, 0, 0, 0, 172, 0, 174, 178, 180, 181, 188, 190, 175, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 167, 168, 179, 182, 183, 184, 185, - 186, 187, 189, 191, 192, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 193, 173, 177, 176, 0, 0, - 0, 0, 0, 172, 0, 174, 178, 180, 181, 188, - 190, 175, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 167, 168, 179, 182, 183, 184, 185, + 0, 0, 0, 0, 167, 168, 179, 182, 183, 184, + 185, 186, 187, 189, 191, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 193, 173, 177, 176, 0, + 0, 0, 0, 0, 172, 0, 174, 178, 180, 181, + 188, 190, 175, 671, 670, 658, 664, 665, 672, 673, + 674, 675, 678, 679, 192, 0, 0, 0, 0, 0, + 0, 0, 654, 0, 680, 662, 656, 655, 0, 0, + 0, 0, 0, 661, 0, 663, 657, 659, 660, 676, + 677, 666, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 192, 167, 168, 179, 182, 183, 184, 185, 186, 187, 189, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 173, 177, 176, 0, 0, 0, 0, 0, 172, 0, 174, 178, 180, 181, 188, - 190, 175, 669, 657, 663, 664, 671, 672, 673, 674, - 677, 678, 192, 0, 0, 0, 0, 0, 0, 0, - 653, 0, 0, 661, 655, 654, 0, 0, 0, 0, - 0, 660, 0, 662, 656, 658, 659, 675, 676, 665, + 190, 175, 168, 179, 182, 183, 184, 185, 186, 187, + 189, 191, 192, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 173, 177, 176, 0, 0, 0, 0, + 0, 172, 0, 174, 178, 180, 181, 188, 190, 175, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 168, 179, 182, 183, 184, 185, 186, 187, + 0, 0, 0, 179, 182, 183, 184, 185, 186, 187, 189, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 173, 177, 176, 0, 0, 0, 0, 0, 172, 0, 174, 178, 180, 181, 188, 190, 175, - 657, 663, 664, 671, 672, 673, 674, 677, 678, 192, - 0, 0, 0, 0, 0, 0, 0, 653, 0, 0, - 661, 655, 654, 0, 0, 0, 0, 0, 660, 0, - 662, 656, 658, 659, 675, 676, 665, 0, 0, 0, + 658, 664, 665, 672, 673, 674, 675, 678, 679, 192, + 0, 0, 0, 0, 0, 0, 0, 654, 0, 0, + 662, 656, 655, 0, 0, 0, 0, 0, 0, 0, + 663, 657, 659, 660, 676, 677, 666, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 179, 182, 183, 184, 185, 186, 187, 189, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 173, 177, 176, 0, 0, 0, 0, 0, 172, 0, - 174, 178, 180, 181, 188, 190, 175, 657, 663, 664, - 671, 672, 673, 674, 677, 678, 192, 0, 0, 0, - 0, 0, 0, 0, 653, 0, 0, 661, 655, 654, - 0, 0, 0, 0, 0, 0, 0, 662, 656, 658, - 659, 675, 676, 665, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 179, 182, 183, - 184, 185, 186, 187, 189, 191, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 173, 177, 176, - 0, 0, 0, 0, 0, 0, 0, 174, 178, 180, - 181, 188, 190, 175, 657, 663, 664, 671, 672, 673, - 674, 677, 678, 192, 0, 0, 0, 0, 0, 0, - 0, 653, 0, 0, 0, 655, 654, 0, 0, 0, - 0, 0, 0, 0, 0, 656, 658, 659, 675, 676, - 665, 105, 106, 126, 0, 0, 0, 0, 0, 0, + 173, 177, 176, 0, 0, 0, 0, 0, 0, 0, + 174, 178, 180, 181, 188, 190, 175, 658, 664, 665, + 672, 673, 674, 675, 678, 679, 0, 0, 0, 0, + 0, 0, 0, 0, 654, 0, 0, 662, 656, 655, + 0, 0, 0, 0, 0, 0, 0, 0, 657, 659, + 660, 676, 677, 666, 658, 664, 665, 672, 673, 674, + 675, 678, 679, 192, 0, 0, 0, 0, 0, 0, + 0, 654, 0, 0, 0, 656, 655, 0, 0, 0, + 0, 0, 0, 0, 0, 657, 659, 660, 676, 677, + 666, 105, 106, 126, 0, 0, 0, 0, 0, 0, 0, 529, 0, 0, 179, 182, 183, 184, 185, 186, 187, 189, 191, 0, 105, 106, 126, 0, 0, 0, 0, 0, 0, 0, 529, 177, 176, 0, 0, 0, @@ -1497,7 +1495,7 @@ var yyAct = [...]int{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 787, 536, + 0, 0, 0, 0, 0, 0, 0, 0, 788, 536, 0, 525, 0, 0, 0, 535, 534, 532, 533, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 536, 0, 525, 0, 0, 0, 535, 534, @@ -1505,183 +1503,184 @@ var yyAct = [...]int{ } var yyPact = [...]int{ - -1000, -1000, 2475, -1000, -1000, -1000, -1000, -1000, 296, 501, - 570, 107, -1000, 306, -1000, -1000, 914, -1000, 227, 227, - 5583, 295, 227, 6795, 6685, 6575, 362, 162, 756, 6905, - -1000, 8040, 292, 291, 287, -1000, 387, 6905, 913, 26, - 912, 904, 6905, -1000, -1000, -1000, -1000, 680, -1000, 676, - -1000, 1368, 286, 6905, 436, 218, 218, 6905, 6905, 6905, - 6905, -1000, -1000, 7125, -1000, 6905, 6905, 6905, 6905, 6905, - 6905, 6905, 285, 6905, -1000, 177, 175, 891, 6905, 665, - 703, 278, 277, 6905, 6905, 270, 6905, 6905, -1000, 165, - -1000, -1000, 887, 840, -1000, 164, 269, 6133, -1000, 163, - 160, -1000, 228, 830, 560, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, -1000, -1000, 116, 137, -1000, 556, 231, -1000, - 386, -1000, 216, 339, -1000, 830, -1000, 91, 610, 604, - -1000, 674, 830, -1000, 901, -1000, -70, 4503, 5429, 7125, - 5275, 752, 26, 521, 6905, 272, -1000, 7987, -1000, 707, - -1000, 7934, -1000, 360, 1606, 8132, -1000, 67, -1000, -1000, - 150, 64, 26, -73, 48, 8132, -1000, 6905, 6905, 6905, - 6905, 6905, 6905, 6905, 6905, 6905, 6905, 6905, 6905, 6905, - 6905, 6905, 6905, 6905, 6905, 6905, 6905, 6905, 6905, 6905, - 6905, 6905, 703, 6465, 218, 6905, 897, -1000, 7881, 358, - 341, -1000, 671, 670, -1000, 1368, 7828, -1000, -1000, 6355, - 6905, 6905, 6905, 6905, 6905, 6905, 6905, 6905, 6905, 6905, - 6905, 6905, 699, -1000, -1000, -1000, -1000, -1000, 228, 520, - 830, 555, 554, -1000, -1000, 400, 400, 448, 400, 215, - 7761, 213, 400, 400, 400, 400, 400, 400, 400, -1000, - 6243, -1000, 400, 6905, 6905, 389, 684, 852, -1000, 246, - 7015, 218, 8324, 134, 231, 543, -1000, 485, 517, 830, - 664, 116, 137, 537, 6905, 6905, 8132, 8132, 6905, 8132, - 8132, 6905, 574, 684, 843, -1000, 786, 6905, 6133, 152, - 17, 7708, 218, 6905, 6905, 892, -1000, 1698, 228, 111, - 6905, 6905, 116, 386, 138, -1000, 6905, 351, -1000, -1000, - 2319, 228, -1000, 630, 36, -1000, 666, 830, -4, -1000, - 606, 830, 856, 545, -77, 8856, -1000, -1000, -1000, -1000, - -1000, -1000, 267, -1000, -1000, -1000, -1000, -1000, 227, 265, - 350, -39, 8132, -1000, 349, 348, -1000, -1000, -1000, -1000, - -1000, 162, -1000, 6905, -1000, -1000, 806, 263, 8856, -1000, - 6905, 8462, 8549, 8223, 8324, 8274, 8636, 8723, 1836, 34, - 34, 34, 448, 400, 448, 448, 57, 57, 297, 297, - 297, 297, 38, 38, 38, 38, -1000, 7655, 6905, 31, - -1000, -1000, 996, 741, 8, -82, 4347, -1000, -1000, 256, - 563, 668, 612, 385, 612, 6905, 8324, 708, 8324, 8324, - 8324, 8324, 8324, 8324, 8324, 8324, 8324, 8324, 8324, 8324, - -15, -1000, -1000, 254, 830, 228, 134, 134, 242, -1000, - -1000, -1000, 147, 8132, 135, -1000, -1000, -1000, -1000, 803, - 848, 7598, 158, 370, 231, 140, -1000, -1000, 116, 137, - -1000, 6905, -1000, -1000, 133, 830, 485, 134, 116, 133, - -16, -1000, 1368, -1000, 119, 209, 7545, 132, -1000, -1000, - -1000, 123, 207, -1000, -1000, 6023, 5913, -1000, -1000, 122, - 118, -1000, -1000, -20, 197, -1000, -1000, 1368, 218, 6905, - -1000, 231, 231, -1000, -1000, 110, 7488, 231, 231, -1000, - 7431, -1000, 2163, -1000, -1000, -1000, -1000, 610, 844, 527, - -1000, 604, 841, 522, -1000, 839, 8856, -1000, 8079, -1000, - -1000, 485, 516, 830, 245, 8856, -1000, -1000, -1000, -1000, - 632, 532, 8856, 8856, 8856, 8856, 8856, 195, 456, 4659, - 4191, 342, 6905, 6905, 458, -1000, 919, -1000, -1000, 7374, - -84, 563, -1000, 8132, 6905, 8374, 340, 218, 204, 204, - 5121, 838, 8856, 704, 563, 192, -43, -1000, 26, -1000, - -1000, -1000, 485, 508, 830, 383, 612, -1000, -1000, -60, - -1000, -1000, 1368, -1000, 703, -91, 699, 699, 228, -1000, - -1000, 199, 643, 6905, -1000, 134, -1000, -1000, 108, -1000, - -1000, -1000, -1000, -1000, 6905, -1000, -1000, 156, 141, -1000, - 6905, 6905, 116, 7317, -1000, 485, -1000, -1000, -1000, 6905, - -1000, -1000, -1000, -1000, -1000, -1000, 7264, 218, 8132, 218, - -1000, -1000, -1000, 5693, -1000, -1000, 8132, -1000, -1000, -1000, - -1000, -1000, -1000, -1000, -1000, -1000, -1000, 836, -1000, -1000, - 831, -1000, -1000, 8856, 8856, 8856, 8856, 8856, 8856, 8856, - 8856, 8856, 8856, 8856, 8856, 8856, 8856, 8856, 8856, 8856, - 8856, 8856, 8856, 8856, 8856, 8856, 8856, 8856, 8856, 8833, - 830, 485, 8856, 106, -55, 7209, 573, 717, 121, 121, - -71, -71, 1935, 338, -1000, 227, 5583, 452, 336, -1000, - 334, 8132, -1000, 6905, 241, 438, 333, 916, -1000, 8856, - 190, 8374, -1000, -1000, 595, -1000, 218, 238, 595, -1000, - -1000, -1000, -93, -1000, 697, 235, 189, 691, 563, 464, - 830, 485, -1000, -60, 7156, 612, 231, 6905, -1000, -40, - 6905, 643, -1000, 105, 231, -1000, 7154, 643, 6905, 6905, - 69, 1896, -1000, 633, -1000, 5803, -1000, -1000, -1000, -1000, - -1000, 1239, -71, -71, 121, 121, 121, 121, 8586, 8673, - 1980, -51, -51, -71, 1785, 1383, 8171, 8499, 8412, 20, - 20, 20, 20, -78, -78, -78, -78, 8856, 1186, 485, - 188, -1000, -1000, 8856, 8856, -1000, -1000, -1000, -1000, 5583, - -1000, 449, 227, 299, -1000, 6905, 1053, -1000, -1000, -1000, - -1000, -1000, 330, -1000, 691, 186, 204, -1000, 699, 185, - 4035, 8856, -1000, 381, 612, 380, 377, 223, -1000, 788, - -1000, 485, 2007, -1000, -1000, 784, -38, -1000, 707, 709, - -1000, 826, 612, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, 8324, -1000, 63, -1000, -1000, 366, -1000, 58, - 54, -1000, -1000, -1000, 134, 8132, 218, -1000, 1490, 8856, - -1000, 1734, 8079, -1000, 321, 219, -1000, 183, -1000, 4659, - -1000, 376, 4967, -1000, -48, 4967, 314, -1000, -1000, 774, - -1000, -1000, 187, -94, -1000, -49, -98, -1000, 825, 26, - -1000, -108, -79, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - 1490, 8856, -1000, -1000, 4659, 4813, 4659, -1000, -1000, -1000, - -1000, -1000, -1000, -1000, 3879, 182, 3723, 3567, -53, -1000, - 772, 8856, -1000, 771, 8856, -116, 821, 8856, -1000, 612, - -1000, 619, 8079, 4659, -1000, -1000, -1000, 3411, 3255, -1000, - 374, -1000, -1000, -1000, 169, -1000, -1000, -117, -1000, 8856, - 222, -1000, -1000, 364, 619, -1000, 313, 310, 688, 737, - 528, -1000, 3099, -1000, 309, -1000, -1000, 767, 8856, -1000, - 563, -1000, -1000, -1000, -1000, 612, 709, 818, 302, -1000, - 2943, -1000, -1000, 181, -62, -1000, 811, -1000, -1000, -1000, - 701, 301, 612, -1000, -1000, 701, -1000, 221, -1000, -1000, - -1000, -1000, -1000, 612, 2787, 762, -1000, 170, 343, -1000, - 2631, -1000, + -1000, -1000, 2453, -1000, -1000, -1000, -1000, -1000, 317, 508, + 616, 113, -1000, 335, -1000, -1000, 1012, -1000, 261, 261, + 5561, 315, 261, 6773, 6663, 6553, 403, 150, 897, 6883, + -1000, 8071, 314, 313, 312, -1000, 441, 6883, 1004, 45, + 998, 992, 6883, -1000, -1000, -1000, -1000, 762, -1000, 751, + -1000, 1813, 308, 6883, 493, 404, 404, 6883, 6883, 6883, + 6883, -1000, -1000, 7103, -1000, 6883, 6883, 6883, 6883, 6883, + 6883, 6883, 304, 6883, -1000, 183, 182, 948, 6883, 725, + 405, 303, 302, 6883, 6883, 299, 6883, 6883, -1000, 181, + -1000, -1000, 942, 844, -1000, 179, 298, 6111, -1000, 177, + 176, -1000, 283, 965, 647, -1000, -1000, -1000, -1000, -1000, + -1000, -1000, -1000, -1000, 130, 138, -1000, 637, 263, -1000, + 439, -1000, 243, 371, -1000, 965, -1000, 98, 677, 610, + -1000, 726, 965, -1000, 991, -1000, -54, 4481, 5407, 7103, + 5253, 828, 45, 564, 6883, 301, -1000, 8018, -1000, 799, + -1000, 7965, -1000, 398, 2010, 8163, -1000, 88, -1000, -1000, + 300, 69, 45, -55, 60, 8163, -1000, 6883, 6883, 6883, + 6883, 6883, 6883, 6883, 6883, 6883, 6883, 6883, 6883, 6883, + 6883, 6883, 6883, 6883, 6883, 6883, 6883, 6883, 6883, 6883, + 6883, 6883, 405, 6443, 404, 6883, 990, -1000, 7912, 397, + 374, -1000, 746, 744, -1000, 1813, 7859, -1000, -1000, 6333, + 6883, 6883, 6883, 6883, 6883, 6883, 6883, 6883, 6883, 6883, + 6883, 6883, 237, -1000, -1000, -1000, -1000, -1000, 283, 541, + 965, 636, 632, -1000, -1000, 463, 463, 496, 463, 238, + 7792, 236, 463, 463, 463, 463, 463, 463, 463, -1000, + 6221, -1000, 463, 6883, 6883, 443, 733, 730, -1000, 271, + 6993, 404, 1334, 195, 263, 618, -1000, 524, 531, 965, + 708, 130, 138, 573, 6883, 6883, 8163, 8163, 6883, 8163, + 8163, 6883, 626, 733, 917, -1000, 830, 6883, 6111, 171, + 7, 7739, 404, 6883, 6883, 989, -1000, 1675, 283, 191, + 6883, 6883, 130, 439, 276, -1000, 6883, 396, -1000, -1000, + 2297, 283, -1000, 716, 50, -1000, 712, 965, -3, -1000, + 711, 965, 986, 662, -57, 8826, -1000, -1000, -1000, -1000, + -1000, -1000, 292, -1000, -1000, -1000, -1000, -1000, 261, 290, + 395, -18, 8163, -1000, 394, 387, -1000, -1000, -1000, -1000, + -1000, 150, -1000, 6883, -1000, -1000, 950, 288, 8826, -1000, + 6883, 8432, 8482, 8254, 1334, 8305, 8569, 8693, 1814, 35, + 35, 35, 496, 463, 496, 496, 342, 342, 700, 700, + 700, 700, 57, 57, 57, 57, -1000, 7686, 6883, 23, + -1000, -1000, 1925, 812, 16, -71, 4325, -1000, -1000, 281, + 718, 727, 607, 438, 607, 6883, 1334, 282, 1334, 1334, + 1334, 1334, 1334, 1334, 1334, 1334, 1334, 1334, 1334, 1334, + 13, -1000, -1000, 278, 965, 283, 195, 195, 249, -1000, + -1000, -1000, 164, 8163, 162, -1000, -1000, -1000, -1000, 939, + 981, 7629, 156, 413, 263, 139, -1000, -1000, 130, 138, + -1000, 6883, -1000, -1000, 134, 965, 524, 195, 130, 134, + -4, -1000, 1813, -1000, 1583, 7576, 7523, 152, -1000, -1000, + -1000, 151, 234, -1000, -1000, 6001, 5891, -1000, -1000, 141, + 133, -1000, -1000, -9, 228, -1000, -1000, 1813, 404, 6883, + -1000, 263, 263, -1000, -1000, 103, 7466, 263, 263, -1000, + 7409, -1000, 2141, -1000, -1000, -1000, -1000, 677, 979, 623, + -1000, 610, 976, 611, -1000, 974, 8826, -1000, 8110, -1000, + -1000, 524, 529, 965, 274, 8826, -1000, -1000, -1000, -1000, + 710, 571, 8826, 8826, 8826, 8826, 8826, 227, 551, 4637, + 4169, 386, 6883, 6883, 490, -1000, 892, -1000, -1000, 7352, + -75, 718, -1000, 8163, 6883, 8394, 385, 404, 132, 132, + 5099, 973, 8826, 794, 718, 219, -30, -1000, 45, -1000, + -1000, -1000, 524, 527, 965, 437, 607, -1000, -1000, -43, + -1000, -1000, 1813, -1000, 405, -78, 237, 237, 283, -1000, + -1000, 149, 704, 6883, -1000, 195, -1000, -1000, 99, -1000, + -1000, -1000, -1000, -1000, -1000, 6883, -1000, -1000, 175, 131, + -1000, 6883, 6883, 130, 7295, -1000, 524, -1000, -1000, -1000, + 6883, -1000, -1000, -1000, -1000, -1000, -1000, 7242, 404, 8163, + 404, -1000, -1000, -1000, 5671, -1000, -1000, 8163, -1000, -1000, + -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 971, -1000, + -1000, 967, -1000, -1000, 8826, 8826, 8826, 8826, 8826, 8826, + 8826, 8826, 8826, 8826, 8826, 8826, 8826, 8826, 8826, 8826, + 8826, 8826, 8826, 8826, 8826, 8826, 8826, 8826, 8826, 8826, + 8803, 965, 524, 8826, 95, -39, 7187, 654, 898, 128, + 128, -53, -53, 1218, 384, -1000, 261, 5561, 509, 383, + -1000, 381, 8163, -1000, 6883, 286, 467, 375, 884, -1000, + 8826, 211, 8394, -1000, -1000, 673, -1000, 404, 267, 673, + -1000, -1000, -1000, -84, -1000, 780, 265, 209, 775, 718, + 518, 965, 524, -1000, -43, 1003, 607, 263, 6883, -1000, + -10, 6883, 704, -1000, 76, 263, -1000, 7132, 704, 6883, + 6883, 73, 1927, -1000, 676, -1000, 5781, -1000, -1000, -1000, + -1000, -1000, 1874, -53, -53, 128, 128, 128, 128, 8519, + 8643, 8606, 224, 224, -53, 1762, 8344, 8202, 102, -65, + 20, 20, 20, 20, -40, -40, -40, -40, 8826, 1163, + 524, 200, -1000, -1000, 8826, 8826, -1000, -1000, -1000, -1000, + 5561, -1000, 504, 261, 277, -1000, 6883, 1029, -1000, -1000, + -1000, -1000, -1000, 372, -1000, 775, 198, 132, -1000, 237, + 189, 4013, 8826, -1000, 432, 607, 431, 430, 256, -1000, + 944, -1000, 524, 669, -1000, -1000, 941, -23, -1000, 799, + 621, -1000, 962, 607, -1000, -1000, -1000, -1000, -1000, -1000, + -1000, -1000, -1000, 1334, -1000, 67, -1000, -1000, 410, -1000, + 66, 51, -1000, -1000, -1000, 195, 8163, 404, -1000, 1467, + 8826, -1000, 1711, 8110, -1000, 367, 250, -1000, 187, -1000, + 4637, -1000, 429, 4945, -1000, -13, 4945, 363, -1000, -1000, + 926, -1000, -1000, 166, -85, -1000, -26, -100, -1000, 959, + 45, -1000, -105, -81, -1000, -1000, -1000, -1000, -1000, -1000, + -1000, 1467, 8826, -1000, -1000, 4637, 4791, 4637, -1000, -1000, + -1000, -1000, -1000, -1000, -1000, 3857, 185, 3701, 3545, -27, + -1000, 920, 8826, -1000, 890, 8826, -106, 958, 8826, -1000, + 607, -1000, 702, 8110, 4637, -1000, -1000, -1000, 3389, 3233, + -1000, 425, -1000, -1000, -1000, 157, -1000, -1000, -107, -1000, + 8826, 254, -1000, -1000, 407, 702, -1000, 353, 347, 772, + 808, 570, -1000, 3077, -1000, 344, -1000, -1000, 846, 8826, + -1000, 718, -1000, -1000, -1000, -1000, 607, 621, 954, 341, + -1000, 2921, -1000, -1000, 158, -79, -1000, 953, -1000, -1000, + -1000, 789, 334, 607, -1000, -1000, 789, -1000, 253, -1000, + -1000, -1000, -1000, -1000, 607, 2765, 838, -1000, 104, 422, + -1000, 2609, -1000, } var yyPgo = [...]int{ - 0, 29, 1094, 1092, 38, 31, 30, 572, 1091, 1090, - 134, 217, 204, 88, 1385, 82, 72, 59, 684, 1422, - 1088, 33, 1086, 1085, 1083, 136, 1082, 36, 37, 1081, - 1080, 1079, 1078, 135, 1077, 1076, 24, 1075, 26, 48, - 45, 1074, 708, 34, 1073, 1, 1072, 1070, 27, 1069, - 73, 68, 61, 1068, 1067, 1066, 35, 1065, 1063, 4, - 1062, 1061, 1060, 17, 1059, 1058, 1057, 1056, 51, 5, - 1055, 1054, 1053, 1051, 1049, 2, 1048, 631, 1047, 18, - 22, 1046, 1045, 1043, 15, 1042, 1041, 6, 19, 1040, - 1037, 1033, 9, 39, 0, 1032, 1030, 1029, 117, 1028, - 1027, 553, 1026, 1024, 42, 8, 1018, 1017, 1013, 1007, - 14, 49, 1001, 1000, 998, 995, 993, 992, 3, 991, - 16, 990, 988, 985, 28, 983, 982, 980, 976, 974, - 971, 962, 21, 961, 959, 958, 25, 955, 23, 12, - 953, 40, 945, 939, 937, 933, 41, 13, 930, 853, - 7, 20, + 0, 29, 1177, 22, 21, 1176, 49, 41, 39, 544, + 1175, 1172, 164, 217, 228, 180, 1362, 64, 51, 59, + 855, 1399, 1171, 33, 1170, 1169, 1157, 136, 1155, 40, + 37, 1154, 1152, 1151, 1149, 84, 1148, 1147, 20, 1145, + 28, 44, 38, 1139, 854, 36, 1137, 1, 1136, 1135, + 7, 1134, 52, 43, 42, 1132, 1131, 1128, 31, 1127, + 1126, 4, 1125, 1124, 1123, 16, 1122, 1121, 1120, 1115, + 48, 5, 1114, 1113, 1112, 1111, 1110, 2, 1109, 607, + 1108, 18, 202, 1100, 1099, 1098, 12, 1097, 1095, 6, + 19, 1093, 1092, 1091, 9, 50, 0, 1090, 1089, 1087, + 117, 1086, 1084, 642, 1083, 1082, 62, 8, 1076, 1075, + 1074, 1073, 14, 47, 1072, 1071, 1069, 1068, 1067, 1066, + 3, 1064, 23, 1063, 1062, 1060, 35, 1059, 1058, 1057, + 1056, 1055, 1054, 1052, 25, 1049, 1044, 1042, 24, 1038, + 15, 17, 1034, 34, 1033, 1031, 1029, 1028, 177, 13, + 1027, 1026, } var yyR1 = [...]int{ - 0, 149, 93, 93, 94, 94, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 95, 95, - 4, 4, 4, 4, 96, 96, 5, 5, 5, 5, - 97, 97, 6, 6, 6, 6, 53, 53, 98, 98, - 24, 24, 24, 24, 24, 25, 25, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, - 26, 26, 26, 26, 26, 115, 115, 58, 58, 116, - 116, 117, 117, 59, 113, 113, 56, 51, 52, 147, - 147, 148, 148, 60, 61, 61, 64, 64, 64, 64, - 89, 89, 2, 91, 91, 90, 90, 124, 124, 88, - 88, 87, 87, 87, 85, 85, 84, 84, 57, 57, - 114, 114, 82, 82, 82, 82, 111, 111, 111, 150, - 150, 86, 86, 107, 107, 108, 108, 54, 54, 55, - 55, 118, 118, 119, 119, 63, 63, 62, 62, 62, - 62, 80, 80, 80, 125, 125, 68, 68, 68, 68, - 99, 99, 27, 27, 27, 100, 100, 100, 100, 120, - 120, 65, 65, 65, 65, 67, 126, 126, 81, 81, - 127, 127, 128, 128, 69, 69, 70, 129, 129, 73, - 73, 72, 71, 71, 74, 74, 83, 83, 121, 121, - 122, 122, 130, 130, 75, 75, 75, 75, 75, 75, - 123, 123, 123, 123, 66, 66, 112, 112, 110, 110, - 109, 109, 136, 136, 134, 134, 135, 135, 135, 137, - 137, 42, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 50, 50, 50, 50, - 47, 47, 47, 47, 46, 46, 1, 92, 92, 106, - 106, 106, 106, 23, 23, 23, 23, 23, 23, 23, - 23, 11, 11, 11, 11, 45, 45, 45, 43, 43, - 41, 41, 144, 144, 143, 49, 49, 49, 131, 131, - 131, 79, 79, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 8, 28, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 78, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, - 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, - 35, 35, 35, 35, 29, 29, 29, 29, 29, 29, - 29, 132, 132, 151, 151, 133, 133, 133, 133, 14, - 14, 48, 48, 16, 17, 18, 19, 19, 145, 145, - 138, 140, 140, 76, 139, 139, 139, 40, 40, 44, - 44, 12, 22, 22, 20, 20, 20, 21, 21, 21, - 10, 10, 10, 9, 9, 13, 13, 141, 141, 142, - 142, 142, 39, 39, 146, 146, 105, 105, 38, 38, - 38, 104, 104, 103, 103, 103, 103, 103, 103, 103, - 103, 101, 101, 101, 101, 33, 33, 33, 33, 33, - 33, 34, 34, 34, 37, 37, 37, 37, 37, 37, - 37, 37, 102, 102, 36, 36, 30, 30, 31, 32, + 0, 151, 95, 95, 96, 96, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 97, 97, + 6, 6, 6, 6, 98, 98, 7, 7, 7, 7, + 99, 99, 8, 8, 8, 8, 55, 55, 100, 100, + 26, 26, 26, 26, 26, 27, 27, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 117, 117, 60, 60, 118, + 118, 119, 119, 61, 115, 115, 58, 53, 54, 149, + 149, 150, 150, 62, 63, 63, 66, 66, 66, 66, + 91, 91, 2, 93, 93, 92, 92, 126, 126, 90, + 90, 89, 89, 89, 87, 87, 86, 86, 59, 59, + 116, 116, 84, 84, 84, 84, 113, 113, 113, 4, + 4, 88, 88, 109, 109, 110, 110, 56, 56, 57, + 57, 120, 120, 121, 121, 65, 65, 64, 64, 64, + 64, 82, 82, 82, 127, 127, 70, 70, 70, 70, + 101, 101, 29, 29, 29, 102, 102, 102, 102, 122, + 122, 67, 67, 67, 67, 69, 128, 128, 83, 83, + 129, 129, 130, 130, 71, 71, 72, 131, 131, 75, + 75, 74, 73, 73, 76, 76, 85, 85, 123, 123, + 124, 124, 132, 132, 77, 77, 77, 77, 77, 77, + 125, 125, 125, 125, 68, 68, 114, 114, 112, 112, + 111, 111, 138, 138, 136, 136, 137, 137, 137, 139, + 139, 44, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, + 17, 17, 17, 17, 17, 17, 52, 52, 52, 52, + 49, 49, 49, 49, 48, 48, 1, 94, 94, 108, + 108, 108, 108, 25, 25, 25, 25, 25, 25, 25, + 25, 13, 13, 13, 13, 47, 47, 47, 45, 45, + 43, 43, 146, 146, 145, 51, 51, 51, 133, 133, + 133, 81, 81, 9, 9, 9, 9, 9, 9, 9, + 9, 9, 9, 9, 9, 10, 30, 79, 79, 79, + 79, 79, 79, 79, 79, 79, 79, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 37, 37, 37, 37, 31, 31, 31, 31, 31, 31, + 31, 134, 134, 3, 3, 135, 135, 135, 135, 16, + 16, 50, 50, 18, 19, 20, 21, 21, 147, 147, + 140, 142, 142, 78, 141, 141, 141, 42, 42, 46, + 46, 14, 24, 24, 22, 22, 22, 23, 23, 23, + 12, 12, 12, 11, 11, 15, 15, 143, 143, 144, + 144, 144, 41, 41, 148, 148, 107, 107, 40, 40, + 40, 106, 106, 105, 105, 105, 105, 105, 105, 105, + 105, 103, 103, 103, 103, 35, 35, 35, 35, 35, + 35, 35, 36, 36, 36, 39, 39, 39, 39, 39, + 39, 39, 39, 104, 104, 38, 38, 32, 32, 33, + 34, } var yyR2 = [...]int{ @@ -1734,115 +1733,116 @@ var yyR2 = [...]int{ 4, 4, 1, 1, 4, 0, 1, 1, 1, 4, 4, 1, 1, 3, 1, 2, 3, 1, 1, 4, 0, 0, 2, 5, 3, 3, 1, 6, 4, 4, - 2, 2, 2, 1, 2, 1, 4, 3, 3, 6, - 3, 1, 1, 1, 4, 4, 4, 2, 2, 4, - 2, 2, 1, 3, 1, 1, 3, 3, 3, 3, + 2, 2, 2, 1, 2, 1, 4, 3, 3, 3, + 6, 3, 1, 1, 1, 4, 4, 4, 2, 2, + 4, 2, 2, 1, 3, 1, 1, 3, 3, 3, + 3, } var yyChk = [...]int{ - -1000, -149, -93, -3, 2, -25, -51, -52, 51, 79, - 44, -53, -26, 10, -60, -61, 38, 142, 7, 21, - 20, 23, 30, 34, 35, 39, -50, 46, 98, 19, - 14, -14, 48, 25, 27, 144, 40, 43, 36, -1, - -64, -2, 97, -16, -15, 37, 52, 99, 53, 100, - 54, -19, 59, 92, -18, 104, 105, 153, 152, 154, - 155, -48, -42, 146, -37, 107, 108, 109, 110, 111, - 112, 113, 6, 156, -29, -47, -46, 141, 96, -20, - 91, 49, 50, 4, 5, 84, 85, 86, 11, -35, - -32, -7, 140, 74, 62, 18, 60, 148, -21, -22, - -23, -30, -94, 82, -11, 8, 9, 66, 67, 81, - 63, 64, 65, 80, -10, -146, -44, -12, -40, -9, - 157, 12, 146, -94, 142, 82, 10, -95, 37, 38, - -4, -94, 82, 144, 158, 145, 10, -98, -48, 146, - -48, -25, -1, 79, 146, -48, 144, -14, 97, 98, - 144, -14, 144, -15, -19, -14, 144, -99, -27, 12, - 157, -100, -1, 12, -112, -14, 144, 129, 130, 87, + -1000, -151, -95, -5, 2, -27, -53, -54, 51, 79, + 44, -55, -28, 10, -62, -63, 38, 142, 7, 21, + 20, 23, 30, 34, 35, 39, -52, 46, 98, 19, + 14, -16, 48, 25, 27, 144, 40, 43, 36, -1, + -66, -2, 97, -18, -17, 37, 52, 99, 53, 100, + 54, -21, 59, 92, -20, 104, 105, 153, 152, 154, + 155, -50, -44, 146, -39, 107, 108, 109, 110, 111, + 112, 113, 6, 156, -31, -49, -48, 141, 96, -22, + 91, 49, 50, 4, 5, 84, 85, 86, 11, -37, + -34, -9, 140, 74, 62, 18, 60, 148, -23, -24, + -25, -32, -96, 82, -13, 8, 9, 66, 67, 81, + 63, 64, 65, 80, -12, -148, -46, -14, -42, -11, + 157, 12, 146, -96, 142, 82, 10, -97, 37, 38, + -6, -96, 82, 144, 158, 145, 10, -100, -50, 146, + -50, -27, -1, 79, 146, -50, 144, -16, 97, 98, + 144, -16, 144, -17, -21, -16, 144, -101, -29, 12, + 157, -102, -1, 12, -114, -16, 144, 129, 130, 87, 89, 88, 159, 151, 161, 167, 153, 152, 162, 131, 163, 164, 132, 133, 134, 135, 136, 137, 165, 138, - 166, 139, 90, 150, 146, 146, 146, 142, -14, 10, - -147, 151, 10, 10, -15, -19, -14, 52, 52, 160, + 166, 139, 90, 150, 146, 146, 146, 142, -16, 10, + -149, 151, 10, 10, -17, -21, -16, 52, 52, 160, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 146, -14, 104, 105, -18, -19, -94, 79, - 82, -11, -12, 98, -18, -14, -14, -14, -14, -42, - -14, -50, -14, -14, -14, -14, -14, -14, -14, -49, - 146, -48, -14, 148, 148, -131, 17, -101, -33, 12, - 76, 77, -14, 57, -43, -11, -41, -94, 79, 82, - -21, -10, -146, -12, 146, 146, -14, -14, 146, -14, - -14, 148, -101, 17, 17, 75, -101, 148, 146, -104, - -103, -14, 151, 148, 148, 82, -80, 146, -94, 78, - 148, 142, -10, 157, 78, -80, 142, 147, 144, 142, - -93, -94, 144, 158, -96, -5, -94, 82, -97, -6, - -94, 82, 29, -94, 10, 160, -24, 143, 2, -25, - -51, -52, 51, -25, 145, -86, -25, 145, 21, -147, - -110, -109, -14, -82, 142, 145, 144, 144, 144, 144, - 144, 158, -16, 142, -19, 144, 158, -147, 160, 144, - 158, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -43, -14, 145, -113, - -56, -19, -19, -15, -114, 10, -98, 144, 144, 10, - 146, -89, 55, -91, 55, 58, -14, 151, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -105, -38, -19, 59, 82, -94, 78, 78, 147, 147, - 147, 147, -13, -14, -13, 141, -33, -33, 17, 148, - 57, -14, 11, -19, -141, -142, -40, -39, -10, -146, - 10, 142, -79, -80, 78, 82, -94, 57, -10, 78, - -102, -36, -19, -15, -19, -15, -14, -13, 140, 75, - 75, -13, -104, 149, -151, 158, 58, -17, -19, -13, - -13, 10, 147, -125, -50, -68, -15, -19, 151, 83, - -80, -39, -40, 10, 52, -13, -14, -39, -40, 10, - -14, 144, -93, 143, -80, -4, 144, 158, 29, -94, - 144, 158, 29, -94, 10, 29, 160, -28, -77, -7, - -31, -94, 79, 82, 60, 148, -8, 62, -78, 18, - 74, -11, 154, 155, 153, 152, 146, 146, -107, -98, - -98, -48, 144, 158, -111, 144, -111, 144, -27, -14, - 12, 146, -28, -14, 145, -14, 147, 158, 29, 29, - 147, 158, 160, 143, 146, -118, -119, -63, -62, 60, - 61, -45, -94, 79, 82, -90, 56, -45, 142, -124, - -45, -15, -19, -19, 91, 147, 158, 146, -94, -137, - -135, -134, -136, 148, -138, 57, 149, 149, -34, 10, - 13, 12, 10, 143, 148, 143, -139, -76, -140, -80, - 148, 142, -10, -14, -40, -94, -141, -40, 147, 158, - 147, 147, 147, 149, 149, 147, -14, 151, -14, 151, - 149, 149, 147, 158, 147, -17, -14, -80, -80, 149, - 143, -80, -80, 143, 143, -5, 10, 29, -6, 10, - 29, 10, -28, 148, 153, 152, 162, 131, 163, 164, - 159, 151, 161, 132, 133, 167, 88, 89, 87, 130, - 129, 134, 135, 136, 137, 165, 166, 138, 139, 150, - 82, -94, 146, -132, -133, -77, 17, 78, -77, -77, - -77, -77, -77, 147, -54, 93, 94, -108, 22, 144, - -110, -14, 143, 32, 33, -111, 31, -111, 143, 160, - -118, -14, 144, -56, -87, -19, 151, 59, -87, -57, - -25, 145, 10, -28, -115, 41, -118, 147, 158, -147, - 82, -94, 142, -124, -120, 158, -43, 160, -38, -105, - 148, -136, -138, -13, -141, 149, -14, -145, 148, 148, - -13, -14, 143, -144, -36, 58, -17, -17, -68, 10, - 10, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, -77, -77, -77, - -77, -77, -77, -77, -77, -77, -77, 145, -77, -94, - -132, 149, -151, 158, 58, 10, 52, 147, 144, -48, - -25, -55, 93, 94, 144, 144, -14, -150, 145, 144, - 143, 144, 31, -28, 147, -88, 58, -19, 146, -88, - -98, 160, -58, 42, 146, 147, -92, 44, -63, -148, - 83, -94, -120, 143, -65, -121, -66, -67, -122, -130, - 47, 38, 44, -75, 103, 102, 101, 98, 99, 100, - -45, -79, -14, 147, -13, 149, -139, 149, -138, -13, - -13, 149, 143, -143, 57, -14, 151, 149, -77, 145, - 147, -77, -77, -25, 95, -48, 145, -110, -150, -98, - 144, -92, 147, -87, -105, 147, 28, -28, 142, -45, - 142, 142, 146, 12, 143, -123, 12, 144, 158, -1, - -75, 10, -126, -45, 149, 143, 149, 149, -141, -17, - -77, 58, 144, 145, -98, 147, -98, 142, -84, -25, - 145, 147, -84, 144, -98, 12, -98, -98, -106, 12, - 151, 160, 144, 158, 160, 10, -147, 160, -81, 158, - 144, 142, -77, -98, -85, -25, 145, -98, -98, 143, - 147, 143, 143, 147, 158, 12, -28, 12, -28, 160, - 10, -28, -45, -127, -128, -69, -70, -71, -72, -73, - -45, 10, -98, 143, 26, 142, 12, 151, 160, -28, - 146, 143, -69, 144, 144, 45, 29, 78, 24, 144, - -98, 12, -28, -118, -129, -45, -74, -75, 10, 144, - 143, 147, 158, 10, -116, -117, -59, 41, -83, 144, - 142, -45, -59, 146, -98, -45, 143, 12, 147, 142, - -98, 143, + 127, 128, 146, -16, 104, 105, -20, -21, -96, 79, + 82, -13, -14, 98, -20, -16, -16, -16, -16, -44, + -16, -52, -16, -16, -16, -16, -16, -16, -16, -51, + 146, -50, -16, 148, 148, -133, 17, -103, -35, 12, + 76, 77, -16, 57, -45, -13, -43, -96, 79, 82, + -23, -12, -148, -14, 146, 146, -16, -16, 146, -16, + -16, 148, -103, 17, 17, 75, -103, 148, 146, -106, + -105, -16, 151, 148, 148, 82, -82, 146, -96, 78, + 148, 142, -12, 157, 78, -82, 142, 147, 144, 142, + -95, -96, 144, 158, -98, -7, -96, 82, -99, -8, + -96, 82, 29, -96, 10, 160, -26, 143, 2, -27, + -53, -54, 51, -27, 145, -88, -27, 145, 21, -149, + -112, -111, -16, -84, 142, 145, 144, 144, 144, 144, + 144, 158, -18, 142, -21, 144, 158, -149, 160, 144, + 158, -16, -16, -16, -16, -16, -16, -16, -16, -16, + -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, + -16, -16, -16, -16, -16, -16, -45, -16, 145, -115, + -58, -21, -21, -17, -116, 10, -100, 144, 144, 10, + 146, -91, 55, -93, 55, 58, -16, 151, -16, -16, + -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, + -107, -40, -21, 59, 82, -96, 78, 78, 147, 147, + 147, 147, -15, -16, -15, 141, -35, -35, 17, 148, + 57, -16, 11, -21, -143, -144, -42, -41, -12, -148, + 10, 142, -81, -82, 78, 82, -96, 57, -12, 78, + -104, -38, -21, -17, -21, -16, -16, -15, 140, 75, + 75, -15, -106, 149, -3, 158, 58, -19, -21, -15, + -15, 10, 147, -127, -52, -70, -17, -21, 151, 83, + -82, -41, -42, 10, 52, -15, -16, -41, -42, 10, + -16, 144, -95, 143, -82, -6, 144, 158, 29, -96, + 144, 158, 29, -96, 10, 29, 160, -30, -79, -9, + -33, -96, 79, 82, 60, 148, -10, 62, -80, 18, + 74, -13, 154, 155, 153, 152, 146, 146, -109, -100, + -100, -50, 144, 158, -113, 144, -113, 144, -29, -16, + 12, 146, -30, -16, 145, -16, 147, 158, 29, 29, + 147, 158, 160, 143, 146, -120, -121, -65, -64, 60, + 61, -47, -96, 79, 82, -92, 56, -47, 142, -126, + -47, -17, -21, -21, 91, 147, 158, 146, -96, -139, + -137, -136, -138, 148, -140, 57, 149, 149, -36, 10, + 13, 12, 10, 143, 143, 148, 143, -141, -78, -142, + -82, 148, 142, -12, -16, -42, -96, -143, -42, 147, + 158, 147, 147, 147, 149, 149, 147, -16, 151, -16, + 151, 149, 149, 147, 158, 147, -19, -16, -82, -82, + 149, 143, -82, -82, 143, 143, -7, 10, 29, -8, + 10, 29, 10, -30, 148, 153, 152, 162, 131, 163, + 164, 159, 151, 161, 132, 133, 167, 88, 89, 87, + 130, 129, 134, 135, 136, 137, 165, 166, 138, 139, + 150, 82, -96, 146, -134, -135, -79, 17, 78, -79, + -79, -79, -79, -79, 147, -56, 93, 94, -110, 22, + 144, -112, -16, 143, 32, 33, -113, 31, -113, 143, + 160, -120, -16, 144, -58, -89, -21, 151, 59, -89, + -59, -27, 145, 10, -30, -117, 41, -120, 147, 158, + -149, 82, -96, 142, -126, -122, 158, -45, 160, -40, + -107, 148, -138, -140, -15, -143, 149, -16, -147, 148, + 148, -15, -16, 143, -146, -38, 58, -19, -19, -70, + 10, 10, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, + -79, -79, -79, -79, -79, -79, -79, -79, 145, -79, + -96, -134, 149, -3, 158, 58, 10, 52, 147, 144, + -50, -27, -57, 93, 94, 144, 144, -16, -4, 145, + 144, 143, 144, 31, -30, 147, -90, 58, -21, 146, + -90, -100, 160, -60, 42, 146, 147, -94, 44, -65, + -150, 83, -96, -122, 143, -67, -123, -68, -69, -124, + -132, 47, 38, 44, -77, 103, 102, 101, 98, 99, + 100, -47, -81, -16, 147, -15, 149, -141, 149, -140, + -15, -15, 149, 143, -145, 57, -16, 151, 149, -79, + 145, 147, -79, -79, -27, 95, -50, 145, -112, -4, + -100, 144, -94, 147, -89, -107, 147, 28, -30, 142, + -47, 142, 142, 146, 12, 143, -125, 12, 144, 158, + -1, -77, 10, -128, -47, 149, 143, 149, 149, -143, + -19, -79, 58, 144, 145, -100, 147, -100, 142, -86, + -27, 145, 147, -86, 144, -100, 12, -100, -100, -108, + 12, 151, 160, 144, 158, 160, 10, -149, 160, -83, + 158, 144, 142, -79, -100, -87, -27, 145, -100, -100, + 143, 147, 143, 143, 147, 158, 12, -30, 12, -30, + 160, 10, -30, -47, -129, -130, -71, -72, -73, -74, + -75, -47, 10, -100, 143, 26, 142, 12, 151, 160, + -30, 146, 143, -71, 144, 144, 45, 29, 78, 24, + 144, -100, 12, -30, -120, -131, -47, -76, -77, 10, + 144, 143, 147, 158, 10, -118, -119, -61, 41, -85, + 144, 142, -47, -61, 146, -100, -47, 143, 12, 147, + 142, -100, 143, } var yyDef = [...]int{ @@ -1873,8 +1873,8 @@ var yyDef = [...]int{ 0, 0, 289, 290, 291, 292, 293, 294, 295, 296, 0, 347, 297, 465, 465, 0, 349, 350, 493, 495, 0, 0, 302, 0, 351, 338, 339, 332, 0, 0, - 341, -2, 0, 0, 0, 0, 507, 508, 0, 510, - 511, 465, 0, 0, 0, 364, 0, 465, 481, 0, + 341, -2, 0, 0, 0, 0, 508, 509, 0, 511, + 512, 465, 0, 0, 0, 364, 0, 465, 481, 0, 423, 486, 0, 465, 465, 0, 323, 0, -2, 0, 465, 0, -2, 475, 0, 330, 0, 0, 11, 3, 0, -2, 14, 0, 0, 25, 26, 0, 0, 31, @@ -1892,10 +1892,10 @@ var yyDef = [...]int{ 432, 346, 0, 466, 0, 301, 494, 491, 492, 0, 0, 0, 414, 0, 446, 467, 468, 471, 447, 0, 472, 0, 231, 352, 0, 0, 334, 0, 458, 0, - 0, 512, -2, -2, -2, 430, 0, 0, 418, 363, + 0, 513, -2, -2, -2, 0, 0, 0, 418, 363, 419, 0, 0, 315, 482, 424, 0, 490, 434, 0, 0, 5, 151, 0, 0, 154, -2, -2, 0, 0, - 325, 0, 449, -2, 519, 0, 0, 0, 450, -2, + 325, 0, 449, -2, 520, 0, 0, 0, 450, -2, 0, 10, 0, 13, 324, 18, 15, 0, 0, 28, 16, 0, 0, 34, 21, 0, 0, 37, 366, 367, 368, -2, 0, 0, 0, 421, 374, 375, 376, 355, @@ -1905,50 +1905,50 @@ var yyDef = [...]int{ 0, 0, 0, 75, -2, 0, 141, 143, 89, 148, 149, 150, 335, 0, 0, 0, 0, 101, 170, 104, 107, -2, -2, 234, 0, 0, 480, 480, 333, 285, - 230, 227, 228, 465, 223, 0, 311, 310, 0, 501, - 502, 503, 497, 498, 0, 500, 439, 444, 445, 443, - 465, 0, 448, 0, 449, 333, 343, 450, 504, 0, - 505, 506, 509, 313, 312, 314, 484, 0, 485, 0, - 452, 453, 152, 0, 153, 158, 159, 326, 327, 460, - 461, 328, 329, 464, 12, 24, 27, 0, 30, 33, - 0, 23, 36, 0, 0, 0, 0, 0, 0, 0, + 230, 227, 228, 465, 223, 0, 311, 310, 0, 502, + 503, 504, 497, 498, 499, 0, 501, 439, 444, 445, + 443, 465, 0, 448, 0, 449, 333, 343, 450, 505, + 0, 506, 507, 510, 313, 312, 314, 484, 0, 485, + 0, 452, 453, 152, 0, 153, 158, 159, 326, 327, + 460, 461, 328, 329, 464, 12, 24, 27, 0, 30, + 33, 0, 23, 36, 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, -2, 421, 0, 423, 428, 0, 0, 384, 385, - 407, 408, 0, 0, 48, 0, 0, 139, 0, 51, - 0, 220, 122, 0, 0, 0, 0, 0, 164, 0, - 0, 286, 67, 85, 109, 111, 0, 0, 109, 70, - 118, 39, 0, 120, 77, 0, 0, 317, 147, 91, - 0, 337, 170, 106, 200, 0, 351, 0, 476, 0, - 465, 226, 222, 0, 446, 496, 0, 436, 465, 465, - 0, 0, 473, 340, 513, 0, 488, 489, 155, 29, - 35, 0, 378, 379, 380, 381, 382, 383, 386, 387, - 388, 389, 390, 391, 392, 393, 394, 395, 396, -2, - -2, -2, -2, -2, -2, -2, -2, 0, 0, -2, - 0, 373, 422, 424, 0, 365, 518, 409, 44, 0, - 138, 0, 0, 0, 132, 218, 0, 39, 129, 130, - 123, 124, 0, 166, 317, 0, 0, 112, 480, 0, - 0, 0, 72, 0, 0, 0, 0, 0, 144, 0, - 92, 336, 200, 95, 169, 0, 0, 173, 0, -2, - 199, 0, 0, 202, 204, 205, 206, 207, 208, 209, - 108, 235, 232, 479, 0, 225, 440, 0, 438, 0, - 0, 469, 470, 342, 0, 483, 0, 377, 405, 0, - 372, 426, 427, 134, 0, 0, 39, 0, 39, -2, - 125, 0, 0, 110, 0, 0, 0, 121, 39, 0, - 39, 39, 0, 145, 94, 0, 212, 172, 0, 89, - 203, 0, 0, 176, 224, 499, 442, 441, 344, 487, - 406, 0, 49, 39, -2, 0, -2, 39, 68, 116, - 39, 113, 69, 119, 0, 0, 0, 0, 0, 321, - 0, 0, 171, 0, 0, 0, 0, 0, 175, 0, - 178, 180, 425, -2, 52, 114, 39, 0, 0, 78, - 0, 93, 304, 318, 0, 322, 146, 210, 213, 0, - 0, 215, 177, 0, 181, 182, 0, 0, 190, 0, - 0, -2, 0, 305, 0, 39, 319, 0, 0, 214, - -2, 179, 183, 184, 185, 0, 194, 0, 0, 117, - 0, 320, 211, 0, 186, 187, 0, -2, 191, 115, - 80, 0, 0, 192, 76, 79, 81, 0, 174, 196, - 39, 188, 82, 0, 0, 0, 197, 0, 0, 39, - 0, 83, + 0, 0, -2, 421, 0, 423, 428, 0, 0, 384, + 385, 407, 408, 0, 0, 48, 0, 0, 139, 0, + 51, 0, 220, 122, 0, 0, 0, 0, 0, 164, + 0, 0, 286, 67, 85, 109, 111, 0, 0, 109, + 70, 118, 39, 0, 120, 77, 0, 0, 317, 147, + 91, 0, 337, 170, 106, 200, 0, 351, 0, 476, + 0, 465, 226, 222, 0, 446, 496, 0, 436, 465, + 465, 0, 0, 473, 340, 514, 0, 488, 489, 155, + 29, 35, 0, 378, 379, 380, 381, 382, 383, 386, + 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, + -2, -2, -2, -2, -2, -2, -2, -2, 0, 0, + -2, 0, 373, 422, 424, 0, 365, 519, 409, 44, + 0, 138, 0, 0, 0, 132, 218, 0, 39, 129, + 130, 123, 124, 0, 166, 317, 0, 0, 112, 480, + 0, 0, 0, 72, 0, 0, 0, 0, 0, 144, + 0, 92, 336, 200, 95, 169, 0, 0, 173, 0, + -2, 199, 0, 0, 202, 204, 205, 206, 207, 208, + 209, 108, 235, 232, 479, 0, 225, 440, 0, 438, + 0, 0, 469, 470, 342, 0, 483, 0, 377, 405, + 0, 372, 426, 427, 134, 0, 0, 39, 0, 39, + -2, 125, 0, 0, 110, 0, 0, 0, 121, 39, + 0, 39, 39, 0, 145, 94, 0, 212, 172, 0, + 89, 203, 0, 0, 176, 224, 500, 442, 441, 344, + 487, 406, 0, 49, 39, -2, 0, -2, 39, 68, + 116, 39, 113, 69, 119, 0, 0, 0, 0, 0, + 321, 0, 0, 171, 0, 0, 0, 0, 0, 175, + 0, 178, 180, 425, -2, 52, 114, 39, 0, 0, + 78, 0, 93, 304, 318, 0, 322, 146, 210, 213, + 0, 0, 215, 177, 0, 181, 182, 0, 0, 190, + 0, 0, -2, 0, 305, 0, 39, 319, 0, 0, + 214, -2, 179, 183, 184, 185, 0, 194, 0, 0, + 117, 0, 320, 211, 0, 186, 187, 0, -2, 191, + 115, 80, 0, 0, 192, 76, 79, 81, 0, 174, + 196, 39, 188, 82, 0, 0, 0, 197, 0, 0, + 39, 0, 83, } var yyTok1 = [...]int{ @@ -2326,14 +2326,14 @@ yydefault: case 1: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:278 + //line php5/php5.y:281 { yylex.(*Parser).rootNode = node.NewRoot(yyDollar[1].list) yylex.(*Parser).positions.AddPosition(yylex.(*Parser).rootNode, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) } case 2: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:286 + //line php5/php5.y:289 { if yyDollar[2].node != nil { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) @@ -2341,368 +2341,446 @@ yydefault: } case 3: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:291 + //line php5/php5.y:294 { yyVAL.list = []node.Node{} } case 4: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:296 + //line php5/php5.y:299 { namePart := name.NewNamePart(yyDollar[1].token.Value) - yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yyVAL.list = []node.Node{namePart} - yylex.(*Parser).comments.AddComments(namePart, yyDollar[1].token.Comments()) + + // save position + yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(namePart, yyDollar[1].token, comment.StringToken) } case 5: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:303 + //line php5/php5.y:310 { namePart := name.NewNamePart(yyDollar[3].token.Value) - yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yyVAL.list = append(yyDollar[1].list, namePart) - yylex.(*Parser).comments.AddComments(namePart, yyDollar[3].token.Comments()) + + // save position + yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.NsSeparatorToken) + yylex.(*Parser).comments.AddFromToken(namePart, yyDollar[3].token, comment.StringToken) } case 6: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:313 + //line php5/php5.y:325 { // error yyVAL.node = nil } case 7: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:318 + //line php5/php5.y:330 { yyVAL.node = yyDollar[1].node } case 8: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:320 + //line php5/php5.y:332 { yyVAL.node = yyDollar[1].node } case 9: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:322 + //line php5/php5.y:334 { yyVAL.node = yyDollar[1].node } case 10: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:324 + //line php5/php5.y:336 { yyVAL.node = stmt.NewHaltCompiler() + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.HaltCompilerToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken) } case 11: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:330 + //line php5/php5.y:349 { name := name.NewName(yyDollar[2].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) yyVAL.node = stmt.NewNamespace(name, nil) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NamespaceToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken) } case 12: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:340 + //line php5/php5.y:362 { name := name.NewName(yyDollar[2].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) yyVAL.node = stmt.NewNamespace(name, yyDollar[4].list) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NamespaceToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.CloseCurlyBracesToken) } case 13: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:350 + //line php5/php5.y:376 { yyVAL.node = stmt.NewNamespace(nil, yyDollar[3].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NamespaceToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseCurlyBracesToken) } case 14: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:356 + //line php5/php5.y:388 { yyVAL.node = stmt.NewUseList(nil, yyDollar[2].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UseToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken) } case 15: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:362 + //line php5/php5.y:399 { useType := node.NewIdentifier(yyDollar[2].token.Value) - yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[2].token.Comments()) - yyVAL.node = stmt.NewUseList(useType, yyDollar[3].list) + + // save position + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UseToken) + yylex.(*Parser).comments.AddFromToken(useType, yyDollar[2].token, comment.UseToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken) } case 16: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:372 + //line php5/php5.y:413 { useType := node.NewIdentifier(yyDollar[2].token.Value) - yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[2].token.Comments()) - yyVAL.node = stmt.NewUseList(useType, yyDollar[3].list) + + // save position + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UseToken) + yylex.(*Parser).comments.AddFromToken(useType, yyDollar[2].token, comment.UseToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken) } case 17: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:382 + //line php5/php5.y:427 { yyVAL.node = yyDollar[1].node + + // save position + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken) } case 18: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:387 + //line php5/php5.y:440 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) } case 19: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:389 + //line php5/php5.y:447 { yyVAL.list = []node.Node{yyDollar[1].node} } case 20: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:394 + //line php5/php5.y:452 { name := name.NewName(yyDollar[1].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) yyVAL.node = stmt.NewUse(nil, name, nil) - yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) } case 21: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:404 + //line php5/php5.y:461 { name := name.NewName(yyDollar[1].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) alias := node.NewIdentifier(yyDollar[3].token.Value) - yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yyVAL.node = stmt.NewUse(nil, name, alias) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) + yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) - yylex.(*Parser).comments.AddComments(alias, yyDollar[3].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsToken) + yylex.(*Parser).comments.AddFromToken(alias, yyDollar[3].token, comment.StringToken) } case 22: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:417 + //line php5/php5.y:476 { name := name.NewName(yyDollar[2].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) yyVAL.node = stmt.NewUse(nil, name, nil) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list)) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken) } case 23: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:427 + //line php5/php5.y:488 { name := name.NewName(yyDollar[2].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) alias := node.NewIdentifier(yyDollar[4].token.Value) - yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) yyVAL.node = stmt.NewUse(nil, name, alias) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) + yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[2].list, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list)) - yylex.(*Parser).comments.AddComments(alias, yyDollar[4].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list)) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.AsToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.StringToken) } case 24: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:443 + //line php5/php5.y:507 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) } case 25: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:445 + //line php5/php5.y:514 { yyVAL.list = []node.Node{yyDollar[1].node} } case 26: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:450 + //line php5/php5.y:519 { name := name.NewName(yyDollar[1].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) yyVAL.node = stmt.NewUse(nil, name, nil) - yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) } case 27: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:460 + //line php5/php5.y:528 { name := name.NewName(yyDollar[1].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) alias := node.NewIdentifier(yyDollar[3].token.Value) - yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yyVAL.node = stmt.NewUse(nil, name, alias) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) + yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) - yylex.(*Parser).comments.AddComments(alias, yyDollar[3].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsToken) + yylex.(*Parser).comments.AddFromToken(alias, yyDollar[3].token, comment.StringToken) } case 28: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:473 + //line php5/php5.y:543 { name := name.NewName(yyDollar[2].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) yyVAL.node = stmt.NewUse(nil, name, nil) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list)) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken) } case 29: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:483 + //line php5/php5.y:555 { name := name.NewName(yyDollar[2].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) alias := node.NewIdentifier(yyDollar[4].token.Value) - yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) yyVAL.node = stmt.NewUse(nil, name, alias) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) + yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[2].list, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list)) - yylex.(*Parser).comments.AddComments(alias, yyDollar[4].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list)) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.AsToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.StringToken) } case 30: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:499 + //line php5/php5.y:574 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) } case 31: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:501 + //line php5/php5.y:581 { yyVAL.list = []node.Node{yyDollar[1].node} } case 32: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:506 + //line php5/php5.y:586 { name := name.NewName(yyDollar[1].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) yyVAL.node = stmt.NewUse(nil, name, nil) - yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) } case 33: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:516 + //line php5/php5.y:595 { name := name.NewName(yyDollar[1].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) alias := node.NewIdentifier(yyDollar[3].token.Value) - yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yyVAL.node = stmt.NewUse(nil, name, alias) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) + yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) - yylex.(*Parser).comments.AddComments(alias, yyDollar[3].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsToken) + yylex.(*Parser).comments.AddFromToken(alias, yyDollar[3].token, comment.StringToken) } case 34: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:529 + //line php5/php5.y:610 { name := name.NewName(yyDollar[2].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) yyVAL.node = stmt.NewUse(nil, name, nil) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list)) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken) } case 35: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:539 + //line php5/php5.y:622 { name := name.NewName(yyDollar[2].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) alias := node.NewIdentifier(yyDollar[4].token.Value) - yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) yyVAL.node = stmt.NewUse(nil, name, alias) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) + yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[2].list, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list)) - yylex.(*Parser).comments.AddComments(alias, yyDollar[4].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[2].list)) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.AsToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.StringToken) } case 36: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:555 + //line php5/php5.y:641 { name := node.NewIdentifier(yyDollar[3].token.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(name, yyDollar[3].token.Comments()) - constant := stmt.NewConstant(name, yyDollar[5].node, "") - yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node)) - yylex.(*Parser).comments.AddComments(constant, yyDollar[3].token.Comments()) - constList := yyDollar[1].node.(*stmt.ConstList) constList.Consts = append(constList.Consts, constant) - yyVAL.node = yyDollar[1].node + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) + yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeNodeListPosition(yyDollar[1].node, constList.Consts)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(constList.Consts), yyDollar[2].token, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(name, yyDollar[3].token, comment.StringToken) + yylex.(*Parser).comments.AddFromToken(constant, yyDollar[4].token, comment.EqualToken) } case 37: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:571 + //line php5/php5.y:659 { name := node.NewIdentifier(yyDollar[2].token.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(name, yyDollar[2].token.Comments()) - constant := stmt.NewConstant(name, yyDollar[4].node, "") - yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[4].node)) - yylex.(*Parser).comments.AddComments(constant, yyDollar[2].token.Comments()) - constList := []node.Node{constant} - yyVAL.node = stmt.NewConstList(constList) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) + yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[4].node)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, constList)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ConstToken) + yylex.(*Parser).comments.AddFromToken(name, yyDollar[2].token, comment.StringToken) + yylex.(*Parser).comments.AddFromToken(constant, yyDollar[3].token, comment.EqualToken) } case 38: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:590 + //line php5/php5.y:679 { if yyDollar[2].node != nil { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) @@ -2710,75 +2788,91 @@ yydefault: } case 39: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:596 + //line php5/php5.y:685 { yyVAL.list = []node.Node{} } case 40: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:602 + //line php5/php5.y:691 { // error yyVAL.node = nil } case 41: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:607 + //line php5/php5.y:696 { yyVAL.node = yyDollar[1].node } case 42: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:609 + //line php5/php5.y:698 { yyVAL.node = yyDollar[1].node } case 43: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:611 + //line php5/php5.y:700 { yyVAL.node = yyDollar[1].node } case 44: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:613 + //line php5/php5.y:702 { yyVAL.node = stmt.NewHaltCompiler() + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.HaltCompilerToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken) } case 45: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:623 + //line php5/php5.y:719 { yyVAL.node = yyDollar[1].node } case 46: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:625 + //line php5/php5.y:721 { label := node.NewIdentifier(yyDollar[1].token.Value) - yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yyVAL.node = stmt.NewLabel(label) + + // save position + yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(label, yyDollar[1].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(label, yyDollar[1].token, comment.StringToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ColonToken) } case 47: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:638 + //line php5/php5.y:737 { yyVAL.node = stmt.NewStmtList(yyDollar[2].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken) } case 48: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:644 + //line php5/php5.y:748 { yyVAL.node = stmt.NewIf(yyDollar[2].node, yyDollar[3].node, yyDollar[4].list, yyDollar[5].node) + // save position if yyDollar[5].node != nil { yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[5].node)) } else if len(yyDollar[4].list) > 0 { @@ -2787,22 +2881,29 @@ yydefault: yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node)) } - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IfToken) } case 49: yyDollar = yyS[yypt-8 : yypt+1] - //line php5/php5.y:658 + //line php5/php5.y:764 { stmts := stmt.NewStmtList(yyDollar[4].list) - yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[4].list)) - yyVAL.node = stmt.NewAltIf(yyDollar[2].node, stmts, yyDollar[5].list, yyDollar[6].node) + + // save position + yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[4].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[8].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IfToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.ColonToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.EndifToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[8].token, comment.SemiColonToken) } case 50: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:667 + //line php5/php5.y:779 { switch n := yyDollar[3].node.(type) { case *stmt.While: @@ -2813,20 +2914,29 @@ yydefault: yyVAL.node = yyDollar[3].node + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.WhileToken) } case 51: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:681 + //line php5/php5.y:796 { yyVAL.node = stmt.NewDo(yyDollar[2].node, yyDollar[4].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DoToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.WhileToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.SemiColonToken) } case 52: yyDollar = yyS[yypt-9 : yypt+1] - //line php5/php5.y:687 + //line php5/php5.y:808 { switch n := yyDollar[9].node.(type) { case *stmt.For: @@ -2841,12 +2951,19 @@ yydefault: yyVAL.node = yyDollar[9].node + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[9].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ForToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.ForInitSemicolonToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.ForCondSemicolonToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[8].token, comment.CloseParenthesisToken) } case 53: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:705 + //line php5/php5.y:833 { switch n := yyDollar[3].node.(type) { case *stmt.Switch: @@ -2859,124 +2976,196 @@ yydefault: yyVAL.node = yyDollar[3].node + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.SwitchToken) } case 54: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:721 + //line php5/php5.y:852 { yyVAL.node = stmt.NewBreak(nil) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.BreakToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken) } case 55: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:727 + //line php5/php5.y:863 { yyVAL.node = stmt.NewBreak(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.BreakToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken) } case 56: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:733 + //line php5/php5.y:874 { yyVAL.node = stmt.NewContinue(nil) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ContinueToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken) } case 57: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:739 + //line php5/php5.y:885 { yyVAL.node = stmt.NewContinue(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ContinueToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken) } case 58: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:745 + //line php5/php5.y:896 { yyVAL.node = stmt.NewReturn(nil) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ReturnToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken) } case 59: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:751 + //line php5/php5.y:907 { yyVAL.node = stmt.NewReturn(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ReturnToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken) } case 60: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:757 + //line php5/php5.y:918 { yyVAL.node = stmt.NewReturn(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ReturnToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken) } case 61: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:763 + //line php5/php5.y:929 { yyVAL.node = stmt.NewExpression(yyDollar[1].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken) } case 62: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:769 + //line php5/php5.y:939 { yyVAL.node = stmt.NewGlobal(yyDollar[2].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.GlobalToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken) } case 63: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:775 + //line php5/php5.y:950 { yyVAL.node = stmt.NewStatic(yyDollar[2].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StaticToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken) } case 64: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:781 + //line php5/php5.y:961 { yyVAL.node = stmt.NewEcho(yyDollar[2].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.EchoToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken) } case 65: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:787 + //line php5/php5.y:972 { yyVAL.node = stmt.NewInlineHtml(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.InlineHTMLToken) } case 66: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:793 + //line php5/php5.y:982 { yyVAL.node = stmt.NewExpression(yyDollar[1].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken) } case 67: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:799 + //line php5/php5.y:992 { yyVAL.node = stmt.NewUnset(yyDollar[3].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UnsetToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.SemiColonToken) } case 68: yyDollar = yyS[yypt-8 : yypt+1] - //line php5/php5.y:805 + //line php5/php5.y:1005 { if yyDollar[6].node == nil { switch n := yyDollar[8].node.(type) { @@ -3002,12 +3191,18 @@ yydefault: yyVAL.node = yyDollar[8].node + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[8].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ForeachToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.AsToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.CloseParenthesisToken) } case 69: yyDollar = yyS[yypt-8 : yypt+1] - //line php5/php5.y:834 + //line php5/php5.y:1040 { if yyDollar[6].node == nil { switch n := yyDollar[8].node.(type) { @@ -3031,213 +3226,269 @@ yydefault: } } + // save position yyVAL.node = yyDollar[8].node yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[8].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ForeachToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.AsToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.CloseParenthesisToken) } case 70: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:863 + //line php5/php5.y:1075 { yyVAL.node = stmt.NewDeclare(yyDollar[3].list, yyDollar[5].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[5].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DeclareToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken) } case 71: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:869 + //line php5/php5.y:1087 { yyVAL.node = stmt.NewNop() + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.SemiColonToken) } case 72: yyDollar = yyS[yypt-6 : yypt+1] - //line php5/php5.y:875 + //line php5/php5.y:1097 { yyVAL.node = stmt.NewTry(yyDollar[3].list, yyDollar[5].list, yyDollar[6].node) + // save position if yyDollar[6].node == nil { yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[5].list)) } else { yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[6].node)) } - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.TryToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseCurlyBracesToken) } case 73: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:887 + //line php5/php5.y:1113 { yyVAL.node = stmt.NewThrow(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ThrowToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken) } case 74: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:893 + //line php5/php5.y:1124 { label := node.NewIdentifier(yyDollar[2].token.Value) - yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) yyVAL.node = stmt.NewGoto(label) + + // save position + yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(label, yyDollar[2].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.GotoToken) + yylex.(*Parser).comments.AddFromToken(label, yyDollar[2].token, comment.StringToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken) } case 75: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:906 + //line php5/php5.y:1141 { yyVAL.list = []node.Node{} } case 76: yyDollar = yyS[yypt-9 : yypt+1] - //line php5/php5.y:908 + //line php5/php5.y:1143 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(identifier, yyDollar[4].token.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(variable, yyDollar[4].token.Comments()) - catch := stmt.NewCatch([]node.Node{yyDollar[3].node}, variable, yyDollar[7].list) - yylex.(*Parser).positions.AddPosition(catch, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[8].token)) - yylex.(*Parser).comments.AddComments(catch, yyDollar[1].token.Comments()) - yyVAL.list = append([]node.Node{catch}, yyDollar[9].list...) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) + yylex.(*Parser).positions.AddPosition(catch, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[8].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(catch, yyDollar[1].token, comment.CatchToken) + yylex.(*Parser).comments.AddFromToken(catch, yyDollar[2].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[4].token, comment.StringToken) + yylex.(*Parser).comments.AddFromToken(catch, yyDollar[5].token, comment.CloseParenthesisToken) + yylex.(*Parser).comments.AddFromToken(catch, yyDollar[6].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(catch, yyDollar[8].token, comment.CloseCurlyBracesToken) } case 77: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:926 + //line php5/php5.y:1165 { yyVAL.node = nil } case 78: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:928 + //line php5/php5.y:1167 { yyVAL.node = stmt.NewFinally(yyDollar[3].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FinallyToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseCurlyBracesToken) } case 79: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:937 + //line php5/php5.y:1182 { yyVAL.list = yyDollar[1].list } case 80: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:939 + //line php5/php5.y:1184 { yyVAL.list = []node.Node{} } case 81: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:944 + //line php5/php5.y:1189 { yyVAL.list = []node.Node{yyDollar[1].node} } case 82: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:946 + //line php5/php5.y:1191 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 83: yyDollar = yyS[yypt-8 : yypt+1] - //line php5/php5.y:951 + //line php5/php5.y:1196 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(identifier, yyDollar[4].token.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(variable, yyDollar[4].token.Comments()) - yyVAL.node = stmt.NewCatch([]node.Node{yyDollar[3].node}, variable, yyDollar[7].list) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[8].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.CatchToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[4].token, comment.StringToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.CloseParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[8].token, comment.CloseCurlyBracesToken) } case 84: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:968 + //line php5/php5.y:1218 { yyVAL.list = []node.Node{yyDollar[1].node} } case 85: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:970 + //line php5/php5.y:1220 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) } case 86: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:975 + //line php5/php5.y:1230 { yyVAL.node = yyDollar[1].node } case 87: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:980 + //line php5/php5.y:1235 { yyVAL.node = yyDollar[1].node } case 88: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:985 + //line php5/php5.y:1240 { yyVAL.node = yyDollar[1].node } case 89: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:990 + //line php5/php5.y:1245 { yyVAL.token = nil } case 90: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:992 + //line php5/php5.y:1247 { yyVAL.token = yyDollar[1].token } case 91: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:997 + //line php5/php5.y:1252 { yyVAL.token = nil } case 92: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:999 + //line php5/php5.y:1254 { yyVAL.token = yyDollar[1].token } case 93: yyDollar = yyS[yypt-9 : yypt+1] - //line php5/php5.y:1004 + //line php5/php5.y:1259 { name := node.NewIdentifier(yyDollar[3].token.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(name, yyDollar[3].token.Comments()) - yyVAL.node = stmt.NewFunction(name, yyDollar[2].token != nil, yyDollar[5].list, nil, yyDollar[8].list, "") + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[9].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FunctionToken) + if yyDollar[2].token != nil { + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AmpersandToken) + } + yylex.(*Parser).comments.AddFromToken(name, yyDollar[3].token, comment.StringToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.CloseParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[9].token, comment.CloseCurlyBracesToken) } case 94: yyDollar = yyS[yypt-7 : yypt+1] - //line php5/php5.y:1017 + //line php5/php5.y:1282 { + name := node.NewIdentifier(yyDollar[2].token.Value) switch n := yyDollar[1].node.(type) { case *stmt.Class: - name := node.NewIdentifier(yyDollar[2].token.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) n.ClassName = name n.Stmts = yyDollar[6].list n.Extends = yyDollar[3].ClassExtends @@ -3245,515 +3496,683 @@ yydefault: case *stmt.Trait: // TODO: is it possible that trait extend or implement - name := node.NewIdentifier(yyDollar[2].token.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) n.TraitName = name n.Stmts = yyDollar[6].list } - yyVAL.node = yyDollar[1].node + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(name, yyDollar[2].token, comment.StringToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.CloseCurlyBracesToken) } case 95: yyDollar = yyS[yypt-6 : yypt+1] - //line php5/php5.y:1038 + //line php5/php5.y:1307 { name := node.NewIdentifier(yyDollar[2].token.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(name, yyDollar[2].token.Comments()) - yyVAL.node = stmt.NewInterface(name, yyDollar[3].InterfaceExtends, yyDollar[5].list, "") + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[6].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(name, yyDollar[2].token, comment.StringToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.CloseCurlyBracesToken) } case 96: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1052 + //line php5/php5.y:1325 { yyVAL.node = stmt.NewClass(nil, nil, nil, nil, nil, nil, "") + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ClassToken) } case 97: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1058 + //line php5/php5.y:1335 { classModifier := node.NewIdentifier(yyDollar[1].token.Value) - yylex.(*Parser).positions.AddPosition(classModifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(classModifier, yyDollar[1].token.Comments()) - yyVAL.node = stmt.NewClass(nil, []node.Node{classModifier}, nil, nil, nil, nil, "") + + // save position + yylex.(*Parser).positions.AddPosition(classModifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(classModifier, yyDollar[1].token, comment.AbstractToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ClassToken) } case 98: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1068 + //line php5/php5.y:1348 { yyVAL.node = stmt.NewTrait(nil, nil, "") + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.TraitToken) } case 99: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1074 + //line php5/php5.y:1358 { classModifier := node.NewIdentifier(yyDollar[1].token.Value) - yylex.(*Parser).positions.AddPosition(classModifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(classModifier, yyDollar[1].token.Comments()) - yyVAL.node = stmt.NewClass(nil, []node.Node{classModifier}, nil, nil, nil, nil, "") + + // save position + yylex.(*Parser).positions.AddPosition(classModifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(classModifier, yyDollar[1].token, comment.FinalToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ClassToken) } case 100: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1087 + //line php5/php5.y:1374 { yyVAL.ClassExtends = nil } case 101: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1089 + //line php5/php5.y:1376 { yyVAL.ClassExtends = stmt.NewClassExtends(yyDollar[2].node) // save position yylex.(*Parser).positions.AddPosition(yyVAL.ClassExtends, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.ClassExtends, yyDollar[1].token, comment.ExtendsToken) } case 102: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1099 + //line php5/php5.y:1389 { yyVAL.token = yyDollar[1].token } case 103: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1104 + //line php5/php5.y:1394 { yyVAL.InterfaceExtends = nil } case 104: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1106 + //line php5/php5.y:1396 { yyVAL.InterfaceExtends = stmt.NewInterfaceExtends(yyDollar[2].list) // save position yylex.(*Parser).positions.AddPosition(yyVAL.InterfaceExtends, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.InterfaceExtends, yyDollar[1].token, comment.ExtendsToken) } case 105: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1116 + //line php5/php5.y:1409 { yyVAL.ClassImplements = nil } case 106: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1118 + //line php5/php5.y:1411 { yyVAL.ClassImplements = stmt.NewClassImplements(yyDollar[2].list) // save position yylex.(*Parser).positions.AddPosition(yyVAL.ClassImplements, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.ClassImplements, yyDollar[1].token, comment.ImplementsToken) } case 107: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1128 + //line php5/php5.y:1424 { yyVAL.list = []node.Node{yyDollar[1].node} } case 108: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1130 + //line php5/php5.y:1426 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) } case 109: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1135 + //line php5/php5.y:1436 { yyVAL.node = nil } case 110: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1137 + //line php5/php5.y:1438 { yyVAL.node = yyDollar[2].node + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DoubleArrowToken) } case 111: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1142 + //line php5/php5.y:1448 { yyVAL.node = yyDollar[1].node } case 112: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1144 + //line php5/php5.y:1450 { yyVAL.node = expr.NewReference(yyDollar[2].node) + + // save position + yylex.(*Parser).positions.AddPosition(yyDollar[2].node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.AmpersandToken) } case 113: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1146 + //line php5/php5.y:1460 { - list := expr.NewList(yyDollar[3].list) - yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) - yyVAL.node = list - yylex.(*Parser).comments.AddComments(list, yyDollar[1].token.Comments()) + yyVAL.node = expr.NewList(yyDollar[3].list) + + // save position + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ListToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken) } case 114: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1156 + //line php5/php5.y:1475 { yyVAL.node = stmt.NewFor(nil, nil, nil, yyDollar[1].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node)) } case 115: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1161 + //line php5/php5.y:1482 { stmtList := stmt.NewStmtList(yyDollar[2].list) yyVAL.node = stmt.NewAltFor(nil, nil, nil, stmtList) + // save position yylex.(*Parser).positions.AddPosition(stmtList, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ColonToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.EndforToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken) } case 116: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1173 + //line php5/php5.y:1499 { yyVAL.node = stmt.NewForeach(nil, nil, nil, yyDollar[1].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node)) } case 117: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1178 + //line php5/php5.y:1506 { stmtList := stmt.NewStmtList(yyDollar[2].list) yyVAL.node = stmt.NewAltForeach(nil, nil, nil, stmtList) + // save position yylex.(*Parser).positions.AddPosition(stmtList, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ColonToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.EndforeachToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken) } case 118: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1190 + //line php5/php5.y:1524 { yyVAL.node = yyDollar[1].node } case 119: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1192 + //line php5/php5.y:1526 { yyVAL.node = stmt.NewStmtList(yyDollar[2].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ColonToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.EnddeclareToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken) } case 120: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1202 + //line php5/php5.y:1542 { name := node.NewIdentifier(yyDollar[1].token.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments()) - constant := stmt.NewConstant(name, yyDollar[3].node, "") - yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(constant, yyDollar[1].token.Comments()) - yyVAL.list = []node.Node{constant} + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(name, yyDollar[1].token, comment.StringToken) + yylex.(*Parser).comments.AddFromToken(constant, yyDollar[2].token, comment.EqualToken) } case 121: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:1214 + //line php5/php5.y:1556 { name := node.NewIdentifier(yyDollar[3].token.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(name, yyDollar[3].token.Comments()) - constant := stmt.NewConstant(name, yyDollar[5].node, "") - yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node)) - yylex.(*Parser).comments.AddComments(constant, yyDollar[3].token.Comments()) - yyVAL.list = append(yyDollar[1].list, constant) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) + yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(name, yyDollar[3].token, comment.StringToken) + yylex.(*Parser).comments.AddFromToken(constant, yyDollar[4].token, comment.EqualToken) } case 122: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1230 + //line php5/php5.y:1575 { caseList := stmt.NewCaseList(yyDollar[2].list) yyVAL.node = stmt.NewSwitch(nil, caseList) + // save position yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[1].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[3].token, comment.CloseCurlyBracesToken) } case 123: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1238 + //line php5/php5.y:1588 { caseList := stmt.NewCaseList(yyDollar[3].list) yyVAL.node = stmt.NewSwitch(nil, caseList) + // save position yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[1].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[2].token, comment.SemiColonToken) + yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[4].token, comment.CloseCurlyBracesToken) } case 124: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1246 + //line php5/php5.y:1602 { caseList := stmt.NewCaseList(yyDollar[2].list) yyVAL.node = stmt.NewAltSwitch(nil, caseList) + // save position yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[1].token, comment.ColonToken) + yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[3].token, comment.EndswitchToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken) } case 125: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:1254 + //line php5/php5.y:1616 { caseList := stmt.NewCaseList(yyDollar[3].list) yyVAL.node = stmt.NewAltSwitch(nil, caseList) + // save position yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[3].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[5].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[1].token, comment.ColonToken) + yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[2].token, comment.SemiColonToken) + yylex.(*Parser).comments.AddFromToken(caseList, yyDollar[4].token, comment.EndswitchToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.SemiColonToken) } case 126: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1267 + //line php5/php5.y:1636 { yyVAL.list = []node.Node{} } case 127: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:1269 + //line php5/php5.y:1638 { _case := stmt.NewCase(yyDollar[3].node, yyDollar[5].list) - yylex.(*Parser).positions.AddPosition(_case, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[5].list)) yyVAL.list = append(yyDollar[1].list, _case) - yylex.(*Parser).comments.AddComments(_case, yyDollar[2].token.Comments()) + + // save position + yylex.(*Parser).positions.AddPosition(_case, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[5].list)) + + // save comments + yylex.(*Parser).comments.AddFromToken(_case, yyDollar[2].token, comment.CaseToken) + yylex.(*Parser).comments.AddFromToken(_case, yyDollar[4].token, comment.CaseSeparatorToken) } case 128: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1276 + //line php5/php5.y:1650 { _default := stmt.NewDefault(yyDollar[4].list) - yylex.(*Parser).positions.AddPosition(_default, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[4].list)) yyVAL.list = append(yyDollar[1].list, _default) - yylex.(*Parser).comments.AddComments(_default, yyDollar[2].token.Comments()) + + // save position + yylex.(*Parser).positions.AddPosition(_default, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[4].list)) + + // save comments + yylex.(*Parser).comments.AddFromToken(_default, yyDollar[2].token, comment.DefaultToken) + yylex.(*Parser).comments.AddFromToken(_default, yyDollar[3].token, comment.CaseSeparatorToken) + } + case 129: + yyDollar = yyS[yypt-1 : yypt+1] + //line php5/php5.y:1666 + { + yyVAL.token = yyDollar[1].token + } + case 130: + yyDollar = yyS[yypt-1 : yypt+1] + //line php5/php5.y:1668 + { + yyVAL.token = yyDollar[1].token } case 131: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1293 + //line php5/php5.y:1674 { yyVAL.node = stmt.NewWhile(nil, yyDollar[1].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node)) } case 132: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1298 + //line php5/php5.y:1681 { stmtList := stmt.NewStmtList(yyDollar[2].list) yyVAL.node = stmt.NewAltWhile(nil, stmtList) + // save position yylex.(*Parser).positions.AddPosition(stmtList, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[2].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ColonToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.EndwhileToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.SemiColonToken) } case 133: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1311 + //line php5/php5.y:1700 { yyVAL.list = nil } case 134: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1313 + //line php5/php5.y:1702 { _elseIf := stmt.NewElseIf(yyDollar[3].node, yyDollar[4].node) - yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[4].node)) - yylex.(*Parser).comments.AddComments(_elseIf, yyDollar[2].token.Comments()) - yyVAL.list = append(yyDollar[1].list, _elseIf) + + // save position + yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[4].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(_elseIf, yyDollar[2].token, comment.ElseifToken) } case 135: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1325 + //line php5/php5.y:1717 { yyVAL.list = nil } case 136: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:1327 + //line php5/php5.y:1719 { stmts := stmt.NewStmtList(yyDollar[5].list) - yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[5].list)) - _elseIf := stmt.NewAltElseIf(yyDollar[3].node, stmts) - yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[5].list)) - yylex.(*Parser).comments.AddComments(_elseIf, yyDollar[2].token.Comments()) - yyVAL.list = append(yyDollar[1].list, _elseIf) + + // save position + yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[5].list)) + yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[2].token, yyDollar[5].list)) + + // save comments + yylex.(*Parser).comments.AddFromToken(_elseIf, yyDollar[2].token, comment.ElseifToken) + yylex.(*Parser).comments.AddFromToken(_elseIf, yyDollar[4].token, comment.ColonToken) } case 137: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1342 + //line php5/php5.y:1737 { yyVAL.node = nil } case 138: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1344 + //line php5/php5.y:1739 { yyVAL.node = stmt.NewElse(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ElseToken) } case 139: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1354 + //line php5/php5.y:1753 { yyVAL.node = nil } case 140: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1356 + //line php5/php5.y:1755 { stmts := stmt.NewStmtList(yyDollar[3].list) - yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[3].list)) - yyVAL.node = stmt.NewAltElse(stmts) + + // save position + yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[3].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ElseToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ColonToken) } case 141: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1369 + //line php5/php5.y:1772 { yyVAL.list = yyDollar[1].list } case 142: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1371 + //line php5/php5.y:1774 { yyVAL.list = nil } case 143: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1376 + //line php5/php5.y:1779 { yyVAL.list = []node.Node{yyDollar[1].node} } case 144: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1378 + //line php5/php5.y:1781 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) } case 145: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1383 + //line php5/php5.y:1791 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[4].token.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[4].token.Comments()) - yyVAL.node = node.NewParameter(yyDollar[1].node, variable, nil, yyDollar[2].token != nil, yyDollar[3].token != nil) + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) if yyDollar[1].node != nil { yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) } else if yyDollar[2].token != nil { yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[2].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[2].token.Comments()) } else if yyDollar[3].token != nil { yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[3].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[3].token.Comments()) } else { yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[4].token.Comments()) } + + // save comments + if yyDollar[2].token != nil { + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AmpersandToken) + } + if yyDollar[3].token != nil { + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.EllipsisToken) + } + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[4].token, comment.VariableToken) } case 146: yyDollar = yyS[yypt-6 : yypt+1] - //line php5/php5.y:1409 + //line php5/php5.y:1819 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(identifier, yyDollar[4].token.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(variable, yyDollar[4].token.Comments()) - yyVAL.node = node.NewParameter(yyDollar[1].node, variable, yyDollar[6].node, yyDollar[2].token != nil, yyDollar[3].token != nil) + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) if yyDollar[1].node != nil { yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[6].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) } else if yyDollar[2].token != nil { yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[6].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[2].token.Comments()) } else if yyDollar[3].token != nil { yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[6].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[3].token.Comments()) } else { yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[4].token, yyDollar[6].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[4].token.Comments()) } + + // save comments + if yyDollar[2].token != nil { + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AmpersandToken) + } + if yyDollar[3].token != nil { + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.EllipsisToken) + } + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[4].token, comment.VariableToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.EqualToken) } case 147: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1439 + //line php5/php5.y:1852 { yyVAL.node = nil } case 148: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1441 + //line php5/php5.y:1854 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ArrayToken) } case 149: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1447 + //line php5/php5.y:1864 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.CallableToken) } case 150: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1453 + //line php5/php5.y:1874 { yyVAL.node = yyDollar[1].node } case 151: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1459 + //line php5/php5.y:1880 { yyVAL.node = node.NewArgumentList(nil) // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.CloseParenthesisToken) } case 152: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1466 + //line php5/php5.y:1891 { yyVAL.node = node.NewArgumentList(yyDollar[2].list) // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseParenthesisToken) } case 153: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1473 + //line php5/php5.y:1902 { arg := node.NewArgument(yyDollar[2].node, false, false) yyVAL.node = node.NewArgumentList([]node.Node{arg}) @@ -3761,220 +4180,264 @@ yydefault: // save position yylex.(*Parser).positions.AddPosition(arg, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[2].node)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseParenthesisToken) } case 154: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1486 + //line php5/php5.y:1919 { yyVAL.list = []node.Node{yyDollar[1].node} } case 155: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1488 + //line php5/php5.y:1921 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) } case 156: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1493 + //line php5/php5.y:1931 { yyVAL.node = node.NewArgument(yyDollar[1].node, false, false) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) } case 157: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1499 + //line php5/php5.y:1938 { yyVAL.node = node.NewArgument(yyDollar[1].node, false, false) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) } case 158: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1505 + //line php5/php5.y:1945 { yyVAL.node = node.NewArgument(yyDollar[2].node, false, true) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.AmpersandToken) } case 159: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1511 + //line php5/php5.y:1955 { yyVAL.node = node.NewArgument(yyDollar[2].node, true, false) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.EllipsisToken) } case 160: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1520 + //line php5/php5.y:1968 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) } case 161: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1522 + //line php5/php5.y:1975 { yyVAL.list = []node.Node{yyDollar[1].node} } case 162: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1528 + //line php5/php5.y:1981 { name := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yyVAL.node = expr.NewVariable(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.VariableToken) } case 163: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1538 + //line php5/php5.y:1993 { yyVAL.node = expr.NewVariable(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DollarToken) } case 164: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1544 + //line php5/php5.y:2003 { yyVAL.node = expr.NewVariable(yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DollarToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseCurlyBracesToken) } case 165: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1554 + //line php5/php5.y:2019 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[3].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) - staticVar := stmt.NewStaticVar(variable, nil) - yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) - yyVAL.list = append(yyDollar[1].list, staticVar) - yylex.(*Parser).comments.AddComments(identifier, yyDollar[3].token.Comments()) - yylex.(*Parser).comments.AddComments(variable, yyDollar[3].token.Comments()) - yylex.(*Parser).comments.AddComments(staticVar, yyDollar[3].token.Comments()) + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) + yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[3].token, comment.VariableToken) } case 166: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:1571 + //line php5/php5.y:2035 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[3].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) - staticVar := stmt.NewStaticVar(variable, yyDollar[5].node) - yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node)) - yyVAL.list = append(yyDollar[1].list, staticVar) - yylex.(*Parser).comments.AddComments(identifier, yyDollar[3].token.Comments()) - yylex.(*Parser).comments.AddComments(variable, yyDollar[3].token.Comments()) - yylex.(*Parser).comments.AddComments(staticVar, yyDollar[3].token.Comments()) + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) + yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[3].token, comment.VariableToken) + yylex.(*Parser).comments.AddFromToken(staticVar, yyDollar[4].token, comment.EqualToken) } case 167: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1588 + //line php5/php5.y:2052 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - staticVar := stmt.NewStaticVar(variable, nil) - yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yyVAL.list = []node.Node{staticVar} - yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments()) - yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments()) - yylex.(*Parser).comments.AddComments(staticVar, yyDollar[1].token.Comments()) + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken) } case 168: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1605 + //line php5/php5.y:2067 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - staticVar := stmt.NewStaticVar(variable, yyDollar[3].node) - yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node)) - yyVAL.list = []node.Node{staticVar} - yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments()) - yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments()) - yylex.(*Parser).comments.AddComments(staticVar, yyDollar[1].token.Comments()) + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken) + yylex.(*Parser).comments.AddFromToken(staticVar, yyDollar[2].token, comment.EqualToken) } case 169: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1627 + //line php5/php5.y:2087 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 170: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1629 + //line php5/php5.y:2089 { yyVAL.list = []node.Node{} } case 171: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1635 + //line php5/php5.y:2095 { yyVAL.node = stmt.NewPropertyList(yyDollar[1].list, yyDollar[2].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition(yyDollar[1].list, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.SemiColonToken) } case 172: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1641 + //line php5/php5.y:2105 { yyVAL.node = yyDollar[1].node + + // save position + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken) } case 173: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1643 + //line php5/php5.y:2115 { yyVAL.node = yyDollar[1].node } case 174: yyDollar = yyS[yypt-8 : yypt+1] - //line php5/php5.y:1645 + //line php5/php5.y:2119 { name := node.NewIdentifier(yyDollar[4].token.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(name, yyDollar[4].token.Comments()) - yyVAL.node = stmt.NewClassMethod(name, yyDollar[1].list, yyDollar[3].token != nil, yyDollar[6].list, nil, yyDollar[8].node, "") + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) if yyDollar[1].list == nil { yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[8].node)) } else { yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListNodePosition(yyDollar[1].list, yyDollar[8].node)) } - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.FunctionToken) + if yyDollar[3].token != nil { + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.AmpersandToken) + } + yylex.(*Parser).comments.AddFromToken(name, yyDollar[4].token, comment.IdentifierToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.CloseParenthesisToken) } case 175: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1664 + //line php5/php5.y:2144 { var adaptationList *stmt.TraitAdaptationList switch n := yyDollar[3].node.(type) { @@ -3983,465 +4446,561 @@ yydefault: default: adaptationList = nil } - yyVAL.node = stmt.NewTraitUse(yyDollar[2].list, adaptationList) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UseToken) } case 176: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1681 + //line php5/php5.y:2164 { yyVAL.list = []node.Node{yyDollar[1].node} } case 177: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1683 + //line php5/php5.y:2166 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) } case 178: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1688 + //line php5/php5.y:2176 { yyVAL.node = stmt.NewNop() yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.SemiColonToken) + } case 179: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1694 + //line php5/php5.y:2186 { yyVAL.node = stmt.NewTraitAdaptationList(yyDollar[2].list) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken) } case 180: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1703 + //line php5/php5.y:2199 { yyVAL.list = nil } case 181: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1705 + //line php5/php5.y:2201 { yyVAL.list = yyDollar[1].list } case 182: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1710 + //line php5/php5.y:2206 { yyVAL.list = []node.Node{yyDollar[1].node} } case 183: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1712 + //line php5/php5.y:2208 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 184: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1717 + //line php5/php5.y:2213 { yyVAL.node = yyDollar[1].node + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken) } case 185: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1719 + //line php5/php5.y:2220 { yyVAL.node = yyDollar[1].node + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SemiColonToken) } case 186: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1724 + //line php5/php5.y:2230 { yyVAL.node = stmt.NewTraitUsePrecedence(yyDollar[1].node, yyDollar[3].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeNodeListPosition(yyDollar[1].node, yyDollar[3].list)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.InsteadofToken) } case 187: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1733 + //line php5/php5.y:2243 { yyVAL.list = []node.Node{yyDollar[1].node} } case 188: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1735 + //line php5/php5.y:2245 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) } case 189: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1740 + //line php5/php5.y:2255 { name := node.NewIdentifier(yyDollar[1].token.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments()) - yyVAL.node = stmt.NewTraitMethodRef(nil, name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(name, yyDollar[1].token, comment.IdentifierToken) } case 190: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1750 + //line php5/php5.y:2267 { yyVAL.node = yyDollar[1].node } case 191: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1755 + //line php5/php5.y:2272 { target := node.NewIdentifier(yyDollar[3].token.Value) - yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(target, yyDollar[3].token.Comments()) - yyVAL.node = stmt.NewTraitMethodRef(yyDollar[1].node, target) + + // save position + yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken) + yylex.(*Parser).comments.AddFromToken(target, yyDollar[3].token, comment.IdentifierToken) } case 192: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1768 + //line php5/php5.y:2288 { alias := node.NewIdentifier(yyDollar[4].token.Value) - yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, yyDollar[3].node, alias) + + // save position + yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(alias, yyDollar[4].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsToken) + yylex.(*Parser).comments.AddFromToken(alias, yyDollar[4].token, comment.IdentifierToken) } case 193: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1778 + //line php5/php5.y:2301 { yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, yyDollar[3].node, nil) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsToken) } case 194: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1787 + //line php5/php5.y:2314 { yyVAL.node = nil } case 195: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1789 + //line php5/php5.y:2316 { yyVAL.node = yyDollar[1].node } case 196: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1794 + //line php5/php5.y:2321 { yyVAL.node = stmt.NewNop() + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.SemiColonToken) } case 197: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1800 + //line php5/php5.y:2331 { yyVAL.node = stmt.NewStmtList(yyDollar[2].list) + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken) } case 198: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1809 + //line php5/php5.y:2345 { yyVAL.list = yyDollar[1].list } case 199: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1811 + //line php5/php5.y:2347 { modifier := node.NewIdentifier(yyDollar[1].token.Value) - yylex.(*Parser).positions.AddPosition(modifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(modifier, yyDollar[1].token.Comments()) - yyVAL.list = []node.Node{modifier} + + // save position + yylex.(*Parser).positions.AddPosition(modifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(modifier, yyDollar[1].token, comment.VarToken) } case 200: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1822 + //line php5/php5.y:2361 { yyVAL.list = nil } case 201: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1824 + //line php5/php5.y:2363 { yyVAL.list = yyDollar[1].list } case 202: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1829 + //line php5/php5.y:2368 { yyVAL.list = []node.Node{yyDollar[1].node} } case 203: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1831 + //line php5/php5.y:2370 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 204: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1836 + //line php5/php5.y:2375 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.PublicToken) } case 205: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1842 + //line php5/php5.y:2385 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ProtectedToken) } case 206: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1848 + //line php5/php5.y:2395 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.PrivateToken) } case 207: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1854 + //line php5/php5.y:2405 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StaticToken) } case 208: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1860 + //line php5/php5.y:2415 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.AbstractToken) } case 209: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1866 + //line php5/php5.y:2425 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FinalToken) } case 210: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1875 + //line php5/php5.y:2438 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[3].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(identifier, yyDollar[3].token.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(variable, yyDollar[3].token.Comments()) - property := stmt.NewProperty(variable, nil, "") - yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(property, yyDollar[3].token.Comments()) - yyVAL.list = append(yyDollar[1].list, property) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) + yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[3].token, comment.VariableToken) } case 211: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:1891 + //line php5/php5.y:2454 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[3].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(identifier, yyDollar[3].token.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(variable, yyDollar[3].token.Comments()) - property := stmt.NewProperty(variable, yyDollar[5].node, "") - yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node)) - yylex.(*Parser).comments.AddComments(property, yyDollar[3].token.Comments()) - yyVAL.list = append(yyDollar[1].list, property) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) + yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[3].token, comment.VariableToken) + yylex.(*Parser).comments.AddFromToken(property, yyDollar[4].token, comment.EqualToken) } case 212: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1907 + //line php5/php5.y:2471 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments()) - property := stmt.NewProperty(variable, nil, "") - yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(property, yyDollar[1].token.Comments()) - yyVAL.list = []node.Node{property} + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken) } case 213: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1923 + //line php5/php5.y:2486 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments()) - property := stmt.NewProperty(variable, yyDollar[3].node, "") - yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(property, yyDollar[1].token.Comments()) - yyVAL.list = []node.Node{property} + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[3].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken) + yylex.(*Parser).comments.AddFromToken(property, yyDollar[2].token, comment.EqualToken) } case 214: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:1942 + //line php5/php5.y:2505 { name := node.NewIdentifier(yyDollar[3].token.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(name, yyDollar[3].token.Comments()) - constant := stmt.NewConstant(name, yyDollar[5].node, "") - yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node)) - yylex.(*Parser).comments.AddComments(constant, yyDollar[3].token.Comments()) + constList := yyDollar[1].node.(*stmt.ClassConstList) + constList.Consts = append(constList.Consts, constant) + yyVAL.node = yyDollar[1].node - yyDollar[1].node.(*stmt.ClassConstList).Consts = append(yyDollar[1].node.(*stmt.ClassConstList).Consts, constant) + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) + yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[5].node)) yylex.(*Parser).positions.AddPosition(yyDollar[1].node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[5].node)) - yyVAL.node = yyDollar[1].node + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(constList.Consts), yyDollar[2].token, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(name, yyDollar[3].token, comment.IdentifierToken) + yylex.(*Parser).comments.AddFromToken(constant, yyDollar[4].token, comment.EqualToken) } case 215: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:1957 + //line php5/php5.y:2523 { name := node.NewIdentifier(yyDollar[2].token.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(name, yyDollar[2].token.Comments()) - constant := stmt.NewConstant(name, yyDollar[4].node, "") - yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[4].node)) - yylex.(*Parser).comments.AddComments(constant, yyDollar[2].token.Comments()) - yyVAL.node = stmt.NewClassConstList(nil, []node.Node{constant}) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) + yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[2].token, yyDollar[4].node)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[4].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ConstToken) + yylex.(*Parser).comments.AddFromToken(name, yyDollar[2].token, comment.IdentifierToken) + yylex.(*Parser).comments.AddFromToken(constant, yyDollar[3].token, comment.EqualToken) } case 216: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1974 + //line php5/php5.y:2542 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) } case 217: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1976 + //line php5/php5.y:2549 { yyVAL.list = []node.Node{yyDollar[1].node} } case 218: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:1982 + //line php5/php5.y:2555 { yyVAL.list = nil } case 219: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1984 + //line php5/php5.y:2557 { yyVAL.list = yyDollar[1].list } case 220: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:1989 + //line php5/php5.y:2562 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) } case 221: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1991 + //line php5/php5.y:2569 { yyVAL.list = []node.Node{yyDollar[1].node} } case 222: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:1996 + //line php5/php5.y:2574 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) } case 223: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:1998 + //line php5/php5.y:2576 { yyVAL.list = yyDollar[1].list } case 224: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2003 + //line php5/php5.y:2581 { fetch := expr.NewArrayDimFetch(nil, yyDollar[3].node) + yyVAL.list = append(yyDollar[1].list, fetch) + + // save position yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[3].node)) - yyVAL.list = append(yyDollar[1].list, fetch) + // save comments + yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[2].token, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[4].token, comment.CloseSquareBracket) } case 225: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2010 + //line php5/php5.y:2593 { fetch := expr.NewArrayDimFetch(nil, yyDollar[2].node) + yyVAL.list = []node.Node{fetch} + + // save position yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[2].node)) - yyVAL.list = []node.Node{fetch} + // save comments + yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[1].token, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[3].token, comment.CloseSquareBracket) } case 226: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2020 + //line php5/php5.y:2608 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) } case 227: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2022 + //line php5/php5.y:2610 { yyVAL.list = yyDollar[1].list } case 228: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2024 + //line php5/php5.y:2612 { yyVAL.list = yyDollar[1].list } case 229: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:2029 + //line php5/php5.y:2617 { yyVAL.list = nil } case 230: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2031 + //line php5/php5.y:2619 { yyVAL.list = yyDollar[1].list } case 231: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2036 + //line php5/php5.y:2624 { if yyDollar[3].node != nil { @@ -4452,446 +5011,656 @@ yydefault: yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) } - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NewToken) } case 232: yyDollar = yyS[yypt-6 : yypt+1] - //line php5/php5.y:2052 + //line php5/php5.y:2641 { list := expr.NewList(yyDollar[3].list) - yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) yyVAL.node = assign.NewAssign(list, yyDollar[6].node) + + // save position + yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[6].node)) - yylex.(*Parser).comments.AddComments(list, yyDollar[1].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(list, yyDollar[1].token, comment.ListToken) + yylex.(*Parser).comments.AddFromToken(list, yyDollar[2].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(list, yyDollar[4].token, comment.CloseParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.EqualToken) } case 233: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2062 + //line php5/php5.y:2656 { yyVAL.node = assign.NewAssign(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.EqualToken) } case 234: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2068 + //line php5/php5.y:2666 { yyVAL.node = assign.NewReference(yyDollar[1].node, yyDollar[4].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.EqualToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.AmpersandToken) } case 235: yyDollar = yyS[yypt-6 : yypt+1] - //line php5/php5.y:2074 + //line php5/php5.y:2677 { var _new *expr.New if yyDollar[6].node != nil { _new = expr.NewNew(yyDollar[5].node, yyDollar[6].node.(*node.ArgumentList)) - yylex.(*Parser).positions.AddPosition(_new, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[4].token, yyDollar[6].node)) } else { _new = expr.NewNew(yyDollar[5].node, nil) + } + yyVAL.node = assign.NewReference(yyDollar[1].node, _new) + + // save position + if yyDollar[6].node != nil { + yylex.(*Parser).positions.AddPosition(_new, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[4].token, yyDollar[6].node)) + } else { yylex.(*Parser).positions.AddPosition(_new, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[4].token, yyDollar[5].node)) } - yylex.(*Parser).comments.AddComments(_new, yylex.(*Parser).comments[yyDollar[1].node]) - - yyVAL.node = assign.NewReference(yyDollar[1].node, _new) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, _new)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.EqualToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.AmpersandToken) + yylex.(*Parser).comments.AddFromToken(_new, yyDollar[4].token, comment.NewToken) } case 236: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2091 + //line php5/php5.y:2701 { yyVAL.node = expr.NewClone(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.CloneToken) } case 237: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2097 + //line php5/php5.y:2711 { yyVAL.node = assign.NewPlus(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PlusEqualToken) } case 238: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2103 + //line php5/php5.y:2721 { yyVAL.node = assign.NewMinus(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.MinusEqualToken) } case 239: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2109 + //line php5/php5.y:2731 { yyVAL.node = assign.NewMul(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.MulEqualToken) } case 240: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2115 + //line php5/php5.y:2741 { yyVAL.node = assign.NewPow(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PowEqualToken) } case 241: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2121 + //line php5/php5.y:2751 { yyVAL.node = assign.NewDiv(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.DivEqualToken) } case 242: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2127 + //line php5/php5.y:2761 { yyVAL.node = assign.NewConcat(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ConcatEqualToken) } case 243: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2133 + //line php5/php5.y:2771 { yyVAL.node = assign.NewMod(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ModEqualToken) } case 244: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2139 + //line php5/php5.y:2781 { yyVAL.node = assign.NewBitwiseAnd(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AndEqualToken) } case 245: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2145 + //line php5/php5.y:2791 { yyVAL.node = assign.NewBitwiseOr(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OrEqualToken) } case 246: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2151 + //line php5/php5.y:2801 { yyVAL.node = assign.NewBitwiseXor(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.XorEqualToken) } case 247: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2157 + //line php5/php5.y:2811 { yyVAL.node = assign.NewShiftLeft(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SlEqualToken) } case 248: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2163 + //line php5/php5.y:2821 { yyVAL.node = assign.NewShiftRight(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SrEqualToken) } case 249: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2169 + //line php5/php5.y:2831 { yyVAL.node = expr.NewPostInc(yyDollar[1].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IncToken) } case 250: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2175 + //line php5/php5.y:2841 { yyVAL.node = expr.NewPreInc(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IncToken) } case 251: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2181 + //line php5/php5.y:2851 { yyVAL.node = expr.NewPostDec(yyDollar[1].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.DecToken) } case 252: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2187 + //line php5/php5.y:2861 { yyVAL.node = expr.NewPreDec(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DecToken) } case 253: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2193 + //line php5/php5.y:2871 { yyVAL.node = binary.NewBooleanOr(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.BooleanOrToken) } case 254: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2199 + //line php5/php5.y:2881 { yyVAL.node = binary.NewBooleanAnd(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.BooleanAndToken) } case 255: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2205 + //line php5/php5.y:2891 { yyVAL.node = binary.NewLogicalOr(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LogicalOrToken) } case 256: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2211 + //line php5/php5.y:2901 { yyVAL.node = binary.NewLogicalAnd(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LogicalAndToken) } case 257: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2217 + //line php5/php5.y:2911 { yyVAL.node = binary.NewLogicalXor(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LogicalXorToken) } case 258: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2223 + //line php5/php5.y:2921 { yyVAL.node = binary.NewBitwiseOr(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.VerticalBarToken) } case 259: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2229 + //line php5/php5.y:2931 { yyVAL.node = binary.NewBitwiseAnd(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AmpersandToken) } case 260: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2235 + //line php5/php5.y:2941 { yyVAL.node = binary.NewBitwiseXor(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.CaretToken) } case 261: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2241 + //line php5/php5.y:2951 { yyVAL.node = binary.NewConcat(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.DotToken) } case 262: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2247 + //line php5/php5.y:2961 { yyVAL.node = binary.NewPlus(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PlusToken) } case 263: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2253 + //line php5/php5.y:2971 { yyVAL.node = binary.NewMinus(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.MinusToken) } case 264: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2259 + //line php5/php5.y:2981 { yyVAL.node = binary.NewMul(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsteriskToken) } case 265: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2265 + //line php5/php5.y:2991 { yyVAL.node = binary.NewPow(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PowToken) } case 266: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2271 + //line php5/php5.y:3001 { yyVAL.node = binary.NewDiv(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SlashToken) } case 267: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2277 + //line php5/php5.y:3011 { yyVAL.node = binary.NewMod(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PercentToken) } case 268: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2283 + //line php5/php5.y:3021 { yyVAL.node = binary.NewShiftLeft(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SlToken) } case 269: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2289 + //line php5/php5.y:3031 { yyVAL.node = binary.NewShiftRight(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SrToken) } case 270: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2295 + //line php5/php5.y:3041 { yyVAL.node = expr.NewUnaryPlus(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.PlusToken) } case 271: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2301 + //line php5/php5.y:3051 { yyVAL.node = expr.NewUnaryMinus(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.MinusToken) } case 272: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2307 + //line php5/php5.y:3061 { yyVAL.node = expr.NewBooleanNot(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ExclamationMarkToken) } case 273: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2313 + //line php5/php5.y:3071 { yyVAL.node = expr.NewBitwiseNot(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.TildeToken) } case 274: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2319 + //line php5/php5.y:3081 { yyVAL.node = binary.NewIdentical(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsIdenticalToken) } case 275: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2325 + //line php5/php5.y:3091 { yyVAL.node = binary.NewNotIdentical(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsNotIdenticalToken) } case 276: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2331 + //line php5/php5.y:3101 { yyVAL.node = binary.NewEqual(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsEqualToken) } case 277: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2337 + //line php5/php5.y:3111 { yyVAL.node = binary.NewNotEqual(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsNotEqualToken) } case 278: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2343 + //line php5/php5.y:3121 { yyVAL.node = binary.NewSmaller(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LessToken) } case 279: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2349 + //line php5/php5.y:3131 { yyVAL.node = binary.NewSmallerOrEqual(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsSmallerOrEqualToken) } case 280: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2355 + //line php5/php5.y:3141 { yyVAL.node = binary.NewGreater(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.GreaterToken) } case 281: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2361 + //line php5/php5.y:3151 { yyVAL.node = binary.NewGreaterOrEqual(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsGreaterOrEqualToken) } case 282: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2367 + //line php5/php5.y:3161 { yyVAL.node = expr.NewInstanceOf(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.InstanceofToken) } case 283: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2373 + //line php5/php5.y:3171 { yyVAL.node = yyDollar[1].node } case 284: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2375 + //line php5/php5.y:3173 { yyVAL.node = yyDollar[1].node } case 285: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2377 + //line php5/php5.y:3175 { yyVAL.node = yyDollar[2].node @@ -4899,281 +5668,423 @@ yydefault: switch nn := n.(type) { case *expr.ArrayDimFetch: nn.Variable = yyVAL.node - yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn)) - yylex.(*Parser).comments.AddComments(nn, yyDollar[1].token.Comments()) yyVAL.node = nn case *expr.PropertyFetch: nn.Variable = yyVAL.node - yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn)) - yylex.(*Parser).comments.AddComments(nn, yyDollar[1].token.Comments()) yyVAL.node = nn case *expr.MethodCall: nn.Variable = yyVAL.node - yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn)) - yylex.(*Parser).comments.AddComments(nn, yyDollar[1].token.Comments()) yyVAL.node = nn } + + // save position + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, n)) } + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseParenthesisToken) } case 286: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:2403 + //line php5/php5.y:3202 { yyVAL.node = expr.NewTernary(yyDollar[1].node, yyDollar[3].node, yyDollar[5].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[5].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.QuestionMarkToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.ColonToken) } case 287: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2409 + //line php5/php5.y:3213 { yyVAL.node = expr.NewTernary(yyDollar[1].node, nil, yyDollar[4].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.QuestionMarkToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.ColonToken) } case 288: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2415 + //line php5/php5.y:3224 { yyVAL.node = yyDollar[1].node } case 289: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2417 + //line php5/php5.y:3226 { yyVAL.node = cast.NewInt(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IntCastToken) } case 290: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2423 + //line php5/php5.y:3236 { yyVAL.node = cast.NewDouble(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DoubleCastToken) } case 291: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2429 + //line php5/php5.y:3246 { yyVAL.node = cast.NewString(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StringCastToken) } case 292: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2435 + //line php5/php5.y:3256 { yyVAL.node = cast.NewArray(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ArrayCastToken) } case 293: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2441 + //line php5/php5.y:3266 { yyVAL.node = cast.NewObject(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ObjectCastToken) } case 294: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2447 + //line php5/php5.y:3276 { yyVAL.node = cast.NewBool(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.BoolCastToken) } case 295: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2453 + //line php5/php5.y:3286 { yyVAL.node = cast.NewUnset(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.UnsetCastToken) } case 296: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2459 + //line php5/php5.y:3296 { if strings.EqualFold(yyDollar[1].token.Value, "die") { - yyVAL.node = expr.NewDie(yyDollar[2].node) + yyVAL.node = expr.NewDie(nil) + if yyDollar[2].node != nil { + yyVAL.node.(*expr.Die).Expr = yyDollar[2].node.(*expr.Exit).Expr + } } else { - yyVAL.node = expr.NewExit(yyDollar[2].node) + yyVAL.node = expr.NewExit(nil) + if yyDollar[2].node != nil { + yyVAL.node.(*expr.Exit).Expr = yyDollar[2].node.(*expr.Exit).Expr + } + } + + // save position + if yyDollar[2].node == nil { + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + } else { + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) + } + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ExitToken) + + if yyDollar[2].node != nil { + yylex.(*Parser).comments.AddFromChildNode(yyVAL.node, yyDollar[2].node) } - yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) } case 297: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2469 + //line php5/php5.y:3324 { yyVAL.node = expr.NewErrorSuppress(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.AtToken) } case 298: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2475 + //line php5/php5.y:3334 { yyVAL.node = yyDollar[1].node } case 299: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2477 + //line php5/php5.y:3336 { yyVAL.node = yyDollar[1].node } case 300: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2479 + //line php5/php5.y:3338 { yyVAL.node = yyDollar[1].node } case 301: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2481 + //line php5/php5.y:3340 { yyVAL.node = expr.NewShellExec(yyDollar[2].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.BackquoteToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.BackquoteToken) } case 302: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2487 + //line php5/php5.y:3351 { yyVAL.node = expr.NewPrint(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.PrintToken) } case 303: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2493 + //line php5/php5.y:3361 { yyVAL.node = expr.NewYield(nil, nil) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.YieldToken) } case 304: yyDollar = yyS[yypt-9 : yypt+1] - //line php5/php5.y:2499 + //line php5/php5.y:3371 { yyVAL.node = expr.NewClosure(yyDollar[4].list, yyDollar[6].ClosureUse, nil, yyDollar[8].list, false, yyDollar[2].token != nil, "") + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[9].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FunctionToken) + if yyDollar[2].token != nil { + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AmpersandToken) + } + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.CloseParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[7].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[9].token, comment.CloseCurlyBracesToken) } case 305: yyDollar = yyS[yypt-10 : yypt+1] - //line php5/php5.y:2506 + //line php5/php5.y:3388 { yyVAL.node = expr.NewClosure(yyDollar[5].list, yyDollar[7].ClosureUse, nil, yyDollar[9].list, true, yyDollar[3].token != nil, "") + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[10].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StaticToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.FunctionToken) + if yyDollar[3].token != nil { + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.AmpersandToken) + } + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.CloseParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[8].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[10].token, comment.CloseCurlyBracesToken) } case 306: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2516 + //line php5/php5.y:3409 { yyVAL.node = expr.NewYield(nil, yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.YieldToken) } case 307: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2522 + //line php5/php5.y:3419 { yyVAL.node = expr.NewYield(nil, yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.YieldToken) } case 308: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2528 + //line php5/php5.y:3429 { yyVAL.node = expr.NewYield(yyDollar[2].node, yyDollar[4].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[4].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.YieldToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.DoubleArrowToken) } case 309: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2534 + //line php5/php5.y:3440 { yyVAL.node = expr.NewYield(yyDollar[2].node, yyDollar[4].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[4].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.YieldToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.DoubleArrowToken) } case 310: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2543 + //line php5/php5.y:3454 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket) } case 311: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2549 + //line php5/php5.y:3465 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket) } case 312: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2555 + //line php5/php5.y:3476 { str := scalar.NewString(yyDollar[1].token.Value) - yylex.(*Parser).positions.AddPosition(str, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(str, yyDollar[1].token.Comments()) - yyVAL.node = expr.NewArrayDimFetch(str, yyDollar[3].node) + + // save position + yylex.(*Parser).positions.AddPosition(str, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(str, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[str]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket) } case 313: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2565 + //line php5/php5.y:3489 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket) } case 314: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2574 + //line php5/php5.y:3503 { yyVAL.node = expr.NewArray(yyDollar[3].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ArrayToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken) } case 315: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2580 + //line php5/php5.y:3515 { yyVAL.node = expr.NewShortArray(yyDollar[2].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseSquareBracket) } case 316: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2589 + //line php5/php5.y:3529 { yyVAL.token = yyDollar[1].token } case 317: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:2594 + //line php5/php5.y:3534 { yyVAL.ClosureUse = nil } case 318: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2596 + //line php5/php5.y:3536 { yyVAL.ClosureUse = expr.NewClosureUse(yyDollar[3].list) @@ -5181,226 +6092,279 @@ yydefault: } case 319: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2605 + //line php5/php5.y:3545 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[3].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(identifier, yyDollar[3].token.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(variable, yyDollar[3].token.Comments()) - yyVAL.list = append(yyDollar[1].list, variable) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[3].token, comment.VariableToken) } case 320: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2617 + //line php5/php5.y:3559 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(identifier, yyDollar[4].token.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(variable, yyDollar[3].token.Comments()) - reference := expr.NewReference(variable) - yyVAL.list = append(yyDollar[1].list, reference) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(reference, yyDollar[3].token, comment.VariableToken) + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[4].token, comment.VariableToken) } case 321: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2631 + //line php5/php5.y:3575 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments()) - yyVAL.list = []node.Node{variable} + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken) } case 322: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2643 + //line php5/php5.y:3588 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[2].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(identifier, yyDollar[2].token.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments()) - reference := expr.NewReference(variable) - yyVAL.list = []node.Node{reference} + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) + yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(reference, yyDollar[1].token, comment.VariableToken) + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[2].token, comment.VariableToken) } case 323: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2660 + //line php5/php5.y:3607 { name := name.NewName(yyDollar[1].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) - yyVAL.node = expr.NewFunctionCall(name, yyDollar[2].node.(*node.ArgumentList)) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(name, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[name]) } case 324: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2670 + //line php5/php5.y:3616 { funcName := name.NewRelative(yyDollar[3].list) - yylex.(*Parser).positions.AddPosition(funcName, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list)) - yylex.(*Parser).comments.AddComments(funcName, yyDollar[1].token.Comments()) - yyVAL.node = expr.NewFunctionCall(funcName, yyDollar[4].node.(*node.ArgumentList)) + + // save position + yylex.(*Parser).positions.AddPosition(funcName, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(funcName, yyDollar[4].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[funcName]) + + // save comments + yylex.(*Parser).comments.AddFromToken(funcName, yyDollar[1].token, comment.NamespaceToken) + yylex.(*Parser).comments.AddFromToken(funcName, yyDollar[2].token, comment.NsSeparatorToken) } case 325: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2680 + //line php5/php5.y:3629 { funcName := name.NewFullyQualified(yyDollar[2].list) - yylex.(*Parser).positions.AddPosition(funcName, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list)) - yylex.(*Parser).comments.AddComments(funcName, yyDollar[1].token.Comments()) - yyVAL.node = expr.NewFunctionCall(funcName, yyDollar[3].node.(*node.ArgumentList)) + + // save position + yylex.(*Parser).positions.AddPosition(funcName, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(funcName, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[funcName]) + + // save comments + yylex.(*Parser).comments.AddFromToken(funcName, yyDollar[1].token, comment.NsSeparatorToken) } case 326: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2690 + //line php5/php5.y:3641 { yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList)) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken) } case 327: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2696 + //line php5/php5.y:3651 { yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList)) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken) } case 328: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2702 + //line php5/php5.y:3661 { yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList)) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken) } case 329: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2708 + //line php5/php5.y:3671 { yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList)) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken) } case 330: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2714 + //line php5/php5.y:3681 { yyVAL.node = expr.NewFunctionCall(yyDollar[1].node, yyDollar[2].node.(*node.ArgumentList)) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) } case 331: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2723 + //line php5/php5.y:3691 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StaticToken) } case 332: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2729 + //line php5/php5.y:3701 { yyVAL.node = name.NewName(yyDollar[1].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) } case 333: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2735 + //line php5/php5.y:3708 { yyVAL.node = name.NewRelative(yyDollar[3].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NamespaceToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.NsSeparatorToken) } case 334: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2741 + //line php5/php5.y:3719 { yyVAL.node = name.NewFullyQualified(yyDollar[2].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken) } case 335: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2750 + //line php5/php5.y:3732 { yyVAL.node = name.NewName(yyDollar[1].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) } case 336: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2756 + //line php5/php5.y:3739 { yyVAL.node = name.NewRelative(yyDollar[3].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NamespaceToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.NsSeparatorToken) } case 337: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2762 + //line php5/php5.y:3750 { yyVAL.node = name.NewFullyQualified(yyDollar[2].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken) } case 338: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2771 + //line php5/php5.y:3763 { yyVAL.node = yyDollar[1].node } case 339: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2773 + //line php5/php5.y:3765 { yyVAL.node = yyDollar[1].node } case 340: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2778 + //line php5/php5.y:3770 { yyVAL.node = yyDollar[1].node + // save comments + yylex.(*Parser).comments.AddFromToken(yyDollar[3].list[0], yyDollar[2].token, comment.ObjectOperatorToken) + for _, n := range yyDollar[3].list { switch nn := n.(type) { case *expr.ArrayDimFetch: nn.Variable = yyVAL.node yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node]) yyVAL.node = nn case *expr.PropertyFetch: nn.Variable = yyVAL.node yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node]) yyVAL.node = nn } } @@ -5410,746 +6374,1003 @@ yydefault: case *expr.ArrayDimFetch: nn.Variable = yyVAL.node yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node]) yyVAL.node = nn case *expr.PropertyFetch: nn.Variable = yyVAL.node yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node]) yyVAL.node = nn } } } case 341: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2814 + //line php5/php5.y:3805 { yyVAL.node = yyDollar[1].node } case 342: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2820 + //line php5/php5.y:3811 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) } case 343: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:2822 + //line php5/php5.y:3813 { yyVAL.list = []node.Node{} } case 344: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2828 + //line php5/php5.y:3819 { yyVAL.list = yyDollar[2].list + + // save comments + yylex.(*Parser).comments.AddFromToken(yyDollar[2].list[0], yyDollar[1].token, comment.ObjectOperatorToken) } case 345: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:2833 + //line php5/php5.y:3829 { yyVAL.node = nil } case 346: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2835 + //line php5/php5.y:3831 { - yyVAL.node = nil + yyVAL.node = expr.NewExit(nil) + + // save position + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.CloseParenthesisToken) } case 347: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2837 + //line php5/php5.y:3842 { - yyVAL.node = yyDollar[1].node + yyVAL.node = expr.NewExit(yyDollar[1].node) + + // save position + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node)) } case 348: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:2842 + //line php5/php5.y:3852 { yyVAL.list = []node.Node{} } case 349: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2844 + //line php5/php5.y:3854 { yyVAL.list = []node.Node{scalar.NewEncapsedStringPart(yyDollar[1].token.Value)} } case 350: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2846 + //line php5/php5.y:3856 { yyVAL.list = yyDollar[1].list } case 351: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:2851 + //line php5/php5.y:3861 { yyVAL.node = nil } case 352: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2853 + //line php5/php5.y:3863 { yyVAL.node = yyDollar[1].node } case 353: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2858 + //line php5/php5.y:3868 { yyVAL.node = scalar.NewLnumber(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.LnumberToken) } case 354: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2864 + //line php5/php5.y:3878 { yyVAL.node = scalar.NewDnumber(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DnumberToken) } case 355: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2870 + //line php5/php5.y:3888 { yyVAL.node = scalar.NewString(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ConstantEncapsedStringToken) } case 356: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2876 + //line php5/php5.y:3898 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.LineToken) } case 357: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2882 + //line php5/php5.y:3908 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FileToken) } case 358: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2888 + //line php5/php5.y:3918 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DirToken) } case 359: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2894 + //line php5/php5.y:3928 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.TraitCToken) } case 360: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2900 + //line php5/php5.y:3938 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.MethodCToken) } case 361: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2906 + //line php5/php5.y:3948 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.FuncCToken) } case 362: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2912 + //line php5/php5.y:3958 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsCToken) } case 363: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2918 + //line php5/php5.y:3968 { encapsed := scalar.NewEncapsedStringPart(yyDollar[2].token.Value) - yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(encapsed, yyDollar[2].token.Comments()) - yyVAL.node = scalar.NewHeredoc(yyDollar[1].token.Value, []node.Node{encapsed}) + + // save position + yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StartHeredocToken) } case 364: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2928 + //line php5/php5.y:3980 { yyVAL.node = scalar.NewHeredoc(yyDollar[1].token.Value, nil) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StartHeredocToken) } case 365: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2937 + //line php5/php5.y:3993 { target := node.NewIdentifier(yyDollar[3].token.Value) - yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target) + + // save position + yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(target, yyDollar[3].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken) + yylex.(*Parser).comments.AddFromToken(target, yyDollar[3].token, comment.IdentifierToken) } case 366: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2950 + //line php5/php5.y:4009 { yyVAL.node = yyDollar[1].node } case 367: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2955 + //line php5/php5.y:4014 { yyVAL.node = yyDollar[1].node } case 368: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2957 + //line php5/php5.y:4016 { yyVAL.node = yyDollar[1].node } case 369: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:2959 + //line php5/php5.y:4018 { name := name.NewName(yyDollar[1].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) - yyVAL.node = expr.NewConstFetch(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(name)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[name]) } case 370: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2969 + //line php5/php5.y:4027 { name := name.NewRelative(yyDollar[3].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list)) - yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments()) - yyVAL.node = expr.NewConstFetch(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[name]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NamespaceToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.NsSeparatorToken) } case 371: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:2979 + //line php5/php5.y:4040 { name := name.NewFullyQualified(yyDollar[2].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list)) - yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments()) - yyVAL.node = expr.NewConstFetch(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[name]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken) } case 372: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:2989 + //line php5/php5.y:4052 { yyVAL.node = expr.NewArray(yyDollar[3].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ArrayToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken) } case 373: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:2995 + //line php5/php5.y:4064 { yyVAL.node = expr.NewShortArray(yyDollar[2].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseSquareBracket) } case 374: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3001 + //line php5/php5.y:4075 { yyVAL.node = yyDollar[1].node } case 375: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3003 + //line php5/php5.y:4077 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ClassCToken) } case 376: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3009 + //line php5/php5.y:4087 { yyVAL.node = yyDollar[1].node } case 377: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3014 + //line php5/php5.y:4092 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket) } case 378: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3020 + //line php5/php5.y:4103 { yyVAL.node = binary.NewPlus(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PlusToken) } case 379: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3026 + //line php5/php5.y:4113 { yyVAL.node = binary.NewMinus(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.MinusToken) } case 380: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3032 + //line php5/php5.y:4123 { yyVAL.node = binary.NewMul(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AsteriskToken) } case 381: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3038 + //line php5/php5.y:4133 { yyVAL.node = binary.NewPow(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PowToken) } case 382: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3044 + //line php5/php5.y:4143 { yyVAL.node = binary.NewDiv(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SlashToken) } case 383: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3050 + //line php5/php5.y:4153 { yyVAL.node = binary.NewMod(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PercentToken) } case 384: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3056 + //line php5/php5.y:4163 { yyVAL.node = expr.NewBooleanNot(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ExclamationMarkToken) } case 385: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3062 + //line php5/php5.y:4173 { yyVAL.node = expr.NewBitwiseNot(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.TildeToken) } case 386: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3068 + //line php5/php5.y:4183 { yyVAL.node = binary.NewBitwiseOr(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.VerticalBarToken) } case 387: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3074 + //line php5/php5.y:4193 { yyVAL.node = binary.NewBitwiseAnd(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.AmpersandToken) } case 388: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3080 + //line php5/php5.y:4203 { yyVAL.node = binary.NewBitwiseXor(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.CaretToken) } case 389: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3086 + //line php5/php5.y:4213 { yyVAL.node = binary.NewShiftLeft(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SlToken) } case 390: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3092 + //line php5/php5.y:4223 { yyVAL.node = binary.NewShiftRight(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.SrToken) } case 391: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3098 + //line php5/php5.y:4233 { yyVAL.node = binary.NewConcat(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.DotToken) } case 392: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3104 + //line php5/php5.y:4243 { yyVAL.node = binary.NewLogicalXor(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LogicalXorToken) } case 393: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3110 + //line php5/php5.y:4253 { yyVAL.node = binary.NewLogicalAnd(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LogicalAndToken) } case 394: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3116 + //line php5/php5.y:4263 { yyVAL.node = binary.NewLogicalOr(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LogicalOrToken) } case 395: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3122 + //line php5/php5.y:4273 { yyVAL.node = binary.NewBooleanAnd(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.BooleanAndToken) } case 396: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3128 + //line php5/php5.y:4283 { yyVAL.node = binary.NewBooleanOr(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.BooleanOrToken) } case 397: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3134 + //line php5/php5.y:4293 { yyVAL.node = binary.NewIdentical(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsIdenticalToken) } case 398: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3140 + //line php5/php5.y:4303 { yyVAL.node = binary.NewNotIdentical(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsNotIdenticalToken) } case 399: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3146 + //line php5/php5.y:4313 { yyVAL.node = binary.NewEqual(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsEqualToken) } case 400: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3152 + //line php5/php5.y:4323 { yyVAL.node = binary.NewNotEqual(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsNotEqualToken) } case 401: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3158 + //line php5/php5.y:4333 { yyVAL.node = binary.NewSmaller(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.LessToken) } case 402: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3164 + //line php5/php5.y:4343 { yyVAL.node = binary.NewGreater(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.GreaterToken) } case 403: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3170 + //line php5/php5.y:4353 { yyVAL.node = binary.NewSmallerOrEqual(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsSmallerOrEqualToken) } case 404: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3176 + //line php5/php5.y:4363 { yyVAL.node = binary.NewGreaterOrEqual(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.IsGreaterOrEqualToken) } case 405: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3182 + //line php5/php5.y:4373 { yyVAL.node = expr.NewTernary(yyDollar[1].node, nil, yyDollar[4].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.QuestionMarkToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.ColonToken) } case 406: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:3188 + //line php5/php5.y:4384 { yyVAL.node = expr.NewTernary(yyDollar[1].node, yyDollar[3].node, yyDollar[5].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[5].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.QuestionMarkToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.ColonToken) } case 407: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3194 + //line php5/php5.y:4395 { yyVAL.node = expr.NewUnaryPlus(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.PlusToken) } case 408: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3200 + //line php5/php5.y:4405 { yyVAL.node = expr.NewUnaryMinus(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.MinusToken) } case 409: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3206 + //line php5/php5.y:4415 { yyVAL.node = yyDollar[2].node + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseParenthesisToken) } case 410: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3211 + //line php5/php5.y:4426 { yyVAL.node = yyDollar[1].node } case 411: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3213 + //line php5/php5.y:4428 { name := name.NewName(yyDollar[1].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments(yyDollar[1].list)) - yyVAL.node = expr.NewConstFetch(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition(yyDollar[1].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(name)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[name]) } case 412: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3223 + //line php5/php5.y:4437 { name := name.NewRelative(yyDollar[3].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list)) - yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments()) - yyVAL.node = expr.NewConstFetch(name) + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[3].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(name)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[name]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NamespaceToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.NsSeparatorToken) } case 413: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3233 + //line php5/php5.y:4448 { name := name.NewFullyQualified(yyDollar[2].list) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list)) - yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments()) - yyVAL.node = expr.NewConstFetch(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition(yyDollar[1].token, yyDollar[2].list)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(name)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[name]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NsSeparatorToken) } case 414: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3246 + //line php5/php5.y:4463 { name := node.NewIdentifier(yyDollar[1].token.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yyVAL.node = expr.NewVariable(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(name, yyDollar[1].token, comment.StringVarnameToken) } case 415: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3256 + //line php5/php5.y:4475 { yyVAL.node = yyDollar[1].node } case 416: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3258 + //line php5/php5.y:4477 { yyVAL.node = yyDollar[1].node } case 417: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3260 + //line php5/php5.y:4479 { yyVAL.node = yyDollar[1].node } case 418: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3262 + //line php5/php5.y:4481 { yyVAL.node = scalar.NewEncapsed(yyDollar[2].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DoubleQuoteToken) } case 419: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3268 + //line php5/php5.y:4491 { yyVAL.node = scalar.NewHeredoc(yyDollar[1].token.Value, yyDollar[2].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StartHeredocToken) } case 420: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3274 + //line php5/php5.y:4501 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.ClassCToken) } case 421: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:3283 + //line php5/php5.y:4514 { yyVAL.list = nil } case 422: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3285 + //line php5/php5.y:4516 { yyVAL.list = yyDollar[1].list + + // save comments + if yyDollar[2].token != nil { + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) + } + } + case 423: + yyDollar = yyS[yypt-0 : yypt+1] + //line php5/php5.y:4528 + { + yyVAL.token = nil + } + case 424: + yyDollar = yyS[yypt-1 : yypt+1] + //line php5/php5.y:4530 + { + yyVAL.token = yyDollar[1].token } case 425: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:3295 + //line php5/php5.y:4535 { arrayItem := expr.NewArrayItem(yyDollar[3].node, yyDollar[5].node) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[3].node, yyDollar[5].node)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[3].node]) - yyVAL.list = append(yyDollar[1].list, arrayItem) + + // save position + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[3].node, yyDollar[5].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(arrayItem, yyDollar[4].token, comment.DoubleArrowToken) } case 426: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3303 + //line php5/php5.y:4547 { arrayItem := expr.NewArrayItem(nil, yyDollar[3].node) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[3].node]) - yyVAL.list = append(yyDollar[1].list, arrayItem) + + // save position + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[3].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) } case 427: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3311 + //line php5/php5.y:4558 { arrayItem := expr.NewArrayItem(yyDollar[1].node, yyDollar[3].node) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[1].node]) - yyVAL.list = []node.Node{arrayItem} + + // save position + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(arrayItem, yyDollar[2].token, comment.DoubleArrowToken) } case 428: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3319 + //line php5/php5.y:4569 { arrayItem := expr.NewArrayItem(nil, yyDollar[1].node) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[1].node]) - yyVAL.list = []node.Node{arrayItem} + + // save position + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node)) } case 429: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3330 + //line php5/php5.y:4580 { yyVAL.node = yyDollar[1].node } case 430: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3332 + //line php5/php5.y:4582 { yyVAL.node = yyDollar[1].node } case 431: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3337 + //line php5/php5.y:4587 { yyVAL.node = yyDollar[2].node } case 432: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3339 + //line php5/php5.y:4589 { yyVAL.node = yyDollar[2].node } case 433: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3345 + //line php5/php5.y:4595 { yyVAL.node = yyDollar[1].node } case 434: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3351 + //line php5/php5.y:4601 { yyVAL.node = yyDollar[1].node } case 435: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3356 + //line php5/php5.y:4606 { yyVAL.node = yyDollar[1].node } case 436: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:3361 + //line php5/php5.y:4611 { yyVAL.node = yyDollar[1].node @@ -6158,24 +7379,24 @@ yydefault: yyDollar[3].list = append(yyDollar[3].list[:len(yyDollar[3].list)-1], yyDollar[4].list...) } + // save comments + yylex.(*Parser).comments.AddFromToken(yyDollar[3].list[0], yyDollar[2].token, comment.ObjectOperatorToken) + for _, n := range yyDollar[3].list { switch nn := n.(type) { case *expr.ArrayDimFetch: nn.Variable = yyVAL.node yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node]) yyVAL.node = nn case *expr.PropertyFetch: nn.Variable = yyVAL.node yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node]) yyVAL.node = nn case *expr.MethodCall: nn.Variable = yyVAL.node yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node]) yyVAL.node = nn } } @@ -6185,44 +7406,41 @@ yydefault: case *expr.ArrayDimFetch: nn.Variable = yyVAL.node yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node]) yyVAL.node = nn case *expr.PropertyFetch: nn.Variable = yyVAL.node yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node]) yyVAL.node = nn case *expr.MethodCall: nn.Variable = yyVAL.node yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyVAL.node, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[yyDollar[1].node]) yyVAL.node = nn } } } case 437: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3414 + //line php5/php5.y:4661 { yyVAL.node = yyDollar[1].node } case 438: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3419 + //line php5/php5.y:4666 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].list...) } case 439: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:3421 + //line php5/php5.y:4668 { yyVAL.list = []node.Node{} } case 440: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3427 + //line php5/php5.y:4674 { if yyDollar[3].list != nil { yyDollar[3].list[0].(*expr.MethodCall).Method = yyDollar[2].list[len(yyDollar[2].list)-1].(*expr.PropertyFetch).Property @@ -6230,59 +7448,74 @@ yydefault: } yyVAL.list = yyDollar[2].list + + // save comments + yylex.(*Parser).comments.AddFromToken(yyDollar[2].list[0], yyDollar[1].token, comment.ObjectOperatorToken) } case 441: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3439 + //line php5/php5.y:4689 { fetch := expr.NewArrayDimFetch(nil, yyDollar[3].node) + yyVAL.list = append(yyDollar[1].list, fetch) + + // save position yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[3].node)) - yyVAL.list = append(yyDollar[1].list, fetch) + // save comments + yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[2].token, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[4].token, comment.CloseSquareBracket) } case 442: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3446 + //line php5/php5.y:4701 { fetch := expr.NewArrayDimFetch(nil, yyDollar[3].node) + yyVAL.list = []node.Node{yyDollar[1].node, fetch} + + // save position yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[3].node)) - yyVAL.list = []node.Node{yyDollar[1].node, fetch} + // save comments + yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[2].token, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[4].token, comment.CloseSquareBracket) } case 443: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3456 + //line php5/php5.y:4716 { yyVAL.node = expr.NewMethodCall(nil, nil, yyDollar[1].node.(*node.ArgumentList)) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node)) } case 444: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3464 + //line php5/php5.y:4726 { yyVAL.list = []node.Node{yyDollar[1].node} } case 445: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3466 + //line php5/php5.y:4728 { yyVAL.list = yyDollar[1].list } case 446: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:3468 + //line php5/php5.y:4730 { yyVAL.list = nil } case 447: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3473 + //line php5/php5.y:4735 { yyVAL.node = yyDollar[1].node } case 448: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3475 + //line php5/php5.y:4737 { yyDollar[1].simpleIndirectReference.last.SetVarName(yyDollar[2].node) @@ -6294,69 +7527,87 @@ yydefault: } case 449: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3488 + //line php5/php5.y:4750 { yyVAL.node = expr.NewStaticPropertyFetch(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken) } case 450: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3494 + //line php5/php5.y:4760 { yyVAL.node = expr.NewStaticPropertyFetch(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken) } case 451: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3504 + //line php5/php5.y:4774 { yyVAL.node = yyDollar[1].node } case 452: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3509 + //line php5/php5.y:4779 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket) } case 453: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3515 + //line php5/php5.y:4790 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket) } case 454: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3523 + //line php5/php5.y:4803 { yyVAL.node = yyDollar[1].node } case 455: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3524 + //line php5/php5.y:4804 { yyVAL.node = yyDollar[1].node } case 456: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3525 + //line php5/php5.y:4805 { yyVAL.node = yyDollar[1].node } case 457: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3531 + //line php5/php5.y:4811 { yyVAL.node = yyDollar[1].node } case 458: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3533 + //line php5/php5.y:4813 { yyDollar[1].simpleIndirectReference.last.SetVarName(yyDollar[2].node) @@ -6368,153 +7619,203 @@ yydefault: } case 459: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3543 + //line php5/php5.y:4823 { yyVAL.node = yyDollar[1].node } case 460: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3548 + //line php5/php5.y:4828 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket) } case 461: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3554 + //line php5/php5.y:4839 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseCurlyBracesToken) } case 462: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3560 + //line php5/php5.y:4850 { yyVAL.node = yyDollar[1].node } case 463: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3566 + //line php5/php5.y:4856 { name := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yyVAL.node = expr.NewVariable(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.VariableToken) } case 464: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3576 + //line php5/php5.y:4868 { yyVAL.node = expr.NewVariable(yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DollarToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseCurlyBracesToken) } case 465: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:3585 + //line php5/php5.y:4883 { yyVAL.node = nil } case 466: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3587 + //line php5/php5.y:4885 { yyVAL.node = yyDollar[1].node } case 467: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3593 + //line php5/php5.y:4891 { yyVAL.list = yyDollar[1].list } case 468: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3595 + //line php5/php5.y:4893 { fetch := expr.NewPropertyFetch(nil, yyDollar[1].node) - yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node)) - yyVAL.list = []node.Node{fetch} + + // save position + yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node)) } case 469: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3605 + //line php5/php5.y:4904 { fetch := expr.NewArrayDimFetch(nil, yyDollar[3].node) + yyVAL.list = append(yyDollar[1].list, fetch) + + // save position yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[3].node)) - yyVAL.list = append(yyDollar[1].list, fetch) + // save comments + yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[2].token, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[4].token, comment.CloseSquareBracket) } case 470: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3612 + //line php5/php5.y:4916 { fetch := expr.NewArrayDimFetch(nil, yyDollar[3].node) + yyVAL.list = append(yyDollar[1].list, fetch) + + // save position yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[3].node)) - yyVAL.list = append(yyDollar[1].list, fetch) + // save comments + yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[2].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[4].token, comment.CloseCurlyBracesToken) } case 471: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3619 + //line php5/php5.y:4928 { fetch := expr.NewPropertyFetch(nil, yyDollar[1].node) - yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node)) - yyVAL.list = []node.Node{fetch} + + // save position + yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node)) } case 472: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3629 + //line php5/php5.y:4939 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StringToken) } case 473: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3635 + //line php5/php5.y:4949 { yyVAL.node = yyDollar[2].node + + // save position + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken) } case 474: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3640 + //line php5/php5.y:4963 { n := expr.NewVariable(nil) - yylex.(*Parser).positions.AddPosition(n, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(n, yyDollar[1].token.Comments()) - yyVAL.simpleIndirectReference = simpleIndirectReference{[]*expr.Variable{n}, n} + + // save position + yylex.(*Parser).positions.AddPosition(n, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(n, yyDollar[1].token, comment.DollarToken) } case 475: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3648 + //line php5/php5.y:4974 { n := expr.NewVariable(nil) - yylex.(*Parser).positions.AddPosition(n, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) - yylex.(*Parser).comments.AddComments(n, yyDollar[2].token.Comments()) yyDollar[1].simpleIndirectReference.last.SetVarName(n) - yyDollar[1].simpleIndirectReference.all = append(yyDollar[1].simpleIndirectReference.all, n) yyDollar[1].simpleIndirectReference.last = n yyVAL.simpleIndirectReference = yyDollar[1].simpleIndirectReference + + // save position + yylex.(*Parser).positions.AddPosition(n, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(n, yyDollar[2].token, comment.DollarToken) } case 476: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3663 + //line php5/php5.y:4992 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) } case 477: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3665 + //line php5/php5.y:4999 { if yyDollar[1].node == nil { yyVAL.list = []node.Node{} @@ -6524,399 +7825,540 @@ yydefault: } case 478: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3677 + //line php5/php5.y:5011 { yyVAL.node = expr.NewArrayItem(nil, yyDollar[1].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) } case 479: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3683 + //line php5/php5.y:5018 { item := expr.NewList(yyDollar[3].list) - yylex.(*Parser).positions.AddPosition(item, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(item, yyDollar[1].token.Comments()) - yyVAL.node = expr.NewArrayItem(nil, item) + + // save position + yylex.(*Parser).positions.AddPosition(item, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodePosition(item)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[item]) + + // save comments + yylex.(*Parser).comments.AddFromToken(item, yyDollar[1].token, comment.ListToken) + yylex.(*Parser).comments.AddFromToken(item, yyDollar[2].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(item, yyDollar[4].token, comment.CloseParenthesisToken) } case 480: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:3693 + //line php5/php5.y:5032 { yyVAL.node = nil } case 481: yyDollar = yyS[yypt-0 : yypt+1] - //line php5/php5.y:3699 + //line php5/php5.y:5038 { yyVAL.list = []node.Node{} } case 482: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3701 + //line php5/php5.y:5040 { yyVAL.list = yyDollar[1].list + + // save comments + if yyDollar[2].token != nil { + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) + } } case 483: yyDollar = yyS[yypt-5 : yypt+1] - //line php5/php5.y:3706 + //line php5/php5.y:5052 { arrayItem := expr.NewArrayItem(yyDollar[3].node, yyDollar[5].node) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[3].node, yyDollar[5].node)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[3].node]) - yyVAL.list = append(yyDollar[1].list, arrayItem) + + // save position + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[3].node, yyDollar[5].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(arrayItem, yyDollar[4].token, comment.DoubleArrowToken) } case 484: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3714 + //line php5/php5.y:5064 { arrayItem := expr.NewArrayItem(nil, yyDollar[3].node) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[3].node]) - yyVAL.list = append(yyDollar[1].list, arrayItem) + + // save position + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[3].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) } case 485: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3722 + //line php5/php5.y:5075 { arrayItem := expr.NewArrayItem(yyDollar[1].node, yyDollar[3].node) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[1].node]) - yyVAL.list = []node.Node{arrayItem} + + // save position + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[3].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(arrayItem, yyDollar[2].token, comment.DoubleArrowToken) } case 486: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3730 + //line php5/php5.y:5086 { arrayItem := expr.NewArrayItem(nil, yyDollar[1].node) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[1].node]) - yyVAL.list = []node.Node{arrayItem} + + // save position + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition(yyDollar[1].node)) } case 487: yyDollar = yyS[yypt-6 : yypt+1] - //line php5/php5.y:3738 + //line php5/php5.y:5094 { reference := expr.NewReference(yyDollar[6].node) arrayItem := expr.NewArrayItem(yyDollar[3].node, reference) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[3].node, yyDollar[6].node)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[3].node]) - yyVAL.list = append(yyDollar[1].list, arrayItem) + + // save position + yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[5].token, yyDollar[6].node)) + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[3].node, yyDollar[6].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(arrayItem, yyDollar[4].token, comment.DoubleArrowToken) + yylex.(*Parser).comments.AddFromToken(reference, yyDollar[5].token, comment.AmpersandToken) } case 488: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3747 + //line php5/php5.y:5109 { reference := expr.NewReference(yyDollar[4].node) arrayItem := expr.NewArrayItem(nil, reference) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[4].node)) - yylex.(*Parser).comments.AddComments(arrayItem, yyDollar[3].token.Comments()) - yyVAL.list = append(yyDollar[1].list, arrayItem) + + // save position + yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[4].node)) + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[4].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(reference, yyDollar[3].token, comment.AmpersandToken) } case 489: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3756 + //line php5/php5.y:5123 { reference := expr.NewReference(yyDollar[4].node) arrayItem := expr.NewArrayItem(yyDollar[1].node, reference) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[yyDollar[1].node]) - yyVAL.list = []node.Node{arrayItem} + + // save position + yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[3].token, yyDollar[4].node)) + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition(yyDollar[1].node, yyDollar[4].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(arrayItem, yyDollar[2].token, comment.DoubleArrowToken) + yylex.(*Parser).comments.AddFromToken(reference, yyDollar[3].token, comment.AmpersandToken) } case 490: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3765 + //line php5/php5.y:5137 { reference := expr.NewReference(yyDollar[2].node) arrayItem := expr.NewArrayItem(nil, reference) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(arrayItem, yyDollar[1].token.Comments()) - yyVAL.list = []node.Node{arrayItem} + + // save position + yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(reference, yyDollar[1].token, comment.AmpersandToken) } case 491: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3777 + //line php5/php5.y:5153 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 492: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3779 + //line php5/php5.y:5155 { encapsed := scalar.NewEncapsedStringPart(yyDollar[2].token.Value) - yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) yyVAL.list = append(yyDollar[1].list, encapsed) - yylex.(*Parser).comments.AddComments(encapsed, yyDollar[2].token.Comments()) + + // save position + yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(encapsed, yyDollar[2].token, comment.EncapsedAndWhitespaceToken) } case 493: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3786 + //line php5/php5.y:5166 { yyVAL.list = []node.Node{yyDollar[1].node} } case 494: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3788 + //line php5/php5.y:5168 { encapsed := scalar.NewEncapsedStringPart(yyDollar[1].token.Value) - yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yyVAL.list = []node.Node{encapsed, yyDollar[2].node} - yylex.(*Parser).comments.AddComments(encapsed, yyDollar[1].token.Comments()) + + // save position + yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(encapsed, yyDollar[1].token, comment.EncapsedAndWhitespaceToken) } case 495: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3798 + //line php5/php5.y:5182 { name := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yyVAL.node = expr.NewVariable(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(name, yyDollar[1].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.VariableToken) } case 496: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3808 + //line php5/php5.y:5194 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yyVAL.node = expr.NewArrayDimFetch(variable, yyDollar[3].node) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments()) - yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseSquareBracket) } case 497: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3821 + //line php5/php5.y:5210 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) fetch := node.NewIdentifier(yyDollar[3].token.Value) - yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yyVAL.node = expr.NewPropertyFetch(variable, fetch) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments()) - yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments()) - yylex.(*Parser).comments.AddComments(fetch, yyDollar[3].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[1].token, comment.VariableToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.ObjectOperatorToken) + yylex.(*Parser).comments.AddFromToken(fetch, yyDollar[3].token, comment.StringToken) } case 498: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3837 + //line php5/php5.y:5228 { - yyVAL.node = yyDollar[2].node + yyVAL.node = expr.NewVariable(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DollarOpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken) } case 499: - yyDollar = yyS[yypt-6 : yypt+1] - //line php5/php5.y:3843 + yyDollar = yyS[yypt-3 : yypt+1] + //line php5/php5.y:5239 { - identifier := node.NewIdentifier(yyDollar[2].token.Value) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) - yyVAL.node = expr.NewArrayDimFetch(variable, yyDollar[4].node) - yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[6].token)) + name := node.NewIdentifier(yyDollar[2].token.Value) + yyVAL.node = expr.NewVariable(name) - yylex.(*Parser).comments.AddComments(identifier, yyDollar[2].token.Comments()) - yylex.(*Parser).comments.AddComments(variable, yyDollar[1].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[3].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DollarOpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(name, yyDollar[2].token, comment.StringVarnameToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CloseCurlyBracesToken) } case 500: - yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3857 + yyDollar = yyS[yypt-6 : yypt+1] + //line php5/php5.y:5253 { - yyVAL.node = yyDollar[2].node + identifier := node.NewIdentifier(yyDollar[2].token.Value) + variable := expr.NewVariable(identifier) + yyVAL.node = expr.NewArrayDimFetch(variable, yyDollar[4].node) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[2].token)) + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[6].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.DollarOpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(variable, yyDollar[2].token, comment.StringVarnameToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[5].token, comment.CloseSquareBracket) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[6].token, comment.CloseCurlyBracesToken) } case 501: - yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3862 + yyDollar = yyS[yypt-3 : yypt+1] + //line php5/php5.y:5271 { - yyVAL.node = scalar.NewString(yyDollar[1].token.Value) - yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + yyVAL.node = yyDollar[2].node } case 502: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3868 + //line php5/php5.y:5278 + { + yyVAL.node = scalar.NewString(yyDollar[1].token.Value) + + // save position + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.StringToken) + } + case 503: + yyDollar = yyS[yypt-1 : yypt+1] + //line php5/php5.y:5288 { // TODO: add option to handle 64 bit integer if _, err := strconv.Atoi(yyDollar[1].token.Value); err == nil { yyVAL.node = scalar.NewLnumber(yyDollar[1].token.Value) - yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) } else { yyVAL.node = scalar.NewString(yyDollar[1].token.Value) - yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) } - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) - } - case 503: - yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3880 - { - identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yyVAL.node = expr.NewVariable(identifier) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) - yylex.(*Parser).comments.AddComments(identifier, yyDollar[1].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.NumStringToken) } case 504: - yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3893 + yyDollar = yyS[yypt-1 : yypt+1] + //line php5/php5.y:5303 { - yyVAL.node = expr.NewIsset(yyDollar[3].list) - yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) + yyVAL.node = expr.NewVariable(identifier) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[1].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.VariableToken) } case 505: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3899 + //line php5/php5.y:5318 { - yyVAL.node = expr.NewEmpty(yyDollar[3].node) + yyVAL.node = expr.NewIsset(yyDollar[3].list) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IssetToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken) } case 506: yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3905 + //line php5/php5.y:5330 { yyVAL.node = expr.NewEmpty(yyDollar[3].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.EmptyToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken) } case 507: - yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3911 + yyDollar = yyS[yypt-4 : yypt+1] + //line php5/php5.y:5342 { - yyVAL.node = expr.NewInclude(yyDollar[2].node) - yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + yyVAL.node = expr.NewEmpty(yyDollar[3].node) + + // save position + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.EmptyToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken) } case 508: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3917 + //line php5/php5.y:5354 { - yyVAL.node = expr.NewIncludeOnce(yyDollar[2].node) + yyVAL.node = expr.NewInclude(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IncludeToken) } case 509: - yyDollar = yyS[yypt-4 : yypt+1] - //line php5/php5.y:3923 + yyDollar = yyS[yypt-2 : yypt+1] + //line php5/php5.y:5364 { - yyVAL.node = expr.NewEval(yyDollar[3].node) - yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + yyVAL.node = expr.NewIncludeOnce(yyDollar[2].node) + + // save position + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.IncludeOnceToken) } case 510: - yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3929 + yyDollar = yyS[yypt-4 : yypt+1] + //line php5/php5.y:5374 { - yyVAL.node = expr.NewRequire(yyDollar[2].node) - yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + yyVAL.node = expr.NewEval(yyDollar[3].node) + + // save position + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.EvalToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken) } case 511: yyDollar = yyS[yypt-2 : yypt+1] - //line php5/php5.y:3935 + //line php5/php5.y:5386 { - yyVAL.node = expr.NewRequireOnce(yyDollar[2].node) + yyVAL.node = expr.NewRequire(yyDollar[2].node) + + // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) - yylex.(*Parser).comments.AddComments(yyVAL.node, yyDollar[1].token.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.RequireToken) } case 512: + yyDollar = yyS[yypt-2 : yypt+1] + //line php5/php5.y:5396 + { + yyVAL.node = expr.NewRequireOnce(yyDollar[2].node) + + // save position + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokenNodePosition(yyDollar[1].token, yyDollar[2].node)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.RequireOnceToken) + } + case 513: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3944 + //line php5/php5.y:5409 { yyVAL.list = []node.Node{yyDollar[1].node} } - case 513: + case 514: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3946 + //line php5/php5.y:5411 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) - } - case 514: - yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3951 - { - yyVAL.node = yyDollar[1].node + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(yyDollar[1].list), yyDollar[2].token, comment.CommaToken) } case 515: yyDollar = yyS[yypt-1 : yypt+1] - //line php5/php5.y:3953 + //line php5/php5.y:5421 { yyVAL.node = yyDollar[1].node } case 516: - yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3958 + yyDollar = yyS[yypt-1 : yypt+1] + //line php5/php5.y:5423 { - target := node.NewIdentifier(yyDollar[3].token.Value) - yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) - yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target) - yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token)) - - yylex.(*Parser).comments.AddComments(target, yyDollar[3].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + yyVAL.node = yyDollar[1].node } case 517: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3968 + //line php5/php5.y:5428 { target := node.NewIdentifier(yyDollar[3].token.Value) - yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target) + + // save position + yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(target, yyDollar[3].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken) } case 518: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3981 + //line php5/php5.y:5440 { target := node.NewIdentifier(yyDollar[3].token.Value) - yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target) + + // save position + yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(target, yyDollar[3].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken) } case 519: yyDollar = yyS[yypt-3 : yypt+1] - //line php5/php5.y:3994 + //line php5/php5.y:5455 { target := node.NewIdentifier(yyDollar[3].token.Value) - yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target) + + // save position + yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token)) - yylex.(*Parser).comments.AddComments(target, yyDollar[3].token.Comments()) - yylex.(*Parser).comments.AddComments(yyVAL.node, yylex.(*Parser).comments[yyDollar[1].node]) + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken) + } + case 520: + yyDollar = yyS[yypt-3 : yypt+1] + //line php5/php5.y:5470 + { + target := node.NewIdentifier(yyDollar[3].token.Value) + yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target) + + // save position + yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[3].token)) + yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(yyDollar[1].node, yyDollar[3].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.PaamayimNekudotayimToken) } } goto yystack /* stack new state and value */ diff --git a/php5/php5.y b/php5/php5.y index 94947e7..a25a750 100644 --- a/php5/php5.y +++ b/php5/php5.y @@ -5,6 +5,7 @@ import ( "strings" "strconv" + "github.com/z7zmey/php-parser/comment" "github.com/z7zmey/php-parser/scanner" "github.com/z7zmey/php-parser/node" "github.com/z7zmey/php-parser/node/scalar" @@ -227,6 +228,8 @@ import ( %right T_STATIC T_ABSTRACT T_FINAL T_PRIVATE T_PROTECTED T_PUBLIC %type function interface_entry +%type possible_comma +%type case_separator %type top_statement use_declaration use_function_declaration use_const_declaration common_scalar %type static_class_constant compound_variable reference_variable class_name variable_class_name @@ -295,16 +298,25 @@ namespace_name: T_STRING { namePart := name.NewNamePart($1.Value) - yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) $$ = []node.Node{namePart} - yylex.(*Parser).comments.AddComments(namePart, $1.Comments()) + + // save position + yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + + // save comments + yylex.(*Parser).comments.AddFromToken(namePart, $1, comment.StringToken) } | namespace_name T_NS_SEPARATOR T_STRING { namePart := name.NewNamePart($3.Value) - yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) $$ = append($1, namePart) - yylex.(*Parser).comments.AddComments(namePart, $3.Comments()) + + // save position + yylex.(*Parser).positions.AddPosition(namePart, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.NsSeparatorToken) + yylex.(*Parser).comments.AddFromToken(namePart, $3, comment.StringToken) } ; @@ -323,68 +335,114 @@ top_statement: | T_HALT_COMPILER '(' ')' ';' { $$ = stmt.NewHaltCompiler() + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.HaltCompilerToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken) } | T_NAMESPACE namespace_name ';' { name := name.NewName($2) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) $$ = stmt.NewNamespace(name, nil) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NamespaceToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken) } | T_NAMESPACE namespace_name '{' top_statement_list '}' { name := name.NewName($2) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) $$ = stmt.NewNamespace(name, $4) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $5)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NamespaceToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken($$, $5, comment.CloseCurlyBracesToken) } | T_NAMESPACE '{' top_statement_list '}' { $$ = stmt.NewNamespace(nil, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NamespaceToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseCurlyBracesToken) } | T_USE use_declarations ';' { $$ = stmt.NewUseList(nil, $2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.UseToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken) } | T_USE T_FUNCTION use_function_declarations ';' { useType := node.NewIdentifier($2.Value) - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) - yylex.(*Parser).comments.AddComments($$, $2.Comments()) - $$ = stmt.NewUseList(useType, $3) + + // save position + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.UseToken) + yylex.(*Parser).comments.AddFromToken(useType, $2, comment.UseToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken) } | T_USE T_CONST use_const_declarations ';' { useType := node.NewIdentifier($2.Value) - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) - yylex.(*Parser).comments.AddComments($$, $2.Comments()) - $$ = stmt.NewUseList(useType, $3) + + // save position + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.UseToken) + yylex.(*Parser).comments.AddFromToken(useType, $2, comment.UseToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken) } | constant_declaration ';' - { $$ = $1 } + { + $$ = $1 + + // save position + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken) + } ; use_declarations: use_declarations ',' use_declaration - { $$ = append($1, $3) } + { + $$ = append($1, $3) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + } | use_declaration { $$ = []node.Node{$1} } ; @@ -393,54 +451,65 @@ use_declaration: namespace_name { name := name.NewName($1) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) $$ = stmt.NewUse(nil, name, nil) - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1)) + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) } | namespace_name T_AS T_STRING { name := name.NewName($1) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) alias := node.NewIdentifier($3.Value) - yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) $$ = stmt.NewUse(nil, name, alias) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) + yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($1, $3)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1)) - yylex.(*Parser).comments.AddComments(alias, $3.Comments()) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1)) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsToken) + yylex.(*Parser).comments.AddFromToken(alias, $3, comment.StringToken) } | T_NS_SEPARATOR namespace_name { name := name.NewName($2) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) $$ = stmt.NewUse(nil, name, nil) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($2)) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken) } | T_NS_SEPARATOR namespace_name T_AS T_STRING { name := name.NewName($2) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) alias := node.NewIdentifier($4.Value) - yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) $$ = stmt.NewUse(nil, name, alias) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) + yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($2, $4)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2)) - yylex.(*Parser).comments.AddComments(alias, $4.Comments()) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($2)) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.AsToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.StringToken) } ; use_function_declarations: use_function_declarations ',' use_function_declaration - { $$ = append($1, $3) } + { + $$ = append($1, $3) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + } | use_function_declaration { $$ = []node.Node{$1} } ; @@ -449,54 +518,65 @@ use_function_declaration: namespace_name { name := name.NewName($1) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) $$ = stmt.NewUse(nil, name, nil) - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1)) + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) } | namespace_name T_AS T_STRING { name := name.NewName($1) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) alias := node.NewIdentifier($3.Value) - yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) $$ = stmt.NewUse(nil, name, alias) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) + yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($1, $3)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1)) - yylex.(*Parser).comments.AddComments(alias, $3.Comments()) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1)) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsToken) + yylex.(*Parser).comments.AddFromToken(alias, $3, comment.StringToken) } | T_NS_SEPARATOR namespace_name { name := name.NewName($2) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) $$ = stmt.NewUse(nil, name, nil) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($2)) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken) } | T_NS_SEPARATOR namespace_name T_AS T_STRING { name := name.NewName($2) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) alias := node.NewIdentifier($4.Value) - yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) $$ = stmt.NewUse(nil, name, alias) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) + yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($2, $4)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2)) - yylex.(*Parser).comments.AddComments(alias, $4.Comments()) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($2)) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.AsToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.StringToken) } ; use_const_declarations: use_const_declarations ',' use_const_declaration - { $$ = append($1, $3) } + { + $$ = append($1, $3) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + } | use_const_declaration { $$ = []node.Node{$1} } ; @@ -505,48 +585,54 @@ use_const_declaration: namespace_name { name := name.NewName($1) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) $$ = stmt.NewUse(nil, name, nil) - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1)) + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) } | namespace_name T_AS T_STRING { name := name.NewName($1) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) alias := node.NewIdentifier($3.Value) - yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) $$ = stmt.NewUse(nil, name, alias) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) + yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($1, $3)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1)) - yylex.(*Parser).comments.AddComments(alias, $3.Comments()) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1)) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsToken) + yylex.(*Parser).comments.AddFromToken(alias, $3, comment.StringToken) } | T_NS_SEPARATOR namespace_name { name := name.NewName($2) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) $$ = stmt.NewUse(nil, name, nil) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($2)) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken) } | T_NS_SEPARATOR namespace_name T_AS T_STRING { name := name.NewName($2) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) alias := node.NewIdentifier($4.Value) - yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) $$ = stmt.NewUse(nil, name, alias) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) + yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($2, $4)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($2)) - yylex.(*Parser).comments.AddComments(alias, $4.Comments()) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($2)) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.AsToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.StringToken) } ; @@ -554,34 +640,37 @@ constant_declaration: constant_declaration ',' T_STRING '=' static_scalar { name := node.NewIdentifier($3.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) - yylex.(*Parser).comments.AddComments(name, $3.Comments()) - constant := stmt.NewConstant(name, $5, "") - yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $5)) - yylex.(*Parser).comments.AddComments(constant, $3.Comments()) - constList := $1.(*stmt.ConstList) constList.Consts = append(constList.Consts, constant) - $$ = $1 + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) + yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $5)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeNodeListPosition($1, constList.Consts)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(constList.Consts), $2, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(name, $3, comment.StringToken) + yylex.(*Parser).comments.AddFromToken(constant, $4, comment.EqualToken) } | T_CONST T_STRING '=' static_scalar { name := node.NewIdentifier($2.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) - yylex.(*Parser).comments.AddComments(name, $2.Comments()) - constant := stmt.NewConstant(name, $4, "") - yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $4)) - yylex.(*Parser).comments.AddComments(constant, $2.Comments()) - constList := []node.Node{constant} - $$ = stmt.NewConstList(constList) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) + yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $4)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, constList)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ConstToken) + yylex.(*Parser).comments.AddFromToken(name, $2, comment.StringToken) + yylex.(*Parser).comments.AddFromToken(constant, $3, comment.EqualToken) } ; @@ -612,8 +701,15 @@ inner_statement: | T_HALT_COMPILER '(' ')' ';' { $$ = stmt.NewHaltCompiler() + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.HaltCompilerToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken) } ; @@ -624,12 +720,15 @@ statement: | T_STRING ':' { label := node.NewIdentifier($1.Value) - yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) $$ = stmt.NewLabel(label) + + // save position + yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2)) - yylex.(*Parser).comments.AddComments(label, $1.Comments()) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(label, $1, comment.StringToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.ColonToken) } ; @@ -637,13 +736,19 @@ unticked_statement: '{' inner_statement_list '}' { $$ = stmt.NewStmtList($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken) } | T_IF parenthesis_expr statement elseif_list else_single { $$ = stmt.NewIf($2, $3, $4, $5) - + + // save position if $5 != nil { yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $5)) } else if len($4) > 0 { @@ -652,16 +757,23 @@ unticked_statement: yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3)) } - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.IfToken) } | T_IF parenthesis_expr ':' inner_statement_list new_elseif_list new_else_single T_ENDIF ';' { stmts := stmt.NewStmtList($4) - yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition($4)) - $$ = stmt.NewAltIf($2, stmts, $5, $6) + + // save position + yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition($4)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $8)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.IfToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.ColonToken) + yylex.(*Parser).comments.AddFromToken($$, $7, comment.EndifToken) + yylex.(*Parser).comments.AddFromToken($$, $8, comment.SemiColonToken) } | T_WHILE parenthesis_expr while_statement { @@ -674,14 +786,23 @@ unticked_statement: $$ = $3 + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.WhileToken) } | T_DO statement T_WHILE parenthesis_expr ';' { $$ = stmt.NewDo($2, $4) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $5)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.DoToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.WhileToken) + yylex.(*Parser).comments.AddFromToken($$, $5, comment.SemiColonToken) } | T_FOR '(' for_expr ';' for_expr ';' for_expr ')' for_statement { @@ -698,8 +819,15 @@ unticked_statement: $$ = $9 + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $9)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ForToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.ForInitSemicolonToken) + yylex.(*Parser).comments.AddFromToken($$, $6, comment.ForCondSemicolonToken) + yylex.(*Parser).comments.AddFromToken($$, $8, comment.CloseParenthesisToken) } | T_SWITCH parenthesis_expr switch_case_list { @@ -714,92 +842,164 @@ unticked_statement: $$ = $3 + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.SwitchToken) } | T_BREAK ';' { $$ = stmt.NewBreak(nil) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.BreakToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken) } | T_BREAK expr ';' { $$ = stmt.NewBreak($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.BreakToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken) } | T_CONTINUE ';' { $$ = stmt.NewContinue(nil) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ContinueToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken) } | T_CONTINUE expr ';' { $$ = stmt.NewContinue($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ContinueToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken) } | T_RETURN ';' { $$ = stmt.NewReturn(nil) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ReturnToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken) } | T_RETURN expr_without_variable ';' { $$ = stmt.NewReturn($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ReturnToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken) } | T_RETURN variable ';' { $$ = stmt.NewReturn($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ReturnToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken) } | yield_expr ';' { $$ = stmt.NewExpression($1) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken) } | T_GLOBAL global_var_list ';' { $$ = stmt.NewGlobal($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.GlobalToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken) } | T_STATIC static_var_list ';' { $$ = stmt.NewStatic($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.StaticToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken) } | T_ECHO echo_expr_list ';' { $$ = stmt.NewEcho($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.EchoToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken) } | T_INLINE_HTML { $$ = stmt.NewInlineHtml($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.InlineHTMLToken) } | expr ';' { $$ = stmt.NewExpression($1) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken) } | T_UNSET '(' unset_variables ')' ';' { $$ = stmt.NewUnset($3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $5)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.UnsetToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $5, comment.SemiColonToken) } | T_FOREACH '(' variable T_AS foreach_variable foreach_optional_arg ')' foreach_statement { @@ -827,8 +1027,14 @@ unticked_statement: $$ = $8 + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $8)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ForeachToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.AsToken) + yylex.(*Parser).comments.AddFromToken($$, $7, comment.CloseParenthesisToken) } | T_FOREACH '(' expr_without_variable T_AS foreach_variable foreach_optional_arg ')' foreach_statement { @@ -854,50 +1060,79 @@ unticked_statement: } } + // save position $$ = $8 yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $8)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ForeachToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.AsToken) + yylex.(*Parser).comments.AddFromToken($$, $7, comment.CloseParenthesisToken) } | T_DECLARE '(' declare_list ')' declare_statement { $$ = stmt.NewDeclare($3, $5) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $5)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.DeclareToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken) } | ';' { $$ = stmt.NewNop() + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.SemiColonToken) } | T_TRY '{' inner_statement_list '}' catch_statement finally_statement { $$ = stmt.NewTry($3, $5, $6) + // save position if $6 == nil { yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $5)) } else { yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $6)) } - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.TryToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseCurlyBracesToken) } | T_THROW expr ';' { $$ = stmt.NewThrow($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ThrowToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken) } | T_GOTO T_STRING ';' { label := node.NewIdentifier($2.Value) - yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) $$ = stmt.NewGoto(label) + + // save position + yylex.(*Parser).positions.AddPosition(label, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments(label, $2.Comments()) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.GotoToken) + yylex.(*Parser).comments.AddFromToken(label, $2, comment.StringToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken) } ; @@ -907,18 +1142,22 @@ catch_statement: | T_CATCH '(' fully_qualified_class_name T_VARIABLE ')' '{' inner_statement_list '}' additional_catches { identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) - yylex.(*Parser).comments.AddComments(identifier, $4.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) - yylex.(*Parser).comments.AddComments(variable, $4.Comments()) - catch := stmt.NewCatch([]node.Node{$3}, variable, $7) - yylex.(*Parser).positions.AddPosition(catch, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $8)) - yylex.(*Parser).comments.AddComments(catch, $1.Comments()) - $$ = append([]node.Node{catch}, $9...) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) + yylex.(*Parser).positions.AddPosition(catch, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $8)) + + // save comments + yylex.(*Parser).comments.AddFromToken(catch, $1, comment.CatchToken) + yylex.(*Parser).comments.AddFromToken(catch, $2, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(variable, $4, comment.StringToken) + yylex.(*Parser).comments.AddFromToken(catch, $5, comment.CloseParenthesisToken) + yylex.(*Parser).comments.AddFromToken(catch, $6, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(catch, $8, comment.CloseCurlyBracesToken) } finally_statement: @@ -927,8 +1166,14 @@ finally_statement: | T_FINALLY '{' inner_statement_list '}' { $$ = stmt.NewFinally($3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.FinallyToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseCurlyBracesToken) } ; @@ -950,16 +1195,21 @@ additional_catch: T_CATCH '(' fully_qualified_class_name T_VARIABLE ')' '{' inner_statement_list '}' { identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) - yylex.(*Parser).comments.AddComments(identifier, $4.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) - yylex.(*Parser).comments.AddComments(variable, $4.Comments()) - $$ = stmt.NewCatch([]node.Node{$3}, variable, $7) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $8)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.CatchToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(variable, $4, comment.StringToken) + yylex.(*Parser).comments.AddFromToken($$, $5, comment.CloseParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $6, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken($$, $8, comment.CloseCurlyBracesToken) } ; @@ -967,7 +1217,12 @@ unset_variables: unset_variable { $$ = []node.Node{$1} } | unset_variables ',' unset_variable - { $$ = append($1, $3) } + { + $$ = append($1, $3) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + } ; unset_variable: @@ -1003,22 +1258,31 @@ unticked_function_declaration_statement: function is_reference T_STRING '(' parameter_list ')' '{' inner_statement_list '}' { name := node.NewIdentifier($3.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) - yylex.(*Parser).comments.AddComments(name, $3.Comments()) - $$ = stmt.NewFunction(name, $2 != nil, $5, nil, $8, "") + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $9)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.FunctionToken) + if $2 != nil { + yylex.(*Parser).comments.AddFromToken($$, $2, comment.AmpersandToken) + } + yylex.(*Parser).comments.AddFromToken(name, $3, comment.StringToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $6, comment.CloseParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $7, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken($$, $9, comment.CloseCurlyBracesToken) } ; unticked_class_declaration_statement: class_entry_type T_STRING extends_from implements_list '{' class_statement_list '}' { + name := node.NewIdentifier($2.Value) switch n := $1.(type) { case *stmt.Class : - name := node.NewIdentifier($2.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) n.ClassName = name n.Stmts = $6 n.Extends = $3 @@ -1026,23 +1290,32 @@ unticked_class_declaration_statement: case *stmt.Trait : // TODO: is it possible that trait extend or implement - name := node.NewIdentifier($2.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) n.TraitName = name n.Stmts = $6 } - $$ = $1 + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) + + // save comments + yylex.(*Parser).comments.AddFromToken(name, $2, comment.StringToken) + yylex.(*Parser).comments.AddFromToken($$, $5, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken($$, $7, comment.CloseCurlyBracesToken) } | interface_entry T_STRING interface_extends_list '{' class_statement_list '}' { name := node.NewIdentifier($2.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) - yylex.(*Parser).comments.AddComments(name, $2.Comments()) - $$ = stmt.NewInterface(name, $3, $5, "") + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $6)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(name, $2, comment.StringToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken($$, $6, comment.CloseCurlyBracesToken) } ; @@ -1051,34 +1324,48 @@ class_entry_type: T_CLASS { $$ = stmt.NewClass(nil, nil, nil, nil, nil, nil, "") + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ClassToken) } | T_ABSTRACT T_CLASS { classModifier := node.NewIdentifier($1.Value) - yylex.(*Parser).positions.AddPosition(classModifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(classModifier, $1.Comments()) - $$ = stmt.NewClass(nil, []node.Node{classModifier}, nil, nil, nil, nil, "") + + // save position + yylex.(*Parser).positions.AddPosition(classModifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(classModifier, $1, comment.AbstractToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.ClassToken) } | T_TRAIT { $$ = stmt.NewTrait(nil, nil, "") + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.TraitToken) } | T_FINAL T_CLASS { classModifier := node.NewIdentifier($1.Value) - yylex.(*Parser).positions.AddPosition(classModifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(classModifier, $1.Comments()) - $$ = stmt.NewClass(nil, []node.Node{classModifier}, nil, nil, nil, nil, "") + + // save position + yylex.(*Parser).positions.AddPosition(classModifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(classModifier, $1, comment.FinalToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.ClassToken) } ; @@ -1091,6 +1378,9 @@ extends_from: // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ExtendsToken) } ; @@ -1108,6 +1398,9 @@ interface_extends_list: // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ExtendsToken) } ; @@ -1120,6 +1413,9 @@ implements_list: // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ImplementsToken) } ; @@ -1127,27 +1423,50 @@ interface_list: fully_qualified_class_name { $$ = []node.Node{$1} } | interface_list ',' fully_qualified_class_name - { $$ = append($1, $3) } + { + $$ = append($1, $3) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + } ; foreach_optional_arg: /* empty */ { $$ = nil } | T_DOUBLE_ARROW foreach_variable - { $$ = $2 } + { + $$ = $2 + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.DoubleArrowToken) + } ; foreach_variable: variable { $$ = $1 } | '&' variable - { $$ = expr.NewReference($2) } + { + $$ = expr.NewReference($2) + + // save position + yylex.(*Parser).positions.AddPosition($2, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.AmpersandToken) + } | T_LIST '(' assignment_list ')' { - list := expr.NewList($3) - yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) - $$ = list - yylex.(*Parser).comments.AddComments(list, $1.Comments()) + $$ = expr.NewList($3) + + // save position + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ListToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken) } ; @@ -1155,6 +1474,8 @@ for_statement: statement { $$ = stmt.NewFor(nil, nil, nil, $1) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1)) } | ':' inner_statement_list T_ENDFOR ';' @@ -1162,16 +1483,23 @@ for_statement: stmtList := stmt.NewStmtList($2) $$ = stmt.NewAltFor(nil, nil, nil, stmtList) + // save position yylex.(*Parser).positions.AddPosition(stmtList, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ColonToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.EndforToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken) } ; - foreach_statement: statement { $$ = stmt.NewForeach(nil, nil, nil, $1) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1)) } | ':' inner_statement_list T_ENDFOREACH ';' @@ -1179,8 +1507,14 @@ foreach_statement: stmtList := stmt.NewStmtList($2) $$ = stmt.NewAltForeach(nil, nil, nil, stmtList) + // save position yylex.(*Parser).positions.AddPosition(stmtList, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ColonToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.EndforeachToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken) } ; @@ -1191,8 +1525,14 @@ declare_statement: | ':' inner_statement_list T_ENDDECLARE ';' { $$ = stmt.NewStmtList($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ColonToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.EnddeclareToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken) } ; @@ -1201,26 +1541,31 @@ declare_list: T_STRING '=' static_scalar { name := node.NewIdentifier($1.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(name, $1.Comments()) - constant := stmt.NewConstant(name, $3, "") - yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3)) - yylex.(*Parser).comments.AddComments(constant, $1.Comments()) - $$ = []node.Node{constant} + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3)) + + // save comments + yylex.(*Parser).comments.AddFromToken(name, $1, comment.StringToken) + yylex.(*Parser).comments.AddFromToken(constant, $2, comment.EqualToken) } | declare_list ',' T_STRING '=' static_scalar { name := node.NewIdentifier($3.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) - yylex.(*Parser).comments.AddComments(name, $3.Comments()) - constant := stmt.NewConstant(name, $5, "") - yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $5)) - yylex.(*Parser).comments.AddComments(constant, $3.Comments()) - $$ = append($1, constant) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) + yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $5)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(name, $3, comment.StringToken) + yylex.(*Parser).comments.AddFromToken(constant, $4, comment.EqualToken) } ; @@ -1231,33 +1576,57 @@ switch_case_list: caseList := stmt.NewCaseList($2) $$ = stmt.NewSwitch(nil, caseList) + // save position yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) + + // save comments + yylex.(*Parser).comments.AddFromToken(caseList, $1, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(caseList, $3, comment.CloseCurlyBracesToken) } | '{' ';' case_list '}' { caseList := stmt.NewCaseList($3) $$ = stmt.NewSwitch(nil, caseList) + // save position yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) + + // save comments + yylex.(*Parser).comments.AddFromToken(caseList, $1, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(caseList, $2, comment.SemiColonToken) + yylex.(*Parser).comments.AddFromToken(caseList, $4, comment.CloseCurlyBracesToken) } | ':' case_list T_ENDSWITCH ';' { caseList := stmt.NewCaseList($2) $$ = stmt.NewAltSwitch(nil, caseList) + // save position yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) + + // save comments + yylex.(*Parser).comments.AddFromToken(caseList, $1, comment.ColonToken) + yylex.(*Parser).comments.AddFromToken(caseList, $3, comment.EndswitchToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken) } | ':' ';' case_list T_ENDSWITCH ';' { - + caseList := stmt.NewCaseList($3) $$ = stmt.NewAltSwitch(nil, caseList) + // save position yylex.(*Parser).positions.AddPosition(caseList, yylex.(*Parser).positionBuilder.NewNodeListPosition($3)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $5)) + + // save comments + yylex.(*Parser).comments.AddFromToken(caseList, $1, comment.ColonToken) + yylex.(*Parser).comments.AddFromToken(caseList, $2, comment.SemiColonToken) + yylex.(*Parser).comments.AddFromToken(caseList, $4, comment.EndswitchToken) + yylex.(*Parser).comments.AddFromToken($$, $5, comment.SemiColonToken) } ; @@ -1268,23 +1637,35 @@ case_list: | case_list T_CASE expr case_separator inner_statement_list { _case := stmt.NewCase($3, $5) - yylex.(*Parser).positions.AddPosition(_case, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $5)) $$ = append($1, _case) - yylex.(*Parser).comments.AddComments(_case, $2.Comments()) + + // save position + yylex.(*Parser).positions.AddPosition(_case, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $5)) + + // save comments + yylex.(*Parser).comments.AddFromToken(_case, $2, comment.CaseToken) + yylex.(*Parser).comments.AddFromToken(_case, $4, comment.CaseSeparatorToken) } | case_list T_DEFAULT case_separator inner_statement_list { _default := stmt.NewDefault($4) - yylex.(*Parser).positions.AddPosition(_default, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $4)) $$ = append($1, _default) - yylex.(*Parser).comments.AddComments(_default, $2.Comments()) + + // save position + yylex.(*Parser).positions.AddPosition(_default, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $4)) + + // save comments + yylex.(*Parser).comments.AddFromToken(_default, $2, comment.DefaultToken) + yylex.(*Parser).comments.AddFromToken(_default, $3, comment.CaseSeparatorToken) } ; case_separator: ':' + { $$ = $1 } | ';' + { $$ = $1 } ; @@ -1292,6 +1673,8 @@ while_statement: statement { $$ = stmt.NewWhile(nil, $1) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1)) } | ':' inner_statement_list T_ENDWHILE ';' @@ -1299,8 +1682,14 @@ while_statement: stmtList := stmt.NewStmtList($2) $$ = stmt.NewAltWhile(nil, stmtList) + // save position yylex.(*Parser).positions.AddPosition(stmtList, yylex.(*Parser).positionBuilder.NewNodeListPosition($2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ColonToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.EndwhileToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.SemiColonToken) } ; @@ -1312,10 +1701,13 @@ elseif_list: | elseif_list T_ELSEIF parenthesis_expr statement { _elseIf := stmt.NewElseIf($3, $4) - yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $4)) - yylex.(*Parser).comments.AddComments(_elseIf, $2.Comments()) - $$ = append($1, _elseIf) + + // save position + yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $4)) + + // save comments + yylex.(*Parser).comments.AddFromToken(_elseIf, $2, comment.ElseifToken) } ; @@ -1326,13 +1718,16 @@ new_elseif_list: | new_elseif_list T_ELSEIF parenthesis_expr ':' inner_statement_list { stmts := stmt.NewStmtList($5) - yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition($5)) - _elseIf := stmt.NewAltElseIf($3, stmts) - yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $5)) - yylex.(*Parser).comments.AddComments(_elseIf, $2.Comments()) - $$ = append($1, _elseIf) + + // save position + yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition($5)) + yylex.(*Parser).positions.AddPosition(_elseIf, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($2, $5)) + + // save comments + yylex.(*Parser).comments.AddFromToken(_elseIf, $2, comment.ElseifToken) + yylex.(*Parser).comments.AddFromToken(_elseIf, $4, comment.ColonToken) } ; @@ -1343,8 +1738,12 @@ else_single: | T_ELSE statement { $$ = stmt.NewElse($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ElseToken) } ; @@ -1355,11 +1754,15 @@ new_else_single: | T_ELSE ':' inner_statement_list { stmts := stmt.NewStmtList($3) - yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition($3)) - $$ = stmt.NewAltElse(stmts) + + // save position + yylex.(*Parser).positions.AddPosition(stmts, yylex.(*Parser).positionBuilder.NewNodeListPosition($3)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ElseToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.ColonToken) } ; @@ -1375,61 +1778,71 @@ non_empty_parameter_list: parameter { $$ = []node.Node{$1} } | non_empty_parameter_list ',' parameter - { $$ = append($1, $3) } + { + $$ = append($1, $3) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + } ; parameter: optional_class_type is_reference is_variadic T_VARIABLE { identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) - yylex.(*Parser).comments.AddComments($$, $4.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) - yylex.(*Parser).comments.AddComments($$, $4.Comments()) - $$ = node.NewParameter($1, variable, nil, $2 != nil, $3 != nil) - + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) if $1 != nil { yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) } else if $2 != nil { yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($2, $4)) - yylex.(*Parser).comments.AddComments($$, $2.Comments()) } else if $3 != nil { yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($3, $4)) - yylex.(*Parser).comments.AddComments($$, $3.Comments()) } else { yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) - yylex.(*Parser).comments.AddComments($$, $4.Comments()) } + + // save comments + if $2 != nil { + yylex.(*Parser).comments.AddFromToken($$, $2, comment.AmpersandToken) + } + if $3 != nil { + yylex.(*Parser).comments.AddFromToken($$, $3, comment.EllipsisToken) + } + yylex.(*Parser).comments.AddFromToken(variable, $4, comment.VariableToken) } | optional_class_type is_reference is_variadic T_VARIABLE '=' static_scalar { identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) - yylex.(*Parser).comments.AddComments(identifier, $4.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) - yylex.(*Parser).comments.AddComments(variable, $4.Comments()) - $$ = node.NewParameter($1, variable, $6, $2 != nil, $3 != nil) + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) if $1 != nil { yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $6)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) } else if $2 != nil { yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $6)) - yylex.(*Parser).comments.AddComments($$, $2.Comments()) } else if $3 != nil { yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $6)) - yylex.(*Parser).comments.AddComments($$, $3.Comments()) } else { yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($4, $6)) - yylex.(*Parser).comments.AddComments($$, $4.Comments()) } + + // save comments + if $2 != nil { + yylex.(*Parser).comments.AddFromToken($$, $2, comment.AmpersandToken) + } + if $3 != nil { + yylex.(*Parser).comments.AddFromToken($$, $3, comment.EllipsisToken) + } + yylex.(*Parser).comments.AddFromToken(variable, $4, comment.VariableToken) + yylex.(*Parser).comments.AddFromToken($$, $5, comment.EqualToken) } ; @@ -1440,14 +1853,22 @@ optional_class_type: | T_ARRAY { $$ = node.NewIdentifier($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ArrayToken) } | T_CALLABLE { $$ = node.NewIdentifier($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.CallableToken) } | fully_qualified_class_name { $$ = $1 } @@ -1461,6 +1882,10 @@ function_call_parameter_list: // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.CloseParenthesisToken) } | '(' non_empty_function_call_parameter_list ')' { @@ -1468,6 +1893,10 @@ function_call_parameter_list: // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseParenthesisToken) } | '(' yield_expr ')' { @@ -1477,6 +1906,10 @@ function_call_parameter_list: // save position yylex.(*Parser).positions.AddPosition(arg, yylex.(*Parser).positionBuilder.NewNodePosition($2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseParenthesisToken) } ; @@ -1485,39 +1918,59 @@ non_empty_function_call_parameter_list: function_call_parameter { $$ = []node.Node{$1} } | non_empty_function_call_parameter_list ',' function_call_parameter - { $$ = append($1, $3) } + { + $$ = append($1, $3) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + } ; function_call_parameter: expr_without_variable { $$ = node.NewArgument($1, false, false) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) } | variable { $$ = node.NewArgument($1, false, false) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) } | '&' w_variable { $$ = node.NewArgument($2, false, true) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.AmpersandToken) } | T_ELLIPSIS expr { $$ = node.NewArgument($2, true, false) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.EllipsisToken) } ; global_var_list: global_var_list ',' global_var - { $$ = append($1, $3) } + { + $$ = append($1, $3) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + } | global_var { $$ = []node.Node{$1} } ; @@ -1527,24 +1980,36 @@ global_var: T_VARIABLE { name := node.NewIdentifier(strings.TrimLeft($1.Value, "$")) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) $$ = expr.NewVariable(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(name, $1.Comments()) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.VariableToken) } | '$' r_variable { $$ = expr.NewVariable($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.DollarToken) } | '$' '{' expr '}' { $$ = expr.NewVariable($3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.DollarToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseCurlyBracesToken) } ; @@ -1553,72 +2018,67 @@ static_var_list: static_var_list ',' T_VARIABLE { identifier := node.NewIdentifier(strings.TrimLeft($3.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) - staticVar := stmt.NewStaticVar(variable, nil) + $$ = append($1, staticVar) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) - $$ = append($1, staticVar) - - yylex.(*Parser).comments.AddComments(identifier, $3.Comments()) - yylex.(*Parser).comments.AddComments(variable, $3.Comments()) - yylex.(*Parser).comments.AddComments(staticVar, $3.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(variable, $3, comment.VariableToken) } | static_var_list ',' T_VARIABLE '=' static_scalar { identifier := node.NewIdentifier(strings.TrimLeft($3.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) - staticVar := stmt.NewStaticVar(variable, $5) + $$ = append($1, staticVar) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $5)) - $$ = append($1, staticVar) - - yylex.(*Parser).comments.AddComments(identifier, $3.Comments()) - yylex.(*Parser).comments.AddComments(variable, $3.Comments()) - yylex.(*Parser).comments.AddComments(staticVar, $3.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(variable, $3, comment.VariableToken) + yylex.(*Parser).comments.AddFromToken(staticVar, $4, comment.EqualToken) } | T_VARIABLE { identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - staticVar := stmt.NewStaticVar(variable, nil) + $$ = []node.Node{staticVar} + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - $$ = []node.Node{staticVar} - - yylex.(*Parser).comments.AddComments(identifier, $1.Comments()) - yylex.(*Parser).comments.AddComments(variable, $1.Comments()) - yylex.(*Parser).comments.AddComments(staticVar, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken) } | T_VARIABLE '=' static_scalar { identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - staticVar := stmt.NewStaticVar(variable, $3) + $$ = []node.Node{staticVar} + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) yylex.(*Parser).positions.AddPosition(staticVar, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3)) - $$ = []node.Node{staticVar} - - yylex.(*Parser).comments.AddComments(identifier, $1.Comments()) - yylex.(*Parser).comments.AddComments(variable, $1.Comments()) - yylex.(*Parser).comments.AddComments(staticVar, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken) + yylex.(*Parser).comments.AddFromToken(staticVar, $2, comment.EqualToken) } - ; @@ -1634,28 +2094,48 @@ class_statement: variable_modifiers class_variable_declaration ';' { $$ = stmt.NewPropertyList($1, $2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListTokenPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $3, comment.SemiColonToken) } | class_constant_declaration ';' - { $$ = $1 } + { + $$ = $1 + + // save position + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken) + } | trait_use_statement - { $$ = $1 } + { + $$ = $1 + } | method_modifiers function is_reference T_STRING '(' parameter_list ')' method_body { name := node.NewIdentifier($4.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) - yylex.(*Parser).comments.AddComments(name, $4.Comments()) - $$ = stmt.NewClassMethod(name, $1, $3 != nil, $6, nil, $8, "") + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) if $1 == nil { yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $8)) } else { yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListNodePosition($1, $8)) } - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1)) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.FunctionToken) + if $3 != nil { + yylex.(*Parser).comments.AddFromToken($$, $3, comment.AmpersandToken) + } + yylex.(*Parser).comments.AddFromToken(name, $4, comment.IdentifierToken) + yylex.(*Parser).comments.AddFromToken($$, $5, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $7, comment.CloseParenthesisToken) } ; @@ -1669,10 +2149,13 @@ trait_use_statement: default: adaptationList = nil } - $$ = stmt.NewTraitUse($2, adaptationList) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.UseToken) } ; @@ -1680,7 +2163,12 @@ trait_list: fully_qualified_class_name { $$ = []node.Node{$1} } | trait_list ',' fully_qualified_class_name - { $$ = append($1, $3) } + { + $$ = append($1, $3) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + } ; trait_adaptations: @@ -1689,12 +2177,20 @@ trait_adaptations: $$ = stmt.NewNop() yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.SemiColonToken) + } | '{' trait_adaptation_list '}' { $$ = stmt.NewTraitAdaptationList($2) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken) } ; @@ -1714,17 +2210,31 @@ non_empty_trait_adaptation_list: trait_adaptation_statement: trait_precedence ';' - { $$ = $1 } + { + $$ = $1; + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken) + } | trait_alias ';' - { $$ = $1 } + { + $$ = $1; + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.SemiColonToken) + } ; trait_precedence: trait_method_reference_fully_qualified T_INSTEADOF trait_reference_list { $$ = stmt.NewTraitUsePrecedence($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeNodeListPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.InsteadofToken) } ; @@ -1732,19 +2242,26 @@ trait_reference_list: fully_qualified_class_name { $$ = []node.Node{$1} } | trait_reference_list ',' fully_qualified_class_name - { $$ = append($1, $3) } + { + $$ = append($1, $3) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + } ; trait_method_reference: T_STRING { name := node.NewIdentifier($1.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(name, $1.Comments()) - $$ = stmt.NewTraitMethodRef(nil, name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(name, $1, comment.IdentifierToken) } | trait_method_reference_fully_qualified { $$ = $1 } @@ -1754,12 +2271,15 @@ trait_method_reference_fully_qualified: fully_qualified_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { target := node.NewIdentifier($3.Value) - yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) - yylex.(*Parser).comments.AddComments(target, $3.Comments()) - $$ = stmt.NewTraitMethodRef($1, target) + + // save position + yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken) + yylex.(*Parser).comments.AddFromToken(target, $3, comment.IdentifierToken) } ; @@ -1767,18 +2287,25 @@ trait_alias: trait_method_reference T_AS trait_modifiers T_STRING { alias := node.NewIdentifier($4.Value) - yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) $$ = stmt.NewTraitUseAlias($1, $3, alias) + + // save position + yylex.(*Parser).positions.AddPosition(alias, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4)) - - yylex.(*Parser).comments.AddComments(alias, $4.Comments()) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsToken) + yylex.(*Parser).comments.AddFromToken(alias, $4, comment.IdentifierToken) } | trait_method_reference T_AS member_modifier { $$ = stmt.NewTraitUseAlias($1, $3, nil) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsToken) } ; @@ -1794,13 +2321,22 @@ method_body: { $$ = stmt.NewNop() + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.SemiColonToken) } | '{' inner_statement_list '}' { $$ = stmt.NewStmtList($2) + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken) } ; @@ -1810,10 +2346,13 @@ variable_modifiers: | T_VAR { modifier := node.NewIdentifier($1.Value) - yylex.(*Parser).positions.AddPosition(modifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(modifier, $1.Comments()) - $$ = []node.Node{modifier} + + // save position + yylex.(*Parser).positions.AddPosition(modifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + + // save comments + yylex.(*Parser).comments.AddFromToken(modifier, $1, comment.VarToken) } ; @@ -1835,38 +2374,62 @@ member_modifier: T_PUBLIC { $$ = node.NewIdentifier($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.PublicToken) } | T_PROTECTED { $$ = node.NewIdentifier($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ProtectedToken) } | T_PRIVATE { $$ = node.NewIdentifier($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.PrivateToken) } | T_STATIC { $$ = node.NewIdentifier($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.StaticToken) } | T_ABSTRACT { $$ = node.NewIdentifier($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.AbstractToken) } | T_FINAL { $$ = node.NewIdentifier($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.FinalToken) } ; @@ -1874,66 +2437,66 @@ class_variable_declaration: class_variable_declaration ',' T_VARIABLE { identifier := node.NewIdentifier(strings.TrimLeft($3.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) - yylex.(*Parser).comments.AddComments(identifier, $3.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) - yylex.(*Parser).comments.AddComments(variable, $3.Comments()) - property := stmt.NewProperty(variable, nil, "") - yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) - yylex.(*Parser).comments.AddComments(property, $3.Comments()) - $$ = append($1, property) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) + yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(variable, $3, comment.VariableToken) } | class_variable_declaration ',' T_VARIABLE '=' static_scalar { identifier := node.NewIdentifier(strings.TrimLeft($3.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) - yylex.(*Parser).comments.AddComments(identifier, $3.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) - yylex.(*Parser).comments.AddComments(variable, $3.Comments()) - property := stmt.NewProperty(variable, $5, "") - yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $5)) - yylex.(*Parser).comments.AddComments(property, $3.Comments()) - $$ = append($1, property) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) + yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $5)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(variable, $3, comment.VariableToken) + yylex.(*Parser).comments.AddFromToken(property, $4, comment.EqualToken) } | T_VARIABLE { identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(identifier, $1.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(variable, $1.Comments()) - property := stmt.NewProperty(variable, nil, "") - yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(property, $1.Comments()) - $$ = []node.Node{property} + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + + // save comments + yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken) } | T_VARIABLE '=' static_scalar { identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(identifier, $1.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(variable, $1.Comments()) - property := stmt.NewProperty(variable, $3, "") - yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3)) - yylex.(*Parser).comments.AddComments(property, $1.Comments()) - $$ = []node.Node{property} + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + yylex.(*Parser).positions.AddPosition(property, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $3)) + + // save comments + yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken) + yylex.(*Parser).comments.AddFromToken(property, $2, comment.EqualToken) } ; @@ -1941,37 +2504,47 @@ class_constant_declaration: class_constant_declaration ',' T_STRING '=' static_scalar { name := node.NewIdentifier($3.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) - yylex.(*Parser).comments.AddComments(name, $3.Comments()) - constant := stmt.NewConstant(name, $5, "") - yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $5)) - yylex.(*Parser).comments.AddComments(constant, $3.Comments()) + constList := $1.(*stmt.ClassConstList) + constList.Consts = append(constList.Consts, constant) + $$ = $1 - $1.(*stmt.ClassConstList).Consts = append($1.(*stmt.ClassConstList).Consts, constant) + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) + yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $5)) yylex.(*Parser).positions.AddPosition($1, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $5)) - $$ = $1 + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode(constList.Consts), $2, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(name, $3, comment.IdentifierToken) + yylex.(*Parser).comments.AddFromToken(constant, $4, comment.EqualToken) } | T_CONST T_STRING '=' static_scalar { name := node.NewIdentifier($2.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) - yylex.(*Parser).comments.AddComments(name, $2.Comments()) - constant := stmt.NewConstant(name, $4, "") - yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $4)) - yylex.(*Parser).comments.AddComments(constant, $2.Comments()) - $$ = stmt.NewClassConstList(nil, []node.Node{constant}) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) + yylex.(*Parser).positions.AddPosition(constant, yylex.(*Parser).positionBuilder.NewTokenNodePosition($2, $4)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ConstToken) + yylex.(*Parser).comments.AddFromToken(name, $2, comment.IdentifierToken) + yylex.(*Parser).comments.AddFromToken(constant, $3, comment.EqualToken) } ; echo_expr_list: echo_expr_list ',' expr - { $$ = append($1, $3) } + { + $$ = append($1, $3) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + } | expr { $$ = []node.Node{$1} } ; @@ -1986,7 +2559,12 @@ for_expr: non_empty_for_expr: non_empty_for_expr ',' expr - { $$ = append($1, $3) } + { + $$ = append($1, $3) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + } | expr { $$ = []node.Node{$1} } ; @@ -2002,16 +2580,26 @@ chaining_dereference: chaining_dereference '[' dim_offset ']' { fetch := expr.NewArrayDimFetch(nil, $3) + $$ = append($1, fetch) + + // save position yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($3)) - $$ = append($1, fetch) + // save comments + yylex.(*Parser).comments.AddFromToken(fetch, $2, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(fetch, $4, comment.CloseSquareBracket) } | '[' dim_offset ']' { fetch := expr.NewArrayDimFetch(nil, $2) + $$ = []node.Node{fetch} + + // save position yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($2)) - $$ = []node.Node{fetch} + // save comments + yylex.(*Parser).comments.AddFromToken(fetch, $1, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(fetch, $3, comment.CloseSquareBracket) } ; @@ -2043,7 +2631,8 @@ new_expr: yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) } - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NewToken) } ; @@ -2051,24 +2640,38 @@ expr_without_variable: T_LIST '(' assignment_list ')' '=' expr { list := expr.NewList($3) - yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) $$ = assign.NewAssign(list, $6) + + // save position + yylex.(*Parser).positions.AddPosition(list, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $6)) - yylex.(*Parser).comments.AddComments(list, $1.Comments()) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(list, $1, comment.ListToken) + yylex.(*Parser).comments.AddFromToken(list, $2, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(list, $4, comment.CloseParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $5, comment.EqualToken) } | variable '=' expr { $$ = assign.NewAssign($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.EqualToken) } | variable '=' '&' variable { $$ = assign.NewReference($1, $4) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.EqualToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.AmpersandToken) } | variable '=' '&' T_NEW class_name_reference ctor_arguments { @@ -2076,298 +2679,493 @@ expr_without_variable: if $6 != nil { _new = expr.NewNew($5, $6.(*node.ArgumentList)) - yylex.(*Parser).positions.AddPosition(_new, yylex.(*Parser).positionBuilder.NewTokenNodePosition($4, $6)) } else { _new = expr.NewNew($5, nil) + } + $$ = assign.NewReference($1, _new) + + // save position + if $6 != nil { + yylex.(*Parser).positions.AddPosition(_new, yylex.(*Parser).positionBuilder.NewTokenNodePosition($4, $6)) + } else { yylex.(*Parser).positions.AddPosition(_new, yylex.(*Parser).positionBuilder.NewTokenNodePosition($4, $5)) } - yylex.(*Parser).comments.AddComments(_new, yylex.(*Parser).comments[$1]) - - $$ = assign.NewReference($1, _new) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, _new)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.EqualToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.AmpersandToken) + yylex.(*Parser).comments.AddFromToken(_new, $4, comment.NewToken) } | T_CLONE expr { $$ = expr.NewClone($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.CloneToken) } | variable T_PLUS_EQUAL expr { $$ = assign.NewPlus($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PlusEqualToken) } | variable T_MINUS_EQUAL expr { $$ = assign.NewMinus($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.MinusEqualToken) } | variable T_MUL_EQUAL expr { $$ = assign.NewMul($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.MulEqualToken) } | variable T_POW_EQUAL expr { $$ = assign.NewPow($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PowEqualToken) } | variable T_DIV_EQUAL expr { $$ = assign.NewDiv($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.DivEqualToken) } | variable T_CONCAT_EQUAL expr { $$ = assign.NewConcat($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.ConcatEqualToken) } | variable T_MOD_EQUAL expr { $$ = assign.NewMod($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.ModEqualToken) } | variable T_AND_EQUAL expr { $$ = assign.NewBitwiseAnd($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.AndEqualToken) } | variable T_OR_EQUAL expr { $$ = assign.NewBitwiseOr($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OrEqualToken) } | variable T_XOR_EQUAL expr { $$ = assign.NewBitwiseXor($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.XorEqualToken) } | variable T_SL_EQUAL expr { $$ = assign.NewShiftLeft($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.SlEqualToken) } | variable T_SR_EQUAL expr { $$ = assign.NewShiftRight($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.SrEqualToken) } | rw_variable T_INC { $$ = expr.NewPostInc($1) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.IncToken) } | T_INC rw_variable { $$ = expr.NewPreInc($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.IncToken) } | rw_variable T_DEC { $$ = expr.NewPostDec($1) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.DecToken) } | T_DEC rw_variable { $$ = expr.NewPreDec($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.DecToken) } | expr T_BOOLEAN_OR expr { $$ = binary.NewBooleanOr($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.BooleanOrToken) } | expr T_BOOLEAN_AND expr { $$ = binary.NewBooleanAnd($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.BooleanAndToken) } | expr T_LOGICAL_OR expr { $$ = binary.NewLogicalOr($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.LogicalOrToken) } | expr T_LOGICAL_AND expr { $$ = binary.NewLogicalAnd($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.LogicalAndToken) } | expr T_LOGICAL_XOR expr { $$ = binary.NewLogicalXor($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.LogicalXorToken) } | expr '|' expr { $$ = binary.NewBitwiseOr($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.VerticalBarToken) } | expr '&' expr { $$ = binary.NewBitwiseAnd($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.AmpersandToken) } | expr '^' expr { $$ = binary.NewBitwiseXor($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.CaretToken) } | expr '.' expr { $$ = binary.NewConcat($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.DotToken) } | expr '+' expr { $$ = binary.NewPlus($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PlusToken) } | expr '-' expr { $$ = binary.NewMinus($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.MinusToken) } | expr '*' expr { $$ = binary.NewMul($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsteriskToken) } | expr T_POW expr { $$ = binary.NewPow($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PowToken) } | expr '/' expr { $$ = binary.NewDiv($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.SlashToken) } | expr '%' expr { $$ = binary.NewMod($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PercentToken) } | expr T_SL expr { $$ = binary.NewShiftLeft($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.SlToken) } | expr T_SR expr { $$ = binary.NewShiftRight($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.SrToken) } | '+' expr %prec T_INC { $$ = expr.NewUnaryPlus($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.PlusToken) } | '-' expr %prec T_INC { $$ = expr.NewUnaryMinus($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.MinusToken) } | '!' expr { $$ = expr.NewBooleanNot($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ExclamationMarkToken) } | '~' expr { $$ = expr.NewBitwiseNot($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.TildeToken) } | expr T_IS_IDENTICAL expr { $$ = binary.NewIdentical($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsIdenticalToken) } | expr T_IS_NOT_IDENTICAL expr { $$ = binary.NewNotIdentical($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsNotIdenticalToken) } | expr T_IS_EQUAL expr { $$ = binary.NewEqual($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsEqualToken) } | expr T_IS_NOT_EQUAL expr { $$ = binary.NewNotEqual($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsNotEqualToken) } | expr '<' expr { $$ = binary.NewSmaller($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.LessToken) } | expr T_IS_SMALLER_OR_EQUAL expr { $$ = binary.NewSmallerOrEqual($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsSmallerOrEqualToken) } | expr '>' expr { $$ = binary.NewGreater($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.GreaterToken) } | expr T_IS_GREATER_OR_EQUAL expr { $$ = binary.NewGreaterOrEqual($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsGreaterOrEqualToken) } | expr T_INSTANCEOF class_name_reference { $$ = expr.NewInstanceOf($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.InstanceofToken) } | parenthesis_expr { $$ = $1 } @@ -2381,95 +3179,156 @@ expr_without_variable: switch nn := n.(type) { case *expr.ArrayDimFetch: nn.Variable = $$ - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn)) - yylex.(*Parser).comments.AddComments(nn, $1.Comments()) $$ = nn case *expr.PropertyFetch: nn.Variable = $$ - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn)) - yylex.(*Parser).comments.AddComments(nn, $1.Comments()) $$ = nn case *expr.MethodCall: nn.Variable = $$ - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn)) - yylex.(*Parser).comments.AddComments(nn, $1.Comments()) $$ = nn } + + // save position + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, n)) } + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseParenthesisToken) } | expr '?' expr ':' expr { $$ = expr.NewTernary($1, $3, $5) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $5)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.QuestionMarkToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.ColonToken) } | expr '?' ':' expr { $$ = expr.NewTernary($1, nil, $4) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.QuestionMarkToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.ColonToken) } | internal_functions_in_yacc { $$ = $1 } | T_INT_CAST expr { $$ = cast.NewInt($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.IntCastToken) } | T_DOUBLE_CAST expr { $$ = cast.NewDouble($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.DoubleCastToken) } | T_STRING_CAST expr { $$ = cast.NewString($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.StringCastToken) } | T_ARRAY_CAST expr { $$ = cast.NewArray($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ArrayCastToken) } | T_OBJECT_CAST expr { $$ = cast.NewObject($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ObjectCastToken) } | T_BOOL_CAST expr { $$ = cast.NewBool($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.BoolCastToken) } | T_UNSET_CAST expr { $$ = cast.NewUnset($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.UnsetCastToken) } | T_EXIT exit_expr { if (strings.EqualFold($1.Value, "die")) { - $$ = expr.NewDie($2) + $$ = expr.NewDie(nil) + if $2 != nil { + $$.(*expr.Die).Expr = $2.(*expr.Exit).Expr + } } else { - $$ = expr.NewExit($2) + $$ = expr.NewExit(nil) + if $2 != nil { + $$.(*expr.Exit).Expr = $2.(*expr.Exit).Expr + } + } + + // save position + if $2 == nil { + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + } else { + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) + } + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ExitToken) + + if $2 != nil { + yylex.(*Parser).comments.AddFromChildNode($$, $2) } - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) } | '@' expr { $$ = expr.NewErrorSuppress($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.AtToken) } | scalar { $$ = $1 } @@ -2480,34 +3339,68 @@ expr_without_variable: | '`' backticks_expr '`' { $$ = expr.NewShellExec($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.BackquoteToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.BackquoteToken) } | T_PRINT expr { $$ = expr.NewPrint($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.PrintToken) } | T_YIELD { $$ = expr.NewYield(nil, nil) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.YieldToken) } | function is_reference '(' parameter_list ')' lexical_vars '{' inner_statement_list '}' { $$ = expr.NewClosure($4, $6, nil, $8, false, $2 != nil, "") + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $9)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.FunctionToken) + if $2 != nil { + yylex.(*Parser).comments.AddFromToken($$, $2, comment.AmpersandToken) + } + yylex.(*Parser).comments.AddFromToken($$, $3, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $5, comment.CloseParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $7, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken($$, $9, comment.CloseCurlyBracesToken) } | T_STATIC function is_reference '(' parameter_list ')' lexical_vars '{' inner_statement_list '}' { $$ = expr.NewClosure($5, $7, nil, $9, true, $3 != nil, "") + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $10)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.StaticToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.FunctionToken) + if $3 != nil { + yylex.(*Parser).comments.AddFromToken($$, $3, comment.AmpersandToken) + } + yylex.(*Parser).comments.AddFromToken($$, $4, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $6, comment.CloseParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $8, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken($$, $10, comment.CloseCurlyBracesToken) } ; @@ -2515,26 +3408,44 @@ yield_expr: T_YIELD expr_without_variable { $$ = expr.NewYield(nil, $2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.YieldToken) } | T_YIELD variable { $$ = expr.NewYield(nil, $2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.YieldToken) } | T_YIELD expr T_DOUBLE_ARROW expr_without_variable { $$ = expr.NewYield($2, $4) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.YieldToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.DoubleArrowToken) } | T_YIELD expr T_DOUBLE_ARROW variable { $$ = expr.NewYield($2, $4) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.YieldToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.DoubleArrowToken) } ; @@ -2542,30 +3453,48 @@ combined_scalar_offset: combined_scalar '[' dim_offset ']' { $$ = expr.NewArrayDimFetch($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket) } | combined_scalar_offset '[' dim_offset ']' { $$ = expr.NewArrayDimFetch($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket) } | T_CONSTANT_ENCAPSED_STRING '[' dim_offset ']' { str := scalar.NewString($1.Value) - yylex.(*Parser).positions.AddPosition(str, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(str, $1.Comments()) - $$ = expr.NewArrayDimFetch(str, $3) + + // save position + yylex.(*Parser).positions.AddPosition(str, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition(str, $4)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[str]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket) } | general_constant '[' dim_offset ']' { $$ = expr.NewArrayDimFetch($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket) } ; @@ -2573,14 +3502,25 @@ combined_scalar: T_ARRAY '(' array_pair_list ')' { $$ = expr.NewArray($3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ArrayToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken) } | '[' array_pair_list ']' { $$ = expr.NewShortArray($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseSquareBracket) } ; @@ -2604,54 +3544,61 @@ lexical_var_list: lexical_var_list ',' T_VARIABLE { identifier := node.NewIdentifier(strings.TrimLeft($3.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) - yylex.(*Parser).comments.AddComments(identifier, $3.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) - yylex.(*Parser).comments.AddComments(variable, $3.Comments()) - $$ = append($1, variable) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(variable, $3, comment.VariableToken) } | lexical_var_list ',' '&' T_VARIABLE { identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) - yylex.(*Parser).comments.AddComments(identifier, $4.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) - yylex.(*Parser).comments.AddComments(variable, $3.Comments()) - reference := expr.NewReference(variable) - $$ = append($1, reference) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(reference, $3, comment.VariableToken) + yylex.(*Parser).comments.AddFromToken(variable, $4, comment.VariableToken) } | T_VARIABLE { identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(identifier, $1.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(variable, $1.Comments()) - $$ = []node.Node{variable} + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + + // save comments + yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken) } | '&' T_VARIABLE { identifier := node.NewIdentifier(strings.TrimLeft($2.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) - yylex.(*Parser).comments.AddComments(identifier, $2.Comments()) - variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) - yylex.(*Parser).comments.AddComments(variable, $1.Comments()) - reference := expr.NewReference(variable) - $$ = []node.Node{reference} + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) + yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2)) + + // save comments + yylex.(*Parser).comments.AddFromToken(reference, $1, comment.VariableToken) + yylex.(*Parser).comments.AddFromToken(variable, $2, comment.VariableToken) } ; @@ -2659,62 +3606,83 @@ function_call: namespace_name function_call_parameter_list { name := name.NewName($1) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1)) - $$ = expr.NewFunctionCall(name, $2.(*node.ArgumentList)) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition(name, $2)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[name]) } | T_NAMESPACE T_NS_SEPARATOR namespace_name function_call_parameter_list { funcName := name.NewRelative($3) - yylex.(*Parser).positions.AddPosition(funcName, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3)) - yylex.(*Parser).comments.AddComments(funcName, $1.Comments()) - $$ = expr.NewFunctionCall(funcName, $4.(*node.ArgumentList)) + + // save position + yylex.(*Parser).positions.AddPosition(funcName, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition(funcName, $4)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[funcName]) + + // save comments + yylex.(*Parser).comments.AddFromToken(funcName, $1, comment.NamespaceToken) + yylex.(*Parser).comments.AddFromToken(funcName, $2, comment.NsSeparatorToken) } | T_NS_SEPARATOR namespace_name function_call_parameter_list { funcName := name.NewFullyQualified($2) - yylex.(*Parser).positions.AddPosition(funcName, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2)) - yylex.(*Parser).comments.AddComments(funcName, $1.Comments()) - $$ = expr.NewFunctionCall(funcName, $3.(*node.ArgumentList)) + + // save position + yylex.(*Parser).positions.AddPosition(funcName, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition(funcName, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[funcName]) + + // save comments + yylex.(*Parser).comments.AddFromToken(funcName, $1, comment.NsSeparatorToken) } | class_name T_PAAMAYIM_NEKUDOTAYIM variable_name function_call_parameter_list { $$ = expr.NewStaticCall($1, $3, $4.(*node.ArgumentList)) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken) } | class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects function_call_parameter_list { $$ = expr.NewStaticCall($1, $3, $4.(*node.ArgumentList)) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken) } | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_name function_call_parameter_list { $$ = expr.NewStaticCall($1, $3, $4.(*node.ArgumentList)) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken) } | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects function_call_parameter_list { $$ = expr.NewStaticCall($1, $3, $4.(*node.ArgumentList)) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken) } | variable_without_objects function_call_parameter_list { $$ = expr.NewFunctionCall($1, $2.(*node.ArgumentList)) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) } ; @@ -2722,26 +3690,40 @@ class_name: T_STATIC { $$ = node.NewIdentifier($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.StaticToken) } | namespace_name { $$ = name.NewName($1) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1)) } | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$ = name.NewRelative($3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NamespaceToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.NsSeparatorToken) } | T_NS_SEPARATOR namespace_name { $$ = name.NewFullyQualified($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken) } ; @@ -2749,20 +3731,30 @@ fully_qualified_class_name: namespace_name { $$ = name.NewName($1) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).listGetFirstNodeComments($1)) } | T_NAMESPACE T_NS_SEPARATOR namespace_name { $$ = name.NewRelative($3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NamespaceToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.NsSeparatorToken) } | T_NS_SEPARATOR namespace_name { $$ = name.NewFullyQualified($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken) } ; @@ -2778,18 +3770,19 @@ dynamic_class_name_reference: { $$ = $1 + // save comments + yylex.(*Parser).comments.AddFromToken($3[0], $2, comment.ObjectOperatorToken) + for _, n := range($3) { switch nn := n.(type) { case *expr.ArrayDimFetch: nn.Variable = $$ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1]) $$ = nn case *expr.PropertyFetch: nn.Variable = $$ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1]) $$ = nn } } @@ -2799,13 +3792,11 @@ dynamic_class_name_reference: case *expr.ArrayDimFetch: nn.Variable = $$ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1]) $$ = nn case *expr.PropertyFetch: nn.Variable = $$ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1]) $$ = nn } } @@ -2825,16 +3816,35 @@ dynamic_class_name_variable_properties: dynamic_class_name_variable_property: T_OBJECT_OPERATOR object_property - { $$ = $2 } + { + $$ = $2 + + // save comments + yylex.(*Parser).comments.AddFromToken($2[0], $1, comment.ObjectOperatorToken) + } ; exit_expr: /* empty */ { $$ = nil } | '(' ')' - { $$ = nil } + { + $$ = expr.NewExit(nil); + + // save position + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.CloseParenthesisToken) + } | parenthesis_expr - { $$ = $1 } + { + $$ = expr.NewExit($1); + + // save position + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1)) + } ; backticks_expr: @@ -2857,78 +3867,124 @@ common_scalar: T_LNUMBER { $$ = scalar.NewLnumber($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.LnumberToken) } | T_DNUMBER { $$ = scalar.NewDnumber($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.DnumberToken) } | T_CONSTANT_ENCAPSED_STRING { $$ = scalar.NewString($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ConstantEncapsedStringToken) } | T_LINE { $$ = scalar.NewMagicConstant($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.LineToken) } | T_FILE { $$ = scalar.NewMagicConstant($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.FileToken) } | T_DIR { $$ = scalar.NewMagicConstant($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.DirToken) } | T_TRAIT_C { $$ = scalar.NewMagicConstant($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.TraitCToken) } | T_METHOD_C { $$ = scalar.NewMagicConstant($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.MethodCToken) } | T_FUNC_C { $$ = scalar.NewMagicConstant($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.FuncCToken) } | T_NS_C { $$ = scalar.NewMagicConstant($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsCToken) } - | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC + | T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC { encapsed := scalar.NewEncapsedStringPart($2.Value) - yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) - yylex.(*Parser).comments.AddComments(encapsed, $2.Comments()) - $$ = scalar.NewHeredoc($1.Value, []node.Node{encapsed}) + + // save position + yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.StartHeredocToken) } | T_START_HEREDOC T_END_HEREDOC { $$ = scalar.NewHeredoc($1.Value, nil) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.StartHeredocToken) } ; @@ -2936,12 +3992,15 @@ static_class_constant: class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { target := node.NewIdentifier($3.Value) - yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) $$ = expr.NewClassConstFetch($1, target) + + // save position + yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3)) - yylex.(*Parser).comments.AddComments(target, $3.Comments()) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken) + yylex.(*Parser).comments.AddFromToken(target, $3, comment.IdentifierToken) } ; @@ -2958,52 +4017,71 @@ static_scalar_value: | namespace_name { name := name.NewName($1) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1)) - $$ = expr.NewConstFetch(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition(name)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[name]) } | T_NAMESPACE T_NS_SEPARATOR namespace_name { name := name.NewRelative($3) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3)) - yylex.(*Parser).comments.AddComments(name, $1.Comments()) - $$ = expr.NewConstFetch(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[name]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NamespaceToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.NsSeparatorToken) } | T_NS_SEPARATOR namespace_name { name := name.NewFullyQualified($2) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2)) - yylex.(*Parser).comments.AddComments(name, $1.Comments()) - $$ = expr.NewConstFetch(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[name]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken) } | T_ARRAY '(' static_array_pair_list ')' { $$ = expr.NewArray($3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ArrayToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken) } | '[' static_array_pair_list ']' { $$ = expr.NewShortArray($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseSquareBracket) } | static_class_constant { $$ = $1 } | T_CLASS_C { $$ = scalar.NewMagicConstant($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ClassCToken) } | static_operation { $$ = $1 } @@ -3013,197 +4091,334 @@ static_operation: static_scalar_value '[' static_scalar_value ']' { $$ = expr.NewArrayDimFetch($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket) } | static_scalar_value '+' static_scalar_value { $$ = binary.NewPlus($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PlusToken) } | static_scalar_value '-' static_scalar_value { $$ = binary.NewMinus($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.MinusToken) } | static_scalar_value '*' static_scalar_value { $$ = binary.NewMul($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.AsteriskToken) } | static_scalar_value T_POW static_scalar_value { $$ = binary.NewPow($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PowToken) } | static_scalar_value '/' static_scalar_value { $$ = binary.NewDiv($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.SlashToken) } | static_scalar_value '%' static_scalar_value { $$ = binary.NewMod($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PercentToken) } | '!' static_scalar_value { $$ = expr.NewBooleanNot($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ExclamationMarkToken) } | '~' static_scalar_value { $$ = expr.NewBitwiseNot($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.TildeToken) } | static_scalar_value '|' static_scalar_value { $$ = binary.NewBitwiseOr($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.VerticalBarToken) } | static_scalar_value '&' static_scalar_value { $$ = binary.NewBitwiseAnd($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.AmpersandToken) } | static_scalar_value '^' static_scalar_value { $$ = binary.NewBitwiseXor($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.CaretToken) } | static_scalar_value T_SL static_scalar_value { $$ = binary.NewShiftLeft($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.SlToken) } | static_scalar_value T_SR static_scalar_value { $$ = binary.NewShiftRight($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.SrToken) } | static_scalar_value '.' static_scalar_value { $$ = binary.NewConcat($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.DotToken) } | static_scalar_value T_LOGICAL_XOR static_scalar_value { $$ = binary.NewLogicalXor($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.LogicalXorToken) } | static_scalar_value T_LOGICAL_AND static_scalar_value { $$ = binary.NewLogicalAnd($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.LogicalAndToken) } | static_scalar_value T_LOGICAL_OR static_scalar_value { $$ = binary.NewLogicalOr($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.LogicalOrToken) } | static_scalar_value T_BOOLEAN_AND static_scalar_value { $$ = binary.NewBooleanAnd($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.BooleanAndToken) } | static_scalar_value T_BOOLEAN_OR static_scalar_value { $$ = binary.NewBooleanOr($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.BooleanOrToken) } | static_scalar_value T_IS_IDENTICAL static_scalar_value { $$ = binary.NewIdentical($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsIdenticalToken) } | static_scalar_value T_IS_NOT_IDENTICAL static_scalar_value { $$ = binary.NewNotIdentical($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsNotIdenticalToken) } | static_scalar_value T_IS_EQUAL static_scalar_value { $$ = binary.NewEqual($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsEqualToken) } | static_scalar_value T_IS_NOT_EQUAL static_scalar_value { $$ = binary.NewNotEqual($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsNotEqualToken) } | static_scalar_value '<' static_scalar_value { $$ = binary.NewSmaller($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.LessToken) } | static_scalar_value '>' static_scalar_value { $$ = binary.NewGreater($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.GreaterToken) } | static_scalar_value T_IS_SMALLER_OR_EQUAL static_scalar_value { $$ = binary.NewSmallerOrEqual($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsSmallerOrEqualToken) } | static_scalar_value T_IS_GREATER_OR_EQUAL static_scalar_value { $$ = binary.NewGreaterOrEqual($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.IsGreaterOrEqualToken) } | static_scalar_value '?' ':' static_scalar_value { $$ = expr.NewTernary($1, nil, $4) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.QuestionMarkToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.ColonToken) } | static_scalar_value '?' static_scalar_value ':' static_scalar_value { $$ = expr.NewTernary($1, $3, $5) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $5)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.QuestionMarkToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.ColonToken) } | '+' static_scalar_value { $$ = expr.NewUnaryPlus($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.PlusToken) } | '-' static_scalar_value { $$ = expr.NewUnaryMinus($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.MinusToken) } | '(' static_scalar_value ')' - { $$ = $2 } + { + $$ = $2 + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseParenthesisToken) + } ; general_constant: @@ -3212,32 +4427,34 @@ general_constant: | namespace_name { name := name.NewName($1) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) - yylex.(*Parser).comments.AddComments(name, yylex.(*Parser).listGetFirstNodeComments($1)) - $$ = expr.NewConstFetch(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewNodeListPosition($1)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition(name)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[name]) } | T_NAMESPACE T_NS_SEPARATOR namespace_name { name := name.NewRelative($3) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3)) - yylex.(*Parser).comments.AddComments(name, $1.Comments()) - $$ = expr.NewConstFetch(name) + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $3)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition(name)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[name]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NamespaceToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.NsSeparatorToken) } | T_NS_SEPARATOR namespace_name { name := name.NewFullyQualified($2) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2)) - yylex.(*Parser).comments.AddComments(name, $1.Comments()) - $$ = expr.NewConstFetch(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenNodeListPosition($1, $2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition(name)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[name]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NsSeparatorToken) } ; @@ -3245,12 +4462,14 @@ scalar: T_STRING_VARNAME { name := node.NewIdentifier($1.Value) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) $$ = expr.NewVariable(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(name, $1.Comments()) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(name, $1, comment.StringVarnameToken) } | general_constant { $$ = $1 } @@ -3261,20 +4480,32 @@ scalar: | '"' encaps_list '"' { $$ = scalar.NewEncapsed($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.DoubleQuoteToken) } | T_START_HEREDOC encaps_list T_END_HEREDOC { $$ = scalar.NewHeredoc($1.Value, $2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.StartHeredocToken) } | T_CLASS_C { $$ = scalar.NewMagicConstant($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.ClassCToken) } ; @@ -3282,46 +4513,65 @@ static_array_pair_list: /* empty */ { $$ = nil } | non_empty_static_array_pair_list possible_comma - { $$ = $1 } + { + $$ = $1 + + // save comments + if $2 != nil { + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + } + } ; possible_comma: /* empty */ + { $$ = nil } | ',' + { $$ = $1 } ; non_empty_static_array_pair_list: non_empty_static_array_pair_list ',' static_scalar_value T_DOUBLE_ARROW static_scalar_value { arrayItem := expr.NewArrayItem($3, $5) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($3, $5)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$3]) - $$ = append($1, arrayItem) + + // save position + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($3, $5)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(arrayItem, $4, comment.DoubleArrowToken) } | non_empty_static_array_pair_list ',' static_scalar_value { arrayItem := expr.NewArrayItem(nil, $3) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition($3)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$3]) - $$ = append($1, arrayItem) + + // save position + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition($3)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) } | static_scalar_value T_DOUBLE_ARROW static_scalar_value { arrayItem := expr.NewArrayItem($1, $3) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$1]) - $$ = []node.Node{arrayItem} + + // save position + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) + + // save comments + yylex.(*Parser).comments.AddFromToken(arrayItem, $2, comment.DoubleArrowToken) } | static_scalar_value { arrayItem := expr.NewArrayItem(nil, $1) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition($1)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$1]) - $$ = []node.Node{arrayItem} + + // save position + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition($1)) } ; @@ -3366,24 +4616,24 @@ variable: $3 = append($3[:len($3)-1], $4...) } + // save comments + yylex.(*Parser).comments.AddFromToken($3[0], $2, comment.ObjectOperatorToken) + for _, n := range($3) { switch nn := n.(type) { case *expr.ArrayDimFetch: nn.Variable = $$ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1]) $$ = nn case *expr.PropertyFetch: nn.Variable = $$ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1]) $$ = nn case *expr.MethodCall: nn.Variable = $$ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1]) $$ = nn } } @@ -3393,19 +4643,16 @@ variable: case *expr.ArrayDimFetch: nn.Variable = $$ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1]) $$ = nn case *expr.PropertyFetch: nn.Variable = $$ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1]) $$ = nn case *expr.MethodCall: nn.Variable = $$ yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($$, nn)) - yylex.(*Parser).comments.AddComments(nn, yylex.(*Parser).comments[$1]) $$ = nn } } @@ -3431,6 +4678,9 @@ variable_property: } $$ = $2 + + // save comments + yylex.(*Parser).comments.AddFromToken($2[0], $1, comment.ObjectOperatorToken) } ; @@ -3438,16 +4688,26 @@ array_method_dereference: array_method_dereference '[' dim_offset ']' { fetch := expr.NewArrayDimFetch(nil, $3) + $$ = append($1, fetch) + + // save position yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($3)) - $$ = append($1, fetch) + // save comments + yylex.(*Parser).comments.AddFromToken(fetch, $2, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(fetch, $4, comment.CloseSquareBracket) } | method '[' dim_offset ']' { fetch := expr.NewArrayDimFetch(nil, $3) + $$ = []node.Node{$1, fetch} + + // save position yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($3)) - $$ = []node.Node{$1, fetch} + // save comments + yylex.(*Parser).comments.AddFromToken(fetch, $2, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(fetch, $4, comment.CloseSquareBracket) } ; @@ -3455,6 +4715,8 @@ method: function_call_parameter_list { $$ = expr.NewMethodCall(nil, nil, $1.(*node.ArgumentList)) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1)) } ; @@ -3487,14 +4749,22 @@ static_member: class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = expr.NewStaticPropertyFetch($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken) } | variable_class_name T_PAAMAYIM_NEKUDOTAYIM variable_without_objects { $$ = expr.NewStaticPropertyFetch($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken) } ; @@ -3508,14 +4778,24 @@ array_function_dereference: array_function_dereference '[' dim_offset ']' { $$ = expr.NewArrayDimFetch($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket) } | function_call '[' dim_offset ']' { $$ = expr.NewArrayDimFetch($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket) } ; @@ -3547,14 +4827,24 @@ reference_variable: reference_variable '[' dim_offset ']' { $$ = expr.NewArrayDimFetch($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket) } | reference_variable '{' expr '}' { $$ = expr.NewArrayDimFetch($1, $3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseCurlyBracesToken) } | compound_variable { $$ = $1 } @@ -3565,18 +4855,26 @@ compound_variable: T_VARIABLE { name := node.NewIdentifier(strings.TrimLeft($1.Value, "$")) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) $$ = expr.NewVariable(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(name, $1.Comments()) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.VariableToken) } | '$' '{' expr '}' { $$ = expr.NewVariable($3) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.DollarToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseCurlyBracesToken) } ; @@ -3594,9 +4892,10 @@ object_property: | variable_without_objects { fetch := expr.NewPropertyFetch(nil, $1) - yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($1)) - $$ = []node.Node{fetch} + + // save position + yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($1)) } ; @@ -3604,23 +4903,34 @@ object_dim_list: object_dim_list '[' dim_offset ']' { fetch := expr.NewArrayDimFetch(nil, $3) + $$ = append($1, fetch) + + // save position yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($3)) - $$ = append($1, fetch) + // save comments + yylex.(*Parser).comments.AddFromToken(fetch, $2, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken(fetch, $4, comment.CloseSquareBracket) } | object_dim_list '{' expr '}' { fetch := expr.NewArrayDimFetch(nil, $3) + $$ = append($1, fetch) + + // save position yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($3)) - $$ = append($1, fetch) + // save comments + yylex.(*Parser).comments.AddFromToken(fetch, $2, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(fetch, $4, comment.CloseCurlyBracesToken) } | variable_name { fetch := expr.NewPropertyFetch(nil, $1) - yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($1)) - $$ = []node.Node{fetch} + + // save position + yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewNodePosition($1)) } ; @@ -3628,39 +4938,63 @@ variable_name: T_STRING { $$ = node.NewIdentifier($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.StringToken) } | '{' expr '}' - { $$ = $2 } + { + $$ = $2 + + // save position + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken) + } ; simple_indirect_reference: '$' { n := expr.NewVariable(nil) - yylex.(*Parser).positions.AddPosition(n, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(n, $1.Comments()) - $$ = simpleIndirectReference{[]*expr.Variable{n}, n} + + // save position + yylex.(*Parser).positions.AddPosition(n, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + + // save comments + yylex.(*Parser).comments.AddFromToken(n, $1, comment.DollarToken) } | simple_indirect_reference '$' { n := expr.NewVariable(nil) - yylex.(*Parser).positions.AddPosition(n, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) - yylex.(*Parser).comments.AddComments(n, $2.Comments()) $1.last.SetVarName(n) - $1.all = append($1.all, n) $1.last = n $$ = $1 + + // save position + yylex.(*Parser).positions.AddPosition(n, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) + + // save comments + yylex.(*Parser).comments.AddFromToken(n, $2, comment.DollarToken) } ; assignment_list: assignment_list ',' assignment_list_element - { $$ = append($1, $3) } + { + $$ = append($1, $3) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + } | assignment_list_element { if $1 == nil { @@ -3676,18 +5010,23 @@ assignment_list_element: variable { $$ = expr.NewArrayItem(nil, $1) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition($1)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) } | T_LIST '(' assignment_list ')' { item := expr.NewList($3) - yylex.(*Parser).positions.AddPosition(item, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) - yylex.(*Parser).comments.AddComments(item, $1.Comments()) - $$ = expr.NewArrayItem(nil, item) + + // save position + yylex.(*Parser).positions.AddPosition(item, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodePosition(item)) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[item]) + + // save comments + yylex.(*Parser).comments.AddFromToken(item, $1, comment.ListToken) + yylex.(*Parser).comments.AddFromToken(item, $2, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(item, $4, comment.CloseParenthesisToken) } | /* empty */ { $$ = nil } @@ -3698,77 +5037,114 @@ array_pair_list: /* empty */ { $$ = []node.Node{} } | non_empty_array_pair_list possible_comma - { $$ = $1 } + { + $$ = $1 + + // save comments + if $2 != nil { + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + } + } ; non_empty_array_pair_list: non_empty_array_pair_list ',' expr T_DOUBLE_ARROW expr { arrayItem := expr.NewArrayItem($3, $5) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($3, $5)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$3]) - $$ = append($1, arrayItem) + + // save position + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($3, $5)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(arrayItem, $4, comment.DoubleArrowToken) } | non_empty_array_pair_list ',' expr { arrayItem := expr.NewArrayItem(nil, $3) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition($3)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$3]) - $$ = append($1, arrayItem) + + // save position + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition($3)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) } | expr T_DOUBLE_ARROW expr { arrayItem := expr.NewArrayItem($1, $3) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$1]) - $$ = []node.Node{arrayItem} + + // save position + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $3)) + + // save comments + yylex.(*Parser).comments.AddFromToken(arrayItem, $2, comment.DoubleArrowToken) } | expr { arrayItem := expr.NewArrayItem(nil, $1) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition($1)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$1]) - $$ = []node.Node{arrayItem} + + // save position + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodePosition($1)) } | non_empty_array_pair_list ',' expr T_DOUBLE_ARROW '&' w_variable { reference := expr.NewReference($6) arrayItem := expr.NewArrayItem($3, reference) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($3, $6)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$3]) - $$ = append($1, arrayItem) + + // save position + yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokenNodePosition($5, $6)) + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($3, $6)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(arrayItem, $4, comment.DoubleArrowToken) + yylex.(*Parser).comments.AddFromToken(reference, $5, comment.AmpersandToken) } | non_empty_array_pair_list ',' '&' w_variable { reference := expr.NewReference($4) arrayItem := expr.NewArrayItem(nil, reference) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $4)) - yylex.(*Parser).comments.AddComments(arrayItem, $3.Comments()) - $$ = append($1, arrayItem) + + // save position + yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $4)) + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $4)) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + yylex.(*Parser).comments.AddFromToken(reference, $3, comment.AmpersandToken) } | expr T_DOUBLE_ARROW '&' w_variable { reference := expr.NewReference($4) arrayItem := expr.NewArrayItem($1, reference) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4)) - yylex.(*Parser).comments.AddComments(arrayItem, yylex.(*Parser).comments[$1]) - $$ = []node.Node{arrayItem} + + // save position + yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokenNodePosition($3, $4)) + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewNodesPosition($1, $4)) + + // save comments + yylex.(*Parser).comments.AddFromToken(arrayItem, $2, comment.DoubleArrowToken) + yylex.(*Parser).comments.AddFromToken(reference, $3, comment.AmpersandToken) } | '&' w_variable { reference := expr.NewReference($2) arrayItem := expr.NewArrayItem(nil, reference) - yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments(arrayItem, $1.Comments()) - $$ = []node.Node{arrayItem} + + // save position + yylex.(*Parser).positions.AddPosition(reference, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) + yylex.(*Parser).positions.AddPosition(arrayItem, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) + + // save comments + yylex.(*Parser).comments.AddFromToken(reference, $1, comment.AmpersandToken) } ; @@ -3778,18 +5154,26 @@ encaps_list: | encaps_list T_ENCAPSED_AND_WHITESPACE { encapsed := scalar.NewEncapsedStringPart($2.Value) - yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) $$ = append($1, encapsed) - yylex.(*Parser).comments.AddComments(encapsed, $2.Comments()) + + // save position + yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) + + // save comments + yylex.(*Parser).comments.AddFromToken(encapsed, $2, comment.EncapsedAndWhitespaceToken) } | encaps_var { $$ = []node.Node{$1} } | T_ENCAPSED_AND_WHITESPACE encaps_var { encapsed := scalar.NewEncapsedStringPart($1.Value) - yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) $$ = []node.Node{encapsed, $2} - yylex.(*Parser).comments.AddComments(encapsed, $1.Comments()) + + // save position + yylex.(*Parser).positions.AddPosition(encapsed, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + + // save comments + yylex.(*Parser).comments.AddFromToken(encapsed, $1, comment.EncapsedAndWhitespaceToken) } ; @@ -3797,153 +5181,239 @@ encaps_var: T_VARIABLE { name := node.NewIdentifier(strings.TrimLeft($1.Value, "$")) - yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) $$ = expr.NewVariable(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(name, $1.Comments()) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.VariableToken) } | T_VARIABLE '[' encaps_var_offset ']' { identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) $$ = expr.NewArrayDimFetch(variable, $3) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) - yylex.(*Parser).comments.AddComments(identifier, $1.Comments()) - yylex.(*Parser).comments.AddComments(variable, $1.Comments()) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseSquareBracket) } | T_VARIABLE T_OBJECT_OPERATOR T_STRING { identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) fetch := node.NewIdentifier($3.Value) - yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) $$ = expr.NewPropertyFetch(variable, fetch) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + yylex.(*Parser).positions.AddPosition(fetch, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - - yylex.(*Parser).comments.AddComments(identifier, $1.Comments()) - yylex.(*Parser).comments.AddComments(variable, $1.Comments()) - yylex.(*Parser).comments.AddComments(fetch, $3.Comments()) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken(variable, $1, comment.VariableToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.ObjectOperatorToken) + yylex.(*Parser).comments.AddFromToken(fetch, $3, comment.StringToken) } | T_DOLLAR_OPEN_CURLY_BRACES expr '}' { - $$ = $2 + $$ = expr.NewVariable($2) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.DollarOpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken) + } + | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '}' + { + name := node.NewIdentifier($2.Value) + $$ = expr.NewVariable(name) + + // save position + yylex.(*Parser).positions.AddPosition(name, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $3)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.DollarOpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(name, $2, comment.StringVarnameToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.CloseCurlyBracesToken) } | T_DOLLAR_OPEN_CURLY_BRACES T_STRING_VARNAME '[' expr ']' '}' { identifier := node.NewIdentifier($2.Value) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) variable := expr.NewVariable(identifier) - yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) $$ = expr.NewArrayDimFetch(variable, $4) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) + yylex.(*Parser).positions.AddPosition(variable, yylex.(*Parser).positionBuilder.NewTokenPosition($2)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $6)) - - yylex.(*Parser).comments.AddComments(identifier, $2.Comments()) - yylex.(*Parser).comments.AddComments(variable, $1.Comments()) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.DollarOpenCurlyBracesToken) + yylex.(*Parser).comments.AddFromToken(variable, $2, comment.StringVarnameToken) + yylex.(*Parser).comments.AddFromToken($$, $3, comment.OpenSquareBracket) + yylex.(*Parser).comments.AddFromToken($$, $5, comment.CloseSquareBracket) + yylex.(*Parser).comments.AddFromToken($$, $6, comment.CloseCurlyBracesToken) } | T_CURLY_OPEN variable '}' - { $$ = $2; } + { + $$ = $2; + } ; encaps_var_offset: T_STRING { $$ = scalar.NewString($1.Value) + + // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.StringToken) } | T_NUM_STRING { // TODO: add option to handle 64 bit integer if _, err := strconv.Atoi($1.Value); err == nil { $$ = scalar.NewLnumber($1.Value) - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) } else { $$ = scalar.NewString($1.Value) - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) } - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + + // save position + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.NumStringToken) } | T_VARIABLE { identifier := node.NewIdentifier(strings.TrimLeft($1.Value, "$")) - yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) $$ = expr.NewVariable(identifier) + + // save position + yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenPosition($1)) - yylex.(*Parser).comments.AddComments(identifier, $1.Comments()) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.VariableToken) } ; internal_functions_in_yacc: - T_ISSET '(' isset_variables ')' - { - $$ = expr.NewIsset($3) - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) - } + T_ISSET '(' isset_variables ')' + { + $$ = expr.NewIsset($3) + + // save position + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.IssetToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken) + } | T_EMPTY '(' variable ')' - { - $$ = expr.NewEmpty($3) - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) - } - | T_EMPTY '(' expr_without_variable ')' - { - $$ = expr.NewEmpty($3) - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) - } + { + $$ = expr.NewEmpty($3) + + // save position + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.EmptyToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken) + } + | T_EMPTY '(' expr ')' + { + $$ = expr.NewEmpty($3) + + // save position + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.EmptyToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken) + } | T_INCLUDE expr - { - $$ = expr.NewInclude($2) - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) - } + { + $$ = expr.NewInclude($2) + + // save position + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.IncludeToken) + } | T_INCLUDE_ONCE expr - { - $$ = expr.NewIncludeOnce($2) - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) - } + { + $$ = expr.NewIncludeOnce($2) + + // save position + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.IncludeOnceToken) + } | T_EVAL '(' expr ')' - { - $$ = expr.NewEval($3) - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) - } + { + $$ = expr.NewEval($3) + + // save position + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.EvalToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken) + } | T_REQUIRE expr - { - $$ = expr.NewRequire($2) - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) - } + { + $$ = expr.NewRequire($2) + + // save position + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.RequireToken) + } | T_REQUIRE_ONCE expr - { - $$ = expr.NewRequireOnce($2) - yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) - yylex.(*Parser).comments.AddComments($$, $1.Comments()) - } + { + $$ = expr.NewRequireOnce($2) + + // save position + yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokenNodePosition($1, $2)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.RequireOnceToken) + } ; isset_variables: isset_variable { $$ = []node.Node{$1} } | isset_variables ',' isset_variable - { $$ = append($1, $3) } + { + $$ = append($1, $3) + + // save comments + yylex.(*Parser).comments.AddFromToken(lastNode($1), $2, comment.CommaToken) + } ; isset_variable: @@ -3957,22 +5427,26 @@ class_constant: class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { target := node.NewIdentifier($3.Value) - yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) $$ = expr.NewClassConstFetch($1, target) + + // save position + yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3)) - yylex.(*Parser).comments.AddComments(target, $3.Comments()) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken) } | variable_class_name T_PAAMAYIM_NEKUDOTAYIM T_STRING { target := node.NewIdentifier($3.Value) - yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) $$ = expr.NewClassConstFetch($1, target) + + // save position + yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3)) - yylex.(*Parser).comments.AddComments(target, $3.Comments()) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken) } ; @@ -3980,12 +5454,14 @@ static_class_name_scalar: class_name T_PAAMAYIM_NEKUDOTAYIM T_CLASS { target := node.NewIdentifier($3.Value) - yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) $$ = expr.NewClassConstFetch($1, target) + + // save position + yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3)) - yylex.(*Parser).comments.AddComments(target, $3.Comments()) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken) } ; @@ -3993,12 +5469,14 @@ class_name_scalar: class_name T_PAAMAYIM_NEKUDOTAYIM T_CLASS { target := node.NewIdentifier($3.Value) - yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) $$ = expr.NewClassConstFetch($1, target) + + // save position + yylex.(*Parser).positions.AddPosition(target, yylex.(*Parser).positionBuilder.NewTokenPosition($3)) yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewNodeTokenPosition($1, $3)) - yylex.(*Parser).comments.AddComments(target, $3.Comments()) - yylex.(*Parser).comments.AddComments($$, yylex.(*Parser).comments[$1]) + // save comments + yylex.(*Parser).comments.AddFromToken($$, $2, comment.PaamayimNekudotayimToken) } ; diff --git a/php7/parser.go b/php7/parser.go index 7dad2bc..476c794 100644 --- a/php7/parser.go +++ b/php7/parser.go @@ -96,11 +96,6 @@ func (l *Parser) GetPositions() parser.Positions { return l.positions } -func (l *Parser) setCommentsFromChildNode(n node.Node, c node.Node) { - l.comments.AddComments(n, l.comments[c]) - delete(l.comments, c) -} - // helpers func lastNode(nn []node.Node) node.Node { diff --git a/php7/php7.go b/php7/php7.go index 0dba5ce..87a00fb 100644 --- a/php7/php7.go +++ b/php7/php7.go @@ -346,7 +346,7 @@ const yyEofCode = 1 const yyErrCode = 2 const yyInitialStackSize = 16 -//line php7/php7.y:4311 +//line php7/php7.y:4306 //line yacctab:1 var yyExca = [...]int{ @@ -4168,16 +4168,7 @@ yydefault: { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$")) variable := expr.NewVariable(identifier) - - if yyDollar[1].node != nil { - yyVAL.node = node.NewParameter(yyDollar[1].node, variable, nil, yyDollar[2].token != nil, yyDollar[3].token != nil) - } else if yyDollar[2].token != nil { - yyVAL.node = node.NewParameter(yyDollar[1].node, variable, nil, yyDollar[2].token != nil, yyDollar[3].token != nil) - } else if yyDollar[3].token != nil { - yyVAL.node = node.NewParameter(yyDollar[1].node, variable, nil, yyDollar[2].token != nil, yyDollar[3].token != nil) - } else { - yyVAL.node = node.NewParameter(yyDollar[1].node, variable, nil, yyDollar[2].token != nil, yyDollar[3].token != nil) - } + yyVAL.node = node.NewParameter(yyDollar[1].node, variable, nil, yyDollar[2].token != nil, yyDollar[3].token != nil) // save position yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) @@ -4203,19 +4194,11 @@ yydefault: } case 217: yyDollar = yyS[yypt-6 : yypt+1] - //line php7/php7.y:1731 + //line php7/php7.y:1722 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[4].token.Value, "$")) variable := expr.NewVariable(identifier) - if yyDollar[1].node != nil { - yyVAL.node = node.NewParameter(yyDollar[1].node, variable, yyDollar[6].node, yyDollar[2].token != nil, yyDollar[3].token != nil) - } else if yyDollar[2].token != nil { - yyVAL.node = node.NewParameter(yyDollar[1].node, variable, yyDollar[6].node, yyDollar[2].token != nil, yyDollar[3].token != nil) - } else if yyDollar[3].token != nil { - yyVAL.node = node.NewParameter(yyDollar[1].node, variable, yyDollar[6].node, yyDollar[2].token != nil, yyDollar[3].token != nil) - } else { - yyVAL.node = node.NewParameter(yyDollar[1].node, variable, yyDollar[6].node, yyDollar[2].token != nil, yyDollar[3].token != nil) - } + yyVAL.node = node.NewParameter(yyDollar[1].node, variable, yyDollar[6].node, yyDollar[2].token != nil, yyDollar[3].token != nil) // save position yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition(yyDollar[4].token)) @@ -4242,25 +4225,25 @@ yydefault: } case 218: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:1771 + //line php7/php7.y:1754 { yyVAL.node = nil } case 219: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1773 + //line php7/php7.y:1756 { yyVAL.node = yyDollar[1].node } case 220: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1778 + //line php7/php7.y:1761 { yyVAL.node = yyDollar[1].node } case 221: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:1780 + //line php7/php7.y:1763 { yyVAL.node = node.NewNullable(yyDollar[2].node) @@ -4272,7 +4255,7 @@ yydefault: } case 222: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1793 + //line php7/php7.y:1776 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -4284,7 +4267,7 @@ yydefault: } case 223: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1803 + //line php7/php7.y:1786 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -4296,19 +4279,19 @@ yydefault: } case 224: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1813 + //line php7/php7.y:1796 { yyVAL.node = yyDollar[1].node } case 225: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:1818 + //line php7/php7.y:1801 { yyVAL.node = nil } case 226: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:1820 + //line php7/php7.y:1803 { yyVAL.node = yyDollar[2].node @@ -4317,31 +4300,42 @@ yydefault: } case 227: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:1830 + //line php7/php7.y:1813 { yyVAL.node = node.NewArgumentList(nil) // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[2].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[2].token, comment.CloseParenthesisToken) } case 228: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:1837 + //line php7/php7.y:1824 { yyVAL.node = node.NewArgumentList(yyDollar[2].list) // save position yylex.(*Parser).positions.AddPosition(yyVAL.node, yylex.(*Parser).positionBuilder.NewTokensPosition(yyDollar[1].token, yyDollar[4].token)) + + // save comments + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[1].token, comment.OpenParenthesisToken) + if yyDollar[3].token != nil { + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[3].token, comment.CommaToken) + } + yylex.(*Parser).comments.AddFromToken(yyVAL.node, yyDollar[4].token, comment.CloseParenthesisToken) } case 229: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1847 + //line php7/php7.y:1841 { yyVAL.list = []node.Node{yyDollar[1].node} } case 230: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1849 + //line php7/php7.y:1843 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4350,7 +4344,7 @@ yydefault: } case 231: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1859 + //line php7/php7.y:1853 { yyVAL.node = node.NewArgument(yyDollar[1].node, false, false) @@ -4359,7 +4353,7 @@ yydefault: } case 232: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:1866 + //line php7/php7.y:1860 { yyVAL.node = node.NewArgument(yyDollar[2].node, true, false) @@ -4371,7 +4365,7 @@ yydefault: } case 233: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1879 + //line php7/php7.y:1873 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4380,19 +4374,19 @@ yydefault: } case 234: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1886 + //line php7/php7.y:1880 { yyVAL.list = []node.Node{yyDollar[1].node} } case 235: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1891 + //line php7/php7.y:1885 { yyVAL.node = yyDollar[1].node } case 236: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1896 + //line php7/php7.y:1890 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4401,13 +4395,13 @@ yydefault: } case 237: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1903 + //line php7/php7.y:1897 { yyVAL.list = []node.Node{yyDollar[1].node} } case 238: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:1908 + //line php7/php7.y:1902 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) variable := expr.NewVariable(identifier) @@ -4423,7 +4417,7 @@ yydefault: } case 239: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1922 + //line php7/php7.y:1916 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) variable := expr.NewVariable(identifier) @@ -4440,19 +4434,19 @@ yydefault: } case 240: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:1940 + //line php7/php7.y:1934 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 241: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:1942 + //line php7/php7.y:1936 { yyVAL.list = []node.Node{} } case 242: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1947 + //line php7/php7.y:1941 { yyVAL.node = stmt.NewPropertyList(yyDollar[1].list, yyDollar[2].list) @@ -4464,7 +4458,7 @@ yydefault: } case 243: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:1957 + //line php7/php7.y:1951 { yyVAL.node = stmt.NewClassConstList(yyDollar[1].list, yyDollar[3].list) @@ -4477,7 +4471,7 @@ yydefault: } case 244: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:1968 + //line php7/php7.y:1962 { var adaptationList *stmt.TraitAdaptationList @@ -4499,7 +4493,7 @@ yydefault: } case 245: yyDollar = yyS[yypt-10 : yypt+1] - //line php7/php7.y:1988 + //line php7/php7.y:1982 { name := node.NewIdentifier(yyDollar[4].token.Value) yyVAL.node = stmt.NewClassMethod(name, yyDollar[1].list, yyDollar[3].token != nil, yyDollar[7].list, yyDollar[9].node, yyDollar[10].node, yyDollar[5].str) @@ -4523,13 +4517,13 @@ yydefault: } case 246: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2013 + //line php7/php7.y:2007 { yyVAL.list = []node.Node{yyDollar[1].node} } case 247: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2015 + //line php7/php7.y:2009 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4538,7 +4532,7 @@ yydefault: } case 248: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2025 + //line php7/php7.y:2019 { yyVAL.node = stmt.NewNop() @@ -4550,7 +4544,7 @@ yydefault: } case 249: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2035 + //line php7/php7.y:2029 { yyVAL.node = stmt.NewTraitAdaptationList(nil) @@ -4562,7 +4556,7 @@ yydefault: } case 250: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2045 + //line php7/php7.y:2039 { yyVAL.node = stmt.NewTraitAdaptationList(yyDollar[2].list) @@ -4574,19 +4568,19 @@ yydefault: } case 251: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2058 + //line php7/php7.y:2052 { yyVAL.list = []node.Node{yyDollar[1].node} } case 252: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2060 + //line php7/php7.y:2054 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 253: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2065 + //line php7/php7.y:2059 { yyVAL.node = yyDollar[1].node @@ -4595,7 +4589,7 @@ yydefault: } case 254: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2072 + //line php7/php7.y:2066 { yyVAL.node = yyDollar[1].node @@ -4604,7 +4598,7 @@ yydefault: } case 255: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2082 + //line php7/php7.y:2076 { yyVAL.node = stmt.NewTraitUsePrecedence(yyDollar[1].node, yyDollar[3].list) @@ -4616,7 +4610,7 @@ yydefault: } case 256: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2095 + //line php7/php7.y:2089 { alias := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, nil, alias) @@ -4631,7 +4625,7 @@ yydefault: } case 257: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2108 + //line php7/php7.y:2102 { alias := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, nil, alias) @@ -4646,7 +4640,7 @@ yydefault: } case 258: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:2121 + //line php7/php7.y:2115 { alias := node.NewIdentifier(yyDollar[4].token.Value) yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, yyDollar[3].node, alias) @@ -4661,7 +4655,7 @@ yydefault: } case 259: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2134 + //line php7/php7.y:2128 { yyVAL.node = stmt.NewTraitUseAlias(yyDollar[1].node, yyDollar[3].node, nil) @@ -4673,7 +4667,7 @@ yydefault: } case 260: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2147 + //line php7/php7.y:2141 { name := node.NewIdentifier(yyDollar[1].token.Value) yyVAL.node = stmt.NewTraitMethodRef(nil, name) @@ -4687,13 +4681,13 @@ yydefault: } case 261: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2159 + //line php7/php7.y:2153 { yyVAL.node = yyDollar[1].node } case 262: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2164 + //line php7/php7.y:2158 { target := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = stmt.NewTraitMethodRef(yyDollar[1].node, target) @@ -4708,7 +4702,7 @@ yydefault: } case 263: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2180 + //line php7/php7.y:2174 { yyVAL.node = stmt.NewNop() @@ -4720,7 +4714,7 @@ yydefault: } case 264: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2190 + //line php7/php7.y:2184 { yyVAL.node = stmt.NewStmtList(yyDollar[2].list) @@ -4733,13 +4727,13 @@ yydefault: } case 265: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2204 + //line php7/php7.y:2198 { yyVAL.list = yyDollar[1].list } case 266: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2206 + //line php7/php7.y:2200 { modifier := node.NewIdentifier(yyDollar[1].token.Value) yyVAL.list = []node.Node{modifier} @@ -4752,31 +4746,31 @@ yydefault: } case 267: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:2220 + //line php7/php7.y:2214 { yyVAL.list = nil } case 268: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2222 + //line php7/php7.y:2216 { yyVAL.list = yyDollar[1].list } case 269: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2227 + //line php7/php7.y:2221 { yyVAL.list = []node.Node{yyDollar[1].node} } case 270: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2229 + //line php7/php7.y:2223 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 271: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2234 + //line php7/php7.y:2228 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -4788,7 +4782,7 @@ yydefault: } case 272: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2244 + //line php7/php7.y:2238 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -4800,7 +4794,7 @@ yydefault: } case 273: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2254 + //line php7/php7.y:2248 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -4812,7 +4806,7 @@ yydefault: } case 274: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2264 + //line php7/php7.y:2258 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -4824,7 +4818,7 @@ yydefault: } case 275: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2274 + //line php7/php7.y:2268 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -4836,7 +4830,7 @@ yydefault: } case 276: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2284 + //line php7/php7.y:2278 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -4848,7 +4842,7 @@ yydefault: } case 277: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2297 + //line php7/php7.y:2291 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4857,13 +4851,13 @@ yydefault: } case 278: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2304 + //line php7/php7.y:2298 { yyVAL.list = []node.Node{yyDollar[1].node} } case 279: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2309 + //line php7/php7.y:2303 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) variable := expr.NewVariable(identifier) @@ -4879,7 +4873,7 @@ yydefault: } case 280: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:2323 + //line php7/php7.y:2317 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) variable := expr.NewVariable(identifier) @@ -4896,7 +4890,7 @@ yydefault: } case 281: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2341 + //line php7/php7.y:2335 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4905,13 +4899,13 @@ yydefault: } case 282: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2348 + //line php7/php7.y:2342 { yyVAL.list = []node.Node{yyDollar[1].node} } case 283: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:2353 + //line php7/php7.y:2347 { name := node.NewIdentifier(yyDollar[1].token.Value) yyVAL.node = stmt.NewConstant(name, yyDollar[3].node, yyDollar[4].str) @@ -4926,7 +4920,7 @@ yydefault: } case 284: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:2369 + //line php7/php7.y:2363 { name := node.NewIdentifier(yyDollar[1].token.Value) yyVAL.node = stmt.NewConstant(name, yyDollar[3].node, yyDollar[4].str) @@ -4941,7 +4935,7 @@ yydefault: } case 285: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2385 + //line php7/php7.y:2379 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4950,31 +4944,31 @@ yydefault: } case 286: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2392 + //line php7/php7.y:2386 { yyVAL.list = []node.Node{yyDollar[1].node} } case 287: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2397 + //line php7/php7.y:2391 { yyVAL.node = yyDollar[1].node } case 288: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:2402 + //line php7/php7.y:2396 { yyVAL.list = nil } case 289: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2404 + //line php7/php7.y:2398 { yyVAL.list = yyDollar[1].list } case 290: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2409 + //line php7/php7.y:2403 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -4983,13 +4977,13 @@ yydefault: } case 291: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:2416 + //line php7/php7.y:2410 { yyVAL.list = []node.Node{yyDollar[1].node} } case 292: yyDollar = yyS[yypt-8 : yypt+1] - //line php7/php7.y:2421 + //line php7/php7.y:2415 { if yyDollar[2].node != nil { yyVAL.node = stmt.NewClass(nil, nil, yyDollar[2].node.(*node.ArgumentList), yyDollar[3].ClassExtends, yyDollar[4].ClassImplements, yyDollar[7].list, yyDollar[5].str) @@ -5007,7 +5001,7 @@ yydefault: } case 293: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2440 + //line php7/php7.y:2434 { if yyDollar[3].node != nil { yyVAL.node = expr.NewNew(yyDollar[2].node, yyDollar[3].node.(*node.ArgumentList)) @@ -5022,7 +5016,7 @@ yydefault: } case 294: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2453 + //line php7/php7.y:2447 { yyVAL.node = expr.NewNew(yyDollar[2].node, nil) @@ -5034,7 +5028,7 @@ yydefault: } case 295: yyDollar = yyS[yypt-6 : yypt+1] - //line php7/php7.y:2466 + //line php7/php7.y:2460 { list := expr.NewList(yyDollar[3].list) yyVAL.node = assign.NewAssign(list, yyDollar[6].node) @@ -5051,7 +5045,7 @@ yydefault: } case 296: yyDollar = yyS[yypt-5 : yypt+1] - //line php7/php7.y:2481 + //line php7/php7.y:2475 { shortList := expr.NewShortList(yyDollar[2].list) yyVAL.node = assign.NewAssign(shortList, yyDollar[5].node) @@ -5067,7 +5061,7 @@ yydefault: } case 297: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2495 + //line php7/php7.y:2489 { yyVAL.node = assign.NewAssign(yyDollar[1].node, yyDollar[3].node) @@ -5079,7 +5073,7 @@ yydefault: } case 298: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:2505 + //line php7/php7.y:2499 { yyVAL.node = assign.NewReference(yyDollar[1].node, yyDollar[4].node) @@ -5092,7 +5086,7 @@ yydefault: } case 299: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2516 + //line php7/php7.y:2510 { yyVAL.node = expr.NewClone(yyDollar[2].node) @@ -5104,7 +5098,7 @@ yydefault: } case 300: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2526 + //line php7/php7.y:2520 { yyVAL.node = assign.NewPlus(yyDollar[1].node, yyDollar[3].node) @@ -5116,7 +5110,7 @@ yydefault: } case 301: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2536 + //line php7/php7.y:2530 { yyVAL.node = assign.NewMinus(yyDollar[1].node, yyDollar[3].node) @@ -5128,7 +5122,7 @@ yydefault: } case 302: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2546 + //line php7/php7.y:2540 { yyVAL.node = assign.NewMul(yyDollar[1].node, yyDollar[3].node) @@ -5140,7 +5134,7 @@ yydefault: } case 303: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2556 + //line php7/php7.y:2550 { yyVAL.node = assign.NewPow(yyDollar[1].node, yyDollar[3].node) @@ -5152,7 +5146,7 @@ yydefault: } case 304: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2566 + //line php7/php7.y:2560 { yyVAL.node = assign.NewDiv(yyDollar[1].node, yyDollar[3].node) @@ -5164,7 +5158,7 @@ yydefault: } case 305: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2576 + //line php7/php7.y:2570 { yyVAL.node = assign.NewConcat(yyDollar[1].node, yyDollar[3].node) @@ -5176,7 +5170,7 @@ yydefault: } case 306: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2586 + //line php7/php7.y:2580 { yyVAL.node = assign.NewMod(yyDollar[1].node, yyDollar[3].node) @@ -5188,7 +5182,7 @@ yydefault: } case 307: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2596 + //line php7/php7.y:2590 { yyVAL.node = assign.NewBitwiseAnd(yyDollar[1].node, yyDollar[3].node) @@ -5200,7 +5194,7 @@ yydefault: } case 308: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2606 + //line php7/php7.y:2600 { yyVAL.node = assign.NewBitwiseOr(yyDollar[1].node, yyDollar[3].node) @@ -5212,7 +5206,7 @@ yydefault: } case 309: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2616 + //line php7/php7.y:2610 { yyVAL.node = assign.NewBitwiseXor(yyDollar[1].node, yyDollar[3].node) @@ -5224,7 +5218,7 @@ yydefault: } case 310: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2626 + //line php7/php7.y:2620 { yyVAL.node = assign.NewShiftLeft(yyDollar[1].node, yyDollar[3].node) @@ -5236,7 +5230,7 @@ yydefault: } case 311: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2636 + //line php7/php7.y:2630 { yyVAL.node = assign.NewShiftRight(yyDollar[1].node, yyDollar[3].node) @@ -5248,7 +5242,7 @@ yydefault: } case 312: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2646 + //line php7/php7.y:2640 { yyVAL.node = expr.NewPostInc(yyDollar[1].node) @@ -5260,7 +5254,7 @@ yydefault: } case 313: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2656 + //line php7/php7.y:2650 { yyVAL.node = expr.NewPreInc(yyDollar[2].node) @@ -5272,7 +5266,7 @@ yydefault: } case 314: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2666 + //line php7/php7.y:2660 { yyVAL.node = expr.NewPostDec(yyDollar[1].node) @@ -5284,7 +5278,7 @@ yydefault: } case 315: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2676 + //line php7/php7.y:2670 { yyVAL.node = expr.NewPreDec(yyDollar[2].node) @@ -5296,7 +5290,7 @@ yydefault: } case 316: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2686 + //line php7/php7.y:2680 { yyVAL.node = binary.NewBooleanOr(yyDollar[1].node, yyDollar[3].node) @@ -5308,7 +5302,7 @@ yydefault: } case 317: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2696 + //line php7/php7.y:2690 { yyVAL.node = binary.NewBooleanAnd(yyDollar[1].node, yyDollar[3].node) @@ -5320,7 +5314,7 @@ yydefault: } case 318: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2706 + //line php7/php7.y:2700 { yyVAL.node = binary.NewLogicalOr(yyDollar[1].node, yyDollar[3].node) @@ -5332,7 +5326,7 @@ yydefault: } case 319: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2716 + //line php7/php7.y:2710 { yyVAL.node = binary.NewLogicalAnd(yyDollar[1].node, yyDollar[3].node) @@ -5344,7 +5338,7 @@ yydefault: } case 320: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2726 + //line php7/php7.y:2720 { yyVAL.node = binary.NewLogicalXor(yyDollar[1].node, yyDollar[3].node) @@ -5356,7 +5350,7 @@ yydefault: } case 321: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2736 + //line php7/php7.y:2730 { yyVAL.node = binary.NewBitwiseOr(yyDollar[1].node, yyDollar[3].node) @@ -5368,7 +5362,7 @@ yydefault: } case 322: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2746 + //line php7/php7.y:2740 { yyVAL.node = binary.NewBitwiseAnd(yyDollar[1].node, yyDollar[3].node) @@ -5380,7 +5374,7 @@ yydefault: } case 323: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2756 + //line php7/php7.y:2750 { yyVAL.node = binary.NewBitwiseXor(yyDollar[1].node, yyDollar[3].node) @@ -5392,7 +5386,7 @@ yydefault: } case 324: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2766 + //line php7/php7.y:2760 { yyVAL.node = binary.NewConcat(yyDollar[1].node, yyDollar[3].node) @@ -5404,7 +5398,7 @@ yydefault: } case 325: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2776 + //line php7/php7.y:2770 { yyVAL.node = binary.NewPlus(yyDollar[1].node, yyDollar[3].node) @@ -5416,7 +5410,7 @@ yydefault: } case 326: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2786 + //line php7/php7.y:2780 { yyVAL.node = binary.NewMinus(yyDollar[1].node, yyDollar[3].node) @@ -5428,7 +5422,7 @@ yydefault: } case 327: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2796 + //line php7/php7.y:2790 { yyVAL.node = binary.NewMul(yyDollar[1].node, yyDollar[3].node) @@ -5440,7 +5434,7 @@ yydefault: } case 328: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2806 + //line php7/php7.y:2800 { yyVAL.node = binary.NewPow(yyDollar[1].node, yyDollar[3].node) @@ -5452,7 +5446,7 @@ yydefault: } case 329: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2816 + //line php7/php7.y:2810 { yyVAL.node = binary.NewDiv(yyDollar[1].node, yyDollar[3].node) @@ -5464,7 +5458,7 @@ yydefault: } case 330: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2826 + //line php7/php7.y:2820 { yyVAL.node = binary.NewMod(yyDollar[1].node, yyDollar[3].node) @@ -5476,7 +5470,7 @@ yydefault: } case 331: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2836 + //line php7/php7.y:2830 { yyVAL.node = binary.NewShiftLeft(yyDollar[1].node, yyDollar[3].node) @@ -5488,7 +5482,7 @@ yydefault: } case 332: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2846 + //line php7/php7.y:2840 { yyVAL.node = binary.NewShiftRight(yyDollar[1].node, yyDollar[3].node) @@ -5500,7 +5494,7 @@ yydefault: } case 333: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2856 + //line php7/php7.y:2850 { yyVAL.node = expr.NewUnaryPlus(yyDollar[2].node) @@ -5512,7 +5506,7 @@ yydefault: } case 334: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2866 + //line php7/php7.y:2860 { yyVAL.node = expr.NewUnaryMinus(yyDollar[2].node) @@ -5524,7 +5518,7 @@ yydefault: } case 335: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2876 + //line php7/php7.y:2870 { yyVAL.node = expr.NewBooleanNot(yyDollar[2].node) @@ -5536,7 +5530,7 @@ yydefault: } case 336: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:2886 + //line php7/php7.y:2880 { yyVAL.node = expr.NewBitwiseNot(yyDollar[2].node) @@ -5548,7 +5542,7 @@ yydefault: } case 337: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2896 + //line php7/php7.y:2890 { yyVAL.node = binary.NewIdentical(yyDollar[1].node, yyDollar[3].node) @@ -5560,7 +5554,7 @@ yydefault: } case 338: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2906 + //line php7/php7.y:2900 { yyVAL.node = binary.NewNotIdentical(yyDollar[1].node, yyDollar[3].node) @@ -5572,7 +5566,7 @@ yydefault: } case 339: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2916 + //line php7/php7.y:2910 { yyVAL.node = binary.NewEqual(yyDollar[1].node, yyDollar[3].node) @@ -5584,7 +5578,7 @@ yydefault: } case 340: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2926 + //line php7/php7.y:2920 { yyVAL.node = binary.NewNotEqual(yyDollar[1].node, yyDollar[3].node) @@ -5596,7 +5590,7 @@ yydefault: } case 341: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2936 + //line php7/php7.y:2930 { yyVAL.node = binary.NewSmaller(yyDollar[1].node, yyDollar[3].node) @@ -5608,7 +5602,7 @@ yydefault: } case 342: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2946 + //line php7/php7.y:2940 { yyVAL.node = binary.NewSmallerOrEqual(yyDollar[1].node, yyDollar[3].node) @@ -5620,7 +5614,7 @@ yydefault: } case 343: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2956 + //line php7/php7.y:2950 { yyVAL.node = binary.NewGreater(yyDollar[1].node, yyDollar[3].node) @@ -5632,7 +5626,7 @@ yydefault: } case 344: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2966 + //line php7/php7.y:2960 { yyVAL.node = binary.NewGreaterOrEqual(yyDollar[1].node, yyDollar[3].node) @@ -5644,7 +5638,7 @@ yydefault: } case 345: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2976 + //line php7/php7.y:2970 { yyVAL.node = binary.NewSpaceship(yyDollar[1].node, yyDollar[3].node) @@ -5656,7 +5650,7 @@ yydefault: } case 346: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2986 + //line php7/php7.y:2980 { yyVAL.node = expr.NewInstanceOf(yyDollar[1].node, yyDollar[3].node) @@ -5668,7 +5662,7 @@ yydefault: } case 347: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:2996 + //line php7/php7.y:2990 { yyVAL.node = yyDollar[2].node @@ -5678,13 +5672,13 @@ yydefault: } case 348: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3004 + //line php7/php7.y:2998 { yyVAL.node = yyDollar[1].node } case 349: yyDollar = yyS[yypt-5 : yypt+1] - //line php7/php7.y:3006 + //line php7/php7.y:3000 { yyVAL.node = expr.NewTernary(yyDollar[1].node, yyDollar[3].node, yyDollar[5].node) @@ -5697,7 +5691,7 @@ yydefault: } case 350: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:3017 + //line php7/php7.y:3011 { yyVAL.node = expr.NewTernary(yyDollar[1].node, nil, yyDollar[4].node) @@ -5710,7 +5704,7 @@ yydefault: } case 351: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3028 + //line php7/php7.y:3022 { yyVAL.node = binary.NewCoalesce(yyDollar[1].node, yyDollar[3].node) @@ -5722,13 +5716,13 @@ yydefault: } case 352: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3038 + //line php7/php7.y:3032 { yyVAL.node = yyDollar[1].node } case 353: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3040 + //line php7/php7.y:3034 { yyVAL.node = cast.NewInt(yyDollar[2].node) @@ -5740,7 +5734,7 @@ yydefault: } case 354: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3050 + //line php7/php7.y:3044 { yyVAL.node = cast.NewDouble(yyDollar[2].node) @@ -5752,7 +5746,7 @@ yydefault: } case 355: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3060 + //line php7/php7.y:3054 { yyVAL.node = cast.NewString(yyDollar[2].node) @@ -5764,7 +5758,7 @@ yydefault: } case 356: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3070 + //line php7/php7.y:3064 { yyVAL.node = cast.NewArray(yyDollar[2].node) @@ -5776,7 +5770,7 @@ yydefault: } case 357: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3080 + //line php7/php7.y:3074 { yyVAL.node = cast.NewObject(yyDollar[2].node) @@ -5788,7 +5782,7 @@ yydefault: } case 358: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3090 + //line php7/php7.y:3084 { yyVAL.node = cast.NewBool(yyDollar[2].node) @@ -5800,7 +5794,7 @@ yydefault: } case 359: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3100 + //line php7/php7.y:3094 { yyVAL.node = cast.NewUnset(yyDollar[2].node) @@ -5812,7 +5806,7 @@ yydefault: } case 360: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3110 + //line php7/php7.y:3104 { if strings.EqualFold(yyDollar[1].token.Value, "die") { yyVAL.node = expr.NewDie(nil) @@ -5842,7 +5836,7 @@ yydefault: } case 361: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3138 + //line php7/php7.y:3132 { yyVAL.node = expr.NewErrorSuppress(yyDollar[2].node) @@ -5854,13 +5848,13 @@ yydefault: } case 362: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3148 + //line php7/php7.y:3142 { yyVAL.node = yyDollar[1].node } case 363: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3150 + //line php7/php7.y:3144 { yyVAL.node = expr.NewShellExec(yyDollar[2].list) @@ -5873,7 +5867,7 @@ yydefault: } case 364: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3161 + //line php7/php7.y:3155 { yyVAL.node = expr.NewPrint(yyDollar[2].node) @@ -5885,7 +5879,7 @@ yydefault: } case 365: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3171 + //line php7/php7.y:3165 { yyVAL.node = expr.NewYield(nil, nil) @@ -5897,7 +5891,7 @@ yydefault: } case 366: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3181 + //line php7/php7.y:3175 { yyVAL.node = expr.NewYield(nil, yyDollar[2].node) @@ -5909,7 +5903,7 @@ yydefault: } case 367: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:3191 + //line php7/php7.y:3185 { yyVAL.node = expr.NewYield(yyDollar[2].node, yyDollar[4].node) @@ -5922,7 +5916,7 @@ yydefault: } case 368: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3202 + //line php7/php7.y:3196 { yyVAL.node = expr.NewYieldFrom(yyDollar[2].node) @@ -5934,7 +5928,7 @@ yydefault: } case 369: yyDollar = yyS[yypt-11 : yypt+1] - //line php7/php7.y:3212 + //line php7/php7.y:3206 { yyVAL.node = expr.NewClosure(yyDollar[5].list, yyDollar[7].ClosureUse, yyDollar[8].node, yyDollar[10].list, false, yyDollar[2].token != nil, yyDollar[3].str) @@ -5953,7 +5947,7 @@ yydefault: } case 370: yyDollar = yyS[yypt-12 : yypt+1] - //line php7/php7.y:3229 + //line php7/php7.y:3223 { yyVAL.node = expr.NewClosure(yyDollar[6].list, yyDollar[8].ClosureUse, yyDollar[9].node, yyDollar[11].list, true, yyDollar[3].token != nil, yyDollar[4].str) @@ -5973,32 +5967,32 @@ yydefault: } case 371: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:3250 + //line php7/php7.y:3244 { yyVAL.str = yylex.(*Parser).PhpDocComment yylex.(*Parser).PhpDocComment = "" } case 372: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:3258 + //line php7/php7.y:3252 { yyVAL.token = nil } case 373: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3260 + //line php7/php7.y:3254 { yyVAL.token = yyDollar[1].token } case 374: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:3265 + //line php7/php7.y:3259 { yyVAL.ClosureUse = nil } case 375: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:3267 + //line php7/php7.y:3261 { yyVAL.ClosureUse = expr.NewClosureUse(yyDollar[3].list) @@ -6012,7 +6006,7 @@ yydefault: } case 376: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3282 + //line php7/php7.y:3276 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -6021,13 +6015,13 @@ yydefault: } case 377: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3289 + //line php7/php7.y:3283 { yyVAL.list = []node.Node{yyDollar[1].node} } case 378: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3294 + //line php7/php7.y:3288 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) yyVAL.node = expr.NewVariable(identifier) @@ -6041,7 +6035,7 @@ yydefault: } case 379: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3306 + //line php7/php7.y:3300 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[2].token.Value, "$")) variable := expr.NewVariable(identifier) @@ -6058,7 +6052,7 @@ yydefault: } case 380: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3324 + //line php7/php7.y:3318 { yyVAL.node = expr.NewFunctionCall(yyDollar[1].node, yyDollar[2].node.(*node.ArgumentList)) @@ -6067,7 +6061,7 @@ yydefault: } case 381: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:3331 + //line php7/php7.y:3325 { yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList)) @@ -6079,7 +6073,7 @@ yydefault: } case 382: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:3341 + //line php7/php7.y:3335 { yyVAL.node = expr.NewStaticCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList)) @@ -6091,7 +6085,7 @@ yydefault: } case 383: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3351 + //line php7/php7.y:3345 { yyVAL.node = expr.NewFunctionCall(yyDollar[1].node, yyDollar[2].node.(*node.ArgumentList)) @@ -6100,7 +6094,7 @@ yydefault: } case 384: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3361 + //line php7/php7.y:3355 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -6112,31 +6106,31 @@ yydefault: } case 385: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3371 + //line php7/php7.y:3365 { yyVAL.node = yyDollar[1].node } case 386: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3376 + //line php7/php7.y:3370 { yyVAL.node = yyDollar[1].node } case 387: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3378 + //line php7/php7.y:3372 { yyVAL.node = yyDollar[1].node } case 388: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:3383 + //line php7/php7.y:3377 { yyVAL.node = nil } case 389: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3385 + //line php7/php7.y:3379 { yyVAL.node = expr.NewExit(yyDollar[2].node) @@ -6149,37 +6143,37 @@ yydefault: } case 390: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:3399 + //line php7/php7.y:3393 { yyVAL.list = []node.Node{} } case 391: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3401 + //line php7/php7.y:3395 { yyVAL.list = []node.Node{scalar.NewEncapsedStringPart(yyDollar[1].token.Value)} } case 392: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3403 + //line php7/php7.y:3397 { yyVAL.list = yyDollar[1].list } case 393: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:3408 + //line php7/php7.y:3402 { yyVAL.node = nil } case 394: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3410 + //line php7/php7.y:3404 { yyVAL.node = yyDollar[1].node } case 395: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:3415 + //line php7/php7.y:3409 { yyVAL.node = expr.NewArray(yyDollar[3].list) @@ -6193,7 +6187,7 @@ yydefault: } case 396: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3427 + //line php7/php7.y:3421 { yyVAL.node = expr.NewShortArray(yyDollar[2].list) @@ -6206,7 +6200,7 @@ yydefault: } case 397: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3438 + //line php7/php7.y:3432 { yyVAL.node = scalar.NewString(yyDollar[1].token.Value) @@ -6218,7 +6212,7 @@ yydefault: } case 398: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3451 + //line php7/php7.y:3445 { yyVAL.node = scalar.NewLnumber(yyDollar[1].token.Value) @@ -6230,7 +6224,7 @@ yydefault: } case 399: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3461 + //line php7/php7.y:3455 { yyVAL.node = scalar.NewDnumber(yyDollar[1].token.Value) @@ -6242,7 +6236,7 @@ yydefault: } case 400: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3471 + //line php7/php7.y:3465 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -6254,7 +6248,7 @@ yydefault: } case 401: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3481 + //line php7/php7.y:3475 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -6266,7 +6260,7 @@ yydefault: } case 402: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3491 + //line php7/php7.y:3485 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -6278,7 +6272,7 @@ yydefault: } case 403: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3501 + //line php7/php7.y:3495 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -6290,7 +6284,7 @@ yydefault: } case 404: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3511 + //line php7/php7.y:3505 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -6302,7 +6296,7 @@ yydefault: } case 405: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3521 + //line php7/php7.y:3515 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -6314,7 +6308,7 @@ yydefault: } case 406: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3531 + //line php7/php7.y:3525 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -6326,7 +6320,7 @@ yydefault: } case 407: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3541 + //line php7/php7.y:3535 { yyVAL.node = scalar.NewMagicConstant(yyDollar[1].token.Value) @@ -6338,7 +6332,7 @@ yydefault: } case 408: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3551 + //line php7/php7.y:3545 { encapsed := scalar.NewEncapsedStringPart(yyDollar[2].token.Value) yyVAL.node = scalar.NewHeredoc(yyDollar[1].token.Value, []node.Node{encapsed}) @@ -6352,7 +6346,7 @@ yydefault: } case 409: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3563 + //line php7/php7.y:3557 { yyVAL.node = scalar.NewHeredoc(yyDollar[1].token.Value, nil) @@ -6364,7 +6358,7 @@ yydefault: } case 410: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3573 + //line php7/php7.y:3567 { yyVAL.node = scalar.NewEncapsed(yyDollar[2].list) @@ -6376,7 +6370,7 @@ yydefault: } case 411: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3583 + //line php7/php7.y:3577 { yyVAL.node = scalar.NewHeredoc(yyDollar[1].token.Value, yyDollar[2].list) @@ -6388,19 +6382,19 @@ yydefault: } case 412: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3593 + //line php7/php7.y:3587 { yyVAL.node = yyDollar[1].node } case 413: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3595 + //line php7/php7.y:3589 { yyVAL.node = yyDollar[1].node } case 414: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3600 + //line php7/php7.y:3594 { yyVAL.node = expr.NewConstFetch(yyDollar[1].node) @@ -6409,7 +6403,7 @@ yydefault: } case 415: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3607 + //line php7/php7.y:3601 { target := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target) @@ -6424,7 +6418,7 @@ yydefault: } case 416: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3620 + //line php7/php7.y:3614 { target := node.NewIdentifier(yyDollar[3].token.Value) yyVAL.node = expr.NewClassConstFetch(yyDollar[1].node, target) @@ -6439,43 +6433,43 @@ yydefault: } case 417: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3636 + //line php7/php7.y:3630 { yyVAL.node = yyDollar[1].node } case 418: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3638 + //line php7/php7.y:3632 { yyVAL.node = yyDollar[1].node } case 419: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:3643 + //line php7/php7.y:3637 { yyVAL.node = nil } case 420: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3645 + //line php7/php7.y:3639 { yyVAL.node = yyDollar[1].node } case 421: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3650 + //line php7/php7.y:3644 { yyVAL.node = yyDollar[1].node } case 422: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3655 + //line php7/php7.y:3649 { yyVAL.node = yyDollar[1].node } case 423: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3657 + //line php7/php7.y:3651 { yyVAL.node = yyDollar[2].node @@ -6485,19 +6479,19 @@ yydefault: } case 424: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3665 + //line php7/php7.y:3659 { yyVAL.node = yyDollar[1].node } case 425: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3670 + //line php7/php7.y:3664 { yyVAL.node = yyDollar[1].node } case 426: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3672 + //line php7/php7.y:3666 { yyVAL.node = yyDollar[2].node @@ -6507,19 +6501,19 @@ yydefault: } case 427: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3680 + //line php7/php7.y:3674 { yyVAL.node = yyDollar[1].node } case 428: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3685 + //line php7/php7.y:3679 { yyVAL.node = yyDollar[1].node } case 429: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:3687 + //line php7/php7.y:3681 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) @@ -6532,7 +6526,7 @@ yydefault: } case 430: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:3698 + //line php7/php7.y:3692 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) @@ -6545,7 +6539,7 @@ yydefault: } case 431: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:3709 + //line php7/php7.y:3703 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) @@ -6558,7 +6552,7 @@ yydefault: } case 432: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:3720 + //line php7/php7.y:3714 { yyVAL.node = expr.NewMethodCall(yyDollar[1].node, yyDollar[3].node, yyDollar[4].node.(*node.ArgumentList)) @@ -6570,25 +6564,25 @@ yydefault: } case 433: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3730 + //line php7/php7.y:3724 { yyVAL.node = yyDollar[1].node } case 434: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3735 + //line php7/php7.y:3729 { yyVAL.node = yyDollar[1].node } case 435: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3737 + //line php7/php7.y:3731 { yyVAL.node = yyDollar[1].node } case 436: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3739 + //line php7/php7.y:3733 { yyVAL.node = expr.NewPropertyFetch(yyDollar[1].node, yyDollar[3].node) @@ -6600,7 +6594,7 @@ yydefault: } case 437: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3752 + //line php7/php7.y:3746 { name := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) yyVAL.node = expr.NewVariable(name) @@ -6614,7 +6608,7 @@ yydefault: } case 438: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:3764 + //line php7/php7.y:3758 { yyVAL.node = expr.NewVariable(yyDollar[3].node) @@ -6628,7 +6622,7 @@ yydefault: } case 439: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3776 + //line php7/php7.y:3770 { yyVAL.node = expr.NewVariable(yyDollar[2].node) @@ -6640,7 +6634,7 @@ yydefault: } case 440: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3789 + //line php7/php7.y:3783 { yyVAL.node = expr.NewStaticPropertyFetch(yyDollar[1].node, yyDollar[3].node) @@ -6652,7 +6646,7 @@ yydefault: } case 441: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3799 + //line php7/php7.y:3793 { yyVAL.node = expr.NewStaticPropertyFetch(yyDollar[1].node, yyDollar[3].node) @@ -6664,13 +6658,13 @@ yydefault: } case 442: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3812 + //line php7/php7.y:3806 { yyVAL.node = yyDollar[1].node } case 443: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:3814 + //line php7/php7.y:3808 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) @@ -6683,7 +6677,7 @@ yydefault: } case 444: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:3825 + //line php7/php7.y:3819 { yyVAL.node = expr.NewArrayDimFetch(yyDollar[1].node, yyDollar[3].node) @@ -6696,7 +6690,7 @@ yydefault: } case 445: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3836 + //line php7/php7.y:3830 { yyVAL.node = expr.NewPropertyFetch(yyDollar[1].node, yyDollar[3].node) @@ -6708,7 +6702,7 @@ yydefault: } case 446: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3846 + //line php7/php7.y:3840 { yyVAL.node = expr.NewStaticPropertyFetch(yyDollar[1].node, yyDollar[3].node) @@ -6720,7 +6714,7 @@ yydefault: } case 447: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3856 + //line php7/php7.y:3850 { yyVAL.node = expr.NewStaticPropertyFetch(yyDollar[1].node, yyDollar[3].node) @@ -6732,7 +6726,7 @@ yydefault: } case 448: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3869 + //line php7/php7.y:3863 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -6744,7 +6738,7 @@ yydefault: } case 449: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3879 + //line php7/php7.y:3873 { yyVAL.node = yyDollar[2].node @@ -6754,13 +6748,13 @@ yydefault: } case 450: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3887 + //line php7/php7.y:3881 { yyVAL.node = yyDollar[1].node } case 451: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3892 + //line php7/php7.y:3886 { yyVAL.node = node.NewIdentifier(yyDollar[1].token.Value) @@ -6772,7 +6766,7 @@ yydefault: } case 452: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3902 + //line php7/php7.y:3896 { yyVAL.node = yyDollar[2].node @@ -6782,13 +6776,13 @@ yydefault: } case 453: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3910 + //line php7/php7.y:3904 { yyVAL.node = yyDollar[1].node } case 454: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3915 + //line php7/php7.y:3909 { if yyDollar[1].list[len(yyDollar[1].list)-1] == nil { yyVAL.list = yyDollar[1].list[:len(yyDollar[1].list)-1] @@ -6798,19 +6792,19 @@ yydefault: } case 455: yyDollar = yyS[yypt-0 : yypt+1] - //line php7/php7.y:3926 + //line php7/php7.y:3920 { yyVAL.node = nil } case 456: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3928 + //line php7/php7.y:3922 { yyVAL.node = yyDollar[1].node } case 457: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3933 + //line php7/php7.y:3927 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -6819,13 +6813,13 @@ yydefault: } case 458: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3940 + //line php7/php7.y:3934 { yyVAL.list = []node.Node{yyDollar[1].node} } case 459: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:3945 + //line php7/php7.y:3939 { yyVAL.node = expr.NewArrayItem(yyDollar[1].node, yyDollar[3].node) @@ -6837,7 +6831,7 @@ yydefault: } case 460: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:3955 + //line php7/php7.y:3949 { yyVAL.node = expr.NewArrayItem(nil, yyDollar[1].node) @@ -6846,7 +6840,7 @@ yydefault: } case 461: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:3962 + //line php7/php7.y:3956 { reference := expr.NewReference(yyDollar[4].node) yyVAL.node = expr.NewArrayItem(yyDollar[1].node, reference) @@ -6860,7 +6854,7 @@ yydefault: } case 462: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:3974 + //line php7/php7.y:3968 { reference := expr.NewReference(yyDollar[2].node) yyVAL.node = expr.NewArrayItem(nil, reference) @@ -6873,7 +6867,7 @@ yydefault: } case 463: yyDollar = yyS[yypt-6 : yypt+1] - //line php7/php7.y:3985 + //line php7/php7.y:3979 { // TODO: Cannot use list() as standalone expression list := expr.NewList(yyDollar[5].list) @@ -6891,7 +6885,7 @@ yydefault: } case 464: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:4001 + //line php7/php7.y:3995 { // TODO: Cannot use list() as standalone expression list := expr.NewList(yyDollar[3].list) @@ -6908,13 +6902,13 @@ yydefault: } case 465: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:4019 + //line php7/php7.y:4013 { yyVAL.list = append(yyDollar[1].list, yyDollar[2].node) } case 466: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:4021 + //line php7/php7.y:4015 { encapsed := scalar.NewEncapsedStringPart(yyDollar[2].token.Value) yyVAL.list = append(yyDollar[1].list, encapsed) @@ -6927,13 +6921,13 @@ yydefault: } case 467: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4032 + //line php7/php7.y:4026 { yyVAL.list = []node.Node{yyDollar[1].node} } case 468: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:4034 + //line php7/php7.y:4028 { encapsed := scalar.NewEncapsedStringPart(yyDollar[1].token.Value) yyVAL.list = []node.Node{encapsed, yyDollar[2].node} @@ -6946,7 +6940,7 @@ yydefault: } case 469: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4048 + //line php7/php7.y:4042 { name := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) yyVAL.node = expr.NewVariable(name) @@ -6960,7 +6954,7 @@ yydefault: } case 470: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:4060 + //line php7/php7.y:4054 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) variable := expr.NewVariable(identifier) @@ -6978,7 +6972,7 @@ yydefault: } case 471: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4076 + //line php7/php7.y:4070 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) variable := expr.NewVariable(identifier) @@ -6998,7 +6992,7 @@ yydefault: } case 472: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4094 + //line php7/php7.y:4088 { yyVAL.node = expr.NewVariable(yyDollar[2].node) @@ -7011,7 +7005,7 @@ yydefault: } case 473: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4105 + //line php7/php7.y:4099 { name := node.NewIdentifier(yyDollar[2].token.Value) yyVAL.node = expr.NewVariable(name) @@ -7027,7 +7021,7 @@ yydefault: } case 474: yyDollar = yyS[yypt-6 : yypt+1] - //line php7/php7.y:4119 + //line php7/php7.y:4113 { identifier := node.NewIdentifier(yyDollar[2].token.Value) variable := expr.NewVariable(identifier) @@ -7047,13 +7041,13 @@ yydefault: } case 475: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4137 + //line php7/php7.y:4131 { yyVAL.node = yyDollar[2].node } case 476: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4143 + //line php7/php7.y:4138 { yyVAL.node = scalar.NewString(yyDollar[1].token.Value) @@ -7065,7 +7059,7 @@ yydefault: } case 477: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4153 + //line php7/php7.y:4148 { // TODO: add option to handle 64 bit integer if _, err := strconv.Atoi(yyDollar[1].token.Value); err == nil { @@ -7082,7 +7076,7 @@ yydefault: } case 478: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:4168 + //line php7/php7.y:4163 { var lnumber *scalar.Lnumber // TODO: add option to handle 64 bit integer @@ -7113,7 +7107,7 @@ yydefault: } case 479: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4197 + //line php7/php7.y:4192 { identifier := node.NewIdentifier(strings.TrimLeft(yyDollar[1].token.Value, "$")) yyVAL.node = expr.NewVariable(identifier) @@ -7127,7 +7121,7 @@ yydefault: } case 480: yyDollar = yyS[yypt-5 : yypt+1] - //line php7/php7.y:4212 + //line php7/php7.y:4207 { yyVAL.node = expr.NewIsset(yyDollar[3].list) @@ -7144,7 +7138,7 @@ yydefault: } case 481: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:4227 + //line php7/php7.y:4222 { yyVAL.node = expr.NewEmpty(yyDollar[3].node) @@ -7158,7 +7152,7 @@ yydefault: } case 482: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:4239 + //line php7/php7.y:4234 { yyVAL.node = expr.NewInclude(yyDollar[2].node) @@ -7170,7 +7164,7 @@ yydefault: } case 483: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:4249 + //line php7/php7.y:4244 { yyVAL.node = expr.NewIncludeOnce(yyDollar[2].node) @@ -7182,7 +7176,7 @@ yydefault: } case 484: yyDollar = yyS[yypt-4 : yypt+1] - //line php7/php7.y:4259 + //line php7/php7.y:4254 { yyVAL.node = expr.NewEval(yyDollar[3].node) @@ -7196,7 +7190,7 @@ yydefault: } case 485: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:4271 + //line php7/php7.y:4266 { yyVAL.node = expr.NewRequire(yyDollar[2].node) @@ -7208,7 +7202,7 @@ yydefault: } case 486: yyDollar = yyS[yypt-2 : yypt+1] - //line php7/php7.y:4281 + //line php7/php7.y:4276 { yyVAL.node = expr.NewRequireOnce(yyDollar[2].node) @@ -7220,13 +7214,13 @@ yydefault: } case 487: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4294 + //line php7/php7.y:4289 { yyVAL.list = []node.Node{yyDollar[1].node} } case 488: yyDollar = yyS[yypt-3 : yypt+1] - //line php7/php7.y:4296 + //line php7/php7.y:4291 { yyVAL.list = append(yyDollar[1].list, yyDollar[3].node) @@ -7235,7 +7229,7 @@ yydefault: } case 489: yyDollar = yyS[yypt-1 : yypt+1] - //line php7/php7.y:4306 + //line php7/php7.y:4301 { yyVAL.node = yyDollar[1].node } diff --git a/php7/php7.y b/php7/php7.y index 4190b68..0c7514e 100644 --- a/php7/php7.y +++ b/php7/php7.y @@ -1694,16 +1694,7 @@ parameter: { identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$")) variable := expr.NewVariable(identifier) - - if $1 != nil { - $$ = node.NewParameter($1, variable, nil, $2 != nil, $3 != nil) - } else if $2 != nil { - $$ = node.NewParameter($1, variable, nil, $2 != nil, $3 != nil) - } else if $3 != nil { - $$ = node.NewParameter($1, variable, nil, $2 != nil, $3 != nil) - } else { - $$ = node.NewParameter($1, variable, nil, $2 != nil, $3 != nil) - } + $$ = node.NewParameter($1, variable, nil, $2 != nil, $3 != nil) // save position yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) @@ -1731,15 +1722,7 @@ parameter: { identifier := node.NewIdentifier(strings.TrimLeft($4.Value, "$")) variable := expr.NewVariable(identifier) - if $1 != nil { - $$ = node.NewParameter($1, variable, $6, $2 != nil, $3 != nil) - } else if $2 != nil { - $$ = node.NewParameter($1, variable, $6, $2 != nil, $3 != nil) - } else if $3 != nil { - $$ = node.NewParameter($1, variable, $6, $2 != nil, $3 != nil) - } else { - $$ = node.NewParameter($1, variable, $6, $2 != nil, $3 != nil) - } + $$ = node.NewParameter($1, variable, $6, $2 != nil, $3 != nil) // save position yylex.(*Parser).positions.AddPosition(identifier, yylex.(*Parser).positionBuilder.NewTokenPosition($4)) @@ -1832,6 +1815,10 @@ argument_list: // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $2)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken) + yylex.(*Parser).comments.AddFromToken($$, $2, comment.CloseParenthesisToken) } | '(' non_empty_argument_list possible_comma ')' { @@ -1839,6 +1826,13 @@ argument_list: // save position yylex.(*Parser).positions.AddPosition($$, yylex.(*Parser).positionBuilder.NewTokensPosition($1, $4)) + + // save comments + yylex.(*Parser).comments.AddFromToken($$, $1, comment.OpenParenthesisToken) + if $3 != nil { + yylex.(*Parser).comments.AddFromToken($$, $3, comment.CommaToken) + } + yylex.(*Parser).comments.AddFromToken($$, $4, comment.CloseParenthesisToken) } ; @@ -4138,6 +4132,7 @@ encaps_var: $$ = $2; } ; + encaps_var_offset: T_STRING {