106 (r'/\*(.|\n)*?\*/', Comment), |
105 (r'/\*(.|\n)*?\*/', Comment), |
107 # Whitespace |
106 # Whitespace |
108 (r'\n', Text), |
107 (r'\n', Text), |
109 (r'\s+', Text), |
108 (r'\s+', Text), |
110 # Numbers |
109 # Numbers |
111 (r"0'.", Number), |
110 (r"0'[\\]?.", Number), |
112 (r'0b[01]+', Number.Bin), |
111 (r'0b[01]+', Number.Bin), |
113 (r'0o[0-7]+', Number.Oct), |
112 (r'0o[0-7]+', Number.Oct), |
114 (r'0x[0-9a-fA-F]+', Number.Hex), |
113 (r'0x[0-9a-fA-F]+', Number.Hex), |
115 (r'\d+\.?\d*((e|E)(\+|-)?\d+)?', Number), |
114 (r'\d+\.?\d*((e|E)(\+|-)?\d+)?', Number), |
116 # Variables |
115 # Variables |
117 (r'([A-Z_]\w*)', Name.Variable), |
116 (r'([A-Z_][a-zA-Z0-9_]*)', Name.Variable), |
118 # Event handlers |
117 # Event handlers |
119 (r'(after|before)(?=[(])', Keyword), |
118 (r'(after|before)(?=[(])', Keyword), |
120 # Message forwarding handler |
119 # Message forwarding handler |
121 (r'forward(?=[(])', Keyword), |
120 (r'forward(?=[(])', Keyword), |
122 # Execution-context methods |
121 # Execution-context methods |
123 (r'(parameter|this|se(lf|nder))(?=[(])', Keyword), |
122 (r'(context|parameter|this|se(lf|nder))(?=[(])', Keyword), |
124 # Reflection |
123 # Reflection |
125 (r'(current_predicate|predicate_property)(?=[(])', Keyword), |
124 (r'(current_predicate|predicate_property)(?=[(])', Keyword), |
126 # DCGs and term expansion |
125 # DCGs and term expansion |
127 (r'(expand_(goal|term)|(goal|term)_expansion|phrase)(?=[(])', Keyword), |
126 (r'(expand_(goal|term)|(goal|term)_expansion|phrase)(?=[(])', Keyword), |
128 # Entity |
127 # Entity |
134 (r'imp(lements_protocol|orts_category)(?=[(])', Keyword), |
133 (r'imp(lements_protocol|orts_category)(?=[(])', Keyword), |
135 (r'(instantiat|specializ)es_class(?=[(])', Keyword), |
134 (r'(instantiat|specializ)es_class(?=[(])', Keyword), |
136 # Events |
135 # Events |
137 (r'(current_event|(abolish|define)_events)(?=[(])', Keyword), |
136 (r'(current_event|(abolish|define)_events)(?=[(])', Keyword), |
138 # Flags |
137 # Flags |
139 (r'(current|set)_logtalk_flag(?=[(])', Keyword), |
138 (r'(create|current|set)_logtalk_flag(?=[(])', Keyword), |
140 # Compiling, loading, and library paths |
139 # Compiling, loading, and library paths |
141 (r'logtalk_(compile|l(ibrary_path|oad|oad_context)|make)(?=[(])', Keyword), |
140 (r'logtalk_(compile|l(ibrary_path|oad|oad_context)|make(_target_action)?)(?=[(])', Keyword), |
142 (r'\blogtalk_make\b', Keyword), |
141 (r'\blogtalk_make\b', Keyword), |
143 # Database |
142 # Database |
144 (r'(clause|retract(all)?)(?=[(])', Keyword), |
143 (r'(clause|retract(all)?)(?=[(])', Keyword), |
145 (r'a(bolish|ssert(a|z))(?=[(])', Keyword), |
144 (r'a(bolish|ssert(a|z))(?=[(])', Keyword), |
146 # Control constructs |
145 # Control constructs |
147 (r'(ca(ll|tch)|throw)(?=[(])', Keyword), |
146 (r'(ca(ll|tch)|throw)(?=[(])', Keyword), |
148 (r'(fa(il|lse)|true)\b', Keyword), |
147 (r'(fa(il|lse)|true|(instantiation|system)_error)\b', Keyword), |
|
148 (r'(type|domain|existence|permission|representation|evaluation|resource|syntax)_error(?=[(])', Keyword), |
149 # All solutions |
149 # All solutions |
150 (r'((bag|set)of|f(ind|or)all)(?=[(])', Keyword), |
150 (r'((bag|set)of|f(ind|or)all)(?=[(])', Keyword), |
151 # Multi-threading meta-predicates |
151 # Multi-threading predicates |
152 (r'threaded(_(call|once|ignore|exit|peek|wait|notify))?(?=[(])', Keyword), |
152 (r'threaded(_(ca(ll|ncel)|once|ignore|exit|peek|wait|notify))?(?=[(])', Keyword), |
|
153 # Engine predicates |
|
154 (r'threaded_engine(_(create|destroy|self|next|next_reified|yield|post|fetch))?(?=[(])', Keyword), |
153 # Term unification |
155 # Term unification |
154 (r'(subsumes_term|unify_with_occurs_check)(?=[(])', Keyword), |
156 (r'(subsumes_term|unify_with_occurs_check)(?=[(])', Keyword), |
155 # Term creation and decomposition |
157 # Term creation and decomposition |
156 (r'(functor|arg|copy_term|numbervars|term_variables)(?=[(])', Keyword), |
158 (r'(functor|arg|copy_term|numbervars|term_variables)(?=[(])', Keyword), |
157 # Evaluable functors |
159 # Evaluable functors |
159 (r'float(_(integer|fractional)_part)?(?=[(])', Keyword), |
161 (r'float(_(integer|fractional)_part)?(?=[(])', Keyword), |
160 (r'(floor|t(an|runcate)|round|ceiling)(?=[(])', Keyword), |
162 (r'(floor|t(an|runcate)|round|ceiling)(?=[(])', Keyword), |
161 # Other arithmetic functors |
163 # Other arithmetic functors |
162 (r'(cos|a(cos|sin|tan|tan2)|exp|log|s(in|qrt)|xor)(?=[(])', Keyword), |
164 (r'(cos|a(cos|sin|tan|tan2)|exp|log|s(in|qrt)|xor)(?=[(])', Keyword), |
163 # Term testing |
165 # Term testing |
164 (r'(var|atom(ic)?|integer|float|c(allable|ompound)|n(onvar|umber)|' |
166 (r'(var|atom(ic)?|integer|float|c(allable|ompound)|n(onvar|umber)|ground|acyclic_term)(?=[(])', Keyword), |
165 r'ground|acyclic_term)(?=[(])', Keyword), |
|
166 # Term comparison |
167 # Term comparison |
167 (r'compare(?=[(])', Keyword), |
168 (r'compare(?=[(])', Keyword), |
168 # Stream selection and control |
169 # Stream selection and control |
169 (r'(curren|se)t_(in|out)put(?=[(])', Keyword), |
170 (r'(curren|se)t_(in|out)put(?=[(])', Keyword), |
170 (r'(open|close)(?=[(])', Keyword), |
171 (r'(open|close)(?=[(])', Keyword), |
243 ], |
244 ], |
244 |
245 |
245 'directive': [ |
246 'directive': [ |
246 # Conditional compilation directives |
247 # Conditional compilation directives |
247 (r'(el)?if(?=[(])', Keyword, 'root'), |
248 (r'(el)?if(?=[(])', Keyword, 'root'), |
248 (r'(e(lse|ndif))[.]', Keyword, 'root'), |
249 (r'(e(lse|ndif))(?=[.])', Keyword, 'root'), |
249 # Entity directives |
250 # Entity directives |
250 (r'(category|object|protocol)(?=[(])', Keyword, 'entityrelations'), |
251 (r'(category|object|protocol)(?=[(])', Keyword, 'entityrelations'), |
251 (r'(end_(category|object|protocol))[.]', Keyword, 'root'), |
252 (r'(end_(category|object|protocol))(?=[.])', Keyword, 'root'), |
252 # Predicate scope directives |
253 # Predicate scope directives |
253 (r'(public|protected|private)(?=[(])', Keyword, 'root'), |
254 (r'(public|protected|private)(?=[(])', Keyword, 'root'), |
254 # Other directives |
255 # Other directives |
255 (r'e(n(coding|sure_loaded)|xport)(?=[(])', Keyword, 'root'), |
256 (r'e(n(coding|sure_loaded)|xport)(?=[(])', Keyword, 'root'), |
256 (r'in(clude|itialization|fo)(?=[(])', Keyword, 'root'), |
257 (r'in(clude|itialization|fo)(?=[(])', Keyword, 'root'), |
257 (r'(built_in|dynamic|synchronized|threaded)[.]', Keyword, 'root'), |
258 (r'(built_in|dynamic|synchronized|threaded)(?=[.])', Keyword, 'root'), |
258 (r'(alias|d(ynamic|iscontiguous)|m(eta_(non_terminal|predicate)|ode|ultifile)|' |
259 (r'(alias|d(ynamic|iscontiguous)|m(eta_(non_terminal|predicate)|ode|ultifile)|s(et_(logtalk|prolog)_flag|ynchronized))(?=[(])', Keyword, 'root'), |
259 r's(et_(logtalk|prolog)_flag|ynchronized))(?=[(])', Keyword, 'root'), |
|
260 (r'op(?=[(])', Keyword, 'root'), |
260 (r'op(?=[(])', Keyword, 'root'), |
261 (r'(c(alls|oinductive)|module|reexport|use(s|_module))(?=[(])', Keyword, 'root'), |
261 (r'(c(alls|oinductive)|module|reexport|use(s|_module))(?=[(])', Keyword, 'root'), |
262 (r'[a-z]\w*(?=[(])', Text, 'root'), |
262 (r'[a-z][a-zA-Z0-9_]*(?=[(])', Text, 'root'), |
263 (r'[a-z]\w*[.]', Text, 'root'), |
263 (r'[a-z][a-zA-Z0-9_]*(?=[.])', Text, 'root'), |
264 ], |
264 ], |
265 |
265 |
266 'entityrelations': [ |
266 'entityrelations': [ |
267 (r'(complements|extends|i(nstantiates|mp(lements|orts))|specializes)(?=[(])', Keyword), |
267 (r'(complements|extends|i(nstantiates|mp(lements|orts))|specializes)(?=[(])', Keyword), |
268 # Numbers |
268 # Numbers |
269 (r"0'.", Number), |
269 (r"0'[\\]?.", Number), |
270 (r'0b[01]+', Number.Bin), |
270 (r'0b[01]+', Number.Bin), |
271 (r'0o[0-7]+', Number.Oct), |
271 (r'0o[0-7]+', Number.Oct), |
272 (r'0x[0-9a-fA-F]+', Number.Hex), |
272 (r'0x[0-9a-fA-F]+', Number.Hex), |
273 (r'\d+\.?\d*((e|E)(\+|-)?\d+)?', Number), |
273 (r'\d+\.?\d*((e|E)(\+|-)?\d+)?', Number), |
274 # Variables |
274 # Variables |
275 (r'([A-Z_]\w*)', Name.Variable), |
275 (r'([A-Z_][a-zA-Z0-9_]*)', Name.Variable), |
276 # Atoms |
276 # Atoms |
277 (r"[a-z]\w*", Text), |
277 (r"[a-z][a-zA-Z0-9_]*", Text), |
278 (r"'", String, 'quoted_atom'), |
278 (r"'", String, 'quoted_atom'), |
279 # Strings |
279 # Strings |
280 (r'"(\\\\|\\"|[^"])*"', String), |
280 (r'"(\\\\|\\"|[^"])*"', String), |
281 # End of entity-opening directive |
281 # End of entity-opening directive |
282 (r'([)]\.)', Text, 'root'), |
282 (r'([)]\.)', Text, 'root'), |
283 # Scope operator |
283 # Scope operator |
284 (r'(::)', Operator), |
284 (r'(::)', Operator), |
285 # Ponctuation |
285 # Punctuation |
286 (r'[()\[\],.|]', Text), |
286 (r'[()\[\],.|]', Text), |
287 # Comments |
287 # Comments |
288 (r'%.*?\n', Comment), |
288 (r'%.*?\n', Comment), |
289 (r'/\*(.|\n)*?\*/', Comment), |
289 (r'/\*(.|\n)*?\*/', Comment), |
290 # Whitespace |
290 # Whitespace |