1#![doc = include_str!("readme.md")]
2mod declaration_nodes;
4mod expression_nodes;
5mod statement_nodes;
6
7pub use declaration_nodes::*;
8pub use expression_nodes::*;
9pub use statement_nodes::*;
10
11#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
13#[derive(Debug, Clone, PartialEq)]
14pub struct CRoot {
15 pub translation_unit: TranslationUnit,
17 #[cfg_attr(feature = "serde", serde(with = "oak_core::serde_range"))]
19 pub span: core::range::Range<usize>,
20}
21
22#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
24#[derive(Debug, Clone, PartialEq)]
25pub struct TranslationUnit {
26 pub external_declarations: Vec<ExternalDeclaration>,
28 #[cfg_attr(feature = "serde", serde(with = "oak_core::serde_range"))]
30 pub span: core::range::Range<usize>,
31}
32
33impl CRoot {
34 pub fn new(translation_unit: TranslationUnit, span: core::range::Range<usize>) -> Self {
36 Self { translation_unit, span }
37 }
38}
39
40impl TranslationUnit {
41 pub fn new(external_declarations: Vec<ExternalDeclaration>, span: core::range::Range<usize>) -> Self {
43 Self { external_declarations, span }
44 }
45}