UNPKG

rawsql-ts

Version:

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

42 lines (41 loc) 1.69 kB
import { Lexeme } from "../models/Lexeme"; import { ValueComponent, TypeValue } from "../models/ValueComponent"; export declare class FunctionExpressionParser { /** * Parse ARRAY expressions - handles both ARRAY[...] (literal) and ARRAY(...) (query) syntax * @param lexemes Array of lexemes to parse * @param index Current parsing index * @returns Parsed array expression and new index */ private static parseArrayExpression; static parseFromLexeme(lexemes: Lexeme[], index: number): { value: ValueComponent; newIndex: number; }; static tryParseBinaryExpression(lexemes: Lexeme[], index: number, left: ValueComponent, allowAndOperator?: boolean, allowOrOperator?: boolean): { value: ValueComponent; newIndex: number; } | null; static parseBetweenExpression(lexemes: Lexeme[], index: number, value: ValueComponent, negated: boolean): { value: ValueComponent; newIndex: number; }; /** * Parse the upper bound of a BETWEEN expression with logical operator precedence * This stops parsing when it encounters AND/OR operators at the same level */ private static parseBetweenUpperBound; private static parseFunctionCall; private static parseKeywordFunction; static parseTypeValue(lexemes: Lexeme[], index: number): { value: TypeValue; newIndex: number; }; /** * Parse WITHIN GROUP (ORDER BY ...) clause * @param lexemes Array of lexemes to parse * @param index Current parsing index (should point to "WITHIN GROUP") * @returns Parsed OrderByClause and new index */ private static parseWithinGroupClause; }