You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
#!/usr/bin/env <your favorite interpreter>
Midnight takes your heart and your soul
<rest of lyrics>
The text was updated successfully, but these errors were encountered:
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.
#!/usr/bin/rockstar
# this entire line is a comment
shout "hello world" # this is also a comment
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.
dylanbeattie
changed the title
Add support for shebang
Add support for end-of-line comments using # so that shebangs (e.g. #!/usr/bin/rockstar) work
Apr 8, 2021
I have added the shebang support to Rocky, as well as the # comment line support, for all the use cases @dylanbeattie sketched above.
If we have an entire line # comment, it won't behave like an empty line (end of block), rather the line is simply skipped. This is useful if you are in the middle of coding, but you want to temporarily comment out a line, e.g in a function or in a loop.
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.
Love is " bottles of beer on the wall"
Problems are " bottles of beer"
Carol says Take one down, pass it around
The beers were numbering fa'too'many
While the beers ain't nothing
Shout it with Love
#Shout it + " bottles of beer on the wall"
Shout it with Problems
#Shout it + " bottles of beer"
Say Carol,
Knock the beers down
Say it with Love
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: