allow whitespace after multiline comment in named args

This commit is contained in:
Connor Skees 2020-08-02 15:57:58 -04:00
parent 4a9c200a7e
commit 74dad6af0c
2 changed files with 14 additions and 2 deletions

View File

@ -50,7 +50,7 @@ pub(crate) fn peek_whitespace_or_comment(s: &mut PeekMoreIterator<IntoIter<Token
found_whitespace = true; found_whitespace = true;
s.advance_cursor(); s.advance_cursor();
} }
'/' => match s.peek_forward(1) { '/' => match s.peek_next() {
Some(Token { kind: '/', .. }) => { Some(Token { kind: '/', .. }) => {
peek_until_newline(s); peek_until_newline(s);
found_whitespace = true; found_whitespace = true;
@ -60,7 +60,8 @@ pub(crate) fn peek_whitespace_or_comment(s: &mut PeekMoreIterator<IntoIter<Token
while let Some(tok) = s.peek_next() { while let Some(tok) = s.peek_next() {
match tok.kind { match tok.kind {
'*' => { '*' => {
if matches!(s.peek_forward(1), Some(Token { kind: '/', .. })) { if matches!(s.peek_next(), Some(Token { kind: '/', .. })) {
s.advance_cursor();
break; break;
} }
} }

View File

@ -168,3 +168,14 @@ error!(
filter_value_after_equal_is_last_char, filter_value_after_equal_is_last_char,
"a {\n color: foo(a=a", "Error: expected \")\"." "a {\n color: foo(a=a", "Error: expected \")\"."
); );
test!(
space_after_loud_comment,
"@mixin foo($x) {
color: $x;
}
a {
@include foo($x /* blah */ : kwd-y);
}",
"a {\n color: kwd-y;\n}\n"
);