Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: comments break \ at end of line
- X-seq: zsh-workers 12698
- From: Adam Spiers <adam@xxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxxxxxxxxx>
- Subject: Re: comments break \ at end of line
- Date: Fri, 25 Aug 2000 15:38:30 +0100
- In-reply-to: <0FZU00LN0FYLHV@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>; from pws@xxxxxxx on Fri, Aug 25, 2000 at 11:32:46AM +0100
- Mail-followup-to: Zsh hackers list <zsh-workers@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <20000824222932.A15971@xxxxxxxxxxxxxxxxxxxxxxx> <0FZU00LN0FYLHV@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Reply-to: Adam Spiers <adam@xxxxxxxxxx>
Peter Stephenson (pws@xxxxxxx) wrote:
> Adam wrote:
> > % foo () {
> > > echo hello, \
> > > # this is a comment
> > > world
> > > }
> > % foo
> > hello,
> > foo:3: command not found: world
> >
> > which is the same issue as
> >
> > % echo hello, \
> > > # comment
> > hello,
> >
> > This may be intentional, but if so, it strikes me as a rather
> > undesirable feature, or at least one which you should be able to turn
> > off.
>
> I don't really see how it could be any different. The `\' just skips the
> newline, turning the line into `echo hello, # this is a comment'. `\'
> never forces it into any different state of parsing, it only escapes the
> next character. What are you suggesting?
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? This seems far
more sensible behaviour to me: a) it's useful to be able to
intersperse comments with continuation lines, and b) if you didn't
want the continuation happening, you wouldn't have included the
backslashes in the first place.
> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author