mirror of
https://github.com/typst/typst
synced 2025-08-02 09:17:54 +08:00
Clean up some parser comments (#6398)
This commit is contained in:
parent
6725061841
commit
832fab58b3
@ -1571,10 +1571,10 @@ struct Token {
|
|||||||
prev_end: usize,
|
prev_end: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Information about a newline if present (currently only relevant in Markup).
|
/// Information about newlines in a group of trivia.
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
struct Newline {
|
struct Newline {
|
||||||
/// The column of the start of our token in its line.
|
/// The column of the start of the next token in its line.
|
||||||
column: Option<usize>,
|
column: Option<usize>,
|
||||||
/// Whether any of our newlines were paragraph breaks.
|
/// Whether any of our newlines were paragraph breaks.
|
||||||
parbreak: bool,
|
parbreak: bool,
|
||||||
@ -1587,7 +1587,7 @@ enum AtNewline {
|
|||||||
Continue,
|
Continue,
|
||||||
/// Stop at any newline.
|
/// Stop at any newline.
|
||||||
Stop,
|
Stop,
|
||||||
/// Continue only if there is no continuation with `else` or `.` (Code only).
|
/// Continue only if there is a continuation with `else` or `.` (Code only).
|
||||||
ContextualContinue,
|
ContextualContinue,
|
||||||
/// Stop only at a parbreak, not normal newlines (Markup only).
|
/// Stop only at a parbreak, not normal newlines (Markup only).
|
||||||
StopParBreak,
|
StopParBreak,
|
||||||
@ -1610,9 +1610,10 @@ impl AtNewline {
|
|||||||
},
|
},
|
||||||
AtNewline::StopParBreak => parbreak,
|
AtNewline::StopParBreak => parbreak,
|
||||||
AtNewline::RequireColumn(min_col) => {
|
AtNewline::RequireColumn(min_col) => {
|
||||||
// Don't stop if this newline doesn't start a column (this may
|
// When the column is `None`, the newline doesn't start a
|
||||||
// be checked on the boundary of lexer modes, since we only
|
// column, and we continue parsing. This may happen on the
|
||||||
// report a column in Markup).
|
// boundary of lexer modes, since we only report a column in
|
||||||
|
// Markup.
|
||||||
column.is_some_and(|column| column <= min_col)
|
column.is_some_and(|column| column <= min_col)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user