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

[BUG] comments in an array on multiple lines makes parsing failed #603

Open
lens0021 opened this issue Nov 19, 2024 · 2 comments
Open

[BUG] comments in an array on multiple lines makes parsing failed #603

lens0021 opened this issue Nov 19, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@lens0021
Copy link
Contributor

Describe the bug
Adding comment in an array on multiple lines makes the parsing failed.

To Reproduce

$ echo -e "echo [\n    1,\n    // comment\n    2,\n]"
echo [
    1,
    // comment
    2,
]

$ echo -e "echo [\n    1,\n    // comment\n    2,\n]" | amber - -
 ERROR  Identifier 'echo' is a reserved keyword
at -:1:1

1| echo [
2|     1,

Expected behavior
The comment should not disturb the parsing.

$ echo -e "echo [\n    1,\n    2,\n]" | amber - -
#!/usr/bin/env bash
# Written in [Amber](https://amber-lang.com/)
# version: 0.3.5-alpha
# date: 2024-11-19 21:43:47
__AMBER_ARRAY_0=(1 2);
echo "${__AMBER_ARRAY_0[@]}"
@lens0021 lens0021 added the bug Something isn't working label Nov 19, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in Amber Project Nov 19, 2024
@Ph0enixKM
Copy link
Member

Ph0enixKM commented Nov 20, 2024

This could be an Heraclitus issue, but it has to be further investigated

@lens0021
Copy link
Contributor Author

lens0021 commented Nov 21, 2024

I've thought about this. An array can be on multiple lines in amber,. but it doesn't seem to be able to be in bash. (at least my quick search) Before fix the bug, we should decide how to deal with the comments first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants