Mercurial > vim
annotate runtime/syntax/javascript.vim @ 33636:53416c49a7ab v9.0.2059
patch 9.0.2059: outstanding exceptions may be skipped
Commit: https://github.com/vim/vim/commit/0ab500dede4edd8d5aee7ddc63444537be527871
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sat Oct 21 11:59:42 2023 +0200
patch 9.0.2059: outstanding exceptions may be skipped
Problem: outstanding exceptions may be skipped
Solution: When restoring exception state, process remaining outstanding
exceptions
closes: #13386
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 21 Oct 2023 12:15:03 +0200 |
parents | 8509b2b41b28 |
children | 11fc42b05554 |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: JavaScript | |
3 " Maintainer: Claudio Fleiner <claudio@fleiner.com> | |
557 | 4 " Updaters: Scott Shattuck (ss) <ss@technicalpursuit.com> |
7 | 5 " URL: http://www.fleiner.com/vim/syntax/javascript.vim |
557 | 6 " Changes: (ss) added keywords, reserved words, and other identifiers |
7 " (ss) repaired several quoting and grouping glitches | |
8 " (ss) fixed regex parsing issue with multiple qualifiers [gi] | |
9 " (ss) additional factoring of keywords, globals, and members | |
29104 | 10 " Last Change: 2022 Jun 09 |
4869 | 11 " 2013 Jun 12: adjusted javaScriptRegexpString (Kevin Locke) |
13735 | 12 " 2018 Apr 14: adjusted javaScriptRegexpString (LongJohnCoder) |
7 | 13 |
14 " tuning parameters: | |
15 " unlet javaScript_fold | |
16 | |
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 | 20 finish |
21 endif | |
22 let main_syntax = 'javascript' | |
5239 | 23 elseif exists("b:current_syntax") && b:current_syntax == "javascript" |
24 finish | |
7 | 25 endif |
26 | |
3854 | 27 let s:cpo_save = &cpo |
28 set cpo&vim | |
29 | |
7 | 30 |
31 syn keyword javaScriptCommentTodo TODO FIXME XXX TBD contained | |
1121 | 32 syn match javaScriptLineComment "\/\/.*" contains=@Spell,javaScriptCommentTodo |
7 | 33 syn match javaScriptCommentSkip "^[ \t]*\*\($\|[ \t]\+\)" |
1121 | 34 syn region javaScriptComment start="/\*" end="\*/" contains=@Spell,javaScriptCommentTodo |
7 | 35 syn match javaScriptSpecial "\\\d\d\d\|\\." |
2152 | 36 syn region javaScriptStringD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=javaScriptSpecial,@htmlPreproc |
37 syn region javaScriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=javaScriptSpecial,@htmlPreproc | |
14421 | 38 syn region javaScriptStringT start=+`+ skip=+\\\\\|\\`+ end=+`+ contains=javaScriptSpecial,javaScriptEmbed,@htmlPreproc |
39 | |
40 syn region javaScriptEmbed start=+${+ end=+}+ contains=@javaScriptEmbededExpr | |
557 | 41 |
29104 | 42 " number handling by Christopher Leonard chris.j.leonard@gmx.com |
7 | 43 syn match javaScriptSpecialCharacter "'\\.'" |
29104 | 44 syn match javaScriptNumber "\<0[bB][0-1]\+\(_[0-1]\+\)*\>" |
45 syn match javaScriptNumber "\<0[oO][0-7]\+\(_[0-7]\+\)*\>" | |
46 syn match javaScriptNumber "\<0\([0-7]\+\(_[0-7]\+\)*\)\?\>" | |
47 syn match javaScriptNumber "\<0[xX][0-9a-fA-F]\+\(_[0-9a-fA-F]\+\)*\>" | |
48 syn match javaScriptNumber "\<\d\+\(_\d\+\)*[eE][+-]\?\d\+\>" | |
49 syn match javaScriptNumber "\<[1-9]\d*\(_\d\+\)*\(\.\(\d\+\(_\d\+\)*\([eE][+-]\?\d\+\)\?\)\?\)\?\>" | |
50 syn match javaScriptNumber "\<\(\d\+\(_\d\+\)*\)\?\.\d\+\(_\d\+\)*\([eE][+-]\?\d\+\)\?\>" | |
51 syn match javaScriptNumber "\<\d\+\(_\d\+\)*\.\(\d\+\(_\d\+\)*\([eE][+-]\?\d\+\)\?\)\?\>" | |
14421 | 52 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 | 53 |
54 syn keyword javaScriptConditional if else switch | |
32848
d43eec1fb936
Keywords 'of' and 'yield' for Javascript. (#7873)
Christian Brabandt <cb@256bit.org>
parents:
29104
diff
changeset
|
55 syn keyword javaScriptRepeat while for do in of |
557 | 56 syn keyword javaScriptBranch break continue |
57 syn keyword javaScriptOperator new delete instanceof typeof | |
58 syn keyword javaScriptType Array Boolean Date Function Number Object String RegExp | |
32848
d43eec1fb936
Keywords 'of' and 'yield' for Javascript. (#7873)
Christian Brabandt <cb@256bit.org>
parents:
29104
diff
changeset
|
59 syn keyword javaScriptStatement return with await yield |
36 | 60 syn keyword javaScriptBoolean true false |
557 | 61 syn keyword javaScriptNull null undefined |
2152 | 62 syn keyword javaScriptIdentifier arguments this var let |
557 | 63 syn keyword javaScriptLabel case default |
64 syn keyword javaScriptException try catch finally throw | |
65 syn keyword javaScriptMessage alert confirm prompt status | |
66 syn keyword javaScriptGlobal self window top parent | |
67 syn keyword javaScriptMember document event location | |
68 syn keyword javaScriptDeprecated escape unescape | |
18186 | 69 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 | 70 |
14421 | 71 syn cluster javaScriptEmbededExpr contains=javaScriptBoolean,javaScriptNull,javaScriptIdentifier,javaScriptStringD,javaScriptStringS,javaScriptStringT |
72 | |
7 | 73 if exists("javaScript_fold") |
2152 | 74 syn match javaScriptFunction "\<function\>" |
7 | 75 syn region javaScriptFunctionFold start="\<function\>.*[^};]$" end="^\z1}.*$" transparent fold keepend |
76 | |
77 syn sync match javaScriptSync grouphere javaScriptFunctionFold "\<function\>" | |
78 syn sync match javaScriptSync grouphere NONE "^}" | |
79 | |
80 setlocal foldmethod=syntax | |
81 setlocal foldtext=getline(v:foldstart) | |
82 else | |
2152 | 83 syn keyword javaScriptFunction function |
557 | 84 syn match javaScriptBraces "[{}\[\]]" |
85 syn match javaScriptParens "[()]" | |
7 | 86 endif |
87 | |
20552 | 88 if main_syntax == "javascript" |
89 syn sync fromstart | |
90 syn sync maxlines=100 | |
7 | 91 |
92 syn sync ccomment javaScriptComment | |
93 endif | |
94 | |
95 " Define the default highlighting. | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
5239
diff
changeset
|
96 " 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
|
97 hi def link javaScriptComment Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
98 hi def link javaScriptLineComment Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
99 hi def link javaScriptCommentTodo Todo |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
100 hi def link javaScriptSpecial Special |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
101 hi def link javaScriptStringS String |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
102 hi def link javaScriptStringD String |
14421 | 103 hi def link javaScriptStringT String |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
104 hi def link javaScriptCharacter Character |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
105 hi def link javaScriptSpecialCharacter javaScriptSpecial |
32938
8509b2b41b28
runtime(javascript): fix default link of javaScriptNumber in syntax file (#11788)
Christian Brabandt <cb@256bit.org>
parents:
32848
diff
changeset
|
106 hi def link javaScriptNumber Number |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
107 hi def link javaScriptConditional Conditional |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
108 hi def link javaScriptRepeat Repeat |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
109 hi def link javaScriptBranch Conditional |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
110 hi def link javaScriptOperator Operator |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
111 hi def link javaScriptType Type |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
112 hi def link javaScriptStatement Statement |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
113 hi def link javaScriptFunction Function |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
114 hi def link javaScriptBraces Function |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
115 hi def link javaScriptError Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
116 hi def link javaScrParenError javaScriptError |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
117 hi def link javaScriptNull Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
118 hi def link javaScriptBoolean Boolean |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
119 hi def link javaScriptRegexpString String |
557 | 120 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
121 hi def link javaScriptIdentifier Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
122 hi def link javaScriptLabel Label |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
123 hi def link javaScriptException Exception |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
124 hi def link javaScriptMessage Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
125 hi def link javaScriptGlobal Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
126 hi def link javaScriptMember Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
127 hi def link javaScriptDeprecated Exception |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
128 hi def link javaScriptReserved Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
129 hi def link javaScriptDebug Debug |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
130 hi def link javaScriptConstant Label |
14421 | 131 hi def link javaScriptEmbed Special |
132 | |
557 | 133 |
7 | 134 |
135 let b:current_syntax = "javascript" | |
136 if main_syntax == 'javascript' | |
137 unlet main_syntax | |
138 endif | |
3854 | 139 let &cpo = s:cpo_save |
140 unlet s:cpo_save | |
7 | 141 |
142 " vim: ts=8 |