2017-01-22 23:15:53 +00:00
|
|
|
import 'package:source_span/source_span.dart';
|
|
|
|
|
|
|
|
class SyntaxError implements Exception {
|
|
|
|
final String message;
|
2018-08-02 15:17:14 +00:00
|
|
|
final FileSpan span;
|
2017-01-22 23:15:53 +00:00
|
|
|
|
2018-08-02 15:17:14 +00:00
|
|
|
SyntaxError(this.message, this.span);
|
2017-01-22 23:15:53 +00:00
|
|
|
|
|
|
|
@override
|
2018-08-02 15:17:14 +00:00
|
|
|
String toString() => 'Syntax error at ${span.start.toolString}: $message\n${span.highlight()}';
|
2017-01-22 23:15:53 +00:00
|
|
|
}
|