Skip to content

Commit

Permalink
fix long line diagnostic with long multiline string
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Dec 26, 2023
1 parent 1cb8ba1 commit 0ad5d8c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,18 @@ pub fn parse(
for line in tokens.split(|t| matches!(t.value, Newline)) {
let mut heuristic = 0;
let mut first = None;
for tok in line {
let mut toks = line.iter().peekable();
while let Some(tok) = toks.next() {
heuristic += match &tok.value {
Spaces | Comment => 0,
Simple(CloseBracket | CloseCurly | CloseParen) => 0,
Simple(Underscore) => 0,
MultilineString(_) => {
while let Some(MultilineString(_)) = toks.peek().map(|t| &t.value) {
toks.next();
}
1
}
_ => {
first = first.or(Some(&tok.span));
1
Expand Down

0 comments on commit 0ad5d8c

Please sign in to comment.