diff --git a/src/waforth.wat b/src/waforth.wat index 1d4382c..57defce 100644 --- a/src/waforth.wat +++ b/src/waforth.wat @@ -1195,6 +1195,12 @@ (i32.store (i32.const !stateBase) (i32.const 0))) (!def_word "[" "$left-bracket" !fImmediate) + ;; 6.1.2510 + (func $bracket-tick + (call $tick) + (call $compilePushConst (call $pop))) + (!def_word "[']" "$bracket-tick" !fImmediate) + ;; 6.1.2540 (func $right-bracket (i32.store (i32.const !stateBase) (i32.const 1))) diff --git a/tests/tests.js b/tests/tests.js index 46686e6..b7ad973 100644 --- a/tests/tests.js +++ b/tests/tests.js @@ -1264,6 +1264,23 @@ function loadTests(wasmModule, arrayToBase64) { }); }); + describe("[']", () => { + beforeEach(() => { + core.loadPrelude(); + }); + + it("should work", () => { + run(': HELLO ." Hello " ;'); + run(': GOODBYE ." Goodbye " ;'); + run("VARIABLE 'aloha ' HELLO 'aloha !"); + run(": ALOHA 'aloha @ EXECUTE ;"); + run(": GOING ['] GOODBYE 'aloha ! ;"); + run("GOING"); + run("ALOHA"); + expect(output.trim()).to.eql("Goodbye"); + }); + }); + describe("system", () => { beforeEach(() => { core.loadPrelude();