We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue
>>> from hcl2 import loads >>> loads('a=1*(2+3)') {'a': ['${1 * 2 + 3}']}
Expect
{'a': ['${1*(2+3)}']}
The text was updated successfully, but these errors were encountered:
In case it helps somebody, I fixed this issue by adding the parenthesis to the transformer, whenever an expression is found:
from hcl2.parser import hcl2 as parser from hcl2.transformer import DictTransformer class DictTransformerMod(DictTransformer): def expr_term(self, args: list) -> object: term = super().expr_term(args) if isinstance(term, str) and " " in term: return f"({term})" return term transformer = DictTransformerMod() tree = parser.parse('a=1*(2+3)') transformer.transform(tree)
, which returns the expected:
{'a': '${1 * (2 + 3)}'}
I won't do a PR because I know too little about how this package is used to understand possible side effects
Sorry, something went wrong.
No branches or pull requests
Issue
Expect
The text was updated successfully, but these errors were encountered: