properly parse maps with maps as values
This commit is contained in:
parent
07d6faf64b
commit
27e4f2b541
@ -2,7 +2,7 @@ use peekmore::PeekMoreIterator;
|
||||
|
||||
use crate::{error::SassResult, Token};
|
||||
|
||||
use super::read_until_closing_quote;
|
||||
use super::{read_until_closing_paren, read_until_closing_quote};
|
||||
/// Reads until the char is found, consuming the char,
|
||||
/// or until the end of the iterator is hit
|
||||
pub(crate) fn read_until_char<I: Iterator<Item = Token>>(
|
||||
@ -17,6 +17,11 @@ pub(crate) fn read_until_char<I: Iterator<Item = Token>>(
|
||||
v.extend(read_until_closing_quote(toks, tok.kind)?);
|
||||
continue;
|
||||
}
|
||||
'(' => {
|
||||
v.push(tok);
|
||||
v.extend(read_until_closing_paren(toks)?);
|
||||
continue;
|
||||
}
|
||||
t if t == c => break,
|
||||
_ => {}
|
||||
}
|
||||
|
14
tests/map.rs
14
tests/map.rs
@ -163,3 +163,17 @@ test!(
|
||||
"a {\n color: inspect(((1, 2): 3));\n}\n",
|
||||
"a {\n color: ((1, 2): 3);\n}\n"
|
||||
);
|
||||
test!(
|
||||
// todo: this just tests that it compiles, but does not test
|
||||
// if it parses correctly
|
||||
map_with_map_as_value,
|
||||
"$foo: (\"21by9\": (x: 21, y: 9));",
|
||||
""
|
||||
);
|
||||
test!(
|
||||
// todo: this just tests that it compiles, but does not test
|
||||
// if it parses correctly
|
||||
paren_with_paren_element_and_trailing_comma,
|
||||
"$foo: ((\"<\", \"%3c\"), );",
|
||||
""
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user