From 74dad6af0cbc1bbfa624869980496f8b255d3d51 Mon Sep 17 00:00:00 2001 From: Connor Skees Date: Sun, 2 Aug 2020 15:57:58 -0400 Subject: [PATCH] allow whitespace after multiline comment in named args --- src/utils/comment_whitespace.rs | 5 +++-- tests/args.rs | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/utils/comment_whitespace.rs b/src/utils/comment_whitespace.rs index f3b1a18..386ecd0 100644 --- a/src/utils/comment_whitespace.rs +++ b/src/utils/comment_whitespace.rs @@ -50,7 +50,7 @@ pub(crate) fn peek_whitespace_or_comment(s: &mut PeekMoreIterator match s.peek_forward(1) { + '/' => match s.peek_next() { Some(Token { kind: '/', .. }) => { peek_until_newline(s); found_whitespace = true; @@ -60,7 +60,8 @@ pub(crate) fn peek_whitespace_or_comment(s: &mut PeekMoreIterator { - if matches!(s.peek_forward(1), Some(Token { kind: '/', .. })) { + if matches!(s.peek_next(), Some(Token { kind: '/', .. })) { + s.advance_cursor(); break; } } diff --git a/tests/args.rs b/tests/args.rs index 6c8de5f..37bb585 100644 --- a/tests/args.rs +++ b/tests/args.rs @@ -168,3 +168,14 @@ error!( filter_value_after_equal_is_last_char, "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" +);