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:
Umur Ozkul 2022-05-23 18:06:06 +02:00
commit 08c73ac22f
9 changed files with 824 additions and 1028 deletions

View File

@ -11,3 +11,4 @@ packages/squiggle-lang/.nyc_output/
packages/squiggle-lang/coverage/
packages/squiggle-lang/.cache/
packages/website/build/
packages/squiggle-lang/src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.js

View File

@ -19,13 +19,13 @@
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "^7.17.12",
"@storybook/addon-actions": "^6.5.3",
"@storybook/addon-essentials": "^6.5.3",
"@storybook/addon-links": "^6.5.3",
"@storybook/addon-essentials": "^6.5.4",
"@storybook/addon-links": "^6.5.4",
"@storybook/builder-webpack5": "^6.5.3",
"@storybook/manager-webpack5": "^6.5.3",
"@storybook/node-logger": "^6.4.22",
"@storybook/manager-webpack5": "^6.5.4",
"@storybook/node-logger": "^6.5.4",
"@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/react": "^13.2.0",
"@testing-library/user-event": "^14.2.0",

View File

@ -21,3 +21,4 @@ dist
_coverage
coverage
.nyc_output/
src/rescript/Reducer/Reducer_Peggy/Reducer_Peggy_GeneratedParser.js

View File

@ -5,3 +5,4 @@ lib
.nyc_output/
coverage/
.cache/
Reducer_Peggy_GeneratedParser.js

View File

@ -252,11 +252,8 @@ describe("Peggy parse", () => {
)
})
describe("unit", () => {
testParse("1m", "{(::multiply 1 (::$valueOfUnit 'm'))}")
testParse(
"1m+2cm",
"{(::add (::multiply 1 (::$valueOfUnit 'm')) (::multiply 2 (::$valueOfUnit 'cm')))}",
)
testParse("1m", "{(::fromUnit_m 1)}")
testParse("1m+2cm", "{(::add (::fromUnit_m 1) (::fromUnit_cm 2))}")
})
})

View File

@ -5,8 +5,8 @@
"license": "MIT",
"scripts": {
"peggy": "peggy --cache",
"build:peggy": "find . -type f -name *.peggy -exec yarn run peggy {} \\;",
"build": "yarn build:rescript && yarn build:typescript",
"build": "yarn build:peggy && yarn build:rescript && yarn build:typescript",
"build:peggy": "find . -type f -name *.peggy -exec yarn peggy {} \\;",
"build:rescript": "rescript build -with-deps",
"build:typescript": "tsc",
"bundle": "webpack",
@ -61,7 +61,7 @@
"rescript-fast-check": "^1.1.1",
"ts-jest": "^27.1.4",
"ts-loader": "^9.3.0",
"ts-node": "^10.7.0",
"ts-node": "^10.8.0",
"typescript": "^4.6.3",
"webpack": "^5.72.1",
"webpack-cli": "^4.9.2"

View File

@ -267,8 +267,7 @@ number = number:(float / integer) unit:identifier?
if (unit === null)
{ return number }
else
{ return makeFunctionCall('multiply',
[number, makeFunctionCall('$valueOfUnit', [nodeString(unit.value)])])
{ return makeFunctionCall('fromUnit_'+unit.value, [number])
}
}

753
yarn.lock

File diff suppressed because it is too large Load Diff