aboutsummaryrefslogtreecommitdiff
path: root/src/ast.rs
diff options
context:
space:
mode:
authorJJ2023-10-31 07:47:54 +0000
committerJJ2023-10-31 07:47:54 +0000
commit87d74952a614daa7075aeecef462ff51c4dc46e0 (patch)
tree3ab7269e32dbbbfc2adbf7061e886159cb90f968 /src/ast.rs
parentf3efbfc03fabae11df0554e67769327d4dc57a83 (diff)
compiler: implement most of the parser
Diffstat (limited to 'src/ast.rs')
-rw-r--r--src/ast.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ast.rs b/src/ast.rs
index e55b473..6c7963e 100644
--- a/src/ast.rs
+++ b/src/ast.rs
@@ -59,6 +59,7 @@ pub enum Binding {
value: Option<Box<Expr>> // variable bindings can be delayed
},
Const {
+ public: bool,
id: Pattern,
kind: Option<Type>,
value: Box<Expr>
@@ -83,7 +84,7 @@ pub struct ParamDecl { id: Id, kind: Type }
/// Expressions related to control flow.
pub enum Control {
Call { id: Id, params: Vec<Expr> }, // function calls, macro invocations, field access...
- Cond {
+ If {
branches: Vec<CondBranch>,
else_body: Option<Vec<Expr>>
},
@@ -93,7 +94,7 @@ pub enum Control {
finally: Option<Vec<Expr>>
},
Match {
- item: Box<Expr>,
+ item: Pattern,
branches: Vec<MatchBranch>
},
Block { id: Option<Id>, body: Vec<Expr> },