1<?php
2/*************************************************************************************
3 * logtalk.php
4 * -----------
5 *
6 * Author: Paulo Moura (pmoura@logtalk.org)
7 * Copyright: (c) 2009-2011 Paulo Moura (http://logtalk.org/)
8 * Release Version: 1.0.9.1
9 * Date Started: 2009/10/24
10 *
11 * Logtalk language file for GeSHi.
12 *
13 * CHANGES
14 * -------
15 * 2011/01/18 (1.1.4)
16 *  -  Added syntax coloring of ignore/1
17 * 2010/11/28 (1.1.3)
18 *  -  Added syntax coloring of conforms_to_protocol/2-3
19 * 2010/09/14 (1.1.2)
20 *  -  Added syntax coloring of coinductive/1
21 * 2010/06/23 (1.1.1)
22 *  -  Added syntax coloring of e/0 and pi/0
23 *  -  Added syntax coloring of ground/1, numbervars/3, keysort/2, and sort/2
24 * 2010/05/15 (1.1.0)
25 *  -  Added syntax coloring of callable/1 and compare/3
26 * 2009/10/28 (1.0.0)
27 *  -  First Release
28 *
29 *************************************************************************************
30 *
31 *     This file is part of GeSHi.
32 *
33 *   GeSHi is free software; you can redistribute it and/or modify
34 *   it under the terms of the GNU General Public License as published by
35 *   the Free Software Foundation; either version 2 of the License, or
36 *   (at your option) any later version.
37 *
38 *   GeSHi is distributed in the hope that it will be useful,
39 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
40 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
41 *   GNU General Public License for more details.
42 *
43 *   You should have received a copy of the GNU General Public License
44 *   along with GeSHi; if not, write to the Free Software
45 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
46 *
47 ************************************************************************************/
48
49$language_data = array(
50    'LANG_NAME' => 'Logtalk',
51    'COMMENT_SINGLE' => array(1 => '%'),
52    'COMMENT_MULTI' => array('/*' => '*/'),
53    'COMMENT_REGEXP' => array(2 => "/0'./sim"),
54    'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
55    'QUOTEMARKS' => array("'"),
56    'HARDQUOTE' => array('"', '"'),
57    'HARDESCAPE' => array(),
58    'ESCAPE_CHAR' => '',
59    'ESCAPE_REGEXP' => array(
60        //Simple Single Char Escapes
61        1 => "#\\\\[\\\\abfnrtv\'\"?\n]#i",
62        //Hexadecimal Char Specs
63        2 => "#\\\\x[\da-fA-F]+\\\\#",
64        //Octal Char Specs
65        3 => "#\\\\[0-7]+\\\\#"
66        ),
67    'NUMBERS' =>
68        GESHI_NUMBER_INT_BASIC |
69        GESHI_NUMBER_BIN_PREFIX_0B |
70        GESHI_NUMBER_OCT_PREFIX_0O |
71        GESHI_NUMBER_HEX_PREFIX |
72        GESHI_NUMBER_FLT_NONSCI |
73        GESHI_NUMBER_FLT_SCI_ZERO,
74    'KEYWORDS' => array(
75        // Directives (with arguments)
76        1 => array(
77            // file directives
78            'encoding', 'ensure_loaded',
79            // flag directives
80            'set_logtalk_flag', 'set_prolog_flag',
81            // entity opening directives
82            'category', 'object', 'protocol',
83            // predicate scope directives
84            'private', 'protected', 'public',
85            // conditional compilation directives
86            'elif', 'if',
87            // entity directives
88            'calls', 'initialization', 'op', 'uses',
89            // predicate directives
90            'alias', 'coinductive', 'discontiguous', 'dynamic', 'mode', 'info', 'meta_predicate', 'multifile', 'synchronized',
91            // module directives
92            'export', 'module', 'reexport', 'use_module'
93            ),
94        // Directives (no arguments)
95        2 => array(
96            // entity directives
97            'dynamic',
98            // multi-threading directives
99            'synchronized', 'threaded',
100            // entity closing directives
101            'end_category', 'end_object', 'end_protocol',
102            // conditional compilation directives
103            'else', 'endif'
104            ),
105        // Entity relations
106        3 => array(
107            'complements', 'extends', 'imports', 'implements','instantiates', 'specializes'
108            ),
109        // Built-in predicates (with arguments)
110        4 => array(
111            // event handlers
112            'after', 'before',
113            // execution-context methods
114            'parameter', 'self', 'sender', 'this',
115            // predicate reflection
116            'current_predicate', 'predicate_property',
117            // DCGs and term expansion
118            'expand_goal', 'expand_term', 'goal_expansion', 'phrase', 'term_expansion',
119            // entity
120            'abolish_category', 'abolish_object', 'abolish_protocol',
121            'create_category', 'create_object', 'create_protocol',
122            'current_category', 'current_object', 'current_protocol',
123            'category_property', 'object_property', 'protocol_property',
124            // entity relations
125            'complements_object', 'conforms_to_protocol',
126            'extends_category', 'extends_object', 'extends_protocol',
127            'implements_protocol', 'imports_category',
128            'instantiates_class', 'specializes_class',
129            // events
130            'abolish_events', 'current_event', 'define_events',
131            // flags
132            'current_logtalk_flag', 'set_logtalk_flag',
133            'current_prolog_flag', 'set_prolog_flag',
134            // compiling, loading, and library path
135            'logtalk_compile', 'logtalk_library_path', 'logtalk_load',
136            // database
137            'abolish', 'asserta', 'assertz', 'clause', 'retract', 'retractall',
138            // control
139            'call', 'catch', 'ignore', 'once', 'throw',
140            // all solutions predicates
141            'bagof', 'findall', 'forall', 'setof',
142            // multi-threading meta-predicates
143            'threaded',
144            'threaded_call', 'threaded_once', 'threaded_ignore', 'threaded_exit', 'threaded_peek',
145            'threaded_wait', 'threaded_notify',
146            // term unification
147            'unify_with_occurs_check',
148            // atomic term processing
149            'atom_chars', 'atom_codes', 'atom_concat', 'atom_length',
150            'number_chars', 'number_codes',
151            'char_code',
152            // term creation and decomposition
153            'arg', 'copy_term', 'functor', 'numbervars',
154            // term testing
155            'atom', 'atomic', 'callable', 'compound', 'float', 'ground', 'integer', 'nonvar', 'number', 'sub_atom', 'var',
156            // term comparison
157            'compare',
158            // stream selection and control
159            'current_input', 'current_output', 'set_input', 'set_output',
160            'open', 'close', 'flush_output', 'stream_property',
161            'at_end_of_stream', 'set_stream_position',
162            // character and byte input/output predicates
163            'get_byte', 'get_char', 'get_code',
164            'peek_byte', 'peek_char', 'peek_code',
165            'put_byte', 'put_char', 'put_code',
166            'nl',
167            // term input/output predicates
168            'current_op', 'op',
169            'write', 'writeq', 'write_canonical', 'write_term',
170            'read', 'read_term',
171            'char_conversion', 'current_char_conversion',
172            // hooks
173            'halt',
174            // sorting
175            'keysort', 'sort'
176            ),
177        // Built-in predicates (no arguments)
178        5 => array(
179            // control
180            'fail', 'repeat', 'true',
181            // character and byte input/output predicates
182            'nl',
183            // implementation defined hooks functions
184            'halt',
185            // arithemtic evaluation
186            'is',
187            // stream selection and control
188            'at_end_of_stream', 'flush_output'
189            ),
190        // Evaluable functors (with arguments)
191        6 => array(
192            'float_integer_part', 'float_fractional_part',
193            'rem', 'mod', 'abs', 'sign', 'floor', 'truncate', 'round', 'ceiling',
194            'cos', 'atan', 'exp', 'log', 'sin', 'sqrt'
195            ),
196        // Evaluable functors (no arguments)
197        7 => array(
198            'e', 'pi', 'mod', 'rem'
199            ),
200        ),
201    'SYMBOLS' => array(
202        0 => array(
203            // external call
204            '{', '}'
205            ),
206        1 => array(
207            // arithemtic comparison
208            '=:=', '=\=', '<', '=<', '>=', '>',
209            // term comparison
210            '<<', '>>', '/\\', '\\/', '\\',
211            // bitwise functors
212            '==', '\==', '@<', '@=<', '@>=', '@>',
213            // evaluable functors
214            '+', '-', '*', '/', '**',
215            // logic and control
216            '!', '\\+', ';',
217            // message sending operators
218            '::', '^^', ':',
219            // grammar rule and conditional functors
220            '-->', '->',
221            // mode operators
222            '@', '?',
223            // term to list predicate
224            '=..',
225            // unification
226            '=', '\\='
227            ),
228        2 => array(
229            // clause and directive functors
230            ':-'
231            )
232        ),
233    'CASE_SENSITIVE' => array(
234        GESHI_COMMENTS => false,
235        1 => true,
236        2 => true,
237        3 => true,
238        4 => true,
239        5 => true,
240        6 => true,
241        7 => true
242        ),
243    'STYLES' => array(
244        'KEYWORDS' => array(
245            1 => 'color: #2e4dc9;',
246            2 => 'color: #2e4dc9;',
247            3 => 'color: #2e4dc9;',
248            4 => 'color: #9d4f37;',
249            5 => 'color: #9d4f37;',
250            6 => 'color: #9d4f37;',
251            7 => 'color: #9d4f37;'
252            ),
253        'NUMBERS' => array(
254            0 => 'color: #430000;'
255            ),
256        'COMMENTS' => array(
257            1 => 'color: #60a0b0; font-style: italic;',
258            2 => 'color: #430000;',
259            'MULTI' => 'color: #60a0b0; font-style: italic;'
260            ),
261        'ESCAPE_CHAR' => array(
262            0 => 'color: #9f0000; font-weight: bold;',
263            1 => 'color: #9f0000; font-weight: bold;',
264            2 => 'color: #9f0000; font-weight: bold;',
265            3 => 'color: #9f0000; font-weight: bold;',
266            'HARD' => '',
267            ),
268        'SYMBOLS' => array(
269            0 => 'color: #666666;font-weight: bold;',
270            1 => 'color: #666666;font-weight: bold;',
271            2 => 'color: #000000;'
272            ),
273        'BRACKETS' => array(
274            0 => 'color: #000000;'
275            ),
276        'STRINGS' => array(
277            0 => 'color: #9f0000;',
278            'HARD' => 'color: #9f0000;'
279            ),
280        'METHODS' => array(
281            ),
282        'REGEXPS' => array(
283            0 => 'color: #848484;'
284            ),
285        'SCRIPT' => array()
286        ),
287    'URLS' => array(
288        1 => '',
289        2 => '',
290        3 => '',
291        4 => '',
292        5 => '',
293        6 => '',
294        7 => ''
295        ),
296    'OOLANG' => false,
297    'OBJECT_SPLITTERS' => array(
298        1 => '::'
299        ),
300    'REGEXPS' => array(
301        // variables
302        0 => '\b(?!(?:PIPE|SEMI|REG3XP\d*)[^a-zA-Z0-9_])[A-Z_][a-zA-Z0-9_]*(?![a-zA-Z0-9_])'
303        ),
304    'STRICT_MODE_APPLIES' => GESHI_NEVER,
305    'SCRIPT_DELIMITERS' => array(),
306    'HIGHLIGHT_STRICT_BLOCK' => array(),
307    'TAB_WIDTH' => 4,
308    'PARSER_CONTROL' => array(
309        'ENABLE_FLAGS' => array(
310            'BRACKETS' => GESHI_NEVER
311            ),
312        'KEYWORDS' => array(
313            1 => array(
314                'DISALLOWED_BEFORE' => '(?<=:-\s)',
315                'DISALLOWED_AFTER' => '(?=\()'
316                ),
317            2 => array(
318                'DISALLOWED_BEFORE' => '(?<=:-\s)',
319                'DISALLOWED_AFTER' => '(?=\.)'
320                ),
321            3 => array(
322                'DISALLOWED_BEFORE' => '(?<![a-zA-Z0-9\$_\|\#>|^&\'"])',
323                'DISALLOWED_AFTER' => '(?=\()'
324                ),
325            4 => array(
326                'DISALLOWED_BEFORE' => '(?<![a-zA-Z0-9\$_\|\#>|^&\'"])',
327                'DISALLOWED_AFTER' => '(?=\()'
328                ),
329            5 => array(
330                'DISALLOWED_BEFORE' => '(?<![a-zA-Z0-9\$_\|\#>|^&\'"])',
331                'DISALLOWED_AFTER' => '(?![a-zA-Z0-9_\|%\\-&\'"])'
332                ),
333            6 => array(
334                'DISALLOWED_BEFORE' => '(?<![a-zA-Z0-9\$_\|\#;>|^&\'"])',
335                'DISALLOWED_AFTER' => '(?=\()'
336                ),
337            7 => array(
338                'DISALLOWED_BEFORE' => '(?<![a-zA-Z0-9\$_\|\#;>|^&\'"])',
339                'DISALLOWED_AFTER' => '(?![a-zA-Z0-9_\|%\\-&\'"])'
340                )
341            )
342        )
343);
344