|
|
@ -196,23 +196,23 @@ mod parser {
|
|
|
|
|
|
|
|
|
|
|
|
fn var<'a>() -> impl Parser<'a, Output = &'a str> {
|
|
|
|
fn var<'a>() -> impl Parser<'a, Output = &'a str> {
|
|
|
|
// var = [_a-zA-Z][_a-zA-Z0-9]*
|
|
|
|
// var = [_a-zA-Z][_a-zA-Z0-9]*
|
|
|
|
move |input: &'a str| match input
|
|
|
|
move |input: &'a str| {
|
|
|
|
.char_indices()
|
|
|
|
input
|
|
|
|
.take_while(|(p, c)| {
|
|
|
|
.char_indices()
|
|
|
|
*c == '_'
|
|
|
|
.take_while(|(p, c)| {
|
|
|
|
|| if *p == 0 {
|
|
|
|
*c == '_'
|
|
|
|
c.is_ascii_alphabetic()
|
|
|
|
|| if *p == 0 {
|
|
|
|
} else {
|
|
|
|
c.is_ascii_alphabetic()
|
|
|
|
c.is_ascii_alphanumeric()
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
c.is_ascii_alphanumeric()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
.last()
|
|
|
|
})
|
|
|
|
{
|
|
|
|
.last()
|
|
|
|
Some((index, c)) if index >= 1 => {
|
|
|
|
.map(|(index, c)| {
|
|
|
|
let index = index + c.len_utf8();
|
|
|
|
let index = index + c.len_utf8();
|
|
|
|
Ok((&input[index..], &input[0..index]))
|
|
|
|
(&input[index..], &input[0..index])
|
|
|
|
}
|
|
|
|
})
|
|
|
|
_ => Err(input),
|
|
|
|
.ok_or(input)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|