summaryrefslogtreecommitdiff
path: root/Src/subst.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-12-14 09:59:04 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-12-14 09:59:04 +0000
commiteab4f9a83c74b104bcfa81d574d5f8f8a7a85ad3 (patch)
tree90ce69fc60a966b5d31ad4700cbd84a72b3c2bed /Src/subst.c
parent5858e79f4d942ab13414f5efaf6f280bac690060 (diff)
downloadzsh-eab4f9a83c74b104bcfa81d574d5f8f8a7a85ad3.tar.gz
zsh-eab4f9a83c74b104bcfa81d574d5f8f8a7a85ad3.zip
28528: Rearrange zleparse to lexflags
Add (z+n+)
Diffstat (limited to 'Src/subst.c')
-rw-r--r--Src/subst.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/Src/subst.c b/Src/subst.c
index 799682df2..7ad4aecdf 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -1557,9 +1557,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
* spbreak, see above; fairly straighforward in use but c.f.
* the comment for mods.
*
- * This ultimately becomes zleparse during lexical analysis, via
- * the comments argument to bufferwords(). It's got nothing
- * to do with zle.
+ * This gets set to one of the LEXFLAGS_* values.
*/
int shsplit = 0;
/*
@@ -1937,19 +1935,24 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
break;
case 'z':
- shsplit = 1;
+ shsplit = LEXFLAGS_ACTIVE;
if (s[1] == '+') {
s += 2;
while (*s && *s != '+' && *s != ')' && *s != Outpar) {
switch (*s++) {
case 'c':
/* Parse and keep comments */
- shsplit = 2;
+ shsplit |= LEXFLAGS_COMMENTS_KEEP;
break;
case 'C':
/* Parse and remove comments */
- shsplit = 3;
+ shsplit |= LEXFLAGS_COMMENTS_STRIP;
+ break;
+
+ case 'n':
+ /* Treat newlines as whitespace */
+ shsplit |= LEXFLAGS_NEWLINE;
break;
default:
@@ -3232,10 +3235,10 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
if (isarr) {
char **ap;
for (ap = aval; *ap; ap++)
- list = bufferwords(list, *ap, NULL, shsplit-1);
+ list = bufferwords(list, *ap, NULL, shsplit);
isarr = 0;
} else
- list = bufferwords(NULL, val, NULL, shsplit-1);
+ list = bufferwords(NULL, val, NULL, shsplit);
if (!list || !firstnode(list))
val = dupstring("");