UNPKG

@mfissehaye/string-to-drizzle-orm-filters

Version:
70 lines 1.79 kB
export declare enum TokenType { Identifier = "IDENTIFIER",// e.g., "and", "or", "eq", "like" StringLiteral = "STRING_LITERAL",// e.g., '"foo"', '"bar"' NumberLiteral = "NUMBER_LITERAL",// e.g., '123', '3.14' LParen = "LPAREN",// '(' RParen = "RPAREN",// ')' Comma = "COMMA",// ',' Whitespace = "WHITESPACE",// Space, tab, newline (ignored by parser) EOF = "EOF",// End of file Unknown = "UNKNOWN" } /** * Represents a single token produced by the lexer. */ export interface Token { type: TokenType; value: string; position: number; } /** * The Lexer class is responsible for taking an input string and * breaking it down into a sequence of tokens. */ export declare class Lexer { private input; private currentPosition; constructor(input: string); /** * Resets the lexer's position to the beginning of the input */ reset(): void; nextToken(): Token; /** * Reads a string literal (e.g., "value") including the quotes. */ private readStringLiteral; /** * Reads an identifier (e.g., "and", "eq"). */ private readIdentifier; /** * Reads a number literal (e.g., 123, 3.14). */ private readNumberLiteral; /** * Skips over whitespace characters */ private skipWhitespace; /** * Checks if a character is a letter. */ private isLetter; /** * Checks if a character is a digit. */ private isDigit; /** * Checks if a character is whitespace. */ private isWhitespace; /** * Creates a token and advances the current position. */ private advanceAndCreateToken; /** * Helper to create a token object. */ private createToken; } //# sourceMappingURL=lexer.d.ts.map