aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/interpreter/main.go8
-rw-r--r--cmd/repl/main.go8
2 files changed, 7 insertions, 9 deletions
diff --git a/cmd/interpreter/main.go b/cmd/interpreter/main.go
index 97c8c25..bd70af3 100644
--- a/cmd/interpreter/main.go
+++ b/cmd/interpreter/main.go
@@ -49,14 +49,12 @@ func main() {
os.Exit(1)
}
- var args *ell.V
- tail := &args
+ var args []ell.V
for i := 2; i < len(os.Args); i++ {
- *tail = ell.NewString(os.Args[i])
- tail = &(*tail).Next
+ args = append(args, *ell.NewString(os.Args[i]))
}
- var result *ell.V
+ var result []ell.V
if !L.EvalBlock(program, args, &result) {
fmt.Printf("%s: %s\n", "runtime error", L.Error)
}
diff --git a/cmd/repl/main.go b/cmd/repl/main.go
index 6d1f421..098452d 100644
--- a/cmd/repl/main.go
+++ b/cmd/repl/main.go
@@ -28,8 +28,8 @@ import (
"janouch.name/ell/ell"
)
-func run(L *ell.Ell, program *ell.V) {
- var result *ell.V
+func run(L *ell.Ell, program []ell.V) {
+ var result []ell.V
if !L.EvalBlock(program, nil, &result) {
fmt.Printf("\x1b[31m%s: %s\x1b[0m\n", "runtime error", L.Error)
L.Error = ""
@@ -48,8 +48,8 @@ func complete(L *ell.Ell, line string, pos int) (
head, line = line[:lastSpace+1], line[lastSpace+1:]
}
- for v := L.Globals; v != nil; v = v.Next {
- name := v.Head.String
+ for _, v := range L.Globals {
+ name := v.List[0].String
if strings.HasPrefix(strings.ToLower(name), line) {
completions = append(completions, name)
}