mirror of
https://github.com/danog/dart-sass.git
synced 2025-01-23 06:12:00 +01:00
Fix a check for adjusting parse errors (#582)
This commit is contained in:
parent
e8ac314f56
commit
cd3b82e2be
@ -2,6 +2,10 @@
|
||||
|
||||
* Improve error output, particularly for errors that cover multiple lines.
|
||||
|
||||
* Improve source locations for some parse errors. Rather than pointing to the
|
||||
next token that wasn't what was expected, they point *after* the previous
|
||||
token. This should generally provide more context for the syntax error.
|
||||
|
||||
### Command-Line Interface
|
||||
|
||||
* The new error output uses non-ASCII Unicode characters by default. Add a
|
||||
|
@ -10,6 +10,7 @@ import 'package:string_scanner/string_scanner.dart';
|
||||
import '../exception.dart';
|
||||
import '../logger.dart';
|
||||
import '../util/character.dart';
|
||||
import '../utils.dart';
|
||||
|
||||
/// The abstract base class for all parsers.
|
||||
///
|
||||
@ -627,7 +628,7 @@ abstract class Parser {
|
||||
return callback();
|
||||
} on SourceSpanFormatException catch (error) {
|
||||
var span = error.span as FileSpan;
|
||||
if (error.message.startsWith("Expected") && span.length == 0) {
|
||||
if (startsWithIgnoreCase(error.message, "expected") && span.length == 0) {
|
||||
var startPosition = _firstNewlineBefore(span.start.offset);
|
||||
if (startPosition != span.start.offset) {
|
||||
span = span.file.span(startPosition, startPosition);
|
||||
|
Loading…
x
Reference in New Issue
Block a user