//! Intermediate representation module #[derive(Debug, Clone)] pub struct ExtInfo { pub name: String, pub xname: String, pub major_version: u32, pub minor_version: u32, } #[derive(Debug, Clone)] pub struct DocField { pub name: String, pub text: String, } #[derive(Debug, Clone)] pub struct DocError { pub typ: String, pub text: String, } #[derive(Debug, Clone)] pub struct DocSee { pub typ: String, pub name: String, } #[derive(Debug, Clone)] pub struct Doc { pub brief: Option, pub description: Option, pub example: Option, pub fields: Vec, pub errors: Vec, pub sees: Vec, } #[derive(Debug, Clone)] pub enum Expr { FieldRef(String), ParamRef(String), EnumRef { name: String, item: String }, Value(usize), Op(String, Box, Box), Unop(String, Box), Popcount(Box), SumOf(String, Option>), ListElementRef, } #[derive(Debug, Clone)] pub enum EnumItem { Bit(String, u32), Value(String, u32), } #[derive(Debug, Clone)] pub struct SwitchCase { pub bit: bool, pub name: Option, pub exprs: Vec, pub fields: Vec, } #[allow(clippy::enum_variant_names)] #[derive(Debug, Clone)] pub enum Field { Pad(usize), AlignPad(usize), Field { name: String, typ: String, r#enum: Option, mask: Option, altenum: Option, altmask: Option, }, List { name: String, typ: String, len_expr: Expr, r#enum: Option, mask: Option, }, ListNoLen { name: String, typ: String, r#enum: Option, mask: Option, }, Expr { name: String, typ: String, expr: Expr, }, ValueParam { mask_typ: String, mask_name: String, list_name: String, }, Fd(String), Switch(String, Expr, Vec), } #[derive(Debug, Clone)] pub struct Reply { pub fields: Vec, pub doc: Option, } #[derive(Debug, Clone)] pub struct EventSelector { pub extension: String, pub xge: bool, pub opcode_range: (u32, u32), } #[derive(Debug, Clone)] pub enum Item { Error { name: String, number: i32, fields: Vec, doc: Option, }, ErrorCopy { name: String, number: i32, r#ref: String, }, Typedef { old_typ: String, new_typ: String, }, XidType { typ: String, }, XidUnion { typ: String, xidtypes: Vec, }, Enum { typ: String, items: Vec, doc: Option, }, Struct { typ: String, fields: Vec, doc: Option, }, Union { typ: String, fields: Vec, doc: Option, }, Event { number: i32, name: String, fields: Vec, no_seq_number: bool, xge: bool, doc: Option, }, EventCopy { name: String, number: i32, r#ref: String, }, EventStruct { typ: String, selectors: Vec, }, Request { name: String, opcode: u32, params: Vec, reply: Option, doc: Option, }, }