package token import ( "bytes" ) // List is a slice of tokens. type List []Token // String implements string serialization. func (list List) String() string { builder := bytes.Buffer{} var last Token for _, t := range list { if last.Kind == Keyword || last.Kind == Separator || last.Kind == Define || t.Kind == Define { builder.WriteByte(' ') } builder.Write(t.Bytes) last = t } return builder.String() }