/** * Represents different token types that can be identified by the tokenizer * @example * // Use to classify what kind of syntax element was found * const tokenType = TokenType.Constant; */ export declare enum TokenType { Constant = 0, FunctionCall = 1, Variable = 2, Pipe = 3 } /** * Represents a token with its type and value * @example * // Creating a token for a number constant * const token: Token = { type: TokenType.Constant, value: '42' }; */ export interface Token { type: TokenType; value: string; } /** * Tokenizes an input string into constants, function calls, and variables * @example * // Basic usage * const tokens = tokenize('myVar.property + func(42)'); * * @example * // Handling complex expressions * const tokens = tokenize('math.sin(angle) + "hello".length'); * * @example * // Handling pipes * const tokens = tokenize('input | transform | display'); */ export declare function tokenize(input: string): Token[]; /** Functions */ export type ArgToken = { type: 'number'; value: number; } | { type: 'string'; value: string; } | { type: 'identifier'; value: string; }; export declare function tokenizeArgs(input: string): ArgToken[]; /** For STRING/MUSTACHE */ export type MustacheTokenType = 'string' | 'mustache'; /** * Represents a token extracted from a template string * @typedef {Object} MustahceToken * @property {MustacheTokenType} type - Either 'string' for plain text or 'mustache' for mustache expressions * @property {string} value - The actual content of the token */ export interface MustacheToken { type: MustacheTokenType; value: string; } /** * Tokenizes a template string into an array of string and mustache tokens * @param {string} template - The template string containing text and mustache expressions * @returns {MustacheToken[]} An array of tokens representing the parsed template * * @example * // Returns tokens for a simple greeting template * tokenizeTemplate("Hello, {{name}}!"); * // [ * // { type: 'string', value: 'Hello, ' }, * // { type: 'mustache', value: '{{name}}' }, * // { type: 'string', value: '!' } * // ] */ export declare function tokenizeMustache(template: string): MustacheToken[];