forked from aniani/vim
updated for version 7.0158
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
" Vim syntax file
|
||||
" Language: JavaScript
|
||||
" Maintainer: Claudio Fleiner <claudio@fleiner.com>
|
||||
" Updaters: Scott Shattuck (ss) <ss@technicalpursuit.com>
|
||||
" URL: http://www.fleiner.com/vim/syntax/javascript.vim
|
||||
" Last Change: 2005 Jul 13
|
||||
" Changes: (ss) added keywords, reserved words, and other identifiers
|
||||
" (ss) repaired several quoting and grouping glitches
|
||||
" (ss) fixed regex parsing issue with multiple qualifiers [gi]
|
||||
" (ss) additional factoring of keywords, globals, and members
|
||||
" Last Change: 2005 Nov 12 (ss)
|
||||
|
||||
" For version 5.x: Clear all syntax items
|
||||
" For version 6.x: Quit when a syntax file was already loaded
|
||||
@@ -27,23 +32,33 @@ syn case ignore
|
||||
|
||||
|
||||
syn keyword javaScriptCommentTodo TODO FIXME XXX TBD contained
|
||||
syn match javaScriptLineComment "\/\/.*$" contains=javaScriptCommentTodo
|
||||
syn match javaScriptLineComment "\/\/.*" contains=javaScriptCommentTodo
|
||||
syn match javaScriptCommentSkip "^[ \t]*\*\($\|[ \t]\+\)"
|
||||
syn region javaScriptComment start="/\*" end="\*/" contains=javaScriptCommentTodo
|
||||
syn match javaScriptSpecial "\\\d\d\d\|\\."
|
||||
syn region javaScriptStringD start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=javaScriptSpecial,@htmlPreproc
|
||||
syn region javaScriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=javaScriptSpecial,@htmlPreproc
|
||||
syn region javaScriptStringD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=javaScriptSpecial,@htmlPreproc
|
||||
syn region javaScriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=javaScriptSpecial,@htmlPreproc
|
||||
|
||||
syn match javaScriptSpecialCharacter "'\\.'"
|
||||
syn match javaScriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>"
|
||||
syn region javaScriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\?\s*$+ end=+/[gi]\?\s*[;.,)]+me=e-1 contains=@htmlPreproc oneline
|
||||
syn keyword javaScriptConditional if else
|
||||
syn keyword javaScriptRepeat while for
|
||||
syn keyword javaScriptBranch break continue switch case default
|
||||
syn keyword javaScriptOperator new in
|
||||
syn keyword javaScriptType this var const
|
||||
syn region javaScriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gi]\{0,2\}\s*$+ end=+/[gi]\{0,2\}\s*[;.,)]+me=e-1 contains=@htmlPreproc oneline
|
||||
|
||||
syn keyword javaScriptConditional if else switch
|
||||
syn keyword javaScriptRepeat while for do in
|
||||
syn keyword javaScriptBranch break continue
|
||||
syn keyword javaScriptOperator new delete instanceof typeof
|
||||
syn keyword javaScriptType Array Boolean Date Function Number Object String RegExp
|
||||
syn keyword javaScriptStatement return with
|
||||
syn keyword javaScriptBoolean true false
|
||||
syn keyword javaScriptNull null
|
||||
syn keyword javaScriptNull null undefined
|
||||
syn keyword javaScriptIdentifier arguments this var
|
||||
syn keyword javaScriptLabel case default
|
||||
syn keyword javaScriptException try catch finally throw
|
||||
syn keyword javaScriptMessage alert confirm prompt status
|
||||
syn keyword javaScriptGlobal self window top parent
|
||||
syn keyword javaScriptMember document event location
|
||||
syn keyword javaScriptDeprecated escape unescape
|
||||
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
|
||||
|
||||
if exists("javaScript_fold")
|
||||
syn match javaScriptFunction "\<function\>"
|
||||
@@ -56,17 +71,13 @@ if exists("javaScript_fold")
|
||||
setlocal foldtext=getline(v:foldstart)
|
||||
else
|
||||
syn keyword javaScriptFunction function
|
||||
syn match javaScriptBraces "[{}]"
|
||||
syn match javaScriptBraces "[{}\[\]]"
|
||||
syn match javaScriptParens "[()]"
|
||||
endif
|
||||
|
||||
syn sync fromstart
|
||||
syn sync maxlines=100
|
||||
|
||||
" catch errors caused by wrong parenthesis
|
||||
syn region javaScriptParen transparent start="(" end=")" contains=javaScriptParen,javaScriptComment,javaScriptSpecial,javaScriptStringD,javaScriptStringS,javaScriptSpecialCharacter,javaScriptNumber,javaScriptRegexpString,javaScriptBoolean,javaScriptBraces,javaScriptFunction,javaScriptFunctionFold,javaScriptConditional,javaScriptRepeat,javaScriptBranch,javaScriptOperator,javaScriptType,javaScriptStatement,javaScriptBoolean,javaScriptConstant
|
||||
" syn region javaScriptParen transparent start="(" end=")" contains=javaScriptParen,javaScriptComment,javaScriptSpecial,javaScriptStringD,javaScriptStringS,javaScriptSpecialCharacter,javaScriptNumber,javaScriptRegexpString,javaScriptBoolean,javaScriptBraces
|
||||
syn match javaScrParenError ")"
|
||||
|
||||
if main_syntax == "javascript"
|
||||
syn sync ccomment javaScriptComment
|
||||
endif
|
||||
@@ -103,6 +114,18 @@ if version >= 508 || !exists("did_javascript_syn_inits")
|
||||
HiLink javaScriptNull Keyword
|
||||
HiLink javaScriptBoolean Boolean
|
||||
HiLink javaScriptRegexpString String
|
||||
|
||||
HiLink javaScriptIdentifier Identifier
|
||||
HiLink javaScriptLabel Label
|
||||
HiLink javaScriptException Exception
|
||||
HiLink javaScriptMessage Keyword
|
||||
HiLink javaScriptGlobal Keyword
|
||||
HiLink javaScriptMember Keyword
|
||||
HiLink javaScriptDeprecated Exception
|
||||
HiLink javaScriptReserved Keyword
|
||||
HiLink javaScriptDebug Debug
|
||||
HiLink javaScriptConstant Label
|
||||
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
|
Reference in New Issue
Block a user