Small compatibility fix.

This commit is contained in:
Maurice Makaay 2019-07-20 17:41:59 +00:00
parent 35e4c9411c
commit 5815a93a01
1 changed files with 3 additions and 3 deletions

View File

@ -219,7 +219,7 @@ func BuildGrammar() tokenize.Handler {
R("float", c.Any( R("float", c.Any(
tok.Float64("float", G("standard-float")), tok.Float64("float", G("standard-float")),
tok.ByCallback("float", G("inf-float"), func(t *tokenize.API) interface{} { tok.ByCallback("float", G("inf-float"), func(t *tokenize.API) interface{} {
if t.Rune(0) == '-' { if t.Output.Rune(0) == '-' {
return math.Inf(-1) return math.Inf(-1)
} }
return math.Inf(+1) return math.Inf(+1)
@ -264,11 +264,11 @@ func BuildGrammar() tokenize.Handler {
makeDateTimeValue := func(t *tokenize.API) interface{} { makeDateTimeValue := func(t *tokenize.API) interface{} {
layout := "" layout := ""
input := "" input := ""
for _, t := range t.Tokens() { for _, t := range t.Output.Tokens() {
layout += t.Type.(string) layout += t.Type.(string)
input += t.Value.(string) input += t.Value.(string)
} }
t.ClearTokens() t.Output.ClearTokens()
value, err := time.Parse(layout, input) value, err := time.Parse(layout, input)
if err != nil { if err != nil {
panic(fmt.Sprintf("Ow, we must implement a way to report date parse errors: %s", err)) panic(fmt.Sprintf("Ow, we must implement a way to report date parse errors: %s", err))