UNPKG

rawsql-ts

Version:

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

38 lines (37 loc) 1.37 kB
import { SelectClause, SelectItem } from "../models/Clause"; import { Lexeme } from "../models/Lexeme"; export declare class SelectClauseParser { static parse(query: string): SelectClause; static parseFromLexeme(lexemes: Lexeme[], index: number): { value: SelectClause; newIndex: number; }; } export declare class SelectItemParser { /** * Parses a single select item from a SQL string. * @param query The SQL string representing a select item (e.g. 'id as user_id'). * @returns The parsed SelectItem instance. */ static parse(query: string): SelectItem; /** * Parses a single select item from lexemes. * @param lexemes The array of lexemes. * @param index The starting index. * @returns An object containing the SelectItem and the new index. */ static parseItem(lexemes: Lexeme[], index: number): { value: SelectItem; newIndex: number; }; /** * Recursively clear positioned comments from all nested components to prevent duplication */ private static clearPositionedCommentsRecursively; private static extractValueTokenComments; private static parseAsKeyword; private static applyValueTokenComments; private static applyAsKeywordComments; private static applyAliasComments; private static clearValueTokenComments; }