globals.c

来自「SRI international 发布的OAA框架软件」· C语言 代码 · 共 485 行 · 第 1/2 页

C
485
字号
/*
 * globals.c	--	File containing all variables/tables visible to all files.
 *
 * SOFTWARE RIGHTS
 *
 * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
 * Set (PCCTS) -- PCCTS is in the public domain.  An individual or
 * company may do whatever they wish with source code distributed with
 * PCCTS or the code generated by PCCTS, including the incorporation of
 * PCCTS, or its output, into commerical software.
 *
 * We encourage users to develop software with PCCTS.  However, we do ask
 * that credit is given to us for developing PCCTS.  By "credit",
 * we mean that if you incorporate our source code into one of your
 * programs (commercial product, research project, or otherwise) that you
 * acknowledge this fact somewhere in the documentation, research report,
 * etc...  If you like PCCTS and have developed a nice tool with the
 * output, please mention that you developed it using PCCTS.  In
 * addition, we ask that this header remain intact in our source code.
 * As long as these guidelines are kept, we expect to continue enhancing
 * this system and expect to make other tools available as they are
 * completed.
 *
 * ANTLR 1.33
 * Terence Parr
 * Parr Research Corporation
 * with Purdue University and AHPCRC, University of Minnesota
 * 1989-2001
 */

#include <stdio.h>

#include "pcctscfg.h"

#include "set.h"
#include "syn.h"
#include "hash.h"
#include "generic.h"

char Version[] = "1.33MR33" ;	/* PCCTS version number */	                   /* MRXXX */
char VersionDef[] = "13333";    /* same (except int equiv for preproc symbol) */ /* MRXXX */

char LexStartSymbol[] = "START";/* Name of starting lexical class/automaton */
char *RemapFileName = "remap.h";
char *DlgFileName = "parser.dlg";
char *DefFileName = "tokens.h";
char *ErrFileName = "err.c";
char *ModeFileName = "mode.h";
char *StdMsgName = NULL;

char *ParserName = DefaultParserName;

/* list of PCCTS supplied support symbols; these are renamed when more than
 * one ANTLR-generated parsers are linked together to avoid name conflicts.
 * Can't use '##' ANSIC preprocessor concat operator with K&R and:
 *		#define zzskip	zzparser ## skip
 * will not work for ANSI/C++ as 'zzparserskip' is created w/o zzparser
 * being substituted--ack!!!
 */
char *StandardSymbols[] = {
/* ANTLR stuff */
	"zzStackOvfMsg",
	"zzasp",
	"zzaStack",
	"inf_tokens",
	"inf_text",
	"inf_text_buffer",
	"inf_text_buffer_ptr",
	"inf_text_buffer_size",
 	"inf_labase",
	"inf_last",
	"inf_lap",
	"zztokenLA",
	"zztextLA",
	"zzlap",
	"zzlabase",
	"zztoktext",
	"zztoken",
	"zzdirty",
	"zzguessing",
	"zzguess_start",
	"zzresynch",
	"zzinf_tokens",
	"zzinf_text",
	"zzinf_text_buffer",
	"zzinf_labase",
	"zzinf_last",
	"zzfill_inf_look",
	"zzFAIL",
	"zzsave_antlr_state",
	"zzrestore_antlr_state",
	"zzsyn",
	"zzset_el",
	"zzset_deg",
	"zzedecode",
	"_zzsetmatch",
	"_zzmatch",
	"_inf_zzgettok",
    "zzconsumeUntil",
    "zzconsumeUntilToken",
    "_zzmatch_wsig",
    "_zzsetmatch_wsig",
    "_zzmatch_wdfltsig",
    "_zzsetmatch_wdfltsig",
	"zzdflthandlers",
/* DLG stuff */
	"zzreal_line",
	"zzcharfull",
	"zzerr",
	"zzlextext",
	"zzbegexpr",
	"zzendexpr",
	"zzbufsize",
	"zzbegcol",
	"zzendcol",
	"zzline",
	"zzchar",
	"zzbufovf",
	"zzrdstream",
	"zzrdfunc",
	"zzrdstr",
	"zzclose_stream",
	"zzsave_dlg_state",
	"zzrestore_dlg_state",
	"zzmode",
	"zzskip",
	"zzmore",
	"zzreplchar",
	"zzreplstr",
	"zzgettok",
	"zzadvance",
	"zzerrstd",
	"zzerr_in",
	"zzconstr_attr",
	"zzempty_attr",
	"zzerraction",
	"zztokens",			/* list of token regular expressions */
	"dfa",
	"accepts",
	"actions",
    "zzTraceOptionValue",       /* MR10 */
    "zzTraceGuessOptionValue",  /* MR10 */
    "zzTraceCurrentRuleName",   /* MR10 */
    "zzTraceDepth",             /* MR10 */
    "zzGuessSeq",               /* MR10 */
    "zzSyntaxErrCount",         /* MR11 */
    "zzLexErrCount",            /* MR11 */
    "zzTraceGuessDone",         /* MR13 - BJS */
    "zzTraceGuessFail",         /* MR13 - BJS */
    "zzTraceGuessOption",       /* MR13 - BJS */
    "zzTraceIn",                /* MR13 - BJS */
    "zzTraceOption",            /* MR13 - BJS */
    "zzTraceOut",               /* MR13 - BJS */
    "zzTraceReset",             /* MR13 - BJS */
	NULL		/* must be present */
};

/* list of PCCTS supplied support functions; these are renamed when more than
 * one ANTLR-generated parsers are linked together to avoid name conflicts.
 */
char *ASTSymbols[] = {
	"AST",
	"zzast_sp",
	"zzastStack",
	"zzlink",
	"zzastnew",
	"zzsubchild",
	"zzsubroot",
	"zzpre_ast",
	"zzfree_ast",
	"zztmake",
	"zzdup_ast",
	"zztfree",
	"zzdouble_link",
	NULL		/* must be present */
};

/* Current ambiguity examination information */
int CurAmbigAlt1, CurAmbigAlt2, CurAmbigline, CurAmbigfile;
char *CurAmbigbtype;


						/* M e t h o d  T a b l e s */
/*
 * The following tables are used to fill syntax diagram nodes with the correct
 * function pointers for computing FIRST sets and printing themselves.
 */

/* fpTraverse[node type] == pointer to function that calculates trees
 * representing the FIRST sets for that node (maintains spatial info).
 * We use 'struct _tree' not 'tree' due to a g++ 2.4.3 bug.
 */
#ifdef __cplusplus
struct _tree *(*fpTraverse[NumNodeTypes+1])(... /* Node *, int, set * */) = {
	NULL,
	(struct _tree *(*)(...)) tJunc,
	(struct _tree *(*)(...)) tRuleRef,
	(struct _tree *(*)(...)) tToken,
	(struct _tree *(*)(...)) tAction
};
#else
Tree *(*fpTraverse[NumNodeTypes+1])() = {
	NULL,
	tJunc,
	tRuleRef,
	tToken,
	tAction
};
#endif

/* fpReach[node type] == pointer to function that calculates FIRST set for
 * that node. (r stands for reach).  We use 'struct _set' not 'set'
 * due to a g++ 2.4.3 bug.
 */
#ifdef __cplusplus
struct _set (*fpReach[NumNodeTypes+1])(... /* Node *, int, set * */) = {
	NULL,
	(struct _set (*)(...)) rJunc,
	(struct _set (*)(...)) rRuleRef,
	(struct _set (*)(...)) rToken,
	(struct _set (*)(...)) rAction
};
#else
set (*fpReach[NumNodeTypes+1])() = {
	NULL,
	rJunc,
	rRuleRef,
	rToken,
	rAction
};
#endif

/* fpPrint[node type] == pointer to function that knows how to print that node. */
#ifdef __cplusplus
void (*fpPrint[NumNodeTypes+1])(... /* Node * */) = {
	NULL,
	(void (*)(...)) pJunc,
	(void (*)(...)) pRuleRef,
	(void (*)(...)) pToken,
	(void (*)(...)) pAction
};
#else
void (*fpPrint[NumNodeTypes+1])() = {

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?