1<< 2/* parser.dlg -- DLG Description of scanner 3 * 4 * Generated from: antlr.g 5 * 6 * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001 7 * Purdue University Electrical Engineering 8 * With AHPCRC, University of Minnesota 9 * ANTLR Version 1.33MR33 10 */ 11 12#define ANTLR_VERSION 13333 13#include "pcctscfg.h" 14#include "pccts_stdio.h" 15 16#include "pcctscfg.h" 17#include "set.h" 18#include <ctype.h> 19#include "syn.h" 20#include "hash.h" 21#include "generic.h" 22#define zzcr_attr(attr,tok,t) 23#include "antlr.h" 24#include "tokens.h" 25#include "dlgdef.h" 26LOOKAHEAD 27 28void 29#ifdef __USE_PROTOS 30zzerraction(void) 31#else 32zzerraction() 33#endif 34{ 35 (*zzerr)("invalid token"); 36 zzadvance(); 37 zzskip(); 38} 39>> 40 41<<%%lexaction 42 43/* maintained, but not used for now */ 44set AST_nodes_refd_in_actions = set_init; 45int inAlt = 0; 46set attribsRefdFromAction = set_init; /* MR20 */ 47int UsedOldStyleAttrib = 0; 48int UsedNewStyleLabel = 0; 49#ifdef __USE_PROTOS 50char *inline_set(char *); 51#else 52char *inline_set(); 53#endif 54 55/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */ 56/* MR1 in DLG action */ 57 58int tokenActionActive=0; /* MR1 */ 59 60 61>> 62 63<<%%lexaction 64 65 66static char * 67#ifdef __USE_PROTOS 68getFileNameFromTheLineInfo(char *toStr, char *fromStr) 69#else 70getFileNameFromTheLineInfo(toStr, fromStr) 71char *toStr, *fromStr; 72#endif 73{ 74 int i, j, k; 75 76 if (!fromStr || !toStr) return toStr; 77 78 /* find the first " */ 79 80 for (i=0; 81 (i<MaxFileName) && 82 (fromStr[i] != '\n') && 83 (fromStr[i] != '\r') && 84 (fromStr[i] != '\"'); 85 i++) /* nothing */ ; 86 87 if ( (i == MaxFileName) || 88 (fromStr[i] == '\n') || 89 (fromStr[i] == '\r') ) { 90 return toStr; 91} 92 93 /* find the second " */ 94 95 for (j=i+1; 96(j<MaxFileName) && 97(fromStr[j] != '\n') && 98(fromStr[j] != '\r') && 99(fromStr[j] != '\"'); 100j++) /* nothing */ ; 101 102 if ((j == MaxFileName) || 103(fromStr[j] == '\n') || 104(fromStr[j] == '\r') ) { 105 return toStr; 106} 107 108 /* go back until the last / or \ */ 109 110 for (k=j-1; 111(fromStr[k] != '\"') && 112(fromStr[k] != '/') && 113(fromStr[k] != '\\'); 114k--) /* nothing */ ; 115 116 /* copy the string after " / or \ into toStr */ 117 118 for (i=k+1; fromStr[i] != '\"'; i++) { 119toStr[i-k-1] = fromStr[i]; 120} 121 122 toStr[i-k-1] = '\0'; 123 124 return toStr; 125} 126 127/* MR14 end of a block to support #line in antlr source code */ 128 129 130>> 131 132<<%%lexaction 133 134#ifdef __USE_PROTOS 135void mark_label_used_in_sem_pred(LabelEntry *le) /* MR10 */ 136#else 137void mark_label_used_in_sem_pred(le) /* MR10 */ 138LabelEntry *le; 139#endif 140{ 141 TokNode *tn; 142 require (le->elem->ntype == nToken,"mark_label_used... ntype != nToken"); 143 tn=(TokNode *)le->elem; 144 require (tn->label != 0,"mark_label_used... TokNode has no label"); 145 tn->label_used_in_semantic_pred=1; 146} 147>> 148 149 150%%START 151 152@ 153 << 154 NLA = Eof; 155 /* L o o k F o r A n o t h e r F i l e */ 156 { 157 FILE *new_input; 158 new_input = NextFile(); 159 if ( new_input == NULL ) { NLA=Eof; return; } 160 fclose( input ); 161 input = new_input; 162 zzrdstream( input ); 163 zzskip(); /* Skip the Eof (@) char i.e continue */ 164 } 165 >> 166 167[\t\ ]+ 168 << 169 NLA = 76; 170 zzskip(); 171 >> 172 173\n|\r|\r\n 174 << 175 NLA = 77; 176 zzline++; zzskip(); 177 >> 178 179\[ 180 << 181 NLA = 78; 182 zzmode(ACTIONS); zzmore(); 183 istackreset(); 184 pushint(']'); 185 >> 186 187\<\< 188 << 189 NLA = 79; 190 action_file=CurFile; action_line=zzline; 191 zzmode(ACTIONS); zzmore(); 192 list_free(&CurActionLabels,0); /* MR10 */ 193 numericActionLabel=0; /* MR10 */ 194 istackreset(); 195 pushint('>'); 196 >> 197 198\" 199 << 200 NLA = 80; 201 zzmode(STRINGS); zzmore(); 202 >> 203 204/\* 205 << 206 NLA = 81; 207 zzmode(COMMENTS); zzskip(); 208 >> 209 210\*/ 211 << 212 NLA = 82; 213 warn("Missing /*; found dangling */"); zzskip(); 214 >> 215 216// 217 << 218 NLA = 83; 219 zzmode(CPP_COMMENTS); zzskip(); 220 >> 221 222#line[\ \t]* [0-9]+ {[\ \t]* \"~[\"]+\" ([\ \t]* [0-9]*)* } (\n|\r|\r\n) 223 << 224 NLA = 84; 225 226 zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore(); 227 getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr); 228 >> 229 230#line ~[\n\r]* (\n|\r|\r\n) 231 << 232 NLA = 85; 233 234 zzline++; zzmore(); 235 >> 236 237\>\> 238 << 239 NLA = 86; 240 warn("Missing <<; found dangling \>\>"); zzskip(); 241 >> 242 243. 244 << 245 NLA = WildCard; 246 >> 247 248\@ 249 << 250 NLA = 88; 251 FoundException = 1; /* MR6 */ 252 FoundAtOperator = 1; 253 >> 254 255{\\}#pragma 256 << 257 NLA = Pragma; 258 >> 259 260{\\}#FirstSetSymbol 261 << 262 NLA = FirstSetSymbol; 263 >> 264 265{\\}#header 266 << 267 NLA = 94; 268 >> 269 270{\\}#first 271 << 272 NLA = 95; 273 >> 274 275{\\}#parser 276 << 277 NLA = 96; 278 >> 279 280{\\}#tokdefs 281 << 282 NLA = 97; 283 >> 284 285\} 286 << 287 NLA = 98; 288 >> 289 290class 291 << 292 NLA = 99; 293 >> 294 295\{ 296 << 297 NLA = 102; 298 >> 299 300! 301 << 302 NLA = 103; 303 >> 304 305\< 306 << 307 NLA = 104; 308 >> 309 310\> 311 << 312 NLA = 105; 313 >> 314 315: 316 << 317 NLA = 106; 318 >> 319 320; 321 << 322 NLA = 107; 323 >> 324 325{\\}#lexaction 326 << 327 NLA = 108; 328 >> 329 330{\\}#lexmember 331 << 332 NLA = 109; 333 >> 334 335{\\}#lexprefix 336 << 337 NLA = 110; 338 >> 339 340{\\}#pred 341 << 342 NLA = 111; 343 >> 344 345\|\| 346 << 347 NLA = 112; 348 >> 349 350&& 351 << 352 NLA = 113; 353 >> 354 355\( 356 << 357 NLA = 114; 358 >> 359 360\) 361 << 362 NLA = 115; 363 >> 364 365{\\}#lexclass 366 << 367 NLA = 116; 368 >> 369 370{\\}#errclass 371 << 372 NLA = 117; 373 >> 374 375{\\}#tokclass 376 << 377 NLA = 118; 378 >> 379 380.. 381 << 382 NLA = 119; 383 >> 384 385{\\}#token 386 << 387 NLA = 120; 388 >> 389 390= 391 << 392 NLA = 121; 393 >> 394 395[0-9]+ 396 << 397 NLA = 122; 398 >> 399 400\| 401 << 402 NLA = 123; 403 >> 404 405\~ 406 << 407 NLA = 124; 408 >> 409 410^ 411 << 412 NLA = 125; 413 >> 414 415approx 416 << 417 NLA = 126; 418 >> 419 420LL\(1\) 421 << 422 NLA = 127; 423 >> 424 425LL\(2\) 426 << 427 NLA = 128; 428 >> 429 430\* 431 << 432 NLA = 129; 433 >> 434 435\+ 436 << 437 NLA = 130; 438 >> 439 440? 441 << 442 NLA = 131; 443 >> 444 445=> 446 << 447 NLA = 132; 448 >> 449 450exception 451 << 452 NLA = 133; 453 >> 454 455default 456 << 457 NLA = 134; 458 >> 459 460catch 461 << 462 NLA = 135; 463 >> 464 465[a-z] [A-Za-z0-9_]* 466 << 467 NLA = NonTerminal; 468 469 while ( zzchar==' ' || zzchar=='\t' ) { 470 zzadvance(); 471 } 472 if ( zzchar == ':' && inAlt ) NLA = LABEL; 473 >> 474 475[A-Z] [A-Za-z0-9_]* 476 << 477 NLA = TokenTerm; 478 479 while ( zzchar==' ' || zzchar=='\t' ) { 480 zzadvance(); 481 } 482 if ( zzchar == ':' && inAlt ) NLA = LABEL; 483 >> 484 485{\\}#[A-Za-z0-9_]* 486 << 487 NLA = 136; 488 warn(eMsg1("unknown meta-op: %s",LATEXT(1))); zzskip(); 489 >> 490 491 492%%STRINGS 493 494@ 495 << 496 NLA = Eof; 497 >> 498 499\" 500 << 501 NLA = QuotedTerm; 502 zzmode(START); 503 >> 504 505\n|\r|\r\n 506 << 507 NLA = 3; 508 509 zzline++; 510 warn("eoln found in string"); 511 zzskip(); 512 >> 513 514\\(\n|\r|\r\n) 515 << 516 NLA = 4; 517 zzline++; zzmore(); 518 >> 519 520\\~[] 521 << 522 NLA = 5; 523 zzmore(); 524 >> 525 526~[\n\r\"\\]+ 527 << 528 NLA = 6; 529 zzmore(); 530 >> 531 532 533%%ACTION_STRINGS 534 535@ 536 << 537 NLA = Eof; 538 >> 539 540\" 541 << 542 NLA = 7; 543 zzmode(ACTIONS); zzmore(); 544 >> 545 546\n|\r|\r\n 547 << 548 NLA = 8; 549 550 zzline++; 551 warn("eoln found in string (in user action)"); 552 zzskip(); 553 >> 554 555\\(\n|\r|\r\n) 556 << 557 NLA = 9; 558 zzline++; zzmore(); 559 >> 560 561\\~[] 562 << 563 NLA = 10; 564 zzmore(); 565 >> 566 567~[\n\r\"\\]+ 568 << 569 NLA = 11; 570 zzmore(); 571 >> 572 573 574%%ACTION_CHARS 575 576@ 577 << 578 NLA = Eof; 579 >> 580 581' 582 << 583 NLA = 12; 584 zzmode(ACTIONS); zzmore(); 585 >> 586 587\n|\r|\r\n 588 << 589 NLA = 13; 590 591 zzline++; 592 warn("eoln found in char literal (in user action)"); 593 zzskip(); 594 >> 595 596\\~[] 597 << 598 NLA = 14; 599 zzmore(); 600 >> 601 602~[\n\r'\\]+ 603 << 604 NLA = 15; 605 zzmore(); 606 >> 607 608 609%%ACTION_COMMENTS 610 611@ 612 << 613 NLA = Eof; 614 >> 615 616\*/ 617 << 618 NLA = 16; 619 zzmode(ACTIONS); zzmore(); 620 >> 621 622\* 623 << 624 NLA = 17; 625 zzmore(); 626 >> 627 628\n|\r|\r\n 629 << 630 NLA = 18; 631 zzline++; zzmore(); DAWDLE; 632 >> 633 634~[\n\r\*]+ 635 << 636 NLA = 19; 637 zzmore(); 638 >> 639 640 641%%TOK_DEF_COMMENTS 642 643@ 644 << 645 NLA = Eof; 646 >> 647 648\*/ 649 << 650 NLA = 20; 651 zzmode(PARSE_ENUM_FILE); 652 zzmore(); 653 >> 654 655\* 656 << 657 NLA = 21; 658 zzmore(); 659 >> 660 661\n|\r|\r\n 662 << 663 NLA = 22; 664 zzline++; zzmore(); DAWDLE; 665 >> 666 667~[\n\r\*]+ 668 << 669 NLA = 23; 670 zzmore(); 671 >> 672 673 674%%TOK_DEF_CPP_COMMENTS 675 676@ 677 << 678 NLA = Eof; 679 >> 680 681\n|\r|\r\n 682 << 683 NLA = 24; 684 zzline++; zzmode(PARSE_ENUM_FILE); zzskip(); DAWDLE; 685 >> 686 687~[\n\r]+ 688 << 689 NLA = 25; 690 zzskip(); 691 >> 692 693 694%%ACTION_CPP_COMMENTS 695 696@ 697 << 698 NLA = Eof; 699 >> 700 701\n|\r|\r\n 702 << 703 NLA = 26; 704 zzline++; zzmode(ACTIONS); zzmore(); DAWDLE; 705 >> 706 707~[\n\r]+ 708 << 709 NLA = 27; 710 zzmore(); 711 >> 712 713 714%%CPP_COMMENTS 715 716@ 717 << 718 NLA = Eof; 719 >> 720 721\n|\r|\r\n 722 << 723 NLA = 28; 724 zzline++; zzmode(START); zzskip(); DAWDLE; 725 >> 726 727~[\n\r]+ 728 << 729 NLA = 29; 730 zzskip(); 731 >> 732 733 734%%COMMENTS 735 736@ 737 << 738 NLA = Eof; 739 >> 740 741\*/ 742 << 743 NLA = 30; 744 zzmode(START); zzskip(); 745 >> 746 747\* 748 << 749 NLA = 31; 750 zzskip(); 751 >> 752 753\n|\r|\r\n 754 << 755 NLA = 32; 756 zzline++; zzskip(); DAWDLE; 757 >> 758 759~[\n\r\*]+ 760 << 761 NLA = 33; 762 zzskip(); 763 >> 764 765 766%%ACTIONS 767 768@ 769 << 770 NLA = Eof; 771 >> 772 773\>\> 774 << 775 NLA = Action; 776 /* these do not nest */ 777 zzmode(START); 778 NLATEXT[0] = ' '; 779 NLATEXT[1] = ' '; 780 zzbegexpr[0] = ' '; 781 zzbegexpr[1] = ' '; 782 if ( zzbufovf ) { 783 err( eMsgd("action buffer overflow; size %d",ZZLEXBUFSIZE)); 784 } 785 786/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */ 787 /* MR1 in DLG action */ 788 /* MR1 Doesn't matter what kind of action it is - reset*/ 789 790 tokenActionActive=0; /* MR1 */ 791 >> 792 793\>\>? 794 << 795 NLA = Pred; 796 /* these do not nest */ 797 zzmode(START); 798 NLATEXT[0] = ' '; 799 NLATEXT[1] = ' '; 800 zzbegexpr[0] = '\0'; 801 if ( zzbufovf ) { 802 err( eMsgd("predicate buffer overflow; size %d",ZZLEXBUFSIZE)); 803 }; 804#ifdef __cplusplus__ 805 /* MR10 */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred); 806#else 807#ifdef __STDC__ 808 /* MR10 */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred); 809#else 810#ifdef __USE_PROTOS 811 /* MRxx */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred); 812#else 813 /* MR10 */ list_apply(CurActionLabels,mark_label_used_in_sem_pred); 814#endif 815#endif 816#endif 817 >> 818 819\] 820 << 821 NLA = PassAction; 822 if ( topint() == ']' ) { 823 popint(); 824 if ( istackempty() ) /* terminate action */ 825 { 826 zzmode(START); 827 NLATEXT[0] = ' '; 828 zzbegexpr[0] = ' '; 829 if ( zzbufovf ) { 830 err( eMsgd("parameter buffer overflow; size %d",ZZLEXBUFSIZE)); 831 } 832 } 833 else { 834 /* terminate $[..] and #[..] */ 835 if ( GenCC ) zzreplstr("))"); 836 else zzreplstr(")"); 837 zzmore(); 838 } 839 } 840 else if ( topint() == '|' ) { /* end of simple [...] */ 841 popint(); 842 zzmore(); 843 } 844 else zzmore(); 845 >> 846 847consumeUntil\( [\ \t]* \{~[\}]+\} [\ \t]* \) 848 << 849 NLA = 37; 850 851 zzmore(); 852 zzreplstr(inline_set(zzbegexpr+ 853 strlen("consumeUntil("))); 854 >> 855 856consumeUntil\( ~[\)]+ \) 857 << 858 NLA = 38; 859 zzmore(); 860 >> 861 862\n|\r|\r\n 863 << 864 NLA = 39; 865 zzline++; zzmore(); DAWDLE; 866 >> 867 868\> 869 << 870 NLA = 40; 871 zzmore(); 872 >> 873 874$ 875 << 876 NLA = 41; 877 zzmore(); 878 >> 879 880$$ 881 << 882 NLA = 42; 883 if ( !GenCC ) {zzreplstr("zzaRet"); zzmore();} 884 else err("$$ use invalid in C++ mode"); 885 >> 886 887$\[\] 888 << 889 NLA = 43; 890 if ( !GenCC ) {zzreplstr("zzempty_attr"); zzmore();} 891 else err("$[] use invalid in C++ mode"); 892 >> 893 894$\[ 895 << 896 NLA = 44; 897 898 pushint(']'); 899 if ( !GenCC ) zzreplstr("zzconstr_attr("); 900 else err("$[..] use invalid in C++ mode"); 901 zzmore(); 902 >> 903 904$[0-9]+ 905 << 906 NLA = 45; 907 { 908 static char buf[100]; 909 numericActionLabel=1; /* MR10 */ 910 if ( strlen(zzbegexpr)>(size_t)85 ) 911 fatal("$i attrib ref too big"); 912 set_orel(atoi(zzbegexpr+1), &attribsRefdFromAction); 913 if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%d,%s)", 914 BlkLevel-1,zzbegexpr+1); 915 else sprintf(buf,"_t%d%s", 916 BlkLevel-1,zzbegexpr+1); 917 zzreplstr(buf); 918 zzmore(); 919 UsedOldStyleAttrib = 1; 920 if ( UsedNewStyleLabel ) 921 err("cannot mix old-style $i with new-style labels"); 922 } 923 >> 924 925$[0-9]+. 926 << 927 NLA = 46; 928 { 929 static char buf[100]; 930 numericActionLabel=1; /* MR10 */ 931 if ( strlen(zzbegexpr)>(size_t)85 ) 932 fatal("$i.field attrib ref too big"); 933 zzbegexpr[strlen(zzbegexpr)-1] = ' '; 934 set_orel(atoi(zzbegexpr+1), &attribsRefdFromAction); 935 if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%d,%s).", 936 BlkLevel-1,zzbegexpr+1); 937 else sprintf(buf,"_t%d%s.", 938 BlkLevel-1,zzbegexpr+1); 939 zzreplstr(buf); 940 zzmore(); 941 UsedOldStyleAttrib = 1; 942 if ( UsedNewStyleLabel ) 943 err("cannot mix old-style $i with new-style labels"); 944 } 945 >> 946 947$[0-9]+.[0-9]+ 948 << 949 NLA = 47; 950 { 951 static char buf[100]; 952 static char i[20], j[20]; 953 char *p,*q; 954 numericActionLabel=1; /* MR10 */ 955 if (strlen(zzbegexpr)>(size_t)85) fatal("$i.j attrib ref too big"); 956 for (p=zzbegexpr+1,q= &i[0]; *p!='.'; p++) { 957 if ( q == &i[20] ) 958 fatalFL("i of $i.j attrib ref too big", 959 FileStr[CurFile], zzline ); 960 *q++ = *p; 961 } 962 *q = '\0'; 963 for (p++, q= &j[0]; *p!='\0'; p++) { 964 if ( q == &j[20] ) 965 fatalFL("j of $i.j attrib ref too big", 966 FileStr[CurFile], zzline ); 967 *q++ = *p; 968 } 969 *q = '\0'; 970 if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%s,%s)",i,j); 971 else sprintf(buf,"_t%s%s",i,j); 972 zzreplstr(buf); 973 zzmore(); 974 UsedOldStyleAttrib = 1; 975 if ( UsedNewStyleLabel ) 976 err("cannot mix old-style $i with new-style labels"); 977 } 978 >> 979 980$[_a-zA-Z][_a-zA-Z0-9]* 981 << 982 NLA = 48; 983 { static char buf[300]; LabelEntry *el; 984 zzbegexpr[0] = ' '; 985 if ( CurRule != NULL && 986 strcmp(CurRule, &zzbegexpr[1])==0 ) { 987 if ( !GenCC ) zzreplstr("zzaRet"); 988 } 989 else if ( CurRetDef != NULL && 990 strmember(CurRetDef, &zzbegexpr[1])) { 991 if ( hasMultipleOperands( CurRetDef ) ) { 992 require (strlen(zzbegexpr)<=(size_t)285, 993 "$retval attrib ref too big"); 994 sprintf(buf,"_retv.%s",&zzbegexpr[1]); 995 zzreplstr(buf); 996 } 997 else zzreplstr("_retv"); 998 } 999 else if ( CurParmDef != NULL && 1000 strmember(CurParmDef, &zzbegexpr[1])) { 1001 ; 1002 } 1003 else if ( Elabel==NULL ) { 1004 { err("$-variables in actions outside of rules are not allowed"); } 1005 } else if ( (el=(LabelEntry *)hash_get(Elabel, &zzbegexpr[1]))!=NULL ) { 1006 /* MR10 */ 1007 /* MR10 */ /* element labels might exist without an elem when */ 1008 /* MR10 */ /* it is a forward reference (to a rule) */ 1009 /* MR10 */ 1010 /* MR10 */ if ( GenCC && (el->elem == NULL || el->elem->ntype==nRuleRef) ) 1011 /* MR10 */ { err(eMsg1("There are no token ptrs for rule references: '$%s'",&zzbegexpr[1])); } 1012 /* MR10 */ 1013 /* MR10 */ if ( !GenCC && (el->elem == NULL || el->elem->ntype==nRuleRef) && GenAST) { 1014 /* MR10 */ err("You can no longer use attributes returned by rules when also using ASTs"); 1015 /* MR10 */ err(" Use upward inheritance (\"rule >[Attrib a] : ... <<$a=...\>\>\")"); 1016 /* MR10 */ }; 1017 /* MR10 */ 1018 /* MR10 */ /* keep track of <<... $label ...>> for semantic predicates in guess mode */ 1019 /* MR10 */ /* element labels contain pointer to the owners node */ 1020 /* MR10 */ 1021 /* MR10 */ if (el->elem != NULL && el->elem->ntype == nToken) { 1022 /* MR10 */ list_add(&CurActionLabels,el); 1023 /* MR10 */ }; 1024} 1025else 1026warn(eMsg1("$%s not parameter, return value, (defined) element label",&zzbegexpr[1])); 1027} 1028zzmore(); 1029 >> 1030 1031#0 1032 << 1033 NLA = 49; 1034 zzreplstr("(*_root)"); zzmore(); chkGTFlag(); 1035 >> 1036 1037#\[\] 1038 << 1039 NLA = 50; 1040 if ( GenCC ) { 1041 if (NewAST) zzreplstr("(newAST)"); 1042 else zzreplstr("(new AST)");} 1043 else {zzreplstr("zzastnew()");} zzmore(); 1044 chkGTFlag(); 1045 >> 1046 1047#\(\) 1048 << 1049 NLA = 51; 1050 zzreplstr("NULL"); zzmore(); chkGTFlag(); 1051 >> 1052 1053#[0-9]+ 1054 << 1055 NLA = 52; 1056 { 1057 static char buf[100]; 1058 if ( strlen(zzbegexpr)>(size_t)85 ) 1059 fatal("#i AST ref too big"); 1060 if ( GenCC ) sprintf(buf,"_ast%d%s",BlkLevel-1,zzbegexpr+1); 1061 else sprintf(buf,"zzastArg(%s)",zzbegexpr+1); 1062 zzreplstr(buf); 1063 zzmore(); 1064 set_orel(atoi(zzbegexpr+1), &AST_nodes_refd_in_actions); 1065 chkGTFlag(); 1066 } 1067 >> 1068 1069#line[\ \t]* [0-9]+ {[\ \t]* \"~[\"]+\" ([\ \t]* [0-9]*)* } (\n|\r|\r\n) 1070 << 1071 NLA = 53; 1072 1073 zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore(); 1074 getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr); 1075 >> 1076 1077#line ~[\n\r]* (\n|\r|\r\n) 1078 << 1079 NLA = 54; 1080 1081 zzline++; zzmore(); 1082 >> 1083 1084#[_a-zA-Z][_a-zA-Z0-9]* 1085 << 1086 NLA = 55; 1087 1088 if ( !(strcmp(zzbegexpr, "#ifdef")==0 || 1089 strcmp(zzbegexpr, "#if")==0 || 1090 strcmp(zzbegexpr, "#else")==0 || 1091 strcmp(zzbegexpr, "#endif")==0 || 1092 strcmp(zzbegexpr, "#ifndef")==0 || 1093 strcmp(zzbegexpr, "#define")==0 || 1094 strcmp(zzbegexpr, "#pragma")==0 || 1095 strcmp(zzbegexpr, "#undef")==0 || 1096 strcmp(zzbegexpr, "#import")==0 || 1097 strcmp(zzbegexpr, "#line")==0 || 1098 strcmp(zzbegexpr, "#include")==0 || 1099 strcmp(zzbegexpr, "#error")==0) ) 1100 { 1101 static char buf[100]; 1102 sprintf(buf, "%s_ast", zzbegexpr+1); 1103 /* MR27 */ list_add(&CurAstLabelsInActions, mystrdup(zzbegexpr+1)); 1104 zzreplstr(buf); 1105 chkGTFlag(); 1106 } 1107 zzmore(); 1108 >> 1109 1110#\[ 1111 << 1112 NLA = 56; 1113 1114 pushint(']'); 1115 if ( GenCC ) { 1116 if (NewAST) zzreplstr("(newAST("); 1117 else zzreplstr("(new AST("); } 1118 else zzreplstr("zzmk_ast(zzastnew(),"); 1119 zzmore(); 1120 chkGTFlag(); 1121 >> 1122 1123#\( 1124 << 1125 NLA = 57; 1126 1127 pushint('}'); 1128 if ( GenCC ) { 1129 if (tmakeInParser) { 1130 zzreplstr("tmake("); 1131 } 1132 else { 1133 zzreplstr("ASTBase::tmake("); 1134 } 1135 } 1136 else { 1137 zzreplstr("zztmake("); 1138 } 1139 zzmore(); 1140 chkGTFlag(); 1141 >> 1142 1143# 1144 << 1145 NLA = 58; 1146 zzmore(); 1147 >> 1148 1149\) 1150 << 1151 NLA = 59; 1152 1153 if ( istackempty() ) 1154 zzmore(); 1155 else if ( topint()==')' ) { 1156 popint(); 1157 } 1158 else if ( topint()=='}' ) { 1159 popint(); 1160 /* terminate #(..) */ 1161 zzreplstr(", NULL)"); 1162 } 1163 zzmore(); 1164 >> 1165 1166\[ 1167 << 1168 NLA = 60; 1169 1170 pushint('|'); /* look for '|' to terminate simple [...] */ 1171 zzmore(); 1172 >> 1173 1174\( 1175 << 1176 NLA = 61; 1177 1178 pushint(')'); 1179 zzmore(); 1180 >> 1181 1182\\\] 1183 << 1184 NLA = 62; 1185 zzreplstr("]"); zzmore(); 1186 >> 1187 1188\\\) 1189 << 1190 NLA = 63; 1191 zzreplstr(")"); zzmore(); 1192 >> 1193 1194\\> 1195 << 1196 NLA = 64; 1197 if (! tokenActionActive) zzreplstr(">"); /* MR1 */ 1198 zzmore(); /* MR1 */ 1199 >> 1200 1201' 1202 << 1203 NLA = 65; 1204 zzmode(ACTION_CHARS); zzmore(); 1205 >> 1206 1207\" 1208 << 1209 NLA = 66; 1210 zzmode(ACTION_STRINGS); zzmore(); 1211 >> 1212 1213\\$ 1214 << 1215 NLA = 67; 1216 zzreplstr("$"); zzmore(); 1217 >> 1218 1219\\# 1220 << 1221 NLA = 68; 1222 zzreplstr("#"); zzmore(); 1223 >> 1224 1225\\(\n|\r|\r\n) 1226 << 1227 NLA = 69; 1228 zzline++; zzmore(); 1229 >> 1230 1231\\~[\]\)>$#] 1232 << 1233 NLA = 70; 1234 zzmore(); 1235 >> 1236 1237/ 1238 << 1239 NLA = 71; 1240 zzmore(); 1241 >> 1242 1243/\* 1244 << 1245 NLA = 72; 1246 zzmode(ACTION_COMMENTS); zzmore(); 1247 >> 1248 1249\*/ 1250 << 1251 NLA = 73; 1252 warn("Missing /*; found dangling */ in action"); zzmore(); 1253 >> 1254 1255// 1256 << 1257 NLA = 74; 1258 zzmode(ACTION_CPP_COMMENTS); zzmore(); 1259 >> 1260 1261~[\n\r\)\(\\$#\>\]\[\"'/]+ 1262 << 1263 NLA = 75; 1264 zzmore(); 1265 >> 1266 1267 1268%%PARSE_ENUM_FILE 1269 1270@ 1271 << 1272 NLA = Eof; 1273 ; 1274 >> 1275 1276[\t\ ]+ 1277 << 1278 NLA = 137; 1279 zzskip(); 1280 >> 1281 1282\n|\r|\r\n 1283 << 1284 NLA = 138; 1285 zzline++; zzskip(); 1286 >> 1287 1288// 1289 << 1290 NLA = 139; 1291 zzmode(TOK_DEF_CPP_COMMENTS); zzmore(); 1292 >> 1293 1294/\* 1295 << 1296 NLA = 140; 1297 zzmode(TOK_DEF_COMMENTS); zzskip(); 1298 >> 1299 1300#ifdef 1301 << 1302 NLA = 141; 1303 zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); 1304 >> 1305 1306#if 1307 << 1308 NLA = 142; 1309 zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); 1310 >> 1311 1312#ifndef 1313 << 1314 NLA = 143; 1315 ; 1316 >> 1317 1318#else 1319 << 1320 NLA = 144; 1321 zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); 1322 >> 1323 1324#endif 1325 << 1326 NLA = 145; 1327 zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); 1328 >> 1329 1330#undef 1331 << 1332 NLA = 146; 1333 zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); 1334 >> 1335 1336#import 1337 << 1338 NLA = 147; 1339 zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); 1340 >> 1341 1342#define 1343 << 1344 NLA = 149; 1345 >> 1346 1347enum 1348 << 1349 NLA = 151; 1350 >> 1351 1352\{ 1353 << 1354 NLA = 152; 1355 >> 1356 1357= 1358 << 1359 NLA = 153; 1360 >> 1361 1362, 1363 << 1364 NLA = 154; 1365 >> 1366 1367\} 1368 << 1369 NLA = 155; 1370 >> 1371 1372; 1373 << 1374 NLA = 156; 1375 >> 1376 1377[0-9]+ 1378 << 1379 NLA = INT; 1380 >> 1381 1382[a-zA-Z_][_a-zA-Z0-9]* 1383 << 1384 NLA = ID; 1385 >> 1386 1387%% 1388