summaryrefslogtreecommitdiff
path: root/src/tparse
diff options
context:
space:
mode:
Diffstat (limited to 'src/tparse')
-rw-r--r--src/tparse/tokenize.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/tparse/tokenize.go b/src/tparse/tokenize.go
index 8a79b04..7f57576 100644
--- a/src/tparse/tokenize.go
+++ b/src/tparse/tokenize.go
@@ -26,16 +26,22 @@ import (
// Read in a number (may be a float)
func numericLiteral(r *bufio.Reader, line int, char *int) Token {
- decimal := false
+ decimal, base := false, false
run, _, err := r.ReadRune()
last := *char
b := strings.Builder{}
for ; err == nil; run, _, err = r.ReadRune() {
- if (run == '.') && !decimal {
+ if (run == '.') && !decimal && !base {
decimal = true
- } else if !unicode.IsNumber(run) {
+ } else if (run == '.') && (decimal || base) {
break
+ } else if !unicode.IsNumber(run) {
+ if decimal || checkResRune(run) != -1 || unicode.IsSpace(run) {
+ break
+ } else if !base {
+ base = true
+ }
}
*char++
b.WriteRune(run)