resolve hang on malformed input involving and
and or
This commit is contained in:
parent
eb6f0f3451
commit
c700845174
@ -546,10 +546,12 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
';' | '}' | '{' => return None,
|
||||
':' | '?' | ')' | '@' | '^' | ']' | '|' => {
|
||||
return Some(Err(("expected \";\".", span).into()))
|
||||
self.toks.next();
|
||||
return Some(Err(("expected \";\".", span).into()));
|
||||
}
|
||||
'\u{0}'..='\u{8}' | '\u{b}'..='\u{1f}' | '\u{7f}'..=std::char::MAX | '`' | '~' => {
|
||||
return Some(Err(("Expected expression.", span).into()))
|
||||
self.toks.next();
|
||||
return Some(Err(("Expected expression.", span).into()));
|
||||
}
|
||||
' ' | '\n' | '\t' => unreachable!("whitespace is checked prior to this match"),
|
||||
'A'..='Z' | 'a'..='z' | '_' | '\\' => {
|
||||
@ -1194,15 +1196,21 @@ impl<'a, 'b: 'a> IntermediateValueIterator<'a, 'b> {
|
||||
if left.node.is_true(left.span)? {
|
||||
// we explicitly ignore errors here as a workaround for short circuiting
|
||||
while let Some(value) = self.peek() {
|
||||
if let Ok(Spanned {
|
||||
match value {
|
||||
Ok(Spanned {
|
||||
node: IntermediateValue::Comma,
|
||||
..
|
||||
}) = value
|
||||
{
|
||||
break;
|
||||
}
|
||||
}) => break,
|
||||
Ok(..) => {
|
||||
self.next();
|
||||
}
|
||||
Err(..) => {
|
||||
if let Some(v) = self.next() {
|
||||
v?;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
space_separated.push(left);
|
||||
} else {
|
||||
let right = self.single_value()?;
|
||||
|
@ -56,3 +56,8 @@ test!(
|
||||
"a {\n color: false and comparable(\"a\", \"b\");\n}\n",
|
||||
"a {\n color: false;\n}\n"
|
||||
);
|
||||
error!(
|
||||
#[ignore = "blocked on a rewrite of value eval"]
|
||||
properly_bubbles_error_when_invalid_char_after_and,
|
||||
"a {\n color: false and? foo;\n}\n", "Error: expected \";\"."
|
||||
);
|
||||
|
@ -73,3 +73,7 @@ test!(
|
||||
"a {\n color: true or red % foo, red;\n}\n",
|
||||
"a {\n color: true, red;\n}\n"
|
||||
);
|
||||
error!(
|
||||
properly_bubbles_error_when_invalid_char_after_or,
|
||||
"a {\n color: true or? foo;\n}\n", "Error: expected \";\"."
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user