Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-6608 Use std::stoul to unify to do all integer parsing

caheckman827ebe6a0529
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/slghscan.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/slghscan.cc
index 82f7e82669..f3c1e361a8 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/slghscan.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slghscan.cc
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -648,15 +648,15 @@ static const flex_int16_t yy_accept[533] =
154, 156, 156, 156, 156, 156, 156, 156, 156, 156,
156, 156, 156, 156, 156, 156, 154, 99, 97, 165,
165, 164, 163, 7, 6, 0, 13, 13, 13, 13,
- 13, 1, 1, 56, 0, 55, 50, 0, 51, 0,
- 0, 52, 51, 51, 51, 51, 51, 51, 51, 51,
+ 13, 1, 1, 56, 0, 55, 50, 0, 51, 52,
+ 0, 0, 51, 51, 51, 51, 51, 51, 51, 51,
51, 51, 51, 51, 51, 51, 51, 51, 51, 51,
51, 23, 23, 20, 0, 19, 15, 15, 66, 0,
65, 0, 64, 63, 59, 59, 94, 76, 89, 0,
- 0, 0, 0, 90, 90, 0, 0, 91, 75, 77,
+ 0, 0, 0, 90, 90, 91, 0, 0, 75, 77,
78, 74, 90, 90, 69, 69, 160, 106, 155, 0,
- 101, 156, 0, 0, 157, 104, 107, 105, 108, 103,
+ 101, 156, 157, 0, 0, 104, 107, 105, 108, 103,
102, 156, 156, 156, 156, 156, 156, 156, 156, 156,
0, 118, 116, 117, 119, 122, 0, 123, 156, 156,
145, 156, 156, 156, 156, 156, 156, 156, 156, 110,
@@ -739,68 +739,68 @@ static const YY_CHAR yy_meta[67] =
static const flex_int16_t yy_base[570] =
{ 0,
- 0, 937, 66, 936, 132, 935, 198, 934, 264, 933,
- 330, 932, 0, 394, 961, 968, 396, 968, 0, 948,
- 968, 0, 968, 903, 917, 920, 911, 968, 952, 968,
- 397, 968, 948, 0, 941, 968, 0, 365, 384, 968,
- 904, 906, 899, 908, 898, 906, 901, 365, 903, 905,
- 371, 365, 358, 906, 891, 938, 968, 409, 968, 928,
- 968, 0, 968, 936, 968, 416, 968, 968, 932, 925,
- 0, 968, 881, 932, 968, 419, 968, 907, 0, 402,
- 968, 968, 915, 377, 406, 404, 405, 0, 968, 968,
- 968, 884, 881, 968, 968, 927, 968, 432, 968, 902,
-
- 0, 916, 968, 917, 0, 384, 420, 419, 899, 420,
- 890, 886, 398, 413, 882, 862, 454, 870, 410, 410,
- 429, 869, 423, 466, 865, 877, 853, 968, 913, 968,
- 912, 968, 911, 454, 0, 0, 0, 857, 870, 872,
- 854, 906, 968, 474, 902, 901, 0, 0, 0, 463,
- 0, 466, 861, 395, 855, 451, 864, 843, 846, 852,
- 858, 857, 847, 848, 853, 434, 858, 847, 841, 409,
- 838, 888, 968, 493, 0, 0, 887, 968, 496, 883,
- 882, 0, 0, 0, 884, 968, 497, 968, 0, 0,
- 836, 831, 833, 865, 0, 488, 0, 490, 968, 968,
-
- 968, 968, 831, 836, 877, 968, 512, 968, 0, 0,
- 968, 0, 497, 0, 500, 968, 968, 968, 968, 968,
- 968, 824, 824, 832, 476, 831, 824, 823, 825, 820,
- 844, 968, 968, 968, 968, 843, 842, 841, 816, 810,
- 0, 809, 825, 824, 812, 802, 808, 803, 801, 968,
- 968, 830, 498, 805, 818, 794, 799, 795, 791, 968,
- 847, 968, 846, 968, 845, 968, 834, 809, 800, 790,
- 799, 829, 507, 0, 798, 0, 786, 783, 0, 801,
- 792, 0, 780, 794, 786, 778, 792, 795, 785, 779,
- 787, 788, 785, 784, 767, 778, 782, 808, 807, 806,
-
- 778, 968, 763, 0, 511, 0, 778, 766, 801, 513,
- 0, 0, 759, 764, 763, 756, 761, 757, 752, 769,
- 754, 968, 968, 968, 968, 478, 753, 781, 765, 750,
- 0, 749, 760, 741, 747, 968, 968, 968, 742, 741,
- 738, 737, 742, 735, 968, 777, 750, 738, 736, 0,
- 968, 773, 735, 747, 742, 725, 744, 732, 724, 727,
- 736, 735, 720, 719, 732, 0, 731, 721, 0, 729,
- 732, 713, 968, 754, 968, 753, 968, 752, 968, 968,
- 727, 711, 968, 749, 710, 720, 0, 698, 0, 710,
- 702, 695, 701, 698, 699, 0, 710, 703, 693, 711,
-
- 697, 693, 706, 691, 690, 0, 0, 704, 0, 698,
- 700, 0, 691, 689, 678, 689, 686, 694, 0, 675,
- 677, 681, 679, 674, 689, 0, 0, 673, 689, 681,
- 677, 676, 664, 0, 0, 0, 684, 666, 664, 697,
- 0, 670, 0, 667, 670, 658, 664, 0, 662, 651,
- 0, 0, 0, 670, 667, 653, 652, 0, 0, 0,
- 0, 655, 669, 664, 0, 0, 656, 641, 647, 0,
- 0, 644, 652, 0, 657, 647, 641, 655, 645, 0,
- 635, 0, 643, 651, 0, 0, 0, 652, 636, 648,
- 647, 646, 641, 634, 636, 646, 0, 643, 625, 0,
-
- 624, 0, 638, 642, 622, 0, 620, 627, 618, 622,
- 616, 615, 0, 0, 0, 615, 0, 0, 629, 0,
- 577, 0, 0, 548, 0, 510, 511, 0, 467, 462,
- 0, 968, 534, 540, 546, 548, 554, 558, 564, 566,
- 572, 574, 580, 584, 586, 592, 598, 600, 606, 612,
- 614, 620, 626, 632, 634, 636, 485, 638, 640, 642,
- 473, 644, 429, 647, 650, 653, 656, 659, 662
+ 0, 949, 66, 948, 132, 947, 198, 946, 264, 945,
+ 330, 944, 0, 394, 973, 980, 396, 980, 0, 960,
+ 980, 0, 980, 915, 929, 932, 923, 980, 964, 980,
+ 397, 980, 960, 0, 953, 980, 0, 382, 386, 980,
+ 916, 918, 911, 920, 910, 918, 913, 374, 915, 917,
+ 373, 367, 362, 918, 903, 950, 980, 413, 980, 940,
+ 980, 0, 980, 948, 980, 414, 980, 980, 944, 937,
+ 0, 980, 893, 944, 980, 424, 980, 919, 0, 409,
+ 980, 980, 927, 410, 414, 412, 413, 0, 980, 980,
+ 980, 896, 893, 980, 980, 939, 980, 425, 980, 914,
+
+ 0, 928, 980, 929, 0, 429, 433, 417, 911, 430,
+ 902, 898, 408, 425, 894, 874, 459, 882, 421, 410,
+ 443, 881, 440, 473, 877, 889, 865, 980, 925, 980,
+ 924, 980, 923, 443, 0, 0, 0, 869, 882, 884,
+ 866, 918, 980, 486, 914, 913, 0, 0, 0, 473,
+ 477, 0, 873, 457, 867, 463, 876, 855, 858, 864,
+ 870, 869, 859, 860, 865, 460, 870, 859, 853, 456,
+ 850, 900, 980, 504, 0, 0, 899, 980, 513, 895,
+ 894, 0, 0, 0, 896, 980, 514, 980, 0, 0,
+ 848, 843, 845, 877, 0, 507, 499, 0, 980, 980,
+
+ 980, 980, 843, 848, 889, 980, 519, 980, 0, 0,
+ 980, 0, 511, 504, 0, 980, 980, 980, 980, 980,
+ 980, 836, 836, 844, 487, 843, 836, 835, 837, 832,
+ 856, 980, 980, 980, 980, 855, 854, 853, 828, 822,
+ 0, 821, 837, 836, 824, 814, 820, 815, 813, 980,
+ 980, 842, 509, 817, 830, 806, 811, 807, 803, 980,
+ 859, 980, 858, 980, 857, 980, 846, 821, 812, 802,
+ 811, 841, 518, 0, 810, 0, 798, 795, 0, 813,
+ 804, 0, 792, 806, 798, 790, 804, 807, 797, 791,
+ 799, 800, 797, 796, 779, 790, 794, 820, 819, 818,
+
+ 790, 980, 775, 0, 522, 0, 790, 778, 813, 524,
+ 0, 0, 771, 776, 775, 768, 773, 769, 764, 781,
+ 766, 980, 980, 980, 980, 503, 765, 793, 777, 762,
+ 0, 761, 772, 753, 759, 980, 980, 980, 754, 753,
+ 750, 749, 754, 747, 980, 789, 762, 750, 748, 0,
+ 980, 785, 747, 759, 754, 737, 756, 744, 736, 739,
+ 748, 747, 732, 731, 744, 0, 743, 733, 0, 741,
+ 744, 725, 980, 766, 980, 765, 980, 764, 980, 980,
+ 739, 723, 980, 761, 722, 732, 0, 710, 0, 722,
+ 714, 707, 713, 710, 711, 0, 722, 715, 705, 723,
+
+ 709, 705, 718, 703, 702, 0, 0, 716, 0, 710,
+ 712, 0, 703, 701, 690, 701, 698, 706, 0, 687,
+ 689, 693, 691, 686, 701, 0, 0, 685, 701, 693,
+ 689, 688, 676, 0, 0, 0, 696, 678, 676, 709,
+ 0, 682, 0, 679, 682, 670, 676, 0, 674, 663,
+ 0, 0, 0, 682, 679, 665, 664, 0, 0, 0,
+ 0, 667, 681, 676, 0, 0, 668, 653, 659, 0,
+ 0, 656, 664, 0, 669, 659, 653, 667, 657, 0,
+ 647, 0, 655, 663, 0, 0, 0, 664, 648, 660,
+ 659, 658, 653, 646, 648, 658, 0, 655, 637, 0,
+
+ 636, 0, 650, 654, 634, 0, 578, 572, 530, 517,
+ 497, 496, 0, 0, 0, 496, 0, 0, 510, 0,
+ 512, 0, 0, 496, 0, 491, 509, 0, 470, 442,
+ 0, 980, 554, 560, 566, 568, 574, 578, 584, 586,
+ 592, 594, 600, 604, 606, 612, 618, 620, 626, 632,
+ 634, 640, 646, 652, 654, 656, 469, 658, 660, 662,
+ 462, 664, 416, 667, 670, 673, 676, 679, 682
} ;
static const flex_int16_t yy_def[570] =
@@ -821,14 +821,14 @@ static const flex_int16_t yy_def[570] =
551, 551, 551, 551, 551, 551, 532, 532, 552, 532,
553, 532, 554, 532, 535, 555, 536, 536, 536, 536,
536, 537, 532, 532, 538, 532, 539, 556, 540, 532,
- 557, 532, 540, 540, 540, 540, 540, 540, 540, 540,
+ 532, 557, 540, 540, 540, 540, 540, 540, 540, 540,
540, 540, 540, 540, 540, 540, 540, 540, 540, 540,
540, 541, 532, 532, 558, 542, 543, 532, 532, 544,
532, 559, 545, 545, 546, 532, 532, 532, 547, 560,
- 532, 532, 532, 548, 548, 532, 561, 532, 532, 532,
+ 532, 532, 532, 548, 548, 532, 532, 561, 532, 532,
532, 532, 548, 548, 549, 532, 532, 532, 550, 562,
- 532, 551, 532, 563, 532, 532, 532, 532, 532, 532,
+ 532, 551, 532, 532, 563, 532, 532, 532, 532, 532,
532, 551, 551, 551, 551, 551, 551, 551, 551, 551,
532, 532, 532, 532, 532, 532, 532, 532, 551, 551,
551, 551, 551, 551, 551, 551, 551, 551, 551, 532,
@@ -869,7 +869,7 @@ static const flex_int16_t yy_def[570] =
532, 532, 532, 532, 532, 532, 532, 532, 532
} ;
-static const flex_int16_t yy_nxt[1035] =
+static const flex_int16_t yy_nxt[1047] =
{ 0,
16, 17, 18, 17, 16, 16, 19, 20, 16, 16,
16, 21, 21, 16, 16, 21, 21, 22, 16, 16,
@@ -915,79 +915,80 @@ static const flex_int16_t yy_nxt[1035] =
105, 122, 105, 123, 124, 125, 105, 105, 105, 105,
105, 126, 97, 127, 128, 103, 132, 134, 144, 134,
- 144, 160, 150, 152, 152, 152, 152, 164, 168, 166,
- 174, 165, 174, 190, 196, 161, 167, 179, 169, 179,
- 187, 213, 187, 133, 151, 198, 198, 198, 198, 199,
- 200, 201, 202, 207, 311, 207, 197, 276, 191, 215,
- 215, 215, 215, 214, 216, 217, 219, 220, 223, 225,
- 277, 241, 192, 226, 224, 134, 295, 134, 231, 242,
- 243, 193, 296, 248, 227, 245, 228, 232, 233, 246,
- 234, 244, 235, 249, 250, 144, 290, 144, 306, 236,
- 237, 238, 273, 273, 251, 152, 152, 152, 152, 279,
- 274, 252, 280, 253, 174, 291, 174, 179, 187, 179,
-
- 187, 239, 531, 254, 255, 530, 256, 305, 305, 198,
- 198, 198, 198, 207, 394, 207, 310, 310, 257, 215,
- 215, 215, 215, 315, 337, 338, 273, 273, 395, 316,
- 305, 305, 310, 310, 130, 130, 130, 130, 130, 130,
- 131, 131, 131, 131, 131, 131, 135, 529, 135, 135,
+ 144, 150, 150, 150, 150, 150, 150, 150, 150, 164,
+ 160, 166, 168, 165, 174, 179, 174, 179, 167, 151,
+ 190, 311, 169, 133, 161, 187, 207, 187, 207, 196,
+ 196, 196, 196, 196, 196, 196, 196, 199, 200, 201,
+ 202, 152, 216, 217, 134, 191, 134, 197, 213, 213,
+ 213, 213, 213, 213, 213, 213, 219, 220, 223, 192,
+ 243, 225, 241, 231, 224, 226, 214, 306, 193, 198,
+ 242, 244, 232, 233, 274, 234, 227, 235, 228, 245,
+ 248, 250, 531, 246, 236, 237, 238, 144, 215, 144,
+ 249, 251, 150, 150, 150, 150, 273, 273, 252, 276,
+
+ 253, 279, 290, 295, 280, 174, 239, 174, 530, 296,
+ 254, 255, 277, 256, 179, 187, 179, 187, 305, 305,
+ 207, 291, 207, 310, 310, 257, 196, 196, 196, 196,
+ 213, 213, 213, 213, 315, 337, 338, 273, 273, 394,
+ 316, 305, 305, 310, 310, 529, 528, 527, 526, 525,
+ 524, 523, 522, 395, 130, 130, 130, 130, 130, 130,
+ 131, 131, 131, 131, 131, 131, 135, 521, 135, 135,
135, 135, 137, 137, 142, 142, 142, 142, 142, 142,
- 145, 145, 145, 145, 147, 528, 147, 147, 147, 147,
+ 145, 145, 145, 145, 147, 520, 147, 147, 147, 147,
149, 149, 172, 172, 172, 172, 172, 172, 176, 176,
- 177, 177, 177, 177, 177, 177, 180, 180, 180, 180,
- 183, 183, 185, 185, 185, 185, 185, 185, 189, 527,
+ 177, 177, 177, 177, 177, 177, 180, 180, 180, 180,
+ 183, 183, 185, 185, 185, 185, 185, 185, 189, 519,
189, 189, 189, 189, 195, 195, 205, 205, 205, 205,
- 205, 205, 209, 526, 209, 209, 209, 209, 212, 212,
+ 205, 205, 209, 518, 209, 209, 209, 209, 212, 212,
261, 261, 261, 261, 261, 261, 263, 263, 263, 263,
263, 263, 265, 265, 265, 265, 265, 265, 267, 267,
272, 272, 298, 298, 299, 299, 300, 300, 309, 309,
346, 346, 346, 352, 352, 352, 374, 374, 374, 376,
- 376, 376, 378, 378, 378, 384, 384, 384, 525, 524,
- 523, 522, 521, 520, 519, 518, 517, 516, 515, 514,
- 513, 512, 511, 510, 509, 508, 507, 506, 505, 504,
- 503, 502, 501, 500, 499, 498, 497, 496, 495, 494,
-
- 493, 492, 491, 490, 489, 488, 487, 486, 485, 484,
- 483, 482, 481, 480, 479, 478, 477, 476, 475, 474,
- 473, 472, 471, 470, 469, 468, 467, 466, 465, 464,
- 463, 462, 461, 460, 459, 458, 457, 456, 455, 454,
- 453, 452, 451, 450, 449, 448, 447, 446, 445, 444,
- 443, 442, 441, 440, 439, 438, 437, 436, 435, 434,
- 433, 383, 432, 431, 377, 375, 373, 430, 429, 428,
- 427, 426, 425, 424, 423, 422, 421, 420, 419, 418,
- 417, 416, 415, 414, 413, 351, 412, 411, 410, 345,
- 409, 408, 407, 406, 405, 404, 403, 402, 401, 400,
-
- 399, 398, 397, 396, 393, 392, 391, 390, 389, 388,
- 387, 386, 385, 383, 382, 381, 380, 379, 377, 375,
- 373, 372, 371, 370, 369, 368, 367, 366, 365, 364,
- 363, 362, 361, 360, 359, 358, 357, 356, 355, 354,
- 353, 351, 350, 349, 348, 347, 345, 266, 264, 262,
- 344, 343, 342, 341, 340, 339, 336, 335, 334, 333,
- 332, 331, 330, 329, 328, 327, 326, 325, 324, 323,
- 322, 321, 320, 319, 318, 317, 314, 313, 312, 206,
- 308, 307, 304, 303, 302, 301, 186, 180, 181, 178,
- 173, 297, 294, 293, 292, 289, 288, 287, 286, 285,
-
- 284, 283, 282, 281, 278, 275, 145, 146, 143, 271,
- 270, 269, 268, 266, 264, 262, 260, 259, 258, 247,
- 240, 230, 229, 222, 221, 218, 211, 210, 208, 206,
- 204, 203, 194, 188, 186, 184, 182, 181, 178, 175,
- 173, 171, 170, 163, 162, 159, 158, 157, 156, 155,
- 154, 153, 148, 146, 143, 141, 140, 139, 138, 136,
- 532, 129, 96, 74, 64, 56, 29, 15, 532, 532,
- 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
+ 376, 376, 378, 378, 378, 384, 384, 384, 517, 516,
+ 515, 514, 513, 512, 511, 510, 509, 508, 507, 506,
+
+ 505, 504, 503, 502, 501, 500, 499, 498, 497, 496,
+ 495, 494, 493, 492, 491, 490, 489, 488, 487, 486,
+ 485, 484, 483, 482, 481, 480, 479, 478, 477, 476,
+ 475, 474, 473, 472, 471, 470, 469, 468, 467, 466,
+ 465, 464, 463, 462, 461, 460, 459, 458, 457, 456,
+ 455, 454, 453, 452, 451, 450, 449, 448, 447, 446,
+ 445, 444, 443, 442, 441, 440, 439, 438, 437, 436,
+ 435, 434, 433, 383, 432, 431, 377, 375, 373, 430,
+ 429, 428, 427, 426, 425, 424, 423, 422, 421, 420,
+ 419, 418, 417, 416, 415, 414, 413, 351, 412, 411,
+
+ 410, 345, 409, 408, 407, 406, 405, 404, 403, 402,
+ 401, 400, 399, 398, 397, 396, 393, 392, 391, 390,
+ 389, 388, 387, 386, 385, 383, 382, 381, 380, 379,
+ 377, 375, 373, 372, 371, 370, 369, 368, 367, 366,
+ 365, 364, 363, 362, 361, 360, 359, 358, 357, 356,
+ 355, 354, 353, 351, 350, 349, 348, 347, 345, 266,
+ 264, 262, 344, 343, 342, 341, 340, 339, 336, 335,
+ 334, 333, 332, 331, 330, 329, 328, 327, 326, 325,
+ 324, 323, 322, 321, 320, 319, 318, 317, 314, 313,
+ 312, 206, 308, 307, 304, 303, 302, 301, 186, 180,
+
+ 181, 178, 173, 297, 294, 293, 292, 289, 288, 287,
+ 286, 285, 284, 283, 282, 281, 278, 275, 145, 146,
+ 143, 271, 270, 269, 268, 266, 264, 262, 260, 259,
+ 258, 247, 240, 230, 229, 222, 221, 218, 211, 210,
+ 208, 206, 204, 203, 194, 188, 186, 184, 182, 181,
+ 178, 175, 173, 171, 170, 163, 162, 159, 158, 157,
+ 156, 155, 154, 153, 148, 146, 143, 141, 140, 139,
+ 138, 136, 532, 129, 96, 74, 64, 56, 29, 15,
532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
- 532, 532, 532, 532
+ 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
+ 532, 532, 532, 532, 532, 532
} ;
-static const flex_int16_t yy_chk[1035] =
+static const flex_int16_t yy_chk[1047] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -1033,76 +1034,77 @@ static const flex_int16_t yy_chk[1035] =
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 14, 17, 31, 17,
- 31, 48, 38, 39, 39, 39, 39, 51, 53, 52,
- 58, 51, 58, 80, 84, 48, 52, 66, 53, 66,
- 76, 106, 76, 14, 38, 85, 85, 85, 85, 86,
- 86, 87, 87, 98, 563, 98, 84, 154, 80, 107,
- 107, 107, 107, 106, 108, 108, 110, 110, 113, 114,
- 154, 119, 80, 114, 113, 134, 170, 134, 117, 119,
- 120, 80, 170, 123, 114, 121, 114, 117, 117, 121,
- 117, 120, 117, 123, 124, 144, 166, 144, 561, 117,
- 117, 117, 150, 150, 124, 152, 152, 152, 152, 156,
- 557, 124, 156, 124, 174, 166, 174, 179, 187, 179,
-
- 187, 117, 530, 124, 124, 529, 124, 196, 196, 198,
- 198, 198, 198, 207, 326, 207, 213, 213, 124, 215,
- 215, 215, 215, 225, 253, 253, 273, 273, 326, 225,
- 305, 305, 310, 310, 533, 533, 533, 533, 533, 533,
- 534, 534, 534, 534, 534, 534, 535, 527, 535, 535,
+ 31, 38, 38, 38, 38, 39, 39, 39, 39, 51,
+ 48, 52, 53, 51, 58, 66, 58, 66, 52, 38,
+ 80, 563, 53, 14, 48, 76, 98, 76, 98, 84,
+ 84, 84, 84, 85, 85, 85, 85, 86, 86, 87,
+ 87, 38, 108, 108, 134, 80, 134, 84, 106, 106,
+ 106, 106, 107, 107, 107, 107, 110, 110, 113, 80,
+ 120, 114, 119, 117, 113, 114, 106, 561, 80, 84,
+ 119, 120, 117, 117, 557, 117, 114, 117, 114, 121,
+ 123, 124, 530, 121, 117, 117, 117, 144, 106, 144,
+ 123, 124, 150, 150, 150, 150, 151, 151, 124, 154,
+
+ 124, 156, 166, 170, 156, 174, 117, 174, 529, 170,
+ 124, 124, 154, 124, 179, 187, 179, 187, 197, 197,
+ 207, 166, 207, 214, 214, 124, 196, 196, 196, 196,
+ 213, 213, 213, 213, 225, 253, 253, 273, 273, 326,
+ 225, 305, 305, 310, 310, 527, 526, 524, 521, 519,
+ 516, 512, 511, 326, 533, 533, 533, 533, 533, 533,
+ 534, 534, 534, 534, 534, 534, 535, 510, 535, 535,
535, 535, 536, 536, 537, 537, 537, 537, 537, 537,
- 538, 538, 538, 538, 539, 526, 539, 539, 539, 539,
+ 538, 538, 538, 538, 539, 509, 539, 539, 539, 539,
540, 540, 541, 541, 541, 541, 541, 541, 542, 542,
- 543, 543, 543, 543, 543, 543, 544, 544, 544, 544,
- 545, 545, 546, 546, 546, 546, 546, 546, 547, 524,
+ 543, 543, 543, 543, 543, 543, 544, 544, 544, 544,
+ 545, 545, 546, 546, 546, 546, 546, 546, 547, 508,
547, 547, 547, 547, 548, 548, 549, 549, 549, 549,
- 549, 549, 550, 521, 550, 550, 550, 550, 551, 551,
+ 549, 549, 550, 507, 550, 550, 550, 550, 551, 551,
552, 552, 552, 552, 552, 552, 553, 553, 553, 553,
553, 553, 554, 554, 554, 554, 554, 554, 555, 555,
556, 556, 558, 558, 559, 559, 560, 560, 562, 562,
564, 564, 564, 565, 565, 565, 566, 566, 566, 567,
- 567, 567, 568, 568, 568, 569, 569, 569, 519, 516,
- 512, 511, 510, 509, 508, 507, 505, 504, 503, 501,
- 499, 498, 496, 495, 494, 493, 492, 491, 490, 489,
- 488, 484, 483, 481, 479, 478, 477, 476, 475, 473,
-
- 472, 469, 468, 467, 464, 463, 462, 457, 456, 455,
- 454, 450, 449, 447, 446, 445, 444, 442, 440, 439,
- 438, 437, 433, 432, 431, 430, 429, 428, 425, 424,
- 423, 422, 421, 420, 418, 417, 416, 415, 414, 413,
- 411, 410, 408, 405, 404, 403, 402, 401, 400, 399,
- 398, 397, 395, 394, 393, 392, 391, 390, 388, 386,
- 385, 384, 382, 381, 378, 376, 374, 372, 371, 370,
- 368, 367, 365, 364, 363, 362, 361, 360, 359, 358,
- 357, 356, 355, 354, 353, 352, 349, 348, 347, 346,
- 344, 343, 342, 341, 340, 339, 335, 334, 333, 332,
-
- 330, 329, 328, 327, 321, 320, 319, 318, 317, 316,
- 315, 314, 313, 309, 308, 307, 303, 301, 300, 299,
- 298, 297, 296, 295, 294, 293, 292, 291, 290, 289,
- 288, 287, 286, 285, 284, 283, 281, 280, 278, 277,
- 275, 272, 271, 270, 269, 268, 267, 265, 263, 261,
- 259, 258, 257, 256, 255, 254, 252, 249, 248, 247,
- 246, 245, 244, 243, 242, 240, 239, 238, 237, 236,
- 231, 230, 229, 228, 227, 226, 224, 223, 222, 205,
- 204, 203, 194, 193, 192, 191, 185, 181, 180, 177,
- 172, 171, 169, 168, 167, 165, 164, 163, 162, 161,
-
- 160, 159, 158, 157, 155, 153, 146, 145, 142, 141,
- 140, 139, 138, 133, 131, 129, 127, 126, 125, 122,
- 118, 116, 115, 112, 111, 109, 104, 102, 100, 96,
- 93, 92, 83, 78, 74, 73, 70, 69, 64, 60,
- 56, 55, 54, 50, 49, 47, 46, 45, 44, 43,
- 42, 41, 35, 33, 29, 27, 26, 25, 24, 20,
- 15, 12, 10, 8, 6, 4, 2, 532, 532, 532,
- 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
+ 567, 567, 568, 568, 568, 569, 569, 569, 505, 504,
+ 503, 501, 499, 498, 496, 495, 494, 493, 492, 491,
+
+ 490, 489, 488, 484, 483, 481, 479, 478, 477, 476,
+ 475, 473, 472, 469, 468, 467, 464, 463, 462, 457,
+ 456, 455, 454, 450, 449, 447, 446, 445, 444, 442,
+ 440, 439, 438, 437, 433, 432, 431, 430, 429, 428,
+ 425, 424, 423, 422, 421, 420, 418, 417, 416, 415,
+ 414, 413, 411, 410, 408, 405, 404, 403, 402, 401,
+ 400, 399, 398, 397, 395, 394, 393, 392, 391, 390,
+ 388, 386, 385, 384, 382, 381, 378, 376, 374, 372,
+ 371, 370, 368, 367, 365, 364, 363, 362, 361, 360,
+ 359, 358, 357, 356, 355, 354, 353, 352, 349, 348,
+
+ 347, 346, 344, 343, 342, 341, 340, 339, 335, 334,
+ 333, 332, 330, 329, 328, 327, 321, 320, 319, 318,
+ 317, 316, 315, 314, 313, 309, 308, 307, 303, 301,
+ 300, 299, 298, 297, 296, 295, 294, 293, 292, 291,
+ 290, 289, 288, 287, 286, 285, 284, 283, 281, 280,
+ 278, 277, 275, 272, 271, 270, 269, 268, 267, 265,
+ 263, 261, 259, 258, 257, 256, 255, 254, 252, 249,
+ 248, 247, 246, 245, 244, 243, 242, 240, 239, 238,
+ 237, 236, 231, 230, 229, 228, 227, 226, 224, 223,
+ 222, 205, 204, 203, 194, 193, 192, 191, 185, 181,
+
+ 180, 177, 172, 171, 169, 168, 167, 165, 164, 163,
+ 162, 161, 160, 159, 158, 157, 155, 153, 146, 145,
+ 142, 141, 140, 139, 138, 133, 131, 129, 127, 126,
+ 125, 122, 118, 116, 115, 112, 111, 109, 104, 102,
+ 100, 96, 93, 92, 83, 78, 74, 73, 70, 69,
+ 64, 60, 56, 55, 54, 50, 49, 47, 46, 45,
+ 44, 43, 42, 41, 35, 33, 29, 27, 26, 25,
+ 24, 20, 15, 12, 10, 8, 6, 4, 2, 532,
532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
- 532, 532, 532, 532
+ 532, 532, 532, 532, 532, 532, 532, 532, 532, 532,
+ 532, 532, 532, 532, 532, 532
} ;
static yy_state_type yy_last_accepting_state;
@@ -1575,26 +1577,15 @@ int4 find_symbol(void) {
return -1; // Should never reach here
}
-int4 scan_number(char *numtext,SLEIGHSTYPE *lval,bool signednum)
+int4 scan_number(char *numtext,SLEIGHSTYPE *lval,int4 radix,bool signednum)
{
uintb val;
- if (numtext[0] == '0' && numtext[1] == 'b') {
- val = 0;
- numtext += 2;
- while ((*numtext) != 0) {
- val <<= 1;
- if (*numtext == '1') {
- val |= 1;
- }
- ++numtext;
- }
- } else {
- istringstream s(numtext);
- s.unsetf(ios::dec | ios::hex | ios::oct);
- s >> val;
- if (!s)
- return BADINTEGER;
+ try {
+ val = std::stoul(numtext,(size_t *)0,radix);
+ }
+ catch(...) {
+ return BADINTEGER;
}
if (signednum) {
lval->big = new intb(val);
@@ -1865,7 +1856,7 @@ yy_match:
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
++yy_cp;
}
- while ( yy_base[yy_current_state] != 968 );
+ while ( yy_base[yy_current_state] != 980 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -2100,15 +2091,15 @@ YY_RULE_SETUP
YY_BREAK
case 52:
YY_RULE_SETUP
-{ return scan_number(sleightext,&sleighlval,false); }
+{ return scan_number(sleightext,&sleighlval,10,false); }
YY_BREAK
case 53:
YY_RULE_SETUP
-{ return scan_number(sleightext,&sleighlval,false); }
+{ return scan_number(sleightext+2,&sleighlval,16,false); }
YY_BREAK
case 54:
YY_RULE_SETUP
-{ return scan_number(sleightext,&sleighlval,false); }
+{ return scan_number(sleightext+2,&sleighlval,2,false); }
YY_BREAK
case 55:
YY_RULE_SETUP
@@ -2260,15 +2251,15 @@ YY_RULE_SETUP
YY_BREAK
case 91:
YY_RULE_SETUP
-{ return scan_number(sleightext,&sleighlval,true); }
+{ return scan_number(sleightext,&sleighlval,10,true); }
YY_BREAK
case 92:
YY_RULE_SETUP
-{ return scan_number(sleightext,&sleighlval,true); }
+{ return scan_number(sleightext+2,&sleighlval,16,true); }
YY_BREAK
case 93:
YY_RULE_SETUP
-{ return scan_number(sleightext,&sleighlval,true); }
+{ return scan_number(sleightext+2,&sleighlval,2,true); }
YY_BREAK
case 94:
YY_RULE_SETUP
@@ -2526,15 +2517,15 @@ YY_RULE_SETUP
YY_BREAK
case 157:
YY_RULE_SETUP
-{ return scan_number(sleightext,&sleighlval,false); }
+{ return scan_number(sleightext,&sleighlval,10,false); }
YY_BREAK
case 158:
YY_RULE_SETUP
-{ return scan_number(sleightext,&sleighlval,false); }
+{ return scan_number(sleightext+2,&sleighlval,16,false); }
YY_BREAK
case 159:
YY_RULE_SETUP
-{ return scan_number(sleightext,&sleighlval,false); }
+{ return scan_number(sleightext+2,&sleighlval,2,false); }
YY_BREAK
case 160:
YY_RULE_SETUP
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/slghscan.l b/Ghidra/Features/Decompiler/src/decompile/cpp/slghscan.l
index c831a4791e..1c25962a45 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/slghscan.l
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/slghscan.l
@@ -5,9 +5,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -456,26 +456,15 @@ int4 find_symbol(void) {
return -1; // Should never reach here
}
-int4 scan_number(char *numtext,SLEIGHSTYPE *lval,bool signednum)
+int4 scan_number(char *numtext,SLEIGHSTYPE *lval,int4 radix,bool signednum)
{
uintb val;
- if (numtext[0] == '0' && numtext[1] == 'b') {
- val = 0;
- numtext += 2;
- while ((*numtext) != 0) {
- val <<= 1;
- if (*numtext == '1') {
- val |= 1;
- }
- ++numtext;
- }
- } else {
- istringstream s(numtext);
- s.unsetf(ios::dec | ios::hex | ios::oct);
- s >> val;
- if (!s)
- return BADINTEGER;
+ try {
+ val = std::stoul(numtext,(size_t *)0,radix);
+ }
+ catch(...) {
+ return BADINTEGER;
}
if (signednum) {
lval->big = new intb(val);
@@ -552,9 +541,9 @@ with { BEGIN(pattern); withsection = 1; slgh->calcContextLayout(); return WITH
<defblock>pcodeop { return PCODEOP_KEY; }
<defblock>#.*
<defblock>[a-zA-Z_.][a-zA-Z0-9_.]* { return find_symbol(); }
-<defblock>[0-9]|[1-9][0-9]+ { return scan_number(sleightext,&sleighlval,false); }
-<defblock>0x[0-9a-fA-F]+ { return scan_number(sleightext,&sleighlval,false); }
-<defblock>0b[01]+ { return scan_number(sleightext,&sleighlval,false); }
+<defblock>[0-9]+ { return scan_number(sleightext,&sleighlval,10,false); }
+<defblock>0x[0-9a-fA-F]+ { return scan_number(sleightext+2,&sleighlval,16,false); }
+<defblock>0b[01]+ { return scan_number(sleightext+2,&sleighlval,2,false); }
<defblock>\"([^\"[:cntrl:]]|\"\")*\" { sleighlval.str = new string(sleightext+1,strlen(sleightext)-2); return STRING; }
<defblock>[\r\ \t\v]+
<defblock>\n { slgh->nextLine(); }
@@ -594,9 +583,9 @@ with { BEGIN(pattern); withsection = 1; slgh->calcContextLayout(); return WITH
<pattern>[=(),:;+\-*/~<>] { sleighlval.ch = sleightext[0]; return sleightext[0]; }
<pattern>#.*
<pattern>[a-zA-Z_.][a-zA-Z0-9_.]* { return find_symbol(); }
-<pattern>[0-9]|[1-9][0-9]+ { return scan_number(sleightext,&sleighlval,true); }
-<pattern>0x[0-9a-fA-F]+ { return scan_number(sleightext,&sleighlval,true); }
-<pattern>0b[01]+ { return scan_number(sleightext,&sleighlval,true); }
+<pattern>[0-9]+ { return scan_number(sleightext,&sleighlval,10,true); }
+<pattern>0x[0-9a-fA-F]+ { return scan_number(sleightext+2,&sleighlval,16,true); }
+<pattern>0b[01]+ { return scan_number(sleightext+2,&sleighlval,2,true); }
<pattern>[\r\ \t\v]+
<pattern>\n { slgh->nextLine(); }
<pattern>. { return sleightext[0]; }
@@ -661,9 +650,9 @@ with { BEGIN(pattern); withsection = 1; slgh->calcContextLayout(); return WITH
<sem>[=(),:\[\];!&|^+\-*/%~<>] { sleighlval.ch = sleightext[0]; return sleightext[0]; }
<sem>#.*
<sem>[a-zA-Z_.][a-zA-Z0-9_.]* { return find_symbol(); }
-<sem>[0-9]|[1-9][0-9]+ { return scan_number(sleightext,&sleighlval,false); }
-<sem>0x[0-9a-fA-F]+ { return scan_number(sleightext,&sleighlval,false); }
-<sem>0b[01]+ { return scan_number(sleightext,&sleighlval,false); }
+<sem>[0-9]+ { return scan_number(sleightext,&sleighlval,10,false); }
+<sem>0x[0-9a-fA-F]+ { return scan_number(sleightext+2,&sleighlval,16,false); }
+<sem>0b[01]+ { return scan_number(sleightext+2,&sleighlval,2,false); }
<sem>[\r\ \t\v]+
<sem>\n { slgh->nextLine(); }
<sem>. { return sleightext[0]; }