1<?php
2/*************************************************************************************
3 * llvm.php
4 * --------
5 * Author: Benny Baumann (BenBE@geshi.org), Azriel Fasten (azriel.fasten@gmail.com)
6 * Copyright: (c) 2010 Benny Baumann (http://qbnz.com/highlighter/), Azriel Fasten (azriel.fasten@gmail.com)
7 * Release Version: 1.0.9.1
8 * Date Started: 2010/10/14
9 *
10 * LLVM language file for GeSHi.
11 *
12 * CHANGES
13 * -------
14 * 2010/10/14 (1.0.8.10)
15 *  -  First Release
16 *
17 * TODO (updated 2010/10/14)
18 * -------------------------
19 * * Check if all links aren't broken
20 *
21 *************************************************************************************
22 *
23 *     This file is part of GeSHi.
24 *
25 *   GeSHi is free software; you can redistribute it and/or modify
26 *   it under the terms of the GNU General Public License as published by
27 *   the Free Software Foundation; either version 2 of the License, or
28 *   (at your option) any later version.
29 *
30 *   GeSHi is distributed in the hope that it will be useful,
31 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
32 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
33 *   GNU General Public License for more details.
34 *
35 *   You should have received a copy of the GNU General Public License
36 *   along with GeSHi; if not, write to the Free Software
37 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
38 *
39 ************************************************************************************/
40
41$language_data = array(
42    'LANG_NAME' => 'LLVM Intermediate Representation',
43    'COMMENT_SINGLE' => array(1 => ';'),
44    'COMMENT_MULTI' => array(),
45    'HARDQUOTE' => array("\"", "\""),
46    'HARDESCAPE' => array("\"", "\\"),
47    'HARDCHAR' => "\\",
48    'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
49    'QUOTEMARKS' => array('"'),
50    'ESCAPE_CHAR' => '',
51    'ESCAPE_REGEXP' => array(
52        //Simple Single Char Escapes
53        // 1 => "#\\\\[nfrtv\$\"\n\\\\]#i",
54        //Hexadecimal Char Specs
55        // 2 => "#\\\\x[\da-fA-F]{1,2}#i",
56        //Octal Char Specs
57        // 3 => "#\\\\[0-7]{1,3}#",
58        //String Parsing of Variable Names
59        // 4 => "#\\$[a-z0-9_]+(?:\\[[a-z0-9_]+\\]|->[a-z0-9_]+)?|(?:\\{\\$|\\$\\{)[a-z0-9_]+(?:\\[('?)[a-z0-9_]*\\1\\]|->[a-z0-9_]+)*\\}#i",
60        //Experimental extension supporting cascaded {${$var}} syntax
61        // 5 => "#\$[a-z0-9_]+(?:\[[a-z0-9_]+\]|->[a-z0-9_]+)?|(?:\{\$|\$\{)[a-z0-9_]+(?:\[('?)[a-z0-9_]*\\1\]|->[a-z0-9_]+)*\}|\{\$(?R)\}#i",
62        //Format String support in ""-Strings
63        // 6 => "#%(?:%|(?:\d+\\\\\\\$)?\\+?(?:\x20|0|'.)?-?(?:\d+|\\*)?(?:\.\d+)?[bcdefFosuxX])#"
64        ),
65    'NUMBERS' =>
66    GESHI_NUMBER_INT_BASIC | GESHI_NUMBER_HEX_PREFIX | GESHI_NUMBER_FLT_SCI_ZERO,
67    'KEYWORDS' => array(
68        0 => array(
69            'to', 'nuw', 'nsw', 'inbounds', 'entry', 'return'
70            ),
71        //Terminator Instructions
72        1 => array(
73            'ret', 'br', 'switch', 'indirectbr', 'invoke', 'resume', 'catchswitch', 'catchret', 'cleanupret', 'unreachable'
74            ),
75        //Binary Operations
76        2 => array(
77            'add', 'fadd', 'sub', 'fsub', 'mul', 'fmul', 'udiv', 'sdiv', 'fdiv', 'urem', 'srem', 'frem'
78            ),
79        //Bitwise Binary Operations
80        3 => array(
81            'shl', 'lshr', 'ashr', 'and', 'or', 'xor'
82            ),
83        //Vector Operations
84        4 => array(
85            'extractelement', 'insertelement', 'shufflevector'
86            ),
87        //Aggregate Operations
88        5 => array(
89            'extractvalue', 'insertvalue'
90            ),
91        //Memory Access and Addressing Operations
92        6 => array(
93            'alloca', 'load', 'store', 'fence', 'cmpxchg', 'atomicrmw', 'getelementptr'
94            ),
95        //Conversion Operations
96        7 => array(
97            'trunc', 'zext', 'sext', 'fptrunc', 'fpext', 'fptoui', 'fptosi', 'uitofp', 'sitofp',
98            'ptrtoint', 'inttoptr', 'bitcast', 'addrspacecast'
99            ),
100        //Other Operations
101        8 => array(
102            'icmp', 'fcmp', 'phi', 'select', 'call', 'va_arg', 'landingpad', 'catchpad', 'cleanuppad'
103            ),
104        //Linkage Types
105        9 => array(
106            'private', 'internal', 'available_externally', 'linkonce', 'weak', 'common', 'appending',
107            'extern_weak', 'linkonce_odr', 'weak_odr', 'external'
108            ),
109        //Calling Conventions
110        10 => array(
111            'ccc', 'fastcc', 'coldcc', 'cc 10', 'cc 11', 'webkit_jscc', 'anyregcc', 'preserve_mostcc',
112            'preserve_allcc', 'cxx_fast_tlscc', 'swiftcc', 'cc'
113            ),
114        //Structure Types
115        11 => array(
116            'type'
117            ),
118        //Parameter Attributes
119        12 => array(
120            'zeroext', 'signext', 'inreg', 'byval', 'inalloca', 'sret', 'align', 'noalias', 'nocapture', 'nest',
121            'returned', 'nonnull', 'dereferenceable', 'dereferenceable_or_null', 'swiftself', 'swifterror'
122            ),
123        //Function Attributes
124        13 => array(
125            'alignstack', 'allocsize', 'alwaysinline', 'builtin', 'cold', 'convergent', 'inaccessiblememonly',
126            'inaccessiblemem_or_argmemonly', 'inlinehint', 'jumptable', 'minsize', 'naked', 'nobuiltin', 'noduplicate',
127            'noimplicitfloat', 'noinline', 'nonlazybind', 'noredzone', 'noreturn', 'norecurse', 'nounwind',
128            'optnone', 'optsize', 'patchable-function', 'readnone', 'readonly', 'writeonly', 'argmemonly',
129            'returns_twice', 'safestack', 'sanitize_address', 'sanitize_memory', 'sanitize_thread', 'ssp',
130            'sspreq', 'sspstrong', 'thunk', 'uwtable'
131            ),
132        //Module-Level Inline Assembly
133        14 => array(
134            'module asm'
135            ),
136        //Data Layout
137        15 => array(
138            'target datalayout'
139            ),
140        //Type System
141        16 => array(
142            'x86_mmx',
143            'void',
144            'label',
145            'metadata',
146            'opaque'
147            ),
148        //Floating Point Types
149        17 => array(
150            'half', 'float', 'double', 'fp128', 'x86_fp80', 'ppc_fp128',
151            ),
152        //Simple Constants
153        18 => array(
154            'false', 'true', 'null'
155            ),
156        //Global Variable
157        19 => array(
158            'global', 'addrspace', 'constant', 'section'
159            ),
160        //Functions
161        20 => array(
162            'declare', 'define'
163            ),
164        //Complex Constants
165        21 => array(
166            'zeroinitializer'
167            ),
168        //Undefined Values
169        22 => array(
170            'undef'
171            ),
172        //Addresses of Basic Blocks
173        23 => array(
174            'blockaddress'
175            ),
176        //Visibility Styles
177        24 => array(
178            'default', 'hidden', 'protected'
179            ),
180        //Volatile Memory Accesses
181        25 => array(
182            'volatile'
183            ),
184        26 => array(
185            'tail'
186            ),
187        ),
188    'SYMBOLS' => array(
189        0 => array(
190            '(', ')', '[', ']', '{', '}',
191            '!', '@', '%', '&', '|', '/',
192            '<', '>',
193            '=', '-', '+', '*',
194            '.', ':', ',', ';'
195            )
196        ),
197    'CASE_SENSITIVE' => array(
198        GESHI_COMMENTS => false,
199        1 => true,
200        2 => true,
201        3 => true,
202        4 => true,
203        5 => true,
204        6 => true,
205        7 => true,
206        8 => true,
207        9 => true,
208        10 => true,
209        11 => true,
210        12 => true,
211        13 => true,
212        14 => true,
213        15 => true,
214        16 => true,
215        17 => true,
216        18 => true,
217        19 => true,
218        20 => true,
219        21 => true,
220        22 => true,
221        23 => true,
222        24 => true,
223        25 => true,
224        26 => true,
225        ),
226    'STYLES' => array(
227        'KEYWORDS' => array(
228            0 => 'color: #209090;',
229            1 => 'color: #0000F0;',
230            2 => 'color: #00F000; font-weight: bold;',
231            3 => 'color: #F00000;',
232            4 => 'color: #00F0F0; font-weight: bold;',
233            5 => 'color: #F000F0; font-weight: bold;',
234            6 => 'color: #403020; font-weight: bold;',
235            7 => 'color: #909090; font-weight: bold;',
236            8 => 'color: #009090; font-weight: bold;',
237            9 => 'color: #900090; font-weight: bold;',
238            10 => 'color: #909000; font-weight: bold;',
239            11 => 'color: #000090; font-weight: bold;',
240            12 => 'color: #900000; font-weight: bold;',
241            13 => 'color: #009000; font-weight: bold;',
242            14 => 'color: #F0F090; font-weight: bold;',
243            15 => 'color: #F090F0; font-weight: bold;',
244            16 => 'color: #90F0F0; font-weight: bold;',
245            17 => 'color: #9090F0; font-weight: bold;',
246            18 => 'color: #90F090; font-weight: bold;',
247            19 => 'color: #F09090; font-weight: bold;',
248            20 => 'color: #4040F0; font-weight: bold;',
249            21 => 'color: #40F040; font-weight: bold;',
250            22 => 'color: #F04040; font-weight: bold;',
251            23 => 'color: #F0F040; font-weight: bold;',
252            24 => 'color: #F040F0; font-weight: bold;',
253            25 => 'color: #40F0F0; font-weight: bold;',
254            26 => 'color: #904040; font-weight: bold;',
255            ),
256        'COMMENTS' => array(
257            1 => 'color: #666666; font-style: italic;',
258            'MULTI' => 'color: #666666; font-style: italic;'
259            ),
260        'ESCAPE_CHAR' => array(
261            0 => 'color: #000099; font-weight: bold;',
262            1 => 'color: #000099; font-weight: bold;',
263            2 => 'color: #660099; font-weight: bold;',
264            3 => 'color: #660099; font-weight: bold;',
265            4 => 'color: #006699; font-weight: bold;',
266            5 => 'color: #006699; font-weight: bold; font-style: italic;',
267            6 => 'color: #009933; font-weight: bold;',
268            'HARD' => 'color: #000099; font-weight: bold;'
269            ),
270        'BRACKETS' => array(
271            0 => 'color: #009900;'
272            ),
273        'STRINGS' => array(
274            0 => 'color: #0000ff;',
275            'HARD' => 'color: #0000ff;'
276            ),
277        'NUMBERS' => array(
278            0 => 'color: #cc66cc;',
279            GESHI_NUMBER_OCT_PREFIX => 'color: #208080;',
280            GESHI_NUMBER_HEX_PREFIX => 'color: #208080;',
281            GESHI_NUMBER_FLT_SCI_ZERO => 'color:#800080;',
282            ),
283        'METHODS' => array(
284            1 => 'color: #004000;',
285            2 => 'color: #004000;'
286            ),
287        'SYMBOLS' => array(
288            0 => 'color: #339933;',
289            ),
290        'REGEXPS' => array(
291            0 => 'color: #007088;',
292            1 => 'color: #007088;',
293            // 2 => 'color: #000088;',
294            3 => 'color: #700088;',
295            4 => 'color: #010088;',
296            // 5 => 'color: #610088;',
297            // 6 => 'color: #616088;',
298            // 7 => 'color: #616988;',
299            // 8 => 'color: #616908;',
300            9 => 'color: #6109F8;',
301            ),
302        'SCRIPT' => array(
303            0 => '',
304            1 => '',
305            2 => '',
306            3 => '',
307            4 => '',
308            5 => ''
309            )
310        ),
311    'URLS' => array(
312        0 => '',
313        1 => 'http://llvm.org/docs/LangRef.html#{FNAME}-instruction',
314        2 => 'http://llvm.org/docs/LangRef.html#{FNAME}-instruction',
315        3 => 'http://llvm.org/docs/LangRef.html#{FNAME}-instruction',
316        4 => 'http://llvm.org/docs/LangRef.html#{FNAME}-instruction',
317        5 => 'http://llvm.org/docs/LangRef.html#{FNAME}-instruction',
318        6 => 'http://llvm.org/docs/LangRef.html#{FNAME}-instruction',
319        7 => 'http://llvm.org/docs/LangRef.html#{FNAME}-instruction',
320        8 => 'http://llvm.org/docs/LangRef.html#{FNAME}-instruction',
321        9 => 'http://llvm.org/docs/LangRef.html#linkage-types',
322        10 => 'http://llvm.org/docs/LangRef.html#calling-conventions',
323        11 => 'http://llvm.org/docs/LangRef.html#opaque-structure-types',
324        12 => 'http://llvm.org/docs/LangRef.html#parameter-attributes',
325        13 => 'http://llvm.org/docs/LangRef.html#function-attributes',
326        14 => 'http://llvm.org/docs/LangRef.html#module-level-inline-assembly',
327        15 => 'http://llvm.org/docs/LangRef.html#data-layout',
328        16 => 'http://llvm.org/docs/LangRef.html#type-system',
329        17 => 'http://llvm.org/docs/LangRef.html#floating-point-types',
330        18 => 'http://llvm.org/docs/LangRef.html#simple-constants',
331        19 => 'http://llvm.org/docs/LangRef.html#global-variables',
332        20 => 'http://llvm.org/docs/LangRef.html#functions',
333        21 => 'http://llvm.org/docs/LangRef.html#complex-constants',
334        22 => 'http://llvm.org/docs/LangRef.html#undefined-values',
335        23 => 'http://llvm.org/docs/LangRef.html#addresses-of-basic-blocks',
336        24 => 'http://llvm.org/docs/LangRef.html#visibility-styles',
337        25 => 'http://llvm.org/docs/LangRef.html#volatile-memory-accesses',
338        26 => 'http://llvm.org/docs/LangRef.html#call-instruction',
339        ),
340    'OOLANG' => false,
341    'OBJECT_SPLITTERS' => array(
342        ),
343    'REGEXPS' => array(
344        //Variables
345        0 => '%[-a-zA-Z$\._][-a-zA-Z$\._0-9]*',
346        //Labels
347        // 1 => '[-a-zA-Z$\._0-9]+:',
348        1 => '(?<!\w)[\-\w\$\.]+:(?![^">]*<)',
349        //Strings
350        // 2 => '"[^"]+"',
351        //Unnamed variable slots
352        3 => '%[-]?[0-9]+',
353        //Integer Types
354        4 => array(
355            GESHI_SEARCH => '(?<!\w)i\d+(?!\w)',
356            GESHI_REPLACE => '\\0',
357            GESHI_MODIFIERS => '',
358            GESHI_BEFORE => '<a href="http://llvm.org/docs/LangRef.html#t_integer">',
359            GESHI_AFTER => '</a>'
360            ),
361        //Comments
362        // 5 => ';.*',
363        //Integer literals
364        // 6 => '\\b[-]?[0-9]+\\b',
365        //Floating point constants
366        // 7 => '\\b[-+]?[0-9]+\.[0-9]*\([eE][-+]?[0-9]+\)?\\b',
367        //Hex constants
368        // 8 => '\\b0x[0-9A-Fa-f]+\\b',
369        //Global variables
370        9 => array(
371            GESHI_SEARCH => '@[-a-zA-Z$\._][-a-zA-Z$\._0-9]*',
372            GESHI_REPLACE => '\\0',
373            GESHI_MODIFIERS => '',
374            GESHI_BEFORE => '<a href="http://llvm.org/docs/LangRef.html#globalvars">',
375            GESHI_AFTER => '</a>'
376            ),
377        ),
378    'STRICT_MODE_APPLIES' => GESHI_MAYBE,
379    'HIGHLIGHT_STRICT_BLOCK' => array(
380        0 => true,
381        1 => true,
382        2 => true,
383        3 => true,
384        4 => true,
385        5 => true
386        ),
387    'SCRIPT_DELIMITERS' => array(),
388    'TAB_WIDTH' => 4
389);
390