1<?php
2/*************************************************************************************
3 * ceylon.php
4 * ----------
5 * Author: Lucas Werkmeister (mail@lucaswerkmeister.de)
6 * Copyright: (c) 2015 Lucas Werkmeister (http://lucaswerkmeister.de)
7 * Release Version: 1.0.9.1
8 * Date Started: 2015-01-08
9 *
10 * Ceylon language file for GeSHi.
11 *
12 * CHANGES
13 * -------
14 *
15 * TODO (updated 2015-06-19)
16 * ------------------
17 * * Regexes match and break help URLs, so those are commented out for now
18 * * Ceylon supports nested block comments
19 * * The Ceylon compiler correctly parses
20 *       "\{FICTITIOUS CHARACTER WITH " IN NAME}"
21 *   as a single string literal.
22 *   (However, that's not really important
23 *   since Unicode character names never contain quotes.)
24 *
25 *************************************************************************************
26 *
27 *     This file is part of GeSHi.
28 *
29 *   GeSHi is free software; you can redistribute it and/or modify
30 *   it under the terms of the GNU General Public License as published by
31 *   the Free Software Foundation; either version 2 of the License, or
32 *   (at your option) any later version.
33 *
34 *   GeSHi is distributed in the hope that it will be useful,
35 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
36 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
37 *   GNU General Public License for more details.
38 *
39 *   You should have received a copy of the GNU General Public License
40 *   along with GeSHi; if not, write to the Free Software
41 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
42 *
43 ************************************************************************************/
44
45$language_data = array (
46    'LANG_NAME' => 'Ceylon',
47    'COMMENT_SINGLE' => array(1 => '//', 2 => '#!'),
48    'COMMENT_MULTI' => array('/*' => '*/'),
49    'COMMENT_REGEXP' => array(
50        /*
51         * 1. regular line comments (see COMMENT_SINGLE)
52         * 2. shebang line comments (see COMMENT_SINGLE)
53         * 3. strings (including string templates)
54         */
55        3 => '/(?:"|``).*?(?:``|")/'
56    ),
57    'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
58    'QUOTEMARKS' => array("'"),
59    'ESCAPE_CHAR' => '\\',
60    'KEYWORDS' => array(
61        /*
62         * 1. lexer keywords (class, else, etc.)
63         * 2. language modifiers (shared, formal, etc.)
64         * 3. language doc modifiers (doc, see, etc.)
65         */
66        1 => array(
67            'assembly', 'module', 'package', 'import',
68            'alias', 'class', 'interface', 'object', 'given',
69            'value', 'assign', 'void', 'function',
70            'new', 'of', 'extends', 'satisfies', 'abstracts',
71            'in', 'out',
72            'return', 'break', 'continue', 'throw', 'assert',
73            'dynamic',
74            'if', 'else', 'switch', 'case',
75            'for', 'while', 'try', 'catch', 'finally',
76            'then', 'let',
77            'this', 'outer', 'super',
78            'is', 'exists', 'nonempty'
79        ),
80        2 => array(
81            'shared', 'abstract', 'formal', 'default', 'actual',
82            'variable', 'late', 'native', 'deprecated',
83            'final', 'sealed', 'annotation', 'small'
84        ),
85        3 => array(
86            'doc', 'by', 'license', 'see', 'throws', 'tagged'
87        )
88    ),
89    'SYMBOLS' => array(
90        ',', ';', '...', '{', '}', '[', ']', '`', '?.', '*.',
91        '?', '-&gt;', '=&gt;',
92        '**', '++', '--', '..', ':', '&&', '||',
93        '+=', '-=', '*=', '/=', '%=', '|=', '&=', '~=', '||=', '&&=',
94        '+', '-', '*', '/', '%', '^',
95        '~', '&', '|', '===', '==', '=', '!=', '!',
96        '&lt;=&gt;', '&lt;=', '&gt;=',
97        '&lt;', '&gt;',
98        '.'
99    ),
100    'STYLES' => array(
101        'KEYWORDS' => array(
102            1 => 'font-weight:bold;color:#4C4C4C;',
103            2 => 'color:#39C',
104            3 => 'color:#39C'
105        ),
106        'COMMENTS' => array(
107            1 => 'color:darkgray;',
108            2 => 'color:darkgray;',
109            3 => 'color:blue',
110            'MULTI' => 'color:darkgray;'
111        ),
112        'STRINGS' => array(
113            0 => 'color:blue;'
114        ),
115        'REGEXPS' => array(
116            1 => 'color:#639;',
117            2 => 'color:#039;',
118            3 => 'color:#906;'
119        ),
120        'ESCAPE_CHAR' => array(),
121        'BRACKETS' => array(),
122        'NUMBERS' => array(),
123        'METHODS' => array(),
124        'SYMBOLS' => array(),
125        'SCRIPT' => array()
126    ),
127    'REGEXPS' => array(
128        /*
129         * 1. qualified lidentifiers
130         * 2. lidentifiers
131         * 3. uidentifiers
132         *
133         * All of these contain various lookahead and -behind to ensure
134         * that we don't match various stuff that GeSHi escapes
135         * (for instance, we see semicolons as <SEMI>).
136         */
137        1 => array(
138            GESHI_SEARCH => '\\b((\?|\*)?\.[[:space:]]*)([[:lower:]][[:alnum:]]*|\\\\i[[:alnum:]]*)\\b',
139            GESHI_REPLACE => '\\3',
140            GESHI_MODIFIERS => '',
141            GESHI_BEFORE => '\\1',
142            GESHI_AFTER => ''
143        ),
144        2 => array(
145            GESHI_SEARCH => '(?<![|<>&![:alnum:]])([[:lower:]][[:alnum:]]*|\\\\i[[:alnum:]]*)(?![>[:alnum:]])',
146            GESHI_REPLACE => '\\1',
147            GESHI_MODIFIERS => '',
148            GESHI_BEFORE => '',
149            GESHI_AFTER => ''
150        ),
151        3 => array(
152            GESHI_SEARCH => '(?<![|<>&![:alnum:]])([[:upper:]][[:alnum:]]*|\\\\I[[:alnum:]]*)(?![>[:alnum:]])',
153            GESHI_REPLACE => '\\1',
154            GESHI_MODIFIERS => '',
155            GESHI_BEFORE => '',
156            GESHI_AFTER => ''
157        )
158    ),
159    'OOLANG' => false,
160    'OBJECT_SPLITTERS' => array(),
161    'URLS' => array(
162        1 => '',
163        2 => '', 3 => '' // the real URLs are commented out because syntax highlighting breaks them
164//      2 => 'https://modules.ceylon-lang.org/repo/1/ceylon/language/1.1.0/module-doc/api/index.html#{FNAME}',
165//      3 => 'https://modules.ceylon-lang.org/repo/1/ceylon/language/1.1.0/module-doc/api/index.html#{FNAME}',
166    ),
167    'CASE_SENSITIVE' => array(1 => true, 2 => true, 3 => true),
168    'STRICT_MODE_APPLIES' => GESHI_NEVER,
169    'SCRIPT_DELIMITERS' => array(),
170    'HIGHLIGHT_STRICT_BLOCK' => array()
171);
172