diff options
-rw-r--r-- | .github/CODEOWNERS | 3 | ||||
-rw-r--r-- | Filelist | 2 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | runtime/autoload/freebasic.vim | 7 | ||||
-rw-r--r-- | runtime/doc/filetype.txt | 19 | ||||
-rw-r--r-- | runtime/doc/quickfix.txt | 3 | ||||
-rw-r--r-- | runtime/doc/syntax.txt | 15 | ||||
-rw-r--r-- | runtime/doc/tags | 17 | ||||
-rw-r--r-- | runtime/doc/todo.txt | 22 | ||||
-rw-r--r-- | runtime/doc/xxd.man | 26 | ||||
-rw-r--r-- | runtime/ftplugin/basic.vim | 13 | ||||
-rw-r--r-- | runtime/ftplugin/fetchmail.vim | 15 | ||||
-rw-r--r-- | runtime/ftplugin/freebasic.vim | 32 | ||||
-rw-r--r-- | runtime/ftplugin/vue.vim | 24 | ||||
-rw-r--r-- | runtime/pack/dist/opt/cfilter/plugin/cfilter.vim | 120 | ||||
-rw-r--r-- | runtime/spell/sr/README_sr.txt | 14 | ||||
-rw-r--r-- | runtime/spell/sr/convert.vim | 30 | ||||
-rw-r--r-- | runtime/syntax/basic.vim | 4 | ||||
-rw-r--r-- | runtime/syntax/fetchmail.vim | 110 | ||||
-rw-r--r-- | runtime/syntax/freebasic.vim | 685 |
20 files changed, 869 insertions, 294 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f5a45c4d9..16b73fa85 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -111,6 +111,7 @@ runtime/ftplugin/dosbatch.vim @mrdubya runtime/ftplugin/eiffel.vim @dkearns runtime/ftplugin/erlang.vim @hcs42 runtime/ftplugin/eruby.vim @tpope @dkearns +runtime/ftplugin/fetchmail.vim @dkearns runtime/ftplugin/fpcmake.vim @dkearns runtime/ftplugin/freebasic.vim @dkearns runtime/ftplugin/fstab.vim @rid9 @@ -298,8 +299,10 @@ runtime/syntax/erlang.vim @hcs42 runtime/syntax/eruby.vim @tpope @dkearns runtime/syntax/exports.vim @cecamp runtime/syntax/falcon.vim @steveno +runtime/syntax/fetchmail.vim @dkearns runtime/syntax/forth.vim @jkotlinski runtime/syntax/fpcmake.vim @dkearns +runtime/syntax/freebasic.vim @dkearns runtime/syntax/fstab.vim @rid9 runtime/syntax/git.vim @tpope runtime/syntax/gitcommit.vim @tpope @@ -15,7 +15,6 @@ SRC_ALL = \ .gitignore \ .hgignore \ .lgtm.yml \ - .travis.yml \ .appveyor.yml \ .codecov.yml \ ci/appveyor.bat \ @@ -1017,6 +1016,7 @@ LANG_GEN = \ runtime/spell/??/*.diff \ runtime/spell/??/main.aap \ runtime/spell/sr/README_sr.txt \ + runtime/spell/sr/convert.vim \ runtime/spell/tet/*.diff \ runtime/spell/tet/main.aap \ runtime/spell/check/main.aap \ @@ -1,6 +1,6 @@ [![Vim Logo](https://github.com/vim/vim/raw/master/runtime/vimlogo.gif)](https://www.vim.org) -[![Github Build status](https://github.com/vim/vim/workflows/GitHub%20CI/badge.svg)](https://github.com/vim/vim/actions?query=workflow%3A%22GitHub+CI%22) [![Travis Build Status](https://travis-ci.com/vim/vim.svg?branch=master)](https://travis-ci.com/github/vim/vim) [![Appveyor Build status](https://ci.appveyor.com/api/projects/status/o2qht2kjm02sgghk?svg=true)](https://ci.appveyor.com/project/chrisbra/vim) [![Cirrus Build Status](https://api.cirrus-ci.com/github/vim/vim.svg)](https://cirrus-ci.com/github/vim/vim) [![Coverage Status](https://codecov.io/gh/vim/vim/coverage.svg?branch=master)](https://codecov.io/gh/vim/vim?branch=master) [![Coverity Scan](https://scan.coverity.com/projects/241/badge.svg)](https://scan.coverity.com/projects/vim) [![Language Grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/vim/vim.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/vim/vim/context:cpp) [![Debian CI](https://badges.debian.net/badges/debian/testing/vim/version.svg)](https://buildd.debian.org/vim) [![Packages](https://repology.org/badge/tiny-repos/vim.svg)](https://repology.org/metapackage/vim) [![Fossies codespell report](https://fossies.org/linux/test/vim-master.tar.gz/codespell.svg)](https://fossies.org/linux/test/vim-master.tar.gz/codespell.html) +[![Github Build status](https://github.com/vim/vim/workflows/GitHub%20CI/badge.svg)](https://github.com/vim/vim/actions?query=workflow%3A%22GitHub+CI%22) [![Appveyor Build status](https://ci.appveyor.com/api/projects/status/o2qht2kjm02sgghk?svg=true)](https://ci.appveyor.com/project/chrisbra/vim) [![Cirrus Build Status](https://api.cirrus-ci.com/github/vim/vim.svg)](https://cirrus-ci.com/github/vim/vim) [![Coverage Status](https://codecov.io/gh/vim/vim/coverage.svg?branch=master)](https://codecov.io/gh/vim/vim?branch=master) [![Coverity Scan](https://scan.coverity.com/projects/241/badge.svg)](https://scan.coverity.com/projects/vim) [![Language Grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/vim/vim.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/vim/vim/context:cpp) [![Debian CI](https://badges.debian.net/badges/debian/testing/vim/version.svg)](https://buildd.debian.org/vim) [![Packages](https://repology.org/badge/tiny-repos/vim.svg)](https://repology.org/metapackage/vim) [![Fossies codespell report](https://fossies.org/linux/test/vim-master.tar.gz/codespell.svg)](https://fossies.org/linux/test/vim-master.tar.gz/codespell.html) <sub>For translations of this README see the end.</sub> diff --git a/runtime/autoload/freebasic.vim b/runtime/autoload/freebasic.vim index 428cf1382..6c94cd34e 100644 --- a/runtime/autoload/freebasic.vim +++ b/runtime/autoload/freebasic.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: FreeBASIC " Maintainer: Doug Kearns <dougkearns@gmail.com> -" Last Change: 2021 Mar 16 +" Last Change: 2022 June 24 " Dialects can be one of fb, qb, fblite, or deprecated " Precedence is forcelang > #lang > lang @@ -18,17 +18,16 @@ function! freebasic#GetDialect() abort " override with #lang directive or metacommand - let skip = "has('syntax_items') && synIDattr(synID(line('.'), col('.'), 1), 'name') =~ 'Comment$'" let pat = '\c^\s*\%(#\s*lang\s\+\|''\s*$lang\s*:\s*\)"\([^"]*\)"' let save_cursor = getcurpos() call cursor(1, 1) - let lnum = search(pat, 'n', '', '', skip) + let lnum = search(pat, 'cn') call setpos('.', save_cursor) if lnum let word = matchlist(getline(lnum), pat)[1] - if word =~? '\%(fb\|deprecated\|fblite\|qb\)' + if word =~? '\<\%(fb\|deprecated\|fblite\|qb\)\>' let dialect = word else echomsg "freebasic#GetDialect: Invalid lang, found '" .. word .. "' at line " .. lnum .. " " .. getline(lnum) diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index 90ae3e7ac..d04e4ac13 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -556,12 +556,30 @@ For further discussion of fortran_have_tabs and the method used for the detection of source format see |ft-fortran-syntax|. +FREEBASIC *ft-freebasic-plugin* + +This plugin aims to treat the four FreeBASIC dialects, "fb", "qb", "fblite" +and "deprecated", as distinct languages. + +The dialect will be set to the first name found in g:freebasic_forcelang, any +#lang directive or $lang metacommand in the file being edited, or finally +g:freebasic_lang. These global variables conceptually map to the fbc options +-forcelang and -lang. If no dialect is explicitly specified "fb" will be +used. + +For example, to set the dialect to a default of "fblite" but still allow for +any #lang directive overrides, use the following command: > + + let g:freebasic_lang = "fblite" + + GIT COMMIT *ft-gitcommit-plugin* One command, :DiffGitCached, is provided to show a diff of the current commit in the preview window. It is equivalent to calling "git diff --cached" plus any arguments given to the command. + GPROF *ft-gprof-plugin* The gprof filetype plugin defines a mapping <C-]> to jump from a function @@ -571,6 +589,7 @@ to the details of that function in the call graph. The mapping can be disabled with: > let g:no_gprof_maps = 1 + MAIL *ft-mail-plugin* Options: diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 0db640702..67947854d 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -568,6 +568,9 @@ pattern is used. The |:Lfilter| command does the same as |:Cfilter| but operates on the current location list. +The current quickfix/location list is not modified by these commands, so you +can go back to the unfiltered list using the |:colder|/|:lolder| command. + ============================================================================= 2. The error window *quickfix-window* diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 1229b1908..86e7edd02 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1694,6 +1694,21 @@ because Fortran90 has no reserved words. For further information related to fortran, see |ft-fortran-indent| and |ft-fortran-plugin|. +FREEBASIC *freebasic.vim* *ft-freebasic-syntax* + +FreeBASIC files will be highlighted differently for each of the four available +dialects, "fb", "qb", "fblite" and "deprecated". See |ft-freebasic-plugin| +for how to select the correct dialect. + +Highlighting is further configurable via the following variables. + +Variable Highlight ~ +*freebasic_no_comment_fold* disable multiline comment folding +*freebasic_operators* non-alpha operators +*freebasic_space_errors* trailing white space and spaces before a <Tab> +*freebasic_type_suffixes* QuickBASIC style type suffixes + + FVWM CONFIGURATION FILES *fvwm.vim* *ft-fvwm-syntax* diff --git a/runtime/doc/tags b/runtime/doc/tags index b3b44e262..c08a834de 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -988,6 +988,7 @@ $quote eval.txt /*$quote* 't_Co' term.txt /*'t_Co'* 't_Cs' term.txt /*'t_Cs'* 't_DL' term.txt /*'t_DL'* +'t_Ds' term.txt /*'t_Ds'* 't_EC' term.txt /*'t_EC'* 't_EI' term.txt /*'t_EI'* 't_F1' term.txt /*'t_F1'* @@ -1044,6 +1045,7 @@ $quote eval.txt /*$quote* 't_TI' term.txt /*'t_TI'* 't_Te' term.txt /*'t_Te'* 't_Ts' term.txt /*'t_Ts'* +'t_Us' term.txt /*'t_Us'* 't_VS' term.txt /*'t_VS'* 't_WP' term.txt /*'t_WP'* 't_WS' term.txt /*'t_WS'* @@ -1059,6 +1061,7 @@ $quote eval.txt /*$quote* 't_da' term.txt /*'t_da'* 't_db' term.txt /*'t_db'* 't_dl' term.txt /*'t_dl'* +'t_ds' term.txt /*'t_ds'* 't_fd' term.txt /*'t_fd'* 't_fe' term.txt /*'t_fe'* 't_fs' term.txt /*'t_fs'* @@ -6875,6 +6878,11 @@ format-formatexpr change.txt /*format-formatexpr* formatting change.txt /*formatting* forth.vim syntax.txt /*forth.vim* fortran.vim syntax.txt /*fortran.vim* +freebasic.vim syntax.txt /*freebasic.vim* +freebasic_no_comment_fold syntax.txt /*freebasic_no_comment_fold* +freebasic_operators syntax.txt /*freebasic_operators* +freebasic_space_errors syntax.txt /*freebasic_space_errors* +freebasic_type_suffixes syntax.txt /*freebasic_type_suffixes* friendship intro.txt /*friendship* frombook usr_01.txt /*frombook* ft-abel-syntax syntax.txt /*ft-abel-syntax* @@ -6931,6 +6939,8 @@ ft-forth-syntax syntax.txt /*ft-forth-syntax* ft-fortran-indent indent.txt /*ft-fortran-indent* ft-fortran-plugin filetype.txt /*ft-fortran-plugin* ft-fortran-syntax syntax.txt /*ft-fortran-syntax* +ft-freebasic-plugin filetype.txt /*ft-freebasic-plugin* +ft-freebasic-syntax syntax.txt /*ft-freebasic-syntax* ft-fvwm-syntax syntax.txt /*ft-fvwm-syntax* ft-gitcommit-plugin filetype.txt /*ft-gitcommit-plugin* ft-gprof-plugin filetype.txt /*ft-gprof-plugin* @@ -9726,6 +9736,7 @@ t_Ce term.txt /*t_Ce* t_Co term.txt /*t_Co* t_Cs term.txt /*t_Cs* t_DL term.txt /*t_DL* +t_Ds term.txt /*t_Ds* t_EC term.txt /*t_EC* t_EI term.txt /*t_EI* t_F1 term.txt /*t_F1* @@ -9782,6 +9793,7 @@ t_TE term.txt /*t_TE* t_TI term.txt /*t_TI* t_Te term.txt /*t_Te* t_Ts term.txt /*t_Ts* +t_Us term.txt /*t_Us* t_VS term.txt /*t_VS* t_WP term.txt /*t_WP* t_WS term.txt /*t_WS* @@ -9808,6 +9820,7 @@ t_da term.txt /*t_da* t_db term.txt /*t_db* t_dict-variable eval.txt /*t_dict-variable* t_dl term.txt /*t_dl* +t_ds term.txt /*t_ds* t_ed version4.txt /*t_ed* t_el version4.txt /*t_el* t_f1 version4.txt /*t_f1* @@ -10204,7 +10217,11 @@ u undo.txt /*u* uganda uganda.txt /*uganda* uganda.txt uganda.txt /*uganda.txt* undercurl syntax.txt /*undercurl* +underdashed syntax.txt /*underdashed* +underdotted syntax.txt /*underdotted* +underdouble syntax.txt /*underdouble* underline syntax.txt /*underline* +underline-codes syntax.txt /*underline-codes* undo undo.txt /*undo* undo-blocks undo.txt /*undo-blocks* undo-branches undo.txt /*undo-branches* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 896be454a..736340ac4 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -38,9 +38,6 @@ browser use: https://github.com/vim/vim/issues/1234 *known-bugs* -------------------- Known bugs and current work ----------------------- -Prepare for the Vim 9.0 release: -- Update version number in help - Further Vim9 improvements, possibly after launch: - Use Vim9 for more runtime files. - Check performance with callgrind and kcachegrind. @@ -201,19 +198,11 @@ Terminal emulator window: conversions. Patches considered for including: -- make functions static if possible, add a few tests. #10612 -- use ngettext() in a few more places #10606 -- move f_hasmapto() to map.c #10611 +- Add "-n" option to xxd. #10599 needs a test - allow for nesting of timeout, sketch in #10595 -- Add "-n" option to xxd. #10599 -- Add support for "underdouble", "underdot" and "underdash". #9553 - Patch to implement the vimtutor with a plugin: #6414 Was originally written by Felipe Morales. - Patch to make fillchars global-local. (#5206) -- Version of getchar() that does not move the cursor - #10603 - Use a separate argument for the new flag. -- Improved VB filetype detection. (Doug Kearns, June 26) -- Improved FreeBasic runtime files (and a second one). (Doug Kearns, June 26) Autoconf: must use autoconf 2.69, later version generates lots of warnings - try using autoconf 2.71 and fix all "obsolete" warnings @@ -236,6 +225,8 @@ pass it on with modifications. Can "CSI nr X" be used instead of outputting spaces? Is it faster? #8002 +Typed keys invisible after calling interrupt() from a timer. #10631 + With a window height of 6 and 'scrolloff' set to 3, using "j" does not scroll evenly. (#10545) Need to handle this in scroll_cursor_bot(). @@ -254,6 +245,9 @@ The line number can be obtained from win->w_lines[]. MS-Windows: did path modifier :p:8 stop working? #8600 +Version of getchar() that does not move the cursor - #10603 Use a separate +argument for the new flag. + test_arglist func Test_all_not_allowed_from_cmdwin() hangs on MS-Windows. Information for a specific terminal (e.g. gnome, tmux, konsole, alacritty) is @@ -295,6 +289,8 @@ inconsistent with the documentation. globpath() does not use 'wildignorecase' at all? (related to #8350) +mksession uses :buffer instead of :edit in one place but not another. #10629 + Add 'termguiattr' option, use "gui=" attributes in the terminal? Would work with 'termguicolors'. #1740 @@ -4423,6 +4419,8 @@ GUI: Autocommands: +9 Add WinNewPre - before creating a new window. #10635 +9 When triggering WinNew provide the window ID somehow. #10633 9 Rework the code from FEAT_OSFILETYPE for autocmd-osfiletypes to use 'filetype'. Only for when the current buffer is known. - Put autocommand event names in a hashtable for faster lookup? diff --git a/runtime/doc/xxd.man b/runtime/doc/xxd.man index 26d89e565..3eae32ab6 100644 --- a/runtime/doc/xxd.man +++ b/runtime/doc/xxd.man @@ -46,7 +46,7 @@ OPTIONS long line of output. -C | -capitalize - Capitalize variable names in C include file style, when using + Capitalize variable names in C include file style, when using -i. -E | -EBCDIC @@ -57,28 +57,32 @@ OPTIONS -e Switch to little-endian hexdump. This option treats byte groups as words in little-endian byte order. The default grouping of 4 bytes may be changed using -g. This option only applies to hex‐ - dump, leaving the ASCII (or EBCDIC) representation unchanged. + dump, leaving the ASCII (or EBCDIC) representation unchanged. The command line switches -r, -p, -i do not work with this mode. -g bytes | -groupsize bytes - Separate the output of every <bytes> bytes (two hex characters + Separate the output of every <bytes> bytes (two hex characters or eight bit-digits each) by a whitespace. Specify -g 0 to sup‐ press grouping. <Bytes> defaults to 2 in normal mode, 4 in lit‐ - tle-endian mode and 1 in bits mode. Grouping does not apply to + tle-endian mode and 1 in bits mode. Grouping does not apply to postscript or include style. -h | -help - Print a summary of available commands and exit. No hex dumping + Print a summary of available commands and exit. No hex dumping is performed. -i | -include - Output in C include file style. A complete static array defini‐ - tion is written (named after the input file), unless xxd reads + Output in C include file style. A complete static array defini‐ + tion is written (named after the input file), unless xxd reads from stdin. -l len | -len len Stop after writing <len> octets. + -n name | -name name + Override the variable name output when -i is used. The array is + named name and the length is named name_len. + -o offset Add <offset> to the displayed file position. @@ -91,8 +95,8 @@ OPTIONS not writing to stdout, xxd writes into its output file without truncating it. Use the combination -r -p to read plain hexadeci‐ mal dumps without line number information and without a particu‐ - lar column layout. Additional Whitespace and line-breaks are - allowed anywhere. + lar column layout. Additional Whitespace and line-breaks are al‐ + lowed anywhere. -seek offset When used after -r: revert with <offset> added to file positions @@ -209,8 +213,8 @@ EXAMPLES * 000fffc: 0000 0000 40 ....A - Create a 1 byte file containing a single 'A' character. The number - after '-r -s' adds to the linenumbers found in the file; in effect, the + Create a 1 byte file containing a single 'A' character. The number af‐ + ter '-r -s' adds to the linenumbers found in the file; in effect, the leading bytes are suppressed. % echo "010000: 41" | xxd -r -s -0x10000 > file diff --git a/runtime/ftplugin/basic.vim b/runtime/ftplugin/basic.vim index a8f6b088d..4399fbf3a 100644 --- a/runtime/ftplugin/basic.vim +++ b/runtime/ftplugin/basic.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: BASIC (QuickBASIC 4.5) " Maintainer: Doug Kearns <dougkearns@gmail.com> -" Last Change: 2021 Mar 16 +" Last Change: 2022 Jun 22 if exists("b:did_ftplugin") finish @@ -15,6 +15,8 @@ setlocal comments=:REM\ ,:Rem\ ,:rem\ ,:' setlocal commentstring='\ %s setlocal formatoptions-=t formatoptions+=croql +let b:undo_ftplugin = "setl fo< com< cms<" + " TODO: support exit ... as middle matches? if exists("loaded_matchit") && !exists("b:match_words") let s:line_start = '\%(^\s*\)\@<=' @@ -33,10 +35,11 @@ if exists("loaded_matchit") && !exists("b:match_words") \ '\<while\>:\<wend\>,' .. \ s:line_start .. 'if\%(.*\<then\s*\%($\|''\)\)\@=:\<\%(' .. s:line_start .. 'else\|elseif\)\>:\<end\s\+if\>,' .. \ '\<lock\>:\<unlock\>' - let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name") =~? "comment\\|string" || ' .. \ 'strpart(getline("."), 0, col(".") ) =~? "\\<exit\\s\\+"' + let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_skip b:match_words" + unlet s:line_start s:not_end s:not_end_or_exit endif @@ -44,12 +47,10 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "BASIC Source Files (*.bas)\t*.bas\n" .. \ "BASIC Include Files (*.bi, *.bm)\t*.bi;*.bm\n" .. \ "All Files (*.*)\t*.*\n" + let b:basic_set_browsefilter = 1 + let b:undo_ftplugin ..= " | unlet! b:browsefilter b:basic_set_browsefilter" endif -let b:undo_ftplugin = "setl fo< com< cms<" .. - \ " | unlet! b:match_ignorecase b:match_skip b:match_words" .. - \ " | unlet! b:browsefilter" - let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/fetchmail.vim b/runtime/ftplugin/fetchmail.vim index 33bb417be..032f6610f 100644 --- a/runtime/ftplugin/fetchmail.vim +++ b/runtime/ftplugin/fetchmail.vim @@ -1,19 +1,16 @@ " Vim filetype plugin file -" Language: fetchmail(1) RC File -" Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: fetchmail(1) RC File +" Maintainer: Doug Kearns <dougkearns@gmail.com> +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2022 Jun 30 if exists("b:did_ftplugin") finish endif let b:did_ftplugin = 1 -let s:cpo_save = &cpo -set cpo&vim +setlocal comments=:# commentstring=#\ %s +setlocal formatoptions-=t formatoptions+=croql let b:undo_ftplugin = "setl com< cms< fo<" -setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql - -let &cpo = s:cpo_save -unlet s:cpo_save diff --git a/runtime/ftplugin/freebasic.vim b/runtime/ftplugin/freebasic.vim index 58c2b4c9e..1680e84c9 100644 --- a/runtime/ftplugin/freebasic.vim +++ b/runtime/ftplugin/freebasic.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: FreeBASIC " Maintainer: Doug Kearns <dougkearns@gmail.com> -" Last Change: 2021 Mar 16 +" Last Change: 2022 Jun 24 " Setup {{{1 if exists("b:did_ftplugin") @@ -21,7 +21,8 @@ let &l:comments = "sO:*\ -,mO:*\ \ ,exO:*/,s1:/',mb:',ex:'/,:''," .. &l:comments " Match words {{{1 if exists("loaded_matchit") - let s:not_end = '\%(end\s\+\)\@<!' + let s:line_start = '\%(^\s*\)\@<=' + let s:not_end = '\%(end\s\+\)\@<!' let b:match_words ..= ',' @@ -49,17 +50,32 @@ if exists("loaded_matchit") endif let b:match_words ..= s:not_end .. '\<enum\>:\<end\s\+enum\>,' .. - \ '^#\s*\%(if\|ifdef\|ifndef\)\>:^#\s*\%(else\|elseif\)\>:^#\s*endif\>,' .. - \ '^#\s*macro\>:^#\s*endmacro\>' + \ s:line_start .. '#\s*\%(if\|ifdef\|ifndef\)\>:' .. + \ s:line_start .. '#\s*\%(else\|elseif\)\>:' .. + \ s:line_start .. '#\s*endif\>,' .. + \ s:line_start .. '#\s*macro\>:' .. s:line_start .. '#\s*endmacro\>,' .. + \ "/':'/" - " skip "function = <retval>" - let b:match_skip ..= '|| strpart(getline("."), col(".") - 1) =~? "^\\<function\\s\\+="' + " skip "function = <retval>" and "continue { do | for | while }" + if s:dialect == "qb" + let s:continue = "__continue" + else + let s:continue = "continue" + endif + let b:match_skip ..= ' || strpart(getline("."), col(".") - 1) =~? "^\\<function\\s\\+="' .. + \ ' || strpart(getline("."), 0, col(".") ) =~? "\\<' .. s:continue .. '\\s\\+"' + + unlet s:not_end s:line_start +endif - unlet s:not_end +if (has("gui_win32") || has("gui_gtk")) && exists("b:basic_set_browsefilter") + let b:browsefilter = "FreeBASIC Source Files (*.bas)\t*.bas\n" .. + \ "FreeBASIC Header Files (*.bi)\t*.bi\n" .. + \ "All Files (*.*)\t*.*\n" endif " Cleanup {{{1 let &cpo = s:cpo_save -unlet s:cpo_save +unlet s:cpo_save s:dialect " vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: diff --git a/runtime/ftplugin/vue.vim b/runtime/ftplugin/vue.vim new file mode 100644 index 000000000..e8833742a --- /dev/null +++ b/runtime/ftplugin/vue.vim @@ -0,0 +1,24 @@ +" Vim filetype plugin file +" Language: vue + +if exists("b:did_ftplugin") | finish | endif +let b:did_ftplugin = 1 + +" Make sure the continuation lines below do not cause problems in +" compatibility mode. +let s:save_cpo = &cpo +set cpo-=C + +" Copied from ftplugin/html.vim +" Original thanks to Johannes Zellner and Benji Fisher. +if exists("loaded_matchit") + let b:match_ignorecase = 1 + let b:match_words = '<:>,' + \ .. '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' + \ .. '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' + \ .. '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>' +endif + +" Restore the saved compatibility options. +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/runtime/pack/dist/opt/cfilter/plugin/cfilter.vim b/runtime/pack/dist/opt/cfilter/plugin/cfilter.vim index fe4455fe2..7a6563078 100644 --- a/runtime/pack/dist/opt/cfilter/plugin/cfilter.vim +++ b/runtime/pack/dist/opt/cfilter/plugin/cfilter.vim @@ -1,62 +1,72 @@ -" cfilter.vim: Plugin to filter entries from a quickfix/location list -" Last Change: Aug 23, 2018 -" Maintainer: Yegappan Lakshmanan (yegappan AT yahoo DOT com) -" Version: 1.1 -" -" Commands to filter the quickfix list: -" :Cfilter[!] /{pat}/ -" Create a new quickfix list from entries matching {pat} in the current -" quickfix list. Both the file name and the text of the entries are -" matched against {pat}. If ! is supplied, then entries not matching -" {pat} are used. The pattern can be optionally enclosed using one of -" the following characters: ', ", /. If the pattern is empty, then the -" last used search pattern is used. -" :Lfilter[!] /{pat}/ -" Same as :Cfilter but operates on the current location list. -" -if exists("loaded_cfilter") - finish -endif -let loaded_cfilter = 1 - -func s:Qf_filter(qf, searchpat, bang) - if a:qf - let Xgetlist = function('getqflist') - let Xsetlist = function('setqflist') - let cmd = ':Cfilter' . a:bang - else - let Xgetlist = function('getloclist', [0]) - let Xsetlist = function('setloclist', [0]) - let cmd = ':Lfilter' . a:bang - endif +vim9script - let firstchar = a:searchpat[0] - let lastchar = a:searchpat[-1:] - if firstchar == lastchar && - \ (firstchar == '/' || firstchar == '"' || firstchar == "'") - let pat = a:searchpat[1:-2] - if pat == '' - " Use the last search pattern - let pat = @/ - endif - else - let pat = a:searchpat - endif +# cfilter.vim: Plugin to filter entries from a quickfix/location list +# Last Change: Jun 30, 2022 +# Maintainer: Yegappan Lakshmanan (yegappan AT yahoo DOT com) +# Version: 2.0 +# +# Commands to filter the quickfix list: +# :Cfilter[!] /{pat}/ +# Create a new quickfix list from entries matching {pat} in the current +# quickfix list. Both the file name and the text of the entries are +# matched against {pat}. If ! is supplied, then entries not matching +# {pat} are used. The pattern can be optionally enclosed using one of +# the following characters: ', ", /. If the pattern is empty, then the +# last used search pattern is used. +# :Lfilter[!] /{pat}/ +# Same as :Cfilter but operates on the current location list. +# + +def Qf_filter(qf: bool, searchpat: string, bang: string) + var Xgetlist: func + var Xsetlist: func + var cmd: string + var firstchar: string + var lastchar: string + var pat: string + var title: string + var Cond: func + var items: list<any> + + if qf + Xgetlist = function('getqflist') + Xsetlist = function('setqflist') + cmd = ':Cfilter' .. bang + else + Xgetlist = function('getloclist', [0]) + Xsetlist = function('setloclist', [0]) + cmd = ':Lfilter' .. bang + endif + firstchar = searchpat[0] + lastchar = searchpat[-1 :] + if firstchar == lastchar && + (firstchar == '/' || firstchar == '"' || firstchar == "'") + pat = searchpat[1 : -2] if pat == '' - return + # Use the last search pattern + pat = @/ endif + else + pat = searchpat + endif - if a:bang == '!' - let cond = 'v:val.text !~# pat && bufname(v:val.bufnr) !~# pat' - else - let cond = 'v:val.text =~# pat || bufname(v:val.bufnr) =~# pat' - endif + if pat == '' + return + endif + + if bang == '!' + Cond = (_, val) => val.text !~# pat && bufname(val.bufnr) !~# pat + else + Cond = (_, val) => val.text =~# pat || bufname(val.bufnr) =~# pat + endif + + items = filter(Xgetlist(), Cond) + title = cmd .. ' /' .. pat .. '/' + Xsetlist([], ' ', {title: title, items: items}) +enddef - let items = filter(Xgetlist(), cond) - let title = cmd . ' /' . pat . '/' - call Xsetlist([], ' ', {'title' : title, 'items' : items}) -endfunc +command! -nargs=+ -bang Cfilter Qf_filter(true, <q-args>, <q-bang>) +command! -nargs=+ -bang Lfilter Qf_filter(false, <q-args>, <q-bang>) -com! -nargs=+ -bang Cfilter call s:Qf_filter(1, <q-args>, <q-bang>) -com! -nargs=+ -bang Lfilter call s:Qf_filter(0, <q-args>, <q-bang>) +# vim: shiftwidth=2 sts=2 expandtab diff --git a/runtime/spell/sr/README_sr.txt b/runtime/spell/sr/README_sr.txt index 8f7c908dd..6a3b10a0d 100644 --- a/runtime/spell/sr/README_sr.txt +++ b/runtime/spell/sr/README_sr.txt @@ -40,6 +40,20 @@ continues monotonically after the last flag number in cyrillic .aff file. A couple of words in cyrillic dict used a latin codepoints for 'a' and 'e', that was also corrected. +You should be able to reproduce this with these steps: + * Save the existing sr.aff and sr.dic files, if you have them, they will be + overwritten. + * Create a subfolder "new". + * Put 4 files downloaded from LibreOffice dictionaries GitHub repository in + it: sr.aff, sr-Latn.aff, sr.dic and sr-Latn.dic + * Open Vim and cd into "new" + * Execute: :so ../convert.vim + * The resulting sr.aff and sr.dic are created in the parent spell folder + (here). + * Now one can generate spl file as usual using the merged dic and aff + files: + env LANG=sr_RS.UTF-8 vim -u NONE -e -c "set enc=utf-8" -c "mkspell! ../sr sr" -c q + Ivan Pešić 28.06.2022. diff --git a/runtime/spell/sr/convert.vim b/runtime/spell/sr/convert.vim new file mode 100644 index 000000000..731986e9b --- /dev/null +++ b/runtime/spell/sr/convert.vim @@ -0,0 +1,30 @@ +:e sr.aff +:normal gg +:normal wgu$ +:3d +:4d +:normal G +:normal o +:r sr-Latn.aff +:%s#^\(SFX\|PFX\).*[а-џa-ž]\zs$# .#g +:normal G +?SET +:.,+5d +:.,$s#^\(SFX\|PFX\) \zs\(\d\+\)#\= eval(submatch(2) .. ' + 1903')# +:w ../sr.aff +:bd! +:e sr.dic +:%s#a#а#g +:%s#e#е#g +:normal G +:normal o +:r sr-Latn.dic +:normal 201dd +:.,$s#/\zs\(\d\+\)\(,\(\d\+\)\)\?$#\=(submatch(2) == '') ? eval(submatch(1) + '1903') : eval(submatch(1) + '1903') .. ',' .. eval(submatch(3) + '1903')# +:normal { +:normal dd +:normal gg +:normal C502898 +:w ../sr.dic +:bd! +:q! diff --git a/runtime/syntax/basic.vim b/runtime/syntax/basic.vim index 7fe411a86..b6bf23a3e 100644 --- a/runtime/syntax/basic.vim +++ b/runtime/syntax/basic.vim @@ -3,7 +3,7 @@ " Maintainer: Doug Kearns <dougkearns@gmail.com> " Previous Maintainer: Allan Kelly <allan@fruitloaf.co.uk> " Contributors: Thilo Six -" Last Change: 2021 Aug 08 +" Last Change: 2022 Jun 22 " First version based on Micro$soft QBASIC circa 1989, as documented in " 'Learn BASIC Now' by Halvorson&Rygmyr. Microsoft Press 1989. @@ -344,7 +344,7 @@ hi def link basicCommentError Error hi def link basicDataString basicString hi def link basicFilenumber basicTypeSuffix " TODO: better group hi def link basicFloat Float -hi def link basicFunction Identifier +hi def link basicFunction Function hi def link basicKeyword Keyword hi def link basicLineIdentifier LineNr hi def link basicLineContinuation Special diff --git a/runtime/syntax/fetchmail.vim b/runtime/syntax/fetchmail.vim index 7a421050d..f9c8e0112 100644 --- a/runtime/syntax/fetchmail.vim +++ b/runtime/syntax/fetchmail.vim @@ -1,7 +1,10 @@ " Vim syntax file -" Language: fetchmail(1) RC File -" Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Language: fetchmail(1) RC File +" Maintainer: Doug Kearns <dougkearns@gmail.com> +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2022 Jun 30 + +" Version 6.4.3 if exists("b:current_syntax") finish @@ -10,64 +13,69 @@ endif let s:cpo_save = &cpo set cpo&vim -syn keyword fetchmailTodo contained FIXME TODO XXX NOTE +syn keyword fetchmailTodo contained FIXME TODO XXX NOTE -syn region fetchmailComment start='#' end='$' contains=fetchmailTodo,@Spell +syn region fetchmailComment start='#' end='$' contains=fetchmailTodo,@Spell -syn match fetchmailNumber display '\<\d\+\>' +syn match fetchmailNumber display '\<\d\+\>' -syn region fetchmailString start=+"+ skip=+\\\\\|\\"+ end=+"+ - \ contains=fetchmailStringEsc -syn region fetchmailString start=+'+ skip=+\\\\\|\\'+ end=+'+ - \ contains=fetchmailStringEsc +syn region fetchmailString start=+"+ skip=+\\\\\|\\"+ end=+"+ + \ contains=fetchmailStringEsc +syn region fetchmailString start=+'+ skip=+\\\\\|\\'+ end=+'+ + \ contains=fetchmailStringEsc -syn match fetchmailStringEsc contained '\\\([ntb]\|0\d*\|x\x\+\)' +syn match fetchmailStringEsc contained '\\\([ntb]\|0\d*\|x\x\+\)' -syn region fetchmailKeyword transparent matchgroup=fetchmailKeyword - \ start='\<poll\|skip\|defaults\>' - \ end='\<poll\|skip\|defaults\>' - \ contains=ALLBUT,fetchmailOptions,fetchmailSet +syn region fetchmailKeyword transparent matchgroup=fetchmailKeyword + \ start='\<poll\|skip\|defaults\>' + \ end='\<poll\|skip\|defaults\>' + \ contains=ALLBUT,fetchmailOptions,fetchmailSet syn keyword fetchmailServerOpts contained via proto[col] local[domains] port - \ auth[enticate] timeout envelope qvirtual aka - \ interface monitor plugin plugout dns - \ checkalias uidl interval netsec principal - \ esmtpname esmtppassword - \ sslcertck sslcertpath sslfingerprint + \ service auth[enticate] timeout envelope + \ qvirtual aka interface monitor plugin plugout + \ dns checkalias uidl interval tracepolls + \ principal esmtpname esmtppassword +" removed in 6.3.0 +syn keyword fetchmailServerOpts contained netsec +syn match fetchmailServerOpts contained '\<bad-header\>' syn match fetchmailServerOpts contained '\<no\_s\+\(envelope\|dns\|checkalias\|uidl\)' -syn keyword fetchmailUserOpts contained user[name] is to pass[word] ssl - \ sslcert sslkey sslproto folder smtphost - \ fetchdomains smtpaddress smtpname antispam - \ mda bsmtp preconnect postconnect keep flush - \ fetchall rewrite stripcr forcecr pass8bits - \ dropstatus dropdelivered mimedecode idle - \ limit warnings batchlimit fetchlimit expunge - \ tracepolls properties -syn match fetchmailUserOpts contained '\<no\_s\+\(keep\|flush\|fetchall\|rewrite\|stripcr\|forcecr\|pass8bits\|dropstatus\|dropdelivered\|mimedecode\|noidle\)' - -syn keyword fetchmailSpecial contained here there - -syn keyword fetchmailNoise and with has wants options -syn match fetchmailNoise display '[:;,]' - -syn keyword fetchmailSet nextgroup=fetchmailOptions skipwhite skipnl set - -syn keyword fetchmailOptions daemon postmaster bouncemail spambounce logfile - \ idfile syslog nosyslog properties -syn match fetchmailOptions '\<no\_s\+\(bouncemail\|spambounce\)' - -hi def link fetchmailComment Comment -hi def link fetchmailTodo Todo -hi def link fetchmailNumber Number -hi def link fetchmailString String -hi def link fetchmailStringEsc SpecialChar -hi def link fetchmailKeyword Keyword +syn keyword fetchmailUserOpts contained user[name] is to pass[word] ssl + \ sslcert sslcertck sslcertfile sslcertpath + \ sslfingerprint sslkey sslproto folder + \ smtphost fetchdomains smtpaddress smtpname + \ antispam mda bsmtp preconnect postconnect + \ keep flush limitflush fetchall rewrite + \ stripcr forcecr pass8bits dropstatus + \ dropdelivered mimedecode idle limit warnings + \ batchlimit fetchlimit fetchsizelimit + \ fastuidl expunge properties + \ sslcommonname +syn match fetchmailUserOpts contained '\<no\_s\+\(sslcertck\|keep\|flush\|fetchall\|rewrite\|stripcr\|forcecr\|pass8bits\|dropstatus\|dropdelivered\|mimedecode\|idle\)' + +syn keyword fetchmailSpecial contained here there + +syn keyword fetchmailNoise and with has wants options +syn match fetchmailNoise display '[:;,]' + +syn keyword fetchmailSet nextgroup=fetchmailOptions skipwhite skipnl set + +syn keyword fetchmailOptions daemon postmaster bouncemail spambounce + \ softbounce logfile idfile syslog properties +syn match fetchmailOptions '\<no\_s\+\(bouncemail\|spambounce\|softbounce\|syslog\)' + +hi def link fetchmailComment Comment +hi def link fetchmailTodo Todo +hi def link fetchmailNumber Number +hi def link fetchmailString String +hi def link fetchmailStringEsc SpecialChar +hi def link fetchmailKeyword Keyword hi def link fetchmailServerOpts Identifier -hi def link fetchmailUserOpts Identifier -hi def link fetchmailSpecial Special -hi def link fetchmailSet Keyword -hi def link fetchmailOptions Identifier +hi def link fetchmailUserOpts Identifier +hi def link fetchmailSpecial Special +hi def link fetchmailSet Keyword +hi def link fetchmailOptions Identifier let b:current_syntax = "fetchmail" diff --git a/runtime/syntax/freebasic.vim b/runtime/syntax/freebasic.vim index 68e838f39..7549d0255 100644 --- a/runtime/syntax/freebasic.vim +++ b/runtime/syntax/freebasic.vim @@ -1,14 +1,14 @@ " Vim syntax file -" Language: FreeBasic -" Maintainer: Mark Manning <markem@sim1.us> -" Updated: 10/9/2019 -" Version: 7.0b +" Language: FreeBASIC +" Maintainer: Doug Kearns <dougkearns@gmail.com> +" Previous Maintainer: Mark Manning <markem@sim1.us> +" Last Change: 2022 Jun 26 " " Description: " " Based originally on the work done by Allan Kelly <Allan.Kelly@ed.ac.uk> " Updated by Mark Manning <markem@sim1.us> -" Applied FreeBasic support to the already excellent support +" Applied FreeBASIC support to the already excellent support " for standard basic syntax (like QB). " " First version based on Micro$soft QBASIC circa @@ -17,215 +17,595 @@ " not a complete implementation yet. Send suggestions to " the maintainer. " +" TODO: split this into separate dialect-based files, possibly with a common base +" " Quit when a (custom) syntax file was already loaded (Taken from c.vim) " if exists("b:current_syntax") finish endif " +" Dialect detection +" +let s:lang = freebasic#GetDialect() +" +" Whitespace Errors +" +if exists("freebasic_space_errors") + if !exists("freebasic_no_trail_space_error") + syn match freebasicSpaceError display excludenl "\s\+$" + endif + if !exists("freebasic_no_tab_space_error") + syn match freebasicSpaceError display " \+\t"me=e-1 + endif +endif +" " Be sure to turn on the "case ignore" since current versions " of freebasic support both upper as well as lowercase " letters. - MEM 10/1/2006 " syn case ignore " -" This list of keywords is taken directly from the FreeBasic -" user's guide as presented by the FreeBasic online site. +" Do the Basic variables names first. This is because it +" is the most inclusive of the tests. Later on we change +" this so the identifiers are split up into the various +" types of identifiers like functions, basic commands and +" such. MEM 9/9/2006 +" +if s:lang =~# '\<\%(qb\|fblite\)\>' + syn iskeyword @,48-57,_,192-255,. + syn match freebasicIdentifier "\<\h\%(\w\|\.\)*\>" + syn match freebasicGenericFunction "\<\h\%(\w\|\.\)*\>\ze\s*(" +else + syn iskeyword @,48-57,_,192-255 + syn match freebasicIdentifier "\<\h\w*\>" + syn match freebasicGenericFunction "\<\h\w*\>\ze\s*(" +endif +" +" This list of keywords is taken directly from the FreeBASIC +" user's guide as presented by the FreeBASIC online site. " -syn keyword freebasicArrays ERASE LBOUND REDIM PRESERVE UBOUND +syn keyword freebasicArrays ERASE LBOUND PRESERVE REDIM UBOUND -syn keyword freebasicBitManipulation BIT BITRESET BITSET HIBYTE HIWORD LOBYTE LOWORD SHL SHR +" array.bi +syn keyword freebasicArrays ARRAYLEN ARRAYSIZE +if s:lang == "fb" + syn keyword freebasicArrays ArrayConstDescriptorPtr ArrayDescriptorPtr FBARRAY +endif -syn keyword freebasicCompilerSwitches DEFBYTE DEFDBL DEFINT DEFLNG DEFLNGINT DEFSHORT DEFSNG DEFSTR -syn keyword freebasicCompilerSwitches DEFUBYTE DEFUINT DEFULNGINT DEFUSHORT -syn match freebasicCompilerSwitches "\<option\s+\(BASE\|BYVAL\|DYNAMIC\|ESCAPE\|EXPLICIT\|NOKEYWORD\)\>" -syn match freebasicCompilerSwitches "\<option\s+\(PRIVATE\|STATIC\)\>" +if s:lang == "qb" + syn keyword freebasicAsm __ASM + syn match freebasicAsm "\<end\s\+__asm\>" +else + syn keyword freebasicAsm ASM + syn match freebasicAsm "\<end\s\+asm\>" +endif -syn region freebasicConditional start="\son\s+" skip=".*" end="gosub" -syn region freebasicConditional start="\son\s+" skip=".*" end="goto" -syn match freebasicConditional "\<select\s+case\>" -syn keyword freebasicConditional if iif then case else elseif with +if s:lang == "qb" + syn keyword freebasicBitManipulation __BIT __BITRESET __BITSET __HIBYTE __HIWORD __LOBYTE __LOWORD +else + syn keyword freebasicBitManipulation BIT BITRESET BITSET HIBYTE HIWORD LOBYTE LOWORD +endif -syn match freebasicConsole "\<open\s+\(CONS\|ERR\|PIPE\|SCRN\)\>" -syn keyword freebasicConsole BEEP CLS CSRLIN LOCATE PRINT POS SPC TAB VIEW WIDTH +if s:lang != "fb" + syn keyword freebasicCompilerSwitches DEFDBL DEFINT DEFLNG DEFSNG DEFSTR +endif +if s:lang == "qb" + syn keyword freebasicCompilerSwitches __DEFBYTE __DEFLONGINT __DEFSHORT __DEFUBYTE __DEFUINT __DEFULONGINT __DEFUSHORT +elseif s:lang == "fblite" || s:lang == "deprecated" + syn keyword freebasicCompilerSwitches DEFBYTE DEFLONGINT DEFSHORT DEFUBYTE DEFUINT DEFUILONGINT DEFUSHORT +endif -syn keyword freebasicDataTypes BYTE AS DIM CONST DOUBLE ENUM INTEGER LONG LONGINT SHARED SHORT STRING -syn keyword freebasicDataTypes SINGLE TYPE UBYTE UINTEGER ULONGINT UNION UNSIGNED USHORT WSTRING ZSTRING +syn match freebasicCompilerSwitches "\<option\s\+\%(BASE\|BYVAL\|DYNAMIC\|ESCAPE\|EXPLICIT\|GOSUB\|NOGOSUB\)\>" +syn match freebasicCompilerSwitches "\<option\s\+\%(NOKEYWORD\|PRIVATE\|STATIC\)\>" -syn keyword freebasicDateTime DATE DATEADD DATEDIFF DATEPART DATESERIAL DATEVALUE DAY HOUR MINUTE -syn keyword freebasicDateTime MONTH MONTHNAME NOW SECOND SETDATE SETTIME TIME TIMESERIAL TIMEVALUE -syn keyword freebasicDateTime TIMER YEAR WEEKDAY WEEKDAYNAME +syn keyword freebasicData DATA READ RESTORE -syn keyword freebasicDebug ASSERT STOP +syn keyword freebasicProgramFlow EXIT GOTO RETURN SLEEP +syn match freebasicProgramFlow "\<end\>" +if s:lang == "qb" + syn keyword freebasicProgramFlow __SLEEP +endif +if s:lang == "fblite" || s:lang == "qb" + syn keyword freebasicProgramFlow GOSUB +endif +if s:lang == "fb" || s:lang == "deprecated" + syn keyword freebasicProgramFlow SCOPE + syn match freebasicProgramFlow "\<end\s\+scope\>" +endif -syn keyword freebasicErrorHandling ERR ERL ERROR LOCAL RESUME -syn match freebasicErrorHandling "\<resume\s+next\>" -syn match freebasicErrorHandling "\<on\s+error\>" +if s:lang == "fblite" || s:lang == "qb" + syn region freebasicConditional matchgroup=freebasicConditional start="\<on\>" end="\<gosub\>" transparent + syn region freebasicConditional matchgroup=freebasicConditional start="\<on\>" end="\<goto\>" transparent +endif +syn keyword freebasicConditional IF THEN ELSE ELSEIF +if s:lang == "qb" + syn keyword freebasicConditional __IIF __WITH + syn match freebasicConditional "\<end\s\+__with\>" +else + syn keyword freebasicConditional IIF WITH + syn match freebasicConditional "\<end\s\+with\>" +endif +syn match freebasicConditional "\<end\s\+if\>" +syn match freebasicConditional "\<select\s\+case\>" +syn match freebasicConditional "\<case\>" +syn match freebasicConditional "\<case\s\+is\>" +syn match freebasicConditional "\<end\s\+select\>" -syn match freebasicFiles "\<get\s+#\>" -syn match freebasicFiles "\<input\s+#\>" -syn match freebasicFiles "\<line\s+input\s+#\>" -syn match freebasicFiles "\<put\s+#\>" -syn keyword freebasicFiles ACCESS APPEND BINARY BLOAD BSAVE CLOSE EOF FREEFILE INPUT LOC -syn keyword freebasicFiles LOCK LOF OPEN OUTPUT RANDOM RESET SEEK UNLOCK WRITE +syn keyword freebasicConsole BEEP CLS CSRLIN LOCATE PRINT POS SPC TAB USING VIEW WIDTH +syn match freebasicConsole "?" -syn keyword freebasicFunctions ALIAS ANY BYREF BYVAL CALL CDECL CONSTRUCTOR DESTRUCTOR -syn keyword freebasicFunctions DECLARE FUNCTION LIB OVERLOAD PASCAL STATIC SUB STDCALL -syn keyword freebasicFunctions VA_ARG VA_FIRST VA_NEXT +syn keyword freebasicDataTypes SINGLE DOUBLE INTEGER LONG +syn match freebasicDataTypes "\<string\>" +syn keyword freebasicDataTypes AS DIM CONST ENUM SHARED TYPE +syn match freebasicDataTypes "\<end\s\+enum\>" +syn match freebasicDataTypes "\<end\s\+type\>" +if s:lang == "qb" + syn keyword freebasicDataTypes __BOOLEAN __BYTE __LONGINT __SHORT __UBYTE __UINTEGER __ULONG __ULONGINT __UNSIGNED __USHORT __ZSTRING + syn match freebasicDataTypes "\<__WSTRING\>" + syn keyword freebasicDataTypes __EXPLICIT __EXTENDS __IMPLEMENTS __OBJECT __POINTER __PTR __SIZEOF __TYPEOF + syn keyword freebasicDataTypes __UNION + syn match freebasicDataTypes "\<end\s\+__union\>" +else + syn keyword freebasicDataTypes BOOLEAN BYTE LONGINT SHORT UBYTE UINTEGER ULONG ULONGINT UNSIGNED USHORT ZSTRING + syn match freebasicDataTypes "\<WSTRING\>" + syn keyword freebasicDataTypes EXPLICIT EXTENDS IMPLEMENTS OBJECT POINTER PTR SIZEOF TYPEOF + syn keyword freebasicDataTypes UNION + syn match freebasicDataTypes "\<end\s\+union\>" +endif +if s:lang == "fb" + syn keyword freebasicDataTypes BASE CLASS THIS VAR +endif -syn match freebasicGraphics "\<palette\s+get\>" -syn keyword freebasicGraphics ALPHA CIRCLE CLS COLOR CUSTOM DRAW FLIP GET -syn keyword freebasicGraphics IMAGECREATE IMAGEDESTROY LINE PAINT PALETTE PCOPY PMAP POINT -syn keyword freebasicGraphics PRESET PSET PUT RGB RGBA SCREEN SCREENCOPY SCREENINFO SCREENLIST -syn keyword freebasicGraphics SCREENLOCK SCREENPTR SCREENRES SCREENSET SCREENSYNC SCREENUNLOCK -syn keyword freebasicGraphics TRANS USING VIEW WINDOW +if s:lang == "qb" + syn match freebasicDateTime "\<\%(date\|time\)\$" +elseif s:lang == "fblite" || s:lang == "deprecated" + syn match freebasicDateTime "\<\%(date\|time\)\>\$\=" +else " fb + syn keyword freebasicDateTime DATE TIME +endif +syn keyword freebasicDateTime SETDATE SETTIME -syn match freebasicHardware "\<open\s+com\>" -syn keyword freebasicHardware INP OUT WAIT LPT LPOS LPRINT +" datetime.bi +syn keyword freebasicDateTime DATEADD DATEDIFF DATEPART DATESERIAL DATEVALUE DAY HOUR ISDATE MINUTE +syn keyword freebasicDateTime MONTH MONTHNAME NOW SECOND TIMESERIAL TIMEVALUE +syn keyword freebasicDateTime TIMER YEAR WEEKDAY WEEKDAYNAME -syn keyword freebasicLogical AND EQV IMP OR NOT XOR +syn keyword freebasicDebug STOP +if s:lang == "qb" + syn keyword freebasicDebug __ASSERT __ASSERTWARN +else + syn keyword freebasicDebug ASSERT ASSERTWARN +endif -syn keyword freebasicMath ABS ACOS ASIN ATAN2 ATN COS EXP FIX INT LOG MOD RANDOMIZE -syn keyword freebasicMath RND SGN SIN SQR TAN +syn keyword freebasicErrorHandling ERR ERL ERROR +if s:lang == "qb" + syn keyword freebasicErrorHandling __ERFN __ERMN + syn match freebasicErrorHandling "\<on\s\+error\>" +else + syn keyword freebasicErrorHandling ERFN ERMN + syn match freebasicErrorHandling "\<on\s\+\%(local\s\+\)\=error\>" +endif +if s:lang != "fb" + syn match freebasicErrorHandling "\<resume\%(\s\+next\)\=\>" +endif -syn keyword freebasicMemory ALLOCATE CALLOCATE CLEAR DEALLOCATE FIELD FRE PEEK POKE REALLOCATE +syn match freebasicFiles "\<get\s\+#\>" +syn match freebasicFiles "\<input\s\+#\>" +syn match freebasicFiles "\<line\s\+input\s\+#\>" +syn match freebasicFiles "\<put\s\+#\>" +syn keyword freebasicFiles ACCESS APPEND BINARY CLOSE EOF FREEFILE INPUT LOC +syn keyword freebasicFiles LOCK LOF OUTPUT RANDOM RESET SEEK UNLOCK WRITE +syn match freebasicFiles "\<open\>" +if s:lang == "qb" + syn keyword freebasicFiles __ENCODING +else + syn keyword freebasicFiles ENCODING WINPUT + syn match freebasicFiles "\<open\s\+\%(cons\|err\|pipe\|scrn\)\>" +endif -syn keyword freebasicMisc ASM DATA LET TO READ RESTORE SIZEOF SWAP OFFSETOF +" file.bi +syn keyword freebasicFiles FILEATTR FILECOPY FILEDATETIME FILEEXISTS FILEFLUSH FILELEN FILESETEOF -syn keyword freebasicModularizing CHAIN COMMON EXPORT EXTERN DYLIBFREE DYLIBLOAD DYLIBSYMBOL -syn keyword freebasicModularizing PRIVATE PUBLIC +syn keyword freebasicFunctions ALIAS BYREF BYVAL CDECL DECLARE LIB NAKED PASCAL STATIC STDCALL +syn match freebasicFunctions "\<option\ze\s*(" -syn keyword freebasicMultithreading MUTEXCREATE MUTEXDESTROY MUTEXLOCK MUTEXUNLOCK THREADCREATE THREADWAIT +if s:lang == "qb" + syn keyword freebasicFunctions __CVA_ARG __CVA_COPY __CVA_END __CVA_LIST __CVA_START + syn keyword freebasicFunctions __VA_ARG __VA_FIRST __VA_NEXT +else + syn keyword freebasicFunctions CVA_ARG CVA_COPY CVA_END CVA_LIST CVA_START + syn keyword freebasicFunctions VA_ARG VA_FIRST VA_NEXT + syn keyword freebasicFunctions ANY OVERLOAD +endif -syn keyword freebasicShell CHDIR DIR COMMAND ENVIRON EXEC EXEPATH KILL NAME MKDIR RMDIR RUN +syn keyword freebasicFunctions FUNCTION SUB +syn match freebasicFunctions "\<end\s\+function\>" +syn match freebasicFunctions "\<end\s\+sub\>" -syn keyword freebasicEnviron SHELL SYSTEM WINDOWTITLE POINTERS +if s:lang == "fb" + syn keyword freebasicFunctions ABSTRACT OVERRIDE VIRTUAL __THISCALL + syn keyword freebasicFunctions CONSTRUCTOR DESTRUCTOR OPERATOR PROPERTY + syn match freebasicFunctions "\<end\s\+constructor\>" + syn match freebasicFunctions "\<end\s\+destructor\>" + syn match freebasicFunctions "\<end\s\+operator\>" + syn match freebasicFunctions "\<end\s\+property\>" +else + syn keyword freebasicFunctions CALL +endif -syn keyword freebasicLoops FOR LOOP WHILE WEND DO CONTINUE STEP UNTIL next +syn match freebasicGraphics "\<palette\s\+get\>" +syn keyword freebasicGraphics ADD ALPHA BLOAD BSAVE CIRCLE CLS COLOR DRAW GET +syn keyword freebasicGraphics LINE PAINT PALETTE PCOPY PMAP POINT +syn keyword freebasicGraphics PRESET PSET PUT SCREEN +syn keyword freebasicGraphics TRANS WINDOW +if s:lang == "qb" + syn keyword freebasicGraphics __FLIP __IMAGECONVERTROW __IMAGECREATE __IMAGEDESTROY __IMAGEINFO __POINTCOORD + syn keyword freebasicGraphics __RGB __RGBA __SCREENCOPY __SCREENCONTROL __SCREENEVENT __SCREENGLPROC __SCREENINFO + syn keyword freebasicGraphics __SCREENLIST __SCREENLOCK __SCREENPTR __SCREENRES __SCREENSET __SCREENSYNC + syn keyword freebasicGraphics __SCREENUNLOCK __WINDOWTITLE +else + syn keyword freebasicGraphics CUSTOM + syn keyword freebasicGraphics FLIP IMAGECONVERTROW IMAGECREATE IMAGEDESTROY IMAGEINFO POINTCOORD + syn keyword freebasicGraphics RGB RGBA SCREENCOPY SCREENCONTROL SCREENEVENT SCREENGLPROC SCREENINFO + syn keyword freebasicGraphics SCREENLIST SCREENLOCK SCREENPTR SCREENRES SCREENSET SCREENSYNC + syn keyword freebasicGraphics SCREENUNLOCK WINDOWTITLE +endif -syn match freebasicInclude "\<#\s*\(inclib\|include\)\>" -syn match freebasicInclude "\<\$\s*include\>" +if s:lang != "qb" + syn match freebasicHardware "\<open\s\+\%(com\|lpt\)\>" +endif +syn keyword freebasicHardware INP OUT WAIT LPOS LPRINT -syn keyword freebasicPointer PROCPTR PTR SADD STRPTR VARPTR +syn keyword freebasicMath ABS ATN COS EXP FIX FRAC INT LOG MOD RANDOMIZE RND SGN SIN SQR TAN -syn keyword freebasicPredefined __DATE__ __FB_DOS__ __FB_LINUX__ __FB_MAIN__ __FB_MIN_VERSION__ -syn keyword freebasicPredefined __FB_SIGNATURE__ __FB_VERSION__ __FB_WIN32__ __FB_VER_MAJOR__ -syn keyword freebasicPredefined __FB_VER_MINOR__ __FB_VER_PATCH__ __FILE__ __FUNCTION__ -syn keyword freebasicPredefined __LINE__ __TIME__ +if s:lang == "qb" + syn keyword freebasicMath __ACOS __ASIN __ATAN2 +else + syn keyword freebasicMath ACOS ASIN ATAN2 +endif -syn match freebasicPreProcessor "\<^#\s*\(define\|undef\)\>" -syn match freebasicPreProcessor "\<^#\s*\(ifdef\|ifndef\|else\|elseif\|endif\|if\)\>" -syn match freebasicPreProcessor "\<#\s*error\>" -syn match freebasicPreProcessor "\<#\s*\(print\|dynamic\|static\)\>" -syn keyword freebasicPreProcessor DEFINED ONCE +if s:lang == "qb" + syn keyword freebasicMemory __ALLOCATE __CALLOCATE __DEALLOCATE __REALLOCATE +else + syn keyword freebasicMemory ALLOCATE CALLOCATE DEALLOCATE REALLOCATE + syn keyword freebasicMemory PEEK POKE CLEAR FB_MEMCOPY FB_MEMCOPYCLEAR FB_MEMMOVE SWAP SADD + syn keyword freebasicMemory FIELD FRE +endif -syn keyword freebasicProgramFlow END EXIT GOSUB GOTO -syn keyword freebasicProgramFlow IS RETURN SCOPE SLEEP +syn keyword freebasicMisc LET TO +if s:lang == "qb" + syn keyword freebasicMisc __OFFSETOF +else + syn keyword freebasicMisc OFFSETOF +endif + +syn keyword freebasicModularizing CHAIN COMMON +if s:lang == "fb" + syn keyword freebasicModularizing EXTERN + syn match freebasicModularizing "\<end\s\+extern\>" + syn keyword freebasicModularizing PROTECTED +endif +if s:lang == "qb" + syn keyword freebasicModularizing __EXPORT __IMPORT __DYLIBFREE __DYLIBLOAD __DYLIBSYMBOL +else + syn keyword freebasicModularizing EXPORT IMPORT DYLIBFREE DYLIBLOAD DYLIBSYMBOL + syn keyword freebasicModularizing PRIVATE PUBLIC + syn keyword freebasicModularizing NAMESPACE + syn match freebasicModularizing "\<end\s\+namespace\>" +endif + +if s:lang != "qb" + syn keyword freebasicMultithreading MUTEXCREATE MUTEXDESTROY MUTEXLOCK MUTEXUNLOCK THREADCREATE THREADWAIT + syn keyword freebasicMultithreading CONDBROADCAST CONDCREATE CONDDESTROY CONDSIGNAL CONDWAIT + syn keyword freebasicMultithreading THREADCALL THREADDETACH THREADSELF +endif -syn keyword freebasicString INSTR LCASE LEFT LEN LSET LTRIM MID RIGHT RSET RTRIM -syn keyword freebasicString SPACE STRING TRIM UCASE ASC BIN CHR CVD CVI CVL CVLONGINT -syn keyword freebasicString CVS CVSHORT FORMAT HEX MKD MKI MKL MKLONGINT MKS MKSHORT -syn keyword freebasicString OCT STR VAL VALLNG VALINT VALUINT VALULNG +syn keyword freebasicShell CHDIR KILL NAME MKDIR RMDIR RUN SETENVIRON +if s:lang == "qb" + syn keyword freebasicShell __CURDIR __DIR __EXEC __EXEPATH + syn match freebasicString "\<\%(command\|environ\)\$" +else + " fbio.bi + syn keyword freebasicShell ISREDIRECTED + syn keyword freebasicShell CURDIR DIR EXEC EXEPATH + syn match freebasicString "\<\%(command\|environ\)\>\$\=" +endif -syn keyword freebasicTypeCasting CAST CBYTE CDBL CINT CLNG CLNGINT CPTR CSHORT CSIGN CSNG -syn keyword freebasicTypeCasting CUBYTE CUINT CULNGINT CUNSG CURDIR CUSHORT +syn keyword freebasicEnviron SHELL SYSTEM -syn match freebasicUserInput "\<line\s+input\>" -syn keyword freebasicUserInput GETJOYSTICK GETKEY GETMOUSE INKEY INPUT MULTIKEY SETMOUSE +syn keyword freebasicLoops FOR LOOP WHILE WEND DO STEP UNTIL NEXT +if s:lang == "qb" + syn keyword freebasicLoops __CONTINUE +else + syn keyword freebasicLoops CONTINUE +endif " -" Do the Basic variables names first. This is because it -" is the most inclusive of the tests. Later on we change -" this so the identifiers are split up into the various -" types of identifiers like functions, basic commands and -" such. MEM 9/9/2006 +" File numbers " -syn match freebasicIdentifier "\<[a-zA-Z_][a-zA-Z0-9_]*\>" -syn match freebasicGenericFunction "\<[a-zA-Z_][a-zA-Z0-9_]*\>\s*("me=e-1,he=e-1 +syn match freebasicFilenumber "#\d\+" +syn match freebasicFilenumber "#\a[[:alpha:].]*[%&!#]\=" + +syn match freebasicMetacommand "$\s*\%(dynamic\|static\)" +syn match freebasicMetacommand "$\s*include\s*\%(once\)\=\s*:\s*'[^']\+'" +syn match freebasicMetacommand '$\s*include\s*\%(once\)\=\s*:\s*"[^"]\+"' +syn match freebasicMetacommand '$\s*lang\s*:\s*"[^"]\+"' +" +" Intrinsic defines +" +syn keyword freebasicPredefined __DATE__ __DATE_ISO__ +syn keyword freebasicPredefined __FB_64BIT__ __FB_ARGC__ __FB_ARG_COUNT__ __FB_ARG_EXTRACT__ __FB_ARG_LEFTOF__ +syn keyword freebasicPredefined __FB_ARG_RIGHTOF__ __FB_ARGV__ __FB_ARM__ __FB_ASM__ __FB_BACKEND__ +syn keyword freebasicPredefined __FB_BIGENDIAN__ __FB_BUILD_DATE__ __FB_BUILD_DATE_ISO__ __FB_BUILD_SHA1__ +syn keyword freebasicPredefined __FB_CYGWIN__ __FB_DARWIN__ __FB_DEBUG__ __FB_DOS__ __FB_ERR__ __FB_EVAL__ +syn keyword freebasicPredefined __FB_FPMODE__ __FB_FPU__ __FB_FREEBSD__ __FB_GCC__ __FB_GUI__ __FB_JOIN__ +syn keyword freebasicPredefined __FB_LANG__ __FB_LINUX__ __FB_MAIN__ __FB_MIN_VERSION__ __FB_MT__ __FB_NETBSD__ +syn keyword freebasicPredefined __FB_OPENBSD__ __FB_OPTIMIZE__ __FB_OPTION_BYVAL__ __FB_OPTION_DYNAMIC__ +syn keyword freebasicPredefined __FB_OPTION_ESCAPE__ __FB_OPTION_EXPLICIT__ __FB_OPTION_GOSUB__ +syn keyword freebasicPredefined __FB_OPTION_PRIVATE__ __FB_OUT_DLL__ __FB_OUT_EXE__ __FB_OUT_LIB__ __FB_OUT_OBJ__ +syn keyword freebasicPredefined __FB_PCOS__ __FB_PPC__ __FB_QUOTE__ __FB_SIGNATURE__ __FB_SSE__ __FB_UNIQUEID__ +syn keyword freebasicPredefined __FB_UNIQUEID_POP__ __FB_UNIQUEID_PUSH__ __FB_UNIX__ __FB_UNQUOTE__ +syn keyword freebasicPredefined __FB_VECTORIZE__ __FB_VER_MAJOR__ __FB_VER_MINOR__ __FB_VER_PATCH__ __FB_VERSION__ +syn keyword freebasicPredefined __FB_WIN32__ __FB_X86__ __FB_XBOX__ +syn keyword freebasicPredefined __FILE__ __FILE_NQ__ __FUNCTION__ __FUNCTION_NQ__ +syn keyword freebasicPredefined __LINE__ __PATH__ __TIME__ +" +" Preprocessor directives +" +syn match freebasicInclude "#\s*\%(inclib\|include\%(\s\+once\)\=\|libpath\)\>" + +syn match freebasicPreProcessor "#\s*assert\>" +syn match freebasicPreProcessor "#\s*cmdline\>" +syn match freebasicPreProcessor "#\s*\%(define\|undef\)\>" +syn match freebasicPreProcessor "#\s*\%(if\|ifdef\|ifndef\|else\|elseif\|endif\)\>" +syn match freebasicPreProcessor "#\s*\%(macro\|endmacro\)\>" +syn match freebasicPreProcessor "#\s*error\>" +syn match freebasicPreProcessor "#\s*lang\>" +syn match freebasicPreProcessor "#\s*line\>" +syn match freebasicPreProcessor "#\s*pragma\%(\s\+reserve\)\=\>" +syn match freebasicPreProcessor "#\s*\%(print\|dynamic\|static\)\>" +syn keyword freebasicPreProcessor DEFINED + +syn keyword freebasicString LEN +syn keyword freebasicString ASC +" string.bi +syn keyword freebasicString FORMAT +syn keyword freebasicString VAL +syn keyword freebasicString CVD CVI CVL CVS +syn keyword freebasicString INSTR +syn keyword freebasicString LSET RSET + +if s:lang == "qb" + syn match freebasicString "\<string\$\ze\s*(" + syn match freebasicString "\<__wstring\ze\s*(" + syn match freebasicString "\<space\$" + syn keyword freebasicString __WSPACE + syn match freebasicString "\<chr\$" + syn keyword freebasicString __WCHR + syn keyword freebasicString __WBIN __WHEX __WOCT __WSTR + syn match freebasicString "\<\%(bin\|hex\|oct\|str\)\$" + syn keyword freebasicString __VALLNG __VALINT __VALUINT __VALULNG + syn match freebasicString "\<\%(mkd\|mki\|mkl\|mks\)\$" + syn keyword freebasicString __MKLONGINT __MKSHORT + syn keyword freebasicString __CVLONGINT __CVSHORT + syn match freebasicString "\<\%(left\|mid\|right\|lcase\|ucase\|ltrim\|rtrim\)\$" + syn keyword freebasicString __TRIM + syn keyword freebasicString __INSTRREV +else + syn match freebasicString "\<string\$\=\ze\s*(" + syn match freebasicString "\<wstring\ze\s*(" + syn match freebasicString "\<space\>\$\=" + syn keyword freebasicString WSPACE + syn match freebasicString "\<chr\>\$\=" + syn keyword freebasicString WCHR + syn keyword freebasicString WBIN WHEX WOCT WSTR + syn match freebasicString "\<\%(bin\|hex\|oct\|str\)\>\$\=" + syn keyword freebasicString VALLNG VALINT VALUINT VALULNG + syn match freebasicString "\<\%(mkd\|mki\|mkl\|mks\)\>\$\=" + syn match freebasicString "\<\%(mklongint\|mkshort\)\>\$\=" + syn keyword freebasicString CVLONGINT CVSHORT + syn match freebasicString "\<\%(left\|mid\|right\|lcase\|ucase\|ltrim\|rtrim\)\>\$\=" + syn match freebasicString "\<trim\>\$\=" + syn keyword freebasicString INSTRREV +endif + +syn keyword freebasicTypeCasting CDBL CINT CLNG CSNG +if s:lang == "qb" + syn keyword freebasicTypeCasting __CAST __CBOOL __CBYTE __CLNGINT __CPTR __CSHORT __CSIGN __CYBTE __CUINT __CULNG + syn keyword freebasicTypeCasting __CULNGINT __CUNSG __CUSHORT +else + syn keyword freebasicTypeCasting CAST CBOOL CBYTE CLNGINT CPTR CSHORT CSIGN CUBYTE CUINT CULNG CULNGINT CUNSG CUSHORT +endif + +syn match freebasicUserInput "\<line\s\+input\>" +syn keyword freebasicUserInput INKEY INPUT +if s:lang == "qb" + syn keyword freebasicUserInput __GETJOYSTICK __GETKEY __GETMOUSE __MULTIKEY __SETMOUSE STICK STRIG +else + syn keyword freebasicUserInput GETJOYSTICK GETKEY GETMOUSE MULTIKEY SETMOUSE +endif " -" Function list +" Operators " -syn keyword freebasicTodo contained TODO +" TODO: make these context sensitive to remove the overlap of common operators +" : alpha operators should probably always be highlighted +" -- DJK 20/11/19 +if s:lang == "qb" + syn match freebasicArithmeticOperator "\<\%(MOD\|__SHL\|__SHR\)\>" +else + syn match freebasicArithmeticOperator "\<\%(MOD\|SHL\|SHR\)\>" +endif +syn match freebasicBitwiseOperator "\<\%(AND\|EQV\|IMP\|NOT\|OR\|XOR\)\>" " freebaseLogical? +if s:lang == "qb" + syn match freebasicAssignmentOperator "\<\%(MOD\|AND\|EQV\|IMP\|OR\|XOR\|__SHL\|__SHR\)=\@=" " exclude trailing '=' +else + syn match freebasicAssignmentOperator "\<\%(MOD\|AND\|EQV\|IMP\|OR\|XOR\|SHL\|SHR\)=\@=" +endif +syn match freebasicShortcircuitOperator "\<\%(ANDALSO\|ORELSE\)\>" +if s:lang == "fb" + syn match freebasicMemoryOperator '\<\%(new\|delete\)\>' +endif +syn keyword freebasicPointerOperator STRPTR VARPTR +if s:lang == "qb" + syn keyword freebasicPointerOperator __PROCPTR +else + syn keyword freebasicPointerOperator PROCPTR +endif +syn match freebasicTypeOperator '\<is\>' +syn match freebasicTypeOperator '\.' nextgroup=freebasicIdentifier skipwhite +if s:lang == "fb" + syn match freebasicTypeOperator '->' nextgroup=freebasicIdentifier skipwhite +endif + +if exists("freebasic_operators") + syn match freebasicAssignmentOperator "=>\=\|[-+&/\\*^]=" + if s:lang == "qb" + syn match freebasicAssignmentOperator "\<\%(MOD\|AND\|EQV\|IMP\|OR\|XOR\|__SHL\|__SHR\)=" " include trailing '=' + else + syn match freebasicAssignmentOperator "\<\%(MOD\|AND\|EQV\|IMP\|OR\|XOR\|SHL\|SHR\)=" + endif + syn match freebasicArithmeticOperator "[-+&/\\*^]" + " syn match freebasicIndexingOperator "[[\]()]" " FIXME + syn match freebasicRelationalOperator "=\|<>\|<=\|<\|>=\|>" + syn match freebasicPreprocessorOperator '\%(^\s*\)\@<!\%(##\|#\)\|[$!]"\@=' + syn match freebasicPointerOperator '[@*]' + syn match freebasicTypeOperator '\.' nextgroup=freebasicIdentifier skipwhite + if s:lang == "fb" + syn match freebasicTypeOperator '->' nextgroup=freebasicIdentifier skipwhite + endif +endif + +syn cluster freebasicOperator contains=freebasic.*Operator " " Catch errors caused by wrong parenthesis " -syn region freebasicParen transparent start='(' end=')' contains=ALLBUT,@freebasicParenGroup -syn match freebasicParenError ")" -syn match freebasicInParen contained "[{}]" -syn cluster freebasicParenGroup contains=freebasicParenError,freebasicSpecial,freebasicTodo,freebasicUserCont,freebasicUserLabel,freebasicBitField +" syn region freebasicParen transparent start='(' end=')' contains=ALLBUT,@freebasicParenGroup +" syn match freebasicParenError ")" +" syn match freebasicInParen contained "[{}]" +" syn cluster freebasicParenGroup contains=freebasicParenError,freebasicSpecial,freebasicTodo,freebasicUserCont,freebasicUserLabel,freebasicBitField " -" Integer number, or floating point number without a dot and with "f". +" Integer number " -syn region freebasicHex start="&h" end="\W" -syn region freebasicHexError start="&h\x*[g-zG-Z]" end="\W" -syn region freebasicOctal start="&o" end="\W" -syn region freebasicOctalError start="&o[0-7]*[89a-zA-Z]" end="\W" -syn region freebasicBinary start="&b" end="\W" -syn region freebasicBinaryError start="&b[01]*[2-9a-zA-Z]" end="\W" -syn match freebasicInteger "\<\d\+\(u\=l\=\|lu\|f\)\>" +syn match freebasicHexError "&h\w*\>" +syn match freebasicOctalError "&o\w*\>" +syn match freebasicBinaryError "&b\w*\>" +syn match freebasicHex "&h\x\+\%([%L&U]\|UL\|LL\|ULL\)\=\>" +syn match freebasicOctal "&o\o\+\%([%L&U]\|UL\|LL\|ULL\)\=\>" +syn match freebasicBinary "&b[10]\+\%([%L&U]\|UL\|LL\|ULL\)\=\>" +syn match freebasicInteger "\<\d\+\%([%L&U]\|UL\|LL\|ULL\)\=\>" " -" Floating point number, with dot, optional exponent +" Floating point +" See: https://www.freebasic.net/forum/viewtopic.php?t=20323 " -syn match freebasicFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>" +" Floating point number, with dot, optional exponent, optional suffix " -" Floating point number, starting with a dot, optional exponent +syn match freebasicFloat "\<\d\+\.\d*\%([de][-+]\=\d*\)\=[f!#]\=" " -syn match freebasicFloat "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>" +" Floating point number, starting with a dot, optional exponent, optional suffix " -" Floating point number, without dot, with exponent +syn match freebasicFloat "\.\d\+\%([de][-+]\=\d*\)\=[f!#]\=" " -syn match freebasicFloat "\<\d\+e[-+]\=\d\+[fl]\=\>" +" Floating point number, without dot, with optional exponent, optional suffix " -" Octal number +syn match freebasicFloat "\<\d\+\%([de][-+]\=\d*\)[f!#]\=" " -syn case match -syn match freebasicOctal2 "\<0\o*\>" -syn match freebasicOctal2Error "\<0\o*[89a-zA-Z]" +" Floating point number, without dot, without exponent, with suffix " -" String and Character contstants +syn match freebasicFloat "\<\d\+[f!#]" " -syn region freebasicString start='"' end='"' contains=freebasicSpecial,freebasicTodo -syn region freebasicString start="'" end="'" contains=freebasicSpecial,freebasicTodo +" Create the clusters " -" Comments +syn cluster freebasicNumber contains=freebasicHex,freebasicOctal,freebasicBinary,freebasicInteger,freebasicFloat +syn cluster freebasicNumberError contains=freebasicHexError,freebasicOctalError,freebasicBinaryError " -syn match freebasicSpecial contained "\\\\." -syn region freebasicComment start="^rem" end="$" contains=freebasicSpecial,freebasicTodo -syn region freebasicComment start=":\s*rem" end="$" contains=freebasicSpecial,freebasicTodo -syn region freebasicComment start="\s*'" end="$" contains=freebasicSpecial,freebasicTodo -syn region freebasicComment start="^'" end="$" contains=freebasicSpecial,freebasicTodo +" Booleans " -" Now do the comments and labels +if s:lang != "qb" + syn keyword freebasicBoolean TRUE FALSE +endif " -syn match freebasicLabel "^\d" -syn match freebasicLabel "\<^\w+:\>" -syn region freebasicLineNumber start="^\d" end="\s" " -" Create the clusters +" String and escape sequences " -syn cluster freebasicNumber contains=freebasicHex,freebasicOctal,freebasicOctal2,freebasicBinary,freebasicInteger,freebasicFloat -syn cluster freebasicError contains=freebasicHexError,freebasicOctalError,freebasicOctal2,freebasicBinary +syn match freebasicSpecial contained "\\." +syn match freebasicSpecial contained "\\\d\{1,3}" +syn match freebasicSpecial contained "\\&h\x\{1,2}" +syn match freebasicSpecial contained "\\&o\o\{1,3}" +syn match freebasicSpecial contained "\\&b[01]\{1,8}" +syn match freebasicSpecial contained "\\u\x\{1,4}" +syn region freebasicString start='"' end='"' " TODO: Toggle contains on Option Escape in fblite and qb? -- DJK 20/11/19 +syn region freebasicString start='!\zs"' end='"' contains=freebasicSpecial +syn region freebasicString start='$\zs"' end='"' " -" Used with OPEN statement +" Line labels " -syn match freebasicFilenumber "#\d\+" -syn match freebasicMathOperator "[\+\-\=\|\*\/\>\<\%\()[\]]" contains=freebasicParen +if s:lang =~# '\<\%(qb\|fblite\)\>' + syn match freebasicLineLabel "^\s*\zs\h\%(\w\|\.\)*\ze\s*:" +else + syn match freebasicLineLabel "^\s*\zs\h\w*\ze\s*:" +endif +syn match freebasicLineNumber "^\s*\zs\d\+" +" +" Line continuations +" +" syn match freebasicLineContinuation "\<_\>" nextgroup=freebasicComment,freebasicPostLineContinuation skipwhite +syn keyword freebasicLineContinuation _ nextgroup=freebasicComment,freebasicPostLineContinuation skipwhite +syn match freebasicPostLineContinuation ".*" contained +" +" +" Type suffixes +if exists("freebasic_type_suffixes") && s:lang =~# '\<\%(qb\|fblite\)\>' + syn match freebasicTypeSuffix "\h\%(\w\|.\)*\zs[$%&!#]" +endif +" +" Comments +" +syn keyword freebasicTodo TODO FIXME XXX NOTE contained +syn region freebasicComment start="\<rem\>" end="$" contains=freebasicTodo,@Spell,freebasicMetacommand +syn region freebasicComment start="'" end="$" contains=freebasicTodo,@Spell,freebasicMetacommand +syn region freebasicDoubleComment start="''" end="$" contains=freebasicTodo,@Spell + +if !exists("freebasic_no_comment_fold") + syn region freebasicMultilineComment start="/'" end="'/" contains=freebasicTodo,@Spell,freeBasicMultilineComment fold keepend extend + syn region freebasicMultilineComment2 start="^\s*'.*\n\%(\s*'\)\@=" end="^\s*'.*\n\%(\s*'\)\@!" contains=freebasicComment,freebasicDoubleComment keepend fold +else + syn region freebasicMultilineComment start="/'" end="'/" contains=freebasicTodo,@Spell,freeBasicMultilineComment +endif + +syn case match + +syn sync linebreaks=1 + " " The default methods for highlighting. Can be overridden later " hi def link freebasicArrays StorageClass +hi def link freebasicAsm Special hi def link freebasicBitManipulation Operator -hi def link freebasicCompilerSwitches PreCondit +hi def link freebasicBoolean Boolean +if s:lang == "fb" + hi def link freebasicCompilerSwitches freebasicUnsupportedError +else + hi def link freebasicCompilerSwitches PreCondit +endif hi def link freebasicConsole Special +hi def link freebasicData Special hi def link freebasicDataTypes Type hi def link freebasicDateTime Type hi def link freebasicDebug Special hi def link freebasicErrorHandling Special +hi def link freebasicFilenumber Special hi def link freebasicFiles Special hi def link freebasicFunctions Function hi def link freebasicGraphics Function hi def link freebasicHardware Special -hi def link freebasicLogical Conditional +hi def link freebasicLoops Repeat hi def link freebasicMath Function +if s:lang == "fb" + hi def link freebasicMetacommand freebasicUnsupportedError +else + hi def link freebasicMetacommand SpecialComment +endif hi def link freebasicMemory Function hi def link freebasicMisc Special hi def link freebasicModularizing Special @@ -240,18 +620,55 @@ hi def link freebasicString String hi def link freebasicTypeCasting Type hi def link freebasicUserInput Statement hi def link freebasicComment Comment +hi def link freebasicDoubleComment Comment +hi def link freebasicMultilineComment Comment hi def link freebasicConditional Conditional hi def link freebasicError Error hi def link freebasicIdentifier Identifier hi def link freebasicInclude Include hi def link freebasicGenericFunction Function -hi def link freebasicLabel Label -hi def link freebasicLineNumber Label +hi def link freebasicLineContinuation Special +hi def link freebasicLineLabel LineNr +if s:lang == "fb" + hi def link freebasicLineNumber freebasicUnsupportedError +else + hi def link freebasicLineNumber LineNr +endif hi def link freebasicMathOperator Operator -hi def link freebasicNumber Number + +hi def link freebasicHex Number +hi def link freebasicOctal Number +hi def link freebasicBinary Number +hi def link freebasicInteger Number +hi def link freebasicFloat Float + +hi def link freebasicHexError Error +hi def link freebasicOctalError Error +hi def link freebasicBinaryError Error + +hi def link freebasicAssignmentOperator Operator +hi def link freebasicArithmeticOperator Operator +hi def link freebasicIndexingOperator Operator +hi def link freebasicRelationalOperator Operator +hi def link freebasicBitwiseOperator Operator +hi def link freebasicShortcircuitOperator Operator +hi def link freebasicPreprocessorOperator Operator +hi def link freebasicPointerOperator Operator +if exists("freebasic_operators") + hi def link freebasicTypeOperator Operator +endif +hi def link freebasicMemoryOperator Operator + +hi def link freebasicSpaceError Error + hi def link freebasicSpecial Special hi def link freebasicTodo Todo +hi def link freebasicUnsupported freebasicUnsupportedError +hi def link freebasicUnsupportedError Error + +unlet s:lang + let b:current_syntax = "freebasic" -" vim: ts=8 +" vim: ts=8 tw=132 fdm=marker |