From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: ${(z)} split of unmatched, doubled ((
Date: Sun, 27 Sep 2015 17:59:06 -0700 [thread overview]
Message-ID: <150927175906.ZM20369@torch.brasslantern.com> (raw)
In-Reply-To: <20150927235106.GD1879@tarsus.local2>
On Sep 27, 11:51pm, Daniel Shahaf wrote:
} Subject: Re: ${(z)} split of unmatched, doubled ((
}
} Since the "two subshells" case can be disambiguated by adding a space,
} but arithmetic evluations cannot be disambiguated, I assume ambiguous
} cases should be resolved in favour of the latter.
}
} I see the problem: ${(z)} is bufferwords(), which calls ctxtlex(), which
} ultimately calls cmd_or_math(), which classifies the unbalanced opening
} parentheses as a syntax error, because they have no matching ')' before
} the end of the input. Consequently, cmd_or_math() returns CMD_OR_MATH_ERR
} on line 512 (in the 'if (lexstop)' block), which causes ctxtlex() to
} return LEXERR.
So perhaps this:
diff --git a/Src/lex.c b/Src/lex.c
index 70f3d14..6eb3c82 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -785,6 +785,8 @@ gettok(void)
return INPAR;
default:
+ if (lexflags & LEXFLAGS_ACTIVE)
+ tokstr = dyncat("((", tokstr);
return LEXERR;
}
}
It might be prudent to also test that tokstr != NULL there, but I have
not found a sample input where that occurs.
next prev parent reply other threads:[~2015-09-28 0:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-27 1:23 Daniel Shahaf
2015-09-27 16:00 ` Bart Schaefer
2015-09-27 23:51 ` Daniel Shahaf
2015-09-28 0:59 ` Bart Schaefer [this message]
2015-09-28 1:55 ` Daniel Shahaf
2015-09-28 3:30 ` Bart Schaefer
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=150927175906.ZM20369@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/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).