add error for unknown chars

This commit is contained in:
Adam Jeniski 2025-11-05 06:28:56 -10:00
parent e906b007de
commit 656bd7dc27

View File

@ -1,6 +1,7 @@
package read package read
import ( import (
"fmt"
"mal-go/hash_map" "mal-go/hash_map"
"mal-go/symbol" "mal-go/symbol"
"mal-go/vector" "mal-go/vector"
@ -47,6 +48,8 @@ func readForm(s string, pos int, ns string) (any, any, int) {
res, err, pos = readVector(s, pos, ns) res, err, pos = readVector(s, pos, ns)
case '(': case '(':
res, err, pos = readList(s, pos, ns) res, err, pos = readList(s, pos, ns)
default:
return nil, "unexpected char: '" + fmt.Sprint(c) + "'", pos
} }
} }
return res, err, pos return res, err, pos