@@ -196,23 +196,23 @@ mod parser {
196196
197197 fn var<'a>() -> impl Parser<'a, Output = &'a str> {
198198 // var = [_a-zA-Z][_a-zA-Z0-9]*
199− move |input: &'a str| match input
200− .char_indices()
201− .take_while(|(p, c)| {
202− *c == '_'
203− || if *p == 0 {
204− c.is_ascii_alphabetic()
205− } else {
206− c.is_ascii_alphanumeric()
207− }
208− })
209− .last()
210− {
211− Some((index, c)) if index >= 1 => {
212− let index = index + c.len_utf8();
213− Ok((&input[index..], &input[0..index]))
214− }
215− _ => Err(input),
199+ move |input: &'a str| {
200+ input
201+ .char_indices()
202+ .take_while(|(p, c)| {
203+ *c == '_'
204+ || if *p == 0 {
205+ c.is_ascii_alphabetic()
206+ } else {
207+ c.is_ascii_alphanumeric()
208+ }
209+ })
210+ .last()
211+ .map(|(index, c)| {
212+ let index = index + c.len_utf8();
213+ (&input[index..], &input[0..index])
214+ })
215+ .ok_or(input)
216216 }
217217 }
218218