python-hcl2 7.2.0__tar.gz → 7.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/CHANGELOG.md +8 -1
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/PKG-INFO +1 -1
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/hcl2/hcl2.lark +1 -1
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/hcl2/reconstructor.py +14 -4
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/hcl2/transformer.py +5 -3
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/hcl2/version.py +2 -2
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/python_hcl2.egg-info/PKG-INFO +1 -1
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/.codacy.yml +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/.coveragerc +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/.github/CODEOWNERS +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/.github/ISSUE_TEMPLATE/hcl2-parsing-error.md +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/.github/workflows/codeql-analysis.yml +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/.github/workflows/pr_check.yml +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/.github/workflows/publish.yml +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/.gitignore +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/.pre-commit-config.yaml +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/.yamllint.yml +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/LICENSE +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/MANIFEST.in +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/README.md +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/bin/terraform_test +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/hcl2/__init__.py +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/hcl2/__main__.py +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/hcl2/api.py +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/hcl2/builder.py +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/hcl2/const.py +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/hcl2/parser.py +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/hcl2/py.typed +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/mypy.ini +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/pylintrc +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/pyproject.toml +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/python_hcl2.egg-info/SOURCES.txt +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/python_hcl2.egg-info/dependency_links.txt +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/python_hcl2.egg-info/entry_points.txt +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/python_hcl2.egg-info/not-zip-safe +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/python_hcl2.egg-info/requires.txt +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/python_hcl2.egg-info/top_level.txt +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/reports/.gitignore +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/requirements.txt +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/setup.cfg +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/test-requirements.txt +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/tox.ini +0 -0
- {python_hcl2-7.2.0 → python_hcl2-7.2.1}/tree-to-hcl2-reconstruction.md +0 -0
|
@@ -7,7 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
7
7
|
|
|
8
8
|
## \[Unreleased\]
|
|
9
9
|
|
|
10
|
-
- Nothing
|
|
10
|
+
- Nothing yet.
|
|
11
|
+
|
|
12
|
+
## \[7.2.1\] - 2025-05-16
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- More robust escaping for special characters. Thanks, @eranor ([#224](https://github.com/amplify-education/python-hcl2/pull/224))
|
|
17
|
+
- Issue parsing interpolation string as an object key ([#232](https://github.com/amplify-education/python-hcl2/pull/232))
|
|
11
18
|
|
|
12
19
|
## \[7.2.0\] - 2025-04-24
|
|
13
20
|
|
|
@@ -77,7 +77,7 @@ EQ : /[ \t]*=(?!=|>)/
|
|
|
77
77
|
tuple : "[" (new_line_or_comment* expression new_line_or_comment* ",")* (new_line_or_comment* expression)? new_line_or_comment* "]"
|
|
78
78
|
object : "{" new_line_or_comment? (new_line_or_comment* (object_elem | (object_elem COMMA)) new_line_or_comment*)* "}"
|
|
79
79
|
object_elem : object_elem_key ( EQ | COLON ) expression
|
|
80
|
-
object_elem_key : float_lit | int_lit | identifier | STRING_LIT | object_elem_key_dot_accessor | object_elem_key_expression
|
|
80
|
+
object_elem_key : float_lit | int_lit | identifier | STRING_LIT | object_elem_key_dot_accessor | object_elem_key_expression | string_with_interpolation
|
|
81
81
|
object_elem_key_expression : LPAR expression RPAR
|
|
82
82
|
object_elem_key_dot_accessor : identifier (DOT identifier)+
|
|
83
83
|
|
|
@@ -353,11 +353,21 @@ class HCLReverseTransformer:
|
|
|
353
353
|
|
|
354
354
|
@staticmethod
|
|
355
355
|
def _escape_interpolated_str(interp_s: str) -> str:
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
356
|
+
if interp_s.strip().startswith('<<-') or interp_s.strip().startswith('<<'):
|
|
357
|
+
# For heredoc strings, preserve their format exactly
|
|
358
|
+
return reverse_quotes_within_interpolation(interp_s)
|
|
359
|
+
# Escape backslashes first (very important to do this first)
|
|
360
|
+
escaped = interp_s.replace('\\', '\\\\')
|
|
361
|
+
# Escape quotes
|
|
362
|
+
escaped = escaped.replace('"', '\\"')
|
|
363
|
+
# Escape control characters
|
|
364
|
+
escaped = escaped.replace('\n', '\\n')
|
|
365
|
+
escaped = escaped.replace('\r', '\\r')
|
|
366
|
+
escaped = escaped.replace('\t', '\\t')
|
|
367
|
+
escaped = escaped.replace('\b', '\\b')
|
|
368
|
+
escaped = escaped.replace('\f', '\\f')
|
|
359
369
|
# find each interpolation within the string and remove the backslashes
|
|
360
|
-
interp_s = reverse_quotes_within_interpolation(
|
|
370
|
+
interp_s = reverse_quotes_within_interpolation(f'"{escaped}"')
|
|
361
371
|
return interp_s
|
|
362
372
|
|
|
363
373
|
@staticmethod
|
|
@@ -102,10 +102,12 @@ class DictTransformer(Transformer):
|
|
|
102
102
|
# This returns a dict with a single key/value pair to make it easier to merge these
|
|
103
103
|
# into a bigger dict that is returned by the "object" function
|
|
104
104
|
|
|
105
|
-
key =
|
|
106
|
-
|
|
105
|
+
key = str(args[0].children[0])
|
|
106
|
+
if not re.match(r".*?(\${).*}.*", key):
|
|
107
|
+
# do not strip quotes of a interpolation string
|
|
108
|
+
key = self.strip_quotes(key)
|
|
107
109
|
|
|
108
|
-
value = self.to_string_dollar(
|
|
110
|
+
value = self.to_string_dollar(args[2])
|
|
109
111
|
return {key: value}
|
|
110
112
|
|
|
111
113
|
def object_elem_key_dot_accessor(self, args: List) -> str:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|