1" Vim syntax file
2" Language:     WSML
3" Maintainer:   Thomas Haselwanter <thomas.haselwanter@deri.org>
4" URL:		none
5" Last Change:  2006 Apr 30
6
7" Quit when a syntax file was already loaded
8if version < 600
9  syntax clear
10elseif exists("b:current_syntax")
11  finish
12endif
13
14" WSML
15syn keyword wsmlHeader		wsmlVariant
16syn keyword wsmlNamespace	namespace
17syn keyword wsmlTopLevel	concept instance relationInstance ofType usesMediator usesService relation sharedVariables importsOntology
18syn keyword wsmlOntology	hasValue memberOf ofType impliesType subConceptOf
19syn keyword wsmlAxiom		axiom definedBy
20syn keyword wsmlService		assumption effect postcondition precondition capability interface
21syn keyword wsmlTopLevel	ooMediator wwMediator wgMediator ggMediator
22syn keyword wsmlMediation	usesService source target
23syn 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
24syn keyword wsmlTopLevel	goal webService ontology
25syn keyword wsmlKeywordsInsideLEs	true false memberOf hasValue subConceptOf ofType impliesType and or implies impliedBy equivalent neg naf forall exists
26syn keyword wsmlNFP		nfp endnfp nonFunctionalProperties endNonFunctionalProperties
27syn region wsmlNFPregion	start="nfp\|nonFunctionalProperties" end="endnfp\|endNonFunctionalProperties" contains=ALL
28syn region wsmlNamespace	start="namespace" end="}" contains=wsmlIdentifier
29syn match wsmlOperator		"!=\|:=:\|=<\|>=\|=\|+\|\*\|/\|<->\|->\|<-\|:-\|!-\|-\|<\|>"
30syn match wsmlBrace		"(\|)\|\[\|\]\|{\|}"
31syn match wsmlIdentifier	+_"\S*"+
32syn match wsmlIdentifier	"_#\d*"
33syn match wsmlSqName		"[0-9A-Za-z]\+#[0-9A-Za-z]\+"
34syn match wsmlVariable		"?[0-9A-Za-z]\+"
35
36" ASM-specific code
37syn keyword wsmlBehavioral	choreography orchestration transitionRules
38syn keyword wsmlChoreographyPri	stateSignature in out shared static controlled 
39syn keyword wsmlChoreographySec with do withGrounding forall endForall choose if then endIf
40syn match wsmlChoreographyTer   "\(\s\|\_^\)\(add\|delete\|update\)\s*(.*)" contains=wsmlKeywordsInsideLEs,wsmlIdentifier,wsmlSqName,wsmlString,wsmlNumber,wsmlDataTypes,wsmlVariable
41
42" Comments
43syn keyword wsmlTodo		 contained TODO
44syn keyword wsmlFixMe		 contained FIXME
45if 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
53endif
54
55syn region  wsmlComment		 start="/\*"  end="\*/" contains=@wsmlCommentSpecial,wsmlTodo,wsmlFixMe,@Spell
56syn match   wsmlCommentStar      contained "^\s*\*[^/]"me=e-1
57syn match   wsmlCommentStar      contained "^\s*\*$"
58syn match   wsmlLineComment      "//.*" contains=@wsmlCommentSpecial2,wsmlTodo,@Spell
59
60syn cluster wsmlTop add=wsmlComment,wsmlLineComment
61
62"match the special comment /**/
63syn match   wsmlComment		 "/\*\*/"
64
65" Strings
66syn region  wsmlString		start=+"+ end=+"+ contains=wsmlSpecialChar,wsmlSpecialError,@Spell
67syn match   wsmlCharacter	 "'[^']*'" contains=javaSpecialChar,javaSpecialCharError
68syn match   wsmlCharacter	 "'\\''" contains=javaSpecialChar
69syn match   wsmlCharacter	 "'[^\\]'"
70syn match   wsmlNumber		 "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>"
71syn match   wsmlNumber		 "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\="
72syn match   wsmlNumber		 "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
73syn match   wsmlNumber		 "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>"
74
75" unicode characters
76syn match   wsmlSpecial "\\u\d\{4\}"
77
78syn cluster wsmlTop add=wsmlString,wsmlCharacter,wsmlNumber,wsmlSpecial,wsmlStringError
79
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
120
121delcommand HiLink
122
123let b:current_syntax = "wsml"
124let b:spell_options="contained"
125
126