mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
format
This commit is contained in:
parent
f170509bf1
commit
22e2545fd6
21 changed files with 268 additions and 413 deletions
|
@ -17,11 +17,7 @@ fn ascii_hex_digits<'a>() -> impl Parser<'a, &'a str, EString<'a>> {
|
|||
buf.push(byte as char);
|
||||
} else if buf.is_empty() {
|
||||
// We didn't find any hex digits!
|
||||
return Err((
|
||||
NoProgress,
|
||||
EString::CodePtEnd(state.pos),
|
||||
state,
|
||||
));
|
||||
return Err((NoProgress, EString::CodePtEnd(state.pos), state));
|
||||
} else {
|
||||
let state = state.advance_without_indenting_ee(buf.len(), |pos| {
|
||||
EString::Space(BadInputError::LineTooLong, pos)
|
||||
|
@ -31,19 +27,14 @@ fn ascii_hex_digits<'a>() -> impl Parser<'a, &'a str, EString<'a>> {
|
|||
}
|
||||
}
|
||||
|
||||
Err((
|
||||
NoProgress,
|
||||
EString::CodePtEnd(state.pos),
|
||||
state,
|
||||
))
|
||||
Err((NoProgress, EString::CodePtEnd(state.pos), state))
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! advance_state {
|
||||
($state:expr, $n:expr) => {
|
||||
$state.advance_without_indenting_ee($n, |pos| {
|
||||
EString::Space(BadInputError::LineTooLong, pos)
|
||||
})
|
||||
$state
|
||||
.advance_without_indenting_ee($n, |pos| EString::Space(BadInputError::LineTooLong, pos))
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -201,11 +192,7 @@ pub fn parse<'a>() -> impl Parser<'a, StrLiteral<'a>, EString<'a>> {
|
|||
// all remaining chars. This will mask all other errors, but
|
||||
// it should make it easiest to debug; the file will be a giant
|
||||
// error starting from where the open quote appeared.
|
||||
return Err((
|
||||
MadeProgress,
|
||||
EString::EndlessSingle(state.pos),
|
||||
state,
|
||||
));
|
||||
return Err((MadeProgress, EString::EndlessSingle(state.pos), state));
|
||||
}
|
||||
}
|
||||
b'\\' => {
|
||||
|
@ -294,11 +281,7 @@ pub fn parse<'a>() -> impl Parser<'a, StrLiteral<'a>, EString<'a>> {
|
|||
// Invalid escape! A backslash must be followed
|
||||
// by either an open paren or else one of the
|
||||
// escapable characters (\n, \t, \", \\, etc)
|
||||
return Err((
|
||||
MadeProgress,
|
||||
EString::UnknownEscape(state.pos),
|
||||
state,
|
||||
));
|
||||
return Err((MadeProgress, EString::UnknownEscape(state.pos), state));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue