Make State::xyzlcol a LineColumn, and change everything wanting a Position to use State::pos() instead

This commit is contained in:
Joshua Warner 2021-12-23 18:11:09 -08:00
parent d2dcb462c7
commit 1b257da356
10 changed files with 127 additions and 87 deletions

View file

@ -232,7 +232,7 @@ fn loc_ident_pattern_help<'a>(
if crate::keyword::KEYWORDS.contains(&parts[0]) {
Err((
NoProgress,
EPattern::End(original_state.xyzlcol),
EPattern::End(original_state.pos()),
original_state,
))
} else if module_name.is_empty() && parts.len() == 1 {
@ -304,7 +304,7 @@ fn lowercase_ident_pattern<'a>(
arena: &'a Bump,
state: State<'a>,
) -> ParseResult<'a, &'a str, EPattern<'a>> {
let pos = state.xyzlcol;
let pos = state.pos();
specialize(move |_, _| EPattern::End(pos), lowercase_ident()).parse(arena, state)
}
@ -339,7 +339,7 @@ fn record_pattern_field<'a>(min_indent: u16) -> impl Parser<'a, Loc<Pattern<'a>>
move |arena, state: State<'a>| {
// You must have a field name, e.g. "email"
// using the initial pos is important for error reporting
let pos = state.xyzlcol;
let pos = state.pos();
let (progress, loc_label, state) = loc!(specialize(
move |_, _| PRecord::Field(pos),
lowercase_ident()