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