Skip to main content

oak_objective_c/ast/
mod.rs

1//! Objective-C AST 定义
2
3/// Objective-C 语法树的根节点
4#[derive(Debug, Clone, PartialEq)]
5pub struct ObjectiveCRoot {
6    /// 源文件中的所有顶级项目
7    pub items: Vec<ObjectiveCItem>,
8}
9
10/// Objective-C 顶级项目
11#[derive(Debug, Clone, PartialEq)]
12pub enum ObjectiveCItem {
13    /// 接口定义 (@interface)
14    Interface,
15    /// 实现定义 (@implementation)
16    Implementation,
17    /// 协议定义 (@protocol)
18    Protocol,
19    /// 函数定义
20    Function,
21    /// 变量声明
22    Variable,
23    /// 导入语句 (#import/#include)
24    Import,
25}
26
27impl Default for ObjectiveCRoot {
28    fn default() -> Self {
29        Self { items: Vec::new() }
30    }
31}