summaryrefslogtreecommitdiff
path: root/sheets/haskell.ssh
blob: c8094225c1875690c951cdaf48d8e00f8cc72754 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# a2ps style sheet for Haskell
# Copyright (c) 1999-2000 Ilya Beylin, Akim Demaille, Miguel Santana

# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING.  If not, write to
# the Free Software Foundation, 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

# this file:	ftp://ftp.cs.chalmers.se/pub/users/ilya/a2ps/haskell.ssh
# Haskell	http://www.haskell.org/
# a2ps    	http://www.infres.enst.fr/~demaille/a2ps/
# GNU GPL  	http://www.gnu.org/copyleft/gpl.html

style Haskell is
written by "Ilya Beylin <ilya@cs.chalmers.se>"
version is 1.3
requires a2ps 4.12k


documentation is
"Haskell: non-strict functional programming language"
"  http::/www.haskell.org/"

#Notes:
#- Haskell strings are not parsed properly. C-strings are used instead
#- maximal-munch rule is not followed in examples like ::: or ---
#- Only 7bit characters are recognised in places like operator names
#- literal Haskell (inverted commentary) is not at all supported

# Perhaps one should instead write a proper Haskell parser which would
# produce PreTeX

# A typical "sheets.map" entry:
# 	# Haskell programs
# 	*.hs                    haskell
end documentation

first alphabet is
   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
second alphabet is
   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_\'0123456789"
case sensitive

keywords in Keyword_strong are
    # the keywords of Haskell 98
    "case", "class", "data", "default", "deriving", "do", "else",
    "if", "import", "in", "infix", "infixl", "infixr", "instance",
    "let", "module", "newtype", "of", "then", "type", "where",
#   "_", "as",                # these should not be highlighted
    "qualified", "hiding"     # special words (not reserved)
end keywords

keywords in Keyword are
  # Constructors
  /A-Z[a-zA-z0-9\'_]*/
end keywords

operators  in Keyword_strong are
  /->/, "[", "]",/`[a-zA-z0-9\'_]+`/,
  # Constructor operators
  /:[-!@#$%^&*+<>\/?\\=|:]*/,
  # type signatures
  (/^[a-z][a-zA-Z0-9\'_, ]*::.*$/  Comment_strong)
end operators

# use symbol font with -g
optional operators are
   # does not look nice, and cannot be not protected
   #/\\\\/ \lambda,
   /->/ \rightarrow,
   /<-/ \leftarrow,
   /=>/ \Rightarrow,
   /\/=/ \neq,
   /<=/ \leq,
   />=/ \geq,
   "::" \in
end operators

operators are
  /[-!@#$%^&*+<>\/?\\=|]{3,}/
end operators

sequences are
  # preprocessor directives
  /^#/  Comment_strong,
  "{-" Comment Comment "-}" Comment,
  "--" Comment,
  "{-#" Comment_strong Comment_strong "-}" Comment_strong,
  C-string  # not quite, but actual syntax is too involved
end sequences

end style