Skip to main content

VerbCtx

Struct VerbCtx 

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

Per-parse lexer context carrying user-defined verbatim constructs — those a document declares with catcode manipulation (\@makeother\$, …), found by scanning definition bodies (crate::semantic::define). The lexer consults it (alongside the built-in DB) to capture a verbatim command’s final argument as one VERB token, and a verbatim environment’s body as one VERBATIM_BODY token. Empty for the first parse pass; populated for the second when the document defines any (see parser::core).

A command entry maps a name (no leading \) to its leading, non-verbatim argument shape, the verbatim argument itself being implicit — matching the built-in convention. An environment entry maps a name to its full argument shape (an environment’s args are all leading; its body follows the \begin{…} arguments), so presence in environments means the environment is verbatim.

suppressed names the inverse case: commands the current file redefines to an ordinary (non-verbatim) macro whose name collides with a built-in braced-verbatim command (\code, \url, \path, …). A local definition shadows the built-in, so [lex_verbatim_command] must lex \code{…} as an ordinary group rather than capture the built-in VERB (follow-up to issue #53). We read only static definition facts (a visible \newcommand/\def with no catcode signal), never macro meaning.

Implementations§

Source§

impl VerbCtx

Source

pub fn is_empty(&self) -> bool

Whether the context names no user verbatim constructs and no suppressions (the common case — the second parse pass is skipped entirely).

Trait Implementations§

Source§

impl Clone for VerbCtx

Source§

fn clone(&self) -> VerbCtx

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for VerbCtx

Source§

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

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

impl Default for VerbCtx

Source§

fn default() -> VerbCtx

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.