Skip to main content

microcad_syntax/ast/
mod.rs

1// Copyright © 2026 The µcad authors <info@ucad.xyz>
2// SPDX-License-Identifier: AGPL-3.0-or-later
3
4mod expression;
5mod literal;
6mod statement;
7mod ty;
8
9use crate::Span;
10use compact_str::CompactString;
11
12pub use expression::*;
13pub use literal::*;
14pub use statement::*;
15pub use ty::*;
16
17/// A µcad identifier
18#[derive(Debug, PartialEq, Hash, Eq)]
19#[allow(missing_docs)]
20pub struct Identifier {
21    pub span: Span,
22    pub name: CompactString,
23}
24
25/// A µcad source file
26#[derive(Debug)]
27#[allow(missing_docs)]
28pub struct SourceFile {
29    pub span: Span,
30    pub statements: StatementList,
31}
32
33/// Non-syntactic extras that can be attached to many ast nodes
34#[derive(Debug, PartialEq, Default)]
35#[allow(missing_docs)]
36pub struct ItemExtras {
37    pub leading: Vec<ItemExtra>,
38    pub trailing: Vec<ItemExtra>,
39}
40
41#[derive(Debug, PartialEq)]
42#[allow(missing_docs)]
43#[non_exhaustive]
44pub enum ItemExtra {
45    Comment(Comment),
46}