comparison runtime/syntax/javascript.vim @ 2152:b9e314fe473f

Updated runtime files.
author Bram Moolenaar <bram@zimbu.org>
date Fri, 14 May 2010 23:24:24 +0200
parents e63691e7c504
children aa51675adf7e
comparison
equal deleted inserted replaced
2151:ae22c450546c 2152:b9e314fe473f
5 " URL: http://www.fleiner.com/vim/syntax/javascript.vim 5 " URL: http://www.fleiner.com/vim/syntax/javascript.vim
6 " Changes: (ss) added keywords, reserved words, and other identifiers 6 " Changes: (ss) added keywords, reserved words, and other identifiers
7 " (ss) repaired several quoting and grouping glitches 7 " (ss) repaired several quoting and grouping glitches
8 " (ss) fixed regex parsing issue with multiple qualifiers [gi] 8 " (ss) fixed regex parsing issue with multiple qualifiers [gi]
9 " (ss) additional factoring of keywords, globals, and members 9 " (ss) additional factoring of keywords, globals, and members
10 " Last Change: 2006 Jun 19 10 " Last Change: 2010 Mar 25
11 11
12 " For version 5.x: Clear all syntax items 12 " For version 5.x: Clear all syntax items
13 " For version 6.x: Quit when a syntax file was already loaded 13 " For version 6.x: Quit when a syntax file was already loaded
14 " tuning parameters: 14 " tuning parameters:
15 " unlet javaScript_fold 15 " unlet javaScript_fold
26 " Drop fold if it set but vim doesn't support it. 26 " Drop fold if it set but vim doesn't support it.
27 if version < 600 && exists("javaScript_fold") 27 if version < 600 && exists("javaScript_fold")
28 unlet javaScript_fold 28 unlet javaScript_fold
29 endif 29 endif
30 30
31 syn case ignore
32
33 31
34 syn keyword javaScriptCommentTodo TODO FIXME XXX TBD contained 32 syn keyword javaScriptCommentTodo TODO FIXME XXX TBD contained
35 syn match javaScriptLineComment "\/\/.*" contains=@Spell,javaScriptCommentTodo 33 syn match javaScriptLineComment "\/\/.*" contains=@Spell,javaScriptCommentTodo
36 syn match javaScriptCommentSkip "^[ \t]*\*\($\|[ \t]\+\)" 34 syn match javaScriptCommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
37 syn region javaScriptComment start="/\*" end="\*/" contains=@Spell,javaScriptCommentTodo 35 syn region javaScriptComment start="/\*" end="\*/" contains=@Spell,javaScriptCommentTodo
38 syn match javaScriptSpecial "\\\d\d\d\|\\." 36 syn match javaScriptSpecial "\\\d\d\d\|\\."
39 syn region javaScriptStringD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=javaScriptSpecial,@htmlPreproc 37 syn region javaScriptStringD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=javaScriptSpecial,@htmlPreproc
40 syn region javaScriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=javaScriptSpecial,@htmlPreproc 38 syn region javaScriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=javaScriptSpecial,@htmlPreproc
41 39
42 syn match javaScriptSpecialCharacter "'\\.'" 40 syn match javaScriptSpecialCharacter "'\\.'"
43 syn match javaScriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>" 41 syn match javaScriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
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 42 syn region javaScriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\{0,2\}\s*$+ end=+/[gi]\{0,2\}\s*[;.,)\]}]+me=e-1 contains=@htmlPreproc oneline
45 43
49 syn keyword javaScriptOperator new delete instanceof typeof 47 syn keyword javaScriptOperator new delete instanceof typeof
50 syn keyword javaScriptType Array Boolean Date Function Number Object String RegExp 48 syn keyword javaScriptType Array Boolean Date Function Number Object String RegExp
51 syn keyword javaScriptStatement return with 49 syn keyword javaScriptStatement return with
52 syn keyword javaScriptBoolean true false 50 syn keyword javaScriptBoolean true false
53 syn keyword javaScriptNull null undefined 51 syn keyword javaScriptNull null undefined
54 syn keyword javaScriptIdentifier arguments this var 52 syn keyword javaScriptIdentifier arguments this var let
55 syn keyword javaScriptLabel case default 53 syn keyword javaScriptLabel case default
56 syn keyword javaScriptException try catch finally throw 54 syn keyword javaScriptException try catch finally throw
57 syn keyword javaScriptMessage alert confirm prompt status 55 syn keyword javaScriptMessage alert confirm prompt status
58 syn keyword javaScriptGlobal self window top parent 56 syn keyword javaScriptGlobal self window top parent
59 syn keyword javaScriptMember document event location 57 syn keyword javaScriptMember document event location
60 syn keyword javaScriptDeprecated escape unescape 58 syn keyword javaScriptDeprecated escape unescape
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 59 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
62 60
63 if exists("javaScript_fold") 61 if exists("javaScript_fold")
64 syn match javaScriptFunction "\<function\>" 62 syn match javaScriptFunction "\<function\>"
65 syn region javaScriptFunctionFold start="\<function\>.*[^};]$" end="^\z1}.*$" transparent fold keepend 63 syn region javaScriptFunctionFold start="\<function\>.*[^};]$" end="^\z1}.*$" transparent fold keepend
66 64
67 syn sync match javaScriptSync grouphere javaScriptFunctionFold "\<function\>" 65 syn sync match javaScriptSync grouphere javaScriptFunctionFold "\<function\>"
68 syn sync match javaScriptSync grouphere NONE "^}" 66 syn sync match javaScriptSync grouphere NONE "^}"
69 67
70 setlocal foldmethod=syntax 68 setlocal foldmethod=syntax
71 setlocal foldtext=getline(v:foldstart) 69 setlocal foldtext=getline(v:foldstart)
72 else 70 else
73 syn keyword javaScriptFunction function 71 syn keyword javaScriptFunction function
74 syn match javaScriptBraces "[{}\[\]]" 72 syn match javaScriptBraces "[{}\[\]]"
75 syn match javaScriptParens "[()]" 73 syn match javaScriptParens "[()]"
76 endif 74 endif
77 75
78 syn sync fromstart 76 syn sync fromstart