Home | History | Annotate | Download | only in geshi
      1 <?php
      2 /*************************************************************************************
      3  * c.php
      4  * -----
      5  * Author: Nigel McNie (nigel (at) geshi.org)
      6  * Contributors:
      7  *  - Jack Lloyd (lloyd (at) randombit.net)
      8  *  - Michael Mol (mikemol (at) gmail.com)
      9  * Copyright: (c) 2004 Nigel McNie (http://qbnz.com/highlighter/)
     10  * Release Version: 1.0.8.3
     11  * Date Started: 2004/06/04
     12  *
     13  * C language file for GeSHi.
     14  *
     15  * CHANGES
     16  * -------
     17  * 2009/01/22 (1.0.8.3)
     18  *   -  Made keywords case-sensitive.
     19  * 2008/05/23 (1.0.7.22)
     20  *   -  Added description of extra language features (SF#1970248)
     21  * 2004/XX/XX (1.0.4)
     22  *   -  Added a couple of new keywords (Jack Lloyd)
     23  * 2004/11/27 (1.0.3)
     24  *   -  Added support for multiple object splitters
     25  * 2004/10/27 (1.0.2)
     26  *   -  Added support for URLs
     27  * 2004/08/05 (1.0.1)
     28  *   -  Added support for symbols
     29  * 2004/07/14 (1.0.0)
     30  *   -  First Release
     31  *
     32  * TODO (updated 2009/02/08)
     33  * -------------------------
     34  *  -  Get a list of inbuilt functions to add (and explore C more
     35  *     to complete this rather bare language file
     36  *
     37  *************************************************************************************
     38  *
     39  *     This file is part of GeSHi.
     40  *
     41  *   GeSHi is free software; you can redistribute it and/or modify
     42  *   it under the terms of the GNU General Public License as published by
     43  *   the Free Software Foundation; either version 2 of the License, or
     44  *   (at your option) any later version.
     45  *
     46  *   GeSHi is distributed in the hope that it will be useful,
     47  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     48  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     49  *   GNU General Public License for more details.
     50  *
     51  *   You should have received a copy of the GNU General Public License
     52  *   along with GeSHi; if not, write to the Free Software
     53  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     54  *
     55  ************************************************************************************/
     56 
     57 $language_data = array (
     58     'LANG_NAME' => 'C',
     59     'COMMENT_SINGLE' => array(1 => '//', 2 => '#'),
     60     'COMMENT_MULTI' => array('/*' => '*/'),
     61     'COMMENT_REGEXP' => array(
     62         //Multiline-continued single-line comments
     63         1 => '/\/\/(?:\\\\\\\\|\\\\\\n|.)*$/m',
     64         //Multiline-continued preprocessor define
     65         2 => '/#(?:\\\\\\\\|\\\\\\n|.)*$/m'
     66         ),
     67     'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
     68     'QUOTEMARKS' => array("'", '"'),
     69     'ESCAPE_CHAR' => '',
     70     'ESCAPE_REGEXP' => array(
     71         //Simple Single Char Escapes
     72         1 => "#\\\\[abfnrtv\\'\"?\n]#i",
     73         //Hexadecimal Char Specs
     74         2 => "#\\\\x[\da-fA-F]{2}#",
     75         //Hexadecimal Char Specs
     76         3 => "#\\\\u[\da-fA-F]{4}#",
     77         //Hexadecimal Char Specs
     78         4 => "#\\\\U[\da-fA-F]{8}#",
     79         //Octal Char Specs
     80         5 => "#\\\\[0-7]{1,3}#"
     81         ),
     82     'NUMBERS' =>
     83         GESHI_NUMBER_INT_BASIC | GESHI_NUMBER_INT_CSTYLE | GESHI_NUMBER_BIN_PREFIX_0B |
     84         GESHI_NUMBER_OCT_PREFIX | GESHI_NUMBER_HEX_PREFIX | GESHI_NUMBER_FLT_NONSCI |
     85         GESHI_NUMBER_FLT_NONSCI_F | GESHI_NUMBER_FLT_SCI_SHORT | GESHI_NUMBER_FLT_SCI_ZERO,
     86     'KEYWORDS' => array(
     87         1 => array(
     88             'if', 'return', 'while', 'case', 'continue', 'default',
     89             'do', 'else', 'for', 'switch', 'goto'
     90             ),
     91         2 => array(
     92             'null', 'false', 'break', 'true', 'function', 'enum', 'extern', 'inline'
     93             ),
     94         3 => array(
     95             'printf', 'cout'
     96             ),
     97         4 => array(
     98             'auto', 'char', 'const', 'double',  'float', 'int', 'long',
     99             'register', 'short', 'signed', 'sizeof', 'static', 'string', 'struct',
    100             'typedef', 'union', 'unsigned', 'void', 'volatile', 'wchar_t'
    101             ),
    102         ),
    103     'SYMBOLS' => array(
    104         '(', ')', '{', '}', '[', ']',
    105         '+', '-', '*', '/', '%',
    106         '=', '<', '>',
    107         '!', '^', '&', '|',
    108         '?', ':',
    109         ';', ','
    110         ),
    111     'CASE_SENSITIVE' => array(
    112         GESHI_COMMENTS => false,
    113         1 => true,
    114         2 => true,
    115         3 => true,
    116         4 => true,
    117         ),
    118     'STYLES' => array(
    119         'KEYWORDS' => array(
    120             1 => 'color: #b1b100;',
    121             2 => 'color: #000000; font-weight: bold;',
    122             3 => 'color: #000066;',
    123             4 => 'color: #993333;'
    124             ),
    125         'COMMENTS' => array(
    126             1 => 'color: #666666; font-style: italic;',
    127             2 => 'color: #339933;',
    128             'MULTI' => 'color: #808080; font-style: italic;'
    129             ),
    130         'ESCAPE_CHAR' => array(
    131             0 => 'color: #000099; font-weight: bold;',
    132             1 => 'color: #000099; font-weight: bold;',
    133             2 => 'color: #660099; font-weight: bold;',
    134             3 => 'color: #660099; font-weight: bold;',
    135             4 => 'color: #660099; font-weight: bold;',
    136             5 => 'color: #006699; font-weight: bold;',
    137             'HARD' => '',
    138             ),
    139         'BRACKETS' => array(
    140             0 => 'color: #009900;'
    141             ),
    142         'STRINGS' => array(
    143             0 => 'color: #ff0000;'
    144             ),
    145         'NUMBERS' => array(
    146             0 => 'color: #0000dd;',
    147             GESHI_NUMBER_BIN_PREFIX_0B => 'color: #208080;',
    148             GESHI_NUMBER_OCT_PREFIX => 'color: #208080;',
    149             GESHI_NUMBER_HEX_PREFIX => 'color: #208080;',
    150             GESHI_NUMBER_FLT_SCI_SHORT => 'color:#800080;',
    151             GESHI_NUMBER_FLT_SCI_ZERO => 'color:#800080;',
    152             GESHI_NUMBER_FLT_NONSCI_F => 'color:#800080;',
    153             GESHI_NUMBER_FLT_NONSCI => 'color:#800080;'
    154             ),
    155         'METHODS' => array(
    156             1 => 'color: #202020;',
    157             2 => 'color: #202020;'
    158             ),
    159         'SYMBOLS' => array(
    160             0 => 'color: #339933;'
    161             ),
    162         'REGEXPS' => array(
    163             ),
    164         'SCRIPT' => array(
    165             )
    166         ),
    167     'URLS' => array(
    168         1 => '',
    169         2 => '',
    170         3 => 'http://www.opengroup.org/onlinepubs/009695399/functions/{FNAMEL}.html',
    171         4 => ''
    172         ),
    173     'OOLANG' => true,
    174     'OBJECT_SPLITTERS' => array(
    175         1 => '.',
    176         2 => '::'
    177         ),
    178     'REGEXPS' => array(
    179         ),
    180     'STRICT_MODE_APPLIES' => GESHI_NEVER,
    181     'SCRIPT_DELIMITERS' => array(
    182         ),
    183     'HIGHLIGHT_STRICT_BLOCK' => array(
    184         ),
    185     'TAB_WIDTH' => 4
    186 );
    187 
    188 ?>
    189