annotate runtime/autoload/freebasic.vim @ 34481:de28179cc9cd

runtime(sh): Update syntax file, fix issue #962 (#14138) Commit: https://github.com/vim/vim/commit/1bdc9435c1a14ca1a30e5b5927ab63f603ec4409 Author: dkearns <dougkearns@gmail.com> Date: Tue Mar 5 05:14:08 2024 +1100 runtime(sh): Update syntax file, fix issue https://github.com/vim/vim/issues/962 (https://github.com/vim/vim/issues/14138) Allow the opening parenthesis of a multiline array assignment, within an if statement, to appear at EOL. Fixes issue #962. Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Mon, 04 Mar 2024 19:15:06 +0100
parents 912224cab37f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27459
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim filetype plugin file
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Language: FreeBASIC
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Maintainer: Doug Kearns <dougkearns@gmail.com>
29352
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27459
diff changeset
4 " Last Change: 2022 June 24
27459
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 " Dialects can be one of fb, qb, fblite, or deprecated
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 " Precedence is forcelang > #lang > lang
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 function! freebasic#GetDialect() abort
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 if exists("g:freebasic_forcelang")
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 return g:freebasic_forcelang
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 endif
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 if exists("g:freebasic_lang")
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 let dialect = g:freebasic_lang
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 else
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 let dialect = "fb"
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 endif
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 " override with #lang directive or metacommand
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 let pat = '\c^\s*\%(#\s*lang\s\+\|''\s*$lang\s*:\s*\)"\([^"]*\)"'
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 let save_cursor = getcurpos()
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 call cursor(1, 1)
29352
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27459
diff changeset
25 let lnum = search(pat, 'cn')
27459
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 call setpos('.', save_cursor)
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 if lnum
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 let word = matchlist(getline(lnum), pat)[1]
29352
912224cab37f Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 27459
diff changeset
30 if word =~? '\<\%(fb\|deprecated\|fblite\|qb\)\>'
27459
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 let dialect = word
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 else
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 echomsg "freebasic#GetDialect: Invalid lang, found '" .. word .. "' at line " .. lnum .. " " .. getline(lnum)
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 endif
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 endif
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 return dialect
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 endfunction
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39
5825405e4e2c Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 " vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: