adds support for provider functions#162
Merged
kkozik-amplify merged 2 commits intoJun 11, 2024
Merged
Conversation
kkozik-amplify
requested changes
Jun 7, 2024
kkozik-amplify
left a comment
Collaborator
There was a problem hiding this comment.
Hey @lkwg82, thanks a lot for contributing.
I left a comment about one minor thing. Overall the PR looks good
|
|
||
| function_call : identifier "(" new_line_or_comment? arguments? new_line_or_comment? ")" | ||
| arguments : (expression (new_line_or_comment* "," new_line_or_comment* expression)* ("," | "...")? new_line_or_comment*) | ||
| colons: "::" |
Collaborator
There was a problem hiding this comment.
Please remove this definition and use :: directly in provider_function_call
Contributor
Author
There was a problem hiding this comment.
I dont get it done, everytime I inline "::" I get this error:
FAIL: test_load_terraform_from_cache:10
'provider_function.tf' (test.unit.test_load.TestLoad.test_load_terraform_from_cache:10
'provider_function.tf')
----------------------------------------------------------------------
Traceback (most recent call last):
File ".../python-hcl2/.tox/py312-unit/lib/python3.12/site-packages/lark/visitors.py", line 124, in _call_userfunc
return f(children)
^^^^^^^^^^^
TypeError: sequence item 1: expected str instance, Tree found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".../python-hcl2/test/unit/test_load.py", line 43, in check_terraform
hcl2_dict = hcl2.load(hcl_file)
^^^^^^^^^^^^^^^^^^^
lark.exceptions.VisitError: Error trying to process rule "provider_function_call":
sequence item 1: expected str instance, Tree found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".../python-hcl2/test/unit/test_load.py", line 45, in check_terraform
assert False, f"failed to tokenize terraform in `{hcl_path_str}`: {exc}"
^^^^^
AssertionError: failed to tokenize terraform in `provider_function.tf`: Error trying to process rule "provider_function_call":
sequence item 1: expected str instance, Tree found
I'm not so fluent, maybe someone could assist?
Collaborator
There was a problem hiding this comment.
I looked into that and this happens because of how the provider_function_call works. This function is consistent with function_call you seemed to base on so let's stick to the implementation you proposed.
Thanks!
kkozik-amplify
approved these changes
Jun 11, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
adds support for parsing provider defined functions