[parser] Clean up some syntax and warnings

This commit is contained in:
Eryn Wells 2018-08-24 08:33:06 -07:00
parent 976675027f
commit 1ff349e147
4 changed files with 9 additions and 9 deletions

View file

@ -76,7 +76,7 @@ impl<T> Iterator for Parser<T> where T: Iterator<Item=LexerResult> {
input_lex
},
Some(NodeParseResult::Error{ msg }) => {
out = Some(Err(ParseError::ParserError{ msg: msg }));
out = Some(Err(ParseError::ParserError{ msg }));
break;
}
};
@ -87,15 +87,15 @@ impl<T> Iterator for Parser<T> where T: Iterator<Item=LexerResult> {
result = Some(self.parse_lex(lex));
},
Some(Err(ref error)) => {
// TODO: Lexer error. Throw it up and out.
// Lexer error. Throw it up and out.
let msg = error.msg().to_string();
out = Some(Err(ParseError::LexerError { msg: msg }));
out = Some(Err(ParseError::LexerError { msg }));
break;
},
None => {
// TODO: We didn't get a Lex from the input, which means the
// input is done. If there's any parse result waiting
// around, clean it up and return it or return an error.
// We didn't get a Lex from the input, which means the input
// is done. If there's any parse result waiting around,
// clean it up and return it or return an error.
result = Some(self.parse_none());
}
}

View file

@ -49,6 +49,6 @@ impl NodeParser for ListParser {
fn none(&mut self) -> NodeParseResult {
let msg = format!("Unmatched paren, found EOF");
NodeParseResult::Error { msg }
NodeParseResult::error(msg)
}
}

View file

@ -3,7 +3,7 @@
*/
use std::fmt::Debug;
use sibillexer::{Lex, Token};
use sibillexer::Lex;
use sibiltypes::Obj;
#[derive(Debug)]

View file

@ -27,6 +27,6 @@ impl NodeParser for SymParser {
fn none(&mut self) -> NodeParseResult {
let msg = format!("Expected symbol, found EOF");
NodeParseResult::Error { msg }
NodeParseResult::error(msg)
}
}