Leverage fn array_index to fn integer

This commit is contained in:
Bourgond Aries 2016-03-28 06:24:25 +02:00
parent 568dd2ef4b
commit 33c49d0357

View file

@ -292,22 +292,7 @@ impl<'a> Parser<'a> {
// Parse an array index as a natural number // Parse an array index as a natural number
fn array_index(&mut self) -> Option<String> { fn array_index(&mut self) -> Option<String> {
let mut index = String::new(); self.integer(0, false, false)
while let Some((_, ch)) = self.peek(0) {
match ch {
v @ '0' ... '9' => {
if !self.eat(v) {
return None
}
index.push(v);
}
_ => return Some(index),
}
}
if index.len() > 0 {
return Some(index);
}
None
} }
/// Parse a path into a vector of paths /// Parse a path into a vector of paths