bashpp
bashpp copied to clipboard
Normal comments
Why are normal comments failing?
#this is a comment
But this works:
# this is a comment
Shouldn't we only parse things that are actual directives?
Yeah. What's the error you're seeing? I can set up a test for this and check, but it seems low priority.
Ok, so it treats anything that is prefixed with # as a directive. If a directive is not defined, then it errors:
t/test_comments.sh
/var/folders/mr/bvl8x82d1490cbs708m_pt5hl1gfd3/T/tmp.ioAw3QDm:1:19 error: 1: invalid directive: this
#this is a comment
..................^
We'd be in danger of allowing typos through the net, like:
#defnie SOMETHING
Since defnie is not defined, it would generate a script with undefined behaviour. By explicitly requiring comments include the additional space, we save ourselves this potential pain.
However this can break a lot of scripts. Isn't it possible to only process correctly structured macros. So that if the original script had a typo, then that script should be fixed. Also I'd imagine that #defnie SOMETHING
should just not be evaluated, and left as a comment.
Well let's compromise. I'll add an option that will treat an undefined directive as a comment, but the default behaviour will be to warn. I'll add a message to the warning to try the option.