diff --git a/lib/core.fs b/lib/core.fs index 956c5ee..297ee6d 100644 --- a/lib/core.fs +++ b/lib/core.fs @@ -40,4 +40,18 @@ end-struct cons-cell% : car first @ ; export : cdr second @ ; export +( === Enum === ) + +\ 0 +\ enum A +\ enum B +\ drop + +\ 0 constant A +\ 1 constant B + +: enum ( n "name" -- n ) + dup constant 1+ +; export + }private diff --git a/test/core.fs b/test/core.fs index c900cd6..8c442bc 100644 --- a/test/core.fs +++ b/test/core.fs @@ -1013,4 +1013,10 @@ T{ cons0 cdr -> 1 }T cons0 free +\ ------------------------------------------------------------------------ +testing enum +T{ 0 enum e0 enum e1 enum e2 drop -> }T +T{ e0 -> 0 }T +T{ e1 -> 1 }T +T{ e2 -> 2 }T