q/src/build/token/Token.go

16 lines
377 B
Go

package token
// Token represents a single element in a source file.
// The characters that make up an identifier are grouped into a single token.
// This makes parsing easier and allows us to do better syntax checks.
type Token struct {
Kind Kind
Position int
Bytes []byte
}
// Text returns the token text.
func (t Token) Text() string {
return string(t.Bytes)
}