import { CaretParselet } from "@caret-js/core"; import { DecimalParselet } from "./parselets/decimal"; import { UnaryMinusParselet } from "./parselets/unaryMinus"; import { SubSupParselet } from "./parselets/subsup"; import { ParenthesesParselet } from "./parselets/parentheses"; import { FractionParselet } from "./parselets/fraction"; import { VariableParselet } from "./parselets/variable"; import { MultiplyParselet } from "./parselets/multiply"; import { AddParselet } from "./parselets/add"; import { SubtractParselet } from "./parselets/subtract"; import { CommaListParselet } from "./parselets/commaList"; import { EquationParselet } from "./parselets/equation"; import { AdjacentMultiplicationParselet } from "./parselets/adjacentMultiplication"; import { FunctionCallParselet } from "./parselets/functionCall"; import { UnaryPlusParselet } from "./parselets/unaryPlus"; import { RadicalParselet } from "./parselets/radical"; /** * The default parselet configuration for mathematical expressions. */ export function defaultParselets( options: { funcNames?: Set } = {} ): (CaretParselet | Set)[] { return [ new Set([ new DecimalParselet(), new VariableParselet(), new ParenthesesParselet(), new FractionParselet(), new RadicalParselet(), ]), new SubSupParselet(), new FunctionCallParselet( options.funcNames ?? new Set(["f", "g", "h"]) ), new Set([new MultiplyParselet(), new AdjacentMultiplicationParselet()]), new Set([new UnaryMinusParselet(), new UnaryPlusParselet()]), new Set([new SubtractParselet(), new AddParselet()]), new Set([new CommaListParselet()]), new Set([new EquationParselet()]), ]; }