sleigh_rs/semantic/
display.rs

1use crate::semantic::{
2    disassembly, ContextId, InstNext, InstStart, TableId, TokenFieldId,
3    VarnodeId,
4};
5
6#[derive(Clone, Debug, Default)]
7pub struct Display {
8    pub mneumonic: Option<String>,
9    pub(crate) elements: Box<[DisplayElement]>,
10}
11
12impl Display {
13    pub fn elements(&self) -> impl Iterator<Item = &DisplayElement> {
14        self.elements.iter()
15    }
16}
17
18#[derive(Clone, Debug)]
19pub enum DisplayElement {
20    Varnode(VarnodeId),
21    Context(ContextId),
22    //Bitrange(BitrangeId),
23    TokenField(TokenFieldId),
24    InstStart(InstStart),
25    InstNext(InstNext),
26    Table(TableId),
27    Disassembly(disassembly::VariableId),
28    Literal(String),
29    Space,
30}
31
32impl DisplayElement {
33    pub fn is_space(&self) -> bool {
34        matches!(self, Self::Space)
35    }
36}