SpanScanner class

A subclass of LineScanner that exposes matched ranges as source map Spans.

Inheritance
Implemented types

Constructors

SpanScanner(String string, { dynamic sourceUrl, int position })
Creates a new SpanScanner that starts scanning from position. [...]
SpanScanner.eager(String string, { dynamic sourceUrl, int position })
Creates a new SpanScanner that eagerly computes line and column numbers. [...]
factory
SpanScanner.within(FileSpan span)
Creates a new SpanScanner that scans within span. [...]
factory

Properties

column int
The scanner's current (zero-based) column number.
read-only, override
emptySpan FileSpan
Returns an empty span at the current location.
read-only
lastSpan FileSpan
The FileSpan for lastMatch. [...]
read-only
line int
The scanner's current (zero-based) line number.
read-only, override
location FileLocation
The current location of the scanner.
read-only
state LineScannerState
The scanner's state, including line and column information. [...]
read / write, override
hashCode int
The hash code for this object. [...]
read-only, inherited
isDone bool
Whether the scanner has completely consumed string.
read-only, inherited
lastMatch Match
The data about the previous match made by the scanner. [...]
read-only, inherited
position int
The current position of the scanner in the string, in characters.
read / write, inherited
rest String
The portion of the string that hasn't yet been scanned.
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
sourceUrl Uri
The URL of the source of the string being scanned. [...]
final, inherited
string String
The string being scanned through.
final, inherited

Methods

error(String message, { Match match, int position, int length }) → void
Throws a FormatException with message as well as a detailed description of the location of the error in the string. [...]
override
matches(Pattern pattern) bool
Returns whether or not pattern matches at the current position of the string. [...]
override
spanFrom(LineScannerState startState, [ LineScannerState endState ]) FileSpan
Creates a FileSpan representing the source range between startState and the current position.
expect(Pattern pattern, { String name }) → void
If pattern matches at the current position of the string, scans forward until the end of the match. [...]
inherited
expectChar(int character, { String name }) → void
If the next character in the string is character, consumes it. [...]
inherited
expectDone() → void
If the string has not been fully consumed, this throws a FormatException.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
peekChar([int offset ]) int
Returns the character code of the character offset away from position. [...]
inherited
readChar() int
Consumes a single character and returns its character code. [...]
inherited
scan(Pattern pattern) bool
If pattern matches at the current position of the string, scans forward until the end of the match. [...]
inherited
scanChar(int character) bool
If the next character in the string is character, consumes it. [...]
inherited
substring(int start, [ int end ]) String
Returns the substring of string between start and end. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited