Metadata-Version: 2.1
Name: hcl2-ast
Version: 0.1.2
Summary: 
License: MIT
Author: Niklas Rosenstein
Author-email: rosensteinniklas@gmail.com
Requires-Python: >=3.6,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Requires-Dist: python-hcl2 (>=3.0.5,<4.0.0)
Requires-Dist: termcolor (>=1.1.0,<2.0.0)
Requires-Dist: typing-extensions (>=4.2.0,<5.0.0)
Project-URL: Bug Tracker, https://github.com/NiklasRosenstein/python-hcl2-ast/issues
Project-URL: Repository, https://github.com/NiklasRosenstein/python-hcl2-ast
Description-Content-Type: text/markdown

# hcl2-ast

A [HCL2][] parser and evaluator based on [python-hcl2][] that produces an Abstract Syntax Tree.

  [HCL2]: https://github.com/hashicorp/hcl/blob/main/README.md
  [python-hcl2]: https://pypi.org/project/python-hcl2/

> __Note__: This project is in an early stage. It does not currently cover all HCL2 syntax features
> and does not have good test coverage.

## Usage

```py
from hcl2_ast import parse_string

module = parse_string("""
  hello {
    name = "World"
  }
""")

print(module.pformat())
```

Outputs:

```py
Module(body=[
  Block(
    name='hello',
    args=[],
    body=[
      Attribute(key='name', value=Literal(value='World')),
    ]
  ),
])
```

Check out [examples/evaluate.py](examples/evaluate.py) for an example on how to dynamically
evaluate a HCL2 configuration AST.

## Compatibility

hcl2-ast requires Python 3.6 or higher.

## Known issues

* No understanding of operator precedence in expressions (grouping with parentheses works as expected)

