diff options
Diffstat (limited to 'vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/keywords.go')
-rw-r--r-- | vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/keywords.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/keywords.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/keywords.go new file mode 100644 index 0000000..eef8b96 --- /dev/null +++ b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/keywords.go | |||
@@ -0,0 +1,21 @@ | |||
1 | package hclsyntax | ||
2 | |||
3 | import ( | ||
4 | "bytes" | ||
5 | ) | ||
6 | |||
7 | type Keyword []byte | ||
8 | |||
9 | var forKeyword = Keyword([]byte{'f', 'o', 'r'}) | ||
10 | var inKeyword = Keyword([]byte{'i', 'n'}) | ||
11 | var ifKeyword = Keyword([]byte{'i', 'f'}) | ||
12 | var elseKeyword = Keyword([]byte{'e', 'l', 's', 'e'}) | ||
13 | var endifKeyword = Keyword([]byte{'e', 'n', 'd', 'i', 'f'}) | ||
14 | var endforKeyword = Keyword([]byte{'e', 'n', 'd', 'f', 'o', 'r'}) | ||
15 | |||
16 | func (kw Keyword) TokenMatches(token Token) bool { | ||
17 | if token.Type != TokenIdent { | ||
18 | return false | ||
19 | } | ||
20 | return bytes.Equal([]byte(kw), token.Bytes) | ||
21 | } | ||