Commits

Lee S. committed 0afe9d7

Added alot of code; thank god, it's almost done.

Comments (0)

Files changed (1)

src/syntax/abc.vim

 " Language: abc music notation
 " Maintainer: Lee Savide <laughingman182@yahoo.com>
 " License: http://apache.org/licenses/LICENSE-2.0.txt
+" GetLatestVimScripts: 4100 ### abc-vim.vmb
+
 
 if version < 600
     syntax clear
     finish
 endif
 
+" Keywords in abc files can include all printable ASCII
+set iskeyword="@,33-64,91-96,123-126,128-174"
+
 syn include @PS <sfile>:p:h/postscr.vim
 
 syn case ignore
 syn case match
 
 syn region abcFreeText excludenl start='^\s*$' skip='\%(\)\@<!' excludenl end='^\s*$' transparent
-
+" Directives {{{
 syn keyword abcDirectiveKeyword contained abc2pscompat alignbars aligncomposer
             \ annotationfont autoclef barnumbers barsperstaff breakoneoln
             \ bgcolor botmargin bstemdown cancelkey comball combinevoices
             \ start='%%begintext\s\+\%(obeylines\|align\|justify\|ragged\|fill\|center\|skip\|right\)\='
             \ end='%%endtext'
 syn match abcTypeSet excludenl '%%endtext'
-syn match abcTypeSetBegin excludenl '%%begin' contained
-syn match abcTypeSetEnd '%%end' contained
 syn region abcTypeSet matchgroup=abcTypeSetBegin start='%%begintext' skip='^\%(%%\)\=.*' matchgroup=abcTypeSetEnd end='%%endtext'
-syn match abcTypeSetKeyword contained
-            \ '%%\%(begintext\|endtext\|beginps\|endps\|beginsvg\|endsvg\)'
+syn match abcTypeSetKeyword contained '%%\%(begintext\|endtext\|beginps\|endps\|beginsvg\|endsvg\)'
 
-syn match abcDirectiveArgument excludenl '[^%]*$' contained
-syn match abcDirectiveStatement '%%\K\k* ' nextgroup=abcDirectiveArgument skipwhite
-
+syn match abcDirectiveDefine excludenl '[^%]*$' contained
+syn match abcDirectivePreProc '%%\I\i* ' nextgroup=abcDirectiveDefine skipwhite
+" }}}
+" Fields {{{
 syn match abcField '^\a:[^%]*' nextgroup=abcFieldContinue skipnl skipwhite
-syn match abcFieldError '\%(^X:[^%]*\)\{2,}'
+syn region abcField start='\[\a:' skip='[^%\]]*' end='\]' contained oneline
+" May be changed to make multiline field
+syn match abcFieldError '\%(^X:.*$\)\{2,}'
 syn match abcFieldContinue '^+:[^%]*'
-
-" Body {{{
+" }}}
+" Tune Body {{{
 syn match abcKeyIdentifier '[A-G][b#]\=' contained nextgroup=abcMode,abcExplicit skipwhite
 syn region abcKeyExplicit start='\%(exp\)\=\( [_=^][a-g]\)*' contained
 
 syn match abcRest 'z' contained nextgroup=abcNoteLength
 syn match abcRest 'Z\%([1-9]*\d*\)\=' contained
+
+
+syn region abcGrace start='{\/' end='}' contained nextgroup=abc
 syn match abcNote '[A-Ga-g][_=^]\{,2}' contained nextgroup=abcOctave
 syn match abcOctave +[,']*+ contained nextgroup=abcNoteLength
 syn match abcNoteLength '*[1-9]*\d*/[248]\=' contained
 syn match abcTie +- \=+ contained
-syn match abcSlur '(\|)' contained
+
+syn match abcOperator '[<>()\[\]]*' contained
+syn region abcSlur start='(' end=')' keepend contained
+syn region abcChord start='\[' end='\]' keepend contained oneline
+syn match abcTuplet '([1-9]\%(:[1-9]\)\{,2}' contained
 
 syn match abcBar '|\|\]\|\['  contained
 syn match abcRepeat '[:|][:|]' contained
 syn match abcRepeat '|[1-9]\%([,-][1-9]\d*\)\=' contained
 syn match abcRepeat '\[[1-9]\%([,-][1-9]\d*\)\=' contained
 
-
-
-
-
-
+syn match abcStringCharacter +"+
+syn keyword abcChordStringType contained m[in] maj dim aug sus
+syn match abcChordStringType '\%([1-9]\d*\)\|+' contained
+syn region abcChordString matchgroup=abcStringCharacter start=+"[A-G][b#]\=+ end=+"+ contains=abcChordString.* contained
 
 
 " }}}
-" TopLevel {{{
+" Top level {{{
+syn match abcSpecialCharacter '\\u00[aA]9' conceal cchar=©
+syn match abcSpecialCharacter '\\u266[dD]' conceal cchar=♭
+syn match abcSpecialCharacter '\\u266[eE]' conceal cchar=♮
+syn match abcSpecialCharacter '\\u266[fF]' conceal cchar=♯
 syn match abcSpecialComment '^%abc\%(-[1-9]\.\d\)\='
+
 syn region abcFileHeader start='\%(^[\a+]:\)' excludenl end='\^s*$' contained contains=abcComment
 syn region abcTuneHeader start='\%(^X:.*\)\{1}\%(^T:.*\)*' end='^K:'
-" Negative lookbehind is fine, since it looks for lines that aren't empty
+" Negative look-behind is fine, since it looks for lines that aren't empty
+syn region abcPart matchgroup=abcPartIdentifier start='^P:' end='\%(^\s*$\)\|\%(^P:[^%]*$\)' keepend fold
+syn region abcPart matchgroup=abcPartIdentifier start='\[P:[^%\]]*\]' excludenl end='\%(^\s*$\)\|\[P:' keepend fold
+syn region abcVoice matchgroup=abcVoiceIdentifier start='^V:'
+            \ matchgroup=NONE excludenl end='\%(^V:\)\|\%(^P:\)\|\%(^\s*$\)' keepend fold
+syn region abcVoice matchgroup=abcVoiceIdentifier start='\[V:[^%\]]*\]'
+            \ matchgroup=abcField end='\%(\[V:\)\|\%(\[P:\)' excludenl end='^\s*$' keepend fold
 syn match abcComment excludenl '%\{1}.*$'
-syn match abcPreProc '%%\K\k*' contains=abcDirectiveKeyword
-
 " }}}
 " Syncing {{{
+syn sync ccomment abcComment
 syn sync linecont '\\$'
-syn sync match abcSlurSync grouphere abcSlur '([^\d]*'
-syn sync match abcSlurSync groupthere abcSlur ')'
-syn sync match abcTuneHeaderSync grouphere abcKeyField '^X:'
-syn sync match abcTypeSetSync grouphere abcTypeSetBegin '%%end'
-syn sync match abcTypeSetSync groupthere abcTypeSetEnd '%%begin'
-syn sync match abcFileHeaderSync groupthere abcSpecialComment '\%(^\s*$\)\@<!'
+
+syn sync match abcFieldBeginSync '^\a:'
+syn sync match abcFieldContinueSync '+:' extend
+syn sync match abcFieldSync groupthere abcFieldBeginSync '^+:'
+syn sync region abcFieldRegionSync start='^\a:' excludenl end='$' keepend oneline
+syn sync region abcFieldRegionSync start='\[\a:' end='\]' keepend oneline
+syn sync match abcFieldBeginSync '\[\a:'
+syn sync match abcFieldSync groupthere abcFieldBeginSync '\]'
+
+syn sync region abcTypeSetSync start='%%begin' end='%%end'
+syn sync match abcTypeSetBegin '%%begin'
+syn sync match abcTypeSetEnd '%%end'
+syn sync match abcTypeSetSync grouphere abcTypeSetEnd '%%begin'
+syn sync match abcTypeSetSync groupthere abcTypeSetBegin '%%end'
+
+syn sync match abcSlurEndSync ')'
+syn sync match abcSlurBeginSync '('
+syn sync match abcSlurSync grouphere abcSlurEndSync '([^\d]*'
+syn sync match abcSlurSync groupthere abcSlurBeginSync ')'
+
+syn sync match abcTupletSync groupthere abcSlurBeginSync '[1-9]\%(:[1-9]\)\{,2}'
+
+syn sync match abcChordBeginSync '\['
+syn sync match abcChordEndSync '\]'
+syn sync match abcChordGroupSync grouphere abcChordEndSync '\['
+syn sync match abcChordGroupSync groupthere abcChordBeginSync '\]'
+
+syn sync region abcHeaderRegionSync start='^X:' end='^K:' keepend
+syn sync match abcHeaderSync grouphere abcHeaderRegionSync '^X:'
+
+syn sync region abcBodyRegionSync start='^K:' excludenl end='^\s*$' keepend
+syn sync match abcBodySync grouphere abcBodyRegionSync '\%(^\s*$\)\@<!'
+
+syn sync region abcPartBodySync start='^P:' excludenl end='^P:\|\%(^\s*$\)'
+syn sync region abcPartBodySync start='\[P:' excludenl end='\[P:\|\%(^\s*$\)'
+syn sync match abcPartSync grouphere abcPartBody '^P:\|\[P:\|\%(^\s*$\)'
+
+syn sync region abcVoiceIdentifierSync start='^V:' excludenl end='^V:\|^P:\|\%(^\s*$\)'
+syn sync region abcVoiceIdentifierSync start='\[V:' excludenl end='\[V:\|\[P:\|\%(^\s*$\)'
+syn sync match abcVoiceSync grouphere abcVoiceIdentifierSync '\%(^V:\)\|\%(\[V:\)'
+
+syn sync region abcSpecialCommentSync start='^%abc\%(-[1-9]\.\d\)\=' excludenl end='^\s*$'
+syn sync match abcFileHeaderSync groupthere abcSpecialCommentSync '\%(^\s*$\)\@<!'
 " }}}
 
 " Highlighting {{{
 if version >= 508 || !exists('did_abc_syn_inits')
-  if version < 508
-    let did_abc_syn_inits = 1
-    command -nargs=+ HiLink hi link <args>
-  else
-    command -nargs=+ HiLink hi def link <args>
-  endif
+    if version < 508
+        let did_abc_syn_inits = 1
+        command -nargs=+ HiLink hi link <args>
+    else
+        command -nargs=+ HiLink hi def link <args>
+    endif
 
-  HiLink abcComment           Comment
-  HiLink abcInteger           Integer
-  HiLink abcFloat             Float
-  HiLink abcHeaderField       Type
-  HiLink abcBodyField         Type
-  HiLink abcBar               Operator
-  HiLink abcTuple             Operator
-  HiLink abcBroken            Operator
-  HiLink abcTie               Operator
-  HiLink abcChord             Operator
-  HiLink abcNote              Statement
+    "hi 
 
-  delcommand HiLink
+    HiLink abcComment           Comment
+    HiLink abcInteger           Integer
+    HiLink abcFloat             Float
+    HiLink abcHeaderField       Type
+    HiLink abcBodyField         Type
+    HiLink abcBar               Operator
+    HiLink abcTuple             Operator
+    HiLink abcBroken            Operator
+    HiLink abcTie               Operator
+    HiLink abcChord             Operator
+    HiLink abcNote              Statement
+
+    delcommand HiLink
 endif " }}}
 
 let b:current_syntax = 'abc'
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.