Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: lexing



On 11/29/2015 10:07 AM, Bart Schaefer wrote:
   The # character introduces a comment ONLY when it is immediately
   preceded by a command terminator (including start of line) or by
   whitespace that acts as a word separator.

Ok, so the comment is actually the exception. That spares me going through ZyX's list and seeing which of them is highlighted wrong. I expect there's a big overlap with bash rules anyway, so we're only interested in exceptions from bash.
Everywhere else, # is NOT a comment, in contexts such as:

Yeah, I know the hash is used all over the place, but I've only noticed the " (#...) " error so far, tho I suppose I should check all the other candidates.
The form you're using (#something), is only not-a-comment in pattern
or filename-generation context, so $(# this IS a comment).

When will I run out of things that astonish me about zsh syntax? What sort of need would there be to put a comment inside " $(#...) " ? So that's a comment but " (#b) " is not a comment ... sometimes, but don't bet on it.

Final note:  The one thing zsh borrowed from csh that I freely concede
is pretty horrible, is the ability to change the comment character by
changing the third character of $histchars.  Please never do this.
Pardon the mini-rant, but that's demented. So the whole edifice of zsh lexing, all the stuff mentioned, and everything else, has to be filtered thu some engine that first determines if the comment character has been changed? Changed to what? What character is 'free' for assumption as the comment marker? I don' t know if I'll ever understand.




Messages sorted by: Reverse Date, Date, Thread, Author