export declare const TokenType: { readonly LParen: "LParen"; readonly RParen: "RParen"; readonly LBracket: "LBracket"; readonly RBracket: "RBracket"; readonly LBrace: "LBrace"; readonly RBrace: "RBrace"; readonly Comma: "Comma"; readonly Semi: "Semi"; readonly Colon: "Colon"; readonly Dot: "Dot"; readonly QuestDot: "QuestDot"; readonly DollarDot: "DollarDot"; readonly Dollar: "Dollar"; readonly DoubleDollar: "DoubleDollar"; readonly TripleDollar: "TripleDollar"; readonly QuadDollar: "QuadDollar"; readonly Spread: "Spread"; readonly Plus: "Plus"; readonly Minus: "Minus"; readonly Star: "Star"; readonly StarStar: "StarStar"; readonly Slash: "Slash"; readonly Percent: "Percent"; readonly PlusPlus: "PlusPlus"; readonly MinusMinus: "MinusMinus"; readonly Eq: "Eq"; readonly PlusEq: "PlusEq"; readonly MinusEq: "MinusEq"; readonly StarEq: "StarEq"; readonly SlashEq: "SlashEq"; readonly EqEq: "EqEq"; readonly EqEqEq: "EqEqEq"; readonly BangEq: "BangEq"; readonly BangEqEq: "BangEqEq"; readonly Gt: "Gt"; readonly GtEq: "GtEq"; readonly Lt: "Lt"; readonly LtEq: "LtEq"; readonly AmpAmp: "AmpAmp"; readonly PipePipe: "PipePipe"; readonly Bang: "Bang"; readonly Amp: "Amp"; readonly Pipe: "Pipe"; readonly Caret: "Caret"; readonly Tilde: "Tilde"; readonly QuestQuest: "QuestQuest"; readonly Quest: "Quest"; readonly Arrow: "Arrow"; readonly Number: "Number"; readonly BigInt: "BigInt"; readonly String: "String"; readonly True: "True"; readonly False: "False"; readonly Null: "Null"; readonly Undefined: "Undefined"; readonly RegexLiteral: "RegexLiteral"; readonly TemplateStart: "TemplateStart"; readonly TemplateChars: "TemplateChars"; readonly TemplateExprStart: "TemplateExprStart"; readonly TemplateEnd: "TemplateEnd"; readonly In: "In"; readonly New: "New"; readonly Typeof: "Typeof"; readonly Delete: "Delete"; readonly Let: "Let"; readonly Ident: "Ident"; readonly EOF: "EOF"; }; export type TokenType = (typeof TokenType)[keyof typeof TokenType]; /** * Human-friendly display string for each token type, used in lexer/parser error * messages so users see `'('` instead of the internal `LParen` enum name. For * punctuation we quote the literal character(s); for value-bearing tokens * (identifiers, numbers, strings, …) we use a descriptive word so the message * still reads naturally when paired with `got 'foo'`. Keep in sync with the * `TokenType` declaration above. */ export declare const TOKEN_DISPLAY: Record; /** * Format a token for the "but got X" half of an error message. For value-bearing * tokens (identifiers, numbers, strings) the actual lexeme is more useful than * the category name, so we render it as e.g. `an identifier 'foo'` or * `a number '42'`. For punctuation the display already *is* the lexeme, so the * `('${value}')` suffix would be redundant. */ export declare function formatActualToken(t: Token): string; export type Token = { type: TokenType; value: string; pos: number; flags?: string; }; export declare class LexError extends Error { readonly pos: number; constructor(message: string, pos: number); } export declare class Lexer { private pos; private readonly tokens; private tokenIdx; private lastTokenType; private braceDepth; private templateBraceDepths; private readonly src; constructor(src: string); peek(): Token; next(): Token; lookahead(offset: number): Token; expect(type: TokenType): Token; private pushToken; private tokenize; private emit; private static readonly LINE_TERMINATORS; private skipTrivia; private skipLineComment; private skipBlockComment; private isDigit; private isIdentStart; private isIdentPart; private readNumber; /** * Consume a run of digits, allowing single underscores between them as numeric * separators (1_000_000). Rejects leading, trailing, or doubled underscores. */ private consumeDigitsWithSeparators; private readString; /** * Read a chunk of a template literal — characters between the previous boundary * (opening `, or `${...}`) and the next boundary (closing `, or `${`). * * Always emits a TemplateChars token (possibly empty) followed by either: * - TemplateExprStart for `${`, then returns to caller (main lex loop resumes * normal lexing inside the expression — the matching `}` re-enters this method) * - TemplateEnd for closing backtick, then returns */ private readTemplateChunk; private readRegex; private readIdent; private keywordToken; } //# sourceMappingURL=lexer.d.ts.map