rawsql-ts
Version:
[beta]High-performance SQL parser and AST analyzer written in TypeScript. Provides fast parsing and advanced transformation capabilities.
65 lines (64 loc) • 1.8 kB
TypeScript
import { Lexeme } from '../models/Lexeme';
/**
* Class responsible for tokenizing SQL input.
*/
export declare class SqlTokenizer {
/**
* The input SQL string to be tokenized.
*/
private input;
/**
* Current position within the input string.
*/
private position;
/**
* Manager responsible for handling token readers.
*/
private readerManager;
/**
* Initializes a new instance of the SqlTokenizer.
*/
constructor(input: string);
/**
* Checks if the end of input is reached.
*
* @param shift - The shift to consider beyond the current position.
* @returns True if the end of input is reached; otherwise, false.
*/
private isEndOfInput;
/**
* Checks if more input can be read.
*
* @param shift - The shift to consider beyond the current position.
* @returns True if more input can be read; otherwise, false.
*/
private canRead;
/**
* Reads the lexemes from the input string.
*
* @returns An array of lexemes extracted from the input string.
* @throws Error if an unexpected character is encountered.
*/
readLexmes(): Lexeme[];
/**
* Adds pending comments to the last token.
*/
private addPendingCommentsToLastToken;
/**
* Adds comments to the token.
*/
private addCommentsToToken;
/**
* Skips whitespace characters and SQL comments in the input.
*
* @remarks This method updates the position pointer.
*/
private readComment;
/**
* Gets debug information for error reporting.
*
* @param errPosition - The position where the error occurred.
* @returns A string containing the debug position information.
*/
private getDebugPositionInfo;
}