summaryrefslogtreecommitdiffstats
path: root/kate/data/logtalk.xml
blob: 3351e8e8c63792fa189791987da72e8f47e20b3b (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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd">

<language name="Logtalk" version="1.52" kateversion="2.5" section="Sources" extensions="*.lgt;*.config" mimetype="text/x-logtalk" author="Paulo Moura (pmoura@logtalk.org)" license="Artistic License 2.0">

	<highlighting>

		<contexts>

			<context name = "normal" attribute = "Normal" lineEndContext = "#stay" >
				<!-- Directives -->
				<RegExpr String = "^\s*:-" attribute = "Normal" context = "directive" />
				<!-- Event handlers -->
				<RegExpr String = "\b(after|before)(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Method execution context -->
				<RegExpr String = "\b(parameter|this|se(lf|nder))(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Reflection -->
				<RegExpr String = "\b(current_predicate|predicate_property)(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- DCGs -->
				<RegExpr String = "\b(expand_term|term_expansion|phrase)(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Entity -->
				<RegExpr String = "\b(abolish|c(reate|urrent))_(object|protocol|category)(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\b(object|protocol|category)_property(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Entity relations -->
				<RegExpr String = "\bextends_(object|protocol)(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\bimplements_protocol(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\b(instantiates|specializes)_class(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\bimports_category(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Events -->
				<RegExpr String = "\b(current_event|(abolish|define)_events)(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Flags -->
				<RegExpr String = "\b(current|set)_logtalk_flag(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Compiling, loading, and library paths -->
				<RegExpr String = "\blogtalk_(compile|l(ibrary_path|oad))(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Database -->
				<RegExpr String = "\b(clause|retract(all)?)(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\ba(bolish|ssert(a|z))(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Control -->
				<RegExpr String = "\b(ca(ll|tch)|throw)(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\b(fail|true)\b" attribute = "Built-in" context = "#stay" />
				<!-- All solutions -->
				<RegExpr String = "\b((bag|set)of|f(ind|or)all)(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Term unification -->
				<RegExpr String = "\bunify_with_occurs_check(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Term creation and decomposition -->
				<RegExpr String = "\b(functor|arg|copy_term)(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Evaluable functors -->
				<RegExpr String = "\b(rem|mod|abs|sign)(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\bfloat(_(integer|fractional)_part)?(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\b(floor|truncate|round|ceiling)(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Other arithmetic functors -->
				<RegExpr String = "\b(cos|atan|exp|log|s(in|qrt))(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Term testing -->
				<RegExpr String = "\b(var|atom(ic)?|integer|float|compound|n(onvar|umber))(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Stream selection and control -->
				<RegExpr String = "\b(current|set)_(in|out)put(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\b(open|close)(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\bflush_output(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\bflush_output\b" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\b(stream_property|at_end_of_stream|set_stream_position)(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Character and byte input/output -->
				<RegExpr String = "\b(nl|(get|peek|put)_(byte|c(har|ode)))(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\bnl\b" attribute = "Built-in" context = "#stay" />
				<!-- Term input/output -->
				<RegExpr String = "\bread(_term)?(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\bwrite(q|_(canonical|term))?(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\b(current_)?op(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\b(current_)?char_conversion(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Atomic term processing -->
				<RegExpr String = "\batom_(length|c(hars|o(ncat|des)))(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\b(char_code|sub_atom)(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\bnumber_c(hars|odes)(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Implementation defined hooks functions -->
				<RegExpr String = "\b(set|current)_prolog_flag(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\bhalt\b" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\bhalt(?=[(])" attribute = "Built-in" context = "#stay" />
				<!-- Variables -->
				<RegExpr String = "\b[A-Z_]\w*" attribute = "Variable" context = "#stay" />
				<!-- Comments -->
				<DetectChar char = "%" attribute = "Comment" context = "single line comment" />
				<Detect2Chars char = "/" char1 = "*" attribute = "Comment" context = "multiline comment" beginRegion = "Comment" />
				<!-- Strings and quoted atoms -->
				<DetectChar char = "&quot;" attribute = "String" context = "string" />
				<DetectChar char = "'" attribute = "String" context = "atom" />
				<!-- Numbers -->
				<RegExpr String = "0'." attribute = "Number" context = "#stay" />
				<RegExpr String = "0b[0-1]+" attribute = "Number" context = "#stay" />
				<RegExpr String = "0o[0-7]+" attribute = "Number" context = "#stay" />
				<RegExpr String = "0x[0-9a-fA-F]+" attribute = "Number" context = "#stay" />
				<RegExpr String = "\d+(\.\d+)?([eE]([-+])?\d+)?" attribute = "Number" context = "#stay" />
				<!-- Message sending operators -->
				<Detect2Chars char = ":" char1 = ":" attribute = "Operator" context = "#stay" />
				<Detect2Chars char = "^" char1 = "^" attribute = "Operator" context = "#stay" />
				<!-- External call -->
				<DetectChar char = "{" attribute = "Operator" context = "#stay" beginRegion="external" />
				<DetectChar char = "}" attribute = "Operator" context = "#stay" endRegion="external" />
				<!-- Logic and control -->
				<RegExpr String = "\bonce(?=[(])" attribute = "Built-in" context = "#stay" />
				<RegExpr String = "\brepeat\b" attribute = "Built-in" context = "#stay" />
				<!-- Bitwise functors -->
				<Detect2Chars char = "&gt;" char1 = "&gt;" attribute = "Operator" context = "#stay" />
				<Detect2Chars char = "&lt;" char1 = "&lt;" attribute = "Operator" context = "#stay" />
				<Detect2Chars char = "/" char1 = "\" attribute = "Operator" context = "#stay" />
				<Detect2Chars char = "\" char1 = "/" attribute = "Operator" context = "#stay" />
				<Detect2Chars char = "\" char1 = "\" attribute = "Operator" context = "#stay" />
				<!-- Arithemtic evaluation -->
				<RegExpr String = "\bis\b" attribute = "Operator" context = "#stay" />
				<!-- Arithemtic comparison -->
				<StringDetect String = "=:=" attribute = "Operator" context = "#stay" />
				<StringDetect String = "=\=" attribute = "Operator" context = "#stay" />
				<DetectChar char = "&lt;" attribute = "Operator" context = "#stay" />
				<Detect2Chars char = "=" char1 = "&lt;" attribute = "Operator" context = "#stay" />
				<DetectChar char = "&gt;" attribute = "Operator" context = "#stay" />
				<Detect2Chars char = "&gt;" char1 = "=" attribute = "Operator" context = "#stay" />
				<!-- Term creation and decomposition -->
				<StringDetect String = "=.." attribute = "Operator" context = "#stay" />
				<!-- Term unification -->
				<DetectChar char = "=" attribute = "Operator" context = "#stay" />
				<Detect2Chars char = "\" char1 = "=" attribute = "Operator" context = "#stay" />
				<!-- Term comparison -->
				<Detect2Chars char = "=" char1 = "=" attribute = "Operator" context = "#stay" />
				<StringDetect String = "\==" attribute = "Operator" context = "#stay" />
				<StringDetect String = "@=&lt;" attribute = "Operator" context = "#stay" />
				<Detect2Chars char = "@" char1 = "&lt;" attribute = "Operator" context = "#stay" />
				<StringDetect String = "@&gt;=" attribute = "Operator" context = "#stay" />
				<Detect2Chars char = "@" char1 = "&gt;" attribute = "Operator" context = "#stay" />
				<!-- Evaluable functors -->
				<Detect2Chars char = "/" char1 = "/" attribute = "Operator" context = "#stay" />
				<AnyChar String = "+-*/" attribute = "Operator" context = "#stay" />
				<RegExpr String = "\b(mod|rem)\b" attribute = "Operator" context = "#stay" />
				<!-- Other arithemtic functors -->
				<Detect2Chars char = "*" char1 = "*" attribute = "Operator" context = "#stay" />
				<!-- DCG rules -->
				<StringDetect String = "--&gt;" attribute = "Operator" context = "#stay" />
				<!-- Control constructs -->
				<AnyChar String = "!;" attribute = "Operator" context = "#stay" />
				<Detect2Chars char = "-" char1 = "&gt;" attribute = "Operator" context = "#stay" />
				<!-- Logic and control -->
				<Detect2Chars char = "\" char1 = "+" attribute = "Operator" context = "#stay" />
				<!-- Mode operators -->
				<AnyChar String = "?@" attribute = "Operator" context = "#stay" />
				<!-- Clause operator -->
				<Detect2Chars char = ":" char1 = "-"  firstNonSpace = "false" attribute = "Normal" context = "#stay" />
				<!-- Atoms -->
				<RegExpr String = "\b[a-z]\w*" attribute = "Normal" context = "#stay" />
			</context>

			<context name = "directive" attribute = "Directive" lineEndContext = "#stay" >
				<!-- Entity directives -->
				<RegExpr String = "\b(category|object|protocol)(?=[(])" attribute = "Directive" context = "entityrelations" beginRegion = "Entity"/>
				<RegExpr String = "\bend_(category|object|protocol)[.]" attribute = "Directive" context = "#pop" endRegion = "Entity" />
				<RegExpr String = "\bmodule(?=[(])" attribute = "Directive" context = "#pop"/>
 				<!-- Predicate scope directives -->
				<RegExpr String = "\bp(ublic|r(otected|ivate))(?=[(])" attribute = "Directive" context = "#pop" />
				<!-- Other directives -->
				<RegExpr String = "\be(ncoding|xport)(?=[(])" attribute = "Directive" context = "#pop" />
			   	<RegExpr String = "\bin(fo|itialization)(?=[(])" attribute = "Directive" context = "#pop" />
				<RegExpr String = "\bdynamic[.]" attribute = "Directive" context = "#pop" />
				<RegExpr String = "\b(alias|d(ynamic|iscontiguous)|meta_predicate|m(etapredicate|ode|ultifile))(?=[(])" attribute = "Directive" context = "#pop" />
				<RegExpr String = "\bop(?=[(])" attribute = "Directive" context = "#pop" />
				<RegExpr String = "\b(calls|use(s|_module))(?=[(])" attribute = "Directive" context = "#pop" />
			</context>

			<context name = "entityrelations" attribute = "Normal" lineEndContext = "#stay" >
				<RegExpr String = "\b(extends|i(nstantiates|mp(lements|orts))|specializes)(?=[(])" attribute = "Directive" context = "#stay" />
				<Detect2Chars attribute = "Normal" context = "normal" char = ")" char1 = "." />
			</context>

			<context name = "single line comment" attribute = "Comment" lineEndContext = "#pop" />

			<context name = "multiline comment" attribute = "Comment" lineEndContext = "#stay" >
				<Detect2Chars char = "*" char1 = "/" attribute = "Comment" context = "#pop" endRegion = "Comment" />
			</context>

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

			<context name = "atom" attribute = "String" lineEndContext = "#stay" >
				<DetectChar char = "'" attribute = "String" context = "#pop" />
			</context>

		</contexts>

		<itemDatas>
			<itemData name = "Normal" defStyleNum = "dsNormal" />
			<itemData name = "Directive" defStyleNum = "dsKeyword" />
			<itemData name = "Built-in" defStyleNum = "dsKeyword" />
			<itemData name = "Operator" defStyleNum = "dsDataType" />
			<itemData name = "Comment" defStyleNum = "dsComment" />
			<itemData name = "Number" defStyleNum = "dsDecVal" />
			<itemData name = "String"  defStyleNum = "dsString" />
			<itemData name = "Variable" defStyleNum = "dsOthers" />
		</itemDatas>

	</highlighting>

	<general>
		<comments>
			<comment name = "singleLine" start = "%" />
			<comment name = "multiLine" start = "/*" end = "*/" region = "Comment" />
		</comments>
		<keywords casesensitive="true" />
	</general>

</language>