pub(crate) struct Parser<'a> {
pub(crate) src: &'a str,
pub(crate) file: PathBuf,
pub(crate) pos: usize,
pub(crate) items: Vec<Item>,
pub(crate) diagnostics: Vec<Diagnostic>,
}Fields§
§src: &'a str§file: PathBuf§pos: usize§items: Vec<Item>§diagnostics: Vec<Diagnostic>Implementations§
Source§impl Parser<'_>
impl Parser<'_>
pub(crate) fn parse_heading(&mut self)
Sourcefn flag_misplaced_heading_label(&mut self, start: usize, content_end: usize)
fn flag_misplaced_heading_label(&mut self, start: usize, content_end: usize)
Emit MOS0048 when a heading carries a <label> token that is not the
trailing element, so strip_trailing_label left it unrecognised and
it would otherwise be swallowed into the heading text. The attached
suggestion moves the label to the end of the line, where it registers as
a real declaration.
pub(crate) fn parse_paragraph(&mut self)
Sourcefn heading_level_of_current_line(&self) -> Option<u8>
fn heading_level_of_current_line(&self) -> Option<u8>
Returns Some(level) if the current line is a well-formed
heading of =+ followed by ASCII whitespace.
Source§impl Parser<'_>
impl Parser<'_>
pub(crate) fn parse_directive_block(&mut self, kw: &'static str)
fn parse_raw_block(&mut self, kw: &'static str)
fn parse_set_block(&mut self)
fn parse_call_block(&mut self, kw: &'static str)
fn finish_directive_block( &mut self, line_start: usize, paren_pos: usize, kind: DirectiveKind, name: String, display_kw: &str, allow_positional: bool, )
fn scan_balanced_parens(&self, start: usize) -> Option<usize>
fn scan_long_raw_open(&self, start: usize) -> Option<(usize, usize)>
fn scan_long_raw_close( &self, start: usize, eq_count: usize, ) -> Option<(usize, usize)>
fn parse_set_body( &mut self, start: usize, end: usize, allow_positional: bool, ) -> Vec<SetArg>
fn consume_arg_separator(&mut self, bytes: &[u8], i: usize, end: usize) -> usize
fn parse_set_value(&mut self, i: &mut usize, end: usize) -> Option<SetValue>
fn parse_string_value(&mut self, i: &mut usize, end: usize) -> Option<SetValue>
fn parse_number_value(&mut self, i: &mut usize, end: usize) -> Option<SetValue>
Source§impl Parser<'_>
impl Parser<'_>
Sourcepub(crate) fn parse_inlines(&mut self, slice: &str, base: usize) -> Vec<Inline>
pub(crate) fn parse_inlines(&mut self, slice: &str, base: usize) -> Vec<Inline>
Tokenize slice (whose first byte sits at base in self.src)
into inline runs. Backtick code and @label references are
atomic; emphasis delimiters can nest into bold+italic text runs.
fn parse_inline_segment( &mut self, slice: &str, base: usize, from: usize, style: InlineStyle, close: Option<Delimiter>, ) -> ParsedSegment
Sourcefn flush_styled_text_with_pending(
&self,
out: &mut Vec<Inline>,
slice: &str,
base: usize,
from: usize,
to: usize,
style: InlineStyle,
pending: &mut String,
pending_source_start: &mut Option<usize>,
)
fn flush_styled_text_with_pending( &self, out: &mut Vec<Inline>, slice: &str, base: usize, from: usize, to: usize, style: InlineStyle, pending: &mut String, pending_source_start: &mut Option<usize>, )
Flush slice[from..to] (possibly prefixed by buffered pending
text from earlier escape expansions like \- → U+00AD) into a
single styled-text inline. The span covers the full source range
from the earliest byte that fed pending (or from when pending
is empty) through to, so emitted inlines whose text includes
expanded escapes still carry a span covering the original source
bytes: including the consumed \- markers.
fn flush_styled_text( &self, out: &mut Vec<Inline>, slice: &str, base: usize, from: usize, to: usize, style: InlineStyle, )
fn warn_unterminated_delimiter( &mut self, slice: &str, base: usize, i: usize, delimiter: Delimiter, )
fn closing_delimiter_suggestion( &self, slice: &str, base: usize, i: usize, delimiter: Delimiter, ) -> Option<Suggestion>
fn code_closing_insertion( slice: &str, i: usize, close: Option<Delimiter>, ) -> Option<usize>
Source§impl Parser<'_>
impl Parser<'_>
Sourcepub(crate) fn parse_list(&mut self)
pub(crate) fn parse_list(&mut self)
Consume a contiguous run of list-marker lines starting at the
current position and push one or more Item::List entries
onto self.items.
fn collect_list_lines(&mut self) -> Vec<RawListLine>
Sourcefn build_list_at(&mut self, raw: &[RawListLine], start: usize) -> (Item, usize)
fn build_list_at(&mut self, raw: &[RawListLine], start: usize) -> (Item, usize)
Build one list from the run starting at raw[start].