Files
neovim/runtime/syntax
zeertzjq cedafc86df vim-patch:9c0d057: runtime(sh): Improve the matching of function definitions
- Drop the remaining undefined "shFunctionStart" references
  (gone in v7.2b.000, c236c16d0).
- Revise nestable contexts where function definitions are
  supported:
  * Stop looking for function definitions in arithmetic
    expressions.
  * Recognise function definitions enclosing other function
    definitions.
- In addition to grouping commands "{}" and "()", also match
  other compound commands (e.g. "if"; see "shFunctionCmd*")
  whenever these commands are supported as complete function
  bodies.
- Balance body delimiters "(" and ")" for "shFunctionFour"
  in Bash; match such function bodies whenever the use of
  the function parameter list "()" token is optional, i.e.
  when the "function" reserved word is present.
- Enable the use of "shFunctionFour" definitions.
- Do not claim optional leading whitespace characters before
  a matched function definition.
- Prefer patterns with ASCII atoms (e.g. "\h") to equivalent
  collections (e.g. "[A-Za-z_]") for speed.
- Accommodate word-boundary assertions in function name
  patterns to names that may start and/or end with supported
  non-word characters, e.g. "@test:".
- Match more valid function names in Bash: non-ASCII names,
  non-word names.
- Allow for function names with "do", "done", etc. prefixes;
  confine these name checks to "shDoError" and "shIfError".

fixes:   vim/vim#19619
related: vim/vim#19638

References:
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html#tag_19_09_04
https://gitweb.git.savannah.gnu.org/gitweb/?p=bash.git;a=blob_plain;f=doc/bash.html;hb=637f5c8696a6adc9b4519f1cd74aa78492266b7f
https://web.archive.org/web/20151105130220/http://www.research.att.com/sw/download/man/man1/ksh88.html
https://web.archive.org/web/20151025145158/http://www2.research.att.com/sw/download/man/man1/ksh.html
http://www.mirbsd.org/htman/i386/man1/mksh.htm

9c0d057e3d

Co-authored-by: Aliaksei Budavei <0x000c70@gmail.com>
Co-authored-by: Johnothan King <johnothanking@protonmail.com>
Co-authored-by: Doug Kearns <dougkearns@gmail.com>
2026-03-25 07:38:21 +08:00
..
2017-11-06 05:26:16 +01:00
2023-08-13 13:25:10 +01:00
2023-10-16 16:36:25 +08:00
2021-09-13 16:33:41 +02:00
2021-09-13 16:33:41 +02:00
2021-05-01 22:29:03 -04:00
2017-11-06 05:26:16 +01:00
2024-02-21 06:30:18 +08:00
2024-01-27 19:38:05 +01:00
2017-11-06 05:26:16 +01:00
2014-07-29 02:12:31 +00:00
2021-04-28 21:29:56 -04:00
2023-10-16 16:36:25 +08:00
2021-05-01 22:29:02 -04:00
2017-04-28 21:25:15 +02:00
2021-09-13 16:33:41 +02:00
2017-04-28 21:25:15 +02:00
2024-04-22 00:18:34 +02:00
2018-10-28 14:05:14 +01:00
2022-07-30 15:48:32 +02:00
2023-02-03 09:18:18 +01:00
2017-04-29 01:01:51 +02:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2023-08-23 20:36:16 +01:00
2022-07-02 11:06:03 +02:00
2017-11-06 05:26:16 +01:00
2023-08-24 11:33:06 +09:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2016-04-18 21:50:37 -07:00
2017-04-28 21:25:15 +02:00
2022-11-10 09:05:25 +00:00
2017-11-06 05:26:16 +01:00
2014-07-29 02:12:31 +00:00
2017-11-06 05:26:16 +01:00
2017-11-06 05:26:16 +01:00
2023-08-24 11:33:06 +09:00
2024-01-22 23:40:50 +01:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2023-12-15 10:30:13 +01:00
2018-10-28 14:05:14 +01:00
2017-11-06 05:26:16 +01:00
2022-06-17 20:38:21 +02:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2017-04-29 01:47:36 +02:00
2017-11-06 05:26:16 +01:00
2021-09-13 16:33:41 +02:00
2017-04-28 21:25:15 +02:00
2023-08-13 13:25:10 +01:00
2023-12-29 00:54:09 +01:00
2021-09-13 16:33:41 +02:00
2021-04-27 09:21:32 -04:00
2017-11-06 05:26:16 +01:00
2016-06-07 06:46:37 -04:00
2021-04-27 09:21:28 -04:00
2017-04-28 21:13:55 +02:00
2017-04-28 21:25:15 +02:00
2024-02-21 06:30:18 +08:00
2023-10-27 10:06:52 +02:00
2024-02-27 10:31:11 +01:00
2017-04-28 21:25:15 +02:00
2017-11-06 05:26:16 +01:00
2023-02-03 09:18:18 +01:00
2022-09-28 12:48:36 +02:00
2017-11-06 05:26:16 +01:00
2017-11-06 05:26:16 +01:00
2022-06-17 20:38:21 +02:00
2014-07-29 02:12:31 +00:00
2017-04-28 21:13:55 +02:00
2021-05-02 11:51:38 -04:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2021-05-01 22:29:02 -04:00
2017-11-06 05:26:16 +01:00
2024-02-21 06:30:18 +08:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2017-11-06 05:26:16 +01:00
2017-04-28 21:13:55 +02:00
2023-08-24 11:33:06 +09:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2024-02-21 06:30:18 +08:00
2017-04-28 21:25:15 +02:00
2014-07-29 02:12:31 +00:00
2017-04-28 21:13:55 +02:00
2017-04-28 21:25:15 +02:00
2022-07-07 08:15:33 +02:00
2023-08-31 10:58:54 +02:00
2024-02-02 08:59:49 +01:00
2021-05-02 13:00:38 -04:00
2017-11-06 05:26:16 +01:00
2023-08-16 09:15:39 +02:00
2017-04-28 21:25:15 +02:00
2022-09-18 15:20:20 +02:00
2022-08-31 08:08:51 +02:00
2017-04-28 21:25:15 +02:00
2021-09-13 06:05:27 -07:00
2021-05-01 22:29:03 -04:00
2023-12-29 00:54:09 +01:00
2023-12-29 00:54:09 +01:00
2017-11-07 23:07:03 +01:00
2022-01-11 14:14:17 +01:00
2017-04-28 21:13:55 +02:00
2017-04-28 21:13:55 +02:00
2021-11-17 10:02:59 +01:00
2024-04-13 22:41:51 +02:00
2017-04-28 21:25:15 +02:00
2023-08-24 11:33:06 +09:00
2024-02-21 06:30:18 +08:00
2021-09-22 06:12:06 -07:00
2017-04-28 21:25:15 +02:00
2023-08-24 11:33:06 +09:00
2017-11-06 05:26:16 +01:00
2017-11-06 05:26:16 +01:00
2017-04-28 21:13:55 +02:00
2021-04-27 09:21:31 -04:00
2021-09-13 16:33:41 +02:00
2017-04-28 21:13:55 +02:00
2017-04-28 21:13:55 +02:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2019-08-02 16:20:22 +02:00
2021-04-27 09:21:27 -04:00
2017-11-06 05:26:16 +01:00
2017-04-28 21:13:55 +02:00
2021-05-01 14:22:52 -04:00
2017-04-28 21:13:55 +02:00
2022-06-17 20:38:21 +02:00
2021-09-13 16:33:41 +02:00
2017-04-28 21:25:15 +02:00
2017-11-06 05:26:16 +01:00
2021-04-27 09:21:30 -04:00
2022-06-17 20:38:21 +02:00
2021-04-27 21:31:28 -04:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2023-12-22 01:07:50 +01:00
2024-04-27 11:01:14 +02:00
2021-09-04 19:49:17 +02:00
2023-09-17 22:52:56 +02:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2023-04-23 15:22:55 +02:00
2017-11-06 05:26:16 +01:00
2021-05-01 14:22:52 -04:00
2024-02-21 06:30:18 +08:00
2017-11-06 05:26:16 +01:00
2017-11-06 05:26:16 +01:00
2017-04-28 21:25:15 +02:00
2017-11-06 05:26:16 +01:00
2022-03-20 10:48:10 +01:00
2024-02-21 06:30:18 +08:00
2023-08-24 11:33:06 +09:00
2017-11-06 05:26:16 +01:00
2023-04-23 15:22:55 +02:00
2017-11-06 05:26:16 +01:00
2021-05-01 22:29:02 -04:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2023-05-15 09:38:32 +02:00
2021-05-02 12:44:04 -04:00
2021-05-02 12:44:04 -04:00
2017-11-06 05:26:16 +01:00
2017-11-06 05:26:16 +01:00
2023-08-13 13:25:10 +01:00
2024-02-21 06:30:18 +08:00
2022-10-17 08:19:48 +02:00
2023-12-22 01:07:50 +01:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2023-12-28 10:42:09 +01:00
2023-06-11 12:40:22 +01:00
2021-05-01 23:47:11 -04:00
2017-04-28 23:49:16 +02:00
2017-04-28 21:25:15 +02:00
2018-10-28 14:01:46 +01:00
2017-04-28 21:13:55 +02:00
2017-11-06 05:26:16 +01:00
2023-08-23 20:36:16 +01:00
2017-04-29 01:47:36 +02:00
2015-12-17 21:56:41 -05:00
2017-04-28 21:13:55 +02:00
2017-04-28 21:25:15 +02:00
2019-09-06 18:44:52 -07:00
2017-11-07 03:23:37 +01:00
2017-11-06 05:26:16 +01:00
2023-04-23 15:22:55 +02:00
2023-08-13 13:25:10 +01:00
2021-09-13 16:33:41 +02:00
2024-01-16 23:08:41 +00:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2024-03-31 23:05:38 +02:00
2021-04-28 21:29:57 -04:00
2017-04-28 21:13:55 +02:00
2017-11-06 05:26:16 +01:00
2021-05-01 22:29:02 -04:00
2017-04-28 21:25:15 +02:00
2014-07-29 02:12:31 +00:00
2018-10-29 09:50:08 +01:00
2017-04-28 21:25:15 +02:00
2021-09-22 06:12:06 -07:00
2017-04-28 21:25:15 +02:00
2018-10-28 14:05:14 +01:00
2017-11-06 05:26:16 +01:00
2017-11-06 05:26:16 +01:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2021-05-02 10:33:32 -04:00
2021-05-01 23:19:57 -04:00
2017-04-28 21:13:55 +02:00
2021-05-01 22:29:02 -04:00
2017-11-06 05:26:16 +01:00
2021-05-02 12:03:34 -04:00
2021-05-02 12:03:34 -04:00
2017-11-06 05:26:16 +01:00
2024-02-21 06:30:18 +08:00
2024-11-21 06:50:30 +08:00
2024-02-21 06:30:18 +08:00
2017-11-06 05:26:16 +01:00
2019-07-29 20:50:07 +02:00
2021-05-02 12:44:04 -04:00
2022-01-23 18:38:41 +01:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2018-10-29 09:55:07 +01:00
2023-08-23 20:31:07 +01:00
2017-04-28 21:25:15 +02:00
2022-12-08 16:33:38 +01:00
2017-04-28 21:25:15 +02:00
2024-02-21 06:30:18 +08:00
2024-02-21 06:30:18 +08:00
2017-11-06 05:26:16 +01:00
2014-07-29 02:12:31 +00:00
2021-05-01 22:29:02 -04:00
2021-11-17 10:02:59 +01:00
2024-02-21 06:30:18 +08:00
2021-05-01 22:29:02 -04:00
2021-05-01 22:29:02 -04:00
2017-11-07 03:23:37 +01:00
2022-03-20 10:48:10 +01:00
2017-04-28 21:25:15 +02:00
2017-11-07 01:27:14 +01:00
2023-09-11 10:05:54 +02:00
2017-04-28 21:25:15 +02:00
2016-04-18 21:36:16 -07:00
2021-04-27 09:21:31 -04:00
2017-04-28 21:25:15 +02:00
2022-06-17 20:38:21 +02:00
2017-11-06 05:26:16 +01:00
2017-11-06 05:26:16 +01:00
2017-11-06 05:26:16 +01:00
2021-05-01 22:29:03 -04:00
2017-04-28 21:25:15 +02:00
2015-11-01 21:27:28 +03:00
2017-11-06 05:26:16 +01:00
2021-05-01 22:29:03 -04:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2017-11-07 01:46:19 +01:00
2017-11-06 05:26:16 +01:00
2017-11-06 05:26:16 +01:00
2017-11-06 05:26:16 +01:00
2023-08-24 11:33:06 +09:00
2024-02-21 06:30:18 +08:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2023-10-16 16:36:25 +08:00
2017-04-28 21:13:55 +02:00
2017-04-28 21:13:55 +02:00
2017-04-28 21:13:55 +02:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:13:55 +02:00
2023-08-24 11:33:06 +09:00
2017-04-28 21:25:15 +02:00
2023-12-09 07:45:31 +08:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2021-04-27 09:21:34 -04:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2017-11-06 05:26:16 +01:00
2016-04-18 21:50:37 -07:00
2017-04-28 21:25:15 +02:00
2024-02-21 06:30:18 +08:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2022-06-15 09:20:32 +02:00
2022-06-17 20:38:21 +02:00
2017-04-28 21:13:55 +02:00
2023-08-13 13:25:10 +01:00
2018-10-29 23:55:45 +01:00
2017-11-06 05:26:16 +01:00
2021-12-16 21:46:13 +01:00
2023-08-24 11:33:06 +09:00
2021-05-01 23:19:58 -04:00
2021-05-01 22:29:02 -04:00
2023-02-03 09:18:18 +01:00
2017-04-28 21:25:15 +02:00
2017-11-06 05:26:16 +01:00
2023-08-24 11:33:06 +09:00
2023-10-16 16:36:25 +08:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2017-11-06 05:26:16 +01:00
2017-11-06 05:26:16 +01:00
2017-11-06 05:26:16 +01:00
2017-04-28 23:14:36 +02:00
2017-11-06 05:26:16 +01:00
2017-04-28 21:13:55 +02:00
2021-12-06 13:55:38 +01:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:25:15 +02:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2015-08-15 15:25:30 -03:00
2017-04-28 21:25:15 +02:00
2017-04-28 21:13:55 +02:00
2022-12-08 16:33:38 +01:00
2017-04-28 21:25:15 +02:00
2014-07-29 02:12:31 +00:00
2014-07-29 02:12:31 +00:00
2017-11-06 05:26:16 +01:00
2024-02-21 06:30:18 +08:00
2017-11-06 05:26:16 +01:00
2017-05-01 13:32:51 +02:00
2021-04-27 09:21:34 -04:00
2024-02-21 06:30:18 +08:00
2024-02-21 06:30:18 +08:00
2017-04-28 21:25:15 +02:00
2023-10-19 10:20:55 -05:00
2023-08-23 20:36:16 +01:00
2022-12-08 16:33:38 +01:00
2023-09-02 11:08:29 +02:00

This directory contains Vim scripts for syntax highlighting.

These scripts are not for a language, but are used by Vim itself:

syntax.vim	Used for the ":syntax on" command.  Uses synload.vim.

manual.vim	Used for the ":syntax manual" command.  Uses synload.vim.

synload.vim	Contains autocommands to load a language file when a certain
		file name (extension) is used.  And sets up the Syntax menu
		for the GUI.

nosyntax.vim	Used for the ":syntax off" command.  Undo the loading of
		synload.vim.

The "shared" directory contains generated files and what is used by more than
one syntax.


A few special files:

2html.vim	Converts any highlighted file to HTML (GUI only).
colortest.vim	Check for color names and actual color on screen.
hitest.vim	View the current highlight settings.
whitespace.vim  View Tabs and Spaces.


If you want to write a syntax file, read the docs at ":help usr_44.txt".

If you make a new syntax file which would be useful for others, please send it
to the vim-dev mailing list <vim-dev@vim.org>.  Include instructions for
detecting the file type for this language, by file name extension or by
checking a few lines in the file. And please write the file in a portable way,
see ":help 44.12".

If you have remarks about an existing file, send them to the maintainer of
that file.  Only when you get no response send a message to the vim-dev
mailing list: <vim-dev@vim.org>.

If you are the maintainer of a syntax file and make improvements, send the new
version to the vim-dev mailing list: <vim-dev@vim.org>

For further info see ":help syntax" in Vim.