Skip to main content

FlmFallbackProvider

Struct FlmFallbackProvider 

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

The fallback provider: the specification provider that resolves a macro or an environment that no declaration defines, according to the fallbacks (FallbackDef) declared for the current parsing mode.

techy’s own fallback provider cannot be restricted to parsing modes, so minting builds this provider instead. The language build puts it at the bottom of the scope stack, so every defined name shadows it. It returns specifications from the techy package it holds (FlmFallbackProvider::package).

The fallbacks are consulted in declaration order, with the language’s own two last, so a feature’s fallback for a mode applies in that mode. In a mode no feature’s fallback covers, the language’s own fallbacks apply: the command is reported and its node carries flm.unknown.macro or flm.unknown.environment. Text mode therefore reports unknown commands, while mathematics mode, with a mathematics feature registered, does not.

It resolves any name, so it cannot list its entries; the package beside it is therefore listed separately in BuiltLang::providers.

Implementations§

Source§

impl FlmFallbackProvider

Source

pub fn package(&self) -> &Arc<Package<Flm>> ⓘ

Returns the techy package holding the fallback specifications, which their provenance stamps refer to. It is never on the scope stack.

Source

pub fn entries( &self, ) -> impl Iterator<Item = (&FeatureName, &[Mode], FallbackKind)> + '_

Returns the installed fallbacks as (owner, modes, kind), in the order they are consulted: declaration order, with the language’s own two last (owned by LANGUAGE_OWNER). A fallback reported as a MintError::Clash is not among them.

Source

pub fn answers(&self, kind: FallbackKind, mode: Mode) -> bool

Returns whether some fallback applies to kind in mode. It always returns true, since the language’s own two fallbacks apply to both kinds in every mode.

Source

pub fn spec_for( &self, kind: FallbackKind, mode: Mode, ) -> Option<&Arc<dyn CallableSpec<Flm>>>

Returns the specification for kind in mode: that of the first installed fallback that covers them.

Trait Implementations§

Source§

impl Debug for FlmFallbackProvider

Source§

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

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

impl DeserializableObject<Flm> for FlmFallbackProvider

Looked up among the reading session’s providers (techy’s KnownProviders in its user data): the gate registered under the written name.

Source§

type Output = Arc<dyn SpecsProvider<Flm>>

What deserialize_object produces.
Source§

fn deserialize_object( value: &SerialValue, cx: &mut DeserializeContext<'_, Flm>, ) -> Result<Self::Output, DeserializeError>

Rebuild an object from its serialized value. Read more
Source§

impl SerializableObject<Flm> for FlmFallbackProvider

Written by identity as {name} under FALLBACK_GATE_IDENTIFIER: the gate belongs to the reading language, as a package does. The specifications it returns are held in the fallback package, which is written by identity separately.

Source§

fn serialize_object( &self, cx: &mut SerializeContext<'_, Flm>, ) -> Result<SerialEntry, SerializeError>

Produce this object’s serialized form: its identifier and its data as a SerialEntry. Read more
Source§

impl SpecsProvider<Flm> for FlmFallbackProvider

Source§

fn name(&self) -> &str

The provider’s name: how definition ops target it (ScopeOp::Define routing), and how it appears in diagnostics (the miss detail of ScopeStack::searched_providers, the provider context of a ScopeStackError). Names need not be unique on a stack; name-targeted ops address the innermost match.
Source§

fn retrieve_spec( &self, query: &CallableQuery<'_, Flm>, state: &ParsingState<Flm>, ) -> Result<Option<Arc<dyn CallableSpec<Flm>>>, ProviderError>

Resolve query in this provider: Ok(Some(spec)) on a hit, Ok(None) for “not defined here — continue outward” (which includes “not visible here”: per-mode visibility is the provider’s own business, checked against state.mode(); the stack is visibility-blind). Err means the provider itself failed — an operational error that stops the search over the stack, never a panic.
Source§

fn scan_specials( &self, state: &ParsingState<L>, content: &str, pos: usize, ) -> Result<Option<SpecialsMatch<L>>, SpecialsScanError>

Specials participation: is a callable-triggering character sequence of this provider at content[pos..]? Same contract as the Lang::scan_specials hook it feeds through the ScopeStack::scan_specials search — including the SpecialsMatch::end obligations and the recovery-token protocol (the TokenResult shape is deliberate: a scanning provider keeps the tokenizer’s recoverable-failure channel, which a ProviderError could not express). Implementations should return their longest match at pos. The default recognizes nothing. Read more
Source§

fn specials_trigger_chars(&self) -> TriggerChars

The characters that may start one of this provider’s specials triggers — unioned over the stack at state freeze (ScopeStack::specials_trigger_chars) into the per-state filter. Must be a conservative superset of the first characters of every trigger scan_specials can match, regardless of state (there is deliberately no state parameter: the union is cached on frozen states — a mode-invisible provider’s chars stay in the filter and its scan declines instead). The default: no specials.
Source§

fn with_definitions( &self, ops: &[DefinitionOp<L>], ) -> Result<Arc<dyn SpecsProvider<L>>, ProviderError>

Apply definition ops functionally: return a fresh provider reflecting ops, leaving self untouched. This is the copy-on-write mechanism (Arc::make_mut does not exist for dyn types): the stack replaces its entry with the returned Arc, and outer states keep holding the old one — scoped reversion stays structural. Atomic per call: on Err, no partial application may be observable. Read more
Source§

fn iter_symbols( &self, callable_type: <L as Lang>::CallableTypeId, mode: <L as Lang>::ModeId, ) -> Option<Box<dyn Iterator<Item = SymbolEntry<'_, L>> + '_>>

Enumerate this provider’s definitions of the invocation form callable_type that are visible under mode. Visibility is the provider’s own business, exactly as in retrieve_spec — and since visibility is mode-determined at every grain, the mode alone is passed, not a full state. 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> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_cast_from(src: Src) -> Dst

Casts the value.
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.