]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/CodeTools/TianoTools/Pccts/antlr/globals.c
More renames for Tool Packages
[mirror_edk2.git] / Tools / CodeTools / TianoTools / Pccts / antlr / globals.c
diff --git a/Tools/CodeTools/TianoTools/Pccts/antlr/globals.c b/Tools/CodeTools/TianoTools/Pccts/antlr/globals.c
deleted file mode 100644 (file)
index 59d0032..0000000
+++ /dev/null
@@ -1,484 +0,0 @@
-/*\r
- * globals.c   --      File containing all variables/tables visible to all files.\r
- *\r
- * SOFTWARE RIGHTS\r
- *\r
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool\r
- * Set (PCCTS) -- PCCTS is in the public domain.  An individual or\r
- * company may do whatever they wish with source code distributed with\r
- * PCCTS or the code generated by PCCTS, including the incorporation of\r
- * PCCTS, or its output, into commerical software.\r
- *\r
- * We encourage users to develop software with PCCTS.  However, we do ask\r
- * that credit is given to us for developing PCCTS.  By "credit",\r
- * we mean that if you incorporate our source code into one of your\r
- * programs (commercial product, research project, or otherwise) that you\r
- * acknowledge this fact somewhere in the documentation, research report,\r
- * etc...  If you like PCCTS and have developed a nice tool with the\r
- * output, please mention that you developed it using PCCTS.  In\r
- * addition, we ask that this header remain intact in our source code.\r
- * As long as these guidelines are kept, we expect to continue enhancing\r
- * this system and expect to make other tools available as they are\r
- * completed.\r
- *\r
- * ANTLR 1.33\r
- * Terence Parr\r
- * Parr Research Corporation\r
- * with Purdue University and AHPCRC, University of Minnesota\r
- * 1989-2001\r
- */\r
-\r
-#include <stdio.h>\r
-\r
-#include "pcctscfg.h"\r
-\r
-#include "set.h"\r
-#include "syn.h"\r
-#include "hash.h"\r
-#include "generic.h"\r
-\r
-char Version[] = "1.33MR33" ;  /* PCCTS version number */                         /* MRXXX */\r
-char VersionDef[] = "13333";    /* same (except int equiv for preproc symbol) */ /* MRXXX */\r
-\r
-char LexStartSymbol[] = "START";/* Name of starting lexical class/automaton */\r
-char *RemapFileName = "remap.h";\r
-char *DlgFileName = "parser.dlg";\r
-char *DefFileName = "tokens.h";\r
-char *ErrFileName = "err.c";\r
-char *ModeFileName = "mode.h";\r
-char *StdMsgName = NULL;\r
-\r
-char *ParserName = DefaultParserName;\r
-\r
-/* list of PCCTS supplied support symbols; these are renamed when more than\r
- * one ANTLR-generated parsers are linked together to avoid name conflicts.\r
- * Can't use '##' ANSIC preprocessor concat operator with K&R and:\r
- *             #define zzskip  zzparser ## skip\r
- * will not work for ANSI/C++ as 'zzparserskip' is created w/o zzparser\r
- * being substituted--ack!!!\r
- */\r
-char *StandardSymbols[] = {\r
-/* ANTLR stuff */\r
-       "zzStackOvfMsg",\r
-       "zzasp",\r
-       "zzaStack",\r
-       "inf_tokens",\r
-       "inf_text",\r
-       "inf_text_buffer",\r
-       "inf_text_buffer_ptr",\r
-       "inf_text_buffer_size",\r
-       "inf_labase",\r
-       "inf_last",\r
-       "inf_lap",\r
-       "zztokenLA",\r
-       "zztextLA",\r
-       "zzlap",\r
-       "zzlabase",\r
-       "zztoktext",\r
-       "zztoken",\r
-       "zzdirty",\r
-       "zzguessing",\r
-       "zzguess_start",\r
-       "zzresynch",\r
-       "zzinf_tokens",\r
-       "zzinf_text",\r
-       "zzinf_text_buffer",\r
-       "zzinf_labase",\r
-       "zzinf_last",\r
-       "zzfill_inf_look",\r
-       "zzFAIL",\r
-       "zzsave_antlr_state",\r
-       "zzrestore_antlr_state",\r
-       "zzsyn",\r
-       "zzset_el",\r
-       "zzset_deg",\r
-       "zzedecode",\r
-       "_zzsetmatch",\r
-       "_zzmatch",\r
-       "_inf_zzgettok",\r
-    "zzconsumeUntil",\r
-    "zzconsumeUntilToken",\r
-    "_zzmatch_wsig",\r
-    "_zzsetmatch_wsig",\r
-    "_zzmatch_wdfltsig",\r
-    "_zzsetmatch_wdfltsig",\r
-       "zzdflthandlers",\r
-/* DLG stuff */\r
-       "zzreal_line",\r
-       "zzcharfull",\r
-       "zzerr",\r
-       "zzlextext",\r
-       "zzbegexpr",\r
-       "zzendexpr",\r
-       "zzbufsize",\r
-       "zzbegcol",\r
-       "zzendcol",\r
-       "zzline",\r
-       "zzchar",\r
-       "zzbufovf",\r
-       "zzrdstream",\r
-       "zzrdfunc",\r
-       "zzrdstr",\r
-       "zzclose_stream",\r
-       "zzsave_dlg_state",\r
-       "zzrestore_dlg_state",\r
-       "zzmode",\r
-       "zzskip",\r
-       "zzmore",\r
-       "zzreplchar",\r
-       "zzreplstr",\r
-       "zzgettok",\r
-       "zzadvance",\r
-       "zzerrstd",\r
-       "zzerr_in",\r
-       "zzconstr_attr",\r
-       "zzempty_attr",\r
-       "zzerraction",\r
-       "zztokens",                     /* list of token regular expressions */\r
-       "dfa",\r
-       "accepts",\r
-       "actions",\r
-    "zzTraceOptionValue",       /* MR10 */\r
-    "zzTraceGuessOptionValue",  /* MR10 */\r
-    "zzTraceCurrentRuleName",   /* MR10 */\r
-    "zzTraceDepth",             /* MR10 */\r
-    "zzGuessSeq",               /* MR10 */\r
-    "zzSyntaxErrCount",         /* MR11 */\r
-    "zzLexErrCount",            /* MR11 */\r
-    "zzTraceGuessDone",         /* MR13 - BJS */\r
-    "zzTraceGuessFail",         /* MR13 - BJS */\r
-    "zzTraceGuessOption",       /* MR13 - BJS */\r
-    "zzTraceIn",                /* MR13 - BJS */\r
-    "zzTraceOption",            /* MR13 - BJS */\r
-    "zzTraceOut",               /* MR13 - BJS */\r
-    "zzTraceReset",             /* MR13 - BJS */\r
-       NULL            /* must be present */\r
-};\r
-\r
-/* list of PCCTS supplied support functions; these are renamed when more than\r
- * one ANTLR-generated parsers are linked together to avoid name conflicts.\r
- */\r
-char *ASTSymbols[] = {\r
-       "AST",\r
-       "zzast_sp",\r
-       "zzastStack",\r
-       "zzlink",\r
-       "zzastnew",\r
-       "zzsubchild",\r
-       "zzsubroot",\r
-       "zzpre_ast",\r
-       "zzfree_ast",\r
-       "zztmake",\r
-       "zzdup_ast",\r
-       "zztfree",\r
-       "zzdouble_link",\r
-       NULL            /* must be present */\r
-};\r
-\r
-/* Current ambiguity examination information */\r
-int CurAmbigAlt1, CurAmbigAlt2, CurAmbigline, CurAmbigfile;\r
-char *CurAmbigbtype;\r
-\r
-\r
-                                               /* M e t h o d  T a b l e s */\r
-/*\r
- * The following tables are used to fill syntax diagram nodes with the correct\r
- * function pointers for computing FIRST sets and printing themselves.\r
- */\r
-\r
-/* fpTraverse[node type] == pointer to function that calculates trees\r
- * representing the FIRST sets for that node (maintains spatial info).\r
- * We use 'struct _tree' not 'tree' due to a g++ 2.4.3 bug.\r
- */\r
-#ifdef __cplusplus\r
-struct _tree *(*fpTraverse[NumNodeTypes+1])(... /* Node *, int, set * */) = {\r
-       NULL,\r
-       (struct _tree *(*)(...)) tJunc,\r
-       (struct _tree *(*)(...)) tRuleRef,\r
-       (struct _tree *(*)(...)) tToken,\r
-       (struct _tree *(*)(...)) tAction\r
-};\r
-#else\r
-Tree *(*fpTraverse[NumNodeTypes+1])() = {\r
-       NULL,\r
-       tJunc,\r
-       tRuleRef,\r
-       tToken,\r
-       tAction\r
-};\r
-#endif\r
-\r
-/* fpReach[node type] == pointer to function that calculates FIRST set for\r
- * that node. (r stands for reach).  We use 'struct _set' not 'set'\r
- * due to a g++ 2.4.3 bug.\r
- */\r
-#ifdef __cplusplus\r
-struct _set (*fpReach[NumNodeTypes+1])(... /* Node *, int, set * */) = {\r
-       NULL,\r
-       (struct _set (*)(...)) rJunc,\r
-       (struct _set (*)(...)) rRuleRef,\r
-       (struct _set (*)(...)) rToken,\r
-       (struct _set (*)(...)) rAction\r
-};\r
-#else\r
-set (*fpReach[NumNodeTypes+1])() = {\r
-       NULL,\r
-       rJunc,\r
-       rRuleRef,\r
-       rToken,\r
-       rAction\r
-};\r
-#endif\r
-\r
-/* fpPrint[node type] == pointer to function that knows how to print that node. */\r
-#ifdef __cplusplus\r
-void (*fpPrint[NumNodeTypes+1])(... /* Node * */) = {\r
-       NULL,\r
-       (void (*)(...)) pJunc,\r
-       (void (*)(...)) pRuleRef,\r
-       (void (*)(...)) pToken,\r
-       (void (*)(...)) pAction\r
-};\r
-#else\r
-void (*fpPrint[NumNodeTypes+1])() = {\r
-       NULL,\r
-       pJunc,\r
-       pRuleRef,\r
-       pToken,\r
-       pAction\r
-};\r
-#endif\r
-\r
-char *decodeJType[] = {\r
-       "invalid",\r
-       "aSubBlk",\r
-       "aOptBlk",\r
-       "aLoopBlk",\r
-       "EndBlk",\r
-       "RuleBlk",\r
-       "Generic",\r
-       "EndRule",\r
-       "aPlusBlk",\r
-       "aLoopBegin"\r
-};\r
-\r
-\r
-                                                       /* H a s h  T a b l e s */\r
-\r
-Entry  **Tname,                        /* Table of all token names (maps name to tok num)*/\r
-               **Texpr,                        /* Table of all token expressions\r
-                                                          (maps expr to tok num) */\r
-               **Rname,                        /* Table of all Rules (has ptr to start of rule) */\r
-               **Fcache,                       /* Cache of First/Follow Computations */\r
-               **Tcache;                       /* Tree cache; First/Follow for permute trees */\r
-Entry  **Elabel;                       /* Table of all element label names */\r
-Entry  **Sname;                        /* Signal names */\r
-Entry   **Pname;            /* symbolic predicate names MR11 */\r
-\r
-\r
-                                                       /* V a r i a b l e s */\r
-\r
-int     Save_argc;          /* MR10 */\r
-char    **Save_argv;        /* MR10 */\r
-int            EpToken=0;                      /* Imaginary Epsilon token number */\r
-int            WildCardToken=0;\r
-int            CurFile= -1;            /* Index into FileStr table */\r
-char    *CurPredName=NULL;  /* MR11 */\r
-char   *CurRule=NULL;          /* Pointer to current rule name */\r
-int     CurRuleDebug=0;     /* MR13 debug flag */\r
-RuleEntry *CurRuleNode=NULL;/* Pointer to current rule node in syntax tree */\r
-char   *CurRetDef=NULL;        /* Pointer to current return type definition */\r
-char   *CurParmDef=NULL;       /* Pointer to current parameter definition */\r
-Junction *CurRuleBlk=NULL;     /* Pointer to current block node for enclosing block */\r
-ListNode *CurExGroups=NULL;    /* Current list of exception groups for rule/alts */\r
-ListNode *CurElementLabels=NULL;\r
-ListNode *CurAstLabelsInActions=NULL; /* MR27 */\r
-\r
-/* MR10  used by <<>>? to set "label_used_in_semantic_pred"  */\r
-/* MR10  this will force LT(i) assignment even in guess mode */\r
-\r
-ListNode *CurActionLabels=NULL;     /* MR10 Element Labels appearing in last action */\r
-int      numericActionLabel=0 ;     /* MR10 << ... $1 ... >> or << ... $1 ... >>?   */\r
-ListNode *NumericPredLabels=NULL;   /* MR10 << ... $1 ... >>?  ONLY                 */\r
-ListNode *ContextGuardPredicateList=NULL;  /* MR13 for re-evaluating predicates\r
-                                                   after meta tokens are defined    */\r
-\r
-int            CurBlockID=0;           /* Unique int for each block */\r
-int            CurAltNum=0;\r
-Junction *CurAltStart = NULL;  /* Junction node that starts the alt */\r
-Junction *OuterAltStart = NULL; /* For chaining exception groups        MR7 */\r
-int            NumRules=0;                     /* Rules are from 1 to n */\r
-FILE   *output=NULL;           /* current parser output file */\r
-FILE   *input=NULL;            /* current grammar input file */\r
-char   *FileStr[MaxNumFiles];/* Ptr to array of file names on command-line */\r
-int            NumFiles=0;                     /* current grammar file number */\r
-#ifdef __cplusplus\r
-void   (**fpTrans)(...),       /* array of ptrs to funcs that translate nodes */\r
-               (**fpJTrans)(...);      /*  ... that translate junctions */\r
-#else\r
-void   (**fpTrans)(),          /* array of ptrs to funcs that translate nodes */\r
-               (**fpJTrans)();         /*  ... that translate junctions */\r
-#endif\r
-int            **FoStack;                      /* Array of LL_k ptrs to stacks of rule numbers */\r
-int            **FoTOS;                        /* FOLLOW stack top-of-stack pointers */\r
-Junction *SynDiag = NULL;      /* Pointer to start of syntax diagram */\r
-int            BlkLevel=1;                     /* Current block level.  Set by antlr.g, used by\r
-                                                        * scanner to translate $i.j attributes */\r
-set            reserved_positions;     /* set of token positions reserved by '#token T=i' cmds */\r
-set            all_tokens;                     /* set of all token types */\r
-set            imag_tokens;            /* set of all imaginary token types (EpToken, errclasses...) */\r
-set            tokclasses;                     /* set of all token class token types */\r
-ListNode *ForcedTokens = 0;    /* list of token_id/token_num pairs to remap */\r
-ListNode *MetaTokenNodes=NULL; /* list of meta token refs such as token classes etc... */\r
-int            *TokenInd=NULL;         /* an indirection level between token num and position\r
-                                                        * of that token def in TokenStr and ExprStr */\r
-int            LastTokenCounted=0;     /* ==TokenNum if no token renumbering (same as old TokenNum) */\r
-int            TokenNum=TokenStart;\r
-char   **TokenStr=NULL;        /* map token # to token name */\r
-char   **ExprStr=NULL;         /* map token # to expr */\r
-Junction **RulePtr=NULL;       /* map rule # to RuleBlk node of rule */\r
-ListNode *ExprOrder=NULL;      /* list of exprs as they are found in grammar */\r
-ListNode *BeforeActions=NULL;/* list of grammar actions before rules */\r
-ListNode *AfterActions=NULL;/* list of grammar actions after rules */\r
-ListNode *LexActions=NULL;     /* list of lexical actions */\r
-\r
-/* MR1                                                                                     */\r
-/* MR1  11-Apr-97      Provide mechanism for inserting code into DLG class     */\r
-/* MR1                         via #lexmember <<....>>                             */\r
-/* MR1                         via #lexprefix <<....>>                             */\r
-/* MR1                                                                                     */\r
-\r
-ListNode *LexMemberActions=NULL;/* list of lexical header member decl   MR1 */\r
-ListNode *LexPrefixActions=NULL;/* list of lexical header #include decl MR1 */\r
-ListNode **Cycles=NULL;                /* list of cycles (for each k) found when\r
-                                                          doing FOLLOWs */\r
-ListNode *eclasses=NULL;       /* list of error classes */\r
-ListNode *tclasses=NULL;       /* list of token classes */\r
-LClass  lclass[MaxLexClasses]; /* array of lex class definitions */\r
-int             CurrentLexClass;       /* index into lclass */\r
-int             NumLexClasses=0;       /* in range 1..MaxLexClasses (init 0) */\r
-\r
-char   *HdrAction=NULL;        /* action defined with #header */\r
-char    *FirstAction=NULL;  /* action defined with #first MR11 */\r
-FILE   *ErrFile;                       /* sets and error recovery stuff */\r
-FILE   *DefFile=NULL;          /* list of tokens, return value structs, setwd defs */\r
-FILE    *MRinfoFile=NULL;   /* MR10 information file */\r
-int     MRinfo=0;           /* MR10 */\r
-int     MRinfoSeq=0;        /* MR10 */\r
-int     InfoP=0;            /* MR10 predicates        */\r
-int     InfoT=0;            /* MR10 tnodes            */\r
-int     InfoF=0;            /* MR10 first/follow sets */\r
-int     InfoM=0;            /* MR10 monitor progress  */\r
-int     InfoO=0;            /* MR12 orphan rules      */\r
-int     TnodesInUse=0;      /* MR10 */\r
-int     TnodesPeak=0;       /* MR10 */\r
-int     TnodesAllocated=0;  /* MR10 */\r
-int     TnodesReportThreshold=0;    /* MR11 */\r
-int     PotentialSuppression=0; /* MR10 */\r
-int     PotentialDummy=0;       /* MR10 */\r
-int            CannotContinue=FALSE;\r
-int            OutputLL_k = 1;         /* LL_k for parsing must be power of 2 */\r
-int            action_file;            /* used to track start of action */\r
-int            action_line;\r
-int            FoundGuessBlk=0;        /* there is a (...)? block somewhere in grammar */\r
-int            FoundException=0;       /* there is an exception somewhere in grammar */\r
-/* MR6 Distinguish between @ operator and real exception                   */\r
-/* MR6    by keeping separate flags for @ operator and real exceptions             */\r
-int            FoundAtOperator=0;                                                           /* MR6 */\r
-int            FoundExceptionGroup=0;                                               /* MR6 */\r
-int            pLevel=0;                       /* print Level */\r
-int            pAlt1,pAlt2;            /* print "==>" in front of these alts */\r
-\r
-/* C++ output stuff */\r
-FILE   *Parser_h,                      /* where subclass of ANTLRParser goes */\r
-               *Parser_c;                      /* where code for subclass of ANTLRParser goes */\r
-char   Parser_h_Name[MaxFileName+1] = "";\r
-char   Parser_c_Name[MaxFileName+1] = "";\r
-char    MRinfoFile_Name[MaxFileName+1] = "";                /* MR10 */\r
-char    *ClassDeclStuff=NULL;                               /* MR10 */\r
-char    *BaseClassName=NULL;                                /* MR22 */\r
-/* list of actions inside the #class {...} defs */\r
-ListNode *class_before_actions=NULL;\r
-ListNode *class_after_actions=NULL;\r
-\r
-char   CurrentClassName[MaxRuleName]="";\r
-int            no_classes_found=1;\r
-char   *UserTokenDefsFile;\r
-int            UserDefdTokens=0;       /* found #tokdefs? */\r
-char   *OutputDirectory=TopDirectory;\r
-ExceptionGroup *DefaultExGroup = NULL;\r
-int            NumSignals = NumPredefinedSignals;\r
-int            ContextGuardTRAV=0;\r
-\r
-char    *MR_AmbAidRule=NULL;        /* MR11 */\r
-int     MR_AmbAidLine=0;            /* MR11 */\r
-int     MR_AmbAidDepth=0;           /* MR11 */\r
-int     MR_AmbAidMultiple=0;        /* MR11 */\r
-int     MR_skipped_e3_report=0;     /* MR11 */\r
-int     MR_usingPredNames=0;        /* MR11 */\r
-int     MR_BadExprSets=0;           /* MR13 */\r
-int     MR_Inhibit_Tokens_h_Gen=0;  /* MR13 */\r
-int     NewAST=0;                   /* MR13 */\r
-int            tmakeInParser=0;            /* MR23 */\r
-int     AlphaBetaTrace=0;           /* MR14 */\r
-int            MR_BlkErr=0;                            /* MR21 */\r
-int     MR_AlphaBetaMessageCount=0; /* MR14 */\r
-int     MR_AlphaBetaWarning=0;      /* MR14 */\r
-int     MR_ErrorSetComputationActive=0;     /* MR14 */\r
-int     MR_MaintainBackTrace=0;             /* MR14 */\r
-set     MR_CompromisedRules;        /* MR14 */\r
-\r
-Junction    *MR_RuleBlkWithHalt;    /* MR10 */\r
-\r
-                                       /* C m d - L i n e  O p t i o n s */\r
-\r
-int            LL_k=1;                         /* how many tokens of full lookahead */\r
-int            CLL_k= -1;                      /* how many tokens of compressed lookahead */\r
-int            PrintOut = FALSE;       /* print out the grammar */\r
-int            PrintAnnotate = FALSE;/* annotate printout with FIRST sets */\r
-int            CodeGen=TRUE;           /* Generate output code? */\r
-int            LexGen=TRUE;            /* Generate lexical files? (tokens.h, parser.dlg) */\r
-int            GenAST=FALSE;           /* Generate AST's? */\r
-int            GenANSI=FALSE;          /* Generate ANSI code where necessary */\r
-int            GenExprSetsOpt=TRUE;/* use sets not (LA(1)==tok) expression lists */\r
-int            GenCR=FALSE;            /* Generate cross reference? */\r
-int            GenLineInfo=FALSE;      /* Generate # line "file" stuff? */\r
-int            GenLineInfoMS=FALSE;/* Like -gl but replace "\" with "/" for MS C/C++ systems */\r
-int            TraceGen=FALSE;         /* Generate code to trace rule invocation */\r
-int            elevel=1;                       /* error level for ambiguity messages */\r
-int            GenEClasseForRules=0;/* don't generate eclass for each rule */\r
-int            TreeResourceLimit= -1;/* don't limit tree resource */\r
-int            DemandLookahead = 0;/* demand/delayed lookahead or not */\r
-char   *RulePrefix = "";       /* prefix each generated rule with this */\r
-char   *stdpccts = "stdpccts.h";/* where to generate std pccts include file */\r
-int            GenStdPccts = 0;        /* don't gen stdpccts.h? */\r
-int            ParseWithPredicates = 1;\r
-int            WarningLevel = 1;\r
-int            UseStdout = 0;                                  /* MR6 */\r
-int            TabWidth = 2;                                   /* MR6 */ /* MR27 */\r
-int            HoistPredicateContext = 0;\r
-int     MRhoisting = 0;                 /* MR9 */\r
-int     MRhoistingk = 0;                /* MR13 */\r
-int     MR_debugGenRule=0;              /* MR11 */\r
-\r
-int            GenCC = 0;                      /* Generate C++ output */\r
-\r
-PointerStack MR_BackTraceStack={0,0,NULL};            /* MR10 */\r
-PointerStack MR_PredRuleRefStack={0,0,NULL};          /* MR10 */\r
-PointerStack MR_RuleBlkWithHaltStack={0,0,NULL};      /* MR10 */\r
-\r
-/* DontCopyTokens and Pragma_DupLabeledTokens were a bad idea.  I've just\r
-   turned them off rather than backpatching the code.  Who knows?  We\r
-   may need them in the future.\r
- */\r
-int            DontCopyTokens = 1;     /* in C++, don't copy ANTLRToken passed to ANTLR */\r
-\r
-/* Remember if LT(i), LA(i), or LATEXT(i) used in an action which is not\r
-   a predicate.  If so, give a warning for novice users.\r
-*/\r
-\r
-int     LTinTokenAction = 0; /* MR23 */\r
-int     PURIFY = 1;          /* MR23 */\r
-\r
-int     CurBlockID_array[MAX_BLK_LEVEL]; /* MR23 */\r
-int     CurAltNum_array[MAX_BLK_LEVEL]; /* MR23 */\r