add more tests, readme
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
# tree-sitter-hcl
|
||||
|
||||
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'`.
|
||||
|
||||
34
test/corpus/attributes.txt
Normal file
34
test/corpus/attributes.txt
Normal 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)))))))
|
||||
|
||||
@@ -85,3 +85,24 @@ block_1 {
|
||||
(body
|
||||
(block
|
||||
(identifier))))))
|
||||
|
||||
==================
|
||||
nested blocks
|
||||
==================
|
||||
|
||||
block_1 {
|
||||
block_2 {}
|
||||
block_3 {}
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
(config_file
|
||||
(body
|
||||
(block
|
||||
(identifier)
|
||||
(body
|
||||
(block
|
||||
(identifier))
|
||||
(block
|
||||
(identifier))))))
|
||||
|
||||
Reference in New Issue
Block a user