From cbec20f753aa39d5631892ad4555bb55ce2d9aaf Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sun, 24 May 2020 07:51:28 -0400 Subject: [PATCH] make value parsing more robust --- src/value/parse.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/value/parse.rs b/src/value/parse.rs index e7a6a48..a8b4957 100644 --- a/src/value/parse.rs +++ b/src/value/parse.rs @@ -906,10 +906,13 @@ impl Value { ':' | '?' | ')' | '@' | '^' | ']' | '|' => { return Some(Err(("expected \";\".", span).into())) } - v if v as u32 >= 0x80 || v.is_control() || v == '`' || v == '~' => { + '\u{0}'..='\u{8}' | '\u{b}'..='\u{1f}' | '\u{7f}'..=std::char::MAX | '`' | '~' => { return Some(Err(("Expected expression.", span).into())) } - v => todo!("unexpected token in value parsing: {:?}", v), + ' ' | '\n' | '\t' => unreachable!("whitespace is checked prior to this match"), + 'A'..='Z' | 'a'..='z' | '_' | '\\' => { + unreachable!("these chars are checked in an if stmt") + } })) } }