From 84a2ae26b17e88b738a55b3f8b987b3c814b75e8 Mon Sep 17 00:00:00 2001 From: Brad Nelson Date: Sat, 6 Feb 2021 15:12:02 -0800 Subject: [PATCH] Added vlist --- ueforth/common/vocabulary.fs | 2 ++ ueforth/common/vocabulary_tests.fs | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/ueforth/common/vocabulary.fs b/ueforth/common/vocabulary.fs index 7b79887..1573498 100644 --- a/ueforth/common/vocabulary.fs +++ b/ueforth/common/vocabulary.fs @@ -2,3 +2,5 @@ : forth [ current @ ] literal context ! ; : vocabulary ( "name" ) create 0 , current @ 2 cells + , does> cell+ context ! ; : definitions context @ current ! ; +: vlist 0 context @ @ begin onlines dup see. >link dup 0= if 2drop cr exit then + dup >name nip 0= until 2drop cr ; diff --git a/ueforth/common/vocabulary_tests.fs b/ueforth/common/vocabulary_tests.fs index 858b157..4d6a981 100644 --- a/ueforth/common/vocabulary_tests.fs +++ b/ueforth/common/vocabulary_tests.fs @@ -7,7 +7,18 @@ e: test-vocabularies foo test bar test foo test + forth definitions out: AAAA out: BBBB out: AAAA ;e + +e: test-vlist + vocabulary foo + foo definitions + : pig ; : cow ; : sheep ; + forth definitions + foo vlist + forth definitions + out: sheep cow pig +;e