1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
/*
* globals.c
*
* SOFTWARE RIGHTS
*
* We reserve no LEGAL rights to SORCERER -- SORCERER is in the public
* domain. An individual or company may do whatever they wish with
* source code distributed with SORCERER or the code generated by
* SORCERER, including the incorporation of SORCERER, or its output, into
* commerical software.
*
* We encourage users to develop software with SORCERER. However, we do
* ask that credit is given to us for developing SORCERER. 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 SORCERER and have developed a nice tool with the
* output, please mention that you developed it using SORCERER. 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.
*
* SORCERER 1.00B
* Terence Parr
* Parr Research Corporation
* With AHPCRC, University of Minnesota
* 1992-1995
*/
#include "stdpccts.h"
char *Version = "1.00B15";
char *VersionText = "100B15";
char *FileStr[MaxNumFiles];/* Ptr to array of file names on command-line */
int NumFiles=0; /* current grammar file number */
int action_file; /* used to track start of action */
int action_line;
int CurFile= -1; /* Index into FileStr table */
char *CurRule=NULL; /* Pointer to current rule name */
char *CurRetDef=NULL; /* Pointer to current return type definition */
char *CurParmDef=NULL; /* Pointer to current parameter definition */
FILE *output=NULL; /* current parser output file */
FILE *input=NULL; /* current grammar input file */
Entry **symbols; /* both tokens and nonterminals */
int token_table_size = 1000;
char **token_dict=NULL;
int token_type = 1; /* used only if #tokdefs it not used */
int end_of_input = 0;
int epsilon = 0;
int last_valid_token = 0;
int DumpIR = 0;
char *OutputDirectory = TopDirectory;
ListNode *before_actions = NULL,
*after_actions = NULL,
*class_actions = NULL;
char translator[MaxFileName+1];
char tokdefs_file[MaxFileName+1];
char *header_action = NULL;
AST *rules=NULL;
int print_guts = 0;
int transform = 0; /* Don't assume a transformation */
int found_guess_block = 0;
char *def_token_file=NULL;
int def_tokens=0;
ListNode *token_list = NULL;
int found_error=0;
set referenced_tokens = set_init;
int wild_card = 0;
int UserDefdTokens=0;
int Inline = 0;
char *Prefix="";
FILE *ProtoFILE = NULL;
char *GenProtoFile = NULL;
ListNode *RefVars = NULL;
ListNode *AllRefVars = NULL;
char CurRefVarType[MaxAtom+1];
char CurRefVarLabel[MaxAtom+1];
char CurClassName[MaxAtom+1]="";
int GenCPP = 0;
#if defined(__STDC__) || defined(__cplusplus)
int GenAnsiProtos=1; /* Gen both if both Protos are on */
int GenKRProtos=0;
#else
int GenAnsiProtos=0;
int GenKRProtos=1;
#endif
|