refactor parser return
This commit is contained in:
parent
7fe3abc625
commit
00aeacbc74
@ -330,17 +330,13 @@ impl<'a> Parser<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check for named colors
|
// check for named colors
|
||||||
if let Some(c) = NAMED_COLORS.get_by_name(lower.as_str()) {
|
Ok(if let Some(c) = NAMED_COLORS.get_by_name(lower.as_str()) {
|
||||||
return Ok(
|
|
||||||
IntermediateValue::Value(HigherIntermediateValue::Literal(Value::Color(Box::new(
|
IntermediateValue::Value(HigherIntermediateValue::Literal(Value::Color(Box::new(
|
||||||
Color::new(c[0], c[1], c[2], c[3], s),
|
Color::new(c[0], c[1], c[2], c[3], s),
|
||||||
))))
|
))))
|
||||||
.span(span),
|
} else {
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for keywords
|
// check for keywords
|
||||||
Ok(match s.as_str() {
|
match s.as_str() {
|
||||||
"true" => IntermediateValue::Value(HigherIntermediateValue::Literal(Value::True)),
|
"true" => IntermediateValue::Value(HigherIntermediateValue::Literal(Value::True)),
|
||||||
"false" => IntermediateValue::Value(HigherIntermediateValue::Literal(Value::False)),
|
"false" => IntermediateValue::Value(HigherIntermediateValue::Literal(Value::False)),
|
||||||
"null" => IntermediateValue::Value(HigherIntermediateValue::Literal(Value::Null)),
|
"null" => IntermediateValue::Value(HigherIntermediateValue::Literal(Value::Null)),
|
||||||
@ -352,6 +348,7 @@ impl<'a> Parser<'a> {
|
|||||||
QuoteKind::None,
|
QuoteKind::None,
|
||||||
))),
|
))),
|
||||||
}
|
}
|
||||||
|
}
|
||||||
.span(span))
|
.span(span))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user