diff --git a/src/utils/read_until.rs b/src/utils/read_until.rs index 8fb213b..55f855d 100644 --- a/src/utils/read_until.rs +++ b/src/utils/read_until.rs @@ -21,8 +21,8 @@ pub(crate) fn read_until_open_curly_brace>( '}' => n -= 1, '/' => { let next = toks.next().unwrap(); - match toks.peek().unwrap().kind { - '/' => read_until_newline(toks), + match toks.peek() { + Some(Token { kind: '/', .. }) => read_until_newline(toks), _ => t.push(next), }; continue; diff --git a/tests/if.rs b/tests/if.rs index ca058b1..13f8add 100644 --- a/tests/if.rs +++ b/tests/if.rs @@ -129,3 +129,4 @@ error!( error!(unclosed_dbl_quote, "@if true \" {}", "Error: Expected \"."); error!(unclosed_sgl_quote, "@if true ' {}", "Error: Expected '."); error!(unclosed_call_args, "@if a({}", "Error: expected \")\"."); +error!(nothing_after_div, "@if a/", "Error: Expected expression.");