xref: /vim-8.2.3635/runtime/syntax/jsp.vim (revision 00a927d6)
1" Vim syntax file
2" Language:	JSP (Java Server Pages)
3" Maintainer:	Rafael Garcia-Suarez <[email protected]>
4" URL:		http://rgarciasuarez.free.fr/vim/syntax/jsp.vim
5" Last change:	2004 Feb 02
6" Credits : Patch by Darren Greaves (recognizes <jsp:...> tags)
7"	    Patch by Thomas Kimpton (recognizes jspExpr inside HTML tags)
8
9" For version 5.x: Clear all syntax items
10" For version 6.x: Quit when a syntax file was already loaded
11if version < 600
12  syntax clear
13elseif exists("b:current_syntax")
14  finish
15endif
16
17if !exists("main_syntax")
18  let main_syntax = 'jsp'
19endif
20
21" Source HTML syntax
22if version < 600
23  source <sfile>:p:h/html.vim
24else
25  runtime! syntax/html.vim
26endif
27unlet b:current_syntax
28
29" Next syntax items are case-sensitive
30syn case match
31
32" Include Java syntax
33syn include @jspJava <sfile>:p:h/java.vim
34
35syn region jspScriptlet matchgroup=jspTag start=/<%/  keepend end=/%>/ contains=@jspJava
36syn region jspComment			  start=/<%--/	      end=/--%>/
37syn region jspDecl	matchgroup=jspTag start=/<%!/ keepend end=/%>/ contains=@jspJava
38syn region jspExpr	matchgroup=jspTag start=/<%=/ keepend end=/%>/ contains=@jspJava
39syn region jspDirective			  start=/<%@/	      end=/%>/ contains=htmlString,jspDirName,jspDirArg
40
41syn keyword jspDirName contained include page taglib
42syn keyword jspDirArg contained file uri prefix language extends import session buffer autoFlush
43syn keyword jspDirArg contained isThreadSafe info errorPage contentType isErrorPage
44syn region jspCommand			  start=/<jsp:/ start=/<\/jsp:/ keepend end=/>/ end=/\/>/ contains=htmlString,jspCommandName,jspCommandArg
45syn keyword jspCommandName contained include forward getProperty plugin setProperty useBean param params fallback
46syn keyword jspCommandArg contained id scope class type beanName page flush name value property
47syn keyword jspCommandArg contained code codebase name archive align height
48syn keyword jspCommandArg contained width hspace vspace jreversion nspluginurl iepluginurl
49
50" Redefine htmlTag so that it can contain jspExpr
51syn region htmlTag start=+<[^/%]+ end=+>+ contains=htmlTagN,htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster,jspExpr
52
53" Define the default highlighting.
54" For version 5.7 and earlier: only when not done already
55" For version 5.8 and later: only when an item doesn't have highlighting yet
56if version >= 508 || !exists("did_jsp_syn_inits")
57  if version < 508
58    let did_jsp_syn_inits = 1
59    command -nargs=+ HiLink hi link <args>
60  else
61    command -nargs=+ HiLink hi def link <args>
62  endif
63  " java.vim has redefined htmlComment highlighting
64  HiLink htmlComment	 Comment
65  HiLink htmlCommentPart Comment
66  " Be consistent with html highlight settings
67  HiLink jspComment	 htmlComment
68  HiLink jspTag		 htmlTag
69  HiLink jspDirective	 jspTag
70  HiLink jspDirName	 htmlTagName
71  HiLink jspDirArg	 htmlArg
72  HiLink jspCommand	 jspTag
73  HiLink jspCommandName  htmlTagName
74  HiLink jspCommandArg	 htmlArg
75  delcommand HiLink
76endif
77
78if main_syntax == 'jsp'
79  unlet main_syntax
80endif
81
82let b:current_syntax = "jsp"
83
84" vim: ts=8
85