import { A as ASTNode, T as Token, O as Operations, u as TokenType, R as ReferenceRecord, e as Config, K as ReferenceNode, M as BinOpNode, P as FunctionCallNode, Q as ImplicitListNode, V as ListNode, W as NoOpNode, X as NumNode, Y as StringNode, Z as UnaryOpNode } from './types-BMYcHiSq.cjs'; export { B as BaseSymbolType, a as BooleanSymbol, C as ColorManager, b as ColorSpecification, c as ColorSpecificationSchema, d as ColorSymbol, f as ConfigOptions, g as ConstantsSpecification, h as ConstantsSpecificationSchema, D as DEFAULT_LANGUAGE_OPTIONS, i as DictionarySymbol, F as FunctionSpecification, j as FunctionSpecificationSchema, k as FunctionsManager, I as ISymbolType, J as JsValue, L as LanguageOptions, l as ListSymbol, N as NullSymbol, m as NumberSymbol, n as NumberWithUnitSymbol, o as ReferenceRecordValue, p as ReservedKeyword, S as SCRIPT_ONLY_STATEMENT_KEYWORDS, q as StringSymbol, r as SupportedFormats, s as SymbolMetadata, t as TokenSymbol, U as UNINTERPRETED_KEYWORDS, v as UnitManager, w as UnitSpecification, x as UnitSpecificationSchema, y as collectReferenceNodes, z as filterAST, E as getResultTypeName, G as jsValueToSymbolType, H as walkAST } from './types-BMYcHiSq.cjs'; import { A as AllErrorCodes, L as LanguageError, q as ParseMode, T as TolerantParseResult } from './interpreter-B7BcLEBz.cjs'; export { C as ColorErrorCode, c as ColorErrorData, d as ConfigErrorCode, e as ConfigErrorData, E as ErrorOptions, F as FunctionsErrorCode, f as FunctionsErrorData, g as IncompleteInfo, h as IncompleteType, i as Interpreter, I as InterpreterError, j as InterpreterErrorCode, k as InterpreterErrorData, l as InterpreterResult, m as Lexer, a as LexerError, n as LexerErrorCode, o as LexerErrorData, O as OperationsErrorCode, p as OperationsErrorData, r as ParseState, s as Parser, b as ParserError, t as ParserErrorCode, u as ParserErrorData, P as ProcessorError, v as ProcessorErrorCode, w as ProcessorErrorData, S as SerializedError, x as SymbolsErrorCode, y as SymbolsErrorData, U as UnitErrorCode, z as UnitErrorData, B as isInterpreterError, D as isLanguageError, G as isLexerError, H as isParserError, J as isProcessorError, K as lexerOptionsForMode, M as parseExpression, N as serializeError } from './interpreter-B7BcLEBz.cjs'; import '@tokens-studio/schema-validation'; /** * Partial reference node - represents an incomplete reference like {color without closing } */ declare class PartialReferenceNode implements ASTNode { /** The partial reference name typed so far (e.g., "color" or "foo.bar") */ partialValue: string; token: Token; nodeType: string; constructor( /** The partial reference name typed so far (e.g., "color" or "foo.bar") */ partialValue: string, token: Token); } /** * Partial string node - represents an incomplete string like "hello without closing quote */ declare class PartialStringNode implements ASTNode { /** The partial string value typed so far */ partialValue: string; /** The quote type used (' or ") */ quoteType: string; token: Token; nodeType: string; constructor( /** The partial string value typed so far */ partialValue: string, /** The quote type used (' or ") */ quoteType: string, token: Token); } /** * Partial function call node - represents an incomplete function call like func(1, 2 without closing ) */ declare class PartialFunctionCallNode implements ASTNode { /** The function name */ name: string; /** Arguments parsed so far */ args: ASTNode[]; token: Token; nodeType: string; constructor( /** The function name */ name: string, /** Arguments parsed so far */ args: ASTNode[], token: Token); } /** * Partial binary operation node - represents an incomplete binary operation like 1 + without right operand */ declare class PartialBinOpNode implements ASTNode { /** The left operand */ left: ASTNode; /** The operator token */ opToken: Token; nodeType: string; token: Token; constructor( /** The left operand */ left: ASTNode, /** The operator token */ opToken: Token); get op(): Operations | TokenType; } /** * Partial unary operation node - represents an incomplete unary operation like - without operand */ declare class PartialUnaryOpNode implements ASTNode { /** The operator token */ opToken: Token; nodeType: string; token: Token; constructor( /** The operator token */ opToken: Token); get op(): Operations; } /** * Partial parenthesized expression - represents an incomplete parenthesized expression like (1 + 2 without closing ) */ declare class PartialParenNode implements ASTNode { /** The expression inside the parentheses (may itself be partial) */ expr: ASTNode; token: Token; nodeType: string; constructor( /** The expression inside the parentheses (may itself be partial) */ expr: ASTNode, token: Token); } declare const getMessage: (code: AllErrorCodes | string, data?: Record) => string; /** * Rename references in a token value string using an AST and rename map * * @param originalValue - The original token value string * @param ast - The parsed AST of the token value * @param renameMap - Map of old names to new names { "old.name": "new.name" } * @returns The updated token value string with renamed references * * @example * const renameMap = { "color.primary": "color.main" }; * const updated = renameReferences("{color.primary}", ast, renameMap); * // Returns: "{color.main}" * * @example * const renameMap = { "a": "x", "b": "y" }; * const updated = renameReferences("{a} + {b}", ast, renameMap); * // Returns: "{x} + {y}" */ declare function renameReferences(originalValue: string, ast: ASTNode, renameMap: Record): string; interface EvalOptions { references?: ReferenceRecord; config?: Config; /** Parsing mode. Defaults to `"script"`. */ mode?: ParseMode; } interface EvalSuccess { success: true; result: unknown; resultString: string; type: string; executionTime: number; } interface EvalError { success: false; error: LanguageError; executionTime: number; } type EvalResult = EvalSuccess | EvalError; declare function evaluateExpression(expression: string, options?: EvalOptions): EvalResult; /** * Tolerant Parser for Tokenscript * * This module provides a tolerant parsing mode that can handle incomplete tokenscript * values while the user is typing. Instead of throwing errors on incomplete input, * the parser returns partial AST nodes with metadata about what's incomplete. * * Use cases: * - Syntax highlighting for incomplete references (e.g., `{color` highlighted as partial) * - Autocomplete suggestions (e.g., `{foo.ba|` - suggest completions) * - Live color display for incomplete color functions (e.g., `rgb(255, 128`) */ /** * Parse tokenscript input tolerantly, returning partial AST nodes for incomplete input. * * @param text - The tokenscript text to parse * @returns Parse result containing AST, state, and incomplete info * * @example * ```typescript * // Parse incomplete reference * const result = parseTolerantly("{color"); * if (result.state === ParseState.INCOMPLETE) { * console.log("Incomplete reference:", result.ast); * } * * // Parse incomplete function call * const result2 = parseTolerantly("rgb(255, 128"); * // result2.ast will be a PartialFunctionCallNode * ``` */ declare function parseTolerantly(text: string): TolerantParseResult; /** * Tokenize input tolerantly and return all tokens including partial ones. * * @param text - The tokenscript text to tokenize * @returns Array of tokens * * @example * ```typescript * const tokens = tokenizeTolerantly("{color"); * // tokens[0] will be a PARTIAL_REFERENCE token * ``` */ declare function tokenizeTolerantly(text: string): Token[]; /** * Reference information extracted from an AST */ interface ReferenceInfo { /** The reference name (e.g., "color.primary") */ name: string; /** Whether this is a partial/incomplete reference */ isPartial: boolean; /** The AST node */ node: ReferenceNode | PartialReferenceNode; } /** * Collect all references from a tolerant parse result, including partial references. * * @param ast - The AST node to search * @returns Array of reference information * * @example * ```typescript * const result = parseTolerantly("{color} + {foo"); * const refs = collectAllReferences(result.ast); * // refs = [ * // { name: "color", isPartial: false, node: ReferenceNode }, * // { name: "foo", isPartial: true, node: PartialReferenceNode } * // ] * ``` */ declare function collectAllReferences(ast: ASTNode | null): ReferenceInfo[]; /** * Check if an AST contains any partial/incomplete nodes */ declare function hasPartialNodes(ast: ASTNode | null): boolean; declare const ASTNodes: { BinOpNode: typeof BinOpNode; FunctionCallNode: typeof FunctionCallNode; ImplicitListNode: typeof ImplicitListNode; ListNode: typeof ListNode; NoOpNode: typeof NoOpNode; NumNode: typeof NumNode; ReferenceNode: typeof ReferenceNode; StringNode: typeof StringNode; UnaryOpNode: typeof UnaryOpNode; }; export { ASTNode, ASTNodes, AllErrorCodes, Config, type EvalError, type EvalOptions, type EvalResult, type EvalSuccess, LanguageError, Operations, ParseMode, PartialBinOpNode, PartialFunctionCallNode, PartialParenNode, PartialReferenceNode, PartialStringNode, PartialUnaryOpNode, type ReferenceInfo, ReferenceRecord, Token, TokenType, TolerantParseResult, collectAllReferences, evaluateExpression, getMessage, hasPartialNodes, parseTolerantly, renameReferences, tokenizeTolerantly };