📄 directives.c
字号:
/*Copyright (c) 2000, Red Hat, Inc.This file is part of Source-Navigator.Source-Navigator is free software; you can redistribute it and/ormodify it under the terms of the GNU General Public License as publishedby the Free Software Foundation; either version 2, or (at your option)any later version.Source-Navigator is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public License alongwith Source-Navigator; see the file COPYING. If not, write tothe Free Software Foundation, 59 Temple Place - Suite 330, Boston,MA 02111-1307, USA.*//* $Id: directives.c,v 1.1.1.1 2002/04/18 23:41:27 mdejong Exp $ */#include "directives.h"#ifdef __cplusplusextern "C" {#include "Reuse.h"#include "rMemory.h"#include "General.h"#include "DynArray.h"#ifndef NO_RECOVER#include "Sets.h"#endif#if ! defined NO_RECOVER | defined YYReParse#include "Errors.h"#endif#if defined YYDEBUG | defined lex_interface#include "Position.h"#endif#include <stdio.h>#include <string.h>}#else#include "Reuse.h"#include "rMemory.h"#include "General.h"#include "DynArray.h"#ifndef NO_RECOVER#include "Sets.h"#endif#if ! defined NO_RECOVER | defined YYReParse#include "Errors.h"#endif#if defined YYDEBUG | defined lex_interface#include "Position.h"#endif#include <stdio.h>#endif#ifdef lex_interface#define GetToken yylex extern int yylex ARGS ((void));#ifndef AttributeDef#include "Position.h" typedef struct { tPosition Position; } tScanAttribute; tScanAttribute Attribute = {{ 0, 0 }};#endif#ifndef ErrorAttributeDef#define ErrorAttribute(Token, RepairAttribute)#endif#ifndef yyGetAttribute#define yyGetAttribute(yyAttrStackPtr, a) * yyAttrStackPtr = yylval#endif#else#include "Scanner.h"#ifndef yyGetAttribute#define yyGetAttribute(yyAttrStackPtr, a) (yyAttrStackPtr)->Scan = a#endif#endiftypedef unsigned short yyStateRange ;typedef unsigned short yySymbolRange ;typedef struct { yyStateRange Check, Next; } yytComb;typedef enum {yyNT0_intern = 15,yyNTdirective = 16,yyNTxx_directive_1_3 = 17,yyNTliteral = 18,yyNToperator = 19} yytNonterminal;typedef struct { short yyMode; rbool yyActions, yyMessages; } yytControl;static yytControl yyControl = { 0, rtrue, rtrue }; rbool directives_Debug = rfalse;#define yyFirstTerminal 0#define yyLastTerminal 14#define yySetSize 15#define yyFirstSymbol 0#define yyLastSymbol 19#define yyTTableMax 26#define yyNTableMax 27#define yyStartState 1#define yyFirstReadState 1#define yyLastReadState 12#define yyFirstReadReduceState 13#define yyLastReadReduceState 23#define yyFirstReduceState 24#define yyLastReduceState 40#define yyLastState 40#define yyLastStopState 24#define YYTDefault#define YYNDefault#define yyFirstFinalState yyFirstReadReduceState#define ErrorMessages(Messages) yyControl.yyMessages = Messages#define SemActions(Actions) yyControl.yyActions = Actions#ifdef YYGetLook#define GetLookahead(k) yyGetLookahead ((k) - 1, yyTerminal)#define GetAttribute(k, a) xxGetAttribute ((k) - 1, yyTerminal, a)static int yyGetLookahead ARGS ((int yyk, yySymbolRange yyToken));static void xxGetAttribute ARGS ((int yyk, yySymbolRange yyToken, tScanAttribute * yyAttribute));#endif/* line 5 "directives.lrk" */#include "Source.h"typedef union {tScanAttribute Scan;} tParsAttribute;#if defined lex_interface & ! defined yylvalDef tParsAttribute yylval;#endif#ifndef yyInitStackSize#define yyInitStackSize 100#endif#ifndef MY_ERROR#define MY_ERROR#endif#define yyNoState 0#define yystandard 1#define yytrial 2#define yybuffer 4#define yyreparse 8#define yyS yySynAttribute#define yyA yyAttrStackPtr#define YYACCEPT goto yyAccept#define YYABORT goto yyAbort#ifdef YYDEC_TABLE#define yyDecrement(x)#define yySetNT(x)#else#define yyDecrement(x) yyStateStackPtr -= x; yyAttrStackPtr -= x;#define yySetNT(x) yyNonterminal = x;#endif#ifdef YYNDefault#define yytNComb yytComb#else#define yytNComb yyStateRange#endif#if defined YYDEBUG | defined YYDCRPstatic long yyCount = 0;static FILE * yyTrace ;static void yyPrintState ARGS ((yyStateRange yyState));static void yyNl ARGS ((void));static char * yyRule [] = { 0,"0_intern : directive _EOF_ ","directive : SET SOURCEFORMAT xx_directive_1_3 string ","directive : SET name literal ","directive : SET name ","directive : DISPLAY string ","directive : ELSE ","directive : END ","directive : IF literal operator literal ","directive : IF literal NOT operator literal ","directive : IF literal DEFINED ","directive : IF literal NOT DEFINED ","xx_directive_1_3 : ","literal : unsigned_integer ","literal : string ","operator : '<' ","operator : '>' ","operator : '=' ",""};#endif char * directives_TokenName [yyLastTerminal + 2] = {"_EOF_","name","SET","unsigned_integer","SOURCEFORMAT","DISPLAY","ELSE","END","string","IF","<",">","=","NOT","DEFINED",""};static yytComb yyTComb [yyTTableMax + 1] = {{ 6, 27}, { 5, 24}, { 1, 2}, { 4, 19}, { 0, 0}, { 1, 3}, { 1, 15}, { 1, 16}, { 4, 20}, { 1, 4}, { 10, 21}, { 10, 22}, { 10, 23}, { 2, 6}, { 10, 18}, { 9, 13}, { 2, 7}, { 8, 10}, { 8, 17}, { 7, 35}, { 3, 14}, { 0, 0}, { 0, 0}, { 0, 0}, { 0, 0}, { 0, 0}, { 0, 0}, };static yytNComb yyNComb [yyNTableMax - yyLastTerminal] = {{ 0, 0}, { 1, 5}, { 0, 0}, { 0, 0}, { 10, 12}, { 11, 31}, { 4, 8}, { 8, 11}, { 6, 26}, { 12, 32}, { 7, 9}, { 0, 0}, { 0, 0}, };static yytComb * yyTBasePtr [yyLastReadState + 1] = { 0,& yyTComb [ 0], & yyTComb [ 12], & yyTComb [ 12], & yyTComb [ 0], & yyTComb [ 1], & yyTComb [ 0], & yyTComb [ 11], & yyTComb [ 4], & yyTComb [ 7], & yyTComb [ 0], & yyTComb [ 0], & yyTComb [ 0], };static yytNComb * yyNBasePtr [yyLastReadState + 1] = { 0,& yyNComb [ -15], & yyNComb [ -15], & yyNComb [ -15], & yyNComb [ -12], & yyNComb [ -15], & yyNComb [ -10], & yyNComb [ -7], & yyNComb [ -12], & yyNComb [ -15], & yyNComb [ -15], & yyNComb [ -13], & yyNComb [ -9], };#ifdef YYTDefaultstatic unsigned short yyTDefault [yyLastReadState + 1] = { 0, 0, 0, 0, 0, 0, 4, 0, 10, 0, 0, 4, 4, };#endif#ifdef YYNDefaultstatic unsigned short yyNDefault [yyLastReadState + 1] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, };#endif#if ! defined NO_RECOVER | defined YYDEC_TABLEstatic unsigned char yyLength [yyLastReduceState - yyFirstReduceState + 1] = { 2, 4, 3, 2, 2, 1, 1, 4, 5, 3, 4, 0, 1, 1, 1, 1, 1, };static yytNonterminal yyLeftHandSide [yyLastReduceState - yyFirstReduceState + 1] = {yyNT0_intern,yyNTdirective,yyNTdirective,yyNTdirective,yyNTdirective,yyNTdirective,yyNTdirective,yyNTdirective,yyNTdirective,yyNTdirective,yyNTdirective,yyNTxx_directive_1_3,yyNTliteral,yyNTliteral,yyNToperator,yyNToperator,yyNToperator,};#endif#ifndef NO_RECOVERstatic yySymbolRange yyContinuation [yyLastReadState + 1] = { 0, 6, 1, 8, 3, 0, 0, 8, 14, 8, 14, 3, 3, };static unsigned short yyCondition [yyLastState - yyLastReduceState + 1] ={ 0,};#endifstatic unsigned short yyFinalToProd [yyLastReadReduceState - yyFirstReadReduceState + 2] = { 25, 28, 29, 30, 33, 34, 36, 37, 38, 39, 40, 0};static unsigned short yyStartLine [yyLastStopState - yyFirstReduceState + 2] = { 0,46,};#ifdef YYaccDefaultstatic unsigned long * yyDefaultLook [yyLastReadState + 1] = { 0,};#endifstatic int yyParse ARGS ((yyStateRange yyStartSymbol, yySymbolRange yyToken, int yyLine));#ifndef NO_RECOVERstatic yyStateRange yyNext ARGS ((yyStateRange yyState, yySymbolRange yySymbol));static void yyErrorRecovery ARGS ((yySymbolRange * yyTerminal, yyStateRange * yyStateStack, short yyStackPtr));static void yyComputeContinuation ARGS ((yyStateRange * yyStack, short yyStackPtr, tSet * yyContinueSet));static rbool yyIsContinuation ARGS ((yySymbolRange yyTerminal, yyStateRange * yyStateStack, short yyStackPtr));static void yyComputeRestartPoints ARGS ((yyStateRange * yyStateStack, short yyStackPtr, tSet * yyRestartSet));#endif#if defined YYTrialParse | defined YYReParse | defined YYGetLook#ifndef yyInitBufferSize#define yyInitBufferSize 100#endif#ifndef TOKENOP#define TOKENOP#endif#ifndef BEFORE_TRIAL#define BEFORE_TRIAL#endif#ifndef AFTER_TRIAL#define AFTER_TRIAL#endiftypedef struct { yySymbolRange yyToken; tScanAttribute yyAttribute;#ifdef YYMemoParse short yyStart;#endif } yytBuffer;static yytBuffer * yyBuffer ;static unsigned long yyBufferSize = yyInitBufferSize;static long yyBufferNext = 1;static long yyBufferLast = 1;static rbool yyBufferClear = rtrue;static unsigned short yyParseLevel = 0;static void yyBufferSet#if defined __STDC__ | defined __cplusplus (yySymbolRange yyToken)#else (yyToken) yySymbolRange yyToken;#endif{ if (yyBufferNext == yyBufferLast) { if (yyBufferClear) yyBufferLast = 0; if (++ yyBufferLast >= (long) yyBufferSize) { ExtendArray ((char * *) & yyBuffer, & yyBufferSize, (unsigned long) sizeof (yytBuffer));#ifdef YYDEBUG if (directives_Debug) { yyPrintState (0); (void) fprintf (yyTrace, "extend token buffer from %ld to %ld", yyBufferSize / 2, yyBufferSize); yyNl (); }#endif } yyBuffer [yyBufferLast].yyToken = yyToken; yyBuffer [yyBufferLast].yyAttribute= Attribute;#ifdef YYMemoParse yyBuffer [yyBufferLast].yyStart = 0;#endif yyBufferNext = yyBufferLast; }}static int yyGetToken ARGS ((void)){ register yySymbolRange yyToken; if (yyBufferNext < yyBufferLast) { yyToken = yyBuffer [++ yyBufferNext].yyToken; Attribute = yyBuffer [yyBufferNext].yyAttribute; } else { yyToken = GetToken (); if ((yytrial | yybuffer) & yyControl.yyMode) { if (++ yyBufferLast >= (long) yyBufferSize) { ExtendArray ((char * *) & yyBuffer, & yyBufferSize, (unsigned long) sizeof (yytBuffer));#ifdef YYDEBUG if (directives_Debug) { yyPrintState (0); (void) fprintf (yyTrace, "extend token buffer from %ld to %ld", yyBufferSize / 2, yyBufferSize); yyNl (); }#endif } yyBuffer [yyBufferLast].yyToken = yyToken; yyBuffer [yyBufferLast].yyAttribute = Attribute;#ifdef YYMemoParse yyBuffer [yyBufferLast].yyStart = 0;#endif yyBufferNext = yyBufferLast; } } TOKENOP return yyToken;}#else#define yyGetToken GetToken#endif#ifdef YYGetLookstatic int yyGetLookahead#if defined __STDC__ | defined __cplusplus (int yyk, yySymbolRange yyToken)#else (yyk, yyToken) int yyk; yySymbolRange yyToken;#endif{ if (yyk == 0) return yyToken; if (yyControl.yyMode == yystandard) yyBufferSet (yyToken); while (yyBufferNext + yyk > yyBufferLast) { if (yyBuffer [yyBufferLast].yyToken == EofToken) return EofToken; if (++ yyBufferLast >= (long) yyBufferSize) { ExtendArray ((char * *) & yyBuffer, & yyBufferSize, (unsigned long) sizeof (yytBuffer));#ifdef YYDEBUG if (directives_Debug) { yyPrintState (0); (void) fprintf (yyTrace, "extend token buffer from %ld to %ld", yyBufferSize / 2, yyBufferSize); yyNl (); }#endif } yyBuffer [yyBufferLast].yyToken = GetToken (); yyBuffer [yyBufferLast].yyAttribute = Attribute;#ifdef YYMemoParse yyBuffer [yyBufferLast].yyStart = 0;#endif } Attribute = yyBuffer [yyBufferNext].yyAttribute; return yyBuffer [yyBufferNext + yyk].yyToken;}static void xxGetAttribute#if defined __STDC__ | defined __cplusplus (int yyk, yySymbolRange yyToken, tScanAttribute * yyAttribute)#else (yyk, yyToken, yyAttribute) int yyk; yySymbolRange yyToken; tScanAttribute * yyAttribute;#endif{ if (yyk == 0) * yyAttribute = Attribute; else { (void) yyGetLookahead (yyk, yyToken); * yyAttribute =
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -