blob: fd6e9d0b200806bc64668922e4288c59dda08d33 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
package token
var keywords map[string]Token
func init() {
keywords = make(map[string]Token)
for i := _keywordBeg + 1; i < _keywordEnd; i++ {
keywords[tokens[i]] = i
}
}
// Lookup returns corresponding keyword if ident is a keyword.
func Lookup(ident string) Token {
if tok, isKeyword := keywords[ident]; isKeyword {
return tok
}
return Ident
}
|