Minor cleanup
This commit is contained in:
parent
949b57c426
commit
4b99e0135e
|
@ -21,9 +21,7 @@ type t = expression
|
||||||
Converts a Squigle code to expression
|
Converts a Squigle code to expression
|
||||||
*/
|
*/
|
||||||
let parse = (peggyCode: string): result<t, errorValue> =>
|
let parse = (peggyCode: string): result<t, errorValue> =>
|
||||||
peggyCode
|
peggyCode->Reducer_Peggy_Parse.parse->Result.map(Reducer_Peggy_ToExpression.fromNode)
|
||||||
->Reducer_Peggy_Parse.parse
|
|
||||||
->Result.map(node => Reducer_Peggy_ToExpression.fromNode(node))
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Recursively evaluate/reduce the expression (Lisp AST)
|
Recursively evaluate/reduce the expression (Lisp AST)
|
||||||
|
|
|
@ -87,7 +87,7 @@ let toStringResult = x =>
|
||||||
| Error(m) => `Error(${ErrorValue.errorToString(m)})`
|
| Error(m) => `Error(${ErrorValue.errorToString(m)})`
|
||||||
}
|
}
|
||||||
|
|
||||||
let toStringResultOkless = codeResult =>
|
let toStringResultOkless = (codeResult: result<expressionValue, ErrorValue.errorValue>): string =>
|
||||||
switch codeResult {
|
switch codeResult {
|
||||||
| Ok(a) => toString(a)
|
| Ok(a) => toString(a)
|
||||||
| Error(m) => `Error(${ErrorValue.errorToString(m)})`
|
| Error(m) => `Error(${ErrorValue.errorToString(m)})`
|
||||||
|
@ -105,7 +105,7 @@ type environment = DistributionOperation.env
|
||||||
@genType
|
@genType
|
||||||
let defaultEnvironment: environment = DistributionOperation.defaultEnv
|
let defaultEnvironment: environment = DistributionOperation.defaultEnv
|
||||||
|
|
||||||
type expresionValueType =
|
type expressionValueType =
|
||||||
| EvtArray
|
| EvtArray
|
||||||
| EvtArrayString
|
| EvtArrayString
|
||||||
| EvtBool
|
| EvtBool
|
||||||
|
@ -117,9 +117,9 @@ type expresionValueType =
|
||||||
| EvtString
|
| EvtString
|
||||||
| EvtSymbol
|
| EvtSymbol
|
||||||
|
|
||||||
type functionCallSignature = CallSignature(string, array<expresionValueType>)
|
type functionCallSignature = CallSignature(string, array<expressionValueType>)
|
||||||
type functionDefinitionSignature =
|
type functionDefinitionSignature =
|
||||||
FunctionDefinitionSignature(functionCallSignature, expresionValueType)
|
FunctionDefinitionSignature(functionCallSignature, expressionValueType)
|
||||||
|
|
||||||
let valueToValueType = value =>
|
let valueToValueType = value =>
|
||||||
switch value {
|
switch value {
|
||||||
|
@ -140,7 +140,7 @@ let functionCallToCallSignature = (functionCall: functionCall): functionCallSign
|
||||||
CallSignature(fn, args->Js.Array2.map(valueToValueType))
|
CallSignature(fn, args->Js.Array2.map(valueToValueType))
|
||||||
}
|
}
|
||||||
|
|
||||||
let valueTypeToString = (valueType: expresionValueType): string =>
|
let valueTypeToString = (valueType: expressionValueType): string =>
|
||||||
switch valueType {
|
switch valueType {
|
||||||
| EvtArray => `Array`
|
| EvtArray => `Array`
|
||||||
| EvtArrayString => `ArrayString`
|
| EvtArrayString => `ArrayString`
|
||||||
|
|
|
@ -4295,7 +4295,7 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/react" "*"
|
"@types/react" "*"
|
||||||
|
|
||||||
"@types/react@*", "@types/react@^18.0.9":
|
"@types/react@*", "@types/react@^18.0.1", "@types/react@^18.0.9":
|
||||||
version "18.0.9"
|
version "18.0.9"
|
||||||
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.9.tgz#d6712a38bd6cd83469603e7359511126f122e878"
|
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.0.9.tgz#d6712a38bd6cd83469603e7359511126f122e878"
|
||||||
integrity sha512-9bjbg1hJHUm4De19L1cHiW0Jvx3geel6Qczhjd0qY5VKVE2X5+x77YxAepuCwVh4vrgZJdgEJw48zrhRIeF4Nw==
|
integrity sha512-9bjbg1hJHUm4De19L1cHiW0Jvx3geel6Qczhjd0qY5VKVE2X5+x77YxAepuCwVh4vrgZJdgEJw48zrhRIeF4Nw==
|
||||||
|
@ -14522,7 +14522,7 @@ react-vega@^7.5.1:
|
||||||
prop-types "^15.8.1"
|
prop-types "^15.8.1"
|
||||||
vega-embed "^6.5.1"
|
vega-embed "^6.5.1"
|
||||||
|
|
||||||
react@^18.1.0:
|
react@^18.0.0, react@^18.1.0:
|
||||||
version "18.1.0"
|
version "18.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/react/-/react-18.1.0.tgz#6f8620382decb17fdc5cc223a115e2adbf104890"
|
resolved "https://registry.yarnpkg.com/react/-/react-18.1.0.tgz#6f8620382decb17fdc5cc223a115e2adbf104890"
|
||||||
integrity sha512-4oL8ivCz5ZEPyclFQXaNksK3adutVS8l2xzZU0cqEFrE9Sb7fC0EFK5uEk74wIreL1DERyjvsU915j1pcT2uEQ==
|
integrity sha512-4oL8ivCz5ZEPyclFQXaNksK3adutVS8l2xzZU0cqEFrE9Sb7fC0EFK5uEk74wIreL1DERyjvsU915j1pcT2uEQ==
|
||||||
|
|
Loading…
Reference in New Issue
Block a user