Ensure full duration values are parsed correctly

This commit is contained in:
Tobie Morgan Hitchcock 2018-08-20 07:32:21 +01:00
parent 05d4d97707
commit de925ae16e
2 changed files with 2 additions and 2 deletions

View file

@ -62,7 +62,7 @@ func TestDefine(t *testing.T) {
txt := `
USE NS test DB test;
DEFINE SCOPE test SESSION 1h
DEFINE SCOPE test SESSION 1h0m0s
SIGNUP AS (
IF $ip IN ["127.0.0.1", "213.172.165.134"] THEN
(CREATE user SET email=$user, pass=bcrypt.generate($pass))

View file

@ -748,7 +748,7 @@ func (s *scanner) scanNumber(chp ...rune) (tok Token, lit string, val interface{
} else if isNumber(ch) {
buf.WriteRune(ch)
} else if isLetter(ch) {
if tok == NUMBER || tok == DOUBLE {
if tok == NUMBER || tok == DOUBLE || tok == DURATION {
tok = IDENT
buf.WriteRune(ch)
switch ch {