zsh-workers
 help / color / mirror / code / Atom feed
* [BUG] Cannot use (#i) flag in [[ ]] explicit glib
@ 2019-09-11  2:49 Sebastian Gniazdowski
  2019-09-11 20:11 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Gniazdowski @ 2019-09-11  2:49 UTC (permalink / raw)
  To: Zsh hackers list

Hello,
if [[ -f (#i)$dir/README.md(#qN[1]) ]]; then echo true; fi

Output:
zsh: parse error near `('

A workaround is to precede with '', i.e.:

if [[ -f ''(#i)$dir/README.md(#qN[1]) ]]; then echo true; fi

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

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

* Re: [BUG] Cannot use (#i) flag in [[ ]] explicit glib
  2019-09-11  2:49 [BUG] Cannot use (#i) flag in [[ ]] explicit glib Sebastian Gniazdowski
@ 2019-09-11 20:11 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2019-09-11 20:11 UTC (permalink / raw)
  To: Sebastian Gniazdowski; +Cc: Zsh hackers list

On Tue, Sep 10, 2019 at 7:50 PM Sebastian Gniazdowski
<sgniazdowski@gmail.com> wrote:
>
> if [[ -f (#i)$dir/README.md(#qN[1]) ]]; then echo true; fi
>
> Output:
> zsh: parse error near `('

That's not exactly a bug, it's because a parenthesized sub-expression
is valid syntax inside [[ ]].  The parser can't tell why the open
paren is there.  It might be possible to special-case the operators
that accept file patterns as arguments, but right now except for "-t"
(which has special handling for ksh compatibility) the parser doesn't
use any such context dependence; that is, the operators are not
tokens, they're just one in a list of strings, a property which is
made use of by the module system for defining new condition operators.

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

end of thread, other threads:[~2019-09-11 20:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-11  2:49 [BUG] Cannot use (#i) flag in [[ ]] explicit glib Sebastian Gniazdowski
2019-09-11 20:11 ` Bart Schaefer

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