Skip to main content

NotationTable

Struct NotationTable 

Source
pub struct NotationTable { /* private fields */ }
Expand description

The main notation/operator table.

Contains all registered notations and operators, supports scoped activation, and provides fast lookup by symbol.

Implementations§

Source§

impl NotationTable

Source

pub fn new() -> Self

Create an empty notation table.

Source

pub fn register_notation(&mut self, entry: NotationEntry)

Register a notation entry.

Source

pub fn register_operator(&mut self, entry: OperatorEntry)

Register an operator entry.

Source

pub fn lookup_prefix(&self, symbol: &str) -> Option<&OperatorEntry>

Look up a prefix operator by symbol.

Source

pub fn lookup_infix(&self, symbol: &str) -> Option<&OperatorEntry>

Look up an infix operator by symbol (either left- or right-associative).

Source

pub fn lookup_postfix(&self, symbol: &str) -> Option<&OperatorEntry>

Look up a postfix operator by symbol.

Source

pub fn lookup_operator(&self, symbol: &str) -> Option<&OperatorEntry>

Look up any operator by symbol regardless of fixity.

Source

pub fn get_precedence(&self, symbol: &str) -> Option<u32>

Get the precedence of an operator by symbol.

Source

pub fn get_entry(&self, index: usize) -> Option<&NotationEntry>

Get a notation entry by index.

Source

pub fn notation_count(&self) -> usize

Get the number of registered notation entries.

Source

pub fn operator_count(&self) -> usize

Get the number of registered operators.

Source

pub fn open_scope(&mut self, scope: &str) -> Vec<&NotationEntry>

Open a scope, making its notations active.

Returns the notation entries that belong to that scope.

Source

pub fn close_scope(&mut self, scope: &str)

Close a scope, deactivating its notations.

Source

pub fn is_scope_active(&self, scope: &str) -> bool

Check whether a scope is currently active.

Source

pub fn active_scope_names(&self) -> &[String]

Get all currently active scopes.

Source

pub fn active_notations(&self) -> Vec<&NotationEntry>

Get all currently active notations (global + active scopes).

Source

pub fn find_by_name(&self, name: &str) -> Vec<&NotationEntry>

Find all notation entries matching a given name.

Source

pub fn find_by_kind(&self, kind: &NotationKind) -> Vec<&NotationEntry>

Find all notation entries of a given kind.

Source

pub fn find_operators_by_fixity(&self, fixity: &Fixity) -> Vec<&OperatorEntry>

Find all operators with a given fixity.

Source

pub fn all_operator_symbols(&self) -> Vec<&str>

Get all operator symbols, sorted alphabetically.

Source

pub fn compare_precedence(&self, a: &str, b: &str) -> Option<Ordering>

Compare the precedence of two symbols.

Returns Some(Ordering) if both symbols are registered, None otherwise.

Source

pub fn builtin_operators() -> Self

Create a notation table pre-populated with standard Lean 4 operators.

Includes arithmetic, comparison, logical, arrow, and assignment operators with their standard precedences.

Trait Implementations§

Source§

impl Clone for NotationTable

Source§

fn clone(&self) -> NotationTable

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NotationTable

Source§

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

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

impl Default for NotationTable

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.