UNPKG

rawsql-ts

Version:

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

46 lines (45 loc) 1.06 kB
export declare enum TokenType { None = 0, Literal = 1, Operator = 2, OpenParen = 4, CloseParen = 8, Comma = 16, Dot = 32, Identifier = 64, Command = 128,// select, from, where as, on, array etc Parameter = 256, OpenBracket = 512, CloseBracket = 1024, Function = 2048,// next token is open paren StringSpecifier = 4096,// next token is string literal Type = 8192 } /** * Position information for a lexeme in the source text */ export interface LexemePosition { startPosition: number; endPosition: number; startLine?: number; startColumn?: number; endLine?: number; endColumn?: number; } /** * Positioned comment information for lexemes */ export interface LexemePositionedComment { position: 'before' | 'after'; comments: string[]; } /** * Represents a lexical token in SQL parsing */ export interface Lexeme { type: number; value: string; comments: string[] | null; positionedComments?: LexemePositionedComment[]; position?: LexemePosition; }