📄 directives.c
字号:
yyBuffer [Min (yyBufferNext + yyk, yyBufferLast)].yyAttribute; }}#endif#ifdef YYReParse#define BufferOn(Actions, Messages) yyBufferOn (Actions, Messages, yyTerminal)#define BufferPosition yyBufferNextstatic yytControl yyPrevControl;static long yyBufferOn#if defined __STDC__ | defined __cplusplus (rbool yyActions, rbool yyMessages, yySymbolRange yyToken)#else (yyActions, yyMessages, yyToken) rbool yyActions, yyMessages; yySymbolRange yyToken;#endif{ if (yyControl.yyMode == yystandard) { yyPrevControl = yyControl; yyControl.yyMode = yybuffer; yyControl.yyActions = yyActions; yyControl.yyMessages = yyMessages; yyBufferSet (yyToken); yyBufferClear = rfalse; } return yyBufferNext;}static long BufferOff ARGS ((void)){ if (yyControl.yyMode == yybuffer) yyControl = yyPrevControl; return yyBufferNext;}static void BufferClear ARGS ((void)){ yyBufferClear = rtrue;}#endif#ifdef YYDEBUGstatic void yyNl ARGS ((void)){ (void) putc ('\n', yyTrace); (void) fflush (yyTrace); }static void yyPrintState#if defined __STDC__ | defined __cplusplus (yyStateRange yyState)#else (yyState) yyStateRange yyState;#endif{ (void) fprintf (yyTrace, "%4ld:", ++ yyCount); WritePosition (yyTrace, Attribute.Position); (void) fprintf (yyTrace, ":%5d %c ", yyState, " ST-B---R" [yyControl.yyMode]);#if defined YYTrialParse | defined YYReParse if (yyParseLevel > 0) { register int yyi = yyParseLevel; (void) fprintf (yyTrace, "%2d ", yyi); do (void) fputs (" ", yyTrace); while (-- yyi); } else#endif (void) fputs (" ", yyTrace);}static rbool yyPrintResult#if defined __STDC__ | defined __cplusplus (yyStateRange yyState, int yyLine, rbool yyCondition)#else (yyState, yyLine, yyCondition) yyStateRange yyState; int yyLine; rbool yyCondition;#endif{ if (directives_Debug) { yyPrintState (yyState); (void) fprintf (yyTrace, "check predicate in line %d, result = %d", yyLine, yyCondition); yyNl (); } return yyCondition;}#else#define yyPrintResult(State, Line, Condition) Condition#endif#if defined YYDEBUG | defined YYDEC_TABLE#define yyGotoReduce(State, Rule) { yyState = State; goto yyReduce; }#define yyGotoRead(State) { yyState = State; goto yyRead; }#else#define yyGotoReduce(State, Rule) goto Rule;#define yyGotoRead(State) { yyState = State; goto yyRead; }#endifstatic unsigned long yyStateStackSize = yyInitStackSize;static yyStateRange * yyStateStack ;static yyStateRange * yyEndOfStack ;static unsigned long yyAttrStackSize = yyInitStackSize;static tParsAttribute * yyAttributeStack ;#if defined YYTrialParse | defined YYReParsestatic yyStateRange * yyStateStackPtr ;static tParsAttribute * yyAttrStackPtr ;#endifstatic yyStateRange * yyIsContStackPtr ;static unsigned long yyIsContStackSize = yyInitStackSize;static yyStateRange * yyCompResStackPtr ;static unsigned long yyCompResStackSize = yyInitStackSize;int directives ARGS ((void)) { return directives2 (yyStartState); }int directives2#if defined __STDC__ | defined __cplusplus (int yyStartSymbol)#else (yyStartSymbol) int yyStartSymbol;#endif { int yyErrorCount;#if defined YYDEBUG | defined YYDCRP yyTrace = stdout;#endif Begindirectives (); MakeArray ((char * *) & yyStateStack, & yyStateStackSize, (unsigned long) sizeof (yyStateRange)); MakeArray ((char * *) & yyAttributeStack, & yyAttrStackSize, (unsigned long) sizeof (tParsAttribute)); MakeArray ((char * *) & yyIsContStackPtr, & yyIsContStackSize, (unsigned long) sizeof (yyStateRange)); MakeArray ((char * *) & yyCompResStackPtr, & yyCompResStackSize, (unsigned long) sizeof (yyStateRange));#if defined YYTrialParse | defined YYReParse | defined YYGetLook MakeArray ((char * *) & yyBuffer, & yyBufferSize, (unsigned long) sizeof (yytBuffer));#endif yyEndOfStack = & yyStateStack [yyStateStackSize - 1];#if defined YYTrialParse | defined YYReParse yyStateStackPtr = yyStateStack; yyAttrStackPtr = yyAttributeStack; yyBufferNext = 1; yyBufferLast = 1; yyParseLevel = 0;#endif#ifdef YYDEBUG if (directives_Debug) { (void) fprintf (yyTrace, " #|Position|State|Mod|Lev|Action |Terminal and Lookahead or Rule\n"); yyNl (); }#endif yyControl.yyMode = yystandard; yyControl.yyActions = rtrue; yyControl.yyMessages = rtrue; yyErrorCount = yyParse ((yyStateRange) yyStartSymbol, (yySymbolRange) yyGetToken (), (int) yyStartLine [yyStartSymbol]); ReleaseArray ((char * *) & yyStateStack, & yyStateStackSize, (unsigned long) sizeof (yyStateRange)); ReleaseArray ((char * *) & yyAttributeStack, & yyAttrStackSize, (unsigned long) sizeof (tParsAttribute)); ReleaseArray ((char * *) & yyIsContStackPtr, & yyIsContStackSize, (unsigned long) sizeof (yyStateRange)); ReleaseArray ((char * *) & yyCompResStackPtr, & yyCompResStackSize, (unsigned long) sizeof (yyStateRange));#if defined YYTrialParse | defined YYReParse | defined YYGetLook ReleaseArray ((char * *) & yyBuffer, & yyBufferSize, (unsigned long) sizeof (yytBuffer));#endif return yyErrorCount; }#ifdef YYTrialParse#ifdef YYMemoParse#define MemoryClear(Position) yyBuffer [Position].yyStart = 0#endifstatic int yyTrialParse#if defined __STDC__ | defined __cplusplus (yyStateRange yyStartSymbol, yySymbolRange yyToken, int yyLine)#else (yyStartSymbol, yyToken, yyLine) yyStateRange yyStartSymbol ; yySymbolRange yyToken ; int yyLine ;#endif { int yyErrorCount ; unsigned long yyPrevStateStackPtr = yyStateStackPtr - yyStateStack; unsigned long yyPrevAttrStackPtr = yyAttrStackPtr - yyAttributeStack; long yyPrevBufferNext ; yytControl yyPrevControl ; BEFORE_TRIAL#ifdef YYMemoParse if (yyBuffer [yyBufferNext].yyStart == yyStartSymbol) return 0; if (yyBuffer [yyBufferNext].yyStart == - yyStartSymbol) return 1;#endif yyPrevControl = yyControl; yyStateStackPtr ++; yyAttrStackPtr ++; yyParseLevel ++; if (yyControl.yyMode == yystandard) yyBufferSet (yyToken); yyPrevBufferNext = yyBufferNext; yyControl.yyMode = yytrial; yyControl.yyActions = rfalse; yyControl.yyMessages = rfalse; yyErrorCount = yyParse (yyStartSymbol, yyToken, yyLine);#ifdef YYMemoParse yyBuffer [yyPrevBufferNext].yyStart = yyErrorCount ? - yyStartSymbol : yyStartSymbol;#endif yyStateStackPtr = yyStateStack + yyPrevStateStackPtr; yyAttrStackPtr = yyAttributeStack + yyPrevAttrStackPtr; yyBufferNext = yyPrevBufferNext; yyControl = yyPrevControl; yyParseLevel --; Attribute = yyBuffer [yyBufferNext].yyAttribute; AFTER_TRIAL return yyErrorCount; }#endif#ifdef YYReParsestatic int ReParse#if defined __STDC__ | defined __cplusplus (yyStateRange yyStartSymbol, int yyFrom, int yyTo, rbool yyActions, rbool yyMessages)#else (yyStartSymbol, yyFrom, yyTo, yyActions, yyMessages) yyStateRange yyStartSymbol ; int yyFrom, yyTo ; rbool yyActions, yyMessages ;#endif { int yyErrorCount = 1; if (1 <= yyFrom && yyFrom <= yyTo && yyTo <= yyBufferLast) { unsigned long yyPrevStateStackPtr = yyStateStackPtr - yyStateStack; unsigned long yyPrevAttrStackPtr = yyAttrStackPtr - yyAttributeStack; long yyPrevBufferNext = yyBufferNext; int yyToToken = yyBuffer [yyTo].yyToken; yytControl yyPrevControl ; yyPrevControl = yyControl; yyStateStackPtr ++; yyAttrStackPtr ++; yyParseLevel ++; yyBufferNext = yyFrom - 1; yyBuffer [yyTo].yyToken= EofToken; yyControl.yyMode = yyreparse; yyControl.yyActions = yyActions; yyControl.yyMessages = yyMessages; yyErrorCount = yyParse (yyStartSymbol, (yySymbolRange) yyGetToken (), (int) yyStartLine [yyStartSymbol]); yyStateStackPtr = yyStateStack + yyPrevStateStackPtr; yyAttrStackPtr = yyAttributeStack + yyPrevAttrStackPtr; yyBufferNext = yyPrevBufferNext; yyControl = yyPrevControl; yyParseLevel --; yyBuffer [yyTo].yyToken= yyToToken; Attribute = yyBuffer [yyBufferNext].yyAttribute; } else { Message ("invalid call of ReParse", xxError, Attribute.Position); } return yyErrorCount; }#endifstatic int yyParse#if defined __STDC__ | defined __cplusplus (yyStateRange yyStartSymbol, yySymbolRange yyToken, int yyLine)#else (yyStartSymbol, yyToken, yyLine) yyStateRange yyStartSymbol ; yySymbolRange yyToken ; int yyLine ;#endif { register yyStateRange yyState = yyStartSymbol; register yySymbolRange yyTerminal = yyToken; register rbool yyIsRepairing = rfalse; tParsAttribute yySynAttribute ; /* synthesized attribute */ int yyErrorCount = 0;#if ! (defined YYTrialParse | defined YYReParse) register yyStateRange * yyStateStackPtr = yyStateStack; register tParsAttribute *yyAttrStackPtr = yyAttributeStack;#endif#ifdef YYDEBUG long yyStartCount = yyCount + 1; yySymbolRange yyPrevTerminal = yyToken;#endif#ifdef YYGetLook yySymbolRange yy2;#endif/* line 15 "directives.lrk" */#ifdef YYDEBUG if (directives_Debug) { yyPrintState (yyStartSymbol); (void) fprintf (yyTrace, "parse for predicate in line %d, lookahead: %s", yyLine, directives_TokenName [yyTerminal]); yyNl (); }#endif yyParseLoop: for (;;) { if (yyStateStackPtr >= yyEndOfStack) { unsigned long yyyStateStackPtr = yyStateStackPtr - yyStateStack; unsigned long yyyAttrStackPtr = yyAttrStackPtr - yyAttributeStack; ExtendArray ((char * *) & yyStateStack, & yyStateStackSize, (unsigned long) sizeof (yyStateRange)); ExtendArray ((char * *) & yyAttributeStack, & yyAttrStackSize, (unsigned long) sizeof (tParsAttribute)); yyStateStackPtr = yyStateStack + yyyStateStackPtr; yyAttrStackPtr = yyAttributeStack + yyyAttrStackPtr; yyEndOfStack = & yyStateStack [yyStateStackSize - 1];#ifdef YYDEBUG if (directives_Debug) { yyPrintState (yyState); (void) fprintf (yyTrace, "extend stack from %ld to %ld", yyStateStackSize / 2, yyStateStackSize); yyNl (); }#endif } * yyStateStackPtr = yyState; yyTermTrans: for (;;) { /* SPEC State = Next (State, Terminal); terminal transit */ register yytComb * yyTCombPtr = yyTBasePtr [yyState] + yyTerminal;#if defined YYTDefault & defined YYaccDefault register unsigned long * yylp;#endif if (yyTCombPtr->Check == yyState) { yyState = yyTCombPtr->Next; break; }#ifdef YYTDefault#ifdef YYaccDefault if ((yylp = yyDefaultLook [yyState]) && (yylp [yyTerminal >> 5] >> (yyTerminal & 0x1f)) & 1) { yyState = yyTDefault [yyState]; break; }#else if ((yyState = yyTDefault [yyState]) != yyNoState) goto yyTermTrans;#endif#endif /* syntax error */ if (! yyIsRepairing) { /* report and recover */ yySymbolRange yyyTerminal = (yySymbolRange) yyTerminal;#ifdef YYTrialParse if (yyControl.yyMode == yytrial) YYABORT;#endif MY_ERROR#ifndef NO_RECOVER yyErrorCount ++; yyErrorRecovery (& yyyTerminal, yyStateStack, yyStateStackPtr - yyStateStack); yyTerminal = yyyTerminal; yyIsRepairing = rtrue;#else YYABORT;#endif }#ifndef NO_RECOVER yyState = * yyStateStackPtr; for (;;) { if (yyNext (yyState, (yySymbolRange) yyTerminal) == yyNoState) { yySymbolRange yyRepairToken; /* repair */ tScanAttribute yyRepairAttribute; yyRepairToken = yyContinuation [yyState]; yyState = yyNext (yyState, yyRepairToken); if (yyState > yyLastReduceState) { /* dynamic ? */ yyState = yyCondition [yyState - yyLastReduceState]; } if (yyState <= yyLastReadReduceState) { /* read or read reduce ? */ ErrorAttribute ((int) yyRepairToken, & yyRepairAttribute); if (yyControl.yyMessages) ErrorMessageI (xxTokenInserted, xxRepair, Attribute.Position, xxString, directives_TokenName [yyRepairToken]);#ifdef YYDEBUG if (directives_Debug) { yyPrintState (* yyStateStackPtr); (void) fprintf (yyTrace, "insert %s", directives_TokenName [yyRepairToken]); yyNl (); yyPrintState (* yyStateStackPtr); (void) fprintf (yyTrace, "shift %s, lookahead: %s", directives_TokenName [yyRepairToken], directives_TokenName [yyTerminal]); yyNl (); }#endif if (yyState >= yyFirstFinalState) { /* avoid second push */ yyState = yyFinalToProd [yyState - yyFirstReadReduceState]; } yyGetAttribute (yyAttrStackPtr ++, yyRepairAttribute); * ++ yyStateStackPtr = yyState; } if (yyState >= yyFirstFinalState) goto yyFinal; /* final state ? */ } else { yyState = yyNext (yyState, (yySymbolRange) yyTerminal); goto yyFinal; } }#endif } yyFinal: if (yyState >= yyFirstFinalState) { /* final state ? */ if (yyState <= yyLastReadReduceState) { /* read reduce ? */ yyStateStackPtr ++; yyGetAttribute (yyAttrStackPtr ++, Attribute); yyTerminal = yyGetToken ();#ifdef YYDEBUG if (directives_Debug) { yyStateStackPtr [0] = yyStateStackPtr [-1]; yyPrintState (* yyStateStackPtr); (void) fprintf (yyTrace, "shift %s, lookahead: %s", directives_TokenName [yyPrevTerminal], directives_TokenName [yyTerminal]); yyNl (); yyPrevTerminal = yyTerminal; }#endif yyIsRepairing = rfalse; } for (;;) { register yytNonterminal yyNonterminal; /* left-hand side */ yyReduce:#ifdef YYDEBUG if (directives_Debug) { if (yyState <= yyLastReadReduceState) /* read reduce ? */ yyState = yyFinalToProd [yyState - yyFirstReadReduceState]; yyPrintState (* yyStateStackPtr); if (yyState <= yyLastReduceState) { (void) fprintf (yyTrace, "reduce %s", yyRule [yyState - yyLastReadReduceState]); yyNl (); } else { (void) fprintf (yyTrace, "dynamic decision %d", yyState - yyLastReduceState); yyNl (); } }#endif#ifdef YYDEC_TABLE if (yyLastStopState < yyState && yyState <= yyLastReduceState) { register int yyd = yyLength [yyState - yyFirstReduceState]; yyStateStackPtr -= yyd; yyAttrStackPtr -= yyd;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -