UNPKG

rawsql-ts

Version:

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

28 lines (27 loc) 963 B
import { Lexeme } from "../models/Lexeme"; import { IdentifierString } from "../models/ValueComponent"; /** * Utility class for parsing fully qualified names (e.g. db.schema.table or db.schema.table.column_name) * This can be used for both table and column references. */ export declare class FullNameParser { /** * Parses a fully qualified name from lexemes, returning namespaces, table, and new index. */ static parseFromLexeme(lexemes: Lexeme[], index: number): { namespaces: string[] | null; name: IdentifierString; newIndex: number; lastTokenType: number; }; /** * Parses a fully qualified name from a string (e.g. 'db.schema.table') * Returns { namespaces, name } */ static parse(str: string): { namespaces: string[] | null; name: IdentifierString; }; private static parseEscapedOrDotSeparatedIdentifiers; private static extractNamespacesAndName; }