annotate runtime/autoload/freebasic.vim @ 32150:3923c5051b87 v9.0.1406

patch 9.0.1406: ILE RPG files are not recognized Commit: https://github.com/vim/vim/commit/e202ec8a0c89e8ef47a3d38e668b7326fa68510a Author: Andreas Louv <andreas@louv.dk> Date: Thu Mar 16 12:26:51 2023 +0000 patch 9.0.1406: ILE RPG files are not recognized Problem: ILE RPG files are not recognized. Solution: Add patterns for ILE RPG files. (Andreas Louv, issue https://github.com/vim/vim/issues/12152)
author Bram Moolenaar <Bram@vim.org>
date Thu, 16 Mar 2023 13:30:04 +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: