nerdamer 1.1.13 → 2.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (341) hide show
  1. package/LICENSE.md +184 -0
  2. package/README.md +293 -312
  3. package/dist/bundle.js +2 -0
  4. package/dist/bundle.js.LICENSE.txt +7 -0
  5. package/dist/parser.js +2 -0
  6. package/dist/parser.js.LICENSE.txt +7 -0
  7. package/docs-data/parser-functions.json +1960 -0
  8. package/index.d.ts +10 -426
  9. package/output/algebra/adapters.d.ts +33 -0
  10. package/output/algebra/adapters.js +109 -0
  11. package/output/algebra/algorithms/arith.d.ts +84 -0
  12. package/output/algebra/algorithms/arith.js +323 -0
  13. package/output/algebra/algorithms/factor.d.ts +3 -0
  14. package/output/algebra/algorithms/factor.js +5 -0
  15. package/output/algebra/algorithms/factorMultivariate.d.ts +23 -0
  16. package/output/algebra/algorithms/factorMultivariate.js +2393 -0
  17. package/output/algebra/algorithms/factorUnivariate.d.ts +72 -0
  18. package/output/algebra/algorithms/factorUnivariate.js +1072 -0
  19. package/output/algebra/algorithms/gcd.d.ts +22 -0
  20. package/output/algebra/algorithms/gcd.js +690 -0
  21. package/output/algebra/algorithms/groebnerBase.d.ts +157 -0
  22. package/output/algebra/algorithms/groebnerBase.js +1166 -0
  23. package/output/algebra/algorithms/multiPoly/MultiPoly.d.ts +137 -0
  24. package/output/algebra/algorithms/multiPoly/MultiPoly.js +346 -0
  25. package/output/algebra/algorithms/poly.d.ts +228 -0
  26. package/output/algebra/algorithms/poly.js +1299 -0
  27. package/output/algebra/algorithms/rational.d.ts +17 -0
  28. package/output/algebra/algorithms/rational.js +115 -0
  29. package/output/algebra/factor/factor.d.ts +62 -0
  30. package/output/algebra/factor/factor.js +158 -0
  31. package/output/algebra/gcd/gcd.d.ts +29 -0
  32. package/output/algebra/gcd/gcd.js +141 -0
  33. package/output/algebra/groebner.d.ts +21 -0
  34. package/output/algebra/groebner.js +42 -0
  35. package/output/algebra/partfrac.d.ts +19 -0
  36. package/output/algebra/partfrac.js +398 -0
  37. package/output/algebra/polynomialize.d.ts +20 -0
  38. package/output/algebra/polynomialize.js +24 -0
  39. package/output/algebra/simplify/complexsimp.d.ts +7 -0
  40. package/output/algebra/simplify/complexsimp.js +24 -0
  41. package/output/algebra/simplify/factorCommon.d.ts +13 -0
  42. package/output/algebra/simplify/factorCommon.js +136 -0
  43. package/output/algebra/simplify/funcsimp.d.ts +26 -0
  44. package/output/algebra/simplify/funcsimp.js +633 -0
  45. package/output/algebra/simplify/invtrigrewrite.d.ts +10 -0
  46. package/output/algebra/simplify/invtrigrewrite.js +96 -0
  47. package/output/algebra/simplify/ratsimp.d.ts +21 -0
  48. package/output/algebra/simplify/ratsimp.js +140 -0
  49. package/output/algebra/simplify/simplify.d.ts +25 -0
  50. package/output/algebra/simplify/simplify.js +228 -0
  51. package/output/algebra/simplify/trigreduce.d.ts +38 -0
  52. package/output/algebra/simplify/trigreduce.js +424 -0
  53. package/output/algebra/simplify/trigrewrite.d.ts +17 -0
  54. package/output/algebra/simplify/trigrewrite.js +156 -0
  55. package/output/algebra/simplify/trigsimp.d.ts +11 -0
  56. package/output/algebra/simplify/trigsimp.js +369 -0
  57. package/output/algebra/simplify/utils.d.ts +32 -0
  58. package/output/algebra/simplify/utils.js +56 -0
  59. package/output/algebra/utils.d.ts +32 -0
  60. package/output/algebra/utils.js +48 -0
  61. package/output/api/advanced.d.ts +7 -0
  62. package/output/api/advanced.js +18 -0
  63. package/output/api/algebra.d.ts +17 -0
  64. package/output/api/algebra.js +32 -0
  65. package/output/api/assumptions.d.ts +4 -0
  66. package/output/api/assumptions.js +11 -0
  67. package/output/api/calculus.d.ts +9 -0
  68. package/output/api/calculus.js +21 -0
  69. package/output/api/core.d.ts +17 -0
  70. package/output/api/core.js +41 -0
  71. package/output/api/debug.d.ts +16 -0
  72. package/output/api/debug.js +23 -0
  73. package/output/api/parser.d.ts +85 -0
  74. package/output/api/parser.js +16 -0
  75. package/output/api/solve.d.ts +10 -0
  76. package/output/api/solve.js +16 -0
  77. package/output/api/structures.d.ts +10 -0
  78. package/output/api/structures.js +22 -0
  79. package/output/calculus/derivative/diff.d.ts +30 -0
  80. package/output/calculus/derivative/diff.js +238 -0
  81. package/output/calculus/fresnel.d.ts +16 -0
  82. package/output/calculus/fresnel.js +39 -0
  83. package/output/calculus/integrate/byParts.d.ts +18 -0
  84. package/output/calculus/integrate/byParts.js +339 -0
  85. package/output/calculus/integrate/bySubstitution.d.ts +135 -0
  86. package/output/calculus/integrate/bySubstitution.js +411 -0
  87. package/output/calculus/integrate/integrate.d.ts +38 -0
  88. package/output/calculus/integrate/integrate.js +652 -0
  89. package/output/calculus/integrate/integrationTable.d.ts +2 -0
  90. package/output/calculus/integrate/integrationTable.js +914 -0
  91. package/output/calculus/integrate/utils.d.ts +28 -0
  92. package/output/calculus/integrate/utils.js +96 -0
  93. package/output/calculus/laplace/ilaplace.d.ts +31 -0
  94. package/output/calculus/laplace/ilaplace.js +192 -0
  95. package/output/calculus/laplace/ilaplaceTable.d.ts +2 -0
  96. package/output/calculus/laplace/ilaplaceTable.js +200 -0
  97. package/output/calculus/laplace/laplace.d.ts +22 -0
  98. package/output/calculus/laplace/laplace.js +109 -0
  99. package/output/calculus/laplace/laplaceTable.d.ts +2 -0
  100. package/output/calculus/laplace/laplaceTable.js +187 -0
  101. package/output/calculus/limit/limit.d.ts +35 -0
  102. package/output/calculus/limit/limit.js +1183 -0
  103. package/output/calculus/limit/limitsTable.d.ts +2 -0
  104. package/output/calculus/limit/limitsTable.js +7 -0
  105. package/output/core/Settings.d.ts +32 -0
  106. package/output/core/Settings.js +68 -0
  107. package/output/core/adapters.d.ts +18 -0
  108. package/output/core/adapters.js +40 -0
  109. package/output/core/classes/assumption/Assumption.d.ts +218 -0
  110. package/output/core/classes/assumption/Assumption.js +605 -0
  111. package/output/core/classes/assumption/assertiveFunctions.d.ts +6 -0
  112. package/output/core/classes/assumption/assertiveFunctions.js +64 -0
  113. package/output/core/classes/assumption/assume.d.ts +90 -0
  114. package/output/core/classes/assumption/assume.js +145 -0
  115. package/output/core/classes/collection/Collection.d.ts +107 -0
  116. package/output/core/classes/collection/Collection.js +231 -0
  117. package/output/core/classes/complex/Complex.d.ts +99 -0
  118. package/output/core/classes/complex/Complex.js +135 -0
  119. package/output/core/classes/decimalSet/DecimalSet.d.ts +226 -0
  120. package/output/core/classes/decimalSet/DecimalSet.js +453 -0
  121. package/output/core/classes/dictionary/Dictionary.d.ts +102 -0
  122. package/output/core/classes/dictionary/Dictionary.js +213 -0
  123. package/output/core/classes/equation/Equation.d.ts +256 -0
  124. package/output/core/classes/equation/Equation.js +350 -0
  125. package/output/core/classes/expression/CoeffObject.d.ts +100 -0
  126. package/output/core/classes/expression/CoeffObject.js +198 -0
  127. package/output/core/classes/expression/Expression.d.ts +1674 -0
  128. package/output/core/classes/expression/Expression.js +2332 -0
  129. package/output/core/classes/expression/analysis.d.ts +25 -0
  130. package/output/core/classes/expression/analysis.js +218 -0
  131. package/output/core/classes/expression/collect.d.ts +9 -0
  132. package/output/core/classes/expression/collect.js +49 -0
  133. package/output/core/classes/expression/format.d.ts +45 -0
  134. package/output/core/classes/expression/format.js +217 -0
  135. package/output/core/classes/expression/products.d.ts +23 -0
  136. package/output/core/classes/expression/products.js +115 -0
  137. package/output/core/classes/expression/shortcuts.d.ts +35 -0
  138. package/output/core/classes/expression/shortcuts.js +129 -0
  139. package/output/core/classes/expression/traversal.d.ts +31 -0
  140. package/output/core/classes/expression/traversal.js +216 -0
  141. package/output/core/classes/expression/trig.d.ts +25 -0
  142. package/output/core/classes/expression/trig.js +40 -0
  143. package/output/core/classes/expression/utils.d.ts +52 -0
  144. package/output/core/classes/expression/utils.js +189 -0
  145. package/output/core/classes/lookupTable/LookupTable.d.ts +12 -0
  146. package/output/core/classes/lookupTable/LookupTable.js +55 -0
  147. package/output/core/classes/matrix/Matrix.d.ts +227 -0
  148. package/output/core/classes/matrix/Matrix.js +889 -0
  149. package/output/core/classes/matrix/Sylvester.d.ts +11 -0
  150. package/output/core/classes/matrix/Sylvester.js +54 -0
  151. package/output/core/classes/matrix/functions.d.ts +26 -0
  152. package/output/core/classes/matrix/functions.js +52 -0
  153. package/output/core/classes/matrix/utils.d.ts +9 -0
  154. package/output/core/classes/matrix/utils.js +22 -0
  155. package/output/core/classes/parser/Parser.d.ts +480 -0
  156. package/output/core/classes/parser/Parser.js +1812 -0
  157. package/output/core/classes/parser/Token.d.ts +58 -0
  158. package/output/core/classes/parser/Token.js +137 -0
  159. package/output/core/classes/parser/constants.d.ts +160 -0
  160. package/output/core/classes/parser/constants.js +227 -0
  161. package/output/core/classes/parser/helpers.d.ts +21 -0
  162. package/output/core/classes/parser/helpers.js +42 -0
  163. package/output/core/classes/parser/operations/add.d.ts +15 -0
  164. package/output/core/classes/parser/operations/add.js +238 -0
  165. package/output/core/classes/parser/operations/comma.d.ts +7 -0
  166. package/output/core/classes/parser/operations/comma.js +11 -0
  167. package/output/core/classes/parser/operations/compare.d.ts +21 -0
  168. package/output/core/classes/parser/operations/compare.js +461 -0
  169. package/output/core/classes/parser/operations/divide.d.ts +2 -0
  170. package/output/core/classes/parser/operations/divide.js +72 -0
  171. package/output/core/classes/parser/operations/functions.d.ts +46 -0
  172. package/output/core/classes/parser/operations/functions.js +430 -0
  173. package/output/core/classes/parser/operations/multiply.d.ts +11 -0
  174. package/output/core/classes/parser/operations/multiply.js +321 -0
  175. package/output/core/classes/parser/operations/power.d.ts +48 -0
  176. package/output/core/classes/parser/operations/power.js +673 -0
  177. package/output/core/classes/parser/operations/subtract.d.ts +3 -0
  178. package/output/core/classes/parser/operations/subtract.js +35 -0
  179. package/output/core/classes/parser/preprocess.d.ts +14 -0
  180. package/output/core/classes/parser/preprocess.js +259 -0
  181. package/output/core/classes/parser/scripting/controlFlow.d.ts +121 -0
  182. package/output/core/classes/parser/scripting/controlFlow.js +355 -0
  183. package/output/core/classes/parser/scripting/evaluate.d.ts +10 -0
  184. package/output/core/classes/parser/scripting/evaluate.js +112 -0
  185. package/output/core/classes/parser/scripting/functions.d.ts +14 -0
  186. package/output/core/classes/parser/scripting/functions.js +59 -0
  187. package/output/core/classes/parser/scripting/scope.d.ts +35 -0
  188. package/output/core/classes/parser/scripting/scope.js +155 -0
  189. package/output/core/classes/parser/types.d.ts +125 -0
  190. package/output/core/classes/parser/types.js +2 -0
  191. package/output/core/classes/parser/wrappers/IndexedReference.d.ts +31 -0
  192. package/output/core/classes/parser/wrappers/IndexedReference.js +68 -0
  193. package/output/core/classes/parser/wrappers/KeyValuePair.d.ts +24 -0
  194. package/output/core/classes/parser/wrappers/KeyValuePair.js +51 -0
  195. package/output/core/classes/polynomial/Polynomial.d.ts +500 -0
  196. package/output/core/classes/polynomial/Polynomial.js +1149 -0
  197. package/output/core/classes/polynomial/Term.d.ts +222 -0
  198. package/output/core/classes/polynomial/Term.js +430 -0
  199. package/output/core/classes/polynomial/functions.d.ts +69 -0
  200. package/output/core/classes/polynomial/functions.js +126 -0
  201. package/output/core/classes/polynomial/utils.d.ts +62 -0
  202. package/output/core/classes/polynomial/utils.js +206 -0
  203. package/output/core/classes/rational/Rational.d.ts +504 -0
  204. package/output/core/classes/rational/Rational.js +779 -0
  205. package/output/core/classes/seq/SEQ.d.ts +13 -0
  206. package/output/core/classes/seq/SEQ.js +137 -0
  207. package/output/core/classes/valuesSet/ValuesSet.d.ts +179 -0
  208. package/output/core/classes/valuesSet/ValuesSet.js +381 -0
  209. package/output/core/classes/vector/Vector.d.ts +222 -0
  210. package/output/core/classes/vector/Vector.js +497 -0
  211. package/output/core/classes/vector/functions.d.ts +28 -0
  212. package/output/core/classes/vector/functions.js +47 -0
  213. package/output/core/common/classes/MathematicalAggregate.d.ts +53 -0
  214. package/output/core/common/classes/MathematicalAggregate.js +140 -0
  215. package/output/core/common/classes/Scope.d.ts +62 -0
  216. package/output/core/common/classes/Scope.js +122 -0
  217. package/output/core/common/classes/StructuredEntity.d.ts +55 -0
  218. package/output/core/common/classes/StructuredEntity.js +151 -0
  219. package/output/core/common/common.d.ts +63 -0
  220. package/output/core/common/common.js +279 -0
  221. package/output/core/common/functions/functions.d.ts +14 -0
  222. package/output/core/common/functions/functions.js +33 -0
  223. package/output/core/common/functions/structuredEntityUtils.d.ts +27 -0
  224. package/output/core/common/functions/structuredEntityUtils.js +40 -0
  225. package/output/core/converters/BaseConverter.d.ts +97 -0
  226. package/output/core/converters/BaseConverter.js +405 -0
  227. package/output/core/converters/Converter.d.ts +111 -0
  228. package/output/core/converters/Converter.js +802 -0
  229. package/output/core/converters/Pattern.d.ts +71 -0
  230. package/output/core/converters/Pattern.js +302 -0
  231. package/output/core/dispatch.d.ts +34 -0
  232. package/output/core/dispatch.js +304 -0
  233. package/output/core/errors.d.ts +531 -0
  234. package/output/core/errors.js +621 -0
  235. package/output/core/functions/bigint/bigint.d.ts +121 -0
  236. package/output/core/functions/bigint/bigint.js +392 -0
  237. package/output/core/functions/bigint/primeFactor.d.ts +49 -0
  238. package/output/core/functions/bigint/primeFactor.js +267 -0
  239. package/output/core/functions/bigint/primes.d.ts +1 -0
  240. package/output/core/functions/bigint/primes.js +11 -0
  241. package/output/core/functions/build/definitions.d.ts +12 -0
  242. package/output/core/functions/build/definitions.js +133 -0
  243. package/output/core/functions/build/index.d.ts +32 -0
  244. package/output/core/functions/build/index.js +136 -0
  245. package/output/core/functions/complex.d.ts +90 -0
  246. package/output/core/functions/complex.js +482 -0
  247. package/output/core/functions/decimal.d.ts +24 -0
  248. package/output/core/functions/decimal.js +664 -0
  249. package/output/core/functions/expand/expand.d.ts +42 -0
  250. package/output/core/functions/expand/expand.js +376 -0
  251. package/output/core/functions/fresnelNumeric.d.ts +12 -0
  252. package/output/core/functions/fresnelNumeric.js +123 -0
  253. package/output/core/functions/numeric.d.ts +140 -0
  254. package/output/core/functions/numeric.js +790 -0
  255. package/output/core/functions/rationalNormalization.d.ts +11 -0
  256. package/output/core/functions/rationalNormalization.js +117 -0
  257. package/output/core/functions/setFunction.d.ts +19 -0
  258. package/output/core/functions/setFunction.js +75 -0
  259. package/output/core/functions/string.d.ts +26 -0
  260. package/output/core/functions/string.js +101 -0
  261. package/output/core/functions/subst.d.ts +90 -0
  262. package/output/core/functions/subst.js +498 -0
  263. package/output/core/functions/utils.d.ts +24 -0
  264. package/output/core/functions/utils.js +51 -0
  265. package/output/core/types.d.ts +48 -0
  266. package/output/core/types.js +2 -0
  267. package/output/index.d.ts +339 -0
  268. package/output/index.js +715 -0
  269. package/output/math/defint/defintDecimal.d.ts +37 -0
  270. package/output/math/defint/defintDecimal.js +320 -0
  271. package/output/math/defint/defintNative.d.ts +57 -0
  272. package/output/math/defint/defintNative.js +292 -0
  273. package/output/math/geometry.d.ts +8 -0
  274. package/output/math/geometry.js +32 -0
  275. package/output/math/math.d.ts +655 -0
  276. package/output/math/math.js +1811 -0
  277. package/output/math/trig.d.ts +518 -0
  278. package/output/math/trig.js +1444 -0
  279. package/output/math/trunc.d.ts +19 -0
  280. package/output/math/trunc.js +36 -0
  281. package/output/math/utils.d.ts +60 -0
  282. package/output/math/utils.js +180 -0
  283. package/output/solve/classes/DecimalMatrix.d.ts +17 -0
  284. package/output/solve/classes/DecimalMatrix.js +86 -0
  285. package/output/solve/classes/FunctionSolver.d.ts +135 -0
  286. package/output/solve/classes/FunctionSolver.js +433 -0
  287. package/output/solve/classes/MultivariateSolver.d.ts +84 -0
  288. package/output/solve/classes/MultivariateSolver.js +240 -0
  289. package/output/solve/classes/PolynomialSolver.d.ts +85 -0
  290. package/output/solve/classes/PolynomialSolver.js +292 -0
  291. package/output/solve/classes/SolutionSet.d.ts +153 -0
  292. package/output/solve/classes/SolutionSet.js +357 -0
  293. package/output/solve/classes/Solver.d.ts +17 -0
  294. package/output/solve/classes/Solver.js +132 -0
  295. package/output/solve/classes/SymbolicSolver.d.ts +74 -0
  296. package/output/solve/classes/SymbolicSolver.js +601 -0
  297. package/output/solve/linsolve.d.ts +51 -0
  298. package/output/solve/linsolve.js +225 -0
  299. package/output/solve/solve.d.ts +34 -0
  300. package/output/solve/solve.js +260 -0
  301. package/output/solve/solveSystem.d.ts +31 -0
  302. package/output/solve/solveSystem.js +290 -0
  303. package/output/solve/utils.d.ts +9 -0
  304. package/output/solve/utils.js +62 -0
  305. package/output/utils/array.d.ts +42 -0
  306. package/output/utils/array.js +98 -0
  307. package/output/utils/debug.d.ts +131 -0
  308. package/output/utils/debug.js +295 -0
  309. package/output/utils/decimal.d.ts +3 -0
  310. package/output/utils/decimal.js +16 -0
  311. package/output/utils/numeric.d.ts +14 -0
  312. package/output/utils/numeric.js +51 -0
  313. package/output/utils/object.d.ts +26 -0
  314. package/output/utils/object.js +56 -0
  315. package/package.json +213 -57
  316. package/.travis.yml +0 -3
  317. package/Algebra.js +0 -4568
  318. package/BREAKING_CHANGES.md +0 -5
  319. package/CODE_OF_CONDUCT.md +0 -46
  320. package/CONTRIBUTING.md +0 -14
  321. package/Calculus.js +0 -2675
  322. package/Extra.js +0 -622
  323. package/Solve.js +0 -1783
  324. package/all.js +0 -16
  325. package/all.min.js +0 -1
  326. package/gulpfile.js +0 -16
  327. package/index.html +0 -158
  328. package/license.txt +0 -19
  329. package/nerdamer.core.js +0 -12510
  330. package/spec/LaTeX.spec.js +0 -302
  331. package/spec/TeXConvert.spec.js +0 -8
  332. package/spec/algebra.spec.js +0 -287
  333. package/spec/basic_parser.spec.js +0 -134
  334. package/spec/build.spec.js +0 -131
  335. package/spec/calculus.spec.js +0 -183
  336. package/spec/core.spec.js +0 -2970
  337. package/spec/extra.spec.js +0 -54
  338. package/spec/solve.spec.js +0 -126
  339. package/spec/support/jasmine.json +0 -11
  340. package/spec/support/utils.js +0 -42
  341. package/spec/text.spec.js +0 -132
@@ -0,0 +1,58 @@
1
+ import { TOKEN } from './constants';
2
+ import type { Operator } from '../../common/common';
3
+ export declare const ALLOWED_CHARACTERS: string[];
4
+ export declare const operatorArray: string[];
5
+ export declare let operatorRegex: RegExp;
6
+ /** Refreshes tokenizer operator symbols after the shared operator registry changes. */
7
+ export declare function refreshOperatorSymbols(): void;
8
+ export declare const bracketRegex: RegExp;
9
+ export declare const variableRegex: RegExp;
10
+ export declare const digitRegex: RegExp;
11
+ export declare const dotOrDigitRegex: RegExp;
12
+ export interface TokenBuffer {
13
+ tokenType: string;
14
+ chars: string[];
15
+ inputString: string;
16
+ scientificNumber: boolean;
17
+ last(): string | undefined;
18
+ next(at: number): string;
19
+ prev(at: number): string;
20
+ is(tokenType: string): boolean;
21
+ }
22
+ export declare class Token {
23
+ static readonly BRACKET = "BKT";
24
+ static readonly CHARACTER = "CHR";
25
+ static readonly FUNCTION = "FUN";
26
+ static readonly NUMBER = "NUM";
27
+ static readonly OPERATOR = "OPR";
28
+ static readonly PREFIX = "PFX";
29
+ static readonly SPACE = "SPC";
30
+ static readonly UNDEFINED = "UND";
31
+ static readonly VARIABLE = "VAR";
32
+ dataType: typeof TOKEN;
33
+ position: number;
34
+ /** Operator metadata selected from syntax when one source token has multiple roles. */
35
+ resolvedOperator?: Operator;
36
+ type?: string;
37
+ value: string;
38
+ constructor(value: string | number | Token, type: string, position: number);
39
+ static getCharType(ch: string, at: number, buffer: TokenBuffer): "BKT" | "CHR" | "NUM" | "OPR" | "SPC" | "VAR";
40
+ static isToken(obj: unknown): obj is Token;
41
+ /**
42
+ * Helper function for creating an operator token
43
+ *
44
+ * @param value
45
+ * @returns
46
+ */
47
+ static O(value: string): Token;
48
+ /**
49
+ * Helper function for creating an variable token
50
+ *
51
+ * @param value
52
+ * @returns
53
+ */
54
+ static V(value: string): Token;
55
+ is(type: string): boolean;
56
+ text(): string;
57
+ toString(): string;
58
+ }
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Token = exports.dotOrDigitRegex = exports.digitRegex = exports.variableRegex = exports.bracketRegex = exports.operatorRegex = exports.operatorArray = exports.ALLOWED_CHARACTERS = void 0;
4
+ exports.refreshOperatorSymbols = refreshOperatorSymbols;
5
+ const common_1 = require("../../common/common");
6
+ const functions_1 = require("../../common/functions/functions");
7
+ const constants_1 = require("./constants");
8
+ // Additional characters allowed in the parser which haven't already been defined
9
+ exports.ALLOWED_CHARACTERS = [];
10
+ exports.operatorArray = (0, functions_1.getOperatorSymbolArray)();
11
+ exports.operatorRegex = new RegExp(`[${exports.operatorArray.join('')}]`);
12
+ /** Refreshes tokenizer operator symbols after the shared operator registry changes. */
13
+ function refreshOperatorSymbols() {
14
+ exports.operatorArray.splice(0, exports.operatorArray.length, ...(0, functions_1.getOperatorSymbolArray)());
15
+ exports.operatorRegex = new RegExp(`[${exports.operatorArray.join('')}]`);
16
+ }
17
+ exports.bracketRegex = new RegExp(`[${Object.keys(common_1.brackets).join('\\')}]`);
18
+ exports.variableRegex = /[a-z_αAβBγΓδΔϵEζZηHθΘιIκKλΛμMνNξΞoOπΠρPσΣτTυϒϕΦχXψΨωΩ∞]/i;
19
+ exports.digitRegex = /\d/;
20
+ exports.dotOrDigitRegex = /\d|\./;
21
+ class Token {
22
+ static BRACKET = 'BKT';
23
+ static CHARACTER = 'CHR';
24
+ static FUNCTION = 'FUN';
25
+ static NUMBER = 'NUM';
26
+ // args?: any;
27
+ static OPERATOR = 'OPR';
28
+ static PREFIX = 'PFX';
29
+ static SPACE = 'SPC';
30
+ static UNDEFINED = 'UND';
31
+ static VARIABLE = 'VAR';
32
+ dataType;
33
+ position;
34
+ /** Operator metadata selected from syntax when one source token has multiple roles. */
35
+ resolvedOperator;
36
+ type;
37
+ value;
38
+ constructor(value, type, position) {
39
+ this.dataType = constants_1.TOKEN;
40
+ // Where was start of the token found
41
+ this.position = position;
42
+ // What type of token is it
43
+ this.type = type;
44
+ // The actual contents
45
+ this.value = String(value);
46
+ }
47
+ static getCharType(ch, at, buffer) {
48
+ // If it's a number.
49
+ if (exports.digitRegex.test(ch)) {
50
+ // If the number or underscore comes after a variable then it belongs to the variable
51
+ if (buffer.tokenType === Token.VARIABLE) {
52
+ return Token.VARIABLE;
53
+ }
54
+ return Token.NUMBER;
55
+ }
56
+ else if (ch === constants_1.SPACE) {
57
+ return Token.SPACE;
58
+ }
59
+ // It's a decimal and belongs to a number.
60
+ else if (ch === constants_1.DOT) {
61
+ // If the "." comes after a variable then we make it an operator to allow for dot notation at some point
62
+ if (buffer.tokenType === Token.VARIABLE) {
63
+ return Token.OPERATOR;
64
+ }
65
+ return Token.NUMBER;
66
+ }
67
+ // Scientific numbers
68
+ else if ((ch === 'e' || ch === 'E') && buffer.tokenType === Token.NUMBER) {
69
+ const prev = buffer.prev(at);
70
+ const next = buffer.next(at);
71
+ if (next === constants_1.PLUS ||
72
+ next === constants_1.MINUS ||
73
+ (exports.dotOrDigitRegex.test(prev) && exports.digitRegex.test(next))) {
74
+ buffer.scientificNumber = true;
75
+ return Token.NUMBER;
76
+ }
77
+ return Token.VARIABLE;
78
+ }
79
+ // If it's a letter.
80
+ else if (exports.variableRegex.test(ch) || exports.ALLOWED_CHARACTERS.includes(ch)) {
81
+ return Token.VARIABLE;
82
+ }
83
+ // It's a bracket
84
+ else if (exports.bracketRegex.test(ch)) {
85
+ return Token.BRACKET;
86
+ }
87
+ // It's an operator
88
+ else if (exports.operatorRegex.test(ch)) {
89
+ const last = buffer.last();
90
+ // Bypass the + and - for scientific numbers
91
+ if (buffer.tokenType === Token.NUMBER &&
92
+ (ch === constants_1.PLUS || ch === constants_1.MINUS) &&
93
+ (last === 'e' || last === 'E')) {
94
+ return Token.NUMBER;
95
+ }
96
+ return Token.OPERATOR;
97
+ }
98
+ // All else
99
+ else {
100
+ return Token.CHARACTER;
101
+ }
102
+ }
103
+ static isToken(obj) {
104
+ return (0, common_1.isNerdamerNativeType)(obj, constants_1.TOKEN);
105
+ }
106
+ /**
107
+ * Helper function for creating an operator token
108
+ *
109
+ * @param value
110
+ * @returns
111
+ */
112
+ static O(value) {
113
+ return new Token(value, Token.OPERATOR, -1);
114
+ }
115
+ /**
116
+ * Helper function for creating an variable token
117
+ *
118
+ * @param value
119
+ * @returns
120
+ */
121
+ static V(value) {
122
+ return new Token(value, Token.VARIABLE, -1);
123
+ }
124
+ is(type) {
125
+ return this.type === type;
126
+ }
127
+ text() {
128
+ return this.value;
129
+ }
130
+ toString() {
131
+ if (this.type === Token.PREFIX) {
132
+ return '`' + this.value;
133
+ }
134
+ return this.value;
135
+ }
136
+ }
137
+ exports.Token = Token;
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Some helper constants
3
+ */
4
+ export declare const MINUS = "-";
5
+ export declare const PLUS = "+";
6
+ export declare const MULTIPLY = "*";
7
+ export declare const DIVIDE = "/";
8
+ export declare const DOT = ".";
9
+ export declare const COMMA = ",";
10
+ export declare const ASSIGN = ":";
11
+ export declare const SPACE = " ";
12
+ export declare const BLANK = "";
13
+ export declare const NEWLINE = "\n";
14
+ export declare const TAB = "\t";
15
+ export declare const LINEFEED = "\f";
16
+ export declare const RETURN = "\r";
17
+ export declare const OPEN_PAREN = "(";
18
+ export declare const CLOSE_PAREN = ")";
19
+ export declare const WRAP = "";
20
+ export declare const TOKEN = "Token";
21
+ export declare const INDEXED_REFERENCE = "INDEXED_REF";
22
+ export declare const KEY_VALUE_PAIR = "KEY_VALUE_PAIR";
23
+ export declare const RATIONAL = "RAT";
24
+ export declare const SCOPE = "SCP";
25
+ export declare const EXPRESSION = "EXP";
26
+ export declare const COLLECTION = "COL";
27
+ export declare const VECTOR = "VEC";
28
+ export declare const MATRIX = "MAT";
29
+ export declare const EQUATION = "EQN";
30
+ export declare const POLYNOMIAL = "POL";
31
+ export declare const TERM = "TRM";
32
+ export declare const GFPOLY = "GFP";
33
+ export declare const SET = "SET";
34
+ export declare const SOLUTIONS_SET = "SOL";
35
+ export declare const DICTIONARY = "DIC";
36
+ export declare const ASSUMPTION = "ASSUMPTION";
37
+ export declare const dataTypes: {
38
+ [key: string]: string;
39
+ };
40
+ /**
41
+ * The base types supported by the parser. All other types are a form of these
42
+ */
43
+ export declare const EXPRESSION_TYPES: {
44
+ NUM: number;
45
+ VAR: number;
46
+ EXP: number;
47
+ FUN: number;
48
+ GRP: number;
49
+ PRD: number;
50
+ SUM: number;
51
+ INF: number;
52
+ VEC: number;
53
+ MAT: number;
54
+ };
55
+ /**
56
+ * The ranking used when evaluating types
57
+ */
58
+ export declare const RANK: {
59
+ [key: string]: number;
60
+ };
61
+ export declare const E = "e";
62
+ export declare const PI_NAME = "pi";
63
+ export declare const PI_SYMBOL = "\u03C0";
64
+ export declare const DEFAULT_IMAGINARY = "i";
65
+ export declare const INDEX_VARIABLE = "_n";
66
+ export declare const ALL_SYMBOL = "all";
67
+ export declare const ALIASES: Record<string, string>;
68
+ export declare const PI: string[];
69
+ export declare const INFINITY: string[];
70
+ export declare const PARSER_CONSTANTS: {
71
+ pi: () => string;
72
+ π: () => string;
73
+ e: () => string;
74
+ };
75
+ export declare const SYMBOLIC_ACCESSOR = "__accessor__";
76
+ export declare const FACTORIAL = "fact";
77
+ export declare const DOUBLE_FACTORIAL = "dfact";
78
+ export declare const FIB = "fib";
79
+ export declare const SQRT = "sqrt";
80
+ export declare const ABS = "abs";
81
+ export declare const MOD = "mod";
82
+ export declare const GAMMA = "gamma";
83
+ export declare const DIRAC = "delta";
84
+ export declare const HEAVISIDE = "heaviside";
85
+ export declare const LOG = "log";
86
+ export declare const SGN = "sign";
87
+ export declare const CSGN = "csgn";
88
+ export declare const CBRT = "cbrt";
89
+ export declare const CEIL = "ceil";
90
+ export declare const CHI = "Chi";
91
+ export declare const CI = "Ci";
92
+ export declare const CONJUGATE = "conjugate";
93
+ export declare const CONTAINS = "contains";
94
+ export declare const CONTENT = "content";
95
+ export declare const COUNT = "count";
96
+ export declare const CROSS = "cross";
97
+ export declare const DEFINT = "defint";
98
+ export declare const DEG = "deg";
99
+ export declare const DIFF = "diff";
100
+ export declare const DOT_PRODUCT = "dot";
101
+ export declare const EI = "Ei";
102
+ export declare const ERF = "erf";
103
+ export declare const FACTOR = "factor";
104
+ export declare const FLOOR = "floor";
105
+ export declare const FRESNEL_C = "C";
106
+ export declare const FRESNEL_S = "S";
107
+ export declare const GCD = "gcd";
108
+ export declare const ILAPLACE = "ilaplace";
109
+ export declare const IMAGPART = "imagpart";
110
+ export declare const IMATRIX = "imatrix";
111
+ export declare const INTEGRATE = "integrate";
112
+ export declare const ISPRIME = "isprime";
113
+ export declare const LAPLACE = "laplace";
114
+ export declare const LI = "Li";
115
+ export declare const LIMIT = "limit";
116
+ export declare const LN = "ln";
117
+ export declare const MAX = "max";
118
+ export declare const MIN = "min";
119
+ export declare const NTHROOT = "nthroot";
120
+ export declare const PRODUCT_FUNCTION = "product";
121
+ export declare const REALPART = "realpart";
122
+ export declare const ROUND = "round";
123
+ export declare const SIZE = "size";
124
+ export declare const TRUNC = "trunc";
125
+ export declare const SHI = "Shi";
126
+ export declare const SI = "Si";
127
+ export declare const SINC = "sinc";
128
+ export declare const SUM_FUNCTION = "sum";
129
+ export declare const TRIG_FUNCTION_NAMES: {
130
+ COS: string;
131
+ SIN: string;
132
+ TAN: string;
133
+ SEC: string;
134
+ CSC: string;
135
+ COT: string;
136
+ ACOS: string;
137
+ ASIN: string;
138
+ ATAN: string;
139
+ ASEC: string;
140
+ ACSC: string;
141
+ ACOT: string;
142
+ ATAN2: string;
143
+ SINH: string;
144
+ COSH: string;
145
+ TANH: string;
146
+ SECH: string;
147
+ CSCH: string;
148
+ COTH: string;
149
+ ACOSH: string;
150
+ ASINH: string;
151
+ ATANH: string;
152
+ ASECH: string;
153
+ ACSCH: string;
154
+ ACOTH: string;
155
+ };
156
+ export declare const COS: string, SIN: string, TAN: string, ASIN: string, ACOS: string, SEC: string, CSC: string, COT: string, ATAN: string, ASEC: string, ACSC: string, ACOT: string, ATAN2: string, SINH: string, COSH: string, TANH: string, SECH: string, CSCH: string, COTH: string, ACOSH: string, ASINH: string, ATANH: string, ASECH: string, ACSCH: string, ACOTH: string;
157
+ export declare const TRIG: string[];
158
+ export declare const INVERSE_TRIG: string[];
159
+ export declare const HYPERBOLIC_TRIG: string[];
160
+ export declare const INVERSE_HYPERBOLIC_TRIG: string[];
@@ -0,0 +1,227 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FIB = exports.DOUBLE_FACTORIAL = exports.FACTORIAL = exports.SYMBOLIC_ACCESSOR = exports.PARSER_CONSTANTS = exports.INFINITY = exports.PI = exports.ALIASES = exports.ALL_SYMBOL = exports.INDEX_VARIABLE = exports.DEFAULT_IMAGINARY = exports.PI_SYMBOL = exports.PI_NAME = exports.E = exports.RANK = exports.EXPRESSION_TYPES = exports.dataTypes = exports.ASSUMPTION = exports.DICTIONARY = exports.SOLUTIONS_SET = exports.SET = exports.GFPOLY = exports.TERM = exports.POLYNOMIAL = exports.EQUATION = exports.MATRIX = exports.VECTOR = exports.COLLECTION = exports.EXPRESSION = exports.SCOPE = exports.RATIONAL = exports.KEY_VALUE_PAIR = exports.INDEXED_REFERENCE = exports.TOKEN = exports.WRAP = exports.CLOSE_PAREN = exports.OPEN_PAREN = exports.RETURN = exports.LINEFEED = exports.TAB = exports.NEWLINE = exports.BLANK = exports.SPACE = exports.ASSIGN = exports.COMMA = exports.DOT = exports.DIVIDE = exports.MULTIPLY = exports.PLUS = exports.MINUS = void 0;
7
+ exports.SUM_FUNCTION = exports.SINC = exports.SI = exports.SHI = exports.TRUNC = exports.SIZE = exports.ROUND = exports.REALPART = exports.PRODUCT_FUNCTION = exports.NTHROOT = exports.MIN = exports.MAX = exports.LN = exports.LIMIT = exports.LI = exports.LAPLACE = exports.ISPRIME = exports.INTEGRATE = exports.IMATRIX = exports.IMAGPART = exports.ILAPLACE = exports.GCD = exports.FRESNEL_S = exports.FRESNEL_C = exports.FLOOR = exports.FACTOR = exports.ERF = exports.EI = exports.DOT_PRODUCT = exports.DIFF = exports.DEG = exports.DEFINT = exports.CROSS = exports.COUNT = exports.CONTENT = exports.CONTAINS = exports.CONJUGATE = exports.CI = exports.CHI = exports.CEIL = exports.CBRT = exports.CSGN = exports.SGN = exports.LOG = exports.HEAVISIDE = exports.DIRAC = exports.GAMMA = exports.MOD = exports.ABS = exports.SQRT = void 0;
8
+ exports.INVERSE_HYPERBOLIC_TRIG = exports.HYPERBOLIC_TRIG = exports.INVERSE_TRIG = exports.TRIG = exports.ACOTH = exports.ACSCH = exports.ASECH = exports.ATANH = exports.ASINH = exports.ACOSH = exports.COTH = exports.CSCH = exports.SECH = exports.TANH = exports.COSH = exports.SINH = exports.ATAN2 = exports.ACOT = exports.ACSC = exports.ASEC = exports.ATAN = exports.COT = exports.CSC = exports.SEC = exports.ACOS = exports.ASIN = exports.TAN = exports.SIN = exports.COS = exports.TRIG_FUNCTION_NAMES = void 0;
9
+ const decimal_js_1 = __importDefault(require("decimal.js"));
10
+ /**
11
+ * Some helper constants
12
+ */
13
+ exports.MINUS = '-';
14
+ exports.PLUS = '+';
15
+ exports.MULTIPLY = '*';
16
+ exports.DIVIDE = '/';
17
+ exports.DOT = '.';
18
+ exports.COMMA = ',';
19
+ exports.ASSIGN = ':';
20
+ exports.SPACE = ' ';
21
+ exports.BLANK = '';
22
+ exports.NEWLINE = '\n';
23
+ exports.TAB = '\t';
24
+ exports.LINEFEED = '\f';
25
+ exports.RETURN = '\r';
26
+ exports.OPEN_PAREN = '(';
27
+ exports.CLOSE_PAREN = ')';
28
+ exports.WRAP = '';
29
+ // Data types
30
+ // export const EXPRESSION = 'EX';
31
+ exports.TOKEN = 'Token';
32
+ exports.INDEXED_REFERENCE = 'INDEXED_REF';
33
+ exports.KEY_VALUE_PAIR = 'KEY_VALUE_PAIR';
34
+ exports.RATIONAL = 'RAT';
35
+ exports.SCOPE = 'SCP';
36
+ exports.EXPRESSION = 'EXP';
37
+ exports.COLLECTION = 'COL';
38
+ exports.VECTOR = 'VEC';
39
+ exports.MATRIX = 'MAT';
40
+ exports.EQUATION = 'EQN';
41
+ exports.POLYNOMIAL = 'POL';
42
+ exports.TERM = 'TRM';
43
+ exports.GFPOLY = 'GFP';
44
+ exports.SET = 'SET';
45
+ exports.SOLUTIONS_SET = 'SOL';
46
+ exports.DICTIONARY = 'DIC';
47
+ exports.ASSUMPTION = 'ASSUMPTION';
48
+ // The data type name
49
+ exports.dataTypes = {
50
+ [exports.TOKEN]: 'Token',
51
+ [exports.INDEXED_REFERENCE]: 'IndexedReference',
52
+ [exports.KEY_VALUE_PAIR]: 'KeyValuePair',
53
+ [exports.RATIONAL]: 'Rational',
54
+ [exports.SCOPE]: 'Scope',
55
+ [exports.EXPRESSION]: 'Expression',
56
+ [exports.COLLECTION]: 'Collection',
57
+ [exports.VECTOR]: 'Vector',
58
+ [exports.MATRIX]: 'Matrix',
59
+ [exports.EQUATION]: 'Equation',
60
+ [exports.POLYNOMIAL]: 'Polynomial',
61
+ [exports.TERM]: 'Term',
62
+ [exports.GFPOLY]: 'GFPolynomial',
63
+ [exports.SET]: 'ValuesSet',
64
+ [exports.SOLUTIONS_SET]: 'SolutionSet',
65
+ [exports.DICTIONARY]: 'Dictionary',
66
+ [exports.ASSUMPTION]: 'Assumption',
67
+ };
68
+ /**
69
+ * The base types supported by the parser. All other types are a form of these
70
+ */
71
+ exports.EXPRESSION_TYPES = {
72
+ // Numbers,
73
+ NUM: 6,
74
+ // Any variable e.g. x
75
+ VAR: 2,
76
+ // An exponential
77
+ EXP: 1,
78
+ // Any function
79
+ FUN: 3,
80
+ // Any type of the same variable
81
+ GRP: 4,
82
+ // Any expression with terms bound by multiplication or division
83
+ PRD: 7,
84
+ // Any expression bound by division or subtraction
85
+ SUM: 5,
86
+ // Infinity
87
+ INF: 8,
88
+ // Vectors
89
+ VEC: 9,
90
+ // Matrices
91
+ MAT: 10,
92
+ };
93
+ /**
94
+ * The ranking used when evaluating types
95
+ */
96
+ exports.RANK = {
97
+ // Numbers,
98
+ [exports.EXPRESSION_TYPES.NUM]: 1,
99
+ // Any variable e.g. x
100
+ [exports.EXPRESSION_TYPES.VAR]: 2,
101
+ // An exponential
102
+ [exports.EXPRESSION_TYPES.EXP]: 3,
103
+ // Any function
104
+ [exports.EXPRESSION_TYPES.FUN]: 4,
105
+ // Any type of the same variable
106
+ [exports.EXPRESSION_TYPES.GRP]: 5,
107
+ // Any expression with terms bound by multiplication or division
108
+ [exports.EXPRESSION_TYPES.PRD]: 6,
109
+ // Any expression bound by division or subtraction
110
+ [exports.EXPRESSION_TYPES.SUM]: 7,
111
+ // Infinity
112
+ [exports.EXPRESSION_TYPES.INF]: 8,
113
+ };
114
+ // Parser Constants
115
+ exports.E = 'e';
116
+ exports.PI_NAME = 'pi';
117
+ exports.PI_SYMBOL = 'π';
118
+ exports.DEFAULT_IMAGINARY = 'i';
119
+ exports.INDEX_VARIABLE = '_n';
120
+ exports.ALL_SYMBOL = 'all';
121
+ exports.ALIASES = {
122
+ [exports.PI_SYMBOL]: exports.PI_NAME,
123
+ '∞': 'Inf',
124
+ };
125
+ exports.PI = [exports.PI_NAME, exports.PI_SYMBOL];
126
+ exports.INFINITY = ['Inf', 'Infinity', '∞'];
127
+ // Parser Constants
128
+ exports.PARSER_CONSTANTS = {
129
+ [exports.PI_NAME]: () => {
130
+ return decimal_js_1.default.acos(-1).toString();
131
+ },
132
+ [exports.PI_SYMBOL]: () => {
133
+ return decimal_js_1.default.acos(-1).toString();
134
+ },
135
+ [exports.E]: () => {
136
+ return decimal_js_1.default.exp(1).toString();
137
+ },
138
+ };
139
+ // Functions
140
+ // Internal function name used to carry symbolic bracket access inside an Expression.
141
+ exports.SYMBOLIC_ACCESSOR = '__accessor__';
142
+ exports.FACTORIAL = 'fact';
143
+ exports.DOUBLE_FACTORIAL = 'dfact';
144
+ exports.FIB = 'fib';
145
+ exports.SQRT = 'sqrt';
146
+ exports.ABS = 'abs';
147
+ exports.MOD = 'mod';
148
+ exports.GAMMA = 'gamma';
149
+ exports.DIRAC = 'delta';
150
+ exports.HEAVISIDE = 'heaviside';
151
+ exports.LOG = 'log';
152
+ exports.SGN = 'sign';
153
+ exports.CSGN = 'csgn';
154
+ exports.CBRT = 'cbrt';
155
+ exports.CEIL = 'ceil';
156
+ exports.CHI = 'Chi';
157
+ exports.CI = 'Ci';
158
+ exports.CONJUGATE = 'conjugate';
159
+ exports.CONTAINS = 'contains';
160
+ exports.CONTENT = 'content';
161
+ exports.COUNT = 'count';
162
+ exports.CROSS = 'cross';
163
+ exports.DEFINT = 'defint';
164
+ exports.DEG = 'deg';
165
+ exports.DIFF = 'diff';
166
+ exports.DOT_PRODUCT = 'dot';
167
+ exports.EI = 'Ei';
168
+ exports.ERF = 'erf';
169
+ exports.FACTOR = 'factor';
170
+ exports.FLOOR = 'floor';
171
+ exports.FRESNEL_C = 'C';
172
+ exports.FRESNEL_S = 'S';
173
+ exports.GCD = 'gcd';
174
+ exports.ILAPLACE = 'ilaplace';
175
+ exports.IMAGPART = 'imagpart';
176
+ exports.IMATRIX = 'imatrix';
177
+ exports.INTEGRATE = 'integrate';
178
+ exports.ISPRIME = 'isprime';
179
+ exports.LAPLACE = 'laplace';
180
+ exports.LI = 'Li';
181
+ exports.LIMIT = 'limit';
182
+ exports.LN = 'ln';
183
+ exports.MAX = 'max';
184
+ exports.MIN = 'min';
185
+ exports.NTHROOT = 'nthroot';
186
+ exports.PRODUCT_FUNCTION = 'product';
187
+ exports.REALPART = 'realpart';
188
+ exports.ROUND = 'round';
189
+ exports.SIZE = 'size';
190
+ exports.TRUNC = 'trunc';
191
+ exports.SHI = 'Shi';
192
+ exports.SI = 'Si';
193
+ exports.SINC = 'sinc';
194
+ exports.SUM_FUNCTION = 'sum';
195
+ // Trigonometric functions
196
+ exports.TRIG_FUNCTION_NAMES = {
197
+ COS: 'cos',
198
+ SIN: 'sin',
199
+ TAN: 'tan',
200
+ SEC: 'sec',
201
+ CSC: 'csc',
202
+ COT: 'cot',
203
+ ACOS: 'acos',
204
+ ASIN: 'asin',
205
+ ATAN: 'atan',
206
+ ASEC: 'asec',
207
+ ACSC: 'acsc',
208
+ ACOT: 'acot',
209
+ ATAN2: 'atan2',
210
+ SINH: 'sinh',
211
+ COSH: 'cosh',
212
+ TANH: 'tanh',
213
+ SECH: 'sech',
214
+ CSCH: 'csch',
215
+ COTH: 'coth',
216
+ ACOSH: 'acosh',
217
+ ASINH: 'asinh',
218
+ ATANH: 'atanh',
219
+ ASECH: 'asech',
220
+ ACSCH: 'acsch',
221
+ ACOTH: 'acoth',
222
+ };
223
+ exports.COS = exports.TRIG_FUNCTION_NAMES.COS, exports.SIN = exports.TRIG_FUNCTION_NAMES.SIN, exports.TAN = exports.TRIG_FUNCTION_NAMES.TAN, exports.ASIN = exports.TRIG_FUNCTION_NAMES.ASIN, exports.ACOS = exports.TRIG_FUNCTION_NAMES.ACOS, exports.SEC = exports.TRIG_FUNCTION_NAMES.SEC, exports.CSC = exports.TRIG_FUNCTION_NAMES.CSC, exports.COT = exports.TRIG_FUNCTION_NAMES.COT, exports.ATAN = exports.TRIG_FUNCTION_NAMES.ATAN, exports.ASEC = exports.TRIG_FUNCTION_NAMES.ASEC, exports.ACSC = exports.TRIG_FUNCTION_NAMES.ACSC, exports.ACOT = exports.TRIG_FUNCTION_NAMES.ACOT, exports.ATAN2 = exports.TRIG_FUNCTION_NAMES.ATAN2, exports.SINH = exports.TRIG_FUNCTION_NAMES.SINH, exports.COSH = exports.TRIG_FUNCTION_NAMES.COSH, exports.TANH = exports.TRIG_FUNCTION_NAMES.TANH, exports.SECH = exports.TRIG_FUNCTION_NAMES.SECH, exports.CSCH = exports.TRIG_FUNCTION_NAMES.CSCH, exports.COTH = exports.TRIG_FUNCTION_NAMES.COTH, exports.ACOSH = exports.TRIG_FUNCTION_NAMES.ACOSH, exports.ASINH = exports.TRIG_FUNCTION_NAMES.ASINH, exports.ATANH = exports.TRIG_FUNCTION_NAMES.ATANH, exports.ASECH = exports.TRIG_FUNCTION_NAMES.ASECH, exports.ACSCH = exports.TRIG_FUNCTION_NAMES.ACSCH, exports.ACOTH = exports.TRIG_FUNCTION_NAMES.ACOTH;
224
+ exports.TRIG = [exports.COS, exports.SIN, exports.TAN, exports.SEC, exports.CSC, exports.COT];
225
+ exports.INVERSE_TRIG = [exports.ACOS, exports.ASIN, exports.ATAN, exports.ASEC, exports.ACSC, exports.ACOT];
226
+ exports.HYPERBOLIC_TRIG = [exports.COSH, exports.SINH, exports.TANH, exports.SECH, exports.CSCH, exports.COTH];
227
+ exports.INVERSE_HYPERBOLIC_TRIG = [exports.ACOSH, exports.ASINH, exports.ATANH, exports.ASECH, exports.ACSCH, exports.ACOTH];
@@ -0,0 +1,21 @@
1
+ import { scopedBlock } from '../../Settings';
2
+ import { Expression } from '../expression/Expression';
3
+ import type { ExpressionInput, StructuredEntityType } from '../../types';
4
+ import type { ParserValuesObject } from './types';
5
+ export { scopedBlock };
6
+ /**
7
+ * Forces the expression to be evaluated
8
+ *
9
+ * @param expression The expression to be evaluated
10
+ * @param values The values to be substituted
11
+ * @returns
12
+ */
13
+ export declare function evaluate(expression: string, values?: ParserValuesObject): import("../../types").ParserEntity;
14
+ export declare function inert(expression: string): import("../../types").ParserEntity;
15
+ export declare function _(expr: ExpressionInput): Expression;
16
+ /**
17
+ * Returns true if the object is a structured entity
18
+ * @param obj
19
+ * @returns
20
+ */
21
+ export declare function isStructuredEntity(obj: unknown): obj is StructuredEntityType;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.scopedBlock = void 0;
4
+ exports.evaluate = evaluate;
5
+ exports.inert = inert;
6
+ exports._ = _;
7
+ exports.isStructuredEntity = isStructuredEntity;
8
+ const Settings_1 = require("../../Settings");
9
+ Object.defineProperty(exports, "scopedBlock", { enumerable: true, get: function () { return Settings_1.scopedBlock; } });
10
+ const Expression_1 = require("../expression/Expression");
11
+ const Parser_1 = require("./Parser");
12
+ /**
13
+ * Forces the expression to be evaluated
14
+ *
15
+ * @param expression The expression to be evaluated
16
+ * @param values The values to be substituted
17
+ * @returns
18
+ */
19
+ function evaluate(expression, values) {
20
+ return Parser_1.Parser.evaluate(expression, values);
21
+ }
22
+ function inert(expression) {
23
+ return (0, Settings_1.scopedBlock)('EVALUATE', false, () => {
24
+ return (0, Settings_1.scopedBlock)('SUBSTITUTE', false, () => {
25
+ return Parser_1.Parser.parse(expression);
26
+ });
27
+ });
28
+ }
29
+ function _(expr) {
30
+ return Expression_1.Expression.create(expr);
31
+ }
32
+ /**
33
+ * Returns true if the object is a structured entity
34
+ * @param obj
35
+ * @returns
36
+ */
37
+ function isStructuredEntity(obj) {
38
+ if (typeof obj === 'undefined') {
39
+ return false;
40
+ }
41
+ return obj.isEnumerable;
42
+ }
@@ -0,0 +1,15 @@
1
+ import { Expression } from '../../expression/Expression';
2
+ export declare function add(a: Expression, b: Expression): Expression;
3
+ export declare function addPrefix(a: Expression): Expression;
4
+ /**
5
+ * This method is not designed for cases where a = b; This should be handled before getting here.
6
+ * This method only does element wise addition for powers of 1. For all else it just creates a new expression
7
+ * and puts them in a new container.
8
+ *
9
+ * @param a
10
+ * @param b
11
+ * @param action
12
+ * @param skipAction
13
+ * @returns
14
+ */
15
+ export declare function join(a: Expression, b: Expression, isGroup?: boolean): Expression;