pub struct Parser<'eng, 'tokens> {
pub tokens: Vec<Token<'tokens>>,
pub meta: Arc<SourceMeta>,
pub pos: usize,
pub refs: RefMap,
pub diag_engine: &'eng mut DiagnosticEngine<Code>,
pub options: ParseOptions,
pub source: Option<&'tokens str>,
pub link_label_depth: u16,
pub jsx_open_stack: Vec<String>,
}Expand description
Token-stream cursor + diagnostic engine. 'tokens ties borrowed lexemes
to the source; 'eng ties the engine borrow to the caller.
Fields§
§tokens: Vec<Token<'tokens>>§meta: Arc<SourceMeta>§pos: usize§refs: RefMap§diag_engine: &'eng mut DiagnosticEngine<Code>§options: ParseOptions§source: Option<&'tokens str>Original source (with_source). Enables a provenance-correct
byte-offset reslice in raw_source_for_token_range.
link_label_depth: u16Current [...] link-label nesting depth. Unresolved-shortcut replay is
super-linear in this depth; above [MAX_LINK_LABEL_DEPTH] a [ becomes
literal text. CM forbids links inside link text so this only bounds
adversarial [[[[[... input.
jsx_open_stack: Vec<String>JSX elements currently being parsed (outermost first). parse_jsx
pushes the open-tag name and pops on close. Inline / block collection
consults this so a JsxCloseTagStart for an enclosing element
terminates the run instead of leaking as literal text. Lowercase HTML
tags never push here; only MDX component names.
Implementations§
Source§impl<'eng, 'tokens> Parser<'eng, 'tokens>
impl<'eng, 'tokens> Parser<'eng, 'tokens>
pub fn new( tokens: Vec<Token<'tokens>>, meta: Arc<SourceMeta>, diag_engine: &'eng mut DiagnosticEngine<Code>, ) -> Self
pub fn new_with_options( tokens: Vec<Token<'tokens>>, meta: Arc<SourceMeta>, diag_engine: &'eng mut DiagnosticEngine<Code>, options: ParseOptions, ) -> Self
Sourcepub fn with_source(self, source: &'tokens str) -> Self
pub fn with_source(self, source: &'tokens str) -> Self
Attach the original source so verbatim-slice reconstruction (raw HTML blocks, malformed-link bodies) can reslice it directly.