ableos_userland/programs/aidl/src/ast.rs

44 lines
745 B
Rust
Raw Normal View History

2023-05-04 06:19:32 -05:00
//! **note** the order of fields is the order of parsing.
/// An IDL module.
///
/// Parsing order:
/// - use declarations,
/// - items
#[derive(Debug)]
pub struct IDLModule {
// why: only allow use before other items
// parser will error if use is present in any other place
pub uses: Vec<UseDecl>,
pub items: Vec<Item>
}
#[derive(Debug)]
pub enum Item {
Interface(ItemInterface),
Type(ItemType)
}
#[derive(Debug)]
pub struct Function {
pub name: String,
}
#[derive(Debug)]
pub struct ItemInterface {
pub name: String,
pub functions: Vec<Function>
}
#[derive(Debug)]
pub struct ItemType {
pub name: String,
pub referree: String
}
#[derive(Debug)]
pub struct UseDecl {
pub module: String
}