Skip to main content

Catcode

Enum Catcode 

Source
#[repr(u16)]
pub enum Catcode {
Show 19 variants ESCAPE = 0, BEGIN = 1, END = 2, MATH = 3, ALIGN = 4, EOL = 5, PARAM = 6, SUPER = 7, SUB = 8, IGNORE = 9, SPACE = 10, LETTER = 11, OTHER = 12, ACTIVE = 13, COMMENT = 14, INVALID = 15, CS = 16, MARKER = 17, ARG = 18,
}
Expand description

A Token category code, as in TeX

Two bytes (#[repr(u16)]), so that Token (text u32, code, prov u16) has no padding byte: with one, every move of a token on the gullet’s read path (Option<Token>, CheckedRead::Tok, the Result slot) copied the pad and prov as a 3-byte blob, byte by byte (token_layout_code_at_byte_4).

Variants§

§

ESCAPE = 0

§

BEGIN = 1

§

END = 2

§

MATH = 3

§

ALIGN = 4

§

EOL = 5

§

PARAM = 6

§

SUPER = 7

§

SUB = 8

§

IGNORE = 9

§

SPACE = 10

§

LETTER = 11

§

OTHER = 12

§

ACTIVE = 13

§

COMMENT = 14

§

INVALID = 15

§

CS = 16

§

MARKER = 17

§

ARG = 18

Implementations§

Source§

impl Catcode

Source

pub fn name(self) -> &'static str

a debug-friendly name

Source

pub fn name_sym(self) -> SymStr

SymStr form of name() — each variant caches its interned symbol via pin!. Used by Token::get_cs_name / pin_cs_name to avoid a per-call pin_static hash probe (fires on every primitive-token definition lookup).

Source

pub fn meaning(self) -> &'static str

a \meaning-friendly name

Source

pub fn short_name(self) -> &'static str

a short name helpful for Token debugging

Source

pub fn is_primitive(self) -> bool

TeX-primitive codes

Source

pub fn is_executable(self) -> bool

Catcodes with associated primitives

Source

pub fn is_neutralizable(self) -> bool

Catcodes which can be neutralized

Source

pub fn is_active_or_cs(self) -> bool

Shorthand to match the “active” and “command sequence” catcodes

Source

pub fn is_absorbable(self) -> bool

Tokens which can be absorbed without side-effects

Source

pub fn is_gullet_holdable(self) -> bool

Gullet can only hold comment and marker tokens

Source

pub fn is_balanced_interesting(self) -> bool

Catcodes that are of note for balanced reads.

Trait Implementations§

Source§

impl Clone for Catcode

Source§

fn clone(&self) -> Self

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 Copy for Catcode

Source§

impl Debug for Catcode

Source§

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

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

impl Eq for Catcode

Source§

impl From<Catcode> for u8

Source§

fn from(cc: Catcode) -> u8

Converts to this type from the input type.
Source§

impl From<Catcode> for Number

Source§

fn from(c: Catcode) -> Number

Converts to this type from the input type.
Source§

impl From<Catcode> for Stored

Source§

fn from(value: Catcode) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Catcode

Source§

fn from(num: u8) -> Catcode

Converts to this type from the input type.
Source§

impl Hash for Catcode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Catcode

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Catcode

Source§

impl ToTokens for Catcode

Available on crate feature codegen only.
Source§

fn to_tokens(&self, stream: &mut TokenStream)

Write self to the given TokenStream. Read more
Source§

fn to_token_stream(&self) -> TokenStream

Convert self directly into a TokenStream object. Read more
Source§

fn into_token_stream(self) -> TokenStream
where Self: Sized,

Convert self directly into a TokenStream object. 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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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 = !

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.