rename col -> column

This commit is contained in:
Joshua Warner 2021-12-22 20:37:40 -08:00
parent 4d7070ce3b
commit f170509bf1
6 changed files with 21 additions and 21 deletions

View file

@ -222,7 +222,7 @@ where
} else if state.pos.line != pos.line {
// we parsed at least one newline
state.indent_col = pos.column;
state.indent_column = pos.column;
if pos.column >= min_indent {
state.pos = pos;

View file

@ -1705,7 +1705,7 @@ mod when {
move |arena, state: State<'a>| {
parser::keyword_e(keyword::WHEN, EWhen::When)
.parse(arena, state)
.map(|(progress, (), state)| (progress, state.indent_col, state))
.map(|(progress, (), state)| (progress, state.indent_column, state))
}
}
@ -1714,7 +1714,7 @@ mod when {
options: ExprParseOptions,
) -> impl Parser<'a, Vec<'a, &'a WhenBranch<'a>>, EWhen<'a>> {
move |arena, state: State<'a>| {
let when_indent = state.indent_col;
let when_indent = state.indent_column;
let mut branches: Vec<'a, &'a WhenBranch<'a>> = Vec::with_capacity_in(2, arena);
@ -1725,7 +1725,7 @@ mod when {
branch_alternatives(min_indent, options, None).parse(arena, state)?;
let original_indent = pattern_indent_level;
state.indent_col = pattern_indent_level;
state.indent_column = pattern_indent_level;
// Parse the first "->" and the expression after it.
let (_, loc_first_expr, mut state) =
@ -1742,11 +1742,11 @@ mod when {
and!(
then(
branch_alternatives(min_indent, options, Some(pattern_indent_level)),
move |_arena, state, _, ((indent_col, loc_patterns), loc_guard)| {
if pattern_indent_level == indent_col {
move |_arena, state, _, ((indent_column, loc_patterns), loc_guard)| {
if pattern_indent_level == indent_column {
Ok((MadeProgress, (loc_patterns, loc_guard), state))
} else {
let indent = pattern_indent_level - indent_col;
let indent = pattern_indent_level - indent_column;
Err((
MadeProgress,
EWhen::PatternAlignment(indent, state.pos),
@ -1786,7 +1786,7 @@ mod when {
}
let mut state = state;
state.indent_col = when_indent;
state.indent_column = when_indent;
Ok((MadeProgress, branches, state))
}
@ -1895,9 +1895,9 @@ mod when {
_ => {
let pattern_indent =
min_indent.max(pattern_indent_level.unwrap_or(min_indent));
// the region is not reliable for the indent col in the case of
// the region is not reliable for the indent column in the case of
// parentheses around patterns
let pattern_indent_col = state.pos.column;
let pattern_indent_column = state.pos.column;
let parser = sep_by1(
word1(b'|', EWhen::Bar),
@ -1923,7 +1923,7 @@ mod when {
}
}
Ok((MadeProgress, (pattern_indent_col, loc_patterns), state))
Ok((MadeProgress, (pattern_indent_column, loc_patterns), state))
}
}
}
@ -2111,11 +2111,11 @@ where
E: 'a,
{
move |arena, state: State<'a>| {
let indent_col = state.indent_col;
let indent_column = state.indent_column;
let (progress, _, state) = parser.parse(arena, state)?;
Ok((progress, indent_col, state))
Ok((progress, indent_column, state))
}
}

View file

@ -1331,8 +1331,8 @@ where
E: 'a,
{
move |_arena, state: State<'a>| {
dbg!(state.indent_col, min_indent);
if state.indent_col < min_indent {
dbg!(state.indent_column, min_indent);
if state.indent_column < min_indent {
Err((NoProgress, to_problem(state.pos), state))
} else {
Ok((NoProgress, (), state))

View file

@ -342,7 +342,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 row/col is important for error reporting
// using the initial pos is important for error reporting
let pos = state.pos;
let (progress, loc_label, state) = loc!(specialize(
move |_, _| PRecord::Field(pos),

View file

@ -15,7 +15,7 @@ pub struct State<'a> {
/// Current indentation level, in columns
/// (so no indent is col 1 - this saves an arithmetic operation.)
pub indent_col: u16,
pub indent_column: u16,
}
impl<'a> State<'a> {
@ -23,7 +23,7 @@ impl<'a> State<'a> {
State {
bytes,
pos: Position::default(),
indent_col: 0,
indent_column: 0,
}
}
@ -91,7 +91,7 @@ impl<'a> State<'a> {
}
/// Returns a Region corresponding to the current state, but
/// with the end_col advanced by the given amount. This is
/// with the the end column advanced by the given amount. This is
/// useful when parsing something "manually" (using input.chars())
/// and thus wanting a Region while not having access to loc().
pub fn len_region(&self, length: u16) -> Region {
@ -128,7 +128,7 @@ impl<'a> fmt::Debug for State<'a> {
}
write!(f, "\n\t(line, col): ({}, {}),", self.pos.line, self.pos.column)?;
write!(f, "\n\tindent_col: {}", self.indent_col)?;
write!(f, "\n\tindent_column: {}", self.indent_column)?;
write!(f, "\n}}")
}
}

View file

@ -211,7 +211,7 @@ fn record_type_field<'a>(
(move |arena, state: State<'a>| {
// You must have a field name, e.g. "email"
// using the initial row/col is important for error reporting
// using the initial pos is important for error reporting
let pos = state.pos;
let (progress, loc_label, state) = loc!(specialize(
move |_, _| ETypeRecord::Field(pos),