Merge branch 'hack/autopaste'
[vim-kana.git] / runtime / syntax / wsml.vim
blob2a92a0d548c3d3ad160c5b685cb5060d303350bc
1 " Vim syntax file
2 " Language:     WSML
3 " Maintainer:   Thomas Haselwanter <thomas.haselwanter@deri.org>
4 " URL:          none
5 " Last Change:  2006 Apr 30
7 " Quit when a syntax file was already loaded
8 if version < 600
9   syntax clear
10 elseif exists("b:current_syntax")
11   finish
12 endif
14 " WSML
15 syn keyword wsmlHeader          wsmlVariant
16 syn keyword wsmlNamespace       namespace
17 syn keyword wsmlTopLevel        concept instance relationInstance ofType usesMediator usesService relation sharedVariables importsOntology
18 syn keyword wsmlOntology        hasValue memberOf ofType impliesType subConceptOf
19 syn keyword wsmlAxiom           axiom definedBy
20 syn keyword wsmlService         assumption effect postcondition precondition capability interface
21 syn keyword wsmlTopLevel        ooMediator wwMediator wgMediator ggMediator
22 syn keyword wsmlMediation       usesService source target
23 syn match wsmlDataTypes         "\( _string\| _decimal\| _integer\| _float\| _double\| _iri\| _sqname\| _boolean\| _duration\| _dateTime\| _time\| _date\| _gyearmonth\| _gyear\| _gmonthday\| _gday\| _gmonth\| _hexbinary\| _base64binary\)\((\S*)\)\?" contains=wsmlString,wsmlNumber,wsmlCharacter
24 syn keyword wsmlTopLevel        goal webService ontology
25 syn keyword wsmlKeywordsInsideLEs       true false memberOf hasValue subConceptOf ofType impliesType and or implies impliedBy equivalent neg naf forall exists
26 syn keyword wsmlNFP             nfp endnfp nonFunctionalProperties endNonFunctionalProperties
27 syn region wsmlNFPregion        start="nfp\|nonFunctionalProperties" end="endnfp\|endNonFunctionalProperties" contains=ALL
28 syn region wsmlNamespace        start="namespace" end="}" contains=wsmlIdentifier
29 syn match wsmlOperator          "!=\|:=:\|=<\|>=\|=\|+\|\*\|/\|<->\|->\|<-\|:-\|!-\|-\|<\|>"
30 syn match wsmlBrace             "(\|)\|\[\|\]\|{\|}"
31 syn match wsmlIdentifier        +_"\S*"+
32 syn match wsmlIdentifier        "_#\d*"
33 syn match wsmlSqName            "[0-9A-Za-z]\+#[0-9A-Za-z]\+"
34 syn match wsmlVariable          "?[0-9A-Za-z]\+"
36 " ASM-specific code
37 syn keyword wsmlBehavioral      choreography orchestration transitionRules
38 syn keyword wsmlChoreographyPri stateSignature in out shared static controlled 
39 syn keyword wsmlChoreographySec with do withGrounding forall endForall choose if then endIf
40 syn match wsmlChoreographyTer   "\(\s\|\_^\)\(add\|delete\|update\)\s*(.*)" contains=wsmlKeywordsInsideLEs,wsmlIdentifier,wsmlSqName,wsmlString,wsmlNumber,wsmlDataTypes,wsmlVariable
42 " Comments
43 syn keyword wsmlTodo             contained TODO
44 syn keyword wsmlFixMe            contained FIXME
45 if exists("wsml_comment_strings")
46   syn region  wsmlCommentString    contained start=+"+ end=+"+ end=+$+ end=+\*/+me=s-1,he=s-1 contains=wsmlSpecial,wsmlCommentStar,wsmlSpecialChar,@Spell
47   syn region  wsmlComment2String   contained start=+"+  end=+$\|"+  contains=wsmlSpecial,wsmlSpecialChar,@Spell
48   syn match   wsmlCommentCharacter contained "'\\[^']\{1,6\}'" contains=wsmlSpecialChar
49   syn match   wsmlCommentCharacter contained "'\\''" contains=wsmlSpecialChar
50   syn match   wsmlCommentCharacter contained "'[^\\]'"
51   syn cluster wsmlCommentSpecial add=wsmlCommentString,wsmlCommentCharacter,wsmlNumber
52   syn cluster wsmlCommentSpecial2 add=wsmlComment2String,wsmlCommentCharacter,wsmlNumber
53 endif
55 syn region  wsmlComment          start="/\*"  end="\*/" contains=@wsmlCommentSpecial,wsmlTodo,wsmlFixMe,@Spell
56 syn match   wsmlCommentStar      contained "^\s*\*[^/]"me=e-1
57 syn match   wsmlCommentStar      contained "^\s*\*$"
58 syn match   wsmlLineComment      "//.*" contains=@wsmlCommentSpecial2,wsmlTodo,@Spell
60 syn cluster wsmlTop add=wsmlComment,wsmlLineComment
62 "match the special comment /**/
63 syn match   wsmlComment          "/\*\*/"
65 " Strings
66 syn region  wsmlString          start=+"+ end=+"+ contains=wsmlSpecialChar,wsmlSpecialError,@Spell
67 syn match   wsmlCharacter        "'[^']*'" contains=javaSpecialChar,javaSpecialCharError
68 syn match   wsmlCharacter        "'\\''" contains=javaSpecialChar
69 syn match   wsmlCharacter        "'[^\\]'"
70 syn match   wsmlNumber           "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>"
71 syn match   wsmlNumber           "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\="
72 syn match   wsmlNumber           "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
73 syn match   wsmlNumber           "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>"
75 " unicode characters
76 syn match   wsmlSpecial "\\u\d\{4\}"
78 syn cluster wsmlTop add=wsmlString,wsmlCharacter,wsmlNumber,wsmlSpecial,wsmlStringError
80 " Define the default highlighting.
81 " " For version 5.7 and earlier: only when not done already
82 " " For version 5.8 and later: only when an item doesn't have highlighting yet
83  if version >= 508 || !exists("did_wsml_syn_inits")
84    if version < 508
85        let did_wsml_syn_inits = 1
86        command -nargs=+ HiLink hi link <args>
87    else
88        command -nargs=+ HiLink hi def link <args>
89    endif              
90    HiLink wsmlHeader                    TypeDef
91    HiLink wsmlNamespace                 TypeDef
92    HiLink wsmlOntology                  Statement
93    HiLink wsmlAxiom                     TypeDef
94    HiLink wsmlService                   TypeDef
95    HiLink wsmlNFP                       TypeDef
96    HiLink wsmlTopLevel                  TypeDef
97    HiLink wsmlMediation                 TypeDef 
98    HiLink wsmlBehavioral                TypeDef
99    HiLink wsmlChoreographyPri           TypeDef
100    HiLink wsmlChoreographySec           Operator
101    HiLink wsmlChoreographyTer           Special
102    HiLink wsmlString                    String
103    HiLink wsmlIdentifier                Normal 
104    HiLink wsmlSqName                     Normal
105    HiLink wsmlVariable                  Define
106    HiLink wsmlKeywordsInsideLEs         Operator
107    HiLink wsmlOperator                  Operator
108    HiLink wsmlBrace                     Operator
109    HiLink wsmlCharacter                 Character
110    HiLink wsmlNumber                    Number
111    HiLink wsmlDataTypes                 Special
112    HiLink wsmlComment                   Comment
113    HiLink wsmlDocComment                Comment
114    HiLink wsmlLineComment               Comment
115    HiLink wsmlTodo                      Todo
116    HiLink wsmlFixMe                     Error
117    HiLink wsmlCommentTitle              SpecialComment
118    HiLink wsmlCommentStar               wsmlComment
119  endif
121 delcommand HiLink
123 let b:current_syntax = "wsml"
124 let b:spell_options="contained"