7 #include "TocParser.h"
\r
24 struct PrefixOperatorExpr;
\r
25 struct PostfixOperatorExpr;
\r
26 struct BinaryOperatorExpr;
\r
27 struct TernaryOperatorExpr;
\r
28 struct BracketsExpr;
\r
29 struct IdentifierExpr;
\r
40 enum class TypeModifierType
\r
47 TypeModifierType type;
\r
55 std::vector<std::string> namespacePrefixes;
\r
57 std::vector<TypeModifier> modifiers;
\r
68 std::vector<Variable> variables;
\r
69 std::vector<Stmt> statements;
\r
76 std::vector<Variable> parameters;
\r
80 template<typename T>
\r
85 operator T() { return t; }
\r
91 std::vector<StructMember<Variable>> members;
\r
92 std::vector<StructMember<Function>> methods;
\r
98 std::vector<Variable> variables;
\r
99 std::vector<Struct> structs;
\r
100 std::vector<Function> functions;
\r
101 std::vector<Namespace> namespaces;
\r
106 std::vector<Variable> variables;
\r
107 std::vector<Struct> structs;
\r
108 std::vector<Function> functions;
\r
109 std::vector<Namespace> namespaces;
\r
112 enum class ExprType
\r
114 Func, Method, Lit, Paren, Dot, PrefixOp, PostfixOp, BinaryOp, TernaryOp, Bracket, Identifier
\r
119 std::vector<std::string> namespacePrefixes;
\r
120 std::string functionName;
\r
121 std::vector<Expr> arguments;
\r
126 std::shared_ptr<Expr> expr;
\r
127 std::string methodName;
\r
128 std::vector<Expr> arguments;
\r
133 Int, Decimal, String, Bool
\r
142 std::string _string;
\r
148 std::shared_ptr<Expr> expr;
\r
153 std::shared_ptr<Expr> expr;
\r
154 std::string identifier;
\r
157 enum class PrefixOperatorType
\r
159 Plus, Minus, Increment, Decrement,
\r
160 LogicalNot, BitwiseNot, Dereference, AddressOf,
\r
163 static std::string PrefixOperatorTypeStrings[] =
\r
165 "+", "-", "++", "--", "!", "~", "*", "&" };
\r
167 struct PrefixOperatorExpr
\r
169 PrefixOperatorType type;
\r
170 std::shared_ptr<Expr> expr;
\r
173 enum class PostfixOperatorType
\r
175 Increment, Decrement,
\r
178 static std::string PostfixOperatorTypeStrings[] =
\r
182 struct PostfixOperatorExpr
\r
184 PostfixOperatorType type;
\r
185 std::shared_ptr<Expr> expr;
\r
188 enum class BinaryOperatorType
\r
190 Plus, Minus, Multiply, Divide, Modulo, BitwiseAnd, BitwiseOr, BitwiseXor, LessThan, GreaterThan,
\r
191 LeftShift, RightShift, LogicalAnd, LogicalOr, Equals, NotEquals, LessThanEquals, GreaterThanEquals, BitwiseAndEquals, BitwiseOrEquals, BitwiseXorEquals,
\r
192 PlusEquals, MinusEquals, MultiplyEquals, DivideEquals, ModuloEquals,
\r
193 LeftShiftEquals, RightShiftEquals,
\r
196 static std::string BinaryOperatorTypeStrings[] =
\r
198 "+", "-", "*", "/", "%", "&", "|", "^", "<", ">",
\r
199 "<<",">>","&&","||","==","!=","<=",">=","&=","|=","^=",
\r
200 "+=","-=","*=","/=","%=",
\r
203 struct BinaryOperatorExpr
\r
205 BinaryOperatorType type;
\r
206 std::shared_ptr<Expr> lexpr;
\r
207 std::shared_ptr<Expr> rexpr;
\r
210 struct TernaryOperatorExpr
\r
212 std::shared_ptr<Expr> lexpr;
\r
213 std::shared_ptr<Expr> rexprTrue;
\r
214 std::shared_ptr<Expr> rexprFalse;
\r
217 struct BracketsExpr
\r
219 std::shared_ptr<Expr> lexpr;
\r
220 std::shared_ptr<Expr> rexpr;
\r
223 struct IdentifierExpr
\r
225 std::vector<std::string> namespacePrefixes;
\r
226 std::string identifier;
\r
234 MethodExpr _method;
\r
238 PrefixOperatorExpr _prefixOp;
\r
239 PostfixOperatorExpr _postfixOp;
\r
240 BinaryOperatorExpr _binaryOp;
\r
241 TernaryOperatorExpr _ternaryOp;
\r
242 BracketsExpr _brackets;
\r
243 IdentifierExpr _identifier;
\r
246 enum class StmtType
\r
248 If, Switch, For, While, Assign, Return, Expr
\r
254 std::shared_ptr<Expr> expr;
\r
261 std::vector<ElseStmt> elses;
\r
266 std::shared_ptr<Expr> expr;
\r
272 std::shared_ptr<Expr> ident;
\r
273 std::vector<SwitchCase> cases;
\r
276 // TODO: int i = 0 (var decl)
\r
279 std::shared_ptr<AssignStmt> init;
\r
280 std::shared_ptr<Expr> condition;
\r
281 std::shared_ptr<Expr> action;
\r
306 SwitchStmt _switch;
\r
309 AssignStmt _assign;
\r
310 ReturnStmt _return;
\r