Start mathjs setup
This commit is contained in:
parent
07c6b62060
commit
83cbb00427
@ -11,6 +11,7 @@
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"mathjs": "^10.4.3",
|
||||
"vue": "^3.2.25"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -5,12 +5,14 @@ specifiers:
|
||||
'@typescript-eslint/parser': ^5.18.0
|
||||
'@volar/vue-language-service': ^0.33.9
|
||||
eslint: ^8.13.0
|
||||
mathjs: ^10.4.3
|
||||
typescript: ^4.5.4
|
||||
vite: ^2.9.0
|
||||
vue: ^3.2.25
|
||||
vue-tsc: ^0.33.9
|
||||
|
||||
dependencies:
|
||||
mathjs: 10.4.3
|
||||
vue: 3.2.31
|
||||
|
||||
devDependencies:
|
||||
@ -50,6 +52,13 @@ packages:
|
||||
engines: {node: '>=6.0.0'}
|
||||
hasBin: true
|
||||
|
||||
/@babel/runtime/7.17.9:
|
||||
resolution: {integrity: sha512-lSiBBvodq29uShpWGNbgFdKYNiFDo5/HIYsaCEY9ff4sb10x9jizo2+pRrSyF4jKZCXqgzuqBOQKbUm90gQwJg==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
dependencies:
|
||||
regenerator-runtime: 0.13.9
|
||||
dev: false
|
||||
|
||||
/@babel/types/7.17.0:
|
||||
resolution: {integrity: sha512-TmKSNO4D5rzhL5bjWFcVHHLETzfQ/AmbKpKPOSjlP0WoHZ6L911fgoOKY4Alp/emzG4cHJdyN49zpgkbXFEHHw==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
@ -918,6 +927,10 @@ packages:
|
||||
resolution: {integrity: sha512-GHuDRO12Sypu2cV70d1dkA2EUmXHgntrzbpvOB+Qy+49ypNfGgFQIC2fhhXbnyrJRynDCAARsT7Ou0M6hirpfw==}
|
||||
dev: true
|
||||
|
||||
/complex.js/2.1.0:
|
||||
resolution: {integrity: sha512-RdcrDz7YynXp/YXGwXIZ4MtmxXXniT5WmLFRX93cuXUX+0geWAqB8l1BoLXF+3BkzviVzHlpw27P9ow7MvlcmA==}
|
||||
dev: false
|
||||
|
||||
/concat-map/0.0.1:
|
||||
resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=}
|
||||
dev: true
|
||||
@ -1019,6 +1032,10 @@ packages:
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/decimal.js/10.3.1:
|
||||
resolution: {integrity: sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ==}
|
||||
dev: false
|
||||
|
||||
/decompress-response/3.3.0:
|
||||
resolution: {integrity: sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=}
|
||||
engines: {node: '>=4'}
|
||||
@ -1362,6 +1379,10 @@ packages:
|
||||
esbuild-windows-arm64: 0.14.34
|
||||
dev: true
|
||||
|
||||
/escape-latex/1.2.0:
|
||||
resolution: {integrity: sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw==}
|
||||
dev: false
|
||||
|
||||
/escape-string-regexp/1.0.5:
|
||||
resolution: {integrity: sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=}
|
||||
engines: {node: '>=0.8.0'}
|
||||
@ -1602,6 +1623,10 @@ packages:
|
||||
engines: {node: '>=0.4.x'}
|
||||
dev: true
|
||||
|
||||
/fraction.js/4.2.0:
|
||||
resolution: {integrity: sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==}
|
||||
dev: false
|
||||
|
||||
/fs.realpath/1.0.0:
|
||||
resolution: {integrity: sha1-FQStJSMVjKpA20onh8sBQRmU6k8=}
|
||||
dev: true
|
||||
@ -2040,6 +2065,10 @@ packages:
|
||||
resolution: {integrity: sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=}
|
||||
dev: true
|
||||
|
||||
/javascript-natural-sort/0.7.1:
|
||||
resolution: {integrity: sha1-+eIwPUUH9tdDVac2ZNFED7Wg71k=}
|
||||
dev: false
|
||||
|
||||
/js-stringify/1.0.2:
|
||||
resolution: {integrity: sha1-Fzb939lyTyijaCrcYjCufk6Weds=}
|
||||
dev: true
|
||||
@ -2225,6 +2254,22 @@ packages:
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/mathjs/10.4.3:
|
||||
resolution: {integrity: sha512-C50lWorCOplBec9Ik5fzhHuOx4G4+mtdz3r1G2I1/r8yj+CpYFXLXNqTdg59oKmIF1tKcIzpxlC4s2dGL7f3pg==}
|
||||
engines: {node: '>= 12'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.17.9
|
||||
complex.js: 2.1.0
|
||||
decimal.js: 10.3.1
|
||||
escape-latex: 1.2.0
|
||||
fraction.js: 4.2.0
|
||||
javascript-natural-sort: 0.7.1
|
||||
seedrandom: 3.0.5
|
||||
tiny-emitter: 2.1.0
|
||||
typed-function: 2.1.0
|
||||
dev: false
|
||||
|
||||
/meow/5.0.0:
|
||||
resolution: {integrity: sha512-CbTqYU17ABaLefO8vCU153ZZlprKYWDljcndKKDCFcYQITzWCXZAVk4QMFZPgvzrnUQ3uItnIE/LoUOwrT15Ig==}
|
||||
engines: {node: '>=6'}
|
||||
@ -2764,6 +2809,10 @@ packages:
|
||||
strip-indent: 3.0.0
|
||||
dev: true
|
||||
|
||||
/regenerator-runtime/0.13.9:
|
||||
resolution: {integrity: sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==}
|
||||
dev: false
|
||||
|
||||
/regexpp/3.2.0:
|
||||
resolution: {integrity: sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==}
|
||||
engines: {node: '>=8'}
|
||||
@ -2867,6 +2916,10 @@ packages:
|
||||
suf-regex: 0.3.4
|
||||
dev: true
|
||||
|
||||
/seedrandom/3.0.5:
|
||||
resolution: {integrity: sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==}
|
||||
dev: false
|
||||
|
||||
/semver-diff/2.1.0:
|
||||
resolution: {integrity: sha1-S7uEN8jTfksM8aaP1ybsbWRdbTY=}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@ -3114,6 +3167,10 @@ packages:
|
||||
resolution: {integrity: sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=}
|
||||
dev: true
|
||||
|
||||
/tiny-emitter/2.1.0:
|
||||
resolution: {integrity: sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==}
|
||||
dev: false
|
||||
|
||||
/to-fast-properties/2.0.0:
|
||||
resolution: {integrity: sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=}
|
||||
engines: {node: '>=4'}
|
||||
@ -3209,6 +3266,11 @@ packages:
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/typed-function/2.1.0:
|
||||
resolution: {integrity: sha512-bctQIOqx2iVbWGDGPWwIm18QScpu2XRmkC19D8rQGFsjKSgteq/o1hTZvIG/wuDq8fanpBDrLkLq+aEN/6y5XQ==}
|
||||
engines: {node: '>= 10'}
|
||||
dev: false
|
||||
|
||||
/typedarray/0.0.6:
|
||||
resolution: {integrity: sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=}
|
||||
dev: true
|
||||
|
65
src/support/types.ts
Normal file
65
src/support/types.ts
Normal file
@ -0,0 +1,65 @@
|
||||
import {
|
||||
parse,
|
||||
MathNode,
|
||||
AccessorNode,
|
||||
ArrayNode,
|
||||
AssignmentNode,
|
||||
BlockNode,
|
||||
ConditionalNode,
|
||||
ConstantNode,
|
||||
FunctionAssignmentNode,
|
||||
FunctionNode,
|
||||
IndexNode,
|
||||
ObjectNode,
|
||||
OperatorNode,
|
||||
ParenthesisNode,
|
||||
RangeNode,
|
||||
RelationalNode,
|
||||
SymbolNode,
|
||||
} from 'mathjs'
|
||||
|
||||
|
||||
export abstract class MathNodeWalk<TReturn> {
|
||||
abstract walkAccessorNode(node: AccessorNode): TReturn
|
||||
|
||||
abstract walkArrayNode(node: ArrayNode): TReturn
|
||||
|
||||
abstract walkAssignmentNode(node: AssignmentNode): TReturn
|
||||
|
||||
abstract walkBlockNode(node: BlockNode): TReturn
|
||||
|
||||
abstract walkConditionalNode(node: ConditionalNode): TReturn
|
||||
|
||||
abstract walkConstantNode(node: ConstantNode): TReturn
|
||||
|
||||
abstract walkFunctionAssignmentNode(node: FunctionAssignmentNode): TReturn
|
||||
|
||||
abstract walkFunctionNode(node: FunctionNode): TReturn
|
||||
|
||||
abstract walkIndexNode(node: IndexNode): TReturn
|
||||
|
||||
abstract walkObjectNode(node: ObjectNode): TReturn
|
||||
|
||||
abstract walkOperatorNode(node: OperatorNode): TReturn
|
||||
|
||||
abstract walkParenthesisNode(node: ParenthesisNode): TReturn
|
||||
|
||||
abstract walkRangeNode(node: RangeNode): TReturn
|
||||
|
||||
abstract walkRelationalNode(node: RelationalNode): TReturn
|
||||
|
||||
abstract walkSymbolNode(node: SymbolNode): TReturn
|
||||
}
|
||||
|
||||
export class MathStatement {
|
||||
constructor(
|
||||
public readonly raw: string,
|
||||
) {}
|
||||
|
||||
parse(): MathNode {
|
||||
return parse(this.raw)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class MathExpression extends MathStatement {}
|
Loading…
Reference in New Issue
Block a user