summaryrefslogtreecommitdiff
path: root/Src/lex.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-02-26 23:01:48 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-02-26 23:01:48 +0000
commit3d63a33407f1b4e324b83a87d55b27303a2fcdb8 (patch)
tree9c2a30fc62c0a6f8ea4d4d6e1d14efd975a42877 /Src/lex.c
parentbf0ef69f4240c2d89562948971077447b4ec5be0 (diff)
downloadzsh-3d63a33407f1b4e324b83a87d55b27303a2fcdb8.tar.gz
zsh-3d63a33407f1b4e324b83a87d55b27303a2fcdb8.zip
26617 c.f. Tomáš Smetana, 26610: comments weren't handled in $(...)
Diffstat (limited to 'Src/lex.c')
-rw-r--r--Src/lex.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/Src/lex.c b/Src/lex.c
index 5637a2106..6e14612f7 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1802,16 +1802,18 @@ exalias(void)
static int
skipcomm(void)
{
- int pct = 1, c;
+ int pct = 1, c, start = 1;
cmdpush(CS_CMDSUBST);
SETPARBEGIN
c = Inpar;
do {
+ int iswhite;
add(c);
c = hgetc();
if (itok(c) || lexstop)
break;
+ iswhite = isep(c);
switch (c) {
case '(':
pct++;
@@ -1854,7 +1856,15 @@ skipcomm(void)
else
add(c);
break;
+ case '#':
+ if (start) {
+ add(c);
+ while ((c = hgetc()) != '\n' && !lexstop)
+ add(c);
+ }
+ break;
}
+ start = iswhite;
}
while (pct);
if (!lexstop)