Skip to content

Commit 0d782fb

Browse files
authored
Fix inline comments in the indented syntax (#881)
Closes #880
1 parent 07b5c84 commit 0d782fb

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## 1.23.5
22

3+
* Support inline comments in the indented syntax.
4+
35
* When an overloaded function receives the wrong number of arguments, guess
46
which overload the user actually meant to invoke, and display the invalid
57
argument error for that overload.

lib/src/parse/sass.dart

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,17 +309,29 @@ class SassParser extends StylesheetParser {
309309
return LoudComment(buffer.interpolation(scanner.spanFrom(start)));
310310
}
311311

312-
void whitespace() {
313-
// This overrides whitespace consumption so that it doesn't consume newlines
314-
// or loud comments.
312+
void whitespaceWithoutComments() {
313+
// This overrides whitespace consumption so that it doesn't consume
314+
// newlines.
315315
while (!scanner.isDone) {
316316
var next = scanner.peekChar();
317317
if (next != $tab && next != $space) break;
318318
scanner.readChar();
319319
}
320+
}
320321

321-
if (scanner.peekChar() == $slash && scanner.peekChar(1) == $slash) {
322-
silentComment();
322+
void loudComment() {
323+
// This overrides loud comment consumption so that it doesn't consume
324+
// multi-line comments.
325+
scanner.expect("/*");
326+
while (true) {
327+
var next = scanner.readChar();
328+
if (isNewline(next)) scanner.error("expected */.");
329+
if (next != $asterisk) continue;
330+
331+
do {
332+
next = scanner.readChar();
333+
} while (next == $asterisk);
334+
if (next == $slash) break;
323335
}
324336
}
325337

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass
2-
version: 1.23.5-dev
2+
version: 1.23.5
33
description: A Sass implementation in Dart.
44
author: Sass Team
55
homepage: https://github.com/sass/dart-sass

0 commit comments

Comments
 (0)