mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
simplifications
This commit is contained in:
parent
225254d7e5
commit
1a49930d1d
2 changed files with 26 additions and 36 deletions
|
@ -180,8 +180,7 @@ fn spaces_help_help<'a, E>(
|
||||||
where
|
where
|
||||||
E: 'a + SpaceProblem,
|
E: 'a + SpaceProblem,
|
||||||
{
|
{
|
||||||
move |arena, state: State<'a>| {
|
move |arena, state: State<'a>| match fast_eat_spaces(&state) {
|
||||||
match fast_eat_spaces(&state) {
|
|
||||||
FastSpaceState::HasTab(position) => Err((
|
FastSpaceState::HasTab(position) => Err((
|
||||||
MadeProgress,
|
MadeProgress,
|
||||||
E::space_problem(BadInputError::HasTab, position),
|
E::space_problem(BadInputError::HasTab, position),
|
||||||
|
@ -199,26 +198,16 @@ where
|
||||||
} else {
|
} else {
|
||||||
let comments_and_newlines = Vec::with_capacity_in(newlines, arena);
|
let comments_and_newlines = Vec::with_capacity_in(newlines, arena);
|
||||||
let spaces = eat_spaces(state, false, comments_and_newlines);
|
let spaces = eat_spaces(state, false, comments_and_newlines);
|
||||||
let mut state = spaces.state;
|
|
||||||
|
|
||||||
if spaces.multiline {
|
|
||||||
// we parsed at least one newline
|
|
||||||
|
|
||||||
state.indent_column = state.column();
|
|
||||||
|
|
||||||
debug_assert!(state.column() >= min_indent);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok((
|
Ok((
|
||||||
MadeProgress,
|
MadeProgress,
|
||||||
spaces.comments_and_newlines.into_bump_slice(),
|
spaces.comments_and_newlines.into_bump_slice(),
|
||||||
state,
|
spaces.state,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
enum FastSpaceState {
|
enum FastSpaceState {
|
||||||
Good {
|
Good {
|
||||||
|
|
|
@ -2789,10 +2789,11 @@ fn chomp_ops(bytes: &[u8]) -> &str {
|
||||||
let mut chomped = 0;
|
let mut chomped = 0;
|
||||||
|
|
||||||
for c in bytes.iter() {
|
for c in bytes.iter() {
|
||||||
if !BINOP_CHAR_MASK[*c as usize] {
|
if let Some(true) = BINOP_CHAR_MASK.get(*c as usize) {
|
||||||
|
chomped += 1;
|
||||||
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
chomped += 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue