MutableOperatorTable

Mutable operator lookup intended for clause-by-clause parse sessions.

The type is stateful and not designed for concurrent access. Defining the same name/specifier pair again replaces its priority; other specifiers for that name remain intact.

Functions

Link copied to clipboard

Returns every definition in stable name and Associativity order.

Link copied to clipboard
abstract fun clear()

Removes every operator definition.

Link copied to clipboard
abstract fun define(definition: OperatorDefinition)

Adds definition, replacing the priority of an existing name/specifier pair.

open fun define(name: String, specifier: Associativity, priority: Int)

Defines one operator from its components.

Link copied to clipboard
abstract fun definition(name: String, specifier: Associativity): OperatorDefinition?

Returns the definition for name and specifier, or null if absent.

Link copied to clipboard

Returns all definitions for name in stable Associativity order.

Link copied to clipboard
abstract fun isOperator(name: String): Boolean

Returns whether at least one definition exists for name.

Link copied to clipboard
abstract fun remove(name: String, specifier: Associativity)

Removes only the specifier definition of name, if present.

Link copied to clipboard
abstract fun removeAll(name: String)

Removes every definition of name.

Link copied to clipboard
abstract fun snapshot(): OperatorTable

Returns an immutable copy isolated from subsequent mutations.