📄 scan.c
字号:
/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */ /* MR1 in DLG action */ /* MR1 Doesn't matter what kind of action it is - reset*/ tokenActionActive=0; /* MR1 */ }static void act102(){ NLA = Pred; /* these do not nest */ zzmode(START); NLATEXT[0] = ' '; NLATEXT[1] = ' '; zzbegexpr[0] = '\0'; if ( zzbufovf ) { err( eMsgd("predicate buffer overflow; size %d",ZZLEXBUFSIZE)); };#ifdef __cplusplus__ /* MR10 */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);#else#ifdef __STDC__ /* MR10 */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred);#else /* MR10 */ list_apply(CurActionLabels,mark_label_used_in_sem_pred);#endif#endif }static void act103(){ NLA = PassAction; if ( topint() == ']' ) { popint(); if ( istackempty() ) /* terminate action */ { zzmode(START); NLATEXT[0] = ' '; zzbegexpr[0] = ' '; if ( zzbufovf ) { err( eMsgd("parameter buffer overflow; size %d",ZZLEXBUFSIZE)); } } else { /* terminate $[..] and #[..] */ if ( GenCC ) zzreplstr("))"); else zzreplstr(")"); zzmore(); } } else if ( topint() == '|' ) { /* end of simple [...] */ popint(); zzmore(); } else zzmore(); }static void act104(){ NLA = 37; zzmore(); zzreplstr(inline_set(zzbegexpr+ strlen("consumeUntil("))); }static void act105(){ NLA = 38; zzmore(); }static void act106(){ NLA = 39; zzline++; zzmore(); DAWDLE; }static void act107(){ NLA = 40; zzmore(); }static void act108(){ NLA = 41; zzmore(); }static void act109(){ NLA = 42; if ( !GenCC ) {zzreplstr("zzaRet"); zzmore();} else err("$$ use invalid in C++ mode"); }static void act110(){ NLA = 43; if ( !GenCC ) {zzreplstr("zzempty_attr"); zzmore();} else err("$[] use invalid in C++ mode"); }static void act111(){ NLA = 44; pushint(']'); if ( !GenCC ) zzreplstr("zzconstr_attr("); else err("$[..] use invalid in C++ mode"); zzmore(); }static void act112(){ NLA = 45; { static char buf[100]; numericActionLabel=1; /* MR10 */ if ( strlen(zzbegexpr)>(size_t)85 ) fatal("$i attrib ref too big"); set_orel(atoi(zzbegexpr+1), &attribsRefdFromAction); if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%d,%s)", BlkLevel-1,zzbegexpr+1); else sprintf(buf,"_t%d%s", BlkLevel-1,zzbegexpr+1); zzreplstr(buf); zzmore(); UsedOldStyleAttrib = 1; if ( UsedNewStyleLabel ) err("cannot mix old-style $i with new-style labels"); } }static void act113(){ NLA = 46; { static char buf[100]; numericActionLabel=1; /* MR10 */ if ( strlen(zzbegexpr)>(size_t)85 ) fatal("$i.field attrib ref too big"); zzbegexpr[strlen(zzbegexpr)-1] = ' '; set_orel(atoi(zzbegexpr+1), &attribsRefdFromAction); if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%d,%s).", BlkLevel-1,zzbegexpr+1); else sprintf(buf,"_t%d%s.", BlkLevel-1,zzbegexpr+1); zzreplstr(buf); zzmore(); UsedOldStyleAttrib = 1; if ( UsedNewStyleLabel ) err("cannot mix old-style $i with new-style labels"); } }static void act114(){ NLA = 47; { static char buf[100]; static char i[20], j[20]; char *p,*q; numericActionLabel=1; /* MR10 */ if (strlen(zzbegexpr)>(size_t)85) fatal("$i.j attrib ref too big"); for (p=zzbegexpr+1,q= &i[0]; *p!='.'; p++) { if ( q == &i[20] ) fatalFL("i of $i.j attrib ref too big", FileStr[CurFile], zzline ); *q++ = *p; } *q = '\0'; for (p++, q= &j[0]; *p!='\0'; p++) { if ( q == &j[20] ) fatalFL("j of $i.j attrib ref too big", FileStr[CurFile], zzline ); *q++ = *p; } *q = '\0'; if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%s,%s)",i,j); else sprintf(buf,"_t%s%s",i,j); zzreplstr(buf); zzmore(); UsedOldStyleAttrib = 1; if ( UsedNewStyleLabel ) err("cannot mix old-style $i with new-style labels"); } }static void act115(){ NLA = 48; { static char buf[300]; LabelEntry *el; zzbegexpr[0] = ' '; if ( CurRule != NULL && strcmp(CurRule, &zzbegexpr[1])==0 ) { if ( !GenCC ) zzreplstr("zzaRet"); } else if ( CurRetDef != NULL && strmember(CurRetDef, &zzbegexpr[1])) { if ( HasComma( CurRetDef ) ) { require (strlen(zzbegexpr)<=(size_t)285, "$retval attrib ref too big"); sprintf(buf,"_retv.%s",&zzbegexpr[1]); zzreplstr(buf); } else zzreplstr("_retv"); } else if ( CurParmDef != NULL && strmember(CurParmDef, &zzbegexpr[1])) { ; } else if ( Elabel==NULL ) { { err("$-variables in actions outside of rules are not allowed"); } } else if ( (el=(LabelEntry *)hash_get(Elabel, &zzbegexpr[1]))!=NULL ) { /* MR10 */ /* MR10 */ /* element labels might exist without an elem when */ /* MR10 */ /* it is a forward reference (to a rule) */ /* MR10 */ /* MR10 */ if ( GenCC && (el->elem == NULL || el->elem->ntype==nRuleRef) ) /* MR10 */ { err(eMsg1("There are no token ptrs for rule references: '$%s'",&zzbegexpr[1])); } /* MR10 */ /* MR10 */ if ( !GenCC && (el->elem == NULL || el->elem->ntype==nRuleRef) && GenAST) { /* MR10 */ err("You can no longer use attributes returned by rules when also using ASTs"); /* MR10 */ err(" Use upward inheritance (\"rule >[Attrib a] : ... <<$a=...>>\")"); /* MR10 */ }; /* MR10 */ /* MR10 */ /* keep track of <<... $label ...>> for semantic predicates in guess mode */ /* MR10 */ /* element labels contain pointer to the owners node */ /* MR10 */ /* MR10 */ if (el->elem != NULL && el->elem->ntype == nToken) { /* MR10 */ list_add(&CurActionLabels,el); /* MR10 */ };}elsewarn(eMsg1("$%s not parameter, return value, (defined) element label",&zzbegexpr[1]));}zzmore(); }static void act116(){ NLA = 49; zzreplstr("(*_root)"); zzmore(); chkGTFlag(); }static void act117(){ NLA = 50; if ( GenCC ) { if (NewAST) zzreplstr("(newAST)"); else zzreplstr("(new AST)");} else {zzreplstr("zzastnew()");} zzmore(); chkGTFlag(); }static void act118(){ NLA = 51; zzreplstr("NULL"); zzmore(); chkGTFlag(); }static void act119(){ NLA = 52; { static char buf[100]; if ( strlen(zzbegexpr)>(size_t)85 ) fatal("#i AST ref too big"); if ( GenCC ) sprintf(buf,"_ast%d%s",BlkLevel-1,zzbegexpr+1); else sprintf(buf,"zzastArg(%s)",zzbegexpr+1); zzreplstr(buf); zzmore(); set_orel(atoi(zzbegexpr+1), &AST_nodes_refd_in_actions); chkGTFlag(); } }static void act120(){ NLA = 53; zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore(); getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr); }static void act121(){ NLA = 54; zzline++; zzmore(); }static void act122(){ NLA = 55; if ( !(strcmp(zzbegexpr, "#ifdef")==0 || strcmp(zzbegexpr, "#if")==0 || strcmp(zzbegexpr, "#else")==0 || strcmp(zzbegexpr, "#endif")==0 || strcmp(zzbegexpr, "#ifndef")==0 || strcmp(zzbegexpr, "#define")==0 || strcmp(zzbegexpr, "#pragma")==0 || strcmp(zzbegexpr, "#undef")==0 || strcmp(zzbegexpr, "#import")==0 || strcmp(zzbegexpr, "#line")==0 || strcmp(zzbegexpr, "#include")==0 || strcmp(zzbegexpr, "#error")==0) ) { static char buf[100]; sprintf(buf, "%s_ast", zzbegexpr+1); zzreplstr(buf); chkGTFlag(); } zzmore(); }static void act123(){ NLA = 56; pushint(']'); if ( GenCC ) { if (NewAST) zzreplstr("(newAST("); else zzreplstr("(new AST("); } else zzreplstr("zzmk_ast(zzastnew(),"); zzmore(); chkGTFlag(); }static void act124(){ NLA = 57; pushint('}'); if ( GenCC ) zzreplstr("ASTBase::tmake("); else zzreplstr("zztmake("); zzmore(); chkGTFlag(); }static void act125(){ NLA = 58; zzmore(); }static void act126(){ NLA = 59; if ( istackempty() ) zzmore(); else if ( topint()==')' ) { popint(); } else if ( topint()=='}' ) { popint(); /* terminate #(..) */ zzreplstr(", NULL)"); } zzmore(); }static void act127(){ NLA = 60; pushint('|'); /* look for '|' to terminate simple [...] */ zzmore(); }static void act128(){ NLA = 61; pushint(')'); zzmore(); }static void act129(){ NLA = 62; zzreplstr("]"); zzmore(); }static void act130(){ NLA = 63; zzreplstr(")"); zzmore(); }static void act131(){ NLA = 64; if (! tokenActionActive) zzreplstr(">"); /* MR1 */ zzmore(); /* MR1 */ }static void act132(){ NLA = 65; zzmode(ACTION_CHARS); zzmore(); }static void act133(){ NLA = 66; zzmode(ACTION_STRINGS); zzmore(); }static void act134(){ NLA = 67; zzreplstr("$"); zzmore(); }static void act135(){ NLA = 68; zzreplstr("#"); zzmore(); }static void act136(){ NLA = 69; zzline++; zzmore(); }static void act137(){ NLA = 70; zzmore(); }static void act138(){ NLA = 71; zzmore(); }static void act139(){ NLA = 72; zzmode(ACTION_COMMENTS); zzmore(); }static void act140(){ NLA = 73; warn("Missing /*; found dangling */ in action"); zzmore(); }static void act141(){ NLA = 74; zzmode(ACTION_CPP_COMMENTS); zzmore(); }static void act142(){ NLA = 75; zzmore(); }static unsigned char shift10[257] = { 0, 33, 33, 33, 33, 33, 33, 33, 33, 33, 16, 19, 33, 33, 20, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 16, 33, 28, 27, 21, 33, 33, 30, 15, 18, 32, 33, 33, 33, 25, 31, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 33, 33, 33, 33, 1, 2, 33, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 11, 26, 26, 26, 26, 26, 22, 29, 3, 33, 26, 33, 26, 26, 4, 26, 10, 26, 26, 26, 13, 26, 26, 14, 9, 6, 5, 26, 26, 26, 7, 12, 8, 26, 26, 26, 26, 26, 17, 33, 34, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33};static void act143(){ NLA = Eof; ; }static void act144(){ NLA = 136; zzskip(); }static void act145(){ NLA = 137; zzline++; zzskip(); }static void act146(){ NLA = 138; zzmode(TOK_DEF_CPP_COMMENTS); zzmore(); }static void act147()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -