From 857bc189b9a3d1023361bde3602c0ff3b1de8d97 Mon Sep 17 00:00:00 2001 From: C Jones Date: Wed, 19 Dec 2018 09:01:37 -0500 Subject: [PATCH] Code cleanup --- src/parser.rs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index 4f7f2ef..561a61a 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -83,18 +83,8 @@ trait IsDelimeter { impl IsDelimeter for char { fn is_delimiter(&self) -> bool { - self.is_whitespace() - || *self == ';' - || *self == '(' - || *self == ')' - || *self == '[' - || *self == ']' - || *self == '{' - || *self == '}' - || *self == '"' - || *self == '\'' - || *self == '`' - || *self == ',' + let delim_chars = r#";()[]{}"\`,"#; + self.is_whitespace() || delim_chars.contains(*self) } } @@ -223,7 +213,7 @@ pub fn parse_expression(input: &str, start_loc: usize) -> ParseResult err, }, Some(',') => { - if input[1..].chars().next() == Some('@') { + if input[1..].starts_with('@') { match parse_expression(&input[2..], start_loc + 2) { Done(rest, result) => { let span = *result.get_loc(); @@ -458,7 +448,7 @@ pub fn parse_string(input: &str, start_loc: usize) -> ParseResult