1<?php
2/*************************************************************************************
3 * rust.php
4 * --------
5 * Author: Edward Hart (edward.dan.hart@gmail.com)
6 * Copyright: (c) 2013 Edward Hart
7 * Release Version: 1.0.9.1
8 * Date Started: 2013/10/20
9 *
10 * Rust language file for GeSHi.
11 *
12 * CHANGES
13 * -------
14 * 2014/03/18
15 *   -  Added support for raw strings
16 *   -  Color symbols
17 * 2013/10/20
18 *   -  First Release
19 *
20 * TODO (updated 2013/10/20)
21 * -------------------------
22 *
23 *************************************************************************************
24 *
25 *     This file is part of GeSHi.
26 *
27 *   GeSHi is free software; you can redistribute it and/or modify
28 *   it under the terms of the GNU General Public License as published by
29 *   the Free Software Foundation; either version 2 of the License, or
30 *   (at your option) any later version.
31 *
32 *   GeSHi is distributed in the hope that it will be useful,
33 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
34 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
35 *   GNU General Public License for more details.
36 *
37 *   You should have received a copy of the GNU General Public License
38 *   along with GeSHi; if not, write to the Free Software
39 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
40 *
41 ************************************************************************************/
42
43$language_data = array(
44    'LANG_NAME' => 'Rust',
45
46    'COMMENT_SINGLE' => array('//'),
47    'COMMENT_MULTI' => array('/*' => '*/'),
48    'COMMENT_REGEXP' => array(
49        // Raw strings
50        1 => '/\\br(\\#*)".*?"\\1/'
51        ),
52
53    'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
54    'QUOTEMARKS' => array("'", '"'),
55    'ESCAPE_CHAR' => '',
56    'ESCAPE_REGEXP' => array(
57        //Simple Single Char Escapes
58        1 => "#\\\\[\\\\nrt\'\"?\n]#i",
59        //Hexadecimal Char Specs
60        2 => "#\\\\x[\da-fA-F]{2}#",
61        //Hexadecimal Char Specs
62        3 => "#\\\\u[\da-fA-F]{4}#",
63        //Hexadecimal Char Specs
64        4 => "#\\\\U[\da-fA-F]{8}#",
65        //Octal Char Specs
66        5 => "#\\\\[0-7]{1,3}#"
67        ),
68    'NUMBERS' =>
69        GESHI_NUMBER_INT_BASIC | GESHI_NUMBER_INT_CSTYLE | GESHI_NUMBER_BIN_PREFIX_0B |
70        GESHI_NUMBER_HEX_PREFIX | GESHI_NUMBER_FLT_NONSCI |
71        GESHI_NUMBER_FLT_NONSCI_F | GESHI_NUMBER_FLT_SCI_SHORT | GESHI_NUMBER_FLT_SCI_ZERO,
72
73    'KEYWORDS' => array(
74        // Keywords
75        1 => array(
76            'alt', 'as', 'assert', 'break', 'const', 'continue', 'copy', 'do',
77            'else', 'enum', 'extern', 'fn', 'for', 'if',
78            'impl', 'in', 'let', 'log', 'loop', 'match', 'mod', 'mut', 'of',
79            'priv', 'pub', 'ref', 'return', 'self', 'static', 'struct', 'super',
80            'to', 'trait', 'type', 'unsafe', 'use', 'with', 'while'
81            ),
82        // Boolean values
83        2 => array( 'true', 'false' ),
84        // Structs and built-in types
85        3 => array(
86            'u8', 'i8',
87            'u16', 'i16',
88            'u32', 'i32',
89            'u64', 'i64',
90            'f32', 'f64',
91            'int', 'uint',
92            'float',
93            'bool',
94            'str', 'char',
95            'Argument', 'AsyncWatcher', 'BorrowRecord', 'BufReader',
96            'BufWriter', 'BufferedReader', 'BufferedStream', 'BufferedWriter',
97            'ByRef', 'ByteIterator', 'CFile', 'CString', 'CStringIterator',
98            'Cell', 'Chain', 'Chan', 'ChanOne', 'CharIterator',
99            'CharOffsetIterator', 'CharRange', 'CharSplitIterator',
100            'CharSplitNIterator', 'ChunkIter', 'Condition', 'ConnectRequest',
101            'Coroutine', 'Counter', 'CrateMap', 'Cycle', 'DeflateWriter',
102            'Display', 'ElementSwaps', 'Enumerate', 'Exp', 'Exp1', 'FileDesc',
103            'FileReader', 'FileStat', 'FileStream', 'FileWriter', 'Filter',
104            'FilterMap', 'FlatMap', 'FormatSpec', 'Formatter', 'FsRequest',
105            'Fuse', 'GarbageCollector', 'GetAddrInfoRequest', 'Handle',
106            'HashMap', 'HashMapIterator', 'HashMapMoveIterator',
107            'HashMapMutIterator', 'HashSet', 'HashSetIterator',
108            'HashSetMoveIterator', 'Hint', 'IdleWatcher', 'InflateReader',
109            'Info', 'Inspect', 'Invert', 'IoError', 'Isaac64Rng', 'IsaacRng',
110            'LineBufferedWriter', 'Listener', 'LocalHeap', 'LocalStorage',
111            'Loop', 'Map', 'MatchesIndexIterator', 'MemReader', 'MemWriter',
112            'MemoryMap', 'ModEntry', 'MoveIterator', 'MovePtrAdaptor',
113            'MoveRevIterator', 'NoOpRunnable', 'NonCopyable', 'Normal',
114            'OSRng', 'OptionIterator', 'Parser', 'Path', 'Peekable',
115            'Permutations', 'Pipe', 'PipeStream', 'PluralArm', 'Port',
116            'PortOne', 'Process', 'ProcessConfig', 'ProcessOptions',
117            'ProcessOutput', 'RC', 'RSplitIterator', 'RandSample', 'Range',
118            'RangeInclusive', 'RangeStep', 'RangeStepInclusive', 'Rc', 'RcMut',
119            'ReaderRng', 'Repeat', 'ReprVisitor', 'RequestData',
120            'ReseedWithDefault', 'ReseedingRng', 'Scan', 'SchedOpts',
121            'SelectArm', 'SharedChan', 'SharedPort', 'SignalWatcher',
122            'SipState', 'Skip', 'SkipWhile', 'SocketAddr', 'SplitIterator',
123            'StackPool', 'StackSegment', 'StandardNormal', 'StdErrLogger',
124            'StdIn', 'StdOut', 'StdReader', 'StdRng', 'StdWriter',
125            'StrSplitIterator', 'StreamWatcher', 'TTY', 'Take', 'TakeWhile',
126            'Task', 'TaskBuilder', 'TaskOpts', 'TcpAcceptor', 'TcpListener',
127            'TcpStream', 'TcpWatcher', 'Timer', 'TimerWatcher', 'TrieMap',
128            'TrieMapIterator', 'TrieSet', 'TrieSetIterator', 'Tube',
129            'UdpSendRequest', 'UdpSocket', 'UdpStream', 'UdpWatcher', 'Unfold',
130            'UnixAcceptor', 'UnixListener', 'UnixStream', 'Unwinder',
131            'UvAddrInfo', 'UvError', 'UvEventLoop', 'UvFileStream',
132            'UvIoFactory', 'UvPausibleIdleCallback', 'UvPipeStream',
133            'UvProcess', 'UvRemoteCallback', 'UvSignal', 'UvTTY',
134            'UvTcpAcceptor', 'UvTcpListener', 'UvTcpStream', 'UvTimer',
135            'UvUdpSocket', 'UvUnboundPipe', 'UvUnixAcceptor', 'UvUnixListener',
136            'VecIterator', 'VecMutIterator', 'Weighted', 'WeightedChoice',
137            'WindowIter', 'WriteRequest', 'XorShiftRng', 'Zip', 'addrinfo',
138            'uv_buf_t', 'uv_err_data', 'uv_process_options_t', 'uv_stat_t',
139            'uv_stdio_container_t', 'uv_timespec_t'
140            ),
141        // Enums
142        4 => array(
143            'Alignment', 'Count', 'Either', 'ExponentFormat', 'FPCategory',
144            'FileAccess', 'FileMode', 'Flag', 'IoErrorKind', 'IpAddr',
145            'KeyValue', 'MapError', 'MapOption', 'MemoryMapKind', 'Method',
146            'NullByteResolution', 'Option', 'Ordering', 'PathPrefix', 'Piece',
147            'PluralKeyword', 'Position', 'Protocol', 'Result', 'SchedHome',
148            'SchedMode', 'SeekStyle', 'SendStr', 'SignFormat',
149            'SignificantDigits', 'Signum', 'SocketType', 'StdioContainer',
150            'TaskResult', 'TaskType', 'UvSocketAddr', 'Void', 'uv_handle_type',
151            'uv_membership', 'uv_req_type'
152            )
153        ),
154    'SYMBOLS' => array(
155        '(', ')', '{', '}', '[', ']',
156        '+', '-', '*', '/', '%',
157        '&', '|', '^', '!', '<', '>', '~', '@',
158        ':',
159        ';', ',',
160        '='
161        ),
162
163    'CASE_SENSITIVE' => array(
164        GESHI_COMMENTS => false,
165        1 => true,
166        2 => true,
167        3 => true,
168        4 => true
169        ),
170
171    'STYLES' => array(
172        'KEYWORDS' => array(
173            1 => 'color: #708;',
174            2 => 'color: #219;',
175            3 => 'color: #05a;',
176            4 => 'color: #800;'
177            ),
178        'COMMENTS' => array(
179            0 => 'color: #a50; font-style: italic;',
180            1 => 'color: #a11;',
181            'MULTI' => 'color: #a50; font-style: italic;'
182            ),
183        'ESCAPE_CHAR' => array(
184            0 => 'color: #000099; font-weight: bold;',
185            1 => 'color: #000099; font-weight: bold;',
186            2 => 'color: #660099; font-weight: bold;',
187            3 => 'color: #660099; font-weight: bold;',
188            4 => 'color: #660099; font-weight: bold;',
189            5 => 'color: #006699; font-weight: bold;',
190            'HARD' => ''
191            ),
192        'STRINGS' => array(
193            0 => 'color: #a11;'
194            ),
195        'NUMBERS' => array(
196            0 => 'color: #0000dd;',
197            GESHI_NUMBER_BIN_PREFIX_0B => 'color: #208080;',
198            GESHI_NUMBER_OCT_PREFIX => 'color: #208080;',
199            GESHI_NUMBER_HEX_PREFIX => 'color: #208080;',
200            GESHI_NUMBER_FLT_SCI_SHORT => 'color:#800080;',
201            GESHI_NUMBER_FLT_SCI_ZERO => 'color:#800080;',
202            GESHI_NUMBER_FLT_NONSCI_F => 'color:#800080;',
203            GESHI_NUMBER_FLT_NONSCI => 'color:#800080;'
204            ),
205        'BRACKETS' => array(''),
206        'METHODS' => array(
207            1 => 'color: #164;'
208            ),
209        'SYMBOLS' => array(
210            0 => 'color: #339933;'
211            ),
212        'REGEXPS' => array(
213            ),
214        'SCRIPT' => array(
215            )
216        ),
217    'URLS' => array(
218        1 => '',
219        2 => '',
220        3 => '',
221        4 => ''
222        ),
223    'OOLANG' => true,
224    'OBJECT_SPLITTERS' => array(
225        1 => '::'
226        ),
227    'REGEXPS' => array(
228        ),
229    'STRICT_MODE_APPLIES' => GESHI_NEVER,
230    'SCRIPT_DELIMITERS' => array(
231        ),
232    'HIGHLIGHT_STRICT_BLOCK' => array(
233        ),
234    'TAB_WIDTH' => 4
235);
236