📄 preccx.c
字号:
/* to make #line references to definitions immediately before the STATUS foo line in the emitted code, insert P_LINE; before the VV above */static STATUS hid77(){PARSER printdeclerr, passthrough;static STATUS p_tok;P_PAND((TOPARSER printdeclerr)(),(TOPARSER passthrough)());return p_tok;}static VOID hid78(){VV(2)=V(1);}static STATUS hid79(){PARSER hid77;ACTION hid78;return p_attach0n(TOPARSER hid77,0,hid78,0);}STATUS declerr(){PARSER hid79;return((TOPARSER hid79)());}static VOID hid80(){VV(0)="@"; printf("line %d error: malformed declaration\n@?",yylineno);}static STATUS hid81(){PARSER p_nothing0;ACTION hid80;return p_attach0n(TOPARSER p_nothing0,0,hid80,0);}STATUS printdeclerr(){PARSER hid81;return((TOPARSER hid81)());} /* that was it. Now the top level (MAIN) parse. */static STATUS hid82(){PARSER notanat, passthrough;static STATUS p_tok;P_PAND((TOPARSER notanat)(),(TOPARSER passthrough)());return p_tok;}static VOID hid83(){VV(0)="";printf("\n");}static STATUS hid84(){PARSER p_nothing0;ACTION hid83;return p_attach0n(TOPARSER p_nothing0,0,hid83,0);}static STATUS hid85 (){PARSER hid82, hid84;static STATUS p_tok;p_tok = (TOPARSER hid82) ();return (GOODSTATUS(p_tok))?p_tok:(TOPARSER hid84) ();}static STATUS hid86 (){PARSER declaration, hid85;static STATUS p_tok;p_tok = (TOPARSER declaration) ();return (GOODSTATUS(p_tok))?p_tok:(TOPARSER hid85) ();}STATUS line(){PARSER hid86;return((TOPARSER hid86)());}static VOID hid87(){ VV(1)=putchar(T(1)); }static STATUS hid88(){PARSER NOTANAT;ACTION hid87;return p_attach0n(TOPARSER NOTANAT,0,hid87,0);}STATUS notanat(){PARSER hid88;return((TOPARSER hid88)());}/* this is a deliberate pop of the value 'behind' if we get none */static VOID hid89(){ VV(2)=V(1); }static STATUS hid90(){PARSER anychar;ACTION hid89;return p_attach0n(TOPARSER anychar,0,hid89,0);}static STATUS hid91(){PARSER hid90;return p_many0n(TOPARSER hid90,0);}static VOID hid92(){getname(&V(1));printf("%s\n",V(1)); RESET;}static STATUS hid93(){PARSER hid91;ACTION hid92;return p_attach0n(TOPARSER hid91,0,hid92,0);}STATUS passthrough(){PARSER hid93;return((TOPARSER hid93)());}static VOID hid94(){ VV(1)=putchar(T(1)); }static STATUS hid95(){PARSER ANYTHING;ACTION hid94;return p_attach0n(TOPARSER ANYTHING,0,hid94,0);}STATUS anychar(){PARSER hid95;return((TOPARSER hid95)());} /* ---- parser expressions -------- */static STATUS hid96 (){PARSER alternates, empty;static STATUS p_tok;p_tok = (TOPARSER alternates) ();return (GOODSTATUS(p_tok))?p_tok:(TOPARSER empty) ();}STATUS expression(){PARSER hid96;return((TOPARSER hid96)());}/* a <'|'> separated series, at least one <'|'> - note the overpull I prefer the order which results from recursion */static STATUS hid97(){PARSER WHITESPACE, alternates;static STATUS p_tok;P_PAND((TOPARSER WHITESPACE)(),(TOPARSER alternates)());return p_tok;}static STATUS hid98(){PARSER OR, hid97;static STATUS p_tok;P_PAND((TOPARSER OR)(),(TOPARSER hid97)());return p_tok;}static STATUS hid99(){PARSER WHITESPACE, hid98;static STATUS p_tok;P_PAND((TOPARSER WHITESPACE)(),(TOPARSER hid98)());return p_tok;}static VOID hid100(){char *n; VV(5)=(GETNEWNAME(&n,plainenv,NULL),P_ALT(n,V(1),V(5)));}static STATUS hid101(){PARSER hid99;ACTION hid100;return p_attach0n(TOPARSER hid99,0,hid100,0);}static STATUS hid102(){PARSER hid101, p_nothing0;static STATUS p_tok;P_PAND((TOPARSER hid101)(),(TOPARSER p_nothing0)());return p_tok;}static STATUS hid103(){PARSER hid102;return p_option0n(TOPARSER hid102,0);}static STATUS hid104(){PARSER sequence, hid103;static STATUS p_tok;P_PAND((TOPARSER sequence)(),(TOPARSER hid103)());return p_tok;}STATUS alternates(){PARSER hid104;return((TOPARSER hid104)());}/* appending is much more efficient than prepending because I don't waste C-stack space with MARK before a parse *//* this is a command separated sequence of sequents which are not commands*/static STATUS hid105(){PARSER SOMESPACE, manysequents;static STATUS p_tok;P_PAND((TOPARSER SOMESPACE)(),(TOPARSER manysequents)());return p_tok;}static STATUS hid106(){PARSER command, hid105;static STATUS p_tok;P_PAND((TOPARSER command)(),(TOPARSER hid105)());return p_tok;}static STATUS hid107(){PARSER SOMESPACE, hid106;static STATUS p_tok;P_PAND((TOPARSER SOMESPACE)(),(TOPARSER hid106)());return p_tok;}static VOID hid108(){char *n; VV(3)=(GETNEWNAME(&n,plainenv,NULL),P_AND(n,V(1),V(3)));}static STATUS hid109(){PARSER hid107;ACTION hid108;return p_attach0n(TOPARSER hid107,0,hid108,0);}static STATUS hid110(){PARSER hid109, p_nothing0;static STATUS p_tok;P_PAND((TOPARSER hid109)(),(TOPARSER p_nothing0)());return p_tok;}static STATUS hid111(){PARSER hid110;return p_many0n(TOPARSER hid110,0);}static STATUS hid112(){PARSER WHITESPACE, command;static STATUS p_tok;P_PAND((TOPARSER WHITESPACE)(),(TOPARSER command)());return p_tok;}static STATUS hid113(){PARSER hid112;return p_option0n(TOPARSER hid112,0);}static STATUS hid114(){PARSER hid111, hid113;static STATUS p_tok;P_PAND((TOPARSER hid111)(),(TOPARSER hid113)());return p_tok;}static STATUS hid115(){PARSER manysequents, hid114;static STATUS p_tok;P_PAND((TOPARSER manysequents)(),(TOPARSER hid114)());return p_tok;}STATUS sequence(){PARSER hid115;return((TOPARSER hid115)());} /* here we attach to the manysequents which this follows */static STATUS hid116(){PARSER c_code, COLONorEOL;static STATUS p_tok;P_PAND((TOPARSER c_code)(),(TOPARSER COLONorEOL)());return p_tok;}static STATUS hid117(){PARSER COLON, hid116;static STATUS p_tok;P_PAND((TOPARSER COLON)(),(TOPARSER hid116)());return p_tok;}static VOID hid118(){ char *n,*m; VV(5)=(GETNEWNAME(&n,plainenv,NULL),GETNEWNAME(&m,plainenv,NULL),P_ATT(m,V(1),n,V(4))); }static STATUS hid119(){PARSER hid117;ACTION hid118;return p_attach0n(TOPARSER hid117,0,hid118,0);}STATUS command(){PARSER hid119;return((TOPARSER hid119)());}/* commands can't be treated as ordinary atoms at the moment, because they * are required to end a sequence of 'and's and force a stack shift */static VOID hid120(){ VV(1)=V(1); getname(&V(1)); }static STATUS hid121(){PARSER cstuffs;ACTION hid120;return p_attach0n(TOPARSER cstuffs,0,hid120,0);}STATUS c_code(){PARSER hid121;return((TOPARSER hid121)());}/* the stuff inside a command is a sequence of C constants or C tokens */static VOID hid122(){ VV(2) = V(1); }static STATUS hid123(){PARSER cstuff;ACTION hid122;return p_attach0n(TOPARSER cstuff,0,hid122,0);}static STATUS hid124(){PARSER hid123;return p_many0n(TOPARSER hid123,0);}static STATUS hid125(){PARSER cstuff, hid124;static STATUS p_tok;P_PAND((TOPARSER cstuff)(),(TOPARSER hid124)());return p_tok;}static VOID hid126(){ VV(0) =""; }static STATUS hid127(){PARSER p_nothing0;ACTION hid126;return p_attach0n(TOPARSER p_nothing0,0,hid126,0);}static STATUS hid128 (){PARSER hid125, hid127;static STATUS p_tok;p_tok = (TOPARSER hid125) ();return (GOODSTATUS(p_tok))?p_tok:(TOPARSER hid127) ();}STATUS cstuffs(){PARSER hid128;return((TOPARSER hid128)());}/* all the component tokens are accumulating in the cbuff */static VOID hid129(){ VV(1) = putchar(T(1)); }static STATUS hid130(){PARSER NOTACOLON;ACTION hid129;return p_attach0n(TOPARSER NOTACOLON,0,hid129,0);}static STATUS hid131 (){PARSER COMMENT, hid130;static STATUS p_tok;p_tok = (TOPARSER COMMENT) ();return (GOODSTATUS(p_tok))?p_tok:(TOPARSER hid130) ();}static STATUS hid132 (){PARSER DOLLARID, hid131;static STATUS p_tok;p_tok = (TOPARSER DOLLARID) ();return (GOODSTATUS(p_tok))?p_tok:(TOPARSER hid131) ();}static STATUS hid133 (){PARSER CHARCONST, hid132;static STATUS p_tok;p_tok = (TOPARSER CHARCONST) ();return (GOODSTATUS(p_tok))?p_tok:(TOPARSER hid132) ();}static STATUS hid134 (){PARSER STRING, hid133;static STATUS p_tok;p_tok = (TOPARSER STRING) ();return (GOODSTATUS(p_tok))?p_tok:(TOPARSER hid133) ();}STATUS cstuff(){PARSER hid134;return((TOPARSER hid134)());}/* manysequents is a 0 or more long list of nonempty non-commands *//* start a new count *//* do the pulling in moresequents, if it happens */static STATUS hid135(){PARSER moresequents;return p_option0n(TOPARSER moresequents,0);}static STATUS hid136(){PARSER firstsequent, hid135;static STATUS p_tok;P_PAND((TOPARSER firstsequent)(),(TOPARSER hid135)());return p_tok;}static VOID hid137(){ popcount();}static STATUS hid138(){PARSER hid136;ACTION hid137;return p_attach0n(TOPARSER hid136,0,hid137,0);}STATUS manysequents(){PARSER hid138;return((TOPARSER hid138)());}/* need "empty newvar empty" and "sequent newvar empty" to make the above complete, but it's too much bother right now */static STATUS hid139 (){PARSER sequent, empty;static STATUS p_tok;p_tok = (TOPARSER sequent) ();return (GOODSTATUS(p_tok))?p_tok:(TOPARSER empty) ();}static VOID hid140(){pushcount();}static STATUS hid141(){PARSER hid139;ACTION hid140;return p_attach0n(TOPARSER hid139,0,hid140,0);}STATUS firstsequent(){PARSER hid141;return((TOPARSER hid141)());} /* overpull again in the option again, I prefer to use recursion for better output order *//* without a parameterized spec, I can't prevent repetitions */static STATUS hid142(){PARSER BACKSLASH, IDENTIFIER;static STATUS p_tok;P_PAND((TOPARSER BACKSLASH)(),(TOPARSER IDENTIFIER)());return p_tok;}static VOID hid143(){VV(2)=V(2);getname(&V(2));ADDVAR(V(2));}static STATUS hid144(){PARSER hid142;ACTION hid143;return p_attach0n(TOPARSER hid142,0,hid143,0);}STATUS newvar(){PARSER hid144;return((TOPARSER hid144)());}/* moresequents is a 1 or more long list of sequents, or an attr decl * followed by a 1 or more long list. It is not empty. It is not * (presently) a newvar on its own, though it might eventually be */static STATUS hid145(){PARSER moresequents;return p_option0n(TOPARSER moresequents,0);}static STATUS hid146(){PARSER sequent, hid145;static STATUS p_tok;P_PAND((TOPARSER sequent)(),(TOPARSER hid145)());return p_tok;}static STATUS hid147(){PARSER SOMESPACE, hid146;static STATUS p_tok;P_PAND((TOPARSER SOMESPACE)(),(TOPARSER hid146)());return p_tok;}static STATUS hid148(){PARSER newvar, hid147;static STATUS p_tok;P_PAND((TOPARSER newvar)(),(TOPARSER hid147)());return p_tok;}static VOID hid149(){ char *n; VV(4)=V(1);popenv(); GETNEWNAME(&n,plainenv,NULL);V(1)=P_STAR(n,V(1),V(4),V(2));}static STATUS hid150(){PARSER hid148;ACTION hid149;return p_attach0n(TOPARSER hid148,0,hid149,0);}static STATUS hid151(){PARSER hid150, p_nothing0;static STATUS p_tok;P_PAND((TOPARSER hid150)(),(TOPARSER p_nothing0)());return p_tok;}static STATUS hid152(){PARSER moresequents;return p_option0n(TOPARSER moresequents,0);}static STATUS hid153(){PARSER sequent, hid152;static STATUS p_tok;P_PAND((TOPARSER sequent)(),(TOPARSER hid152)());return p_tok;}static STATUS hid154(){PARSER SOMESPACE, hid153;static STATUS p_tok;P_PAND((TOPARSER SOMESPACE)(),(TOPARSER hid153)());return p_tok;}static STATUS hid155(){PARSER dummyvar, hid154;static STATUS p_tok;P_PAND((TOPARSER dummyvar)(),(TOPARSER hid154)());return p_tok;}static VOID hid156(){ char *n; VV(4)=V(1); if (precc_data.oldattributes){popenv(); GETNEWNAME(&n,plainenv,NULL);V(1)=P_STAR(n,V(1),V(4),V(2));} else{ GETNEWNAME(&n,plainenv,NULL);V(1)=P_AND(n,V(1),V(4));}}static STATUS hid157(){PARSER hid155;ACTION hid156;return p_attach0n(TOPARSER hid155,0,hid156,0);}static STATUS hid158 (){PARSER hid151, hid157;static STATUS p_tok;p_tok = (TOPARSER hid151) ();return (GOODSTATUS(p_tok))?p_tok:(TOPARSER hid157) ();}STATUS moresequents(){PARSER hid158;return((TOPARSER hid158)());}/* in the above, have to be careful to avoid allowing a trailing "empty" because that wrecks the returned value from an @foo@ */static VOID hid159(){/*empty*/ VV(0)=V(1); if(precc_data.oldattributes){ getname(&V(1)); GETANAME(&V(1),"p_","",count++); V(1)=GNAME(V(1));putname(V(1)); getname(&V(1)); ADDVAR(V(1)); }}static STATUS hid160(){PARSER p_nothing0;ACTION hid159;return p_attach0n(TOPARSER p_nothing0,0,hid159,0);}STATUS dummyvar(){PARSER hid160;return((TOPARSER hid160)());} /* Don't overpull now because ... */static STATUS hid161(){PARSER postfix;return p_option0n(TOPARSER postfix,0);}static STATUS hid162(){PARSER seqoperand, hid161;static STATUS p_tok;P_PAND((TOPARSER seqoperand)(),(TOPARSER hid161)());return p_tok;}STATUS sequent(){PARSER hid162;return((TOPARSER hid162)());} /* in each of these cases the postfix must behave as though the seqoperand were before it and overpull its arguments and write into the stack position to the left of itself */static STATUS hid163 (){PARSER plusop, hideop;static STATUS p_tok;p_tok = (TOPARSER plusop) ();return (GOODSTATUS(p_tok))?p_tok:(TOPARSER hideop) ();}static STATUS hid164 (){PARSER starop, hid163;static STATUS p_tok;p_tok = (TOPARSER starop) ();return (GOODSTATUS(p_tok))?p_tok:(TOPARSER hid163) ();}STATUS postfix(){PARSER hid164;return((TOPARSER hid164)());}static STATUS hid165(){PARSER WHITESPACE, CLOSEBRACE;static STATUS p_tok;P_PAND((TOPARSER WHITESPACE)(),(TOPARSER CLOSEBRACE)());return p_tok;}static STATUS hid166(){PARSER expression, hid165;static STATUS p_tok;P_PAND((TOPARSER expression)(),(TOPARSER hid165)());return p_tok;}static STATUS hid167(){PARSER WHITESPACE, hid166;static STATUS p_tok;P_PAND((TOPARSER WHITESPACE)(),(TOPARSER hid166)());return p_tok;}static STATUS hid168(){PARSER OPENBRACE, hid167;static STATUS p_tok;P_PAND((TOPARSER OPENBRACE)(),(TOPARSER hid167)());return p_tok;}static VOID hid169(){ VV(5) = V(3); }static STATUS hid170(){PARSER hid168;ACTION hid169;return p_attach0n(TOPARSER hid168,0,hid169,0);}STATUS bracket(){PARSER hid170;return((TOPARSER hid170)());}static STATUS hid171(){PARSER WHITESPACE, CLOSEBRACKET;static STATUS p_tok;P_PAND((TOPARSER WHITESPACE)(),(TOPARSER CLOSEBRACKET)());return p_tok;}static STATUS hid172(){PARSER expression, hid171;static STATUS p_tok;P_PAND((TOPARSER expression)(),(TOPARSER hid171)());return p_tok;}static STATUS hid173(){PARSER WHITESPACE, hid172;static STATUS p_tok;P_PAND((TOPARSER WHITESPACE)(),(TOPARSER hid172)());return p_tok;}static STATUS hid174(){PARSER OPENBRACKET, hid173;static STATUS p_tok;P_PAND((TOPARSER OPENBRACKET)(),(TOPARSER hid173)());return p_tok;}static VOID hid175(){ char *n;VV(5)=(GETNEWNAME(&n,plainenv,NULL),P_OPT(n,V(3))); }static STATUS hid176(){PARSER hid174;ACTION hid175;return p_attach0n(TOPARSER hid174,0,hid175,0);}STATUS option(){PARSER hid176;return((TOPARSER hid176)());}static VOID hid177(){ VV(0)= "p_nothing0"; }static STATUS hid178(){PARSER p_nothing0;ACTION hid177;return p_attach0n(TOPARSER p_nothing0,0,hid177,0);}STATUS empty(){PARSER hid178;return((TOPARSER hid178)());}static STATUS hid179(){PARSER WHITESPACE, AT;static STATUS p_tok;P_PAND((TOPARSER WHITESPACE)(),(TOPARSER AT)());return p_tok;}static STATUS hid180(){PARSER expr, hid179;static STATUS p_tok;P_PAND((TOPARSER expr)(),(TOPARSER hid179)());return p_tok;}static STATUS hid181(){PARSER WHITESPACE, hid180;static STATUS p_tok;P_PAND((TOPARSER WHITESPACE)(),(TOPARSER hid180)());return p_tok;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -