Mercurial > vim
annotate runtime/syntax/ptcap.vim @ 20738:d4a02687852e
Added tag v8.2.0921 for changeset 0b4a9642b39c0738e4d179d1aae77489619334ba
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 07 Jun 2020 17:15:04 +0200 |
parents | 46763b01cd9a |
children | 20cf2080f1ee |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: printcap/termcap database | |
3 " Maintainer: Haakon Riiser <hakonrk@fys.uio.no> | |
4 " URL: http://folk.uio.no/hakonrk/vim/syntax/ptcap.vim | |
5 " Last Change: 2001 May 15 | |
6 | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
7 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
8 if exists("b:current_syntax") |
7 | 9 finish |
10 endif | |
11 | |
12 " Since I only highlight based on the structure of the databases, not | |
13 " specific keywords, case sensitivity isn't required | |
14 syn case ignore | |
15 | |
16 " Since everything that is not caught by the syntax patterns is assumed | |
17 " to be an error, we start parsing 20 lines up, unless something else | |
18 " is specified | |
19 if exists("ptcap_minlines") | |
20 exe "syn sync lines=".ptcap_minlines | |
21 else | |
22 syn sync lines=20 | |
23 endif | |
24 | |
25 " Highlight everything that isn't caught by the rules as errors, | |
26 " except blank lines | |
27 syn match ptcapError "^.*\S.*$" | |
28 | |
29 syn match ptcapLeadBlank "^\s\+" contained | |
30 | |
31 " `:' and `|' are delimiters for fields and names, and should not be | |
32 " highlighted. Hence, they are linked to `NONE' | |
33 syn match ptcapDelimiter "[:|]" contained | |
34 | |
35 " Escaped characters receive special highlighting | |
36 syn match ptcapEscapedChar "\\." contained | |
37 syn match ptcapEscapedChar "\^." contained | |
38 syn match ptcapEscapedChar "\\\o\{3}" contained | |
39 | |
40 " A backslash at the end of a line will suppress the newline | |
41 syn match ptcapLineCont "\\$" contained | |
42 | |
43 " A number follows the same rules as an integer in C | |
44 syn match ptcapNumber "#\(+\|-\)\=\d\+"lc=1 contained | |
45 syn match ptcapNumberError "#\d*[^[:digit:]:\\]"lc=1 contained | |
46 syn match ptcapNumber "#0x\x\{1,8}"lc=1 contained | |
47 syn match ptcapNumberError "#0x\X"me=e-1,lc=1 contained | |
48 syn match ptcapNumberError "#0x\x\{9}"lc=1 contained | |
49 syn match ptcapNumberError "#0x\x*[^[:xdigit:]:\\]"lc=1 contained | |
50 | |
51 " The `@' operator clears a flag (i.e., sets it to zero) | |
52 " The `#' operator assigns a following number to the flag | |
53 " The `=' operator assigns a string to the preceding flag | |
54 syn match ptcapOperator "[@#=]" contained | |
55 | |
56 " Some terminal capabilites have special names like `#5' and `@1', and we | |
57 " need special rules to match these properly | |
58 syn match ptcapSpecialCap "\W[#@]\d" contains=ptcapDelimiter contained | |
59 | |
60 " If editing a termcap file, an entry in the database is terminated by | |
61 " a (non-escaped) newline. Otherwise, it is terminated by a line which | |
62 " does not start with a colon (:) | |
63 if exists("b:ptcap_type") && b:ptcap_type[0] == 't' | |
64 syn region ptcapEntry start="^\s*[^[:space:]:]" end="[^\\]\(\\\\\)*$" end="^$" contains=ptcapNames,ptcapField,ptcapLeadBlank keepend | |
65 else | |
66 syn region ptcapEntry start="^\s*[^[:space:]:]"me=e-1 end="^\s*[^[:space:]:#]"me=e-1 contains=ptcapNames,ptcapField,ptcapLeadBlank,ptcapComment | |
67 endif | |
68 syn region ptcapNames start="^\s*[^[:space:]:]" skip="[^\\]\(\\\\\)*\\:" end=":"me=e-1 contains=ptcapDelimiter,ptcapEscapedChar,ptcapLineCont,ptcapLeadBlank,ptcapComment keepend contained | |
69 syn region ptcapField start=":" skip="[^\\]\(\\\\\)*\\$" end="[^\\]\(\\\\\)*:"me=e-1 end="$" contains=ptcapDelimiter,ptcapString,ptcapNumber,ptcapNumberError,ptcapOperator,ptcapLineCont,ptcapSpecialCap,ptcapLeadBlank,ptcapComment keepend contained | |
70 syn region ptcapString matchgroup=ptcapOperator start="=" skip="[^\\]\(\\\\\)*\\:" matchgroup=ptcapDelimiter end=":"me=e-1 matchgroup=NONE end="[^\\]\(\\\\\)*[^\\]$" end="^$" contains=ptcapEscapedChar,ptcapLineCont keepend contained | |
71 syn region ptcapComment start="^\s*#" end="$" contains=ptcapLeadBlank | |
72 | |
73 | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
74 hi def link ptcapComment Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
75 hi def link ptcapDelimiter Delimiter |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
76 " The highlighting of "ptcapEntry" should always be overridden by |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
77 " its contents, so I use Todo highlighting to indicate that there |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
78 " is work to be done with the syntax file if you can see it :-) |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
79 hi def link ptcapEntry Todo |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
80 hi def link ptcapError Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
81 hi def link ptcapEscapedChar SpecialChar |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
82 hi def link ptcapField Type |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
83 hi def link ptcapLeadBlank NONE |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
84 hi def link ptcapLineCont Special |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
85 hi def link ptcapNames Label |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
86 hi def link ptcapNumber NONE |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
87 hi def link ptcapNumberError Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
88 hi def link ptcapOperator Operator |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
89 hi def link ptcapSpecialCap Type |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
90 hi def link ptcapString NONE |
7 | 91 |
92 | |
93 let b:current_syntax = "ptcap" | |
94 | |
95 " vim: sts=4 sw=4 ts=8 |