annotate runtime/syntax/javascript.vim @ 19470:ddc2e7caff46

Added tag v8.2.0292 for changeset 55656a51d2af1ff933d100af21206204f1bb0938
author Bram Moolenaar <Bram@vim.org>
date Thu, 20 Feb 2020 23:15:04 +0100
parents 03b854983b14
children 74e3316c1d5a
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: JavaScript
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " Maintainer: Claudio Fleiner <claudio@fleiner.com>
557
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
4 " Updaters: Scott Shattuck (ss) <ss@technicalpursuit.com>
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 " URL: http://www.fleiner.com/vim/syntax/javascript.vim
557
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
6 " Changes: (ss) added keywords, reserved words, and other identifiers
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
7 " (ss) repaired several quoting and grouping glitches
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
8 " (ss) fixed regex parsing issue with multiple qualifiers [gi]
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
9 " (ss) additional factoring of keywords, globals, and members
18186
03b854983b14 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
10 " Last Change: 2019 Sep 27
4869
a5352e73dc00 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3854
diff changeset
11 " 2013 Jun 12: adjusted javaScriptRegexpString (Kevin Locke)
13735
a62eeee5f116 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 10051
diff changeset
12 " 2018 Apr 14: adjusted javaScriptRegexpString (LongJohnCoder)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 " tuning parameters:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 " unlet javaScript_fold
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 if !exists("main_syntax")
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 5239
diff changeset
18 " quit when a syntax file was already loaded
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 5239
diff changeset
19 if exists("b:current_syntax")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 let main_syntax = 'javascript'
5239
11cd8d58372e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4869
diff changeset
23 elseif exists("b:current_syntax") && b:current_syntax == "javascript"
11cd8d58372e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 4869
diff changeset
24 finish
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3854
aa51675adf7e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
27 let s:cpo_save = &cpo
aa51675adf7e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
28 set cpo&vim
aa51675adf7e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
29
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 syn keyword javaScriptCommentTodo TODO FIXME XXX TBD contained
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 829
diff changeset
32 syn match javaScriptLineComment "\/\/.*" contains=@Spell,javaScriptCommentTodo
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 syn match javaScriptCommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 829
diff changeset
34 syn region javaScriptComment start="/\*" end="\*/" contains=@Spell,javaScriptCommentTodo
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 syn match javaScriptSpecial "\\\d\d\d\|\\."
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1121
diff changeset
36 syn region javaScriptStringD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=javaScriptSpecial,@htmlPreproc
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1121
diff changeset
37 syn region javaScriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=javaScriptSpecial,@htmlPreproc
14421
2f7e67dd088c Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13735
diff changeset
38 syn region javaScriptStringT start=+`+ skip=+\\\\\|\\`+ end=+`+ contains=javaScriptSpecial,javaScriptEmbed,@htmlPreproc
2f7e67dd088c Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13735
diff changeset
39
2f7e67dd088c Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13735
diff changeset
40 syn region javaScriptEmbed start=+${+ end=+}+ contains=@javaScriptEmbededExpr
557
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
41
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 syn match javaScriptSpecialCharacter "'\\.'"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 syn match javaScriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
14421
2f7e67dd088c Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13735
diff changeset
44 syn region javaScriptRegexpString start=+[,(=+]\s*/[^/*]+ms=e-1,me=e-1 skip=+\\\\\|\\/+ end=+/[gimuys]\{0,2\}\s*$+ end=+/[gimuys]\{0,2\}\s*[+;.,)\]}]+me=e-1 end=+/[gimuys]\{0,2\}\s\+\/+me=e-1 contains=@htmlPreproc,javaScriptComment oneline
557
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
45
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
46 syn keyword javaScriptConditional if else switch
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
47 syn keyword javaScriptRepeat while for do in
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
48 syn keyword javaScriptBranch break continue
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
49 syn keyword javaScriptOperator new delete instanceof typeof
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
50 syn keyword javaScriptType Array Boolean Date Function Number Object String RegExp
18186
03b854983b14 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
51 syn keyword javaScriptStatement return with await
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
52 syn keyword javaScriptBoolean true false
557
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
53 syn keyword javaScriptNull null undefined
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1121
diff changeset
54 syn keyword javaScriptIdentifier arguments this var let
557
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
55 syn keyword javaScriptLabel case default
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
56 syn keyword javaScriptException try catch finally throw
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
57 syn keyword javaScriptMessage alert confirm prompt status
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
58 syn keyword javaScriptGlobal self window top parent
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
59 syn keyword javaScriptMember document event location
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
60 syn keyword javaScriptDeprecated escape unescape
18186
03b854983b14 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 14421
diff changeset
61 syn keyword javaScriptReserved abstract boolean byte char class const debugger double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile async
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
14421
2f7e67dd088c Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13735
diff changeset
63 syn cluster javaScriptEmbededExpr contains=javaScriptBoolean,javaScriptNull,javaScriptIdentifier,javaScriptStringD,javaScriptStringS,javaScriptStringT
2f7e67dd088c Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13735
diff changeset
64
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 if exists("javaScript_fold")
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1121
diff changeset
66 syn match javaScriptFunction "\<function\>"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 syn region javaScriptFunctionFold start="\<function\>.*[^};]$" end="^\z1}.*$" transparent fold keepend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 syn sync match javaScriptSync grouphere javaScriptFunctionFold "\<function\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 syn sync match javaScriptSync grouphere NONE "^}"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 setlocal foldmethod=syntax
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 setlocal foldtext=getline(v:foldstart)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 else
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1121
diff changeset
75 syn keyword javaScriptFunction function
557
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
76 syn match javaScriptBraces "[{}\[\]]"
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
77 syn match javaScriptParens "[()]"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 syn sync fromstart
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 syn sync maxlines=100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 if main_syntax == "javascript"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 syn sync ccomment javaScriptComment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 " Define the default highlighting.
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 5239
diff changeset
88 " Only when an item doesn't have highlighting yet
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
89 hi def link javaScriptComment Comment
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
90 hi def link javaScriptLineComment Comment
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
91 hi def link javaScriptCommentTodo Todo
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
92 hi def link javaScriptSpecial Special
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
93 hi def link javaScriptStringS String
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
94 hi def link javaScriptStringD String
14421
2f7e67dd088c Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13735
diff changeset
95 hi def link javaScriptStringT String
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
96 hi def link javaScriptCharacter Character
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
97 hi def link javaScriptSpecialCharacter javaScriptSpecial
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
98 hi def link javaScriptNumber javaScriptValue
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
99 hi def link javaScriptConditional Conditional
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
100 hi def link javaScriptRepeat Repeat
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
101 hi def link javaScriptBranch Conditional
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
102 hi def link javaScriptOperator Operator
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
103 hi def link javaScriptType Type
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
104 hi def link javaScriptStatement Statement
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
105 hi def link javaScriptFunction Function
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
106 hi def link javaScriptBraces Function
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
107 hi def link javaScriptError Error
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
108 hi def link javaScrParenError javaScriptError
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
109 hi def link javaScriptNull Keyword
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
110 hi def link javaScriptBoolean Boolean
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
111 hi def link javaScriptRegexpString String
557
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
112
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
113 hi def link javaScriptIdentifier Identifier
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
114 hi def link javaScriptLabel Label
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
115 hi def link javaScriptException Exception
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
116 hi def link javaScriptMessage Keyword
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
117 hi def link javaScriptGlobal Keyword
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
118 hi def link javaScriptMember Keyword
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
119 hi def link javaScriptDeprecated Exception
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
120 hi def link javaScriptReserved Keyword
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
121 hi def link javaScriptDebug Debug
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
122 hi def link javaScriptConstant Label
14421
2f7e67dd088c Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13735
diff changeset
123 hi def link javaScriptEmbed Special
2f7e67dd088c Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 13735
diff changeset
124
557
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
125
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 let b:current_syntax = "javascript"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 if main_syntax == 'javascript'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 unlet main_syntax
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 endif
3854
aa51675adf7e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
131 let &cpo = s:cpo_save
aa51675adf7e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
132 unlet s:cpo_save
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 " vim: ts=8