add more tests, readme

This commit is contained in:
mhoffm
2021-06-08 23:18:50 +02:00
parent c8afa29760
commit 4cb4f3f142
3 changed files with 63 additions and 0 deletions

View File

@@ -1,3 +1,11 @@
# tree-sitter-hcl # tree-sitter-hcl
WIP tree-sitter grammar for the [HCL](https://github.com/hashicorp/hcl/blob/main/hclsyntax/spec.md) language WIP tree-sitter grammar for the [HCL](https://github.com/hashicorp/hcl/blob/main/hclsyntax/spec.md) language
## developing
It is recommended to use `nix` to fulfill all development dependencies. To activate the development environment simply run `nix-shell` in the project root.
## running tests
To run tests simply run `nix-shell --run 'tree-sitter test'`.

View File

@@ -0,0 +1,34 @@
==================
attribute with literal
==================
foo = "bar"
---
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(literal_value
(string_lit)))))))
==================
attribute with variable
==================
foo = bar
---
(config_file
(body
(attribute
(identifier)
(expression
(expr_term
(variable_expr
(identifier)))))))

View File

@@ -85,3 +85,24 @@ block_1 {
(body (body
(block (block
(identifier)))))) (identifier))))))
==================
nested blocks
==================
block_1 {
block_2 {}
block_3 {}
}
---
(config_file
(body
(block
(identifier)
(body
(block
(identifier))
(block
(identifier))))))