parse
cmd/compile/internal/syntax (lexer, parser, syntax tree)
一、lexer、parse
- token化
type token uint
//go:generate stringer -type token -linecomment tokens.go
const (
_ token = iota
_EOF
...
)其中有一句:
// Make sure we have at most 64 tokens so we can use them in a set.
const _ uint64 = 1 << (tokenCount - 1)该段代码的目的是确保我们最多只使用 64 个令牌(tokens),以便将它们作为位集合(bit set)使用。