import { A as ASTNode, T as Token, O as Operations, t as TokenType, R as ReferenceRecord, e as Config, H as ReferenceNode, K as BinOpNode, M as FunctionCallNode, P as ImplicitListNode, Q as ListNode, V as NoOpNode, W as NumNode, X as StringNode, Y as UnaryOpNode } from './types-CxQPMHn1.js';
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 StringSymbol, q as SupportedFormats, r as SymbolMetadata, s as TokenSymbol, U as UNINTERPRETED_KEYWORDS, u as UnitManager, v as UnitSpecification, w as UnitSpecificationSchema, x as collectReferenceNodes, y as filterAST, z as getResultTypeName, E as jsValueToSymbolType, G as walkAST } from './types-CxQPMHn1.js';
import { A as AllErrorCodes, L as LanguageError, T as TolerantParseResult } from './interpreter-DdF_Hj-J.js';
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, q as ParseState, r as Parser, b as ParserError, s as ParserErrorCode, t as ParserErrorData, P as ProcessorError, u as ProcessorErrorCode, v as ProcessorErrorData, S as SerializedError, w as SymbolsErrorCode, x as SymbolsErrorData, U as UnitErrorCode, y as UnitErrorData, z as isInterpreterError, B as isLanguageError, D as isLexerError, G as isParserError, H as isProcessorError, J as parseExpression, K as serializeError } from './interpreter-DdF_Hj-J.js';
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, unknown>) => 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, string>): string;

interface EvalOptions {
    references?: ReferenceRecord;
    config?: Config;
    allowStatements?: boolean;
}
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, PartialBinOpNode, PartialFunctionCallNode, PartialParenNode, PartialReferenceNode, PartialStringNode, PartialUnaryOpNode, type ReferenceInfo, ReferenceRecord, Token, TokenType, TolerantParseResult, collectAllReferences, evaluateExpression, getMessage, hasPartialNodes, parseTolerantly, renameReferences, tokenizeTolerantly };
