summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-09-23 08:55:57 +0200
committerDimitri Sokolyuk <demon@dim13.org>2018-09-23 08:55:57 +0200
commit45a968cb94598074e608c17161d475911f7e0871 (patch)
tree565f72189468435f0f79cf9e1dd4025d17d5b51c
parentc2b63444505a015c8213ccee4078c1d3f07d9503 (diff)
..
-rw-r--r--go/forth/forth.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/go/forth/forth.go b/go/forth/forth.go
index 389036e..5ae7805 100644
--- a/go/forth/forth.go
+++ b/go/forth/forth.go
@@ -130,7 +130,7 @@ func literal(n int) word {
}
}
-func number(s string) (int, bool) {
+func atoi(s string) (int, bool) {
n, err := strconv.Atoi(s)
return n, err == nil
}
@@ -140,7 +140,7 @@ func colon(dict dictionary, l *lexer) error {
return ErrEOL
}
name := l.next()
- if _, ok := number(name); ok {
+ if _, ok := atoi(name); ok {
return ErrWord
}
w, err := compile(dict, l)
@@ -171,7 +171,7 @@ func compile(dict dictionary, l *lexer) ([]word, error) {
continue
}
// try to parse literal
- if n, ok := number(v); ok {
+ if n, ok := atoi(v); ok {
words = append(words, literal(n))
continue
}