annotate runtime/indent/sdl.vim @ 33529:6d7a054bf2e3 v9.0.2013

patch 9.0.2013: Unicode tables outdated Commit: https://github.com/vim/vim/commit/a634b92b969e1bcb47551a39bf4e11e41ba9aa17 Author: Christian Brabandt <cb@256bit.org> Date: Wed Oct 11 21:24:49 2023 +0200 patch 9.0.2013: Unicode tables outdated Problem: Unicode tables outdated Solution: Update Unicode tables to v15.1 (released 23.09.2023) closes: #13311 Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Wed, 11 Oct 2023 21:30:09 +0200
parents 9c221ad9634a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim indent file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: SDL
3237
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
3 " Maintainer: Michael Piefel <entwurf@piefel.de>
25880
9c221ad9634a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
4 " Last Change: 2021 Oct 03
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 " Shamelessly stolen from the Vim-Script indent file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 " Only load this indent file when no other was loaded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 if exists("b:did_indent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 let b:did_indent = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 setlocal indentexpr=GetSDLIndent()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 setlocal indentkeys+==~end,=~state,*<Return>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16
25880
9c221ad9634a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
17 let b:undo_indent = "setl inde< indk<"
9c221ad9634a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11518
diff changeset
18
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 " Only define the function once.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 if exists("*GetSDLIndent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 " finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23
3237
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
24 let s:cpo_save = &cpo
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
25 set cpo&vim
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 function! GetSDLIndent()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 " Find a non-blank line above the current line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 let lnum = prevnonblank(v:lnum - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 " At the start of the file use zero indent.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 if lnum == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 let ind = indent(lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 let virtuality = '^\s*\(\(virtual\|redefined\|finalized\)\s\+\)\=\s*'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 " Add a single space to comments which use asterisks
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 if getline(lnum) =~ '^\s*\*'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 let ind = ind - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 if getline(v:lnum) =~ '^\s*\*'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 let ind = ind + 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 " Add a 'shiftwidth' after states, different blocks, decision (and alternatives), inputs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 if (getline(lnum) =~? '^\s*\(start\|state\|system\|package\|connection\|channel\|alternative\|macro\|operator\|newtype\|select\|substructure\|decision\|generator\|refinement\|service\|method\|exceptionhandler\|asntype\|syntype\|value\|(.*):\|\(priority\s\+\)\=input\|provided\)'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 \ || getline(lnum) =~? virtuality . '\(process\|procedure\|block\|object\)')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 \ && getline(lnum) !~? 'end[[:alpha:]]\+;$'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 4186
diff changeset
51 let ind = ind + shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 " Subtract a 'shiftwidth' after states
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 if getline(lnum) =~? '^\s*\(stop\|return\>\|nextstate\)'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 4186
diff changeset
56 let ind = ind - shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 " Subtract a 'shiftwidth' on on end (uncompleted line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 if getline(v:lnum) =~? '^\s*end\>'
11518
63b0b7b79b25 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 4186
diff changeset
61 let ind = ind - shiftwidth()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 " Put each alternatives where the corresponding decision was
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 if getline(v:lnum) =~? '^\s*\((.*)\|else\):'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 normal k
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 let ind = indent(searchpair('^\s*decision', '', '^\s*enddecision', 'bW',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "sdlString"'))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 " Put each state where the preceding state was
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 if getline(v:lnum) =~? '^\s*state\>'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 let ind = indent(search('^\s*start', 'bW'))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 " Systems and packages are always in column 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 if getline(v:lnum) =~? '^\s*\(\(end\)\=system\|\(end\)\=package\)'
4186
7ffc704cb7c1 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3237
diff changeset
78 return 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 " Put each end* where the corresponding begin was
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 if getline(v:lnum) =~? '^\s*end[[:alpha:]]'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 normal k
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 let partner=matchstr(getline(v:lnum), '\(' . virtuality . 'end\)\@<=[[:alpha:]]\+')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 let ind = indent(searchpair(virtuality . partner, '', '^\s*end' . partner, 'bW',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 \ 'synIDattr(synID(line("."), col("."), 0), "name") =~? "sdlString"'))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 return ind
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 endfunction
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91
3237
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
92 let &cpo = s:cpo_save
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
93 unlet s:cpo_save
91e53bcb7946 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 7
diff changeset
94
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 " vim:sw=2