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