[I] Scanner
Properties
Property | Modifier | Type | Description |
---|---|---|---|
file | readonly | SourceFile | The source code being scanned. |
position | readonly | number | The offset in UTF-16 code units to the current position at the start of the next token. |
token | readonly | Token | The current token |
tokenFlags | readonly | TokenFlags | The flags on the current token. |
tokenPosition | readonly | number | The offset in UTF-16 code units to the start of the current token. |
Methods
eof()
Determine if the scanner has reached the end of the input.
Returns
boolean
findTripleQuotedStringIndent()
Finds the indent for the given triple quoted string.
Parameters
Parameter | Type | Description |
---|---|---|
start | number | |
end | number |
Returns
[number
, number
]
getTokenText()
The exact spelling of the current token.
Returns
string
getTokenValue()
The value of the current token.
String literals are escaped and unquoted, identifiers are normalized, and all other tokens return their exact spelling sames as getTokenText().
Returns
string
reScanStringTemplate()
Unconditionally back up and scan a template expression portion.
Parameters
Parameter | Type | Description |
---|---|---|
tokenFlags | TokenFlags | Token Flags for head StringTemplateToken |
Returns
scan()
Advance one token.
Returns
scanDoc()
Advance one token inside DocComment. Use inside scanRange callback over DocComment range.
Returns
scanRange()
Reset the scanner to the given start and end positions, invoke the callback, and then restore scanner state.
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
range | TextRange |
callback | () => T |
Returns
T
unindentAndUnescapeTripleQuotedString()
Unindent and unescape the triple quoted string rawText
Parameters
Parameter | Type |
---|---|
start | number |
end | number |
indentationStart | number |
indentationEnd | number |
token | StringLiteral | StringTemplateToken |
tokenFlags | TokenFlags |
Returns
string