3 " Maintainer: Heikki Junes <hjunes@cc.hut.fi>
4 " Created: Oct 17, 2002
5 " Last Change: Nov 13, 2002
8 " http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lilypond.vim
10 " For version 5.x: Clear all syntax items
11 " For version 6.x: Quit when a syntax file was already loaded
14 elseif exists("b:current_syntax")
18 " Match also parethesis of angle type
21 syn cluster lilyMatchGroup contains=lilyMatcher,lilyString,lilyComment,lilyStatement,lilyNote,lilyNumber,lilyEquation,lilySlur,lilySpecial
23 syn region lilyMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{<>}]" end="}" contains=@lilyMatchGroup fold
24 syn region lilyMatcher matchgroup=Delimiter start="\[" end="]" contains=@lilyMatchGroup fold
25 syn region lilyMatcher matchgroup=Delimiter start="<" skip="\\\\\|\\[{<>}]" end=">" contains=@lilyMatchGroup fold
27 syn region lilyString start=/"/ end=/"/ skip=/\\"/
28 syn region lilyComment start="%{" skip="%$" end="%}"
29 syn region lilyComment start="%\([^{]\|$\)" end="$"
31 syn match lilyStatement "[-_^]\?\\\a\+"
32 syn match lilyNote "\<\(\(\(bb\|as[ae]s\|[ae]s\|eses\|[a-h]\(\|is\|isis\|es\|eses\)\)\([,']\)\{,4}\([?!]\)\?\|[srR]\)\(\(128\|6\?4\|3\?2\|16\?\|8\|\\breve\|\\longa\)[.]*\)\?\)\(\A\|\n\)"me=e-1
33 syn match lilyNote "\<\(\(\(bb\|as[ae]s\|[ae]s\|eses\|[a-h]\(\|is\|isis\|es\|eses\)\)\([,']\)\{,4}\([?!]\)\?\|[srR]\)\(\(128\|6\?4\|3\?2\|16\?\|8\|\\breve\|\\longa\)[.]*\)\?\)$"
34 syn match lilyNumber "[-_^.]\?\d\+[.]\?"
35 syn match lilyEquation "\(#['`]\)\?\(\a*[-]\)*\a*\s*=\s*\(#[#'`]\?\)\?\a*"
36 syn match lilySlur "[(~)]"
37 syn match lilySlur "\\[()]"
38 syn match lilySpecial "\\[<!>\\]"
40 " Rest of syntax highlighting rules start here
42 " " Define the default highlighting.
43 " " For version 5.7 and earlier: only when not done already
44 " " For version 5.8 and later: only when an item doesn't have highlighting yet
45 if version >= 508 || !exists("did_lily_syn_inits")
47 let did_lily_syn_inits = 1
48 command -nargs=+ HiLink hi link <args>
50 command -nargs=+ HiLink hi def link <args>
53 HiLink Delimiter Identifier
55 HiLink lilyString String
56 HiLink lilyComment Comment
58 HiLink lilyNote Identifier
59 HiLink lilyNumber Constant
60 HiLink lilyStatement Statement
61 HiLink lilySpecial Special
62 HiLink lilySlur ModeMsg