1
0
mirror of https://github.com/danog/liquid.git synced 2025-01-23 05:11:30 +01:00
liquid/tokens.go

29 lines
342 B
Go
Raw Normal View History

2017-06-25 12:36:28 -04:00
package main
import (
"fmt"
"reflect"
)
type Token struct {
2017-06-25 16:21:31 -04:00
t int
2017-06-25 12:36:28 -04:00
s string
v interface{}
}
const (
2017-06-25 16:21:31 -04:00
IdentifierType = iota
2017-06-25 12:36:28 -04:00
KeywordType
RelationType
ValueType
)
func (t Token) String() string {
switch t.v {
case nil:
return fmt.Sprintf("%s{%s}", t.t, t.s)
default:
return fmt.Sprintf("%s{%v}", reflect.TypeOf(t.v), t.v)
}
}