microcad_lang_parse/ast/
mod.rs1mod expression;
5mod literal;
6mod source;
7mod statement;
8mod ty;
9
10use microcad_lang_base::{Id, Span};
11
12pub use expression::*;
13pub use literal::*;
14pub use source::*;
15pub use statement::*;
16pub use ty::*;
17
18#[derive(Debug, PartialEq, Hash, Eq)]
20#[allow(missing_docs)]
21pub struct Identifier {
22 pub span: Span,
23 pub name: Id,
24}
25
26impl Dummy for Identifier {
27 fn dummy(span: Span) -> Self {
28 Self {
29 span,
30 name: Id::default(),
31 }
32 }
33}
34
35#[derive(Debug)]
37#[allow(missing_docs)]
38pub struct Program {
39 pub span: Span,
40 pub statements: StatementList,
41}
42
43#[derive(Clone, Debug, PartialEq, Default)]
45#[allow(missing_docs)]
46pub struct ItemExtras {
47 pub leading: LeadingExtras,
48 pub trailing: TrailingExtras,
49}
50
51#[derive(Debug, Clone, PartialEq, Default)]
53#[allow(missing_docs)]
54pub struct TrailingExtras(pub Vec<ItemExtra>);
55
56#[derive(Debug, Clone, PartialEq, Default)]
58#[allow(missing_docs)]
59pub struct LeadingExtras(pub Vec<ItemExtra>);
60
61#[derive(Debug, Clone, PartialEq)]
62#[allow(missing_docs)]
63#[non_exhaustive]
64pub enum ItemExtra {
65 Comment(Comment),
66 Whitespace(String),
67}
68
69pub(crate) trait Dummy {
73 fn dummy(span: Span) -> Self;
74}