Mercurial > vim
annotate runtime/syntax/sed.vim @ 16338:366978ec2c03 v8.1.1174
patch 8.1.1174: cannot build with Ruby 1.8
commit https://github.com/vim/vim/commit/8dc4c7292364d31cfb8afa8a67984b78b657b192
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Apr 14 19:42:13 2019 +0200
patch 8.1.1174: cannot build with Ruby 1.8
Problem: Cannot build with Ruby 1.8. (Tom G. Christensen)
Solution: Include ruby/st.h. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/4257)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 14 Apr 2019 19:45:04 +0200 |
parents | 46763b01cd9a |
children | 3295247d97a5 |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: sed | |
3 " Maintainer: Haakon Riiser <hakonrk@fys.uio.no> | |
4 " URL: http://folk.uio.no/hakonrk/vim/syntax/sed.vim | |
2231
aa6412cab544
Various improvements to undo file code to make it more robust.
Bram Moolenaar <bram@vim.org>
parents:
602
diff
changeset
|
5 " Last Change: 2010 May 29 |
7 | 6 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2231
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:
2231
diff
changeset
|
8 if exists("b:current_syntax") |
7 | 9 finish |
10 endif | |
11 | |
12 syn match sedError "\S" | |
13 | |
14 syn match sedWhitespace "\s\+" contained | |
15 syn match sedSemicolon ";" | |
16 syn match sedAddress "[[:digit:]$]" | |
17 syn match sedAddress "\d\+\~\d\+" | |
18 syn region sedAddress matchgroup=Special start="[{,;]\s*/\(\\/\)\="lc=1 skip="[^\\]\(\\\\\)*\\/" end="/I\=" contains=sedTab,sedRegexpMeta | |
19 syn region sedAddress matchgroup=Special start="^\s*/\(\\/\)\=" skip="[^\\]\(\\\\\)*\\/" end="/I\=" contains=sedTab,sedRegexpMeta | |
20 syn match sedComment "^\s*#.*$" | |
602 | 21 syn match sedFunction "[dDgGhHlnNpPqQx=]\s*\($\|;\)" contains=sedSemicolon,sedWhitespace |
7 | 22 syn match sedLabel ":[^;]*" |
23 syn match sedLineCont "^\(\\\\\)*\\$" contained | |
24 syn match sedLineCont "[^\\]\(\\\\\)*\\$"ms=e contained | |
25 syn match sedSpecial "[{},!]" | |
26 if exists("highlight_sedtabs") | |
27 syn match sedTab "\t" contained | |
28 endif | |
29 | |
30 " Append/Change/Insert | |
31 syn region sedACI matchgroup=sedFunction start="[aci]\\$" matchgroup=NONE end="^.*$" contains=sedLineCont,sedTab | |
32 | |
33 syn region sedBranch matchgroup=sedFunction start="[bt]" matchgroup=sedSemicolon end=";\|$" contains=sedWhitespace | |
34 syn region sedRW matchgroup=sedFunction start="[rw]" matchgroup=sedSemicolon end=";\|$" contains=sedWhitespace | |
35 | |
36 " Substitution/transform with various delimiters | |
37 syn region sedFlagwrite matchgroup=sedFlag start="w" matchgroup=sedSemicolon end=";\|$" contains=sedWhitespace contained | |
38 syn match sedFlag "[[:digit:]gpI]*w\=" contains=sedFlagwrite contained | |
39 syn match sedRegexpMeta "[.*^$]" contained | |
40 syn match sedRegexpMeta "\\." contains=sedTab contained | |
41 syn match sedRegexpMeta "\[.\{-}\]" contains=sedTab contained | |
42 syn match sedRegexpMeta "\\{\d\*,\d*\\}" contained | |
43 syn match sedRegexpMeta "\\(.\{-}\\)" contains=sedTab contained | |
44 syn match sedReplaceMeta "&\|\\\($\|.\)" contains=sedTab contained | |
45 | |
46 " Metacharacters: $ * . \ ^ [ ~ | |
47 " @ is used as delimiter and treated on its own below | |
48 let __at = char2nr("@") | |
2231
aa6412cab544
Various improvements to undo file code to make it more robust.
Bram Moolenaar <bram@vim.org>
parents:
602
diff
changeset
|
49 let __sed_i = char2nr(" ") " ASCII: 32, EBCDIC: 64 |
7 | 50 if has("ebcdic") |
51 let __sed_last = 255 | |
52 else | |
53 let __sed_last = 126 | |
54 endif | |
55 let __sed_metacharacters = '$*.\^[~' | |
56 while __sed_i <= __sed_last | |
57 let __sed_delimiter = escape(nr2char(__sed_i), __sed_metacharacters) | |
58 if __sed_i != __at | |
59 exe 'syn region sedAddress matchgroup=Special start=@\\'.__sed_delimiter.'\(\\'.__sed_delimiter.'\)\=@ skip=@[^\\]\(\\\\\)*\\'.__sed_delimiter.'@ end=@'.__sed_delimiter.'I\=@ contains=sedTab' | |
60 exe 'syn region sedRegexp'.__sed_i 'matchgroup=Special start=@'.__sed_delimiter.'\(\\\\\|\\'.__sed_delimiter.'\)*@ skip=@[^\\'.__sed_delimiter.']\(\\\\\)*\\'.__sed_delimiter.'@ end=@'.__sed_delimiter.'@me=e-1 contains=sedTab,sedRegexpMeta keepend contained nextgroup=sedReplacement'.__sed_i | |
61 exe 'syn region sedReplacement'.__sed_i 'matchgroup=Special start=@'.__sed_delimiter.'\(\\\\\|\\'.__sed_delimiter.'\)*@ skip=@[^\\'.__sed_delimiter.']\(\\\\\)*\\'.__sed_delimiter.'@ end=@'.__sed_delimiter.'@ contains=sedTab,sedReplaceMeta keepend contained nextgroup=sedFlag' | |
62 endif | |
63 let __sed_i = __sed_i + 1 | |
64 endwhile | |
65 syn region sedAddress matchgroup=Special start=+\\@\(\\@\)\=+ skip=+[^\\]\(\\\\\)*\\@+ end=+@I\=+ contains=sedTab,sedRegexpMeta | |
66 syn region sedRegexp64 matchgroup=Special start=+@\(\\\\\|\\@\)*+ skip=+[^\\@]\(\\\\\)*\\@+ end=+@+me=e-1 contains=sedTab,sedRegexpMeta keepend contained nextgroup=sedReplacement64 | |
67 syn region sedReplacement64 matchgroup=Special start=+@\(\\\\\|\\@\)*+ skip=+[^\\@]\(\\\\\)*\\@+ end=+@+ contains=sedTab,sedReplaceMeta keepend contained nextgroup=sedFlag | |
68 | |
69 " Since the syntax for the substituion command is very similar to the | |
70 " syntax for the transform command, I use the same pattern matching | |
71 " for both commands. There is one problem -- the transform command | |
72 " (y) does not allow any flags. To save memory, I ignore this problem. | |
73 syn match sedST "[sy]" nextgroup=sedRegexp\d\+ | |
74 | |
75 | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
76 hi def link sedAddress Macro |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
77 hi def link sedACI NONE |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
78 hi def link sedBranch Label |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
79 hi def link sedComment Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
80 hi def link sedDelete Function |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
81 hi def link sedError Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
82 hi def link sedFlag Type |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
83 hi def link sedFlagwrite Constant |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
84 hi def link sedFunction Function |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
85 hi def link sedLabel Label |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
86 hi def link sedLineCont Special |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
87 hi def link sedPutHoldspc Function |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
88 hi def link sedReplaceMeta Special |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
89 hi def link sedRegexpMeta Special |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
90 hi def link sedRW Constant |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
91 hi def link sedSemicolon Special |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
92 hi def link sedST Function |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
93 hi def link sedSpecial Special |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
94 hi def link sedWhitespace NONE |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2231
diff
changeset
|
95 if exists("highlight_sedtabs") |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
96 hi def link sedTab Todo |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2231
diff
changeset
|
97 endif |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2231
diff
changeset
|
98 let __sed_i = char2nr(" ") " ASCII: 32, EBCDIC: 64 |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2231
diff
changeset
|
99 while __sed_i <= __sed_last |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
100 exe "hi def link sedRegexp".__sed_i "Macro" |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
101 exe "hi def link sedReplacement".__sed_i "NONE" |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2231
diff
changeset
|
102 let __sed_i = __sed_i + 1 |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2231
diff
changeset
|
103 endwhile |
7 | 104 |
105 | |
2231
aa6412cab544
Various improvements to undo file code to make it more robust.
Bram Moolenaar <bram@vim.org>
parents:
602
diff
changeset
|
106 unlet __sed_i __sed_last __sed_delimiter __sed_metacharacters |
7 | 107 |
108 let b:current_syntax = "sed" | |
109 | |
110 " vim: sts=4 sw=4 ts=8 |