Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: cd606fac3b
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 190 lines (148 sloc) 7.728 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
" Vim syntax file
" Language: Cobra
" Maintainer: Caleb Spare <cespare@gmail.com>
" Last Change: 05-19-2009
" Filenames: *.cobra
" Version: 0.1
"
" Based on the Dmitry Vasiliev's python syntax file
" <dima@hlabs.spb.ru>

if version < 600
  syntax clear
elseif exists("b:current_syntax")
  finish
endif

" Keywords
syn keyword cobraInclude use

syn keyword cobraKeyword namespace inherits implements extend
syn keyword cobraKeyword where must be callable adds cue invariant as
syn keyword cobraKeyword pro var const from has body test shared is of event
syn keyword cobraKeyword using return yield listen ignore this base to to?

syn keyword cobraStorageClass abstract extern fake internal new nonvirtual
syn keyword cobraStorageClass override partial public private protected virtual

syn keyword cobraType bool char int uint decimal float dynamic number passthrough
syn keyword cobraType vari out inout

syn keyword cobraConditional require ensure old implies
syn keyword cobraConditional if else post for

syn keyword cobraStatement assert branch on off expect
syn keyword cobraStatement break continue pass

syn keyword cobraDefn def sig class interface mixin enum struct nextgroup=cobraFunction skipwhite
syn match cobraFunction "[a-zA-Z_][a-zA-Z0-9_]*" display contained

syn keyword cobraRepeat do while

syn keyword cobraException try catch success finally throw raise
syn keyword cobraException except

syn keyword cobraOperator and or not any all in
syn keyword cobraOperator get set print stop trace ref

syn keyword cobraBoolean true false
syn keyword cobraConstant nil


" Comments
syn match cobraComment "#.*$" display contains=cobraTodo,@Spell
syn match cobraRun "\%^#!.*$"
syn match cobraCoding "\%^.*\(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$"
syn keyword cobraTodo TODO FIXME XXX contained

" Errors
syn match cobraError "\<\d\+\D\+\>" display
syn match cobraError "$" display
syn match cobraError "[&|]\{2,}" display
syn match cobraError "[=]\{3,}" display

" Strings
syn region cobraString start=+[bB]\='+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=cobraEscape,cobraEscapeError,@Spell
syn region cobraString start=+[bB]\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=cobraEscape,cobraEscapeError,@Spell
syn region cobraString start=+[bB]\="""+ end=+"""+ keepend contains=cobraEscape,cobraEscapeError,cobraDocTest2,cobraSpaceError,@Spell
syn region cobraString start=+[bB]\='''+ end=+'''+ keepend contains=cobraEscape,cobraEscapeError,cobraDocTest,cobraSpaceError,@Spell

syn match cobraEscape +\\[abfnrtv'"\\]+ display contained
syn match cobraEscape "\\\o\o\=\o\=" display contained
syn match cobraEscapeError "\\\o\{,2}[89]" display contained
syn match cobraEscape "\\x\x\{2}" display contained
syn match cobraEscapeError "\\x\x\=\X" display contained
syn match cobraEscape "\\$"

" Unicode strings
syn region cobraUniString start=+[uU]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=cobraEscape,cobraUniEscape,cobraEscapeError,cobraUniEscapeError,@Spell
syn region cobraUniString start=+[uU]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=cobraEscape,cobraUniEscape,cobraEscapeError,cobraUniEscapeError,@Spell
syn region cobraUniString start=+[uU]"""+ end=+"""+ keepend contains=cobraEscape,cobraUniEscape,cobraEscapeError,cobraUniEscapeError,cobraDocTest2,cobraSpaceError,@Spell
syn region cobraUniString start=+[uU]'''+ end=+'''+ keepend contains=cobraEscape,cobraUniEscape,cobraEscapeError,cobraUniEscapeError,cobraDocTest,cobraSpaceError,@Spell

syn match cobraUniEscape "\\u\x\{4}" display contained
syn match cobraUniEscapeError "\\u\x\{,3}\X" display contained
syn match cobraUniEscape "\\U\x\{8}" display contained
syn match cobraUniEscapeError "\\U\x\{,7}\X" display contained
syn match cobraUniEscape "\\N{[A-Z ]\+}" display contained
syn match cobraUniEscapeError "\\N{[^A-Z ]\+}" display contained

" Raw strings
syn region cobraRawString start=+[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=cobraRawEscape,@Spell
syn region cobraRawString start=+[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=cobraRawEscape,@Spell
syn region cobraRawString start=+[rR]"""+ end=+"""+ keepend contains=cobraDocTest2,cobraSpaceError,@Spell
syn region cobraRawString start=+[rR]'''+ end=+'''+ keepend contains=cobraDocTest,cobraSpaceError,@Spell

syn match cobraRawEscape +\\['"]+ display transparent contained

" Unicode raw strings
syn region cobraUniRawString start=+[uU][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=cobraRawEscape,cobraUniRawEscape,cobraUniRawEscapeError,@Spell
syn region cobraUniRawString start=+[uU][rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=cobraRawEscape,cobraUniRawEscape,cobraUniRawEscapeError,@Spell
syn region cobraUniRawString start=+[uU][rR]"""+ end=+"""+ keepend contains=cobraUniRawEscape,cobraUniRawEscapeError,cobraDocTest2,cobraSpaceError,@Spell
syn region cobraUniRawString start=+[uU][rR]'''+ end=+'''+ keepend contains=cobraUniRawEscape,cobraUniRawEscapeError,cobraDocTest,cobraSpaceError,@Spell

syn match cobraUniRawEscape "\([^\\]\(\\\\\)*\)\@<=\\u\x\{4}" display contained
syn match cobraUniRawEscapeError "\([^\\]\(\\\\\)*\)\@<=\\u\x\{,3}\X" display contained

" Numbers (ints, longs, floats, complex)
syn match cobraHexError "\<0[xX]\x*[g-zG-Z]\x*[lL]\=\>" display

syn match cobraHexNumber "\<0[xX]\x\+[lL]\=\>" display
syn match cobraOctNumber "\<0[oO]\o\+[lL]\=\>" display
syn match cobraBinNumber "\<0[bB][01]\+[lL]\=\>" display

syn match cobraNumber "\<\d\+[lLjJ]\=\>" display

syn match cobraFloat "\.\d\+\([eE][+-]\=\d\+\)\=[jJ]\=\>" display
syn match cobraFloat "\<\d\+[eE][+-]\=\d\+[jJ]\=\>" display
syn match cobraFloat "\<\d\+\.\d*\([eE][+-]\=\d\+\)\=[jJ]\=" display

syn match cobraOctError "\<0[oO]\=\o*[8-9]\d*[lL]\=\>" display
syn match cobraBinError "\<0[bB][01]*[2-9]\d*[lL]\=\>" display

if version >= 508 || !exists("did_cobra_syn_inits")
  if version <= 508
    let did_cobra_syn_inits = 1
    command -nargs=+ HiLink hi link <args>
  else
    command -nargs=+ HiLink hi def link <args>
  endif

  HiLink cobraInclude Include
  HiLink cobraKeyword Keyword
  HiLink cobraStorageClass StorageClass
  HiLink cobraType Type
  HiLink cobraConditional Conditional
  HiLink cobraDefn Keyword
  HiLink cobraFunction Function
  HiLink cobraRepeat Repeat
  HiLink cobraException Exception
  HiLink cobraOperator Operator
  HiLink cobraBoolean Boolean
  HiLink cobraConstant Constant

  HiLink cobraComment Comment
  HiLink cobraCoding Special
  HiLink cobraRun Special
  HiLink cobraTodo Todo

  HiLink cobraError Error
  HiLink cobraIndentError Error
  HiLink cobraSpaceError Error

  HiLink cobraString String
  HiLink cobraUniString String
  HiLink cobraRawString String
  HiLink cobraUniRawString String

  HiLink cobraEscape Special
  HiLink cobraEscapeError Error
  HiLink cobraUniEscape Special
  HiLink cobraUniEscapeError Error
  HiLink cobraUniRawEscape Special
  HiLink cobraUniRawEscapeError Error

  HiLink cobraStrFormatting Special
  HiLink cobraStrFormat Special
  HiLink cobraStrTemplate Special

  HiLink cobraDocTest Special
  HiLink cobraDocTest2 Special

  HiLink cobraNumber Number
  HiLink cobraHexNumber Number
  HiLink cobraOctNumber Number
  HiLink cobraBinNumber Number
  HiLink cobraFloat Float
  HiLink cobraOctError Error
  HiLink cobraHexError Error
  HiLink cobraBinError Error

  HiLink cobraBuiltinObj Structure
  HiLink cobraBuiltinFunc Function

  HiLink cobraExClass Structure

  delcommand HiLink
endif

let b:current_syntax = "cobra"
Something went wrong with that request. Please try again.