UNPKG

rawsql-ts

Version:

[beta]High-performance SQL parser and AST analyzer written in TypeScript. Provides fast parsing and advanced transformation capabilities.

35 lines 1.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SpecialSymbolTokenReader = void 0; const BaseTokenReader_1 = require("./BaseTokenReader"); const Lexeme_1 = require("../models/Lexeme"); /** * Reads SQL symbol tokens (., ,, (, )) */ class SpecialSymbolTokenReader extends BaseTokenReader_1.BaseTokenReader { /** * Try to read a symbol token */ tryRead(previous) { if (this.isEndOfInput()) { return null; } const char = this.input[this.position]; // symbol tokens if (char in SpecialSymbolTokenReader.SPECIAL_SYMBOL_TOKENS) { this.position++; return this.createLexeme(SpecialSymbolTokenReader.SPECIAL_SYMBOL_TOKENS[char], char); } return null; } } exports.SpecialSymbolTokenReader = SpecialSymbolTokenReader; SpecialSymbolTokenReader.SPECIAL_SYMBOL_TOKENS = { '.': Lexeme_1.TokenType.Dot, ',': Lexeme_1.TokenType.Comma, '(': Lexeme_1.TokenType.OpenParen, ')': Lexeme_1.TokenType.CloseParen, '[': Lexeme_1.TokenType.OpenBracket, ']': Lexeme_1.TokenType.CloseBracket, }; //# sourceMappingURL=SymbolTokenReader.js.map