pub struct LexConfig {
pub flavor: LatexFlavor,
pub dtx: bool,
}Expand description
The lexer’s per-parse mode. flavor fixes the initial
catcode regime (a .sty/.cls starts under an implicit \makeatletter),
while dtx is an orthogonal axis: when set, the lexer runs the
bounded line-oriented docstrip mode for a .dtx file — line-leading %
margins become DOC_MARGIN trivia, line-leading
%<…> guards become GUARD trivia, and macrocode
bodies lex as ordinary code (AGENTS.md decision #1). The two axes are
independent because a .dtx’s catcode regime varies by layer (its
documentation is Document-flavored, its macrocode Package-flavored), so
dtx cannot be folded into a LatexFlavor variant.
Fields§
§flavor: LatexFlavorThe initial catcode regime.
dtx: boolRun the docstrip (.dtx) line-oriented lexer mode.
Trait Implementations§
impl Copy for LexConfig
impl Eq for LexConfig
Source§impl From<LatexFlavor> for LexConfig
impl From<LatexFlavor> for LexConfig
Source§fn from(flavor: LatexFlavor) -> Self
fn from(flavor: LatexFlavor) -> Self
A plain (non-.dtx) config of the given flavor — the common case, so a
bare LatexFlavor coerces into a LexConfig at call sites.