annotate runtime/autoload/freebasic.vim @ 31054:a0f0c144baff

Added tag v9.0.0861 for changeset 39f96b1e7b8d39fa5f54fd4ca18870ae7581c0d2
author Bram Moolenaar <Bram@vim.org>
date Sat, 12 Nov 2022 00:00:05 +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: