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

RE: comments break \ at end of line



> I'm suggesting that, in the case of the function, it turns it into
> `echo hello, world', and in second case, it expects another line of
> input, just as if you hadn't entered the comment line.  After all,
> comment lines are supposed to be ignored, aren't they?

That is exactly what happens currently - everything from `#' up to the next
EOL is ignored.


This seems far
> more sensible behaviour to me: a) it's useful to be able to
> intersperse comments with continuation lines,

No, I am against it. It will turn into a nightmare.

echo foo \
#
# ... 57 lines of comments
#
echo bar

How do you like it?
                                                                      and b)
if you didn't
> want the continuation happening, you wouldn't have included the
> backslashes in the first place.
>

It is not a continuation. It is simply removing of EOL no more no less (and so
it is documented). Yes, for all practical purposes it is the same as
continuation ...

> > I don't see how you can turn it
> > off without writing a completely new (= bugridden) way of lexing.
>
> As is probably already obvious, I'm fairly ignorant of zsh's lexing
> and parsing.  At what stage do comments get dropped?  I would have
> thought that if they were dropped earlier on that this would achieve
> what I want, but I'm just guessing.
>

But I just realised. In case of

echo foo \
# comment
bar

how do you want to indicate, that `bar' is not a comment? I mean

echo foo \
#comment \
bar

is the same as

echo foo #comment bar

that makes bar be happily ignored. The above change is trivial,  but gains you
nothing. Anything else, I agree, is too error prone.

-andrej



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