Files
neovim/runtime
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
..
2026-01-07 08:11:42 +08:00
2023-08-13 13:25:10 +01:00
2026-03-24 00:14:55 +01:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2023-08-13 13:25:10 +01:00
2025-03-26 14:48:09 +01:00