summaryrefslogtreecommitdiffstats
path: root/.vim/syntax/fortress.vim
blob: 13aacbb921f06fa86e4249bcd8d29a8029116232 (plain)
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
" Vim syntax file
" Language:     Fortress
" Filenames:    *.fsi *.fss
" Maintainers:  Jon Rafkind <rafkind@cs.utah.edu>
" URL:          http://www.cs.utah.edu/~rafkind
" Last Change:  2008 May 20 - Initial version

" Some stuff stolen from ocaml.vim

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

" syn region   fortressComment start="(\*)" end="\\$" end="$"
syn region   fortressComment start="(\*" end="\*)" contains=fortressComment
syn match    fortressLineComment "(\*).*"
syn match    fortressEnd    "\<end\>"

" syn match    fortressKeyword "\<getter\>"
syn keyword  fortressKeyword getter else var test
syn keyword  fortressExternal import export

syn region   fortressString       start=+"+ skip=+\\\\\|\\"+ end=+"+
syn match    fortressChar         "'.'"
syn match    fortressNumber       "\<-\=\d\(_\|\d\)*"

syn keyword  fortressType  api object trait value
syn keyword  fortressType  extends abstract comprises
syn keyword  fortressType  grammar component
syn keyword  fortressType  Any Boolean String self
syn keyword  fortressType  Char
syn keyword  fortressType  ZZ32 ZZ64 RR32 RR64 ZZ

syn keyword  fortressOperator println

syn keyword  fortressKeyword opr for private asif throw

syn match    fortressThenErr    "\<then\>"
syn match    fortressCaseErr    "\<case\>"
syn match    fortressCatchErr    "\<catch\>"
syn match    fortressTypecaseErr    "\<of\>"

syn region   fortressNone matchgroup=fortressKeyword start="\<if\>" matchgroup=fortressKeyword end="\<then\>" contains=ALLBUT,fortressThenErr nextgroup=fortressIf
syn region   fortressIf matchgroup=fortressKeyword start="\<elif\>" matchgroup=fortressKeyword end="\<then\>" contains=ALLBUT,fortressThenErr nextgroup=fortressIf
syn region   fortressIf matchgroup=fortressKeyword start="\<then\>" matchgroup=fortressKeyword end="\<end\>" contains=ALLBUT,fortressThenErr

syn region   fortressNone matchgroup=fortressKeyword start="\<case\>" matchgroup=fortressKeyword end="\<of\>" contains=ALLBUT,fortressCaseErr nextgroup=fortressCase
syn region   fortressCase matchgroup=fortressKeyword start="\<in\>" matchgroup=fortressKeyword end="\<end\>" contains=ALLBUT,fortressCaseErr

syn region   fortressNone matchgroup=fortressKeyword start="\<typecase\>" matchgroup=fortressKeyword end="\<of\>" contains=ALLBUT,fortressTypecaseErr nextgroup=fortressTypecase
syn region   fortressTypecase matchgroup=fortressKeyword start="\<of\>" matchgroup=fortressKeyword end="\<end\>" contains=ALLBUT,fortressEndErr

syn region   fortressNone matchgroup=fortressKeyword start="\<try\>" matchgroup=fortressKeyword end="\<catch\>" contains=ALLBUT,fortressCatchErr nextgroup=fortressCatch
syn region   fortressCatch matchgroup=fortressKeyword start="\<catch\>" matchgroup=fortressKeyword end="\<end\>" contains=ALLBUT,fortressEndErr

syn region   fortressNone matchgroup=fortressKeyword start="\<do\>" matchgroup=fortressKeyword end="\<end\>" contains=ALLBUT,fortressEndErr

syn region   fortressApi matchgroup=fortressModule start="\<api\>" matchgroup=fortressModule end="\<end\>" contains=ALLBUT,fortressEndErr
syn region   fortressObject matchgroup=fortressModule start="\<object\>" matchgroup=fortressModule end="\<end\>" contains=ALLBUT,fortressEndErr
syn region   fortressTrait matchgroup=fortressModule start="\<trait\>" matchgroup=fortressModule end="\<end\>" contains=ALLBUT,fortressEndErr
syn region   fortressComponent matchgroup=fortressModule start="\<component\>" matchgroup=fortressModule end="\<end\>" contains=ALLBUT,fortressEndErr

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

  HiLink fortressComment	   Comment
  HiLink fortressLineComment	   Comment
  HiLink fortressKeyword	   Keyword
  HiLink fortressExternal          Include
  HiLink fortressType		   Type
  HiLink fortressOperator	   Operator
  HiLink fortressEnd               Statement

  HiLink fortressString	           String
  HiLink fortressChar	           String
  HiLink fortressNumber	           Number
  
  HiLink fortressThenErr	   Error

  delcommand HiLink
endif

let b:current_syntax = "fortress"