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
impl NotationTable
Sourcepub fn register_notation(&mut self, entry: NotationEntry)
pub fn register_notation(&mut self, entry: NotationEntry)
Register a notation entry.
Sourcepub fn register_operator(&mut self, entry: OperatorEntry)
pub fn register_operator(&mut self, entry: OperatorEntry)
Register an operator entry.
Sourcepub fn lookup_prefix(&self, symbol: &str) -> Option<&OperatorEntry>
pub fn lookup_prefix(&self, symbol: &str) -> Option<&OperatorEntry>
Look up a prefix operator by symbol.
Sourcepub fn lookup_infix(&self, symbol: &str) -> Option<&OperatorEntry>
pub fn lookup_infix(&self, symbol: &str) -> Option<&OperatorEntry>
Look up an infix operator by symbol (either left- or right-associative).
Sourcepub fn lookup_postfix(&self, symbol: &str) -> Option<&OperatorEntry>
pub fn lookup_postfix(&self, symbol: &str) -> Option<&OperatorEntry>
Look up a postfix operator by symbol.
Sourcepub fn lookup_operator(&self, symbol: &str) -> Option<&OperatorEntry>
pub fn lookup_operator(&self, symbol: &str) -> Option<&OperatorEntry>
Look up any operator by symbol regardless of fixity.
Sourcepub fn get_precedence(&self, symbol: &str) -> Option<u32>
pub fn get_precedence(&self, symbol: &str) -> Option<u32>
Get the precedence of an operator by symbol.
Sourcepub fn get_entry(&self, index: usize) -> Option<&NotationEntry>
pub fn get_entry(&self, index: usize) -> Option<&NotationEntry>
Get a notation entry by index.
Sourcepub fn notation_count(&self) -> usize
pub fn notation_count(&self) -> usize
Get the number of registered notation entries.
Sourcepub fn operator_count(&self) -> usize
pub fn operator_count(&self) -> usize
Get the number of registered operators.
Sourcepub fn open_scope(&mut self, scope: &str) -> Vec<&NotationEntry>
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.
Sourcepub fn close_scope(&mut self, scope: &str)
pub fn close_scope(&mut self, scope: &str)
Close a scope, deactivating its notations.
Sourcepub fn is_scope_active(&self, scope: &str) -> bool
pub fn is_scope_active(&self, scope: &str) -> bool
Check whether a scope is currently active.
Sourcepub fn active_scope_names(&self) -> &[String]
pub fn active_scope_names(&self) -> &[String]
Get all currently active scopes.
Sourcepub fn active_notations(&self) -> Vec<&NotationEntry>
pub fn active_notations(&self) -> Vec<&NotationEntry>
Get all currently active notations (global + active scopes).
Sourcepub fn find_by_name(&self, name: &str) -> Vec<&NotationEntry>
pub fn find_by_name(&self, name: &str) -> Vec<&NotationEntry>
Find all notation entries matching a given name.
Sourcepub fn find_by_kind(&self, kind: &NotationKind) -> Vec<&NotationEntry>
pub fn find_by_kind(&self, kind: &NotationKind) -> Vec<&NotationEntry>
Find all notation entries of a given kind.
Sourcepub fn find_operators_by_fixity(&self, fixity: &Fixity) -> Vec<&OperatorEntry>
pub fn find_operators_by_fixity(&self, fixity: &Fixity) -> Vec<&OperatorEntry>
Find all operators with a given fixity.
Sourcepub fn all_operator_symbols(&self) -> Vec<&str>
pub fn all_operator_symbols(&self) -> Vec<&str>
Get all operator symbols, sorted alphabetically.
Sourcepub fn compare_precedence(&self, a: &str, b: &str) -> Option<Ordering>
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.
Sourcepub fn builtin_operators() -> Self
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
impl Clone for NotationTable
Source§fn clone(&self) -> NotationTable
fn clone(&self) -> NotationTable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more