annotate runtime/indent/yacc.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 4d76b3e07c07
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
28620
4d76b3e07c07 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11062
diff changeset
2 " Language: YACC input file
4d76b3e07c07 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11062
diff changeset
3 " Maintainer: Doug Kearns <dougkearns@gmail.com>
4d76b3e07c07 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11062
diff changeset
4 " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
4d76b3e07c07 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11062
diff changeset
5 " Last Change: 2022 April 25
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 " Only load this indent file when no other was loaded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 if exists("b:did_indent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
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=GetYaccIndent()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 setlocal indentkeys=!^F,o,O
1216
35a1d7bd6191 updated for version 7.1b
vimboss
parents: 856
diff changeset
16 setlocal nosmartindent
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
28620
4d76b3e07c07 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11062
diff changeset
18 let b:undo_indent = "setl inde< indk< si<"
4d76b3e07c07 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 11062
diff changeset
19
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 " Only define the function once.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 if exists("*GetYaccIndent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 function GetYaccIndent()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 if v:lnum == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 let ind = indent(v:lnum - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 let line = getline(v:lnum - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 if line == ''
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 let ind = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 elseif line =~ '^\w\+\s*:'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 let ind = ind + matchend(line, '^\w\+\s*')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 elseif line =~ '^\s*;'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 let ind = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 let ind = indent(v:lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 return ind
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 endfunction