]> gitweb.ps.run Git - toc/blobdiff - src/repr.h
type modifiers, parenthesized expressions, chained access expressions
[toc] / src / repr.h
index c745ba17b3c3ae65d4f68a08b0a2a3cfe4f3f2f4..e45464cf4c2fd2b618d49bbe1627a6e3ee6ea0fb 100644 (file)
@@ -22,6 +22,7 @@ struct UnaryOperatorExpr;
 struct BinaryOperatorExpr;\r
 struct TernaryOperatorExpr;\r
 struct DotExpr;\r
+struct ParenExpr;\r
 struct Expr;\r
 struct IfStmt;\r
 struct SwitchStmt;\r
@@ -38,6 +39,7 @@ enum class TypeModifierType {
 struct TypeModifier {\r
   TypeModifierType type;\r
 \r
+  bool _staticArray;\r
   int _arraySize;\r
 };\r
 \r
@@ -97,6 +99,7 @@ struct LitExpr {
   bool _bool;\r
 };\r
 \r
+// TODO: accessExpr\r
 struct IdentifierExpr {\r
   std::string name;\r
 };\r
@@ -107,14 +110,17 @@ struct BracketsExpr {
 };\r
 \r
 enum class UnaryOperatorType {\r
-  Plus, Minus, IncrementPre, DecrementPre, IncrementPost, DecrementPost, LogicalNot, BitwiseNot, Dereference, AddressOf\r
+  Plus, Minus, IncrementPre, DecrementPre, IncrementPost, DecrementPost,\r
+  LogicalNot, BitwiseNot, Dereference, AddressOf,\r
+  COUNT\r
 };\r
 \r
 enum class BinaryOperatorType {\r
   Plus, Minus, Multiply, Divide, Modulo, BitwiseAnd, BitwiseOr, BitwiseXor, LessThan, GreaterThan,\r
   LeftShift, RightShift, LogicalAnd, LogicalOr, Equals, NotEquals, LessThanEquals, GreaterThanEquals, BitwiseAndEquals, BitwiseOrEquals, BitwiseXorEquals,\r
   PlusEquals, MinusEquals, MultiplyEquals, DivideEquals, ModuloEquals,\r
-  LeftShiftEquals, RightShiftEquals\r
+  LeftShiftEquals, RightShiftEquals,\r
+  COUNT\r
 };\r
 static std::string UnaryOperatorTypeStrings[] = {\r
   "+", "-", "++", "--", "++", "--", "!", "~", "*", "&" };\r
@@ -143,13 +149,16 @@ struct TernaryOperatorExpr {
 };\r
 \r
 struct DotExpr {\r
-  std::shared_ptr<Expr> lexpr;\r
+  std::shared_ptr<Expr> expr;\r
   IdentifierExpr ident;\r
 };\r
 \r
+// TODO: paren expr\r
 struct Expr {\r
   ExprType type;\r
 \r
+  bool parenthesized;\r
+\r
   FuncExpr            _func;\r
   LitExpr             _lit;\r
   IdentifierExpr      _identifier;\r
@@ -185,8 +194,10 @@ struct SwitchStmt {
   std::vector<SwitchCase> cases;\r
 };\r
 \r
+// TODO: int i = 0 (var decl)\r
 struct ForStmt {\r
-  AssignStmt assign;\r
+  std::string varName;\r
+  std::shared_ptr<Expr> initValue;\r
   std::shared_ptr<Expr> condition;\r
   std::shared_ptr<Expr> action;\r
   Body body;\r
@@ -198,8 +209,8 @@ struct WhileStmt {
 };\r
 \r
 struct AssignStmt {\r
-  Expr lexpr;\r
-  Expr rexpr;\r
+  std::string name;\r
+  Expr expr;\r
 };\r
 \r
 struct ReturnStmt {\r