Compare commits

..

10 Commits

Author SHA1 Message Date
Chris Wanstrath
de30d85304 prelude tests 2025-10-28 13:11:12 -07:00
339127e692 need you 2025-10-28 13:11:12 -07:00
1ec53c3b45 use module 2025-10-28 13:11:12 -07:00
2163527219 native -> global 2025-10-28 13:11:12 -07:00
c8362e106d no valueFunctions 2025-10-28 13:10:25 -07:00
59fe509889 update-reef command 2025-10-28 13:10:25 -07:00
b3fa23bd0f better echo 2025-10-28 13:10:25 -07:00
e7352cec2e start on a prelude of builtin functions 2025-10-28 13:10:25 -07:00
Chris Wanstrath
7a4affd01e globals, not global functions 2025-10-28 13:08:51 -07:00
Chris Wanstrath
20e2dd3b31 update reef 2025-10-28 13:06:54 -07:00
3 changed files with 6 additions and 6 deletions

View File

@ -62,7 +62,7 @@
"hono": ["hono@4.9.8", "", {}, "sha512-JW8Bb4RFWD9iOKxg5PbUarBYGM99IcxFl2FPBo2gSJO11jjUDqlP1Bmfyqt8Z/dGhIQ63PMA9LdcLefXyIasyg=="], "hono": ["hono@4.9.8", "", {}, "sha512-JW8Bb4RFWD9iOKxg5PbUarBYGM99IcxFl2FPBo2gSJO11jjUDqlP1Bmfyqt8Z/dGhIQ63PMA9LdcLefXyIasyg=="],
"reefvm": ["reefvm@git+https://git.nose.space/defunkt/reefvm#97b6722a113417398a1c47d583bfe07a906f87a0", { "peerDependencies": { "typescript": "^5" } }, "97b6722a113417398a1c47d583bfe07a906f87a0"], "reefvm": ["reefvm@git+https://git.nose.space/defunkt/reefvm#e54207067734d2186cd788c3654b675b493c2585", { "peerDependencies": { "typescript": "^5" } }, "e54207067734d2186cd788c3654b675b493c2585"],
"style-mod": ["style-mod@4.1.2", "", {}, "sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw=="], "style-mod": ["style-mod@4.1.2", "", {}, "sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw=="],

View File

@ -13,12 +13,12 @@
"update-reef": "cd packages/ReefVM && git pull origin main" "update-reef": "cd packages/ReefVM && git pull origin main"
}, },
"dependencies": { "dependencies": {
"reefvm": "git+https://git.nose.space/defunkt/reefvm",
"@codemirror/view": "^6.38.3", "@codemirror/view": "^6.38.3",
"@lezer/generator": "^1.8.0", "@lezer/generator": "^1.8.0",
"bun-plugin-tailwind": "^0.0.15", "bun-plugin-tailwind": "^0.0.15",
"codemirror": "^6.0.2", "codemirror": "^6.0.2",
"hono": "^4.9.8", "hono": "^4.9.8",
"reefvm": "git+https://git.nose.space/defunkt/reefvm",
"tailwindcss": "^4.1.11" "tailwindcss": "^4.1.11"
}, },
"devDependencies": { "devDependencies": {

View File

@ -3,7 +3,7 @@ import { parser } from '#parser/shrimp'
import { $ } from 'bun' import { $ } from 'bun'
import { assert, errorMessage } from '#utils/utils' import { assert, errorMessage } from '#utils/utils'
import { Compiler } from '#compiler/compiler' import { Compiler } from '#compiler/compiler'
import { run, VM, type TypeScriptFunction } from 'reefvm' import { run, VM } from 'reefvm'
import { treeToString, VMResultToValue } from '#utils/tree' import { treeToString, VMResultToValue } from '#utils/tree'
const regenerateParser = async () => { const regenerateParser = async () => {
@ -33,7 +33,7 @@ declare module 'bun:test' {
toMatchTree(expected: string): T toMatchTree(expected: string): T
toMatchExpression(expected: string): T toMatchExpression(expected: string): T
toFailParse(): T toFailParse(): T
toEvaluateTo(expected: unknown, globalFunctions?: Record<string, TypeScriptFunction>): Promise<T> toEvaluateTo(expected: unknown, globals?: Record<string, any>): Promise<T>
toFailEvaluation(): Promise<T> toFailEvaluation(): Promise<T>
} }
} }
@ -96,13 +96,13 @@ expect.extend({
async toEvaluateTo( async toEvaluateTo(
received: unknown, received: unknown,
expected: unknown, expected: unknown,
globalFunctions: Record<string, TypeScriptFunction> = {} globals: Record<string, any> = {}
) { ) {
assert(typeof received === 'string', 'toEvaluateTo can only be used with string values') assert(typeof received === 'string', 'toEvaluateTo can only be used with string values')
try { try {
const compiler = new Compiler(received) const compiler = new Compiler(received)
const result = await run(compiler.bytecode, globalFunctions) const result = await run(compiler.bytecode, globals)
let value = VMResultToValue(result) let value = VMResultToValue(result)
// Just treat regex as strings for comparison purposes // Just treat regex as strings for comparison purposes