// AUTO-GENERATED. DO NOT EDIT BY HAND.
//
// Source: zsh upstream `/Users/wizard/forkedRepos/zsh/Doc/Zsh/grammar.yo`.
// Regen: ./scripts/gen_option_docs.py --source keywords /Users/wizard/forkedRepos/zsh/Doc/Zsh/grammar.yo > <this file>
// Generated: 2026-05-23
/// Canonical keyword name → markdown documentation body.
/// Pulled verbatim from every `item(tt(NAME))(...)` block in
/// the upstream yodl source. Use [`lookup_keyword_doc`] to resolve
/// case-insensitive lookups and any negated/compact aliases.
pub const KEYWORD_DOCS: &[(&str, &str)] = &[
("-", "The command is executed with a \"-\" prepended to its\n`argv[0]` string."),
("builtin", "The command word is taken to be the name of a builtin command,\nrather than a shell function or external command."),
("command", "The command word is taken to be the name of an external command,\nrather than a shell function or builtin. If the `POSIX_BUILTINS` option\nis set, builtins will also be executed but certain special properties\nof them are suppressed. The `-p` flag causes a default path to be\nsearched instead of that in `$path`. With the `-v` flag, `command`\nis similar to `whence` and with `-V`, it is equivalent to `whence\n-v`."),
("exec", "The following command together with any arguments is run in place\nof the current process, rather than as a sub-process. The shell does not\nfork and is replaced. The shell does not invoke `TRAPEXIT`, nor does it\nsource `zlogout` files.\nThe options are provided for compatibility with other shells.\n\nThe `-c` option clears the environment.\n\nThe `-l` option is equivalent to the `-` precommand modifier, to\ntreat the replacement command as a login shell; the command is executed\nwith a `-` prepended to its `argv[0]` string. This flag has no effect\nif used together with the `-a` option.\n\nThe `-a` option is used to specify explicitly the `argv[0]` string\n(the name of the command as seen by the process itself) to be used by the\nreplacement command and is directly equivalent to setting a value\nfor the `ARGV0` environment variable."),
("nocorrect", "Spelling correction is not done on any of the words. This must appear\nbefore any other precommand modifier, as it is interpreted immediately,\nbefore any parsing is done. It has no effect in non-interactive shells."),
("noglob", "Filename generation (globbing) is not performed on any of the words."),
("if", "The `if` _list_ is executed, and if it returns a zero exit status,\nthe `then` _list_ is executed.\nOtherwise, the `elif` _list_ is executed and if its status is zero,\nthe `then` _list_ is executed.\nIf each `elif` _list_ returns nonzero status, the `else` _list_\nis executed."),
("for", "Expand the list of _word_s, and set the parameter\n_name_ to each of them in turn, executing _list_\neach time. If the ``in\" _word_\" is omitted,\nuse the positional parameters instead of the _word_s.\nIf any _name_ has been declared as a named reference,\nthe corresponding _word_ is treated as the name of a\nparameter and _name_ is made a reference to that.\nNote that for the positional parameters, this treats the\nvalue of each positional as parameter name rather than\ncreating a reference to the position.\n\nThe _term_ consists of one or more newline or `;`\nwhich terminate the _word_s, and are optional when the\n``in\" _word_\" is omitted.\n\nMore than one parameter _name_ can appear before the list of\n_word_s. If _N_ _name_s are given, then on each execution of the\nloop the next _N_ _word_s are assigned to the corresponding\nparameters. If there are more _name_s than remaining _word_s, the\nremaining parameters are each set to the empty string. Execution of the\nloop ends when there is no remaining _word_ to assign to the first\n_name_. It is only possible for `in` to appear as the first _name_\nin the list, else it will be treated as marking the end of the list."),
("for", "The arithmetic expression _expr1_ is evaluated first (see\n_Arithmetic Evaluation_ (below)). The arithmetic expression\n_expr2_ is repeatedly evaluated until it evaluates to zero and\nwhen non-zero, _list_ is executed and the arithmetic expression\n_expr3_ evaluated. If any expression is omitted, then it behaves\nas if it evaluated to 1."),
("while", "Execute the `do` _list_ as long as the `while` _list_\nreturns a zero exit status."),
("until", "Execute the `do` _list_ as long as `until` _list_\nreturns a nonzero exit status."),
("repeat", "_word_ is expanded and treated as an arithmetic expression,\nwhich must evaluate to a number _n_.\n_list_ is then executed _n_ times.\n\nThe `repeat` syntax is disabled by default when the\nshell starts in a mode emulating another shell. It can be enabled\nwith the command \"enable -r repeat\""),
("case", "Execute the _list_ associated with the first _pattern_\nthat matches _word_, if any. The form of the patterns\nis the same as that used for filename generation. See\n_Filename Generation_ (zshexpn).\n\nNote further that, unless the `SH_GLOB` option is set, the whole\npattern with alternatives is treated by the shell as equivalent to a\ngroup of patterns within parentheses, although white space may appear\nabout the parentheses and the vertical bar and will be stripped from the\npattern at those points. White space may appear elsewhere in the\npattern; this is not stripped. If the `SH_GLOB` option is set, so\nthat an opening parenthesis can be unambiguously treated as part of the\ncase syntax, the expression is parsed into separate words and these are\ntreated as strict alternatives (as in other shells).\n\nIf the _list_ that is executed is terminated with `;&` rather than\n`;;`, the following list is also executed. The rule for\nthe terminator of the following list `;;`, `;&` or `;|` is\napplied unless the `esac` is reached.\n\nIf the _list_ that is executed is terminated with `;|` the\nshell continues to scan the _pattern_s looking for the next match,\nexecuting the corresponding _list_, and applying the rule for\nthe corresponding terminator `;;`, `;&` or `;|`.\nNote that _word_ is not re-expanded; all applicable _pattern_s\nare tested with the same _word_."),
("select", "where _term_ is one or more newline or `;` to terminate the _word_s.\nvindex(REPLY, use of)\nPrint the set of _word_s, each preceded by a number.\nIf the `in` _word_ is omitted, use the positional parameters.\nThe `PROMPT3` prompt is printed and a line is read from the line editor\nif the shell is interactive and that is active, or else standard input.\nIf this line consists of the\nnumber of one of the listed _word_s, then the parameter _name_\nis set to the _word_ corresponding to this number.\nIf this line is empty, the selection list is printed again.\nOtherwise, the value of the parameter _name_ is set to null.\nThe contents of the line read from standard input is saved\nin the parameter `REPLY`. _list_ is executed\nfor each selection until a break or end-of-file is encountered."),
("LPAR", "Execute _list_ in a subshell. Traps set by the `trap` builtin\nare reset to their default values while executing _list_; an\nexception is that ignored signals will continue to be ignored\nif the option `POSIXTRAPS` is set."),
("always", "First execute _try-list_. Regardless of errors, or `break` or\n`continue` commands encountered within _try-list_,\nexecute _always-list_. Execution then continues from the\nresult of the execution of _try-list_; in other words, any error,\nor `break` or `continue` command is treated in the\nnormal way, as if _always-list_ were not present. The two\nchunks of code are referred to as the \"try block\" and the \"always block\".\n\nOptional newlines or semicolons may appear after the `always`;\nnote, however, that they may _not_ appear between the preceding\nclosing brace and the `always`.\n\nAn \"error\" in this context is a condition such as a syntax error which\ncauses the shell to abort execution of the current function, script, or\nlist. Syntax errors encountered while the shell is parsing the\ncode do not cause the _always-list_ to be executed. For example,\nan erroneously constructed `if` block in _try-list_ would cause the\nshell to abort during parsing, so that _always-list_ would not be\nexecuted, while an erroneous substitution such as `${*foo*}` would\ncause a run-time error, after which _always-list_ would be executed.\n\nAn error condition can be tested and reset with the special integer\nvariable `TRY_BLOCK_ERROR`. Outside an _always-list_ the value is\nirrelevant, but it is initialised to `-1`. Inside _always-list_, the\nvalue is 1 if an error occurred in the _try-list_, else 0. If\n`TRY_BLOCK_ERROR` is set to 0 during the _always-list_, the error\ncondition caused by the _try-list_ is reset, and shell execution\ncontinues normally after the end of _always-list_. Altering the value\nduring the _try-list_ is not useful (unless this forms part of an\nenclosing `always` block).\n\nRegardless of `TRY_BLOCK_ERROR`, after the end of _always-list_ the\nnormal shell status `$?` is the value returned from _try-list_.\nThis will be non-zero if there was an error, even if `TRY_BLOCK_ERROR`\nwas set to zero.\n\nThe following executes the given code, ignoring any errors it causes.\nThis is an alternative to the usual convention of protecting code by\nexecuting it in a subshell.\n\nexample({\n # code which may cause an error\n } always {\n # This code is executed regardless of the error.\n (( TRY_BLOCK_ERROR = 0 ))\n}\n# The error condition has been reset.)\n\nWhen a `try` block occurs outside of any function,\na `return` or a `exit` encountered in _try-list_ does _not_ cause\nthe execution of _always-list_. Instead, the shell exits immediately\nafter any `EXIT` trap has been executed.\nOtherwise, a `return` command encountered in _try-list_ will cause the\nexecution of _always-list_, just like `break` and `continue`.\n\nCOMMENT(The semantics of calling 'exit' in try-list inside a function are\ndeliberately left unspecified, because historically there was a mismatch between\nthe documented and implemented behaviours. Cf. 20076, 21734/21735, 45075.)"),
("function", "where _term_ is one or more newline or `;`.\nDefine a function which is referenced by any one of _word_.\nNormally, only one _word_ is provided; multiple _word_s\nare usually only useful for setting traps.\nThe body of the function is the _list_ between\nthe `{` and `}`. See _Functions_ (blow).\n\nThe options of `function` have the following meanings:\n\n\n- **-T** — Enable tracing for this function, as though with `functions -T`. See the\ndocumentation of the `-f` option to the `typeset` builtin, in\n_Shell Builtin Commands_ (zshbuiltins).\n\n\nIf the option `SH_GLOB` is set for compatibility with other shells, then\nwhitespace may appear between the left and right parentheses when\nthere is a single _word_; otherwise, the parentheses will be treated as\nforming a globbing pattern in that case.\n\nIn any of the forms above, a redirection may appear outside the\nfunction body, for example\n\nexample(func+() { ... } 2>&1)\n\nThe redirection is stored with the function and applied whenever the\nfunction is executed. Any variables in the redirection are expanded\nat the point the function is executed, but outside the function scope."),
("time", "The _pipeline_ is executed, and timing statistics are\nreported on the standard error in the form specified\nby the `TIMEFMT` parameter.\nIf _pipeline_ is omitted, print statistics about the\nshell process and its children."),
("[[", "Evaluates the conditional expression _exp_\nand return a zero exit status if it is true.\nSee _Conditional Expressions_ (below)\nfor a description of _exp_."),
("if", "An alternate form of `if`. The rules mean that\n\n if [[ -o ignorebraces ]] {\n print yes\n}\n\nworks, but\n\n if true { # Does not work!\n print yes\n}\n\ndoes _not_, since the test is not suitably delimited."),
("if", "A short form of the alternate `if`. The same limitations on the form of\n_list_ apply as for the previous form."),
("for", "A short form of `for`."),
("for", "where _term_ is at least one newline or `;`.\nAnother short form of `for`."),
("for", "A short form of the arithmetic `for` command."),
("foreach", "Another form of `for`."),
("while", "An alternative form of `while`. Note the limitations on the form of\n_list_ mentioned above."),
("until", "An alternative form of `until`. Note the limitations on the form of\n_list_ mentioned above."),
("repeat", "This is a short form of `repeat`."),
("case", "An alternative form of `case`."),
("select", "where _term_ is at least one newline or `;`.\nA short form of `select`."),
("function", "This is a short form of `function`."),
];
/// Resolve a keyword name (exact match) to its
/// canonical name + markdown body.
pub fn lookup_keyword_doc(name: &str) -> Option<(&'static str, &'static str)> {
KEYWORD_DOCS.iter().find(|(n, _)| *n == name).map(|&(n, d)| (n, d))
}