import type { AbstractInvocationExpression } from "../ast/abstractInvocationExpression.js"; import type { Expression } from "../ast/expression.js"; import { ExecutableAssignmentExpression } from "./ast/executableAssignmentExpression.js"; import type { ExecutableExpression } from "./ast/executableExpression.js"; import { ExecutableIdentifierExpression } from "./ast/executableIdentifierExpression.js"; import type { NativeFunctionType } from "./ast/executableNativeFunctionExpression.js"; import { ExecutableNativeFunctionExpression } from "./ast/executableNativeFunctionExpression.js"; import type { InterpreterContext } from "./interpreter/interpreterContext.js"; import { BaseObject } from "./objects/baseObject.js"; import type { LabeledValue } from "./objects/labeledValue.js"; import type { FullObject } from "./objects/fullObject.js"; import { ExecutableFunctionExpression } from "./ast/executableFunctionExpression.js"; import { ExecutableNativeExpression } from "./ast/executableNativeExpression.js"; import type { ListEntry } from "../ast/listEntry.js"; import type { FunctionDocumentation } from "./ast/executableAbstractFunctionExpression.js"; import type { OperatorExpression } from "../ast/operatorExpression.js"; import { ExecutableObjectExpression } from "./ast/executableObjectExpression.js"; import type { ExecutableListEntry } from "./ast/executableListEntry.js"; import { ExecutableConstExpression } from "./ast/executableConstExpression.js"; /** * Helper function to create an IdentifierExpression without a position * * @param identifier the name of the identifier * @returns the created IdentifierExpression */ export declare function id(identifier: string): ExecutableIdentifierExpression; /** * Helper function to create string literals * * @param value the value of the literal * @returns the created literal expression */ export declare function str(value: string): ExecutableConstExpression; /** * Helper function to create number literals * * @param value the value of the literal * @returns the created literal expression */ export declare function num(value: number): ExecutableConstExpression; /** * Helper function to create boolean literals * * @param value the value of the literal * @returns the created literal expression */ export declare function bool(value: boolean): ExecutableConstExpression; /** * Helper function to create an ExecutableAssignmentExpression without a target * (uses scope as target) * * @param field the name of the field to assign * @param value the new value of the field * @returns the created ExecutableAssignmentExpression */ export declare function assign(field: string, value: ExecutableExpression): ExecutableAssignmentExpression; /** * Helper function to create an ExecutableObjectExpression * * @param fields the fields of the object * @returns the created ExecutableObjectExpression */ export declare function object(fields: ExecutableListEntry[]): ExecutableObjectExpression; /** * Helper function to create an unnamed argument * * @param value the Expression used as the argument * @returns the created InvocationArgument */ export declare function arg(value: Expression): ListEntry; /** * Helper function to create an named argument * * @param value the Expression used as the argument * @param name the name of the named argument * @returns the created InvocationArgument */ export declare function namedArg(name: string, value: Expression): ListEntry; /** * Type for expressions which can be parsed * Either a string or an array of strings and ExecutableExpressions */ export type ParseableExpressions = (ExecutableExpression | string)[] | string; /** * Helper to parse some expressions * * @param expressions the expressions to parse * @returns the parsed expressions */ export declare function parse(expressions: ParseableExpressions): ExecutableExpression[]; /** * Helper to create a ExecutableFunctionExpression * * @param expressions body of the function, if a string is provided it is parsed first * @param documentation documentation of this function, including parameter types and a snippet to execute where every `$i` is the `i`-th position to jump to when pressing `Tab` * @returns the created FunctionExpression */ export declare function fun(expressions: ParseableExpressions, documentation?: FunctionDocumentation): ExecutableFunctionExpression; /** * Helper to create a NativeFunctionExpression with already evaluated arguments * * @param callback executed to get the result of the function * @param documentation the documentation of the function * @returns the created FunctionExpression */ export declare function jsFun(callback: (args: FullObject, context: InterpreterContext, callExpression: AbstractInvocationExpression | OperatorExpression | undefined) => BaseObject | LabeledValue, documentation?: FunctionDocumentation): ExecutableNativeFunctionExpression; /** * Helper to create a NativeFunctionExpression with already evaluated arguments * * @param callback executed to get the result of the function * @param documentation the documentation of the function * @returns the created FunctionExpression */ export declare function native(callback: NativeFunctionType, documentation?: FunctionDocumentation): ExecutableNativeFunctionExpression; /** * Helper to create an expression which evaluates to an enum, meaning an object whith the defined entries * Each entry does NOT have its source set * * @param entries the entries of the enum * @returns the created expression which evaluates to the enum */ export declare function enumObject(entries: Record): ExecutableNativeExpression; /** * Maps an array of AST expressions to an array of executable expressions * * @param expressions the expressions to map * @param keepExpression if true, the executable expression has the original expression assigned * @returns the mapped expressions */ export declare function toExecutable(expressions: Expression[], keepExpression: boolean): ExecutableExpression[]; //# sourceMappingURL=executableAstHelper.d.ts.map