pub enum CatCode {
Show 16 variants
Escape = 0,
BeginGroup = 1,
EndGroup = 2,
MathShift = 3,
AlignmentTab = 4,
EndOfLine = 5,
Parameter = 6,
Superscript = 7,
Subscript = 8,
Ignored = 9,
Space = 10,
Letter = 11,
Other = 12,
Active = 13,
Comment = 14,
Invalid = 15,
}
Expand description
Enum representing all 16 category codes in TeX.
Each variant’s documentation contains an example character which is mapped to that category code in plainTeX.
Variants§
Escape = 0
Marks the beginning of a control sequence.
Example: \
.
This category code is never seen outside of the lexer.
BeginGroup = 1
Begins a new group.
Example: {
.
EndGroup = 2
Ends an existing new group.
Example: }
.
MathShift = 3
Starts or ends math mode.
Example: $
.
AlignmentTab = 4
Used in typesetting tables to align cells.
Example: &
.
EndOfLine = 5
Marks a new line in the input.
Example: \n
.
This code behaves similarly to Space, but has two additional properties.
First, two or more consecutive new lines, modulo intervening Space characters, create a \par
control sequence
instead of a regular space.
Second, this code terminates a comment that started with a Comment character.
This category code is never seen outside of the lexer.
Parameter = 6
Marks the beginning of a parameter number.
It must generally be followed by a digit.
Example: #
.
Superscript = 7
Puts following character or group in a superscript.
Example: ^
.
Subscript = 8
Puts following character or group in a subscript.
Example: _
.
Ignored = 9
Character that is ignored by the lexer. Example: ASCII null (0).
This category code is never seen outside of the lexer.
Space = 10
Whitespace. Example:
.
Letter = 11
A character that can be used as a control sequence name.
Examples: [a-zA-z]
.
Other = 12
A character than cannot be used as a control sequence name.
Example: @
.
Active = 13
A single character that behaves like a control sequence.
Example: ~
.
Comment = 14
Marks the beginning of a comment.
All characters until the next EndOfLine are ignored.
Example: %
.
This category code is never seen outside of the lexer.
Invalid = 15
An invalid character. If this is encountered in the input, the lexer will return an error. Example: ASCII delete (127).
This category code is never seen outside of the lexer.
Implementations§
source§impl CatCode
impl CatCode
sourcepub const INITEX_DEFAULTS: [CatCode; 128] = _
pub const INITEX_DEFAULTS: [CatCode; 128] = _
Default category codes in INITEX for all ASCII characters.
To find the category code for an ASCII character, convert it to an integer and use it as an index for the array.
This list was compiled by reading the source code TeX ’82, specifically section 232 in the “TeX: the program”. These defaults are also described in the TeXBook p343.
sourcepub const PLAIN_TEX_DEFAULTS: [CatCode; 128] = _
pub const PLAIN_TEX_DEFAULTS: [CatCode; 128] = _
Default category codes in plainTeX for all ASCII characters.
To find the category code for an ASCII character, convert it to an integer and use it as an index for the array.
This list was compiled by starting with INITEX_DEFAULTS and then applying all category code changes in the plainTeX format. These changes are described on p343 of the TeXBook.
Trait Implementations§
source§impl<'de> Deserialize<'de> for CatCode
impl<'de> Deserialize<'de> for CatCode
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<S: TexlangState> Parsable<S> for CatCode
impl<S: TexlangState> Parsable<S> for CatCode
source§fn parse_impl(input: &mut ExpandedStream<S>) -> Result<Self>
fn parse_impl(input: &mut ExpandedStream<S>) -> Result<Self>
source§impl SupportedType for CatCode
impl SupportedType for CatCode
source§fn new_command<S>(
ref_fn: RefFn<S, Self>,
ref_mut_fn: MutRefFn<S, Self>,
index_resolver: Option<IndexResolver<S>>,
) -> Command<S>
fn new_command<S>( ref_fn: RefFn<S, Self>, ref_mut_fn: MutRefFn<S, Self>, index_resolver: Option<IndexResolver<S>>, ) -> Command<S>
source§fn update_save_stack<S>(
input: &mut ExecutionInput<S>,
variable: &TypedVariable<S, Self>,
scope: Scope,
overwritten_value: Self,
)
fn update_save_stack<S>( input: &mut ExecutionInput<S>, variable: &TypedVariable<S, Self>, scope: Scope, overwritten_value: Self, )
source§fn new_typed_variable<S>(
command: &Command<S>,
index: Index,
) -> Option<TypedVariable<S, Self>>
fn new_typed_variable<S>( command: &Command<S>, index: Index, ) -> Option<TypedVariable<S, Self>>
source§fn try_cast<S>(
command: &Command<S>,
) -> Option<(RefFn<S, Self>, MutRefFn<S, Self>)>
fn try_cast<S>( command: &Command<S>, ) -> Option<(RefFn<S, Self>, MutRefFn<S, Self>)>
source§fn recycle<S>(input: &mut ExecutionInput<S>, overwritten_value: Self)
fn recycle<S>(input: &mut ExecutionInput<S>, overwritten_value: Self)
impl Copy for CatCode
impl Eq for CatCode
impl StructuralPartialEq for CatCode
Auto Trait Implementations§
impl Freeze for CatCode
impl RefUnwindSafe for CatCode
impl Send for CatCode
impl Sync for CatCode
impl Unpin for CatCode
impl UnwindSafe for CatCode
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)