annotate runtime/indent/treetop.vim @ 8487:ce789e3dc84d v7.4.1534

commit https://github.com/vim/vim/commit/846cdb227526272e2cd8ecba4f7168e2226cd633 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Mar 11 18:52:22 2016 +0100 patch 7.4.1534 Problem: Compiler warning for shadowed variable. (Kazunobu Kuriyama) Solution: Rename it.
author Christian Brabandt <cb@256bit.org>
date Fri, 11 Mar 2016 19:00:06 +0100
parents 6f63330ec225
children 1218c5353e2b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2725
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
1 " Vim indent file
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
2 " Language: Treetop
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
3 " Maintainer: Nikolai Weibull <now@bitwi.se>
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
4 " Latest Revision: 2011-03-14
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
5
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
6 if exists("b:did_indent")
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
7 finish
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
8 endif
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
9 let b:did_indent = 1
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
10
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
11 setlocal indentexpr=GetTreetopIndent()
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
12 setlocal indentkeys=0{,0},!^F,o,O,=end
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
13 setlocal nosmartindent
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
14
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
15 if exists("*GetTreetopIndent")
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
16 finish
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
17 endif
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
18
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
19 function GetTreetopIndent()
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
20 let pnum = prevnonblank(v:lnum - 1)
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
21 if pnum == 0
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
22 return 0
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
23 endif
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
24
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
25 let ind = indent(pnum)
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
26 let line = getline(pnum)
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
27
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
28 if line =~ '^\s*\%(grammar\|module\|rule\)\>'
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
29 let ind += &sw
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
30 endif
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
31
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
32 let line = getline(v:lnum)
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
33 if line =~ '^\s*end\>'
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
34 let ind -= &sw
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
35 end
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
36
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
37 retur ind
6f63330ec225 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents:
diff changeset
38 endfunction