in src/language/expressions/TLE.ts [1364:1451]
public readToken(): Token | undefined {
if (this.hasStarted() === false) {
this.nextBasicToken();
} else if (this.current) {
this._currentTokenStartIndex += this.current.length;
}
this._current = undefined;
const currentBasicToken = this.currentBasicToken;
if (currentBasicToken) {
switch (currentBasicToken.getType()) {
case basic.TokenType.LeftParenthesis:
this._current = Token.createLeftParenthesis(this._currentTokenStartIndex);
this.nextBasicToken();
break;
case basic.TokenType.RightParenthesis:
this._current = Token.createRightParenthesis(this._currentTokenStartIndex);
this.nextBasicToken();
break;
case basic.TokenType.LeftSquareBracket:
this._current = Token.createLeftSquareBracket(this._currentTokenStartIndex);
this.nextBasicToken();
break;
case basic.TokenType.RightSquareBracket:
this._current = Token.createRightSquareBracket(this._currentTokenStartIndex);
this.nextBasicToken();
break;
case basic.TokenType.Comma:
this._current = Token.createComma(this._currentTokenStartIndex);
this.nextBasicToken();
break;
case basic.TokenType.Period:
this._current = Token.createPeriod(this._currentTokenStartIndex);
this.nextBasicToken();
break;
case basic.TokenType.Space:
case basic.TokenType.Tab:
case basic.TokenType.CarriageReturn:
case basic.TokenType.NewLine:
case basic.TokenType.CarriageReturnNewLine:
this._current = Token.createWhitespace(
this._currentTokenStartIndex, Utilities.getCombinedText(Json.readWhitespace(this._basicTokenizer)));
break;
case basic.TokenType.DoubleQuote:
this._current = Token.createQuotedString(
this._currentTokenStartIndex,
Utilities.getCombinedText(Json.readQuotedString(this._basicTokenizer)));
break;
case basic.TokenType.SingleQuote:
this._current = Token.createQuotedString(
this._currentTokenStartIndex,
Utilities.getCombinedText(readQuotedTLEString(this._basicTokenizer)));
break;
case basic.TokenType.Dash:
case basic.TokenType.Digits:
this._current = Token.createNumber(
this._currentTokenStartIndex,
Utilities.getCombinedText(Json.readNumber(this._basicTokenizer)));
break;
default:
const literalTokens: basic.Token[] = [currentBasicToken];
this.nextBasicToken();
while (this.currentBasicToken &&
(this.currentBasicToken.getType() === basic.TokenType.Letters ||
this.currentBasicToken.getType() === basic.TokenType.Digits ||
this.currentBasicToken.getType() === basic.TokenType.Underscore)) {
literalTokens.push(this.currentBasicToken);
this.nextBasicToken();
}
this._current = Token.createLiteral(this._currentTokenStartIndex, Utilities.getCombinedText(literalTokens));
break;
}
}
return this._current;
}