diff options
author | Bourgond Aries <macocio@gmail.com> | 2016-03-28 06:24:25 +0200 |
---|---|---|
committer | Bourgond Aries <macocio@gmail.com> | 2016-03-28 06:24:25 +0200 |
commit | 33c49d03578010e10d5cf881272292558dc043dd (patch) | |
tree | 1a8bada4bbb8e885c3ab21fd80a869d8105eb495 | |
parent | 568dd2ef4ba7db91d59988825f07e3e847e8c8d8 (diff) | |
download | milf-rs-33c49d03578010e10d5cf881272292558dc043dd.tar.gz milf-rs-33c49d03578010e10d5cf881272292558dc043dd.zip |
Leverage fn array_index to fn integer
-rw-r--r-- | src/parser.rs | 17 |
1 files changed, 1 insertions, 16 deletions
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<String> { - 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 |