1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 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 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 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 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542
|
// Generated by Bisonc++ V6.04.01 on Sat, 14 Nov 2020 10:06:30 +0100
// base/comment
// $insert class.ih
#include "parser.ih"
// The FIRST element of SR arrays shown below uses `d_type', defining the
// state's type, and `d_lastIdx' containing the last element's index. If
// d_lastIdx contains the REQ_TOKEN bitflag (see below) then the state needs
// a token: if in this state d_token is Reserved_::UNDETERMINED_, nextToken() will be
// called
// The LAST element of SR arrays uses `d_token' containing the last retrieved
// token to speed up the (linear) seach. Except for the first element of SR
// arrays, the field `d_action' is used to determine what to do next. If
// positive, it represents the next state (used with SHIFT); if zero, it
// indicates `ACCEPT', if negative, -d_action represents the number of the
// rule to reduce to.
// `lookup()' tries to find d_token in the current SR array. If it fails, and
// there is no default reduction UNEXPECTED_TOKEN_ is thrown, which is then
// caught by the error-recovery function.
// The error-recovery function will pop elements off the stack until a state
// having bit flag ERR_ITEM is found. This state has a transition on errTok_
// which is applied. In this errTok_ state, while the current token is not a
// proper continuation, new tokens are obtained by nextToken(). If such a
// token is found, error recovery is successful and the token is
// handled according to the error state's SR table and parsing continues.
// During error recovery semantic actions are ignored.
// A state flagged with the DEF_RED flag will perform a default
// reduction if no other continuations are available for the current token.
// The ACCEPT STATE never shows a default reduction: when it is reached the
// parser returns ACCEPT(). During the grammar
// analysis phase a default reduction may have been defined, but it is
// removed during the state-definition phase.
// So:
// s_x[] =
// {
// [_field_1_] [_field_2_]
//
// First element: {state-type, idx of last element},
// Other elements: {required token, action to perform},
// ( < 0: reduce,
// 0: ACCEPT,
// > 0: next state)
// }
// base/declarations
namespace // anonymous
{
char const author[] = "Frank B. Brokken (f.b.brokken@rug.nl)";
enum Reserved_
{
UNDETERMINED_ = -2,
EOF_ = -1,
errTok_ = 256
};
enum StateType // modify statetype/data.cc when this enum changes
{
NORMAL,
ERR_ITEM,
REQ_TOKEN,
ERR_REQ, // ERR_ITEM | REQ_TOKEN
DEF_RED, // state having default reduction
ERR_DEF, // ERR_ITEM | DEF_RED
REQ_DEF, // REQ_TOKEN | DEF_RED
ERR_REQ_DEF // ERR_ITEM | REQ_TOKEN | DEF_RED
};
inline bool operator&(StateType lhs, StateType rhs)
{
return (static_cast<int>(lhs) & rhs) != 0;
}
enum StateTransition
{
ACCEPT_ = 0, // `ACCEPT' TRANSITION
};
struct PI_ // Production Info
{
size_t d_nonTerm; // identification number of this production's
// non-terminal
size_t d_size; // number of elements in this production
};
struct SR_ // Shift Reduce info, see its description above
{
union
{
int _field_1_; // initializer, allowing initializations
// of the SR s_[] arrays
StateType d_type;
int d_token;
};
union
{
int _field_2_;
int d_lastIdx; // if negative, the state uses SHIFT
int d_action; // may be negative (reduce),
// postive (shift), or 0 (accept)
};
};
// $insert staticdata
enum // size to expand the state-stack with when
{ // full
STACK_EXPANSION_ = 10
};
// Productions Info Records:
PI_ const s_productionInfo[] =
{
{0, 0}, // not used: reduction values are negative
{270, 2}, // 1: startrule -> startrule line
{270, 0}, // 2: startrule -> <empty>
{272, 1}, // 3: nr (NR) -> NR
{273, 0}, // 4: opt_nr_step -> <empty>
{273, 2}, // 5: opt_nr_step ('/') -> '/' nr
{274, 1}, // 6: nr_add -> nr
{275, 4}, // 7: nr_range ('-') -> nr '-' nr opt_nr_step
{275, 1}, // 8: nr_range -> nr_add
{276, 3}, // 9: nr_Sequence (',') -> nr_Sequence ',' nr_range
{276, 1}, // 10: nr_Sequence -> nr_range
{277, 1}, // 11: opt_ws (WS) -> WS
{277, 0}, // 12: opt_ws -> <empty>
{278, 1}, // 13: _tokenNoWs (NR) -> NR
{278, 1}, // 14: _tokenNoWs (ID) -> ID
{278, 1}, // 15: _tokenNoWs ('*') -> '*'
{278, 1}, // 16: _tokenNoWs ('/') -> '/'
{278, 1}, // 17: _tokenNoWs (',') -> ','
{278, 1}, // 18: _tokenNoWs ('-') -> '-'
{278, 1}, // 19: _tokenNoWs (CHAR) -> CHAR
{278, 1}, // 20: _tokenNoWs ('=') -> '='
{279, 1}, // 21: _tokenAny (WS) -> WS
{279, 1}, // 22: _tokenAny -> _tokenNoWs
{280, 0}, // 23: _tokenMatched -> <empty>
{281, 2}, // 24: _tokenAnyMatched -> _tokenAny _tokenMatched
{282, 2}, // 25: token_noWs -> _tokenNoWs _tokenMatched
{283, 2}, // 26: tokens -> tokens _tokenAny
{283, 1}, // 27: tokens -> _tokenAnyMatched
{284, 1}, // 28: opt_tokens -> tokens
{284, 0}, // 29: opt_tokens -> <empty>
{285, 3}, // 30: _nameContents ('=') -> opt_ws '=' opt_tokens
{286, 1}, // 31: _nameID (ID) -> ID
{287, 2}, // 32: nameLine -> _nameID _nameContents
{288, 2}, // 33: _all ('*') -> '*' opt_nr_step
{289, 1}, // 34: _timeUnit -> nr_range
{289, 1}, // 35: _timeUnit (ID) -> ID
{290, 3}, // 36: _timeSequence (',') -> _timeSequence ',' _timeUnit
{290, 1}, // 37: _timeSequence -> _timeUnit
{291, 1}, // 38: time_numberedSpec -> _all
{291, 1}, // 39: time_numberedSpec -> nr_Sequence
{292, 1}, // 40: time_spec -> _all
{292, 1}, // 41: time_spec -> _timeSequence
{293, 2}, // 42: _minutes (WS) -> time_numberedSpec WS
{294, 2}, // 43: _hours (WS) -> time_numberedSpec WS
{295, 2}, // 44: _dayOfMonth (WS) -> time_numberedSpec WS
{296, 2}, // 45: _monthOfYear (WS) -> time_spec WS
{297, 2}, // 46: _dayOfWeek (WS) -> time_spec WS
{298, 2}, // 47: _command -> token_noWs opt_tokens
{299, 6}, // 48: cronLine -> _minutes _hours _dayOfMonth _monthOfYear _dayOfWeek _command
{300, 1}, // 49: _line_contents -> nameLine
{300, 1}, // 50: _line_contents -> cronLine
{300, 1}, // 51: _line_contents (errTok_) -> errTok_
{301, 0}, // 52: _line_preamble -> <empty>
{302, 2}, // 53: _opt_line_contents -> _line_preamble _line_contents
{302, 0}, // 54: _opt_line_contents -> <empty>
{271, 2}, // 55: line ('\x0a') -> _opt_line_contents '\x0a'
{303, 1}, // 56: startrule_$ -> startrule
};
// State info and SR_ transitions for each state.
SR_ s_0[] =
{
{ { DEF_RED}, { 2} },
{ { 270}, { 1} }, // startrule
{ { 0}, { -2} },
};
SR_ s_1[] =
{
{ { REQ_DEF}, { 6} },
{ { 271}, { 2} }, // line
{ { 302}, { 3} }, // _opt_line_contents
{ { 301}, { 4} }, // _line_preamble
{ { EOF_}, { ACCEPT_} },
{ { 10}, { -54} }, // '\x0a'
{ { 0}, { -52} },
};
SR_ s_2[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -1} },
};
SR_ s_3[] =
{
{ { REQ_TOKEN}, { 2} },
{ { 10}, { 5} }, // '\x0a'
{ { 0}, { 0} },
};
SR_ s_4[] =
{
{ { ERR_REQ}, { 16} },
{ { 300}, { 6} }, // _line_contents
{ { 287}, { 7} }, // nameLine
{ { 299}, { 8} }, // cronLine
{ { errTok_}, { 9} }, // errTok_
{ { 286}, { 10} }, // _nameID
{ { 293}, { 11} }, // _minutes
{ { 259}, { 12} }, // ID
{ { 291}, { 13} }, // time_numberedSpec
{ { 288}, { 14} }, // _all
{ { 276}, { 15} }, // nr_Sequence
{ { 42}, { 16} }, // '*'
{ { 275}, { 17} }, // nr_range
{ { 272}, { 18} }, // nr
{ { 274}, { 19} }, // nr_add
{ { 258}, { 20} }, // NR
{ { 0}, { 0} },
};
SR_ s_5[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -55} },
};
SR_ s_6[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -53} },
};
SR_ s_7[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -49} },
};
SR_ s_8[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -50} },
};
SR_ s_9[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -51} },
};
SR_ s_10[] =
{
{ { REQ_DEF}, { 4} },
{ { 285}, { 21} }, // _nameContents
{ { 277}, { 22} }, // opt_ws
{ { 257}, { 23} }, // WS
{ { 0}, { -12} },
};
SR_ s_11[] =
{
{ { REQ_TOKEN}, { 10} },
{ { 294}, { 24} }, // _hours
{ { 291}, { 25} }, // time_numberedSpec
{ { 288}, { 14} }, // _all
{ { 276}, { 15} }, // nr_Sequence
{ { 42}, { 16} }, // '*'
{ { 275}, { 17} }, // nr_range
{ { 272}, { 18} }, // nr
{ { 274}, { 19} }, // nr_add
{ { 258}, { 20} }, // NR
{ { 0}, { 0} },
};
SR_ s_12[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -31} },
};
SR_ s_13[] =
{
{ { REQ_TOKEN}, { 2} },
{ { 257}, { 26} }, // WS
{ { 0}, { 0} },
};
SR_ s_14[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -38} },
};
SR_ s_15[] =
{
{ { REQ_DEF}, { 2} },
{ { 44}, { 27} }, // ','
{ { 0}, { -39} },
};
SR_ s_16[] =
{
{ { REQ_DEF}, { 3} },
{ { 273}, { 28} }, // opt_nr_step
{ { 47}, { 29} }, // '/'
{ { 0}, { -4} },
};
SR_ s_17[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -10} },
};
SR_ s_18[] =
{
{ { REQ_DEF}, { 2} },
{ { 45}, { 30} }, // '-'
{ { 0}, { -6} },
};
SR_ s_19[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -8} },
};
SR_ s_20[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -3} },
};
SR_ s_21[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -32} },
};
SR_ s_22[] =
{
{ { REQ_TOKEN}, { 2} },
{ { 61}, { 31} }, // '='
{ { 0}, { 0} },
};
SR_ s_23[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -11} },
};
SR_ s_24[] =
{
{ { REQ_TOKEN}, { 10} },
{ { 295}, { 32} }, // _dayOfMonth
{ { 291}, { 33} }, // time_numberedSpec
{ { 288}, { 14} }, // _all
{ { 276}, { 15} }, // nr_Sequence
{ { 42}, { 16} }, // '*'
{ { 275}, { 17} }, // nr_range
{ { 272}, { 18} }, // nr
{ { 274}, { 19} }, // nr_add
{ { 258}, { 20} }, // NR
{ { 0}, { 0} },
};
SR_ s_25[] =
{
{ { REQ_TOKEN}, { 2} },
{ { 257}, { 34} }, // WS
{ { 0}, { 0} },
};
SR_ s_26[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -42} },
};
SR_ s_27[] =
{
{ { REQ_TOKEN}, { 5} },
{ { 275}, { 35} }, // nr_range
{ { 272}, { 18} }, // nr
{ { 274}, { 19} }, // nr_add
{ { 258}, { 20} }, // NR
{ { 0}, { 0} },
};
SR_ s_28[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -33} },
};
SR_ s_29[] =
{
{ { REQ_TOKEN}, { 3} },
{ { 272}, { 36} }, // nr
{ { 258}, { 20} }, // NR
{ { 0}, { 0} },
};
SR_ s_30[] =
{
{ { REQ_TOKEN}, { 3} },
{ { 272}, { 37} }, // nr
{ { 258}, { 20} }, // NR
{ { 0}, { 0} },
};
SR_ s_31[] =
{
{ { REQ_DEF}, { 15} },
{ { 284}, { 38} }, // opt_tokens
{ { 283}, { 39} }, // tokens
{ { 281}, { 40} }, // _tokenAnyMatched
{ { 279}, { 41} }, // _tokenAny
{ { 257}, { 42} }, // WS
{ { 278}, { 43} }, // _tokenNoWs
{ { 258}, { 44} }, // NR
{ { 259}, { 45} }, // ID
{ { 42}, { 46} }, // '*'
{ { 47}, { 47} }, // '/'
{ { 44}, { 48} }, // ','
{ { 45}, { 49} }, // '-'
{ { 260}, { 50} }, // CHAR
{ { 61}, { 51} }, // '='
{ { 0}, { -29} },
};
SR_ s_32[] =
{
{ { REQ_TOKEN}, { 12} },
{ { 296}, { 52} }, // _monthOfYear
{ { 292}, { 53} }, // time_spec
{ { 288}, { 54} }, // _all
{ { 290}, { 55} }, // _timeSequence
{ { 42}, { 16} }, // '*'
{ { 289}, { 56} }, // _timeUnit
{ { 275}, { 57} }, // nr_range
{ { 259}, { 58} }, // ID
{ { 272}, { 18} }, // nr
{ { 274}, { 19} }, // nr_add
{ { 258}, { 20} }, // NR
{ { 0}, { 0} },
};
SR_ s_33[] =
{
{ { REQ_TOKEN}, { 2} },
{ { 257}, { 59} }, // WS
{ { 0}, { 0} },
};
SR_ s_34[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -43} },
};
SR_ s_35[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -9} },
};
SR_ s_36[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -5} },
};
SR_ s_37[] =
{
{ { REQ_DEF}, { 3} },
{ { 273}, { 60} }, // opt_nr_step
{ { 47}, { 29} }, // '/'
{ { 0}, { -4} },
};
SR_ s_38[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -30} },
};
SR_ s_39[] =
{
{ { REQ_DEF}, { 12} },
{ { 279}, { 61} }, // _tokenAny
{ { 257}, { 42} }, // WS
{ { 278}, { 43} }, // _tokenNoWs
{ { 258}, { 44} }, // NR
{ { 259}, { 45} }, // ID
{ { 42}, { 46} }, // '*'
{ { 47}, { 47} }, // '/'
{ { 44}, { 48} }, // ','
{ { 45}, { 49} }, // '-'
{ { 260}, { 50} }, // CHAR
{ { 61}, { 51} }, // '='
{ { 0}, { -28} },
};
SR_ s_40[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -27} },
};
SR_ s_41[] =
{
{ { DEF_RED}, { 2} },
{ { 280}, { 62} }, // _tokenMatched
{ { 0}, { -23} },
};
SR_ s_42[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -21} },
};
SR_ s_43[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -22} },
};
SR_ s_44[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -13} },
};
SR_ s_45[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -14} },
};
SR_ s_46[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -15} },
};
SR_ s_47[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -16} },
};
SR_ s_48[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -17} },
};
SR_ s_49[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -18} },
};
SR_ s_50[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -19} },
};
SR_ s_51[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -20} },
};
SR_ s_52[] =
{
{ { REQ_TOKEN}, { 12} },
{ { 297}, { 63} }, // _dayOfWeek
{ { 292}, { 64} }, // time_spec
{ { 288}, { 54} }, // _all
{ { 290}, { 55} }, // _timeSequence
{ { 42}, { 16} }, // '*'
{ { 289}, { 56} }, // _timeUnit
{ { 275}, { 57} }, // nr_range
{ { 259}, { 58} }, // ID
{ { 272}, { 18} }, // nr
{ { 274}, { 19} }, // nr_add
{ { 258}, { 20} }, // NR
{ { 0}, { 0} },
};
SR_ s_53[] =
{
{ { REQ_TOKEN}, { 2} },
{ { 257}, { 65} }, // WS
{ { 0}, { 0} },
};
SR_ s_54[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -40} },
};
SR_ s_55[] =
{
{ { REQ_DEF}, { 2} },
{ { 44}, { 66} }, // ','
{ { 0}, { -41} },
};
SR_ s_56[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -37} },
};
SR_ s_57[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -34} },
};
SR_ s_58[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -35} },
};
SR_ s_59[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -44} },
};
SR_ s_60[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -7} },
};
SR_ s_61[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -26} },
};
SR_ s_62[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -24} },
};
SR_ s_63[] =
{
{ { REQ_TOKEN}, { 12} },
{ { 298}, { 67} }, // _command
{ { 282}, { 68} }, // token_noWs
{ { 278}, { 69} }, // _tokenNoWs
{ { 258}, { 44} }, // NR
{ { 259}, { 45} }, // ID
{ { 42}, { 46} }, // '*'
{ { 47}, { 47} }, // '/'
{ { 44}, { 48} }, // ','
{ { 45}, { 49} }, // '-'
{ { 260}, { 50} }, // CHAR
{ { 61}, { 51} }, // '='
{ { 0}, { 0} },
};
SR_ s_64[] =
{
{ { REQ_TOKEN}, { 2} },
{ { 257}, { 70} }, // WS
{ { 0}, { 0} },
};
SR_ s_65[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -45} },
};
SR_ s_66[] =
{
{ { REQ_TOKEN}, { 7} },
{ { 289}, { 71} }, // _timeUnit
{ { 275}, { 57} }, // nr_range
{ { 259}, { 58} }, // ID
{ { 272}, { 18} }, // nr
{ { 274}, { 19} }, // nr_add
{ { 258}, { 20} }, // NR
{ { 0}, { 0} },
};
SR_ s_67[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -48} },
};
SR_ s_68[] =
{
{ { REQ_DEF}, { 15} },
{ { 284}, { 72} }, // opt_tokens
{ { 283}, { 39} }, // tokens
{ { 281}, { 40} }, // _tokenAnyMatched
{ { 279}, { 41} }, // _tokenAny
{ { 257}, { 42} }, // WS
{ { 278}, { 43} }, // _tokenNoWs
{ { 258}, { 44} }, // NR
{ { 259}, { 45} }, // ID
{ { 42}, { 46} }, // '*'
{ { 47}, { 47} }, // '/'
{ { 44}, { 48} }, // ','
{ { 45}, { 49} }, // '-'
{ { 260}, { 50} }, // CHAR
{ { 61}, { 51} }, // '='
{ { 0}, { -29} },
};
SR_ s_69[] =
{
{ { DEF_RED}, { 2} },
{ { 280}, { 73} }, // _tokenMatched
{ { 0}, { -23} },
};
SR_ s_70[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -46} },
};
SR_ s_71[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -36} },
};
SR_ s_72[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -47} },
};
SR_ s_73[] =
{
{ { DEF_RED}, { 1} },
{ { 0}, { -25} },
};
// State array:
SR_ *s_state[] =
{
s_0, s_1, s_2, s_3, s_4, s_5, s_6, s_7, s_8, s_9,
s_10, s_11, s_12, s_13, s_14, s_15, s_16, s_17, s_18, s_19,
s_20, s_21, s_22, s_23, s_24, s_25, s_26, s_27, s_28, s_29,
s_30, s_31, s_32, s_33, s_34, s_35, s_36, s_37, s_38, s_39,
s_40, s_41, s_42, s_43, s_44, s_45, s_46, s_47, s_48, s_49,
s_50, s_51, s_52, s_53, s_54, s_55, s_56, s_57, s_58, s_59,
s_60, s_61, s_62, s_63, s_64, s_65, s_66, s_67, s_68, s_69,
s_70, s_71, s_72, s_73,
};
} // anonymous namespace ends
// $insert polymorphicCode
namespace Meta_
{
size_t const *t_nErrors;
// $insert idoftag
char const *idOfTag_[] = {
"INT",
"STRING",
"<undefined>"
};
size_t const *s_nErrors_;
Base::~Base()
{}
} // namespace Meta_
// If the parsing function call (i.e., parse()' needs arguments, then provide
// an overloaded function. The code below doesn't rely on parameters, so no
// arguments are required. Furthermore, parse uses a function try block to
// allow us to do ACCEPT and ABORT from anywhere, even from within members
// called by actions, simply throwing the appropriate exceptions.
// base/base1
ParserBase::ParserBase()
:
d_token(Reserved_::UNDETERMINED_),
// $insert baseclasscode
d_requiredTokens_(0)
{
Meta_::t_nErrors = &d_nErrors_;
}
// base/clearin
void ParserBase::clearin_()
{
d_nErrors_ = 0;
d_stackIdx = -1;
d_stateStack.clear();
d_token = Reserved_::UNDETERMINED_;
d_next = TokenPair{ Reserved_::UNDETERMINED_, STYPE_{} };
d_recovery = false;
d_acceptedTokens_ = d_requiredTokens_;
d_val_ = STYPE_{};
push_(0);
}
// base/debugfunctions
void ParserBase::setDebug(bool mode)
{
d_actionCases_ = false;
d_debug_ = mode;
}
void ParserBase::setDebug(DebugMode_ mode)
{
d_actionCases_ = mode & ACTIONCASES;
d_debug_ = mode & ON;
}
// base/lex
void ParserBase::lex_(int token)
{
d_token = token;
if (d_token <= 0)
d_token = Reserved_::EOF_;
d_terminalToken = true;
}
// base/lookup
int ParserBase::lookup_() const
{
// if the final transition is negative, then we should reduce by the rule
// given by its positive value.
SR_ const *sr = s_state[d_state];
SR_ const *last = sr + sr->d_lastIdx;
for ( ; ++sr != last; ) // visit all but the last SR entries
{
if (sr->d_token == d_token)
return sr->d_action;
}
if (sr == last) // reached the last element
{
if (sr->d_action < 0) // default reduction
{
return sr->d_action;
}
// No default reduction, so token not found, so error.
throw UNEXPECTED_TOKEN_;
}
// not at the last element: inspect the nature of the action
// (< 0: reduce, 0: ACCEPT, > 0: shift)
int action = sr->d_action;
return action;
}
// base/pop
void ParserBase::pop_(size_t count)
{
if (d_stackIdx < static_cast<int>(count))
{
ABORT();
}
d_stackIdx -= count;
d_state = d_stateStack[d_stackIdx].first;
d_vsp = &d_stateStack[d_stackIdx];
}
// base/poptoken
void ParserBase::popToken_()
{
d_token = d_next.first;
d_val_ = std::move(d_next.second);
d_next.first = Reserved_::UNDETERMINED_;
}
// base/push
void ParserBase::push_(size_t state)
{
size_t currentSize = d_stateStack.size();
if (stackSize_() == currentSize)
{
size_t newSize = currentSize + STACK_EXPANSION_;
d_stateStack.resize(newSize);
}
++d_stackIdx;
d_stateStack[d_stackIdx] =
StatePair{ d_state = state, std::move(d_val_) };
d_vsp = &d_stateStack[d_stackIdx];
if (d_stackIdx == 0)
{
}
else
{
}
}
// base/pushtoken
void ParserBase::pushToken_(int token)
{
d_next = TokenPair{ d_token, std::move(d_val_) };
d_token = token;
}
// base/redotoken
void ParserBase::redoToken_()
{
if (d_token != Reserved_::UNDETERMINED_)
pushToken_(d_token);
}
// base/reduce
void ParserBase::reduce_(int rule)
{
PI_ const &pi = s_productionInfo[rule];
d_token = pi.d_nonTerm;
pop_(pi.d_size);
d_terminalToken = false;
}
// base/shift
void ParserBase::shift_(int action)
{
push_(action);
popToken_(); // token processed
if (d_recovery and d_terminalToken)
{
d_recovery = false;
d_acceptedTokens_ = 0;
}
}
// base/startrecovery
void ParserBase::startRecovery_()
{
int lastToken = d_token; // give the unexpected token a
// chance to be processed
// again.
pushToken_(Reserved_::errTok_); // specify errTok_ as next token
push_(lookup_()); // push the error state
d_token = lastToken; // reactivate the unexpected
// token (we're now in an
// ERROR state).
d_recovery = true;
}
// base/top
inline size_t ParserBase::top_() const
{
return d_stateStack[d_stackIdx].first;
}
// derived/errorrecovery
void Parser::errorRecovery_()
{
// When an error has occurred, pop elements off the stack until the top
// state has an error-item. If none is found, the default recovery
// mode (which is to abort) is activated.
//
// If EOF is encountered without being appropriate for the current state,
// then the error recovery will fall back to the default recovery mode.
// (i.e., parsing terminates)
if (d_acceptedTokens_ >= d_requiredTokens_)// only generate an error-
{ // message if enough tokens
++d_nErrors_; // were accepted. Otherwise
error(); // simply skip input
}
// get the error state
while (not (s_state[top_()][0].d_type & ERR_ITEM))
{
pop_();
}
// In the error state, looking up a token allows us to proceed.
// Continuation may be require multiple reductions, but eventually a
// terminal-token shift is used. See nextCycle_ for details.
startRecovery_();
}
// derived/executeaction
void Parser::executeAction_(int production)
try
{
if (token_() != Reserved_::UNDETERMINED_)
pushToken_(token_()); // save an already available token
switch (production)
{
// $insert actioncases
case 1:
#line 19 "grammar"
{
d_val_ = std::move(vs_(-1));
}
break;
case 3:
#line 3 "inc/nr"
{
d_val_ = stol(d_scanner.matched());
}
break;
case 4:
#line 10 "inc/nr"
{
d_val_ = 1;
}
break;
case 5:
#line 15 "inc/nr"
{
d_val_ = vs_(0).get<Tag_::INT>();
}
break;
case 6:
#line 22 "inc/nr"
{
d_cronData.addNr(vs_(0).get<Tag_::INT>());
}
break;
case 7:
#line 30 "inc/nr"
{
d_cronData.addRange(vs_(-3).get<Tag_::INT>(), vs_(-1).get<Tag_::INT>(), vs_(0).get<Tag_::INT>());
}
break;
case 8:
#line 35 "inc/nr"
{
d_val_ = std::move(vs_(0));
}
break;
case 9:
#line 39 "inc/nr"
{
d_val_ = std::move(vs_(-2));
}
break;
case 10:
#line 41 "inc/nr"
{
d_val_ = std::move(vs_(0));
}
break;
case 11:
#line 3 "inc/ws"
{
d_val_ = std::move(vs_(0));
}
break;
case 13:
#line 3 "inc/token"
{
d_val_ = std::move(vs_(0));
}
break;
case 14:
#line 5 "inc/token"
{
d_val_ = std::move(vs_(0));
}
break;
case 15:
#line 7 "inc/token"
{
d_val_ = std::move(vs_(0));
}
break;
case 16:
#line 9 "inc/token"
{
d_val_ = std::move(vs_(0));
}
break;
case 17:
#line 11 "inc/token"
{
d_val_ = std::move(vs_(0));
}
break;
case 18:
#line 13 "inc/token"
{
d_val_ = std::move(vs_(0));
}
break;
case 19:
#line 15 "inc/token"
{
d_val_ = std::move(vs_(0));
}
break;
case 20:
#line 17 "inc/token"
{
d_val_ = std::move(vs_(0));
}
break;
case 21:
#line 21 "inc/token"
{
d_val_ = std::move(vs_(0));
}
break;
case 22:
#line 23 "inc/token"
{
d_val_ = std::move(vs_(0));
}
break;
case 23:
#line 26 "inc/token"
{
d_val_ = d_scanner.matched();
}
break;
case 24:
#line 35 "inc/token"
{
d_val_ = vs_(0).get<Tag_::STRING>();
}
break;
case 25:
#line 43 "inc/token"
{
d_val_ = vs_(0).get<Tag_::STRING>();
}
break;
case 26:
#line 50 "inc/token"
{
d_val_ = vs_(-1).get<Tag_::STRING>() + d_scanner.matched();
}
break;
case 27:
#line 55 "inc/token"
{
d_val_ = vs_(0).get<Tag_::STRING>();
}
break;
case 28:
#line 62 "inc/token"
{
d_val_ = std::move(vs_(0));
}
break;
case 29:
#line 63 "inc/token"
{
d_val_ = string{};
}
break;
case 30:
#line 8 "inc/nameline"
{
d_val_ = vs_(0).get<Tag_::STRING>();
}
break;
case 31:
#line 15 "inc/nameline"
{
d_val_ = d_scanner.matched();
}
break;
case 32:
#line 22 "inc/nameline"
{
d_cronData.setEnvVar(vs_(-1).get<Tag_::STRING>(), vs_(0).get<Tag_::STRING>());
}
break;
case 33:
#line 3 "inc/time"
{
d_cronData.setAll(vs_(0).get<Tag_::INT>());
}
break;
case 34:
#line 10 "inc/time"
{
d_val_ = std::move(vs_(0));
}
break;
case 35:
#line 12 "inc/time"
{
d_cronData.addName(d_scanner.matched());
}
break;
case 36:
#line 19 "inc/time"
{
d_val_ = std::move(vs_(-2));
}
break;
case 37:
#line 21 "inc/time"
{
d_val_ = std::move(vs_(0));
}
break;
case 38:
#line 27 "inc/time"
{
d_val_ = std::move(vs_(0));
}
break;
case 39:
#line 29 "inc/time"
{
d_val_ = std::move(vs_(0));
}
break;
case 40:
#line 34 "inc/time"
{
d_val_ = std::move(vs_(0));
}
break;
case 41:
#line 36 "inc/time"
{
d_val_ = std::move(vs_(0));
}
break;
case 42:
#line 4 "inc/cronline"
{
d_cronData.setMinutes();
}
break;
case 43:
#line 12 "inc/cronline"
{
d_cronData.setHours();
}
break;
case 44:
#line 20 "inc/cronline"
{
d_cronData.setDayOfMonth();
}
break;
case 45:
#line 28 "inc/cronline"
{
d_cronData.setMonthOfYear();
}
break;
case 46:
#line 36 "inc/cronline"
{
d_cronData.setDayOfWeek();
}
break;
case 47:
#line 44 "inc/cronline"
{
d_cronData.setCommand(vs_(-1).get<Tag_::STRING>() + vs_(0).get<Tag_::STRING>());
}
break;
case 48:
#line 51 "inc/cronline"
{
d_cronData.process();
}
break;
case 49:
#line 3 "inc/line"
{
d_val_ = std::move(vs_(0));
}
break;
case 50:
#line 5 "inc/line"
{
d_val_ = std::move(vs_(0));
}
break;
case 51:
#line 7 "inc/line"
{
d_val_ = std::move(vs_(0));
}
break;
case 52:
#line 10 "inc/line"
{
d_cronData.reset(d_scanner.lineNr());
}
break;
case 53:
#line 17 "inc/line"
{
d_val_ = std::move(vs_(-1));
}
break;
case 55:
#line 23 "inc/line"
{
d_val_ = std::move(vs_(-1));
}
break;
}
}
catch (std::exception const &exc)
{
exceptionHandler(exc);
}
// derived/nextcycle
void Parser::nextCycle_()
try
{
if (s_state[state_()]->d_type & REQ_TOKEN)
nextToken_(); // obtain next token
int action = lookup_(); // lookup d_token in d_state
if (action > 0) // SHIFT: push a new state
{
shift_(action);
return;
}
if (action < 0) // REDUCE: execute and pop.
{
if (recovery_())
redoToken_();
else
executeAction_(-action);
// next token is the rule's LHS
reduce_(-action);
return;
}
if (recovery_())
ABORT();
else
ACCEPT();
}
catch (ErrorRecovery_)
{
if (not recovery_())
errorRecovery_();
else
{
if (token_() == Reserved_::EOF_)
ABORT();
popToken_(); // skip the failing token
}
}
// derived/nexttoken
void Parser::nextToken_()
{
// If d_token is Reserved_::UNDETERMINED_ then if savedToken_() is
// Reserved_::UNDETERMINED_ another token is obtained from lex(). Then
// savedToken_() is assigned to d_token.
// no need for a token: got one already
if (token_() != Reserved_::UNDETERMINED_)
{
return;
}
if (savedToken_() != Reserved_::UNDETERMINED_)
{
popToken_(); // consume pending token
}
else
{
++d_acceptedTokens_; // accept another token (see
// errorRecover())
lex_(lex());
print_();
}
print();
}
// derived/print
void Parser::print_()
{
// $insert print
}
// derived/parse
int Parser::parse()
try
{
// The parsing algorithm:
// Initially, state 0 is pushed on the stack, and all relevant variables
// are initialized by Base::clearin_.
//
// Then, in an eternal loop:
//
// 1. If a state is a REQ_TOKEN type, then the next token is obtained
// from nextToken(). This may very well be the currently available
// token. When retrieving a terminal token d_terminal is set to true.
//
// 2. lookup() is called, d_token is looked up in the current state's
// SR_ array.
//
// 4. Depending on the result of the lookup() function the next state is
// shifted on the parser's stack, a reduction by some rule is applied,
// or the parsing function returns ACCEPT(). When a reduction is
// called for, any action that may have been defined for that
// reduction is executed.
//
// 5. An error occurs if d_token is not found, and the state has no
// default reduction.
clearin_(); // initialize, push(0)
while (true)
{
// $insert prompt
nextCycle_();
}
}
catch (Return_ retValue)
{
return retValue or d_nErrors_;
}
// derived/tail
|