summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSuleyman Farajli <suleyman@farajli.net>2025-01-02 23:32:53 +0400
committerSuleyman Farajli <suleyman@farajli.net>2025-01-02 23:32:53 +0400
commit76d1fd80c757ccdc9ae9a6716d1db580344ae848 (patch)
tree6aaef5761710f26f845704d8f04775ca11db9679 /src
parent3f8144ce21f9d17f6d52ebb2d799bd7721677332 (diff)
better error message for invalid words
Diffstat (limited to 'src')
-rw-r--r--src/main.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main.go b/src/main.go
index f68a5f1..f8280f8 100644
--- a/src/main.go
+++ b/src/main.go
@@ -246,7 +246,8 @@ func parse(tokens[]Token) []Operation {
}
if op.name == "" {
- panic ("invalid word")
+ fmt.Fprintf(os.Stderr, "Undefined word `%s` at %d:%d\n", tokens[i].str, tokens[i].line, tokens[i].offset)
+ os.Exit(1)
}
ops = append(ops, op)