1
0
mirror of https://github.com/danog/liquid.git synced 2025-01-23 02:21:15 +01:00
liquid/tokens.go
2017-06-25 16:21:31 -04:00

29 lines
342 B
Go

package main
import (
"fmt"
"reflect"
)
type Token struct {
t int
s string
v interface{}
}
const (
IdentifierType = iota
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)
}
}