add hcl parser

This commit is contained in:
mhoffm 2021-06-28 19:11:33 +02:00 committed by Stephan Seitz
parent 6d5b4f19f3
commit 9275a15aad
5 changed files with 91 additions and 0 deletions

View file

@ -161,6 +161,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [gomod](https://github.com/camdencheek/tree-sitter-go-mod) (maintained by @camdencheek)
- [x] [graphql](https://github.com/bkegley/tree-sitter-graphql) (maintained by @bkegley)
- [ ] [haskell](https://github.com/tree-sitter/tree-sitter-haskell)
- [x] [hcl](https://github.com/MichaHoffmann/tree-sitter-hcl) (maintained by @MichaHoffmann)
- [x] [html](https://github.com/tree-sitter/tree-sitter-html) (maintained by @TravonteD)
- [x] [java](https://github.com/tree-sitter/tree-sitter-java) (maintained by @p00f)
- [x] [javascript](https://github.com/tree-sitter/tree-sitter-javascript) (maintained by @steelsojka)

View file

@ -77,6 +77,9 @@
"haskell": {
"revision": "a0c1adb59e390f7d839a146c57fdb33d36ed97e6"
},
"hcl": {
"revision": "7d8ecd053a11274a15b0aa1d1e82f37e64edeb42"
},
"html": {
"revision": "d93af487cc75120c89257195e6be46c999c6ba18"
},

View file

@ -348,6 +348,16 @@ list.haskell = {
}
}
list.hcl = {
install_info = {
url = "https://github.com/MichaHoffmann/tree-sitter-hcl",
files = {"src/parser.c", "src/scanner.cc"},
branch = "main"
},
filetype = "hcl",
used_by = {"tf", "tfvars"}
}
-- FIXME(vigoux): markdown is broken for now
-- list.markdown = {
-- install_info = {

5
queries/hcl/folds.scm Normal file
View file

@ -0,0 +1,5 @@
[
(comment)
(block)
(heredoc_template)
] @fold

View file

@ -0,0 +1,72 @@
; highlights.scm
[
"!"
"\*"
"/"
"%"
"\+"
"-"
">"
">="
"<"
"<="
"=="
"!="
"&&"
"||"
] @operator
[
"{"
"}"
"["
"]"
"("
")"
"[*]"
".*"
] @specialChar
[
"."
","
] @specialChar
[
(ellipsis)
"\?"
":"
"=>"
] @special
[
"for"
"in"
] @repeat
[
"if"
] @conditional
[
(string_lit)
(quoted_template)
(heredoc_template)
] @string
(heredoc_identifier) @namespace
(heredoc_start) @namespace
(template_interpolation) @statement
(numeric_lit) @number
(bool_lit) @boolean
(null_lit) @constant
(comment) @comment
(identifier) @identifier
(block (identifier) @namespace)
(function_call (identifier) @function)
(function_call (function_arguments) @parameter)
(attribute (identifier) @symbol)
(ERROR) @error