mod tags;
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
pub enum IntegerWidth {
Unknown,
Zero,
Eight,
Sixteen,
ThirtyTwo,
SixtyFour,
}
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
pub enum FloatWidth {
Unknown,
Sixteen,
ThirtyTwo,
SixtyFour,
}
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
pub struct Tag(pub u64);
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
pub struct Simple(pub u8);
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct ByteString {
pub data: Vec<u8>,
pub bitwidth: IntegerWidth,
}
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct TextString {
pub data: String,
pub bitwidth: IntegerWidth,
}
#[derive(Debug, PartialEq, Clone)]
pub enum DataItem {
Integer {
value: u64,
bitwidth: IntegerWidth,
},
Negative {
value: u64,
bitwidth: IntegerWidth,
},
ByteString(ByteString),
TextString(TextString),
IndefiniteByteString(Vec<ByteString>),
IndefiniteTextString(Vec<TextString>),
Array {
data: Vec<DataItem>,
bitwidth: Option<IntegerWidth>,
},
Map {
data: Vec<(DataItem, DataItem)>,
bitwidth: Option<IntegerWidth>,
},
Tag {
tag: Tag,
bitwidth: IntegerWidth,
value: Box<DataItem>,
},
Float {
value: f64,
bitwidth: FloatWidth,
},
Simple(Simple),
}
impl Simple {
pub const FALSE: Simple = Simple(20);
pub const TRUE: Simple = Simple(21);
pub const NULL: Simple = Simple(22);
pub const UNDEFINED: Simple = Simple(23);
}