generic.h revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
/*
* generic.h -- generic include stuff for new PCCTS ANTLR.
*
* 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
*/
#define StrSame 0
#define DefaultParserName "zzparser"
/* MR9 JVincent@novell.com Allow user to override default ZZLEXBUFSIZE */
/* MR11 thm Raise antlr's own default ZZLEXBUFSIZE to 8k */
/* MR22 thm Raise antlr's own default ZZLEXBUFSIZE to 32k */
#ifndef ZZLEXBUFSIZE
#define ZZLEXBUFSIZE 32000
#endif
/* E r r o r M a c r o s */
/* S a n i t y C h e c k i n g */
#ifndef require
#endif
/* L i s t N o d e s */
typedef struct _ListNode {
void *elem; /* pointer to any kind of element */
} ListNode;
/* Define a Cycle node which is used to track lists of cycles for later
* reconciliation by ResolveFoCycles().
*/
typedef struct _c {
int croot; /* cycle root */
unsigned deg; /* degree of FOLLOW set of croot */
} Cycle;
typedef struct _e {
int tok; /* error class name == TokenStr[tok] */
int setdeg; /* how big is the set */
int lexclass; /* which lex class is it in? */
} ECnode;
typedef struct _TCnode {
int tok; /* token class name */
int lexclass; /* which lex class is it in? */
unsigned char dumped; /* this def has been been dumped */
unsigned char dumpedComplement; /* this def has been been dumped */
unsigned setnum; /* which set number is this guy? (if dumped) */
unsigned setnumComplement; /* MR23 */
unsigned setnumErrSet; /* MR23 which set is this #tokclass error set (if dumped) */
unsigned setnumErrSetComplement; /* MR23 */
} TCnode;
typedef struct _ft {
char *token; /* id of token type to remap */
int tnum; /* move token type to which token position */
} ForcedToken;
typedef struct _ContextGuardPredicates { /* MR13 */
} ContextGuardPredicates; /* MR13 */
/* H a s h T a b l e E n t r i e s */
typedef struct _t { /* Token name or expression */
char *str;
int token; /* token number */
char *action;
char *akaString;
} TermEntry;
typedef struct _r { /* Rule name and ptr to start of rule */
char *str;
int rulenum; /* RulePtr[rulenum]== ptr to RuleBlk junction */
unsigned char noAST;/* gen AST construction code? (def==gen code) */
char *egroup; /* which error group (err reporting stuff) */
#if 0
/* MR27 This appears to never be used. Delete this code later. */
#endif
unsigned char has_rule_exception;
char dontComputeErrorSet; /* MR14 - don't compute error set
special for rule in alpha part of
(alpha)? beta block */
} RuleEntry;
char *str; /* key == (rulename, computation, k) */
int incomplete; /* only w/FOLLOW sets. Use only if complete */
} CacheEntry;
typedef struct _LabelEntry { /* element labels */
char *str;
/* Is there an exception attached to label? */
/* next EG if ex_group doesn't catch it MR7 */
/* too lazy to use ListNode ? MR7 */
int curAltNum; /* MR7 */
} LabelEntry;
typedef struct _SignalEntry {
char *str;
int signum; /* unique signal number */
} SignalEntry;
typedef struct _PredEntry { /* MR11 predicate name and ptr to string */
char *str;
struct _PredEntry *next;
int file;
int line;
char *predLiteral;
} PredEntry;
typedef struct _PointerStack { /* MR10 */
int count;
int size;
void **data;
} PointerStack;
typedef struct _UserAction {
char *action;
} UserAction;
/* L e x i c a l C l a s s */
/* to switch lex classes, switch ExprStr and Texpr (hash table) */
typedef struct _lc {
} LClass;
typedef struct _exprOrder {
char *expr;
int lclass;
} Expr;
/* M a x i m u m s */
/* MR20 Note G. Hobbelt These values are superceded by values in hash.h */
#ifndef HashTableSize
#define HashTableSize 253
#endif
#ifndef StrTableSize
#endif
/* TokenStart and EofToken are ignored if #tokdefs meta-op is used */
#ifndef MaxNumFiles
#define MaxNumFiles 99
#endif
/**** MR9 JVincent@novell.com Move to pcctscfg.h */
#define NumPredefinedSignals 3
/* S t a n d a r d S i g n a l s */
#define sigNoSignal 0
#define sigMismatchedToken 1
#define sigNoViableAlt 2
#define sigNoSemViableAlt 3
/* AST token types */
#define ASTexclude 0
#define ASTchild 1
#define ASTroot 2
#define PredictionVariable "zzpr_expr"
#define PredictionLexClassSuffix "_zzpred"
#define WildCardString "WildCard"
#if 0
/* Removed in version 1.33MR19
Don't understand why this never caused problems before
*/
/*********************************************************
#ifndef ANTLRm
#define ANTLRm(st, f, _m) zzbufsize = ZZLEXBUFSIZE;\
zzmode(_m); \
zzenterANTLR(f); \
st; ++zzasp; \
zzleaveANTLR(f);
#endif
*********************************************************/
#endif
#include "proto.h"
#include "pcctscfg.h" /* MR14 */
#include <string.h>