-
Notifications
You must be signed in to change notification settings - Fork 222
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 support for end-of-line comments using # so that shebangs (e.g. #!/usr/bin/rockstar) work #276
Comments
An easy way to implement this would be to ignore parsing any lines starting with # but that would create a new kind of comment which is not in the spec. So an almost an easy way would be to ignore the first line of any program if it starting with #. |
I'm happy to add end-of-line comments using # as the comment character, just as it works in bash, Python, Perl, etc.
Sure, they're not very rock'n'roll, but if you're being absolutely idiomatic you shouldn't be using comments anyway. :) I had a very quick look at plugging this into the PEG grammar, and it's not quite as easy as I thought... if anybody wants to take a look, go for it; happy to accept a PR for this. If not, I'll take a look when I have a little more time. |
I have added the shebang support to Rocky, as well as the If we have an entire line For example, here are 2 whole line comment lines in the middle of the loop - if they were treated as empty lines, it would break the While loop block.
|
It's not pretty but practical. If I want my lyrics to mean something I have to wrap them around an interpreter which is fuggly.
Would it be to much to ask if the spec allowed shebangs on the top?
Example usage after implementing shebangs:
The text was updated successfully, but these errors were encountered: