rawsql-ts
Version:
[beta]High-performance SQL parser and AST analyzer written in TypeScript. Provides fast parsing and advanced transformation capabilities.
44 lines (43 loc) • 1.3 kB
TypeScript
import { Lexeme, TokenType } from '../models/Lexeme';
/**
* Base class for token readers
*/
export declare abstract class BaseTokenReader {
protected input: string;
protected position: number;
constructor(input: string, position?: number);
/**
* Get the current position in the input
*/
getPosition(): number;
/**
* Set the position in the input
*/
setPosition(position: number): void;
/**
* Check if we've reached the end of input
*/
protected isEndOfInput(shift?: number): boolean;
/**
* Check if we can read more characters
*/
protected canRead(shift?: number): boolean;
/**
* Read an expected character
*/
protected read(expectChar: string): string;
/**
* Create a lexeme with the specified type and value
*/
protected createLexeme(type: TokenType, value: string, comments?: string[] | null): Lexeme;
/**
* Get debug info for error reporting
*/
protected getDebugPositionInfo(errPosition: number): string;
/**
* Try to read a token from the current position
* @param previous The previous token, if available
* @returns The read token or null if no token could be read
*/
abstract tryRead(previous: Lexeme | null): Lexeme | null;
}