This commit is contained in:
Remko Tronçon 2022-06-01 20:57:16 +02:00
parent 68a98836ab
commit d2fee658dd
4 changed files with 430 additions and 402 deletions

File diff suppressed because it is too large Load diff

View file

@ -479,20 +479,20 @@ T{ : VD3 VAL3 LITERAL ; VD3 -> 123 }T
\ T{ : CS6 CASE 1 OF ENDOF 2 ENDCASE ; 1 CS6 -> }T \ T{ : CS6 CASE 1 OF ENDOF 2 ENDCASE ; 1 CS6 -> }T
\ T{ : CS7 CASE 3 OF ENDOF 2 ENDCASE ; 1 CS7 -> 1 }T \ T{ : CS7 CASE 3 OF ENDOF 2 ENDCASE ; 1 CS7 -> 1 }T
\ \ ----------------------------------------------------------------------------- \ -----------------------------------------------------------------------------
\ TESTING :NONAME RECURSE TESTING :NONAME RECURSE
\ VARIABLE NN1 VARIABLE NN1
\ VARIABLE NN2 VARIABLE NN2
\ :NONAME 1234 ; NN1 ! :NONAME 1234 ; NN1 !
\ :NONAME 9876 ; NN2 ! :NONAME 9876 ; NN2 !
\ T{ NN1 @ EXECUTE -> 1234 }T T{ NN1 @ EXECUTE -> 1234 }T
\ T{ NN2 @ EXECUTE -> 9876 }T T{ NN2 @ EXECUTE -> 9876 }T
\ T{ :NONAME ( n -- 0,1,..n ) DUP IF DUP >R 1- RECURSE R> THEN ; T{ :NONAME ( n -- 0,1,..n ) DUP IF DUP >R 1- RECURSE R> THEN ;
\ CONSTANT RN1 -> }T CONSTANT RN1 -> }T
\ T{ 0 RN1 EXECUTE -> 0 }T T{ 0 RN1 EXECUTE -> 0 }T
\ T{ 4 RN1 EXECUTE -> 0 1 2 3 4 }T T{ 4 RN1 EXECUTE -> 0 1 2 3 4 }T
\ :NONAME ( n -- n1 ) \ Multiple RECURSEs in one definition \ :NONAME ( n -- n1 ) \ Multiple RECURSEs in one definition
\ 1- DUP \ 1- DUP

View file

@ -193,9 +193,9 @@ T{ 123 CONSTANT IW1 IMMEDIATE IW1 -> 123 }T
T{ : IW2 IW1 LITERAL ; IW2 -> 123 }T T{ : IW2 IW1 LITERAL ; IW2 -> 123 }T
T{ VARIABLE IW3 IMMEDIATE 234 IW3 ! IW3 @ -> 234 }T T{ VARIABLE IW3 IMMEDIATE 234 IW3 ! IW3 @ -> 234 }T
T{ : IW4 IW3 [ @ ] LITERAL ; IW4 -> 234 }T T{ : IW4 IW3 [ @ ] LITERAL ; IW4 -> 234 }T
\ T{ :NONAME [ 345 ] IW3 [ ! ] ; DROP IW3 @ -> 345 }T T{ :NONAME [ 345 ] IW3 [ ! ] ; DROP IW3 @ -> 345 }T
T{ CREATE IW5 456 , IMMEDIATE -> }T T{ CREATE IW5 456 , IMMEDIATE -> }T
\ T{ :NONAME IW5 [ @ IW3 ! ] ; DROP IW3 @ -> 456 }T T{ :NONAME IW5 [ @ IW3 ! ] ; DROP IW3 @ -> 456 }T
T{ : IW6 CREATE , IMMEDIATE DOES> @ 1+ ; -> }T T{ : IW6 CREATE , IMMEDIATE DOES> @ 1+ ; -> }T
T{ 111 IW6 IW7 IW7 -> 112 }T T{ 111 IW6 IW7 IW7 -> 112 }T
T{ : IW8 IW7 LITERAL 1+ ; IW8 -> 113 }T T{ : IW8 IW7 LITERAL 1+ ; IW8 -> 113 }T

View file

@ -1571,6 +1571,13 @@ function loadTests() {
}); });
}); });
describe(":NONAME", () => {
it("should work", () => {
run(":NONAME 1234 ; EXECUTE");
expect(stackValues()).to.eql([1234]);
});
});
describe("system", () => { describe("system", () => {
it("should run sieve", () => { it("should run sieve", () => {
run(sieve); run(sieve);