zsh-workers
 help / color / mirror / code / Atom feed
* Comment behaviour
@ 2017-08-04 18:21 Jim
  2017-08-06 18:15 ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Jim @ 2017-08-04 18:21 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 479 bytes --]

ZSH_VERSION: 5.3.1-test-2

Example code produced the following output:
  /home/user/.zshrc:<number of last line>: parse error near `\n'

[ -f /bin/zsh ] && {
  # code
}# A comment.   <<<--- point of error(no space after brace)
IF
} # A comment.   <<<--- no error(space after brace)

Also checked "(#", ")#", and "{#" with no errors. FWIW

BUG or did I miss something in the man page? # after a brace in
a nested statement would be valid, but didn't expect it here.

Thanks,

Jim

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Comment behaviour
  2017-08-04 18:21 Comment behaviour Jim
@ 2017-08-06 18:15 ` Peter Stephenson
  2017-08-06 18:59   ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 2017-08-06 18:15 UTC (permalink / raw)
  To: zsh-workers

On Fri, 4 Aug 2017 13:21:13 -0500
Jim <linux.tech.guy@gmail.com> wrote:
> ZSH_VERSION: 5.3.1-test-2
> 
> Example code produced the following output:
>   /home/user/.zshrc:<number of last line>: parse error near `\n'
> 
> [ -f /bin/zsh ] && {
>   # code
> }# A comment.   <<<--- point of error(no space after brace)
> IF
> } # A comment.   <<<--- no error(space after brace)
> 
> Also checked "(#", ")#", and "{#" with no errors. FWIW
> 
> BUG or did I miss something in the man page? # after a brace in
> a nested statement would be valid, but didn't expect it here.

Generally, you can't rely on being able to put a "#" after a command
argument with no space and have it treated as starting a quote, so
whether it's a bug or not is somewhat philosophical.

I'll have a closer look after the release if this particular case can be
treated differently, however --- it's clearly not useful to have it
treated as a parse error if it's easy to do it otherwise.

pws


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Comment behaviour
  2017-08-06 18:15 ` Peter Stephenson
@ 2017-08-06 18:59   ` Bart Schaefer
  2017-08-06 19:17     ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2017-08-06 18:59 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

On Sun, Aug 6, 2017 at 11:15 AM, Peter Stephenson
<p.w.stephenson@ntlworld.com> wrote:
>
> I'll have a closer look after the release if this particular case can be
> treated differently, however --- it's clearly not useful to have it
> treated as a parse error if it's easy to do it otherwise.

It's a parse error because "}#" is not a "}" token and the script
_ends_ after that, so no matching "}" is ever found.  I don't think
you want to parse "}#" as two separate tokens.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Comment behaviour
  2017-08-06 18:59   ` Bart Schaefer
@ 2017-08-06 19:17     ` Peter Stephenson
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2017-08-06 19:17 UTC (permalink / raw)
  To: zsh-workers

On Sun, 6 Aug 2017 11:59:53 -0700
Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Sun, Aug 6, 2017 at 11:15 AM, Peter Stephenson
> <p.w.stephenson@ntlworld.com> wrote:
> >
> > I'll have a closer look after the release if this particular case can be
> > treated differently, however --- it's clearly not useful to have it
> > treated as a parse error if it's easy to do it otherwise.
> 
> It's a parse error because "}#" is not a "}" token and the script
> _ends_ after that, so no matching "}" is ever found.  I don't think
> you want to parse "}#" as two separate tokens.

The question arises in this particular case because it's in command
position so only certain special syntax is valid.  But it seems like
the following is currently valid, if stupid:

% alias "}#"='echo "Hello"'
% {
cursh> }#
cursh> }
Hello

so we can't change it without repercussions.

pws


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-06 19:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-04 18:21 Comment behaviour Jim
2017-08-06 18:15 ` Peter Stephenson
2017-08-06 18:59   ` Bart Schaefer
2017-08-06 19:17     ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).