RpnOp

Enum RpnOp 

Source
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<'_>

Source

pub fn arity(&self) -> Arity

The operation’s arity.

Source

pub fn precedence(&self) -> u8

The operation’s precedence.

§Panics

This function panics if the operation is not a binary operator.

Source

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.

Source

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.

Trait Implementations§

Source§

impl<'a> Debug for RpnOp<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for RpnOp<'_>

Source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a> PartialEq for RpnOp<'a>

Source§

fn eq(&self, other: &RpnOp<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> StructuralPartialEq for RpnOp<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for RpnOp<'a>

§

impl<'a> RefUnwindSafe for RpnOp<'a>

§

impl<'a> Send for RpnOp<'a>

§

impl<'a> Sync for RpnOp<'a>

§

impl<'a> Unpin for RpnOp<'a>

§

impl<'a> UnwindSafe for RpnOp<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.