mirror of
https://github.com/danog/liquid.git
synced 2025-01-23 02:01:11 +01:00
29 lines
342 B
Go
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)
|
|
}
|
|
}
|