annotate runtime/syntax/javascript.vim @ 1902:5d1ca05fa8ff v7.2.199

updated for version 7.2-199
author vimboss
date Tue, 16 Jun 2009 12:31:33 +0000
parents e63691e7c504
children b9e314fe473f
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
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 829
diff changeset
10 " Last Change: 2006 Jun 19
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 " For version 5.x: Clear all syntax items
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 " For version 6.x: Quit when a syntax file was already loaded
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")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 if version < 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 syntax clear
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 elseif exists("b:current_syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 let main_syntax = 'javascript'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 " Drop fold if it set but vim doesn't support it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 if version < 600 && exists("javaScript_fold")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 unlet javaScript_fold
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 syn case ignore
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 syn keyword javaScriptCommentTodo TODO FIXME XXX TBD contained
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 829
diff changeset
35 syn match javaScriptLineComment "\/\/.*" contains=@Spell,javaScriptCommentTodo
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 syn match javaScriptCommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 829
diff changeset
37 syn region javaScriptComment start="/\*" end="\*/" contains=@Spell,javaScriptCommentTodo
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 syn match javaScriptSpecial "\\\d\d\d\|\\."
557
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
39 syn region javaScriptStringD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=javaScriptSpecial,@htmlPreproc
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
40 syn region javaScriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=javaScriptSpecial,@htmlPreproc
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]\+\>"
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 557
diff changeset
44 syn region javaScriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\{0,2\}\s*$+ end=+/[gi]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc 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
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
51 syn keyword javaScriptStatement return with
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
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
54 syn keyword javaScriptIdentifier arguments this var
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
862863033fdd updated for version 7.0158
vimboss
parents: 417
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
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 if exists("javaScript_fold")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 syn match javaScriptFunction "\<function\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 syn region javaScriptFunctionFold start="\<function\>.*[^};]$" end="^\z1}.*$" transparent fold keepend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 syn sync match javaScriptSync grouphere javaScriptFunctionFold "\<function\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 syn sync match javaScriptSync grouphere NONE "^}"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 setlocal foldmethod=syntax
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 setlocal foldtext=getline(v:foldstart)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 syn keyword javaScriptFunction function
557
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
74 syn match javaScriptBraces "[{}\[\]]"
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
75 syn match javaScriptParens "[()]"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 syn sync fromstart
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 syn sync maxlines=100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 if main_syntax == "javascript"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 syn sync ccomment javaScriptComment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 " Define the default highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 " For version 5.7 and earlier: only when not done already
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 " For version 5.8 and later: only when an item doesn't have highlighting yet
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 if version >= 508 || !exists("did_javascript_syn_inits")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 if version < 508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 let did_javascript_syn_inits = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 command -nargs=+ HiLink hi link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 command -nargs=+ HiLink hi def link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 endif
36
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
95 HiLink javaScriptComment Comment
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
96 HiLink javaScriptLineComment Comment
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
97 HiLink javaScriptCommentTodo Todo
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
98 HiLink javaScriptSpecial Special
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
99 HiLink javaScriptStringS String
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
100 HiLink javaScriptStringD String
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
101 HiLink javaScriptCharacter Character
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
102 HiLink javaScriptSpecialCharacter javaScriptSpecial
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
103 HiLink javaScriptNumber javaScriptValue
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
104 HiLink javaScriptConditional Conditional
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
105 HiLink javaScriptRepeat Repeat
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
106 HiLink javaScriptBranch Conditional
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
107 HiLink javaScriptOperator Operator
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
108 HiLink javaScriptType Type
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
109 HiLink javaScriptStatement Statement
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
110 HiLink javaScriptFunction Function
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
111 HiLink javaScriptBraces Function
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
112 HiLink javaScriptError Error
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
113 HiLink javaScrParenError javaScriptError
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
114 HiLink javaScriptNull Keyword
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
115 HiLink javaScriptBoolean Boolean
125e80798a85 updated for version 7.0021
vimboss
parents: 7
diff changeset
116 HiLink javaScriptRegexpString String
557
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
117
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
118 HiLink javaScriptIdentifier Identifier
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
119 HiLink javaScriptLabel Label
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
120 HiLink javaScriptException Exception
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
121 HiLink javaScriptMessage Keyword
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
122 HiLink javaScriptGlobal Keyword
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
123 HiLink javaScriptMember Keyword
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
124 HiLink javaScriptDeprecated Exception
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
125 HiLink javaScriptReserved Keyword
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
126 HiLink javaScriptDebug Debug
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
127 HiLink javaScriptConstant Label
862863033fdd updated for version 7.0158
vimboss
parents: 417
diff changeset
128
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 delcommand HiLink
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 let b:current_syntax = "javascript"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 if main_syntax == 'javascript'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 unlet main_syntax
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 " vim: ts=8