@pro-fa/expreszo
Advanced tools
| export * from './src/ast/index' | ||
| export {} |
| import { B, N, w } from "./chunks/index-dIFWrSIZ.mjs"; | ||
| export { | ||
| B as BaseVisitor, | ||
| N as NO_SPAN, | ||
| w as walk | ||
| }; |
| var __defProp = Object.defineProperty; | ||
| var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); | ||
| const NO_SPAN = { start: 0, end: 0 }; | ||
| function mkNumber(value, span = NO_SPAN) { | ||
| return { type: "NumberLit", value, span }; | ||
| } | ||
| __name(mkNumber, "mkNumber"); | ||
| function mkString(value, span = NO_SPAN) { | ||
| return { type: "StringLit", value, span }; | ||
| } | ||
| __name(mkString, "mkString"); | ||
| function mkBool(value, span = NO_SPAN) { | ||
| return { type: "BoolLit", value, span }; | ||
| } | ||
| __name(mkBool, "mkBool"); | ||
| function mkNull(span = NO_SPAN) { | ||
| return { type: "NullLit", span }; | ||
| } | ||
| __name(mkNull, "mkNull"); | ||
| function mkUndefined(span = NO_SPAN) { | ||
| return { type: "UndefinedLit", span }; | ||
| } | ||
| __name(mkUndefined, "mkUndefined"); | ||
| function mkRaw(value, span = NO_SPAN) { | ||
| return { type: "RawLit", value, span }; | ||
| } | ||
| __name(mkRaw, "mkRaw"); | ||
| function mkArray(elements, span = NO_SPAN) { | ||
| return { type: "ArrayLit", elements, span }; | ||
| } | ||
| __name(mkArray, "mkArray"); | ||
| function mkObject(properties, span = NO_SPAN) { | ||
| return { type: "ObjectLit", properties, span }; | ||
| } | ||
| __name(mkObject, "mkObject"); | ||
| function mkArraySpread(argument, span = NO_SPAN) { | ||
| return { type: "ArraySpread", argument, span }; | ||
| } | ||
| __name(mkArraySpread, "mkArraySpread"); | ||
| function mkObjectSpread(argument, span = NO_SPAN) { | ||
| return { type: "ObjectSpread", argument, span }; | ||
| } | ||
| __name(mkObjectSpread, "mkObjectSpread"); | ||
| function mkIdent(name, span = NO_SPAN) { | ||
| return { type: "Ident", name, span }; | ||
| } | ||
| __name(mkIdent, "mkIdent"); | ||
| function mkNameRef(name, span = NO_SPAN) { | ||
| return { type: "NameRef", name, span }; | ||
| } | ||
| __name(mkNameRef, "mkNameRef"); | ||
| function mkMember(object, property, span = NO_SPAN) { | ||
| return { type: "Member", object, property, span }; | ||
| } | ||
| __name(mkMember, "mkMember"); | ||
| function mkUnary(op, operand, span = NO_SPAN) { | ||
| return { type: "Unary", op, operand, span }; | ||
| } | ||
| __name(mkUnary, "mkUnary"); | ||
| function mkBinary(op, left, right, span = NO_SPAN) { | ||
| return { type: "Binary", op, left, right, span }; | ||
| } | ||
| __name(mkBinary, "mkBinary"); | ||
| function mkTernary(op, a, b, c, span = NO_SPAN) { | ||
| return { type: "Ternary", op, a, b, c, span }; | ||
| } | ||
| __name(mkTernary, "mkTernary"); | ||
| function mkCall(callee, args, span = NO_SPAN) { | ||
| return { type: "Call", callee, args, span }; | ||
| } | ||
| __name(mkCall, "mkCall"); | ||
| function mkLambda(params, body, span = NO_SPAN) { | ||
| return { type: "Lambda", params, body, span }; | ||
| } | ||
| __name(mkLambda, "mkLambda"); | ||
| function mkFunctionDef(name, params, body, span = NO_SPAN) { | ||
| return { type: "FunctionDef", name, params, body, span }; | ||
| } | ||
| __name(mkFunctionDef, "mkFunctionDef"); | ||
| function mkCase(subject, arms, elseBranch, span = NO_SPAN) { | ||
| return { type: "Case", subject, arms, else: elseBranch, span }; | ||
| } | ||
| __name(mkCase, "mkCase"); | ||
| function mkSequence(statements, span = NO_SPAN) { | ||
| return { type: "Sequence", statements, span }; | ||
| } | ||
| __name(mkSequence, "mkSequence"); | ||
| function mkParen(inner, span = NO_SPAN) { | ||
| return { type: "Paren", inner, span }; | ||
| } | ||
| __name(mkParen, "mkParen"); | ||
| const _BaseVisitor = class _BaseVisitor { | ||
| visit(node) { | ||
| switch (node.type) { | ||
| case "NumberLit": | ||
| return this.visitNumberLit(node); | ||
| case "StringLit": | ||
| return this.visitStringLit(node); | ||
| case "BoolLit": | ||
| return this.visitBoolLit(node); | ||
| case "NullLit": | ||
| return this.visitNullLit(node); | ||
| case "UndefinedLit": | ||
| return this.visitUndefinedLit(node); | ||
| case "RawLit": | ||
| return this.visitRawLit(node); | ||
| case "ArrayLit": | ||
| return this.visitArrayLit(node); | ||
| case "ObjectLit": | ||
| return this.visitObjectLit(node); | ||
| case "Ident": | ||
| return this.visitIdent(node); | ||
| case "NameRef": | ||
| return this.visitNameRef(node); | ||
| case "Member": | ||
| return this.visitMember(node); | ||
| case "Unary": | ||
| return this.visitUnary(node); | ||
| case "Binary": | ||
| return this.visitBinary(node); | ||
| case "Ternary": | ||
| return this.visitTernary(node); | ||
| case "Call": | ||
| return this.visitCall(node); | ||
| case "Lambda": | ||
| return this.visitLambda(node); | ||
| case "FunctionDef": | ||
| return this.visitFunctionDef(node); | ||
| case "Case": | ||
| return this.visitCase(node); | ||
| case "Sequence": | ||
| return this.visitSequence(node); | ||
| case "Paren": | ||
| return this.visitParen(node); | ||
| default: { | ||
| const exhaustive = node; | ||
| throw new Error("NodeVisitor: unhandled node kind " + String(exhaustive.type)); | ||
| } | ||
| } | ||
| } | ||
| }; | ||
| __name(_BaseVisitor, "BaseVisitor"); | ||
| let BaseVisitor = _BaseVisitor; | ||
| function walk(node, fn) { | ||
| switch (node.type) { | ||
| case "NumberLit": | ||
| case "StringLit": | ||
| case "BoolLit": | ||
| case "NullLit": | ||
| case "UndefinedLit": | ||
| case "RawLit": | ||
| case "Ident": | ||
| case "NameRef": | ||
| break; | ||
| case "ArrayLit": | ||
| for (const el of node.elements) { | ||
| if (el.type === "ArraySpread") walk(el.argument, fn); | ||
| else walk(el, fn); | ||
| } | ||
| break; | ||
| case "ObjectLit": | ||
| for (const entry of node.properties) { | ||
| if ("type" in entry && entry.type === "ObjectSpread") { | ||
| walk(entry.argument, fn); | ||
| } else { | ||
| walk(entry.value, fn); | ||
| } | ||
| } | ||
| break; | ||
| case "Member": | ||
| walk(node.object, fn); | ||
| break; | ||
| case "Unary": | ||
| walk(node.operand, fn); | ||
| break; | ||
| case "Binary": | ||
| walk(node.left, fn); | ||
| walk(node.right, fn); | ||
| break; | ||
| case "Ternary": | ||
| walk(node.a, fn); | ||
| walk(node.b, fn); | ||
| walk(node.c, fn); | ||
| break; | ||
| case "Call": | ||
| walk(node.callee, fn); | ||
| for (const a of node.args) walk(a, fn); | ||
| break; | ||
| case "Lambda": | ||
| walk(node.body, fn); | ||
| break; | ||
| case "FunctionDef": | ||
| walk(node.body, fn); | ||
| break; | ||
| case "Case": | ||
| if (node.subject) walk(node.subject, fn); | ||
| for (const arm of node.arms) { | ||
| walk(arm.when, fn); | ||
| walk(arm.then, fn); | ||
| } | ||
| if (node.else) walk(node.else, fn); | ||
| break; | ||
| case "Sequence": | ||
| for (const s of node.statements) walk(s, fn); | ||
| break; | ||
| case "Paren": | ||
| walk(node.inner, fn); | ||
| break; | ||
| default: { | ||
| const exhaustive = node; | ||
| throw new Error("walk: unhandled node kind " + String(exhaustive.type)); | ||
| } | ||
| } | ||
| fn(node); | ||
| } | ||
| __name(walk, "walk"); | ||
| export { | ||
| BaseVisitor as B, | ||
| NO_SPAN as N, | ||
| mkSequence as a, | ||
| mkCase as b, | ||
| mkFunctionDef as c, | ||
| mkLambda as d, | ||
| mkCall as e, | ||
| mkTernary as f, | ||
| mkBinary as g, | ||
| mkUnary as h, | ||
| mkMember as i, | ||
| mkObject as j, | ||
| mkArray as k, | ||
| mkNumber as l, | ||
| mkParen as m, | ||
| mkString as n, | ||
| mkBool as o, | ||
| mkNull as p, | ||
| mkUndefined as q, | ||
| mkRaw as r, | ||
| mkNameRef as s, | ||
| mkIdent as t, | ||
| mkArraySpread as u, | ||
| mkObjectSpread as v, | ||
| walk as w | ||
| }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| import { W as setVar, c as Precedence, ae as add, ac as sub, a6 as concat, ab as mul, aa as div, a8 as mod, O as coalesce, a7 as pow, U as arrayIndexOrProperty, M as neg, L as pos, K as fac, af as condition, a4 as equal, a3 as notEqual, a0 as lessThan, Y as lessThanEqual, a2 as greaterThan, _ as greaterThanEqual, S as inOperator, R as notInOperator, Q as orOperator, T as andOperator, n as not, J as abs, I as acos, H as acosh, G as asin, D as asinh, C as atan, z as atanh, y as cbrt, x as ceil, w as cos, v as cosh, u as exp, q as expm1, p as floor, l as log10, m as log, k as log1p, j as log2, r as round, i as sign, h as sin, g as sinh, f as sqrt, e as tan, d as tanh, t as trunc, B as BUILTIN_FUNCTIONS, o as length, N as asOperator } from "./trigonometric-DkdfZuOq.mjs"; | ||
| const CORE_OPERATORS = [ | ||
| { symbol: "=", kind: "infix", arity: 2, precedence: Precedence.Assignment, associativity: "right", optionName: "assignment", pure: false, impl: setVar }, | ||
| { symbol: "+", kind: "infix", arity: 2, precedence: Precedence.AddSub, associativity: "left", optionName: "add", pure: true, impl: add }, | ||
| { symbol: "-", kind: "infix", arity: 2, precedence: Precedence.AddSub, associativity: "left", optionName: "subtract", pure: true, impl: sub }, | ||
| { symbol: "|", kind: "infix", arity: 2, precedence: Precedence.AddSub, associativity: "left", optionName: "concatenate", pure: true, impl: concat }, | ||
| { symbol: "*", kind: "infix", arity: 2, precedence: Precedence.MulDiv, associativity: "left", optionName: "multiply", pure: true, impl: mul }, | ||
| { symbol: "/", kind: "infix", arity: 2, precedence: Precedence.MulDiv, associativity: "left", optionName: "divide", pure: true, impl: div }, | ||
| { symbol: "%", kind: "infix", arity: 2, precedence: Precedence.MulDiv, associativity: "left", optionName: "remainder", pure: true, impl: mod }, | ||
| { symbol: "??", kind: "infix", arity: 2, precedence: Precedence.Coalesce, associativity: "left", optionName: "coalesce", pure: true, impl: coalesce }, | ||
| { symbol: "^", kind: "infix", arity: 2, precedence: Precedence.Exponent, associativity: "right", optionName: "power", pure: true, impl: pow }, | ||
| { symbol: "[", kind: "infix", arity: 2, precedence: Precedence.Member, associativity: "left", optionName: "array", pure: true, impl: arrayIndexOrProperty }, | ||
| { symbol: "-", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "subtract", pure: true, impl: neg }, | ||
| { symbol: "+", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "add", pure: true, impl: pos }, | ||
| { symbol: "!", kind: "postfix", arity: 1, precedence: Precedence.Postfix, associativity: "left", optionName: "factorial", pure: true, impl: fac }, | ||
| { symbol: "?", kind: "ternary", arity: 3, precedence: Precedence.Ternary, associativity: "right", optionName: "conditional", pure: true, impl: condition } | ||
| ]; | ||
| const CORE_FUNCTIONS = []; | ||
| const COMPARISON_OPERATORS = [ | ||
| { symbol: "==", kind: "infix", arity: 2, precedence: Precedence.Comparison, associativity: "left", optionName: "comparison", pure: true, impl: equal }, | ||
| { symbol: "!=", kind: "infix", arity: 2, precedence: Precedence.Comparison, associativity: "left", optionName: "comparison", pure: true, impl: notEqual }, | ||
| { symbol: "<", kind: "infix", arity: 2, precedence: Precedence.Comparison, associativity: "left", optionName: "comparison", pure: true, impl: lessThan }, | ||
| { symbol: "<=", kind: "infix", arity: 2, precedence: Precedence.Comparison, associativity: "left", optionName: "comparison", pure: true, impl: lessThanEqual }, | ||
| { symbol: ">", kind: "infix", arity: 2, precedence: Precedence.Comparison, associativity: "left", optionName: "comparison", pure: true, impl: greaterThan }, | ||
| { symbol: ">=", kind: "infix", arity: 2, precedence: Precedence.Comparison, associativity: "left", optionName: "comparison", pure: true, impl: greaterThanEqual }, | ||
| { symbol: "in", kind: "infix", arity: 2, precedence: Precedence.Comparison, associativity: "left", optionName: "in", pure: true, impl: inOperator }, | ||
| { symbol: "not in", kind: "infix", arity: 2, precedence: Precedence.Comparison, associativity: "left", optionName: "in", pure: true, impl: notInOperator } | ||
| ]; | ||
| const LOGICAL_OPERATORS = [ | ||
| { symbol: "or", kind: "infix", arity: 2, precedence: Precedence.Or, associativity: "left", optionName: "logical", pure: true, impl: orOperator }, | ||
| { symbol: "||", kind: "infix", arity: 2, precedence: Precedence.Or, associativity: "left", optionName: "logical", pure: true, impl: orOperator }, | ||
| { symbol: "and", kind: "infix", arity: 2, precedence: Precedence.And, associativity: "left", optionName: "logical", pure: true, impl: andOperator }, | ||
| { symbol: "&&", kind: "infix", arity: 2, precedence: Precedence.And, associativity: "left", optionName: "logical", pure: true, impl: andOperator }, | ||
| { symbol: "not", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "logical", pure: true, impl: not } | ||
| ]; | ||
| const MATH_OPERATORS = [ | ||
| { symbol: "abs", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "abs", pure: true, impl: abs }, | ||
| { symbol: "acos", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "acos", pure: true, impl: acos }, | ||
| { symbol: "acosh", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "acosh", pure: true, impl: acosh }, | ||
| { symbol: "asin", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "asin", pure: true, impl: asin }, | ||
| { symbol: "asinh", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "asinh", pure: true, impl: asinh }, | ||
| { symbol: "atan", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "atan", pure: true, impl: atan }, | ||
| { symbol: "atanh", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "atanh", pure: true, impl: atanh }, | ||
| { symbol: "cbrt", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "cbrt", pure: true, impl: cbrt }, | ||
| { symbol: "ceil", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "ceil", pure: true, impl: ceil }, | ||
| { symbol: "cos", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "cos", pure: true, impl: cos }, | ||
| { symbol: "cosh", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "cosh", pure: true, impl: cosh }, | ||
| { symbol: "exp", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "exp", pure: true, impl: exp }, | ||
| { symbol: "expm1", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "expm1", pure: true, impl: expm1 }, | ||
| { symbol: "floor", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "floor", pure: true, impl: floor }, | ||
| { symbol: "lg", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "lg", pure: true, impl: log10 }, | ||
| { symbol: "ln", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "ln", pure: true, impl: log }, | ||
| { symbol: "log", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "log", pure: true, impl: log }, | ||
| { symbol: "log1p", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "log1p", pure: true, impl: log1p }, | ||
| { symbol: "log2", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "log2", pure: true, impl: log2 }, | ||
| { symbol: "log10", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "log10", pure: true, impl: log10 }, | ||
| { symbol: "round", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "round", pure: true, impl: round }, | ||
| { symbol: "sign", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "sign", pure: true, impl: sign }, | ||
| { symbol: "sin", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "sin", pure: true, impl: sin }, | ||
| { symbol: "sinh", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "sinh", pure: true, impl: sinh }, | ||
| { symbol: "sqrt", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "sqrt", pure: true, impl: sqrt }, | ||
| { symbol: "tan", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "tan", pure: true, impl: tan }, | ||
| { symbol: "tanh", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "tanh", pure: true, impl: tanh }, | ||
| { symbol: "trunc", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "trunc", pure: true, impl: trunc } | ||
| ]; | ||
| const MATH_FUNCTIONS = BUILTIN_FUNCTIONS.filter( | ||
| (d) => d.category === "math" | ||
| ); | ||
| const STRING_OPERATORS = [ | ||
| { symbol: "length", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "length", pure: true, impl: length } | ||
| ]; | ||
| const STRING_FUNCTIONS = BUILTIN_FUNCTIONS.filter( | ||
| (d) => d.category === "string" | ||
| ); | ||
| const ARRAY_FUNCTIONS = BUILTIN_FUNCTIONS.filter( | ||
| (d) => d.category === "array" | ||
| ); | ||
| const OBJECT_FUNCTIONS = BUILTIN_FUNCTIONS.filter( | ||
| (d) => d.category === "object" | ||
| ); | ||
| const TYPE_CHECK_FUNCTIONS = BUILTIN_FUNCTIONS.filter( | ||
| (d) => d.category === "type-check" | ||
| ); | ||
| const UTILITY_OPERATORS = [ | ||
| { symbol: "as", kind: "infix", arity: 2, precedence: Precedence.Coalesce, associativity: "left", optionName: "conversion", pure: true, impl: asOperator } | ||
| ]; | ||
| const UTILITY_FUNCTIONS = BUILTIN_FUNCTIONS.filter( | ||
| (d) => d.category === "utility" | ||
| ); | ||
| const coreParser = { | ||
| operators: CORE_OPERATORS, | ||
| functions: CORE_FUNCTIONS | ||
| }; | ||
| const withComparison = { | ||
| operators: COMPARISON_OPERATORS, | ||
| functions: [] | ||
| }; | ||
| const withLogical = { | ||
| operators: LOGICAL_OPERATORS, | ||
| functions: [] | ||
| }; | ||
| const withMath = { | ||
| operators: MATH_OPERATORS, | ||
| functions: MATH_FUNCTIONS | ||
| }; | ||
| const withString = { | ||
| operators: STRING_OPERATORS, | ||
| functions: STRING_FUNCTIONS | ||
| }; | ||
| const withArray = { | ||
| operators: [], | ||
| functions: ARRAY_FUNCTIONS | ||
| }; | ||
| const withObject = { | ||
| operators: [], | ||
| functions: OBJECT_FUNCTIONS | ||
| }; | ||
| const withTypeCheck = { | ||
| operators: [], | ||
| functions: TYPE_CHECK_FUNCTIONS | ||
| }; | ||
| const withUtility = { | ||
| operators: UTILITY_OPERATORS, | ||
| functions: UTILITY_FUNCTIONS | ||
| }; | ||
| const fullParser = { | ||
| operators: [ | ||
| ...CORE_OPERATORS, | ||
| ...COMPARISON_OPERATORS, | ||
| ...LOGICAL_OPERATORS, | ||
| ...MATH_OPERATORS, | ||
| ...STRING_OPERATORS, | ||
| ...UTILITY_OPERATORS | ||
| ], | ||
| functions: [ | ||
| ...CORE_FUNCTIONS, | ||
| ...MATH_FUNCTIONS, | ||
| ...STRING_FUNCTIONS, | ||
| ...ARRAY_FUNCTIONS, | ||
| ...OBJECT_FUNCTIONS, | ||
| ...TYPE_CHECK_FUNCTIONS, | ||
| ...UTILITY_FUNCTIONS | ||
| ] | ||
| }; | ||
| export { | ||
| ARRAY_FUNCTIONS as A, | ||
| COMPARISON_OPERATORS as C, | ||
| LOGICAL_OPERATORS as L, | ||
| MATH_FUNCTIONS as M, | ||
| OBJECT_FUNCTIONS as O, | ||
| STRING_FUNCTIONS as S, | ||
| TYPE_CHECK_FUNCTIONS as T, | ||
| UTILITY_FUNCTIONS as U, | ||
| withComparison as a, | ||
| withLogical as b, | ||
| coreParser as c, | ||
| withMath as d, | ||
| withObject as e, | ||
| fullParser as f, | ||
| withString as g, | ||
| withTypeCheck as h, | ||
| withUtility as i, | ||
| MATH_OPERATORS as j, | ||
| STRING_OPERATORS as k, | ||
| UTILITY_OPERATORS as l, | ||
| withArray as w | ||
| }; |
| export type { Node, Span, CaseArm, ObjectProperty, ObjectSpread, ObjectEntry, ArraySpread, ArrayEntry, NumberLit, StringLit, BoolLit, NullLit, UndefinedLit, RawLit, ArrayLit, ObjectLit, Ident, NameRef, Member, Unary, Binary, Ternary, Call, Lambda, FunctionDef, Case, Sequence, Paren } from './nodes.js'; | ||
| export { NO_SPAN } from './nodes.js'; | ||
| export type { NodeVisitor } from './visitor.js'; | ||
| export { BaseVisitor, walk } from './visitor.js'; | ||
| //# sourceMappingURL=index.d.ts.map |
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ast/index.ts"],"names":[],"mappings":"AAiBA,YAAY,EACV,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,cAAc,EACd,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,SAAS,EACT,SAAS,EACT,OAAO,EACP,OAAO,EACP,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,SAAS,EACT,KAAK,EACL,OAAO,EACP,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,EACP,IAAI,EACJ,MAAM,EACN,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,KAAK,EACN,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC"} |
+1
-1
@@ -1,2 +0,2 @@ | ||
| import { A, w } from "./chunks/utility-Cm-9CA2b.mjs"; | ||
| import { A, w } from "./chunks/utility-c26r4Wlh.mjs"; | ||
| export { | ||
@@ -3,0 +3,0 @@ A as ARRAY_FUNCTIONS, |
@@ -1,2 +0,2 @@ | ||
| import { C, a } from "./chunks/utility-Cm-9CA2b.mjs"; | ||
| import { C, a } from "./chunks/utility-c26r4Wlh.mjs"; | ||
| export { | ||
@@ -3,0 +3,0 @@ C as COMPARISON_OPERATORS, |
+5
-4
| var __defProp = Object.defineProperty; | ||
| var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); | ||
| import { P as Parser } from "./chunks/parser-CRUZ4SXd.mjs"; | ||
| import { B, E } from "./chunks/parser-CRUZ4SXd.mjs"; | ||
| import { c } from "./chunks/utility-Cm-9CA2b.mjs"; | ||
| import { A, a, E as E2, b, F, P, c as c2, V } from "./chunks/trigonometric-MG7O1EZ1.mjs"; | ||
| import { P as Parser } from "./chunks/parser-dbQMN4SV.mjs"; | ||
| import { E } from "./chunks/parser-dbQMN4SV.mjs"; | ||
| import { c } from "./chunks/utility-c26r4Wlh.mjs"; | ||
| import { A, a, E as E2, b, F, P, c as c2, V } from "./chunks/trigonometric-DkdfZuOq.mjs"; | ||
| import { B } from "./chunks/index-dIFWrSIZ.mjs"; | ||
| function defineParser(config) { | ||
@@ -8,0 +9,0 @@ var _a, _b; |
+3
-3
@@ -1,5 +0,5 @@ | ||
| import { E, P } from "./chunks/parser-CRUZ4SXd.mjs"; | ||
| import { A, a, E as E2, b, F, P as P2, c, V, s } from "./chunks/trigonometric-MG7O1EZ1.mjs"; | ||
| import { E, P } from "./chunks/parser-dbQMN4SV.mjs"; | ||
| import { A, a, E as E2, b, F, P as P2, c, V, s } from "./chunks/trigonometric-DkdfZuOq.mjs"; | ||
| import { defineParser } from "./core.mjs"; | ||
| import { c as c2, f, w, a as a2, b as b2, d, e, g, h, i } from "./chunks/utility-Cm-9CA2b.mjs"; | ||
| import { c as c2, f, w, a as a2, b as b2, d, e, g, h, i } from "./chunks/utility-c26r4Wlh.mjs"; | ||
| import { createLanguageService } from "./language-service.mjs"; | ||
@@ -6,0 +6,0 @@ export { |
+1
-1
@@ -1,2 +0,2 @@ | ||
| import { L, b } from "./chunks/utility-Cm-9CA2b.mjs"; | ||
| import { L, b } from "./chunks/utility-c26r4Wlh.mjs"; | ||
| export { | ||
@@ -3,0 +3,0 @@ L as LOGICAL_OPERATORS, |
+1
-1
@@ -1,2 +0,2 @@ | ||
| import { M, j, d } from "./chunks/utility-Cm-9CA2b.mjs"; | ||
| import { M, j, d } from "./chunks/utility-c26r4Wlh.mjs"; | ||
| export { | ||
@@ -3,0 +3,0 @@ M as MATH_FUNCTIONS, |
+1
-1
@@ -1,2 +0,2 @@ | ||
| import { O, e } from "./chunks/utility-Cm-9CA2b.mjs"; | ||
| import { O, e } from "./chunks/utility-c26r4Wlh.mjs"; | ||
| export { | ||
@@ -3,0 +3,0 @@ O as OBJECT_FUNCTIONS, |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"comparison.d.ts","sourceRoot":"","sources":["../../../../src/operators/binary/comparison.ts"],"names":[],"mappings":"AAKA,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAE7C;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAEhD;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,GAAG,SAAS,CAG/D;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,GAAG,SAAS,CAG5D;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,GAAG,SAAS,CAGpE;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,GAAG,SAAS,CAGjE;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAEzD;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAEtD;AAED,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAE9D;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAE3D"} | ||
| {"version":3,"file":"comparison.d.ts","sourceRoot":"","sources":["../../../../src/operators/binary/comparison.ts"],"names":[],"mappings":"AAKA,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAkB7C;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAEhD;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,GAAG,SAAS,CAG/D;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,GAAG,SAAS,CAG5D;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,GAAG,SAAS,CAGpE;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,GAAG,SAAS,CAGjE;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAEzD;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAEtD;AAED,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAE9D;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAE3D"} |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../../../src/operators/binary/utility.ts"],"names":[],"mappings":"AAQA,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,MAAM,GAAG,SAAS,CAWjE;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,MAAM,GAAG,SAAS,CAQvE;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAAG,GAAG,CAYhG;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,GAAG,CAsBzF;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,GAAG,CAE5C;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,CAkB7D"} | ||
| {"version":3,"file":"utility.d.ts","sourceRoot":"","sources":["../../../../src/operators/binary/utility.ts"],"names":[],"mappings":"AASA,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,MAAM,GAAG,SAAS,CAWjE;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,MAAM,GAAG,SAAS,CAQvE;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAAG,GAAG,CAYhG;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,GAAG,CAsBzF;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,GAAG,CAO5C;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,CAkB7D"} |
+1
-1
@@ -1,2 +0,2 @@ | ||
| import { S, k, g } from "./chunks/utility-Cm-9CA2b.mjs"; | ||
| import { S, k, g } from "./chunks/utility-c26r4Wlh.mjs"; | ||
| export { | ||
@@ -3,0 +3,0 @@ S as STRING_FUNCTIONS, |
@@ -1,2 +0,2 @@ | ||
| import { T, h } from "./chunks/utility-Cm-9CA2b.mjs"; | ||
| import { T, h } from "./chunks/utility-c26r4Wlh.mjs"; | ||
| export { | ||
@@ -3,0 +3,0 @@ T as TYPE_CHECK_FUNCTIONS, |
+1
-1
@@ -1,2 +0,2 @@ | ||
| import { U, l, i } from "./chunks/utility-Cm-9CA2b.mjs"; | ||
| import { U, l, i } from "./chunks/utility-c26r4Wlh.mjs"; | ||
| export { | ||
@@ -3,0 +3,0 @@ U as UTILITY_FUNCTIONS, |
| var __defProp = Object.defineProperty; | ||
| var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); | ||
| var _a; | ||
| import { W as setVar, c as Precedence, Q as orOperator, T as andOperator, a4 as equal, a3 as notEqual, a0 as lessThan, Y as lessThanEqual, a2 as greaterThan, _ as greaterThanEqual, S as inOperator, R as notInOperator, ae as add, ac as sub, a6 as concat, ab as mul, aa as div, a8 as mod, O as coalesce, N as asOperator, a7 as pow, U as arrayIndexOrProperty, M as neg, L as pos, n as not, K as fac, J as abs, I as acos, H as acosh, G as asin, D as asinh, C as atan, z as atanh, y as cbrt, x as ceil, w as cos, v as cosh, u as exp, q as expm1, p as floor, o as length, l as log10, m as log, k as log1p, j as log2, r as round, i as sign, h as sin, g as sinh, f as sqrt, e as tan, d as tanh, t as trunc, af as condition, bu as DANGEROUS_PROPERTIES, A as AccessError, F as FunctionError, B as BUILTIN_FUNCTIONS } from "./chunks/trigonometric-MG7O1EZ1.mjs"; | ||
| import { W as setVar, c as Precedence, Q as orOperator, T as andOperator, a4 as equal, a3 as notEqual, a0 as lessThan, Y as lessThanEqual, a2 as greaterThan, _ as greaterThanEqual, S as inOperator, R as notInOperator, ae as add, ac as sub, a6 as concat, ab as mul, aa as div, a8 as mod, O as coalesce, N as asOperator, a7 as pow, U as arrayIndexOrProperty, M as neg, L as pos, n as not, K as fac, J as abs, I as acos, H as acosh, G as asin, D as asinh, C as atan, z as atanh, y as cbrt, x as ceil, w as cos, v as cosh, u as exp, q as expm1, p as floor, o as length, l as log10, m as log, k as log1p, j as log2, r as round, i as sign, h as sin, g as sinh, f as sqrt, e as tan, d as tanh, t as trunc, af as condition, bu as DANGEROUS_PROPERTIES, A as AccessError, F as FunctionError, B as BUILTIN_FUNCTIONS } from "./chunks/trigonometric-DkdfZuOq.mjs"; | ||
| const BINARY_OPERATORS = [ | ||
@@ -6,0 +6,0 @@ { symbol: "=", kind: "infix", arity: 2, precedence: Precedence.Assignment, associativity: "right", optionName: "assignment", pure: false, impl: setVar }, |
+5
-1
| { | ||
| "name": "@pro-fa/expreszo", | ||
| "version": "0.6.0", | ||
| "version": "0.6.4", | ||
| "description": "Mathematical expression evaluator", | ||
@@ -37,2 +37,6 @@ "keywords": [ | ||
| }, | ||
| "./ast": { | ||
| "types": "./dist/ast.d.ts", | ||
| "import": "./dist/ast.mjs" | ||
| }, | ||
| "./core": { | ||
@@ -39,0 +43,0 @@ "types": "./dist/core.d.ts", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| import { W as setVar, c as Precedence, ae as add, ac as sub, a6 as concat, ab as mul, aa as div, a8 as mod, O as coalesce, a7 as pow, U as arrayIndexOrProperty, M as neg, L as pos, K as fac, af as condition, a4 as equal, a3 as notEqual, a0 as lessThan, Y as lessThanEqual, a2 as greaterThan, _ as greaterThanEqual, S as inOperator, R as notInOperator, Q as orOperator, T as andOperator, n as not, J as abs, I as acos, H as acosh, G as asin, D as asinh, C as atan, z as atanh, y as cbrt, x as ceil, w as cos, v as cosh, u as exp, q as expm1, p as floor, l as log10, m as log, k as log1p, j as log2, r as round, i as sign, h as sin, g as sinh, f as sqrt, e as tan, d as tanh, t as trunc, B as BUILTIN_FUNCTIONS, o as length, N as asOperator } from "./trigonometric-MG7O1EZ1.mjs"; | ||
| const CORE_OPERATORS = [ | ||
| { symbol: "=", kind: "infix", arity: 2, precedence: Precedence.Assignment, associativity: "right", optionName: "assignment", pure: false, impl: setVar }, | ||
| { symbol: "+", kind: "infix", arity: 2, precedence: Precedence.AddSub, associativity: "left", optionName: "add", pure: true, impl: add }, | ||
| { symbol: "-", kind: "infix", arity: 2, precedence: Precedence.AddSub, associativity: "left", optionName: "subtract", pure: true, impl: sub }, | ||
| { symbol: "|", kind: "infix", arity: 2, precedence: Precedence.AddSub, associativity: "left", optionName: "concatenate", pure: true, impl: concat }, | ||
| { symbol: "*", kind: "infix", arity: 2, precedence: Precedence.MulDiv, associativity: "left", optionName: "multiply", pure: true, impl: mul }, | ||
| { symbol: "/", kind: "infix", arity: 2, precedence: Precedence.MulDiv, associativity: "left", optionName: "divide", pure: true, impl: div }, | ||
| { symbol: "%", kind: "infix", arity: 2, precedence: Precedence.MulDiv, associativity: "left", optionName: "remainder", pure: true, impl: mod }, | ||
| { symbol: "??", kind: "infix", arity: 2, precedence: Precedence.Coalesce, associativity: "left", optionName: "coalesce", pure: true, impl: coalesce }, | ||
| { symbol: "^", kind: "infix", arity: 2, precedence: Precedence.Exponent, associativity: "right", optionName: "power", pure: true, impl: pow }, | ||
| { symbol: "[", kind: "infix", arity: 2, precedence: Precedence.Member, associativity: "left", optionName: "array", pure: true, impl: arrayIndexOrProperty }, | ||
| { symbol: "-", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "subtract", pure: true, impl: neg }, | ||
| { symbol: "+", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "add", pure: true, impl: pos }, | ||
| { symbol: "!", kind: "postfix", arity: 1, precedence: Precedence.Postfix, associativity: "left", optionName: "factorial", pure: true, impl: fac }, | ||
| { symbol: "?", kind: "ternary", arity: 3, precedence: Precedence.Ternary, associativity: "right", optionName: "conditional", pure: true, impl: condition } | ||
| ]; | ||
| const CORE_FUNCTIONS = []; | ||
| const COMPARISON_OPERATORS = [ | ||
| { symbol: "==", kind: "infix", arity: 2, precedence: Precedence.Comparison, associativity: "left", optionName: "comparison", pure: true, impl: equal }, | ||
| { symbol: "!=", kind: "infix", arity: 2, precedence: Precedence.Comparison, associativity: "left", optionName: "comparison", pure: true, impl: notEqual }, | ||
| { symbol: "<", kind: "infix", arity: 2, precedence: Precedence.Comparison, associativity: "left", optionName: "comparison", pure: true, impl: lessThan }, | ||
| { symbol: "<=", kind: "infix", arity: 2, precedence: Precedence.Comparison, associativity: "left", optionName: "comparison", pure: true, impl: lessThanEqual }, | ||
| { symbol: ">", kind: "infix", arity: 2, precedence: Precedence.Comparison, associativity: "left", optionName: "comparison", pure: true, impl: greaterThan }, | ||
| { symbol: ">=", kind: "infix", arity: 2, precedence: Precedence.Comparison, associativity: "left", optionName: "comparison", pure: true, impl: greaterThanEqual }, | ||
| { symbol: "in", kind: "infix", arity: 2, precedence: Precedence.Comparison, associativity: "left", optionName: "in", pure: true, impl: inOperator }, | ||
| { symbol: "not in", kind: "infix", arity: 2, precedence: Precedence.Comparison, associativity: "left", optionName: "in", pure: true, impl: notInOperator } | ||
| ]; | ||
| const LOGICAL_OPERATORS = [ | ||
| { symbol: "or", kind: "infix", arity: 2, precedence: Precedence.Or, associativity: "left", optionName: "logical", pure: true, impl: orOperator }, | ||
| { symbol: "||", kind: "infix", arity: 2, precedence: Precedence.Or, associativity: "left", optionName: "logical", pure: true, impl: orOperator }, | ||
| { symbol: "and", kind: "infix", arity: 2, precedence: Precedence.And, associativity: "left", optionName: "logical", pure: true, impl: andOperator }, | ||
| { symbol: "&&", kind: "infix", arity: 2, precedence: Precedence.And, associativity: "left", optionName: "logical", pure: true, impl: andOperator }, | ||
| { symbol: "not", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "logical", pure: true, impl: not } | ||
| ]; | ||
| const MATH_OPERATORS = [ | ||
| { symbol: "abs", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "abs", pure: true, impl: abs }, | ||
| { symbol: "acos", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "acos", pure: true, impl: acos }, | ||
| { symbol: "acosh", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "acosh", pure: true, impl: acosh }, | ||
| { symbol: "asin", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "asin", pure: true, impl: asin }, | ||
| { symbol: "asinh", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "asinh", pure: true, impl: asinh }, | ||
| { symbol: "atan", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "atan", pure: true, impl: atan }, | ||
| { symbol: "atanh", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "atanh", pure: true, impl: atanh }, | ||
| { symbol: "cbrt", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "cbrt", pure: true, impl: cbrt }, | ||
| { symbol: "ceil", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "ceil", pure: true, impl: ceil }, | ||
| { symbol: "cos", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "cos", pure: true, impl: cos }, | ||
| { symbol: "cosh", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "cosh", pure: true, impl: cosh }, | ||
| { symbol: "exp", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "exp", pure: true, impl: exp }, | ||
| { symbol: "expm1", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "expm1", pure: true, impl: expm1 }, | ||
| { symbol: "floor", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "floor", pure: true, impl: floor }, | ||
| { symbol: "lg", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "lg", pure: true, impl: log10 }, | ||
| { symbol: "ln", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "ln", pure: true, impl: log }, | ||
| { symbol: "log", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "log", pure: true, impl: log }, | ||
| { symbol: "log1p", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "log1p", pure: true, impl: log1p }, | ||
| { symbol: "log2", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "log2", pure: true, impl: log2 }, | ||
| { symbol: "log10", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "log10", pure: true, impl: log10 }, | ||
| { symbol: "round", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "round", pure: true, impl: round }, | ||
| { symbol: "sign", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "sign", pure: true, impl: sign }, | ||
| { symbol: "sin", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "sin", pure: true, impl: sin }, | ||
| { symbol: "sinh", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "sinh", pure: true, impl: sinh }, | ||
| { symbol: "sqrt", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "sqrt", pure: true, impl: sqrt }, | ||
| { symbol: "tan", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "tan", pure: true, impl: tan }, | ||
| { symbol: "tanh", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "tanh", pure: true, impl: tanh }, | ||
| { symbol: "trunc", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "trunc", pure: true, impl: trunc } | ||
| ]; | ||
| const MATH_FUNCTIONS = BUILTIN_FUNCTIONS.filter( | ||
| (d) => d.category === "math" | ||
| ); | ||
| const STRING_OPERATORS = [ | ||
| { symbol: "length", kind: "prefix", arity: 1, precedence: Precedence.Prefix, associativity: "right", optionName: "length", pure: true, impl: length } | ||
| ]; | ||
| const STRING_FUNCTIONS = BUILTIN_FUNCTIONS.filter( | ||
| (d) => d.category === "string" | ||
| ); | ||
| const ARRAY_FUNCTIONS = BUILTIN_FUNCTIONS.filter( | ||
| (d) => d.category === "array" | ||
| ); | ||
| const OBJECT_FUNCTIONS = BUILTIN_FUNCTIONS.filter( | ||
| (d) => d.category === "object" | ||
| ); | ||
| const TYPE_CHECK_FUNCTIONS = BUILTIN_FUNCTIONS.filter( | ||
| (d) => d.category === "type-check" | ||
| ); | ||
| const UTILITY_OPERATORS = [ | ||
| { symbol: "as", kind: "infix", arity: 2, precedence: Precedence.Coalesce, associativity: "left", optionName: "conversion", pure: true, impl: asOperator } | ||
| ]; | ||
| const UTILITY_FUNCTIONS = BUILTIN_FUNCTIONS.filter( | ||
| (d) => d.category === "utility" | ||
| ); | ||
| const coreParser = { | ||
| operators: CORE_OPERATORS, | ||
| functions: CORE_FUNCTIONS | ||
| }; | ||
| const withComparison = { | ||
| operators: COMPARISON_OPERATORS, | ||
| functions: [] | ||
| }; | ||
| const withLogical = { | ||
| operators: LOGICAL_OPERATORS, | ||
| functions: [] | ||
| }; | ||
| const withMath = { | ||
| operators: MATH_OPERATORS, | ||
| functions: MATH_FUNCTIONS | ||
| }; | ||
| const withString = { | ||
| operators: STRING_OPERATORS, | ||
| functions: STRING_FUNCTIONS | ||
| }; | ||
| const withArray = { | ||
| operators: [], | ||
| functions: ARRAY_FUNCTIONS | ||
| }; | ||
| const withObject = { | ||
| operators: [], | ||
| functions: OBJECT_FUNCTIONS | ||
| }; | ||
| const withTypeCheck = { | ||
| operators: [], | ||
| functions: TYPE_CHECK_FUNCTIONS | ||
| }; | ||
| const withUtility = { | ||
| operators: UTILITY_OPERATORS, | ||
| functions: UTILITY_FUNCTIONS | ||
| }; | ||
| const fullParser = { | ||
| operators: [ | ||
| ...CORE_OPERATORS, | ||
| ...COMPARISON_OPERATORS, | ||
| ...LOGICAL_OPERATORS, | ||
| ...MATH_OPERATORS, | ||
| ...STRING_OPERATORS, | ||
| ...UTILITY_OPERATORS | ||
| ], | ||
| functions: [ | ||
| ...CORE_FUNCTIONS, | ||
| ...MATH_FUNCTIONS, | ||
| ...STRING_FUNCTIONS, | ||
| ...ARRAY_FUNCTIONS, | ||
| ...OBJECT_FUNCTIONS, | ||
| ...TYPE_CHECK_FUNCTIONS, | ||
| ...UTILITY_FUNCTIONS | ||
| ] | ||
| }; | ||
| export { | ||
| ARRAY_FUNCTIONS as A, | ||
| COMPARISON_OPERATORS as C, | ||
| LOGICAL_OPERATORS as L, | ||
| MATH_FUNCTIONS as M, | ||
| OBJECT_FUNCTIONS as O, | ||
| STRING_FUNCTIONS as S, | ||
| TYPE_CHECK_FUNCTIONS as T, | ||
| UTILITY_FUNCTIONS as U, | ||
| withComparison as a, | ||
| withLogical as b, | ||
| coreParser as c, | ||
| withMath as d, | ||
| withObject as e, | ||
| fullParser as f, | ||
| withString as g, | ||
| withTypeCheck as h, | ||
| withUtility as i, | ||
| MATH_OPERATORS as j, | ||
| STRING_OPERATORS as k, | ||
| UTILITY_OPERATORS as l, | ||
| withArray as w | ||
| }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1063253
0.56%265
1.92%22531
0.57%