Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(589)

Unified Diff: pkg/string_scanner/lib/src/span_scanner.dart

Issue 683323002: Add SpanScanner.location. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/string_scanner/CHANGELOG.md ('k') | pkg/string_scanner/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/string_scanner/lib/src/span_scanner.dart
diff --git a/pkg/string_scanner/lib/src/span_scanner.dart b/pkg/string_scanner/lib/src/span_scanner.dart
index d8dc230a82145ebc6fdc22d614c9a0dce7972c54..a70d5fd74a0238bd25b77a3e88c5fe86f971de4c 100644
--- a/pkg/string_scanner/lib/src/span_scanner.dart
+++ b/pkg/string_scanner/lib/src/span_scanner.dart
@@ -34,28 +34,31 @@ class SpanScanner extends StringScanner implements LineScanner {
this.position = state.position;
}
- /// The [SourceSpan] for [lastMatch].
+ /// The [FileSpan] for [lastMatch].
///
/// This is the span for the entire match. There's no way to get spans for
/// subgroups since [Match] exposes no information about their positions.
- SourceSpan get lastSpan => _lastSpan;
- SourceSpan _lastSpan;
+ FileSpan get lastSpan => _lastSpan;
+ FileSpan _lastSpan;
+
+ /// The current location of the scanner.
+ FileLocation get location => _sourceFile.location(position);
/// Returns an empty span at the current location.
- SourceSpan get emptySpan => _sourceFile.location(position).pointSpan();
+ FileSpan get emptySpan => location.pointSpan();
/// Creates a new [SpanScanner] that starts scanning from [position].
///
/// [sourceUrl] is used as [SourceLocation.sourceUrl] for the returned
- /// [SourceSpan]s as well as for error reporting. It can be a [String], a
+ /// [FileSpan]s as well as for error reporting. It can be a [String], a
/// [Uri], or `null`.
SpanScanner(String string, {sourceUrl, int position})
: _sourceFile = new SourceFile(string, url: sourceUrl),
super(string, sourceUrl: sourceUrl, position: position);
- /// Creates a [SourceSpan] representing the source range between [startState]
+ /// Creates a [FileSpan] representing the source range between [startState]
/// and the current position.
- SourceSpan spanFrom(LineScannerState startState) =>
+ FileSpan spanFrom(LineScannerState startState) =>
_sourceFile.span(startState.position, position);
bool matches(Pattern pattern) {
« no previous file with comments | « pkg/string_scanner/CHANGELOG.md ('k') | pkg/string_scanner/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698