Skip to content

Commit 0201a5a

Browse files
Update compiler/parser/src/soft_keywords.rs
Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>
1 parent fa38e9f commit 0201a5a

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

compiler/parser/src/soft_keywords.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,19 @@ where
5858
if !self.start_of_line {
5959
next = Some(Ok((*start, soft_to_name(tok), *end)));
6060
} else {
61-
let mut par_count = 0;
62-
let mut sqb_count = 0;
63-
let mut brace_count = 0;
61+
let mut nesting = 0;
6462
let mut first = true;
6563
let mut seen_colon = false;
6664
while let Some(Ok((_, tok, _))) = self.underlying.peek() {
6765
match tok {
6866
Tok::Newline => break,
69-
Tok::Colon if par_count == 0 && sqb_count == 0 && brace_count == 0 => {
67+
Tok::Colon if nesting == 0 => {
7068
if !first {
7169
seen_colon = true;
7270
}
7371
}
74-
Tok::Lpar => par_count += 1,
75-
Tok::Rpar => par_count -= 1,
76-
Tok::Lsqb => sqb_count += 1,
77-
Tok::Rsqb => sqb_count -= 1,
78-
Tok::Lbrace => brace_count += 1,
79-
Tok::Rbrace => brace_count -= 1,
72+
Tok::Lpar | Tok::Lsqb | Tok::Lbrace => nesting += 1,
73+
Tok::Rpar | Tok::Rsqb | Tok::Rbrace => nesting -= 1,
8074
_ => {}
8175
}
8276
first = false;

0 commit comments

Comments
 (0)