Constructor
new TextParser(data)
Parameters:
Name | Type | Description |
---|---|---|
data |
string |
- Source:
Members
Methods
atEnd() → {boolean}
- Source:
Returns:
Whether it is at the end of the string.
- Type
- boolean
indexOf_(regexnon-null) → {?{position: number, length: number, results: !Array.<string>}}
Returns the index info about a regular expression match.
Parameters:
Name | Type | Description |
---|---|---|
regex |
RegExp |
- Source:
Returns:
- Type
- ?{position: number, length: number, results: !Array.<string>}
readLine() → {string}
Reads a line from the parser. This will read but not return the newline.
Returns null at the end.
- Source:
Returns:
- Type
- string
readRegex(regexnon-null) → {Array.<string>}
Reads the given regular expression from the parser. This requires the
match to be at the current position; there is no need to include a head
anchor.
This requires that the regex have the global flag to be set so that it can
set lastIndex to start the search at the current position. Returns null at
the end or if the regex does not match the current position.
Parameters:
Name | Type | Description |
---|---|---|
regex |
RegExp |
- Source:
Returns:
- Type
- Array.<string>
readRegexReturnCapture_(regexnon-null, index) → {string}
Reads a regex from the parser and returns the given capture.
Parameters:
Name | Type | Description |
---|---|---|
regex |
RegExp | |
index |
number |
- Source:
Returns:
- Type
- string
readWord() → {string}
Reads a word from the parser. This will not read or return any whitespace
before or after the word (including newlines). Returns null at the end.
- Source:
Returns:
- Type
- string
skipWhitespace()
Skips any continuous whitespace from the parser. Returns null at the end.
- Source: