From: "Tomáš Smetana" <t.smetana@gmail.com>
To: zsh-workers@sunsite.dk
Subject: PATCH: Error parsing $(...)
Date: Thu, 26 Feb 2009 09:45:07 +0100 [thread overview]
Message-ID: <20090226094507.43cf3c16@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 646 bytes --]
Hello,
I have stumbled upon a problem with comments in $(...) construct. Consider
the following script:
# Comment containing '
VAR=$(
echo a
# Comment containing '
)
echo $VAR
This is syntactically correct but zsh would throw an error parsing it:
parse error near `VAR=$('
Note that the same script works OK in ksh or bash. It seems that the '\''
character doesn't lose its special meaning even though it appears in the
comment. I have written a patch (attached) which seems to fix the problem.
Could you please review the patch and consider applying it?
Please cc: me in the answers I'm not subscribed.
Thanks and regards,
Tomas Smetana
[-- Attachment #2: zsh-subcomm.patch --]
[-- Type: text/x-patch, Size: 443 bytes --]
Index: Src/lex.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/lex.c,v
retrieving revision 1.49
diff -u -r1.49 lex.c
--- Src/lex.c 25 Feb 2009 10:24:01 -0000 1.49
+++ Src/lex.c 26 Feb 2009 08:28:08 -0000
@@ -1854,6 +1854,11 @@
else
add(c);
break;
+ case '#':
+ add(c);
+ while ((c = hgetc()) != '\n' && !lexstop)
+ add(c);
+ break;
}
}
while (pct);
next reply other threads:[~2009-02-26 8:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-26 8:45 Tomáš Smetana [this message]
2009-02-26 22:57 ` Peter Stephenson
2009-02-27 10:19 ` Peter Stephenson
2009-02-27 16:33 ` Bart Schaefer
2009-03-02 10:06 ` Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090226094507.43cf3c16@gmail.com \
--to=t.smetana@gmail.com \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).