blob: 3bfbbde775f67a1a09c0496bef39bf79a03c1386 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package lexer
// FlagExpiration indicates that `expiration` is supported as a first-class
// feature in the schema.
const FlagExpiration = "expiration"
type transformer func(lexeme Lexeme) (Lexeme, bool)
// Flags is a map of flag names to their corresponding transformers.
var Flags = map[string]transformer{
FlagExpiration: func(lexeme Lexeme) (Lexeme, bool) {
// `expiration` becomes a keyword.
if lexeme.Kind == TokenTypeIdentifier && lexeme.Value == "expiration" {
lexeme.Kind = TokenTypeKeyword
return lexeme, true
}
// `and` becomes a keyword.
if lexeme.Kind == TokenTypeIdentifier && lexeme.Value == "and" {
lexeme.Kind = TokenTypeKeyword
return lexeme, true
}
return lexeme, false
},
}
|