mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
Fix parsing bug in accessor functions
(They weren't advancing the state by 1, because the state advancement was relying on part_buf - which was empty in the case of accessor functions due to having only parsed the dot so far.)
This commit is contained in:
parent
db3dbe3551
commit
a4b0bdc679
1 changed files with 7 additions and 1 deletions
|
@ -81,6 +81,7 @@ where
|
||||||
let mut is_capitalized;
|
let mut is_capitalized;
|
||||||
let is_accessor_fn;
|
let is_accessor_fn;
|
||||||
let mut is_private_tag = false;
|
let mut is_private_tag = false;
|
||||||
|
let mut chars_parsed;
|
||||||
|
|
||||||
// Identifiers and accessor functions must start with either a letter or a dot.
|
// Identifiers and accessor functions must start with either a letter or a dot.
|
||||||
// If this starts with neither, it must be something else!
|
// If this starts with neither, it must be something else!
|
||||||
|
@ -96,6 +97,8 @@ where
|
||||||
is_private_tag = true;
|
is_private_tag = true;
|
||||||
is_capitalized = true;
|
is_capitalized = true;
|
||||||
is_accessor_fn = false;
|
is_accessor_fn = false;
|
||||||
|
|
||||||
|
chars_parsed = 2;
|
||||||
}
|
}
|
||||||
Some(ch) => {
|
Some(ch) => {
|
||||||
return Err(unexpected(ch, 0, state, Attempting::Identifier));
|
return Err(unexpected(ch, 0, state, Attempting::Identifier));
|
||||||
|
@ -109,9 +112,13 @@ where
|
||||||
|
|
||||||
is_capitalized = ch.is_uppercase();
|
is_capitalized = ch.is_uppercase();
|
||||||
is_accessor_fn = false;
|
is_accessor_fn = false;
|
||||||
|
|
||||||
|
chars_parsed = 1;
|
||||||
} else if ch == '.' {
|
} else if ch == '.' {
|
||||||
is_capitalized = false;
|
is_capitalized = false;
|
||||||
is_accessor_fn = true;
|
is_accessor_fn = true;
|
||||||
|
|
||||||
|
chars_parsed = 1;
|
||||||
} else {
|
} else {
|
||||||
return Err(unexpected(ch, 0, state, Attempting::Identifier));
|
return Err(unexpected(ch, 0, state, Attempting::Identifier));
|
||||||
}
|
}
|
||||||
|
@ -121,7 +128,6 @@ where
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut chars_parsed = part_buf.len();
|
|
||||||
let mut next_char = None;
|
let mut next_char = None;
|
||||||
|
|
||||||
while let Some(ch) = chars.next() {
|
while let Some(ch) = chars.next() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue