Skip to content

Commit

Permalink
Fixed the endf ambiguity
Browse files Browse the repository at this point in the history
  • Loading branch information
ubaldot committed Jul 24, 2024
1 parent a963ca6 commit 647dfa7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/vim9_convert_functions.vim
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ export def TransformBuffer(...bufnr: list<string>)
if !(transformed_line =~ '^\s*#')
transformed_line = transformed_line
# Replace all occurrences of 'func', etc. with 'def', etc
->substitute('fu\l*[!]\?\s', 'def ', 'g')
->substitute('^\s*fu\l*[!]\?\s', 'def ', 'g')
->substitute(' abort', '', 'g')
->substitute('endf\l*', 'enddef', 'g')
# 'endf' can be the leding part of both 'endfunc' and 'endfor'
->substitute('\(^\s*\)endf\l*', (m) => m[0] =~ 'endfor' ? m[1] .. 'endfor' : m[1] .. 'enddef', '')
# Remove all occurrences of 'call'
->substitute('cal[l]\?\s', '', 'g')
# Replace '#{' with '{' for dictionaries
Expand Down

0 comments on commit 647dfa7

Please sign in to comment.