abouttreesummaryrefslogcommitdiff
path: root/src/repr.h
diff options
context:
space:
mode:
authorPatrick Schönberger2021-07-31 23:18:40 +0200
committerPatrick Schönberger2021-07-31 23:18:40 +0200
commit9f5457a18f551d261e4bd380ea16a52dc5b04cf9 (patch)
treea0db0635e21039374a022d1f0619c88dcb5d0dd8 /src/repr.h
parent5f9668526491332f62c05ad831dbf6d5fdc2b6d0 (diff)
downloadtoc-9f5457a18f551d261e4bd380ea16a52dc5b04cf9.tar.gz
toc-9f5457a18f551d261e4bd380ea16a52dc5b04cf9.zip
compile again
Diffstat (limited to 'src/repr.h')
-rw-r--r--src/repr.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/repr.h b/src/repr.h
index c745ba1..cc28746 100644
--- a/src/repr.h
+++ b/src/repr.h
@@ -97,6 +97,7 @@ struct LitExpr {
bool _bool;
};
+// TODO: accessExpr
struct IdentifierExpr {
std::string name;
};
@@ -107,14 +108,17 @@ struct BracketsExpr {
};
enum class UnaryOperatorType {
- Plus, Minus, IncrementPre, DecrementPre, IncrementPost, DecrementPost, LogicalNot, BitwiseNot, Dereference, AddressOf
+ Plus, Minus, IncrementPre, DecrementPre, IncrementPost, DecrementPost,
+ LogicalNot, BitwiseNot, Dereference, AddressOf,
+ COUNT
};
enum class BinaryOperatorType {
Plus, Minus, Multiply, Divide, Modulo, BitwiseAnd, BitwiseOr, BitwiseXor, LessThan, GreaterThan,
LeftShift, RightShift, LogicalAnd, LogicalOr, Equals, NotEquals, LessThanEquals, GreaterThanEquals, BitwiseAndEquals, BitwiseOrEquals, BitwiseXorEquals,
PlusEquals, MinusEquals, MultiplyEquals, DivideEquals, ModuloEquals,
- LeftShiftEquals, RightShiftEquals
+ LeftShiftEquals, RightShiftEquals,
+ COUNT
};
static std::string UnaryOperatorTypeStrings[] = {
"+", "-", "++", "--", "++", "--", "!", "~", "*", "&" };
@@ -143,10 +147,11 @@ struct TernaryOperatorExpr {
};
struct DotExpr {
- std::shared_ptr<Expr> lexpr;
+ std::shared_ptr<Expr> expr;
IdentifierExpr ident;
};
+// TODO: paren expr
struct Expr {
ExprType type;
@@ -185,8 +190,10 @@ struct SwitchStmt {
std::vector<SwitchCase> cases;
};
+// TODO: int i = 0 (var decl)
struct ForStmt {
- AssignStmt assign;
+ std::string varName;
+ std::shared_ptr<Expr> initValue;
std::shared_ptr<Expr> condition;
std::shared_ptr<Expr> action;
Body body;
@@ -198,8 +205,8 @@ struct WhileStmt {
};
struct AssignStmt {
- Expr lexpr;
- Expr rexpr;
+ std::string name;
+ Expr expr;
};
struct ReturnStmt {