import { Expression } from "../../expression"; import { ExpressionTokenStream } from "../tokens"; /** The value returned from an argument parser function. */ export type Argument = [string, Expression]; export type ArgumentParser = (stream: ExpressionTokenStream, separator: string) => Argument; /** * An object mapping argument names to Liquid expressions. */ export type Arguments = { [index: string]: Expression; }; export type ArgumentList = Argument[]; export type ArgumentListParser = (stream: ExpressionTokenStream) => ArgumentList; /** * Return a function to parse keyword or named arguments from a stream of * expression tokens until the end of the stream. * * @param argumentParser - A function that will parse a single argument. * @param separatorTokenKind - The token kind that separates an argument's * key from its value. * @returns An object with string keys and `Expression` values. */ export declare function makeParseArguments(argumentParser: ArgumentParser, separatorTokenKind?: string): ArgumentListParser; /** * Parse keyword or named arguments from a stream of expression tokens * until the end of the stream. * * Each key/value pair is assumed to be separated by a comma. Leading and * trailing commas are OK. * * If the same key/name appears multiple times, the last occurrence in the * argument "list" will take priority. * * Values can be string, integer, float, true, false or nil literals, an * identifier or a range expression. An identifier value could be chained * using a mixture of dot and bracket notation. * * @param stream - A stream of expression tokens. * @param separatorTokenKind - The token kind that separates an arguments * key from its value. * @returns An object with string keys and `Expression` values. */ export declare function parseArguments(stream: ExpressionTokenStream, separatorTokenKind?: string): Arguments; export declare const parseColonSeparatedArguments: ArgumentListParser; export declare const parseEqualsSeparatedArguments: ArgumentListParser; /** * Parse keyword or named arguments from a Liquid expression string. * * Each key/value pair is assumed to be separated by a comma. Leading and * trailing commas are OK. * * If the same key/name appears multiple times, the last occurrence in the * argument "list" will take priority. * * Values can be string, integer, float, true, false or nil literals, an * identifier or a range expression. An identifier value could be chained * using a mixture of dot and bracket notation. * * @param expr - A Liquid expression containing zero or more keyword * arguments. * @param separatorTokenKind - The token kind that separates an arguments * key from its value. * @returns An object with string keys and `Expression` values. */ export declare function parse(expr: string, separatorTokenKind?: string, startIndex?: number): Arguments; /** * Parse a macro tag argument list. * @param expr - A macro tag expression. * @param startIndex - Location in the template source text where this * expression starts. * @returns An array of macro name and its argument list. */ export declare function parseMacroArguments(expr: string, startIndex?: number): [string, ArgumentList]; /** * Parse a call tag argument list. * @param expr - A call tag expression. * @param startIndex - Location in the template source text where this * expression starts. * @returns An array of macro name and the arguments it's being called with. */ export declare function parseCallArguments(expr: string, startIndex?: number): [string, ArgumentList];