annotate runtime/indent/yacc.vim @ 18415:52eb1bbf7690

Added tag v8.1.2201 for changeset 6b8508ea90d798b96e29aaa21d6f8021c43128a7
author Bram Moolenaar <Bram@vim.org>
date Wed, 23 Oct 2019 21:45:04 +0200
parents 1218c5353e2b
children 4d76b3e07c07
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
11062
1218c5353e2b Runtime file updates.
Christian Brabandt <cb@256bit.org>
parents: 1216
diff changeset
2 " Language: YACC input file
1218c5353e2b Runtime file updates.
Christian Brabandt <cb@256bit.org>
parents: 1216
diff changeset
3 " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
1218c5353e2b Runtime file updates.
Christian Brabandt <cb@256bit.org>
parents: 1216
diff changeset
4 " Latest Revision: 2006-12-20
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 " Only load this indent file when no other was loaded.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 if exists("b:did_indent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 let b:did_indent = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 setlocal indentexpr=GetYaccIndent()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 setlocal indentkeys=!^F,o,O
1216
35a1d7bd6191 updated for version 7.1b
vimboss
parents: 856
diff changeset
15 setlocal nosmartindent
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 " Only define the function once.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 if exists("*GetYaccIndent")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 function GetYaccIndent()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 if v:lnum == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 return 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 let ind = indent(v:lnum - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 let line = getline(v:lnum - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 if line == ''
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 let ind = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 elseif line =~ '^\w\+\s*:'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 let ind = ind + matchend(line, '^\w\+\s*')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 elseif line =~ '^\s*;'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 let ind = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 let ind = indent(v:lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 return ind
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 endfunction