mirror of
https://github.com/zeroflag/fcl.git
synced 2025-01-11 20:01:10 +01:00
words
This commit is contained in:
parent
74aabb6445
commit
da0a365bcf
1 changed files with 10 additions and 0 deletions
|
@ -16,6 +16,9 @@ import com.vectron.fcl.types.Word;
|
|||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class Fcl {
|
||||
|
@ -364,6 +367,13 @@ public class Fcl {
|
|||
addPrimitive("var:", () -> { String name = word(); dict.add(new Var(dp, name)); dp++; });
|
||||
addPrimitive("val:", () -> { String name = word(); dict.add(new Val(name, stack.pop())); });
|
||||
addPrimitive("abort", () -> { throw new Aborted(stack.pop().asStr().value()); });
|
||||
addPrimitive("words", () -> {
|
||||
List<String> words = new ArrayList(wordList());
|
||||
Collections.sort(words);
|
||||
for (String each : words) {
|
||||
transcript.show(each);
|
||||
transcript.cr();
|
||||
}});
|
||||
addPrimitive("exec", () -> {
|
||||
rstack.push(new Num(ip));
|
||||
innerLoop(pop().intValue());
|
||||
|
|
Loading…
Reference in a new issue