zsh-users
 help / color / mirror / code / Atom feed
* Parse time options
@ 2016-02-16 10:36 Sebastian Gniazdowski
  2016-02-16 12:11 ` Sebastian Gniazdowski
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Gniazdowski @ 2016-02-16 10:36 UTC (permalink / raw)
  To: Zsh Users

Hello,
I'm writing a thing to stress test scripts. Basically:

for i in "${STRESS_TEST_OPTIONS[@]}"; do
    setopt "$i"
    print -n "Stress-testing ${fname:t} for option $i "
    zcompile -R "$fname" 2>/dev/null && {
        print "[${mycolors[success]}Success${mycolors[rst]}]"
    } || {
        print "[${mycolors[failure]}Fail${mycolors[rst]}]"
    }
   unsetopt "$i"
done

This seems to work fine with NO_SHORT_LOOPS and IGNORE_BRACES. Is
there one other option that would break zcompile in case of some
forbidden (by the option) syntax? Except maybe for the CSH_* options.
SH_GLOB doesn't seem to be parse-time option, it apparently just
disables '(' ')' at run time, except maybe for situations where e.g.
(N) is done – unsetting SH_GLOB inside script doesn't seem to make (N)
work.

Best regards,
Sebastian Gniazdowski


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

* Re: Parse time options
  2016-02-16 10:36 Parse time options Sebastian Gniazdowski
@ 2016-02-16 12:11 ` Sebastian Gniazdowski
  2016-02-16 19:01   ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Gniazdowski @ 2016-02-16 12:11 UTC (permalink / raw)
  To: Zsh Users

Turned out SH_GLOB has some parse-time traits, as it makes compilation
of opp plugin unsuccessful:
# zcompile opp.plugin.zsh
# setopt shglob
# zcompile opp.plugin.zsh
zsh: parse error near `CURSOR+1'
zcompile: can't read file: opp.plugin.zsh

Best regards,
Sebastian Gniazdowski


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

* Re: Parse time options
  2016-02-16 12:11 ` Sebastian Gniazdowski
@ 2016-02-16 19:01   ` Bart Schaefer
  2016-02-17  7:11     ` Sebastian Gniazdowski
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2016-02-16 19:01 UTC (permalink / raw)
  To: Zsh Users

On Feb 16, 11:36am, Sebastian Gniazdowski wrote:
}
} for i in "${STRESS_TEST_OPTIONS[@]}"; do
}     setopt "$i"
}     zcompile -R "$fname" 2>/dev/null
}    unsetopt "$i"
} done

Presumably you're starting from a state where none of these options are
set, so that it's correct to unsetopt them again?

} This seems to work fine with NO_SHORT_LOOPS and IGNORE_BRACES. Is
} there one other option that would break zcompile in case of some
} forbidden (by the option) syntax? Except maybe for the CSH_* options.

Well, there's NO_BARE_GLOB_QUAL, IGNORE_CLOSE_BRACES, MULTI_FUNC_DEF,
maybe C_PRECEDENCES, possibly POSIX_IDENTIFIERS.


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

* Re: Parse time options
  2016-02-16 19:01   ` Bart Schaefer
@ 2016-02-17  7:11     ` Sebastian Gniazdowski
  0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Gniazdowski @ 2016-02-17  7:11 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh Users

On 16 February 2016 at 20:01, Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Feb 16, 11:36am, Sebastian Gniazdowski wrote:
> }
> } for i in "${STRESS_TEST_OPTIONS[@]}"; do
> }     setopt "$i"
> }     zcompile -R "$fname" 2>/dev/null
> }    unsetopt "$i"
> } done
>
> Presumably you're starting from a state where none of these options are
> set, so that it's correct to unsetopt them again?
>
> } This seems to work fine with NO_SHORT_LOOPS and IGNORE_BRACES. Is
> } there one other option that would break zcompile in case of some
> } forbidden (by the option) syntax? Except maybe for the CSH_* options.
>
> Well, there's NO_BARE_GLOB_QUAL, IGNORE_CLOSE_BRACES, MULTI_FUNC_DEF,
> maybe C_PRECEDENCES, possibly POSIX_IDENTIFIERS.

Thanks. In my "collection" (test collection) of 51 plugins I didn't
found one that wouldn't compile with the options:

https://asciinema.org/a/ana24je5nnvr8iy9wp8anmptg

However a simple test file revealed that indeed MULTI_FUNC_DEF can
make compilation fail. Couldn't construct test for NO_BARE_GLOB_QUAL
and C_PRECEDENCES, already am using IGNORE_CLOSE_BRACES, and
POSIX_IDENTIFIERS seems to not affect zcompile.

Best regards,
Sebastian Gniazdowski


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

end of thread, other threads:[~2016-02-17  7:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-16 10:36 Parse time options Sebastian Gniazdowski
2016-02-16 12:11 ` Sebastian Gniazdowski
2016-02-16 19:01   ` Bart Schaefer
2016-02-17  7:11     ` Sebastian Gniazdowski

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