mirror of
https://github.com/42wim/matterbridge.git
synced 2024-11-16 00:49:26 +01:00
20 lines
358 B
Go
20 lines
358 B
Go
|
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
|
||
|
}
|