4 * (c)Copyright 1993-2014, Matthew Dillon, All Rights Reserved. See the
5 * COPYRIGHT file at the base of the distribution.
22 void LexDebugLine(token_t *tok);
27 Declaration *FindDeclId(SemGroup *db, string_t id, int *eno);
28 Declaration *FindDeclIdLevel(SemGroup *db, string_t id, int level, int *eno);
29 Declaration *FindDeclByIndex(SemGroup *sg, int index);
30 void DeclPrintError(Declaration *d, int type);
31 Declaration *FindDeclPath(LexRef *lexRef, SemGroup *osg, SemGroup *sg,
32 Type *nomatch, string_t *ary, int mask,
33 int *visibility, int level, int *eno);
34 Declaration *FindDeclPathAltContext(LexRef *lexRef, SemGroup *osg, SemGroup *sg,
35 Type *nomatch, string_t *ary, int mask,
36 int *visibility, int level, int *eno);
37 void *FindDLLSymbol(SemGroup *osg, SemGroup *sg, string_t id);
42 void ExpPrintError(Exp *exp, int type);
47 Lex *LexOpen(const char *path, token_t *tok);
48 void LexClose(Lex **plex);
49 int LexRedactToken(token_t *tok, int bytes);
50 int LexPeekToken(token_t *tok);
51 int LexToken(token_t *tok);
52 int LexSkipToken(token_t *tok, int type);
53 int LexStripQuotes(token_t *tok, token_t *tmp);
54 int LexError(token_t *tok, int err);
55 void LexPrintError(token_t *tok);
56 void LexPrintRef(LexRef *lr, int type);
57 void LexInitRef(LexRef *lr, token_t *tok);
58 void LexDupRef(LexRef *s, LexRef *d);
59 void LexDoneRef(LexRef *lr);
60 const char *LexErrStr(token_t *tok);
65 void LibRuneInit(void);
70 int ParseOpen(Stmt *st, Parse **pp, void **dll);
71 void ParseDone(Parse *p);
72 void ParseClose(Parse **pp);
73 void AddImportPath(const char *path, int flags);
74 void PrefixImportPaths(const char *basePath);
79 int ParseModule(Parse *p, Stmt *st, int t);
80 int ParseStmt(Parse *p, int t, Stmt **pst);
81 int ParseDeclarationStmt(Parse *p, int t, int idRequired, Stmt **pst,
82 int dop, Scope *scope);
87 int ParseScopeQual(Parse *p, int t, Scope *scope);
88 int ParseStorageQual(Parse *p, int t, int *pmask);
89 int ParseDeclaration(Parse *p, int t, Declaration **pd, int idRequired,
90 int dop, Scope *scope);
91 int ParseDeclarationList(Parse *p, int t, int scopeFlags,
92 int idRequired, int dop);
93 int ParseType(Parse *p, int t, Type **ptype, int sqflags);
94 int ParseDeclType(Parse *p, int t, Type **ptype, SemGroup **psg,
95 int scopeFlags, int rqflags, string_t *id,
101 int ParseExp(Parse *p, int t, Exp **pexp);
102 int ParseParenthesizedExp(Parse *p, int t, Exp **pexp, int docomp);
103 int ParseNotExp(Parse *p, int t, Exp **pexp);
108 void ResolveProject(Parse *p, Stmt *st);
109 Type *resolveType(Type *type, int flags);
114 Stmt *BuildRootImportStmt(const char *path);
115 void StmtPrintError(Stmt *st, int type);
120 string_t StrTableEscapeQuotedString(const char *str, int len, int term);
121 string_t StrTableAlloc(const char *str, int len, int special);
122 string_t StrTableToken(token_t *tok);
123 string_t StrTableInt(int v);
124 string_t StrTableDup(string_t str);
125 int StrTableSpecial(string_t id);
126 int StrTableLen(string_t id);
127 int StrCmpToken(string_t id, token_t *tok);
128 void ReplaceStrTable(string_t *pstr, string_t id);
129 void RelStrTable(string_t *pstr);
130 const char *StripPathId(const char *path, int *len);
131 int SimpleIntToken(token_t *tok, int *rv);
132 int SimpleRunesizeToken(token_t *tok, runesize_t *rv);
137 int SymKeywordFind(const char *ptr, int len, int t);
142 char *TypeToStr(Type *type, char **pstr);
143 int SameType(Type *t1, Type *t2, int sqFlags2);
144 int SimilarType(Type *t1, Type *t2);
145 int SimilarSemGroup(SemGroup *s1, SemGroup *s2);
146 int MatchType(Type *super, Type *type);
147 void InternalRegisterType(const char *str, Type *type);
148 Type *InternalRegisteredTypeLookup(string_t id);
149 void initType(Type *type, typelist_t *list, int op);
150 void initQualType(Type *type, typelist_t *list, int op, int sqflags);
151 void initPtrType(Type *type, Type *ptrto, int sqflags);
152 void initCPtrType(Type *type, Type *ptrto, int sqflags);
153 SemGroup *BaseType(Type **ptype);
156 * High-level Interpreter and Generator
158 runctx_p RunUnresolvedStmt(runctx_p ct, Stmt *st);
159 genctx_p GenUnresolvedStmt(genctx_p ct, Stmt *st);
161 rundata_t RunUnresolvedExp(runctx_p ct, Exp *exp);
162 gendata_t *GenUnresolvedExp(genctx_p ct, Exp *exp);
164 extern Type DynamicRValueType;
165 extern Type DynamicLValueType;
166 extern Type NumericType;
167 extern Type IntegralType;
168 extern Type SIntegerType;
169 extern Type UIntegerType;
170 extern Type VoidType;
171 extern Type BoolType;
172 extern Type Int8Type;
173 extern Type UInt8Type;
174 extern Type Int16Type;
175 extern Type UInt16Type;
176 extern Type Int32Type;
177 extern Type UInt32Type;
178 extern Type Int64Type;
179 extern Type UInt64Type;
180 extern Type Int128Type;
181 extern Type UInt128Type;
183 extern Type FloatType;
184 extern Type Float32Type;
185 extern Type Float64Type;
186 extern Type Float128Type;
188 extern Type CCharType;
189 extern Type StrType; /* NOTE: const char *, chars are unsigned */
190 extern Type CharPtrType;
191 extern Type CharPtrPtrType;
192 extern Type VoidPtrType;
193 extern Type VoidRefType;
194 extern Type CVoidPtrType;
195 extern Type LVoidPtrType;
196 extern Type PointerType; /* generic pointer placeholder */
198 extern Type LexRefType; /* run-time access class tie-ins */
199 extern Type ScopeType;
200 extern Type DeclarationType;
201 extern Type SemGroupType;
202 extern Type TypeType;
203 extern Type FILLERTypeType;
204 extern Type FILLERDeclType;
206 extern Type IntPtrType;
207 extern Type UIntPtrType;
209 extern Type SizeType;