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

Add full support for comments #62

Open
daniel-sc opened this issue Oct 15, 2019 · 3 comments
Open

Add full support for comments #62

daniel-sc opened this issue Oct 15, 2019 · 3 comments

Comments

@daniel-sc
Copy link

Currently comments are removed and do not show up in the AST. For certain use cases (e.g. building a converter from bash to win batch scripts) it'd be useful to have the comments as specific AST elements.

@nfischer
Copy link
Collaborator

Comments are usually only preserved in the concrete syntax tree, and get stripped before producing an AST. I don't think preserving comments should be a goal of this project; we really only want an AST so we can then execute the command in vorpaljs/cash. Preserving comments and whitespace are huge headaches.

https://github.com/nfischer/shelljs-transpiler is a similar project with basic support for comments, although I know there's good chunks of bash missing from that grammar (mainly because that project has to parse and transpile, which slows down progress a bit).

@piranna
Copy link
Collaborator

piranna commented Oct 21, 2019

Comments can be consider like any other token... Main problem with them, they can appear everywhere.

@jcubic
Copy link

jcubic commented Jul 21, 2021

What about shebang? #!/usr/bin/node If comments are stripped this at least should be preserved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants