mirror of
https://github.com/helix-editor/helix.git
synced 2025-01-19 21:47:07 +04:00
fix single-char variable names
This commit is contained in:
parent
cabb746b7d
commit
617f09adc4
@ -196,7 +196,8 @@ mod parser {
|
||||
|
||||
fn var<'a>() -> impl Parser<'a, Output = &'a str> {
|
||||
// var = [_a-zA-Z][_a-zA-Z0-9]*
|
||||
move |input: &'a str| match input
|
||||
move |input: &'a str| {
|
||||
input
|
||||
.char_indices()
|
||||
.take_while(|(p, c)| {
|
||||
*c == '_'
|
||||
@ -207,12 +208,11 @@ fn var<'a>() -> impl Parser<'a, Output = &'a str> {
|
||||
}
|
||||
})
|
||||
.last()
|
||||
{
|
||||
Some((index, c)) if index >= 1 => {
|
||||
.map(|(index, c)| {
|
||||
let index = index + c.len_utf8();
|
||||
Ok((&input[index..], &input[0..index]))
|
||||
}
|
||||
_ => Err(input),
|
||||
(&input[index..], &input[0..index])
|
||||
})
|
||||
.ok_or(input)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user