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

Support comments inside lists and maps #924

Open
SitiSchu opened this issue Feb 24, 2020 · 2 comments
Open

Support comments inside lists and maps #924

SitiSchu opened this issue Feb 24, 2020 · 2 comments

Comments

@SitiSchu
Copy link
Contributor

@SitiSchu SitiSchu commented Feb 24, 2020

Currently this:

[
    value
    # comment
    value2
]

fails with:

Multiple parse errors:
  should be ']'
    /home/sitischu/.elvish/lib/github.com/mojurasu/riku/test.elv, line 8:
          # comment
  unexpected rune ']'
    /home/sitischu/.elvish/lib/github.com/mojurasu/riku/test.elv, line 10:
      ]
@krader1961

This comment has been minimized.

Copy link
Contributor

@krader1961 krader1961 commented Feb 24, 2020

A variation on the above example:

~> put [x #y ]
parse error: 7-8 in [interactive]: should be ']'
parse error: should be ']'
[tty], line 1: put [x #y ]

That illustrates why such syntax is problematic. It's not enough to support comments on lines without any other expression of syntactically significant tokens. Note that even without the trailing ] in that example it fails using current parsing behavior. Which is another road block to changing the behavior since doing so is something that can only be done in a major release.

@SitiSchu SitiSchu changed the title Support comments inside lists Support comments inside multiline lists Feb 24, 2020
@SitiSchu SitiSchu changed the title Support comments inside multiline lists Support comments inside lists and maps Feb 24, 2020
@SitiSchu

This comment has been minimized.

Copy link
Contributor Author

@SitiSchu SitiSchu commented Feb 24, 2020

Breaking changes should be fine since we're still below 1.0. Interestingly enough it behaves as expected with lambdas:

~> { put 1 # comment }
   }
▶ 1 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.