refactor how repl works
Some checks failed
Build / build (push) Failing after 5m26s
Publish Image / publish (push) Failing after 45s
Test / build (push) Failing after 5m54s

This commit is contained in:
Chuck Smith
2024-03-28 16:51:54 -04:00
parent fc6ceee02c
commit 244b71d245
32 changed files with 612 additions and 476 deletions

2
internal/testdata/arrays.monkey vendored Normal file
View File

@@ -0,0 +1,2 @@
xs := [1, 2, 3]
xs[0] + xs[1] + xs[2]

3
internal/testdata/assign.monkey vendored Normal file
View File

@@ -0,0 +1,3 @@
x := 1
x = 2
x = x + 1

3
internal/testdata/binding.monkey vendored Normal file
View File

@@ -0,0 +1,3 @@
x := 1
y := 2
z := x

13
internal/testdata/builtins.monkey vendored Normal file
View File

@@ -0,0 +1,13 @@
xs := [1, 2, 3]
len(xs)
first(xs)
rest(xs)
last(xs)
push(xs, 5)
pop(xs)
len("foo")
x := input()
print(x)

2
internal/testdata/closures.monkey vendored Normal file
View File

@@ -0,0 +1,2 @@
f := fn(x) { fn() { x + 1 } }
f(2)

2
internal/testdata/expressions.monkey vendored Normal file
View File

@@ -0,0 +1,2 @@
1 + 2;
(1 + 2) * 3;

2
internal/testdata/functions.monkey vendored Normal file
View File

@@ -0,0 +1,2 @@
f := fn(x, y) { x * y };
f(2, 4)

2
internal/testdata/hashes.monkey vendored Normal file
View File

@@ -0,0 +1,2 @@
d := {"a": 1, "b": 2}
d["a"] + d["b"]

5
internal/testdata/if.monkey vendored Normal file
View File

@@ -0,0 +1,5 @@
x := 1
if (x == 1) {
x = 2
x
}

3
internal/testdata/mod.monkey vendored Normal file
View File

@@ -0,0 +1,3 @@
a := 1
A := 5
Sum := fn(a, b) { return a + b }

5
internal/testdata/selectors.monkey vendored Normal file
View File

@@ -0,0 +1,5 @@
d := {"foo": 1, "bar": 2}
assert(d.foo == 1, "d.foo != 1")
assert(d.bar == 2, "d.bar != 2")
assert(d.bogus == null, "d.bogus != null")

2
internal/testdata/strings.monkey vendored Normal file
View File

@@ -0,0 +1,2 @@
s := "hello"
s + " " + "world"