/* * PARSE.H * * (c)Copyright 1993-2014, Matthew Dillon, All Rights Reserved. See the * COPYRIGHT file at the base of the distribution. */ struct IPNode; typedef RUNE_HEAD(ipnodelist, IPNode) ipnodelist_t; typedef struct IPNode { RUNE_ENTRY(IPNode) ip_Node; char *ip_Path; int ip_Flags; } IPNode; #define IPF_STATIC 0x0001 /* embedded in some other structure */ #define IPF_ABSOLUTE 0x0002 /* treat path as absolute even if it isn't */ #define IPF_BASEPATH 0x0004 /* flag to prefix with basepath later */ typedef struct Parse { Lex *p_Lex; /* lexical scanner */ token_t p_Token; /* lexical scanner */ Stmt *p_Import; /* parse file as import content */ Stmt *p_CurStmt; /* current statement */ SemGroup *p_CurSemGroup; /* current semantic group */ IPNode p_IPath; int p_Format; /* source, pre-parsed, object, etc. */ int p_ArgAc; /* passed to main() */ char **p_ArgAv; /* passed to main() */ int32_t p_RetVal; /* ret value from main() (32 bit int) */ struct stat p_St; /* stat information to detect sharing */ } Parse; #define PFMT_SOURCE 1 #define PFMT_PARSED 2 #define PFMT_RESOLVED 3 #define dassert_parse(p, type, cond) if (!(cond)) ParseFatalError(p, type) #define ParseFatalError(p, type) \ do { \ LexError(&(p)->p_Token, type); \ LexPrintError(&p->p_Token); \ dpanic(""); \ } while(0)