annotate runtime/syntax/typescriptreact.vim @ 18761:e3785af3ba0f v8.1.2370

patch 8.1.2370: build problems on VMS Commit: https://github.com/vim/vim/commit/0c5c3faef2d54151a8c144539e3e5a3350fb18c7 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 30 22:38:16 2019 +0100 patch 8.1.2370: build problems on VMS Problem: Build problems on VMS. Solution: Adjust the build file. (Zoltan Arpadffy)
author Bram Moolenaar <Bram@vim.org>
date Sat, 30 Nov 2019 22:45:04 +0100
parents 82a28df1e2d5
children 2acb87ee55fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18639
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Vim syntax file
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Language: TypeScript with React (JSX)
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Maintainer: Bram Moolenaar
18750
82a28df1e2d5 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 18639
diff changeset
4 " Last Change: 2019 Nov 30
18639
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 " Based On: Herrington Darkholme's yats.vim
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 " Changes: See https:github.com/HerringtonDarkholme/yats.vim
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 " Credits: See yats.vim on github
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 if !exists("main_syntax")
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 if exists("b:current_syntax")
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 finish
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 endif
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 let main_syntax = 'typescriptreact'
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 endif
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 let s:cpo_save = &cpo
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 set cpo&vim
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 syntax region tsxTag
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 \ start=+<\([^/!?<>="':]\+\)\@=+
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 \ skip=+</[^ /!?<>"']\+>+
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 \ end=+/\@<!>+
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 \ end=+\(/>\)\@=+
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 \ contained
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 \ contains=tsxTagName,tsxIntrinsicTagName,tsxAttrib,tsxEscJs,
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 \tsxCloseString,@tsxComment
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 syntax match tsxTag /<>/ contained
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 " <tag></tag>
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 " s~~~~~~~~~e
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 " and self close tag
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 " <tag/>
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 " s~~~~e
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 " A big start regexp borrowed from https://git.io/vDyxc
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 syntax region tsxRegion
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 \ start=+<\_s*\z([a-zA-Z1-9\$_-]\+\(\.\k\+\)*\)+
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 \ skip=+<!--\_.\{-}-->+
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 \ end=+</\_s*\z1>+
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 \ matchgroup=tsxCloseString end=+/>+
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 \ fold
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 \ contains=tsxRegion,tsxCloseString,tsxCloseTag,tsxTag,tsxCommentInvalid,tsxFragment,tsxEscJs,@Spell
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 \ keepend
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 \ extend
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 " <> </>
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 " s~~~~~~e
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 " A big start regexp borrowed from https://git.io/vDyxc
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 syntax region tsxFragment
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 \ start=+\(\((\|{\|}\|\[\|,\|&&\|||\|?\|:\|=\|=>\|\Wreturn\|^return\|\Wdefault\|^\|>\)\_s*\)\@<=<>+
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 \ skip=+<!--\_.\{-}-->+
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 \ end=+</>+
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 \ fold
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 \ contains=tsxRegion,tsxCloseString,tsxCloseTag,tsxTag,tsxCommentInvalid,tsxFragment,tsxEscJs,@Spell
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 \ keepend
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 \ extend
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 " </tag>
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 " ~~~~~~
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 syntax match tsxCloseTag
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 \ +</\_s*[^/!?<>"']\+>+
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 \ contained
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 \ contains=tsxTagName,tsxIntrinsicTagName
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 syntax match tsxCloseTag +</>+ contained
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 syntax match tsxCloseString
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 \ +/>+
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 \ contained
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 " <!-- -->
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 " ~~~~~~~~
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 syntax match tsxCommentInvalid /<!--\_.\{-}-->/ display
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 syntax region tsxBlockComment
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 \ contained
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 \ start="/\*"
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 \ end="\*/"
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 syntax match tsxLineComment
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 \ "//.*$"
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 \ contained
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 \ display
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 syntax cluster tsxComment contains=tsxBlockComment,tsxLineComment
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 syntax match tsxEntity "&[^; \t]*;" contains=tsxEntityPunct
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 syntax match tsxEntityPunct contained "[&.;]"
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 " <tag key={this.props.key}>
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 " ~~~
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 syntax match tsxTagName
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 \ +[</]\_s*[^/!?<>"'* ]\++hs=s+1
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 \ contained
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 \ nextgroup=tsxAttrib
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 \ skipwhite
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 \ display
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 syntax match tsxIntrinsicTagName
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 \ +[</]\_s*[a-z1-9-]\++hs=s+1
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 \ contained
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 \ nextgroup=tsxAttrib
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 \ skipwhite
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 \ display
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 " <tag key={this.props.key}>
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 " ~~~
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 syntax match tsxAttrib
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 \ +[a-zA-Z_][-0-9a-zA-Z_]*+
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 \ nextgroup=tsxEqual skipwhite
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 \ contained
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 \ display
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 " <tag id="sample">
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 " ~
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 syntax match tsxEqual +=+ display contained
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 \ nextgroup=tsxString skipwhite
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 " <tag id="sample">
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 " s~~~~~~e
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 syntax region tsxString contained start=+"+ end=+"+ contains=tsxEntity,@Spell display
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 " <tag key={this.props.key}>
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 " s~~~~~~~~~~~~~~e
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 syntax region tsxEscJs
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 \ contained
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 \ contains=@typescriptValue,@tsxComment
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 \ matchgroup=typescriptBraces
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 \ start=+{+
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 \ end=+}+
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 \ extend
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 """""""""""""""""""""""""""""""""""""""""""""""""""
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135 " Source the part common with typescriptreact.vim
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 source <sfile>:h/typescriptcommon.vim
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 syntax cluster typescriptExpression add=tsxRegion,tsxFragment
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141 hi def link tsxTag htmlTag
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142 hi def link tsxTagName Function
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143 hi def link tsxIntrinsicTagName htmlTagName
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144 hi def link tsxString String
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145 hi def link tsxNameSpace Function
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 hi def link tsxCommentInvalid Error
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147 hi def link tsxBlockComment Comment
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 hi def link tsxLineComment Comment
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149 hi def link tsxAttrib Type
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 hi def link tsxEscJs tsxEscapeJs
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 hi def link tsxCloseTag htmlTag
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 hi def link tsxCloseString Identifier
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 let b:current_syntax = "typescriptreact"
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155 if main_syntax == 'typescriptreact'
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 unlet main_syntax
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157 endif
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
159 let &cpo = s:cpo_save
cb3163d590a1 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160 unlet s:cpo_save