From 8923d2a61824b0856839d52f3bf52aedb86fd827 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 26 Dec 2019 03:54:17 +0100 Subject: Add SHORT_REPEAT option --- Src/lex.c | 2 +- Src/options.c | 1 + Src/parse.c | 2 +- Src/zsh.h | 1 + 4 files changed, 4 insertions(+), 2 deletions(-) (limited to 'Src') diff --git a/Src/lex.c b/Src/lex.c index 1d86da94e..a541defe6 100644 --- a/Src/lex.c +++ b/Src/lex.c @@ -270,7 +270,7 @@ zshlex(void) do { if (inrepeat_) ++inrepeat_; - if (inrepeat_ == 3 && isset(SHORTLOOPS)) + if (inrepeat_ == 3 && (isset(SHORTLOOPS) || isset(SHORTREPEAT))) incmdpos = 1; tok = gettok(); } while (tok != ENDINPUT && exalias()); diff --git a/Src/options.c b/Src/options.c index 08ba71917..7586d21d2 100644 --- a/Src/options.c +++ b/Src/options.c @@ -248,6 +248,7 @@ static struct optname optns[] = { {{NULL, "shnullcmd", OPT_EMULATE|OPT_BOURNE}, SHNULLCMD}, {{NULL, "shoptionletters", OPT_EMULATE|OPT_BOURNE}, SHOPTIONLETTERS}, {{NULL, "shortloops", OPT_EMULATE|OPT_NONBOURNE},SHORTLOOPS}, +{{NULL, "shortrepeat", OPT_EMULATE}, SHORTREPEAT}, {{NULL, "shwordsplit", OPT_EMULATE|OPT_BOURNE}, SHWORDSPLIT}, {{NULL, "singlecommand", OPT_SPECIAL}, SINGLECOMMAND}, {{NULL, "singlelinezle", OPT_KSH}, SINGLELINEZLE}, diff --git a/Src/parse.c b/Src/parse.c index 08919b2da..10c9b4c29 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -1593,7 +1593,7 @@ par_repeat(int *cmplx) if (tok != ZEND) YYERRORV(oecused); zshlex(); - } else if (unset(SHORTLOOPS)) { + } else if (unset(SHORTLOOPS) && unset(SHORTREPEAT)) { YYERRORV(oecused); } else par_save_list1(cmplx); diff --git a/Src/zsh.h b/Src/zsh.h index d72c338da..1f2d774a1 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -2508,6 +2508,7 @@ enum { SHNULLCMD, SHOPTIONLETTERS, SHORTLOOPS, + SHORTREPEAT, SHWORDSPLIT, SINGLECOMMAND, SINGLELINEZLE, -- cgit 1.4.1