From 45a968cb94598074e608c17161d475911f7e0871 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 23 Sep 2018 08:55:57 +0200 Subject: .. --- go/forth/forth.go | 6 +++--- 1 file 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 } -- cgit v1.2.3