Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
anweiss committed Jun 20, 2019
1 parent 343422f commit 3f36e80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/ast.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::token::{SocketPlug, Tag, Value};
use super::token::{SocketPlug, Value};
use std::fmt;

pub trait Node {
Expand Down
14 changes: 6 additions & 8 deletions src/parser.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::ast::*;
use super::lexer::Lexer;
use super::token::{RangeValue, Token, Value, Tag};
use super::token::{RangeValue, Tag, Token, Value};
use std::{error::Error, mem};

pub struct Parser<'a> {
Expand Down Expand Up @@ -243,12 +243,10 @@ impl<'a> Parser<'a> {
fn parse_type2(&mut self) -> Result<Type2<'a>, Box<Error>> {
let t2 = match &self.cur_token {
// value
Token::VALUE(value) => {
match *value {
// TODO: fix workaround for double escaping string literal values
Value::TEXT(_) => Ok(Type2::Value(*value)),
_ => Err("bad value".into()),
}
Token::VALUE(value) => match value {
// TODO: fix workaround for double escaping string literal values
Value::TEXT(_) => Ok(Type2::Value(*value)),
_ => Err("bad value".into()),
}

// TODO: return Value type from lexer instead of these tokens. Duplicate
Expand Down Expand Up @@ -335,7 +333,7 @@ impl<'a> Parser<'a> {
Tag::DATA(data) => Ok(Type2::TaggedData(*data)),
Tag::MAJORTYPE(mt) => Ok(Type2::TaggedDataMajorType(*mt)),
Tag::ANY => Ok(Type2::Any),
}
},

_ => {
while let Token::COMMENT(_) = self.cur_token {
Expand Down

0 comments on commit 3f36e80

Please sign in to comment.