diff --git a/README.md b/README.md index 07531f6..266c757 100644 --- a/README.md +++ b/README.md @@ -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'`. diff --git a/test/corpus/attributes.txt b/test/corpus/attributes.txt new file mode 100644 index 0000000..6af037f --- /dev/null +++ b/test/corpus/attributes.txt @@ -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))))))) + diff --git a/test/corpus/blocks.txt b/test/corpus/blocks.txt index a2beea8..20a6c10 100644 --- a/test/corpus/blocks.txt +++ b/test/corpus/blocks.txt @@ -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))))))