pub enum RpnOp<'a> {
Show 39 variants
Add,
Sub,
Mul,
Div,
Mod,
Neg,
Pow,
BinOr,
BinAnd,
Xor,
Cpl,
And,
Or,
Not,
Eq,
Neq,
Gt,
Lt,
Gte,
Lte,
Lsh,
Rsh,
Ursh,
BankSym(u32),
BankSect(&'a [u8]),
BankSelf,
SizeofSect(&'a [u8]),
StartofSect(&'a [u8]),
SizeofSectType(SectType),
StartofSectType(SectType),
HramCheck,
RstCheck,
BitIndex(u8),
High,
Low,
BitWidth,
TzCount,
Int(u32),
Sym(u32),
}Expand description
A RPN operation; since this means “operation on the RPN stack” here, this includes literals, not just operators.
Variants§
Add
+ operator.
Sub
- operator.
Mul
* operator.
Div
/ operator.
Mod
% operator.
Neg
Unary - operator.
Pow
** operator.
BinOr
| operator.
BinAnd
& operator.
Xor
^ operator.
Cpl
~ operator.
And
&& operator.
Or
|| operator.
Not
! operator.
Eq
== operator.
Neq
!= operator.
Gt
> operator.
Lt
< operator.
Gte
>= operator.
Lte
<= operator.
Lsh
<< operator.
Rsh
>> operator.
Ursh
>>> operator.
BankSym(u32)
BANK(Symbol)
BankSect(&'a [u8])
BANK("section")
BankSelf
BANK(@)
SizeofSect(&'a [u8])
SIZEOF("section")
StartofSect(&'a [u8])
STARTOF("section")
SizeofSectType(SectType)
SIZEOF(SectionType)
StartofSectType(SectType)
STARTOF(SectionType)
HramCheck
HRAM check (check if the value is in HRAM range, then & 0xFF).
RstCheck
rst check (check if the value is a rst target, then | 0xC7).
BitIndex(u8)
bit/res/set bit index (check if the value is in 0-7 range, then << 3 and | u8
High
HIGH(value)
Low
LOW(value)
BitWidth
BITWIDTH(value)
TzCount
TZCOUNT(value)
Int(u32)
32-bit literal.
Sym(u32)
Symbol (referenced by 32-bit ID).
Implementations§
Source§impl RpnOp<'_>
impl RpnOp<'_>
Sourcepub fn precedence(&self) -> u8
pub fn precedence(&self) -> u8
Sourcepub fn is_associative(&self) -> bool
pub fn is_associative(&self) -> bool
Whether this operation is associative; that is, if A op (B op C) == (A op B) op C.
§Panics
This function panics if the operation is not a binary operator.
Sourcepub fn needs_parens(&self, parent: &RpnOp<'_>, is_left: bool) -> bool
pub fn needs_parens(&self, parent: &RpnOp<'_>, is_left: bool) -> bool
Computes whether parens are needed (for pretty-printing) around a child expression, with the given parent.