Fix inline comments in the indented syntax (#881)

Closes #880
This commit is contained in:
Natalie Weizenbaum 2019-11-15 15:45:11 -08:00 committed by GitHub
parent 07b5c84b7d
commit 0d782fbccf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 6 deletions

View File

@ -1,5 +1,7 @@
## 1.23.5 ## 1.23.5
* Support inline comments in the indented syntax.
* When an overloaded function receives the wrong number of arguments, guess * When an overloaded function receives the wrong number of arguments, guess
which overload the user actually meant to invoke, and display the invalid which overload the user actually meant to invoke, and display the invalid
argument error for that overload. argument error for that overload.

View File

@ -309,17 +309,29 @@ class SassParser extends StylesheetParser {
return LoudComment(buffer.interpolation(scanner.spanFrom(start))); return LoudComment(buffer.interpolation(scanner.spanFrom(start)));
} }
void whitespace() { void whitespaceWithoutComments() {
// This overrides whitespace consumption so that it doesn't consume newlines // This overrides whitespace consumption so that it doesn't consume
// or loud comments. // newlines.
while (!scanner.isDone) { while (!scanner.isDone) {
var next = scanner.peekChar(); var next = scanner.peekChar();
if (next != $tab && next != $space) break; if (next != $tab && next != $space) break;
scanner.readChar(); scanner.readChar();
} }
}
if (scanner.peekChar() == $slash && scanner.peekChar(1) == $slash) { void loudComment() {
silentComment(); // This overrides loud comment consumption so that it doesn't consume
// multi-line comments.
scanner.expect("/*");
while (true) {
var next = scanner.readChar();
if (isNewline(next)) scanner.error("expected */.");
if (next != $asterisk) continue;
do {
next = scanner.readChar();
} while (next == $asterisk);
if (next == $slash) break;
} }
} }

View File

@ -1,5 +1,5 @@
name: sass name: sass
version: 1.23.5-dev version: 1.23.5
description: A Sass implementation in Dart. description: A Sass implementation in Dart.
author: Sass Team author: Sass Team
homepage: https://github.com/sass/dart-sass homepage: https://github.com/sass/dart-sass