struct InlineSegmentParser<'parser, 'slice, 'src> {
parser: &'parser mut Parser<'src>,
slice: &'slice str,
bytes: &'slice [u8],
base: usize,
out: Vec<Inline>,
pending: String,
pending_source_start: Option<usize>,
i: usize,
text_start: usize,
style: InlineStyle,
close: Option<Delimiter>,
}Fields§
§parser: &'parser mut Parser<'src>§slice: &'slice str§bytes: &'slice [u8]§base: usize§out: Vec<Inline>§pending: String§pending_source_start: Option<usize>§i: usize§text_start: usize§style: InlineStyle§close: Option<Delimiter>Implementations§
Source§impl<'parser, 'slice, 'src> InlineSegmentParser<'parser, 'slice, 'src>
impl<'parser, 'slice, 'src> InlineSegmentParser<'parser, 'slice, 'src>
const fn new( parser: &'parser mut Parser<'src>, slice: &'slice str, base: usize, from: usize, style: InlineStyle, close: Option<Delimiter>, ) -> Self
fn parse(self) -> ParsedSegment
fn flush(&mut self, to: usize)
fn push_pending_escape(&mut self, text: char, width: usize)
fn handle_backslash(&mut self)
fn handle_star(&mut self) -> Option<ParsedSegment>
fn handle_code(&mut self)
Sourcefn at_inline_comment(&self) -> bool
fn at_inline_comment(&self) -> bool
Whether the cursor sits at a trailing/interior // line comment: the
slashes must be at a whitespace boundary (slice start or a preceding
space/tab/newline) and be followed by a space or end-of-line. Code spans
and @refs are already consumed atomically before the cursor gets here,
so this only ever fires in the default text state.
Sourcefn handle_inline_comment(&mut self)
fn handle_inline_comment(&mut self)
Drop a // comment from the cursor to the end of its line: flush text up
to the comment (trimming the space/tab run before //). A trailing
comment resumes at the line’s \n without consuming it, so the soft
break to the next line survives. A whole-line comment (only whitespace
before //) also consumes that \n, so the excised line leaves no blank
gap between the surrounding text lines.
Sourcefn at_inline_block_comment(&self) -> bool
fn at_inline_block_comment(&self) -> bool
Whether the cursor sits at a /* block-comment opener. Unlike the //
line comment, a block comment is recognized anywhere (matching the
editor grammar), not just at a whitespace boundary: verbatim contexts
(code spans, directive strings, raw blocks) are consumed before the
cursor reaches them, and /* does not occur in URLs, so no URL-safety
carve-out is needed.
Sourcefn handle_inline_block_comment(&mut self)
fn handle_inline_block_comment(&mut self)
Drop a /* … */ block comment from the cursor to its closing */:
flush text up to the comment (trimming the space/tab run before /*,
matching Self::handle_inline_comment), scan raw bytes across newlines
for the first */, then resume just past it. An unterminated /* is a
recoverable MOS0050 warning and consumes to the end of the slice.