docs: list reserved keywords

This commit is contained in:
David Adam 2022-06-16 18:21:19 +10:00
parent 0bc524340c
commit 0431f21bb2
2 changed files with 3 additions and 0 deletions

View file

@ -68,6 +68,8 @@ By using one of the event handler switches, a function can be made to run automa
- ``fish_cancel``, which is emitted when a commandline is cleared (used for terminal-shell integration).
Functions may not be named the same as a reserved keyword. These are elements of fish syntax or builtin commands which are essential for the operations of the shell. Current reserved words are ``[``, ``_``, ``and``, ``argparse``, ``begin``, ``break``, ``builtin``, ``case``, ``command``, ``continue``, ``else``, ``end``, ``eval``, ``exec``, ``for``, ``function``, ``if``, ``not``, ``or``, ``read``, ``return``, ``set``, ``status``, ``string``, ``switch``, ``test``, ``time``, and ``while``.
Example
-------

View file

@ -22,6 +22,7 @@ static const wcstring subcommand_keywords[]{L"command", L"builtin", L"while", L"
static const string_set_t block_keywords = {L"for", L"while", L"if",
L"function", L"switch", L"begin"};
// Don't forget to add any new reserved keywords to the documentation
static const wcstring reserved_keywords[] = {
L"end", L"case", L"else", L"return", L"continue", L"break", L"argparse", L"read",
L"string", L"set", L"status", L"test", L"[", L"_", L"eval"};