From 2df5e1b274610e4575b322678e8d54cc9463b208 Mon Sep 17 00:00:00 2001 From: Connor Skees Date: Sun, 2 Aug 2020 22:24:37 -0400 Subject: [PATCH] resolve panic on malformed args missing closing parenthesis --- src/parse/args.rs | 4 ++-- tests/args.rs | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/parse/args.rs b/src/parse/args.rs index 2702b0e..8de7c39 100644 --- a/src/parse/args.rs +++ b/src/parse/args.rs @@ -345,9 +345,9 @@ impl<'a> Parser<'a> { None => return Err(("expected \")\".", span).into()), } } - Some(c) => { + Some(Token { pos, .. }) => { value?; - unreachable!("{:?}", c) + return Err(("expected \")\".", *pos).into()); } None => return Err(("expected \")\".", span).into()), } diff --git a/tests/args.rs b/tests/args.rs index 37bb585..e06da77 100644 --- a/tests/args.rs +++ b/tests/args.rs @@ -168,6 +168,10 @@ error!( filter_value_after_equal_is_last_char, "a {\n color: foo(a=a", "Error: expected \")\"." ); +error!( + unclosed_paren_in_nested_args, + "a { color: a(b(red); }", "Error: expected \")\"." +); test!( space_after_loud_comment, "@mixin foo($x) {