zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Error parsing $(...)
@ 2009-02-26  8:45 Tomáš Smetana
  2009-02-26 22:57 ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Tomáš Smetana @ 2009-02-26  8:45 UTC (permalink / raw)
  To: zsh-workers

[-- 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);

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

end of thread, other threads:[~2009-03-02 10:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-26  8:45 PATCH: Error parsing $(...) Tomáš Smetana
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

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).