44 lines
745 B
Rust
44 lines
745 B
Rust
|
//! **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
|
||
|
}
|