More concision in parser

This commit is contained in:
greg 2016-01-17 01:17:54 -08:00
parent f53c14535b
commit 70bf68d9bd

View File

@ -119,7 +119,6 @@ macro_rules! expect_identifier {
}
}
fn is_delimiter(token: &Token) -> bool {
use tokenizer::Token::*;
match *token {
@ -179,9 +178,7 @@ impl Parser {
fn identlist(&mut self) -> ParseResult<Vec<String>> {
use tokenizer::Token::*;
let mut args: Vec<String> = Vec::new();
loop {
match self.peek() {
Some(Identifier(name)) => {
while let Some(Identifier(name)) = self.peek() {
args.push(name);
self.next();
if let Some(Comma) = self.peek() {
@ -189,12 +186,7 @@ impl Parser {
} else {
break;
}
},
_ => break
}
}
Ok(args)
}