From b363e8e4be27e427929a4724138cec1b746dd47d Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Wed, 4 Jan 2023 16:05:23 -0800 Subject: [PATCH] Don't crash when parsing `+.` Closes #1856 --- CHANGELOG.md | 5 +++++ lib/src/parse/stylesheet.dart | 5 ++++- pubspec.yaml | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f530226d..29cfdb296 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.57.2 + +* Produce a better error message for a number with a leading `+` or `-`, a + decimal point, but no digits. + ## 1.57.1 * No user-visible changes. diff --git a/lib/src/parse/stylesheet.dart b/lib/src/parse/stylesheet.dart index ea7af982f..f842924b7 100644 --- a/lib/src/parse/stylesheet.dart +++ b/lib/src/parse/stylesheet.dart @@ -2534,7 +2534,10 @@ abstract class StylesheetParser extends Parser { // Don't complain about a dot after a number unless the number starts with a // dot. We don't allow a plain ".", but we need to allow "1." so that // "1..." will work as a rest argument. - _tryDecimal(allowTrailingDot: scanner.position != start.position); + _tryDecimal( + allowTrailingDot: scanner.position != start.position && + first != $plus && + first != $minus); _tryExponent(); // Use Dart's built-in double parsing so that we don't accumulate diff --git a/pubspec.yaml b/pubspec.yaml index fad072700..2f702631c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: sass -version: 1.57.1 +version: 1.57.2-dev description: A Sass implementation in Dart. homepage: https://github.com/sass/dart-sass