Merge branch 'Umur-reducer-dev' into reducer-dev
packages/squiggle-lang/__tests__/Reducer/Reducer_Peggy/Reducer_Peggy_Parse_test.res packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.js packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.peggy
This commit is contained in:
commit
08c73ac22f
|
@ -11,3 +11,4 @@ packages/squiggle-lang/.nyc_output/
|
||||||
packages/squiggle-lang/coverage/
|
packages/squiggle-lang/coverage/
|
||||||
packages/squiggle-lang/.cache/
|
packages/squiggle-lang/.cache/
|
||||||
packages/website/build/
|
packages/website/build/
|
||||||
|
packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.js
|
||||||
|
|
|
@ -19,13 +19,13 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/plugin-proposal-private-property-in-object": "^7.17.12",
|
"@babel/plugin-proposal-private-property-in-object": "^7.17.12",
|
||||||
"@storybook/addon-actions": "^6.5.3",
|
"@storybook/addon-actions": "^6.5.3",
|
||||||
"@storybook/addon-essentials": "^6.5.3",
|
"@storybook/addon-essentials": "^6.5.4",
|
||||||
"@storybook/addon-links": "^6.5.3",
|
"@storybook/addon-links": "^6.5.4",
|
||||||
"@storybook/builder-webpack5": "^6.5.3",
|
"@storybook/builder-webpack5": "^6.5.3",
|
||||||
"@storybook/manager-webpack5": "^6.5.3",
|
"@storybook/manager-webpack5": "^6.5.4",
|
||||||
"@storybook/node-logger": "^6.4.22",
|
"@storybook/node-logger": "^6.5.4",
|
||||||
"@storybook/preset-create-react-app": "^4.1.0",
|
"@storybook/preset-create-react-app": "^4.1.0",
|
||||||
"@storybook/react": "^6.5.3",
|
"@storybook/react": "^6.5.4",
|
||||||
"@testing-library/jest-dom": "^5.16.4",
|
"@testing-library/jest-dom": "^5.16.4",
|
||||||
"@testing-library/react": "^13.2.0",
|
"@testing-library/react": "^13.2.0",
|
||||||
"@testing-library/user-event": "^14.2.0",
|
"@testing-library/user-event": "^14.2.0",
|
||||||
|
|
1
packages/squiggle-lang/.gitignore
vendored
1
packages/squiggle-lang/.gitignore
vendored
|
@ -21,3 +21,4 @@ dist
|
||||||
_coverage
|
_coverage
|
||||||
coverage
|
coverage
|
||||||
.nyc_output/
|
.nyc_output/
|
||||||
|
src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.js
|
||||||
|
|
|
@ -5,3 +5,4 @@ lib
|
||||||
.nyc_output/
|
.nyc_output/
|
||||||
coverage/
|
coverage/
|
||||||
.cache/
|
.cache/
|
||||||
|
Reducer_Peggy_GeneratedParser.js
|
||||||
|
|
|
@ -252,11 +252,8 @@ describe("Peggy parse", () => {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
describe("unit", () => {
|
describe("unit", () => {
|
||||||
testParse("1m", "{(::multiply 1 (::$valueOfUnit 'm'))}")
|
testParse("1m", "{(::fromUnit_m 1)}")
|
||||||
testParse(
|
testParse("1m+2cm", "{(::add (::fromUnit_m 1) (::fromUnit_cm 2))}")
|
||||||
"1m+2cm",
|
|
||||||
"{(::add (::multiply 1 (::$valueOfUnit 'm')) (::multiply 2 (::$valueOfUnit 'cm')))}",
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"peggy": "peggy --cache",
|
"peggy": "peggy --cache",
|
||||||
"build:peggy": "find . -type f -name *.peggy -exec yarn run peggy {} \\;",
|
"build": "yarn build:peggy && yarn build:rescript && yarn build:typescript",
|
||||||
"build": "yarn build:rescript && yarn build:typescript",
|
"build:peggy": "find . -type f -name *.peggy -exec yarn peggy {} \\;",
|
||||||
"build:rescript": "rescript build -with-deps",
|
"build:rescript": "rescript build -with-deps",
|
||||||
"build:typescript": "tsc",
|
"build:typescript": "tsc",
|
||||||
"bundle": "webpack",
|
"bundle": "webpack",
|
||||||
|
@ -61,7 +61,7 @@
|
||||||
"rescript-fast-check": "^1.1.1",
|
"rescript-fast-check": "^1.1.1",
|
||||||
"ts-jest": "^27.1.4",
|
"ts-jest": "^27.1.4",
|
||||||
"ts-loader": "^9.3.0",
|
"ts-loader": "^9.3.0",
|
||||||
"ts-node": "^10.7.0",
|
"ts-node": "^10.8.0",
|
||||||
"typescript": "^4.6.3",
|
"typescript": "^4.6.3",
|
||||||
"webpack": "^5.72.1",
|
"webpack": "^5.72.1",
|
||||||
"webpack-cli": "^4.9.2"
|
"webpack-cli": "^4.9.2"
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -267,8 +267,7 @@ number = number:(float / integer) unit:identifier?
|
||||||
if (unit === null)
|
if (unit === null)
|
||||||
{ return number }
|
{ return number }
|
||||||
else
|
else
|
||||||
{ return makeFunctionCall('multiply',
|
{ return makeFunctionCall('fromUnit_'+unit.value, [number])
|
||||||
[number, makeFunctionCall('$valueOfUnit', [nodeString(unit.value)])])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user