blob: 48c4bb245d74b9965c6492214683bc4d65943e00 [file] [log] [blame]
Andreas Huberc9410c72016-07-28 12:18:40 -07001#ifndef AST_H_
2
3#define AST_H_
4
5#include <android-base/macros.h>
Andreas Hubereb1081f2016-07-28 13:13:24 -07006#include <string>
Andreas Huberc9410c72016-07-28 12:18:40 -07007#include <utils/Vector.h>
8
9namespace android {
10
11struct Formatter;
12struct Type;
13struct Scope;
14
15struct AST {
16 AST();
17 ~AST();
18
19 static AST *Parse(const char *path);
20
Andreas Hubereb1081f2016-07-28 13:13:24 -070021 void setVersion(const char *major, const char *minor);
22 void setPackage(Vector<std::string> *packagePath);
23 void addImport(Vector<std::string> *importPath);
24
Andreas Huberc9410c72016-07-28 12:18:40 -070025 void enterScope(Scope *container);
26 void leaveScope();
27 Scope *scope();
28
29 void *scanner();
30 void setScanner(void *scanner);
31
32 Type *lookupType(const char *name);
33
34 void dump(Formatter &out) const;
35
36private:
37 Vector<Scope *> mScopePath;
38
39 void *mScanner;
40 Scope *mRootScope;
41
42 DISALLOW_COPY_AND_ASSIGN(AST);
43};
44
45} // namespace android
46
47#endif // AST_H_