allow semicolon after closing brace

This commit is contained in:
ConnorSkees 2020-04-04 03:00:38 -04:00
parent 81c85a6f86
commit c0eaf4c5f6
3 changed files with 10 additions and 1 deletions

View File

@ -137,7 +137,7 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
f.insert( f.insert(
"get-function".to_owned(), "get-function".to_owned(),
Builtin::new(|mut args, scope| { Builtin::new(|mut args, scope| {
max_args!(args, 2); max_args!(args, 3);
let name = match arg!(args, 0, "name") { let name = match arg!(args, 0, "name") {
Value::Ident(s, _) => s, Value::Ident(s, _) => s,
v => return Err(format!("$name: {} is not a string.", v).into()), v => return Err(format!("$name: {} is not a string.", v).into()),

View File

@ -505,6 +505,10 @@ pub(crate) fn eat_expr<I: Iterator<Item = Token>>(
if values.is_empty() { if values.is_empty() {
toks.next(); toks.next();
devour_whitespace(toks); devour_whitespace(toks);
if toks.peek().is_some() && toks.peek().unwrap().kind == ';' {
toks.next();
}
devour_whitespace(toks);
return Ok(None); return Ok(None);
} else { } else {
// special edge case where there was no space between the colon // special edge case where there was no space between the colon

View File

@ -110,3 +110,8 @@ test!(
"$base-color: #036;\na {\n color:lighten($base-color, 5%);\n}", "$base-color: #036;\na {\n color:lighten($base-color, 5%);\n}",
"a {\n color: #004080;\n}\n" "a {\n color: #004080;\n}\n"
); );
test!(
semicolon_after_closing_brace,
"a {\n color: foo;\n};",
"a {\n color: foo;\n}\n"
);