pub mod expr;
pub mod item;
pub mod pattern;
pub mod ty;
pub use expr::{BinOp, Expr, FieldInit, Literal, MatchArm, StringPart, UnOp};
pub use item::{
AssignOp, AssocTypeBinding, ConstDecl, ExternBlock, Function, ImplBlock, Import,
Module as ModuleDecl, Param, Record, RecordField, TraitDecl, TraitItem, TypeDecl, Visibility,
WhereBound,
};
pub use pattern::Pattern;
pub use ty::{Type, TypeParam};
use nova_diagnostics::Spanned;
#[derive(Debug, Clone)]
pub struct File {
pub items: Vec<Spanned<Item>>,
}
#[derive(Debug, Clone)]
pub enum Item {
Function(Function),
Record(Record),
Type(TypeDecl),
Trait(TraitDecl),
Impl(ImplBlock),
Const(ConstDecl),
Import(Import),
Module(ModuleDecl),
Extern(ExternBlock),
}
#[derive(Debug, Clone)]
pub enum Stmt {
Let {
is_mut: bool,
pattern: Spanned<Pattern>,
ty: Option<Spanned<Type>>,
init: Option<Spanned<Expr>>,
},
Expr(Spanned<Expr>),
Item(Box<Item>),
}
#[derive(Debug, Clone)]
pub struct Block {
pub stmts: Vec<Spanned<Stmt>>,
pub trailing: Option<Box<Spanned<Expr>>>,
}
#[derive(Debug, Clone)]
pub struct Path {
pub segments: Vec<Spanned<String>>,
}
impl Path {
pub fn single(name: Spanned<String>) -> Self {
Self {
segments: vec![name],
}
}
}