remove unwrap when nothing after /

This commit is contained in:
ConnorSkees 2020-05-24 10:47:11 -04:00
parent 1382ea32ca
commit c42fdc5ee7
2 changed files with 3 additions and 2 deletions

View File

@ -21,8 +21,8 @@ pub(crate) fn read_until_open_curly_brace<I: Iterator<Item = Token>>(
'}' => n -= 1, '}' => n -= 1,
'/' => { '/' => {
let next = toks.next().unwrap(); let next = toks.next().unwrap();
match toks.peek().unwrap().kind { match toks.peek() {
'/' => read_until_newline(toks), Some(Token { kind: '/', .. }) => read_until_newline(toks),
_ => t.push(next), _ => t.push(next),
}; };
continue; continue;

View File

@ -129,3 +129,4 @@ error!(
error!(unclosed_dbl_quote, "@if true \" {}", "Error: Expected \"."); error!(unclosed_dbl_quote, "@if true \" {}", "Error: Expected \".");
error!(unclosed_sgl_quote, "@if true ' {}", "Error: Expected '."); error!(unclosed_sgl_quote, "@if true ' {}", "Error: Expected '.");
error!(unclosed_call_args, "@if a({}", "Error: expected \")\"."); error!(unclosed_call_args, "@if a({}", "Error: expected \")\".");
error!(nothing_after_div, "@if a/", "Error: Expected expression.");