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