From 33c49d03578010e10d5cf881272292558dc043dd Mon Sep 17 00:00:00 2001 From: Bourgond Aries Date: Mon, 28 Mar 2016 06:24:25 +0200 Subject: Leverage fn array_index to fn integer --- src/parser.rs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'src') diff --git a/src/parser.rs b/src/parser.rs index 35b57fa..9eb506a 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -292,22 +292,7 @@ impl<'a> Parser<'a> { // Parse an array index as a natural number fn array_index(&mut self) -> Option { - let mut index = String::new(); - 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 + self.integer(0, false, false) } /// Parse a path into a vector of paths -- cgit v1.2.3