pub enum ExpressionTy<S = ()> {
SizedInt {
value: u64,
size: Option<usize>,
},
SubPieceMsb {
src: Box<Expression<S>>,
count: usize,
},
SubPieceLsb {
src: Box<Expression<S>>,
count: usize,
},
Load(Load<S>),
Range(Range<S>),
FunctionCall {
builtin: Builtin,
args: Vec<Expression<S>>,
},
PcodeOp {
id: PCodeOpId,
args: Vec<Expression<S>>,
},
MacroCall {
id: PMacroId,
args: Vec<Expression<S>>,
},
DeferredCall {
name: Box<str>,
args: Vec<Expression<S>>,
},
Ident(Ident),
Unop(Unop<S>),
Binop(Binop<S>),
}Expand description
The shape of a p-code expression node.
S is the span type: (usize, usize) at parse time, () in the stored/runtime form.
Variants§
SizedInt
An integer literal.
Fields
SubPieceMsb
x(n) — drop the low n bytes of x, keeping the high end.
Fields
src: Box<Expression<S>>The value being truncated.
SubPieceLsb
x:n — keep the low n bytes of x.
Load(Load<S>)
*[space]:n ptr — a memory read.
Range(Range<S>)
x[start, size] — a bit range of a value.
FunctionCall
A call to one of SLEIGH’s built-in functions.
PcodeOp
A call to a define pcodeop — an operation the specification declares
but does not define, so a consumer must give it meaning. The name is
the id-th entry of
the producer’s user-defined operation table.
Fields
args: Vec<Expression<S>>Its arguments, in source order.
MacroCall
A call to a macro. Expanded away before a consumer sees the AST;
one surviving is a bug in this crate.
DeferredCall
A call to a name the symbol table did not hold — necessarily a macro parameter, substituted when the macro is inlined. A consumer does not see this variant.
Fields
args: Vec<Expression<S>>Its arguments, in source order.
Ident(Ident)
A reference to a named thing.
Unop(Unop<S>)
A prefix operator applied to one operand.
Binop(Binop<S>)
An infix operator applied to two operands.
Implementations§
Source§impl ExpressionTy
impl ExpressionTy
Sourcepub fn with_size(self, size: usize) -> Expression
pub fn with_size(self, size: usize) -> Expression
Wraps this node in an expression with a known byte width.
Source§impl<S> ExpressionTy<S>
impl<S> ExpressionTy<S>
Sourcepub fn strip_span(self) -> ExpressionTy<()>
pub fn strip_span(self) -> ExpressionTy<()>
Discards source spans.
Trait Implementations§
Source§impl<S: Clone> Clone for ExpressionTy<S>
impl<S: Clone> Clone for ExpressionTy<S>
Source§fn clone(&self) -> ExpressionTy<S>
fn clone(&self) -> ExpressionTy<S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more