From ea40290f43d6a6447a60be4554e23c2ce947a7c2 Mon Sep 17 00:00:00 2001 From: lordwelch Date: Tue, 15 May 2018 11:42:59 -0700 Subject: [PATCH] lex.go: separate '.' from identifier --- text/lex/lex.go | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/text/lex/lex.go b/text/lex/lex.go index 82a2f85..526e04b 100644 --- a/text/lex/lex.go +++ b/text/lex/lex.go @@ -362,18 +362,11 @@ func lexInsideAction(l *Lexer) stateFn { // special look-ahead for ".field" so we don't break l.backup(). r = l.peek() if r < '0' || '9' < r { - l.emit(ItemChar) + l.emit(ItemDot) return lexInsideAction } fallthrough // '.' can start a number. - case r == '+' || r == '-' || ('0' <= r && r <= '9'): - if r == '+' || r == '-' { - r := l.peek() - if (r < '0' || '9' < r) && r != '.' { - return lexOperator - } - } - + case '0' <= r && r <= '9': l.backup() return lexNumber case isOperator(r): @@ -439,7 +432,7 @@ func lexIdentifier(l *Lexer) stateFn { Loop: for { switch r := l.next(); { - case isAlphaNumeric(r) || r == '.': + case isAlphaNumeric(r): // absorb. default: l.backup()