annotate runtime/syntax/ptcap.vim @ 18486:9d887cad7315

Added tag v8.1.2237 for changeset 63ee3c2b140fe1b4801389872a8e47aec19d028b
author Bram Moolenaar <Bram@vim.org>
date Thu, 31 Oct 2019 20:00:04 +0100
parents 46763b01cd9a
children 20cf2080f1ee
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 syntax file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: printcap/termcap database
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " Maintainer: Haakon Riiser <hakonrk@fys.uio.no>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 " URL: http://folk.uio.no/hakonrk/vim/syntax/ptcap.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 " Last Change: 2001 May 15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
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
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 " Since I only highlight based on the structure of the databases, not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 " specific keywords, case sensitivity isn't required
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 syn case ignore
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 " Since everything that is not caught by the syntax patterns is assumed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 " to be an error, we start parsing 20 lines up, unless something else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 " is specified
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 if exists("ptcap_minlines")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 exe "syn sync lines=".ptcap_minlines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 syn sync lines=20
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 " Highlight everything that isn't caught by the rules as errors,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 " except blank lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 syn match ptcapError "^.*\S.*$"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 syn match ptcapLeadBlank "^\s\+" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 " `:' and `|' are delimiters for fields and names, and should not be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 " highlighted. Hence, they are linked to `NONE'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 syn match ptcapDelimiter "[:|]" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 " Escaped characters receive special highlighting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 syn match ptcapEscapedChar "\\." contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 syn match ptcapEscapedChar "\^." contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 syn match ptcapEscapedChar "\\\o\{3}" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 " A backslash at the end of a line will suppress the newline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 syn match ptcapLineCont "\\$" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 " A number follows the same rules as an integer in C
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 syn match ptcapNumber "#\(+\|-\)\=\d\+"lc=1 contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 syn match ptcapNumberError "#\d*[^[:digit:]:\\]"lc=1 contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 syn match ptcapNumber "#0x\x\{1,8}"lc=1 contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 syn match ptcapNumberError "#0x\X"me=e-1,lc=1 contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 syn match ptcapNumberError "#0x\x\{9}"lc=1 contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 syn match ptcapNumberError "#0x\x*[^[:xdigit:]:\\]"lc=1 contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 " The `@' operator clears a flag (i.e., sets it to zero)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 " The `#' operator assigns a following number to the flag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 " The `=' operator assigns a string to the preceding flag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 syn match ptcapOperator "[@#=]" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 " Some terminal capabilites have special names like `#5' and `@1', and we
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 " need special rules to match these properly
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 syn match ptcapSpecialCap "\W[#@]\d" contains=ptcapDelimiter contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 " If editing a termcap file, an entry in the database is terminated by
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 " a (non-escaped) newline. Otherwise, it is terminated by a line which
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 " does not start with a colon (:)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 if exists("b:ptcap_type") && b:ptcap_type[0] == 't'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 syn region ptcapEntry start="^\s*[^[:space:]:]" end="[^\\]\(\\\\\)*$" end="^$" contains=ptcapNames,ptcapField,ptcapLeadBlank keepend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 syn region ptcapEntry start="^\s*[^[:space:]:]"me=e-1 end="^\s*[^[:space:]:#]"me=e-1 contains=ptcapNames,ptcapField,ptcapLeadBlank,ptcapComment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 syn region ptcapNames start="^\s*[^[:space:]:]" skip="[^\\]\(\\\\\)*\\:" end=":"me=e-1 contains=ptcapDelimiter,ptcapEscapedChar,ptcapLineCont,ptcapLeadBlank,ptcapComment keepend contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 syn region ptcapField start=":" skip="[^\\]\(\\\\\)*\\$" end="[^\\]\(\\\\\)*:"me=e-1 end="$" contains=ptcapDelimiter,ptcapString,ptcapNumber,ptcapNumberError,ptcapOperator,ptcapLineCont,ptcapSpecialCap,ptcapLeadBlank,ptcapComment keepend contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 syn region ptcapString matchgroup=ptcapOperator start="=" skip="[^\\]\(\\\\\)*\\:" matchgroup=ptcapDelimiter end=":"me=e-1 matchgroup=NONE end="[^\\]\(\\\\\)*[^\\]$" end="^$" contains=ptcapEscapedChar,ptcapLineCont keepend contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 syn region ptcapComment start="^\s*#" end="$" contains=ptcapLeadBlank
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 let b:current_syntax = "ptcap"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 " vim: sts=4 sw=4 ts=8