plugins/geshi/geshi/haskell.php
changeset 0 441963e5b07a
child 2 9e3258dfae15
equal deleted inserted replaced
-1:000000000000 0:441963e5b07a
       
     1 <?php
       
     2 /*************************************************************************************
       
     3  * haskell.php
       
     4  * ----------
       
     5  * Author: Jason Dagit (dagit@codersbase.com) based on ocaml.php by Flaie (fireflaie@gmail.com) 
       
     6  * Copyright: (c) 2005 Flaie, Nigel McNie (http://qbnz.com/highlighter)
       
     7  * Release Version: 1.0.7.20
       
     8  * CVS Revision Version: $Revision: 1.6 $
       
     9  * Date Started: 2005/08/27
       
    10  * Last Modified: $Date: 2006/02/25 00:46:33 $
       
    11  *
       
    12  * Haskell language file for GeSHi.
       
    13  *
       
    14  * CHANGES
       
    15  * -------
       
    16  * 2005/08/27 (1.0.0)
       
    17  *   -  First Release
       
    18  *
       
    19  * TODO (updated 2005/08/27)
       
    20  * -------------------------
       
    21  *
       
    22  *************************************************************************************
       
    23  *
       
    24  *   This file is part of GeSHi.
       
    25  *
       
    26  *   GeSHi is free software; you can redistribute it and/or modify
       
    27  *   it under the terms of the GNU General Public License as published by
       
    28  *   the Free Software Foundation; either version 2 of the License, or
       
    29  *   (at your option) any later version.
       
    30  *
       
    31  *   GeSHi is distributed in the hope that it will be useful,
       
    32  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    33  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    34  *   GNU General Public License for more details.
       
    35  *
       
    36  *   You should have received a copy of the GNU General Public License
       
    37  *   along with GeSHi; if not, write to the Free Software
       
    38  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    39  *
       
    40  ************************************************************************************/
       
    41 
       
    42 $language_data = array (
       
    43     'LANG_NAME' => 'Haskell',
       
    44     'COMMENT_SINGLE' => array( 1 => '--'),
       
    45     'COMMENT_MULTI' => array('{-' => '-}'),
       
    46     'CASE_KEYWORDS' => 0,
       
    47     'QUOTEMARKS' => array('"'),
       
    48     'ESCAPE_CHAR' => "\\",
       
    49     'KEYWORDS' => array(
       
    50        /* main haskell keywords */
       
    51         1 => array(
       
    52            'as',
       
    53            'case', 'of', 'class', 'data', 'default', 
       
    54            'deriving', 'do', 'forall', 'hiding', 'if', 'then',
       
    55            'else', 'import', 'infix', 'infixl', 'infixr', 
       
    56            'instance', 'let', 'in', 'module', 'newtype',
       
    57            'qualified', 'type', 'where'
       
    58             ),
       
    59         /* define names of main librarys, so we can link to it */
       
    60         2 => array(
       
    61            'Foreign', 'Numeric', 'Prelude'
       
    62            ),
       
    63         /* just link to Prelude functions, cause it's the default opened library when starting Haskell */
       
    64         3 => array(
       
    65            'not', 'otherwise', 'maybe', 
       
    66            'either', 'fst', 'snd', 'curry', 'uncurry',
       
    67            'compare', 
       
    68            'max', 'min', 'succ', 'pred', 'toEnum', 'fromEnum',
       
    69            'enumFrom', 'enumFromThen', 'enumFromTo', 
       
    70            'enumFromThenTo', 'minBound', 'maxBound',
       
    71            'negate', 'abs', 'signum',
       
    72            'fromInteger', 'toRational', 'quot', 'rem',
       
    73            'div', 'mod', 'quotRem', 'divMod', 'toInteger',
       
    74            'recip', 'fromRational', 'pi', 'exp',
       
    75            'log', 'sqrt', 'logBase', 'sin', 'cos',
       
    76            'tan', 'asin', 'acos', 'atan', 'sinh', 'cosh',
       
    77            'tanh', 'asinh', 'acosh', 'atanh',
       
    78            'properFraction', 'truncate', 'round', 'ceiling',
       
    79            'floor', 'floatRadix', 'floatDigits', 'floatRange',
       
    80            'decodeFloat', 'encodeFloat', 'exponent',
       
    81            'significand', 'scaleFloat', 'isNaN', 'isInfinite',
       
    82            'isDenomalized', 'isNegativeZero', 'isIEEE',
       
    83            'atan2', 'subtract', 'even', 'odd', 'gcd',
       
    84            'lcm', 'fromIntegral', 'realToFrac',
       
    85            'return', 'fail', 'fmap',
       
    86            'mapM', 'mapM_', 'sequence', 'sequence_',
       
    87            'id', 'const','flip',
       
    88            'until', 'asTypeOf', 'error', 'undefined',
       
    89            'seq','map','filter', 'head',
       
    90            'last', 'tail', 'init', 'null', 'length',
       
    91            'reverse', 'foldl', 'foldl1', 'foldr',
       
    92            'foldr1', 'and', 'or', 'any', 'all', 'sum',
       
    93            'product', 'concat', 'concatMap', 'maximum',
       
    94            'minimum', 'scanl', 'scanl1', 'scanr', 'scanr1',
       
    95            'iterate', 'repeat', 'cycle', 'take', 'drop',
       
    96            'splitAt', 'teakWhile', 'dropWhile', 'span',
       
    97            'break', 'elem', 'notElem', 'lookup', 'zip',
       
    98            'zip3', 'zipWith', 'zipWith3', 'unzip', 'unzip3',
       
    99            'unzip', 'unzip3', 'lines', 'words', 'unlines',
       
   100            'unwords', 'showPrec', 'show', 'showList',
       
   101            'shows', 'showChar', 'showString', 'showParen',
       
   102            'readsPrec', 'readList', 'reads', 'readParen',
       
   103            'read', 'lex', 'putChar', 'putStr', 'putStrLn',
       
   104            'print', 'getChar', 'getLine', 'getContents',
       
   105            'interact', 'readFile', 'writeFile', 'appendFile',
       
   106            'readIO', 'readLn', 'ioError', 'userError', 'catch'
       
   107            ),
       
   108         /* here Prelude Types */
       
   109         4 => array (
       
   110             'Bool', 'Maybe', 'Either', 'Ord', 'Ordering', 
       
   111             'Char', 'String', 'Eq', 'Enum', 'Bounded', 
       
   112             'Int', 'Integer', 'Float', 'Double', 'Rational',
       
   113             'Num', 'Real', 'Integral', 'Fractional', 
       
   114             'Floating', 'RealFrac', 'RealFloat', 'Monad',
       
   115             'Functor', 'Show', 'ShowS', 'Read', 'ReadS', 
       
   116             'IO'
       
   117            ),
       
   118         /* finally Prelude Exceptions */
       
   119         5 => array (
       
   120             'IOError', 'IOException'
       
   121             )
       
   122         ),
       
   123     /* highlighting symbols is really important in Haskell */
       
   124     'SYMBOLS' => array(
       
   125            '|', '->', '<-', '@', '!', '::', '_', '~', '=',
       
   126            '&&', '||', '==', '/=', '<', '<=', '>', 
       
   127            '>=','+', '-', '*','/',  '**', '^', '^^', 
       
   128            '>>=', '>>', '=<<',  '$', '.',  '$!',  
       
   129            '++', '!!'
       
   130             ), 
       
   131     'CASE_SENSITIVE' => array(
       
   132         GESHI_COMMENTS => true,
       
   133         1 => true,
       
   134         2 => true, /* functions name are case seinsitive */
       
   135         3 => true, /* types name too */
       
   136         4 => true, /* finally exceptions too */
       
   137         5 => true
       
   138         ),
       
   139     'STYLES' => array(
       
   140         'KEYWORDS' => array(
       
   141             1 => 'color: #06c; font-weight: bold;', /* nice blue */
       
   142             2 => 'color: #06c; font-weight: bold;', /* blue as well */
       
   143             3 => 'font-weight: bold;', /* make the preduled functions bold */
       
   144             4 => 'color: #cccc00; font-weight: bold;', /* give types a different bg */
       
   145             5 => 'color: maroon;'
       
   146             ),
       
   147         'COMMENTS' => array(
       
   148             1 => 'color: #5d478b; font-style: italic;',
       
   149             'MULTI' => 'color: #5d478b; font-style: italic;' /* light purpHle */
       
   150             ),
       
   151         'ESCAPE_CHAR' => array(
       
   152             ),
       
   153         'BRACKETS' => array(
       
   154             0 => 'color: green;'
       
   155             ),
       
   156         'STRINGS' => array(
       
   157             0 => 'background-color: #3cb371;' /* nice green */
       
   158             ),
       
   159         'NUMBERS' => array(
       
   160             0 => 'color: red;' /* pink */
       
   161             ),
       
   162         'METHODS' => array(
       
   163             1 => 'color: #060;' /* dark green */
       
   164             ),
       
   165         'REGEXPS' => array(
       
   166             ),
       
   167         'SYMBOLS' => array( 
       
   168             0 => 'color: #66cc66; font-weight: bold;'
       
   169             ),
       
   170         'SCRIPT' => array(
       
   171             )
       
   172         ),
       
   173     'URLS' => array(
       
   174         /* some of keywords are Prelude functions */
       
   175         1 => '',
       
   176         /* link to the wanted library */
       
   177         2 => 'http://haskell.org/ghc/docs/latest/html/libraries/base/{FNAME}.html',
       
   178         /* link to Prelude functions */
       
   179         3 => 'http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:{FNAME}', 
       
   180         /* link to Prelude types */
       
   181         4 => 'http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:{FNAME}', 
       
   182         /* link to Prelude exceptions */
       
   183         5 => 'http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:{FNAME}', 
       
   184         ),
       
   185     'OOLANG' => false,
       
   186     'OBJECT_SPLITTERS' => array(
       
   187         ),
       
   188     'REGEXPS' => array(
       
   189         ),
       
   190     'STRICT_MODE_APPLIES' => GESHI_NEVER,
       
   191     'SCRIPT_DELIMITERS' => array(
       
   192         ),
       
   193     'HIGHLIGHT_STRICT_BLOCK' => array(
       
   194         )
       
   195 );
       
   196 
       
   197 ?>