cl-parser: Rearrange to match cl-ast

Also reorder `Let` in the AST
This commit is contained in:
2024-07-31 02:35:41 -05:00
parent 97808fd855
commit 1eb0516baf
3 changed files with 478 additions and 457 deletions

View File

@@ -258,7 +258,6 @@ pub enum TyKind {
Tuple(TyTuple),
Ref(TyRef),
Fn(TyFn),
// TODO: slice, array types
}
/// An array of [`T`](Ty)
@@ -334,16 +333,6 @@ pub enum Semi {
Unterminated,
}
/// A local variable declaration [Stmt]
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct Let {
pub mutable: Mutability,
pub name: Sym,
pub ty: Option<Box<Ty>>,
pub init: Option<Box<Expr>>,
pub tail: Option<Box<Expr>>,
}
/// An expression, the beating heart of the language
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct Expr {
@@ -406,6 +395,16 @@ pub enum ExprKind {
Continue,
}
/// A local variable declaration [Stmt]
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct Let {
pub mutable: Mutability,
pub name: Sym,
pub ty: Option<Box<Ty>>,
pub init: Option<Box<Expr>>,
pub tail: Option<Box<Expr>>,
}
/// An [Assign]ment expression: [`Expr`] ([`ModifyKind`] [`Expr`])\+
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct Assign {