src/parser.h

changeset 138
a426c1039655
parent 135
8b9132fea327
child 139
cf11621ae422
equal deleted inserted replaced
137:73d057b030d0 138:a426c1039655
37 37
38 class DataBuffer; 38 class DataBuffer;
39 class Lexer; 39 class Lexer;
40 class Variable; 40 class Variable;
41 41
42 // ============================================================================ 42 // _________________________________________________________________________________________________
43 //
43 // Mark types 44 // Mark types
44 // 45 //
45 named_enum MarkType : char 46 named_enum MarkType : char
46 { 47 {
47 MARK_Label, 48 MARK_Label,
48 MARK_If, 49 MARK_If,
49 MARK_Internal, // internal structures 50 MARK_Internal, // internal structures
50 }; 51 };
51 52
52 // ============================================================================ 53 // _________________________________________________________________________________________________
54 //
53 // Scope types 55 // Scope types
54 // 56 //
55 named_enum ScopeType : char 57 named_enum ScopeType : char
56 { 58 {
57 SCOPE_Unknown, 59 SCOPE_Unknown,
80 WRITE_Mutable, // normal read-many-write-many variable 82 WRITE_Mutable, // normal read-many-write-many variable
81 WRITE_Const, // write-once const variable 83 WRITE_Const, // write-once const variable
82 WRITE_Constexpr, // const variable whose value is known to compiler 84 WRITE_Constexpr, // const variable whose value is known to compiler
83 }; 85 };
84 86
85 // ============================================================================= 87 // _________________________________________________________________________________________________
86 // 88 //
87 // Parser mode: where is the parser at? 89 // Parser mode: where is the parser at?
88 // 90 //
89 named_enum class ParserMode 91 named_enum class ParserMode
90 { 92 {
93 MainLoop, // inside mainloop 95 MainLoop, // inside mainloop
94 Onenter, // inside onenter 96 Onenter, // inside onenter
95 Onexit, // inside onexit 97 Onexit, // inside onexit
96 }; 98 };
97 99
98 // ============================================================================ 100 // _________________________________________________________________________________________________
99 // 101 //
100 struct Variable 102 struct Variable
101 { 103 {
102 String name; 104 String name;
103 String statename; 105 String statename;
112 { 114 {
113 return statename.isEmpty(); 115 return statename.isEmpty();
114 } 116 }
115 }; 117 };
116 118
117 // ============================================================================ 119 // _________________________________________________________________________________________________
118 // 120 //
119 struct CaseInfo 121 struct CaseInfo
120 { 122 {
121 ByteMark* mark; 123 ByteMark* mark;
122 int number; 124 int number;
123 DataBuffer* data; 125 DataBuffer* data;
124 }; 126 };
125 127
126 // ============================================================================ 128 // _________________________________________________________________________________________________
127 // 129 //
128 // Meta-data about scopes 130 // Meta-data about scopes
129 // 131 //
130 struct ScopeInfo 132 struct ScopeInfo
131 { 133 {
143 List<Variable*> localVariables; 145 List<Variable*> localVariables;
144 List<Variable*> globalVariables; 146 List<Variable*> globalVariables;
145 List<Variable*> globalArrays; 147 List<Variable*> globalArrays;
146 }; 148 };
147 149
148 // ============================================================================ 150 // _________________________________________________________________________________________________
149 // 151 //
150 class BotscriptParser 152 class BotscriptParser
151 { 153 {
152 PROPERTY (public, bool, isReadOnly, setReadOnly, STOCK_WRITE) 154 PROPERTY (public, bool, isReadOnly, setReadOnly, STOCK_WRITE)
153 155

mercurial