Skip to main content

oak_objective_c/ast/
mod.rs

1#![doc = include_str!("readme.md")]
2
3/// Root node of the Objective-C syntax tree.
4#[derive(Debug, Clone, PartialEq)]
5#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
6pub struct ObjectiveCRoot {
7    /// All top-level items in the source file.
8    pub items: Vec<ObjectiveCItem>,
9}
10
11/// Objective-C top-level item.
12#[derive(Debug, Clone, PartialEq)]
13#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
14pub enum ObjectiveCItem {
15    /// Interface definition (@interface).
16    Interface,
17    /// Implementation definition (@implementation).
18    Implementation,
19    /// Protocol definition (@protocol).
20    Protocol,
21    /// Function definition.
22    Function,
23    /// Variable declaration.
24    Variable,
25    /// Import statement (#import/#include).
26    Import,
27}
28
29impl Default for ObjectiveCRoot {
30    fn default() -> Self {
31        Self { items: Vec::new() }
32    }
33}