summaryrefslogtreecommitdiffstats
path: root/kate/data/modelica.xml
blob: e9f636b81ddbc731ad36a7de900a89ade69dbcd7 (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
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">
<!--
	====================================================================
	Modelica syntax highlighting file for the KDE editors Kate and Kwrite
	====================================================================
	Based on Modelica 3.0, available at the following link:
	http://www.modelica.org/documents/ModelicaSpec30.pdf

	License: LGPL v2 or later

	ChangeLog: Aug 21, 2008: first version committed.

	Author: Federico Zenith, Max Planck Institute for Complex Technical
	Systems, Magdeburg (Germany).
-->


<language name="Modelica" version="3.1" kateversion="2.0" casesensitive="1" section="Sources" extensions="*.mo" author="Federico Zenith" >

	<highlighting>
		<!-- Classes in Modelica can be called different names; "class" is the
		     most general one, others will limit its capabilities in some ways;
		     for instance, "record" can only contain data members, "connector"
		     does not allow equations, and so on. -->
		<list name="classTypes">
			<item> block </item>
			<item> class </item>
			<item> connector </item>
			<item> function </item>
			<item> model </item>
			<item> package </item>
			<item> record </item>
		</list>

		<list name="classType_type">
			<!-- NOTE this should actually be with the rest in classTypes, but
			     "type" shall not start an environment. -->
			<item> type </item>
		</list>

		<!-- The primitive data types already defined in Modelica. -->
		<list name="primitiveTypes">
			<item> Boolean </item>
			<item> enumeration </item>
			<item> ExternalObject </item>
			<item> Integer </item>
			<item> Real </item>
			<item> StateSelect </item>
			<item> String </item>
		</list>
		
		<!-- The attributes of data types defined in Modelica and those derived
		     from them. Not all primitive data types have all attributes. -->
		<list name="defaultAttributes">
			<item> display </item>
			<item> fixed </item>
			<item> max </item>
			<item> min </item>
			<item> nominal </item>
			<item> quantity </item>
			<item> start </item>
			<item> stateSelect </item>
			<item> unit </item>
			<item> value </item>
		</list>

		<!-- The keywords defined in the Modelica specification (for the 3.0
		     specification it is in section 2.3.3), minus the class types. -->
		<list name="keywords">
			<item> algorithm </item>
			<item> and </item>
			<item> annotation </item>
			<item> assert </item>
			<item> break </item>
			<item> connect </item>
			<item> constant </item>
			<item> constrainedby </item>
			<item> discrete </item>
			<item> else </item>
			<item> elseif </item>
			<item> elsewhen </item>
			<item> encapsulated </item>
			<item> end </item>
			<item> equation </item>
			<item> expandable </item>
			<item> extends </item>
			<item> external </item>
			<item> false </item>
			<item> final </item>
			<item> flow </item>
			<item> for </item>
			<item> if </item>
			<item> import </item>
			<item> in </item>
			<item> inner </item>
			<item> input </item>
			<item> loop </item>
			<item> not </item>
			<item> or </item>
			<item> outer </item>
			<item> output </item>
			<item> parameter </item>
			<item> partial </item>
			<item> protected </item>
			<item> public </item>
			<item> redeclare </item>
			<item> tqreplaceable </item>
			<item> return </item>
			<item> then </item>
			<item> true </item>
			<item> when </item>
			<item> while </item>
			<item> within </item>
		</list>
		
		<!-- The functions that are by default available in Modelica 3.0. -->
		<list name="functions">
			<!-- NOTE this is more like a built-in variable, but as it changes
			     its value during the simulation it is more like a function
			     without the (), and has therefore been placed here.-->
			<item> time </item>

			<item> abs </item>
			<item> ceil </item>
			<item> div </item>
			<item> floor </item>
			<item> integer </item>
			<item> mod </item>
			<item> rem </item>
			<item> sign </item>
			<item> sqrt </item>

			<item> sin </item>
			<item> cos </item>
			<item> tan </item>
			<item> asin </item>
			<item> acos </item>
			<item> atan </item>
			<item> atan2 </item>
			<item> sinh </item>
			<item> cosh </item>
			<item> tanh </item>
			<item> exp </item>
			<item> log </item>
			<item> log10 </item>

			<item> analysisType </item>
			<item> cardinality </item> <!-- NOTE deprecated in 3.0. -->
			<item> change </item>
			<item> delay </item>
			<item> der </item>
			<item> direction </item>
			<item> edge </item>
			<item> initial </item>
			<item> isPresent </item>
			<item> noEvent </item>
			<item> pre </item>
			<item> reinit </item>
			<item> sample </item>
			<item> semiLinear </item>
			<item> smooth </item>
			<item> terminal </item>
			<item> terminate </item>

			<item> ndims </item>
			<item> size </item>
			<item> scalar </item>
			<item> vector </item>
			<item> matrix </item>
			<item> array </item>
			<item> zeros </item>
			<item> ones </item>
			<item> fill </item>
			<item> identity </item>
			<item> diagonal </item>
			<item> linspace </item>
			<item> min </item>
			<item> max </item>
			<item> sum </item>
			<item> product </item>
			<item> transpose </item>
			<item> outerProduct </item>
			<item> symmetric </item>
			<item> cross </item>
			<item> skew </item>
			<item> cat </item>
		</list>

		<contexts>
			<context attribute="Normal Text" lineEndContext="#pop" name="Normal Text" >
				<RegExpr attribute="Keyword" String="\bend\s+(for|while|loop)\b" endRegion="loopBlock"/>
				<RegExpr attribute="Keyword" String="\bloop\b" beginRegion="loopBlock"/>
				<RegExpr attribute="Keyword" String="\bend\s+(if|when)\b" endRegion="thenBlock"/>
				<RegExpr attribute="Keyword" String="\bend\s+(if|when)\b" endRegion="thenBlock"/>
				<RegExpr attribute="Keyword" String="\b(if|when)\b" beginRegion="thenBlock"/>

				<keyword attribute="Class Type" String="classType_type"/>
				<keyword attribute="Class Type" String="classTypes" beginRegion="class"/>
				<RegExpr attribute="Keyword" String="\bend " endRegion="class"/>

				<keyword attribute="Data Type" String="primitiveTypes"/>
				<keyword attribute="Default Attribute" String="defaultAttributes"/>
				<keyword attribute="Keyword" String="keywords"/>
				<keyword attribute="Function" String="functions"/>
				<Float attribute="Floating-Point Number"/>
				<Int attribute="Integer Number"/>
				<AnyChar attribute="Delimiter" String="()[]{}"/>
				<RegExpr attribute="Variable" String="[_a-zA-Z]\w*"/>
				<DetectChar attribute="String" context="String" char="&quot;"/>
				<Detect2Chars attribute="Comment" context="Single-line comment" char="/" char1="/"/>
				<Detect2Chars attribute="Comment" context="Multi-line comment" char="/" char1="*" beginRegion="Comment"/>
			</context>

			<context attribute="String" lineEndContext="#stay" name="String">
				<LineContinue attribute="String" context="#stay"/>
				<HlCStringChar attribute="String Char" context="#stay"/>
				<DetectChar attribute="String" context="#pop" char="&quot;"/>
			</context>

			<context attribute="Comment" lineEndContext="#pop" name="Single-line comment">
				<DetectSpaces/>
				<IncludeRules context="##Alerts"/>
				<DetectIdentifier/>
			</context>

			<context attribute="Comment" lineEndContext="#stay" name="Multi-line comment">
				<DetectSpaces/>
				<Detect2Chars attribute="Comment" context="#pop" char="*" char1="/" endRegion="Comment"/>
				<IncludeRules context="##Alerts"/>
				<DetectIdentifier/>
			</context>
		</contexts>

		<itemDatas>
			<itemData name="Normal Text" defStyleNum="dsNormal"/>
			<itemData name="Variable" defStyleNum="dsNormal"/>
			<itemData name="Class Type" defStyleNum="dsKeyword"/>
			<itemData name="String" defStyleNum="dsString"/>
			<itemData name="String Char"  defStyleNum="dsChar"/>
			<itemData name="Default Attribute" defStyleNum="dsOthers"/>
			<itemData name="Keyword" defStyleNum="dsKeyword"/>
			<itemData name="Data Type" defStyleNum="dsDataType"/>
			<itemData name="Function" defStyleNum="dsFunction"/>
			<itemData name="Floating-Point Number" defStyleNum="dsFloat"/>
			<itemData name="Integer Number" defStyleNum="dsDecVal"/>
			<itemData name="Comment" defStyleNum="dsComment"/>
		</itemDatas>
	</highlighting>

	<general>
		<comments>
			<comment name="singleLine" start="//"/>
			<comment name="multiLine" start="/**" end="*/"/>
			<comment name="multiLine" start="/*" end="*/"/>
		</comments>
		<keywords casesensitive="1"/>
	</general>
</language>