From 70bf68d9bddfccde751bf3753e76d640e49a5b78 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 17 Jan 2016 01:17:54 -0800 Subject: [PATCH] More concision in parser --- src/parser.rs | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index 57aa097..fb6de0c 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -119,7 +119,6 @@ macro_rules! expect_identifier { } } - fn is_delimiter(token: &Token) -> bool { use tokenizer::Token::*; match *token { @@ -179,22 +178,15 @@ impl Parser { fn identlist(&mut self) -> ParseResult> { use tokenizer::Token::*; let mut args: Vec = Vec::new(); - loop { - match self.peek() { - Some(Identifier(name)) => { - args.push(name); - self.next(); - if let Some(Comma) = self.peek() { - self.next(); - } else { - break; - } - }, - - _ => break + while let Some(Identifier(name)) = self.peek() { + args.push(name); + self.next(); + if let Some(Comma) = self.peek() { + self.next(); + } else { + break; } } - Ok(args) }