(125 lines)
1 " Language: Nomsu2 " Maintainer: Bruce Hill <bruce@bruce-hill.com>3 " License: WTFPL5 " Bail if our syntax is already loaded.6 if exists('b:current_syntax') && b:current_syntax == 'nomsu'7 finish8 endif10 " Highlight long strings.11 syn sync minlines=10013 "hi def link nomsuInterpDelim PreProc14 hi nomsuInterpDelim ctermfg=Gray15 syn region nomsuLineComment start=;//; end=/$/16 hi nomsuLineComment ctermfg=DarkBlue17 hi def link nomsuLineComment Comment19 syn region nomsuList start=/\[/ end=/\]/ contains=@nomsuAll20 hi nomsuList ctermfg=Blue22 syn region nomsuDict start=/{/ end=/}/ contains=@nomsuAll23 hi nomsuDict ctermfg=Green25 syn region nomsuParenGroup start=/(/ end=/)/ contains=@nomsuAll26 hi nomsuParenGroup ctermfg=Yellow28 syn match nomsuTextBackslash /\\\%(\\\|;\)\@=/ nextgroup=nomsuTextEscapedBackslash contained29 hi nomsuTextBackslash ctermfg=Gray30 syn match nomsuTextEscapedChar /\%(\\\)\@<=\%(\x\{1,3}\|x\x\{1,2}\|.\)/ contained31 hi nomsuTextEscapedChar cterm=bold ctermfg=Blue32 syn match nomsuTextEscapedBackslash /./ contained33 hi nomsuTextEscapedBackslash cterm=bold ctermfg=Blue34 syn match nomsuTextEscape /\\\%(\x\{1,3}\|x\x\{1,2}\|.\)/ contains=nomsuTextEscapedChar contained35 hi nomsuTextEscape ctermfg=Gray36 syn match nomsuInterp /\\\%([[{($:]\)\@=/37 \ nextgroup=nomsuActionVar,nomsuVar,nomsuList,nomsuDict,nomsuParenGroup,nomsuIndentedInterpBlock contained38 hi nomsuInterp ctermfg=Gray39 syn region nomsuInterpDotDot matchgroup=nomsuInterpDelim start=/\\\s*$/ end=/\.\./ contained40 hi nomsuInterpDotDot ctermfg=Gray41 syn region nomsuIndentedText matchgroup=nomsuTextQuotes start=/\%(^\z(\(\s*\)\)[^\n]*\)\@<=("$/ end=/^\z1")/42 \ contains=nomsuInterp,nomsuInterpDotDot,nomsuTextBackslash43 hi def link nomsuIndentedText String44 hi nomsuTextQuotes ctermfg=DarkMagenta46 syn region nomsuText matchgroup=nomsuTextQuotes start=/\%((\)\@<!"\|"\%($\)\@!/ end=/"\|$/ contains=nomsuInterp,nomsuTextEscape47 hi def link nomsuText String49 syn region nomsuIndentedBlock start=/\%(^\z(\s*\)[^\n]*\)\@<=:\s*$/ end=/\n\%(\z1\s\)\@!\%(\s*\.\.\)\?/50 \ contains=@nomsuAll51 syn region nomsuIndentedInterpBlock matchgroup=nomsuColon start=/:\s*$/ end=/\n\s*\.\./ contained52 \ contains=@nomsuAll54 syn match nomsuVar /\$\%(\%([a-zA-Z0-9_-]\|[^\x00-\xff]\)\+\|(\@!\)/55 \ contains=nomsuDollarSign,nomsuVarParens56 hi nomsuVar ctermfg=Cyan57 hi def link nomsuVar Identifier59 syn region nomsuActionVar matchgroup=nomsuVar start=/\$(/ end=/)\|$/ contains=nomsuVarWord,nomsuVarOpWord,@nomsuAll61 syn match nomsuDollarSign /\$/ contained62 hi nomsuDollarSign ctermfg=Cyan64 syn match nomsuVarParens /[()]/ contained65 hi nomsuVarParens ctermfg=LightCyan67 syn match nomsuWord /\%([a-zA-Z_]\|[^\x00-\xff]\)\%([a-zA-Z0-9_]\|[^\x00-\xff]\)*/68 hi def link nomsuWord Function69 hi nomsuWord ctermfg=White70 syn match nomsuOpWord ;\(\(//\)\@![`~!|%#@^&*_+=<>?'/-]\)\+\|\%(^\s*\)\@<!#;71 hi def link nomsuOpWord Function72 hi nomsuOpWord ctermfg=LightYellow74 syn match nomsuVarWord /\%([a-zA-Z_]\|[^\x00-\xff]\)\%([a-zA-Z0-9_]\|[^\x00-\xff]\)*/ contained75 hi def link nomsuVarWord Function76 hi nomsuVarWord ctermfg=LightCyan77 syn match nomsuVarOpWord ;\(\(//\)\@![`~!|%#@^&*_+=<>?'/-]\)\+\|\%(^\s*\)\@<!#; contained78 hi def link nomsuVarOpWord Function79 hi nomsuVarOpWord ctermfg=LightCyan81 syn match nomsuNumber /-\?\%(0x\x\+\|\d\+\%(\.\%(\d\+\)\?\)\?\|\.\d\+\)/82 hi def link nomsuNumber Number83 hi nomsuNumber ctermfg=Red85 syn match nomsuInt /-\?\%(0x\x\+\|\d\+\)/86 hi def link nomsuInt Number87 hi nomsuInt ctermfg=Red89 syn match nomsuTextWord /\%([a-zA-Z_]\|[^\x00-\xff]\)\%([a-zA-Z0-9_]\|[^\x00-\xff]\)*/ contained90 hi def link nomsuTextWord String92 syn match nomsuIndex /\./ nextgroup=nomsuTextWord,nomsuParenGroup,nomsuText,nomsuIndentedText,93 \nomsuVar,nomsuActionVar,nomsuInt,nomsuDict,nomsuList,nomsuIndentedBlock94 hi nomsuIndex ctermfg=Yellow96 syn match nomsuDotDot /\.\./97 hi def link nomsuDotDot Special98 hi nomsuDotDot ctermfg=DarkGray100 syn match nomsuComma /,/101 hi nomsuComma ctermfg=Blue102 hi def link nomsuComma Delimiter104 syn match nomsuColon /:/105 hi nomsuColon ctermfg=Yellow106 hi def link nomsuColon Delimiter108 syn match nomsuSemicolon /;/109 hi nomsuSemicolon ctermfg=Blue110 hi def link nomsuSemicolon Delimiter112 syn region nomsuComment start=/\%(^\z(\s*\)\)\@<=#/ skip=/\n\s*$/ end=/\n\%(\z1\s\)\@!/113 hi nomsuComment ctermfg=DarkBlue114 hi def link nomsuComment Comment116 syn cluster nomsuExpr contains=nomsuParenGroup,nomsuText,nomsuIndentedText,nomsuVar,117 \nomsuActionVar,nomsuNumber,nomsuDict,nomsuList,nomsuIndentedBlock119 syn cluster nomsuAll contains=nomsuParenGroup,nomsuText,nomsuIndentedText,nomsuComment,nomsuLineComment,120 \ nomsuVar,nomsuActionVar,nomsuNumber,nomsuDict,nomsuList,nomsuIndentedBlock,121 \ nomsuColon,nomsuSemicolon,nomsuDotDot,nomsuWord,nomsuOpWord,nomsuComma,nomsuIndex123 if !exists('b:current_syntax')124 let b:current_syntax = 'nomsu'125 endif