[parser] Clean up some syntax and warnings
This commit is contained in:
parent
976675027f
commit
1ff349e147
4 changed files with 9 additions and 9 deletions
|
@ -76,7 +76,7 @@ impl<T> Iterator for Parser<T> where T: Iterator<Item=LexerResult> {
|
||||||
input_lex
|
input_lex
|
||||||
},
|
},
|
||||||
Some(NodeParseResult::Error{ msg }) => {
|
Some(NodeParseResult::Error{ msg }) => {
|
||||||
out = Some(Err(ParseError::ParserError{ msg: msg }));
|
out = Some(Err(ParseError::ParserError{ msg }));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -87,15 +87,15 @@ impl<T> Iterator for Parser<T> where T: Iterator<Item=LexerResult> {
|
||||||
result = Some(self.parse_lex(lex));
|
result = Some(self.parse_lex(lex));
|
||||||
},
|
},
|
||||||
Some(Err(ref error)) => {
|
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();
|
let msg = error.msg().to_string();
|
||||||
out = Some(Err(ParseError::LexerError { msg: msg }));
|
out = Some(Err(ParseError::LexerError { msg }));
|
||||||
break;
|
break;
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
// TODO: We didn't get a Lex from the input, which means the
|
// We didn't get a Lex from the input, which means the input
|
||||||
// input is done. If there's any parse result waiting
|
// is done. If there's any parse result waiting around,
|
||||||
// around, clean it up and return it or return an error.
|
// clean it up and return it or return an error.
|
||||||
result = Some(self.parse_none());
|
result = Some(self.parse_none());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,6 @@ impl NodeParser for ListParser {
|
||||||
|
|
||||||
fn none(&mut self) -> NodeParseResult {
|
fn none(&mut self) -> NodeParseResult {
|
||||||
let msg = format!("Unmatched paren, found EOF");
|
let msg = format!("Unmatched paren, found EOF");
|
||||||
NodeParseResult::Error { msg }
|
NodeParseResult::error(msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use sibillexer::{Lex, Token};
|
use sibillexer::Lex;
|
||||||
use sibiltypes::Obj;
|
use sibiltypes::Obj;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -27,6 +27,6 @@ impl NodeParser for SymParser {
|
||||||
|
|
||||||
fn none(&mut self) -> NodeParseResult {
|
fn none(&mut self) -> NodeParseResult {
|
||||||
let msg = format!("Expected symbol, found EOF");
|
let msg = format!("Expected symbol, found EOF");
|
||||||
NodeParseResult::Error { msg }
|
NodeParseResult::error(msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue