Skip to content
New issue

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

System Functions disallow use of line wrapping (newlines around params) #1325

Closed
excalq opened this issue May 16, 2024 · 0 comments · Fixed by #1328
Closed

System Functions disallow use of line wrapping (newlines around params) #1325

excalq opened this issue May 16, 2024 · 0 comments · Fixed by #1328
Labels
enhancement New feature or request parser Issues or PRs related to kcl parser

Comments

@excalq
Copy link

excalq commented May 16, 2024

Bug Report

System functions such as template.execute() appear not to work when there are new lines following parentheses, which breaks with conventions of most programming languages.

Code Style > Indentation does reference "brace/bracket/parenthesis on multiline constructs". So having parentheses behave similar to braces and brackets is expected.

1. Minimal reproduce step (Required)

This is an example of a template function would would be good to wrap due to line length:

_iamPolicyJson = template.execute(
    template=_iamPolicyEksAllAccessTemplate,
    data={'AWS_ACCOUNT_ID': prod.env.accountId}
)

The above will produce an InvalidSyntax error.

The following, using \ does compile, but feels unwarranted given expected syntax.

_iamPolicyJson = template.execute( \
    template=_iamPolicyEksAllAccessTemplate, \
    data={'AWS_ACCOUNT_ID': prod.env.accountId} \
)

2. What did you expect to see? (Required)

That, like braces/brackets, parentheses ignore following/leading newlines during parsing.

3. What did you see instead (Required)

The following compiler error:

error[E1001]: InvalidSyntax
  --> /path/to/kcl_configs/iam.k:14:34
   |
14 | _iamPolicyJson = template.execute(
   |                                  ^ expected one of ["identifier", "literal", "(", "[", "{"] got newline
   |

4. What is your KCL components version? (Required)

kcl version
0.8.7-darwin-arm64

@excalq excalq changed the title System Functions disallow use of line wrapping (line beaks, newlines) System Functions disallow use of line wrapping (newlines around params) May 16, 2024
@Peefy Peefy added enhancement New feature or request parser Issues or PRs related to kcl parser labels May 17, 2024
@Peefy Peefy added this to the v0.9.0 Release milestone May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request parser Issues or PRs related to kcl parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants