From d585f094236de21b80c7f27e8d0e71995479754e Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 3 Oct 2017 10:05:46 -0700 Subject: [PATCH] Don't silently swallow lexer errors. --- lib/reader/src/parser.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/reader/src/parser.rs b/lib/reader/src/parser.rs index be86302645..e334319e91 100644 --- a/lib/reader/src/parser.rs +++ b/lib/reader/src/parser.rs @@ -807,6 +807,11 @@ impl<'a> Parser<'a> { while self.token().is_some() { list.push(self.parse_function(unique_isa)?); } + if let Some(err) = self.lex_error { + return match err { + lexer::Error::InvalidChar => err!(self.loc, "invalid character"), + }; + } Ok(list) }