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
103
104
105
106
107
108
|
# Style sheet for stratego
# Copyright (c) 2002 Nicolas Tisserand
#
#
# This file is part of a2ps.
#
# This program 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 style sheet is based on the stratego grammar :
# http://www.cwi.nl/~mdejonge/grammar-base/stratego.0.7/index.html
#
style "stratego" is
written by "Nicolas Tisserand <tisser_n@lrde.epita.fr>"
version is 1.0
requires a2ps 4.9.5
documentation is
"Highlights stratego source code"
end documentation
first alphabet is
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.-_"
second alphabet is
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'.-_'"
case sensitive
keywords in Keyword_strong are
"all", "constructors", "fail", "id", "imports", "in", "let", "module",
"not", "one", "overlays", "override", "prim", "rules", "script",
"signature", "some", "sorts", "strategies", "stratego", "test",
"thread", "where"
end keywords
# common keywords from the stratego library
keywords in Keyword are
"try", "if", "ior", "eq", "repeat", "repeat-until",
"while", "do-while", "for", "topdown", "bottomup", "downup",
"minus", "plus", "add", "subt", "mul", "div", "mod",
"geq", "gt", "lt", "leq", "max", "min", "int",
"is-int", "int-to-string", "string-to-int",
"new", "is-string", "lower-case", "upper-case",
"init-name-space", "exit-name-space", "begin-scope", "end-scope",
"scope", "assert", "rewrite",
"list", "map", "is-list", "length", "fetch", "lookup",
"last", "init", "copy",
"take", "take-while", "take-until",
"drop", "drop-while", "drop-until",
"substitute", "diff", "pattern-match", "unify", "equal",
"print", "WriteToTextFile", "WriteToBinaryFile",
"open-file", "append-file", "close-file",
"say", "echo", "trace", "error", "fatal-error",
"printchar", "print-string", "iowrap",
"pipe", "exit", "call"
end keywords
operators in Keyword_strong are
-> \rightarrow,
-->,
=,
#,
@,
_,
|,
],
[,
^,
},
{ ,
"+" ,
"<" ,
"<+" ,
"<++" ,
">" ,
"+>" ,
"++>" ,
(/^([\t ]*[a-zA-Z0-9'._\-]*)([\t ]*[:=])/ \1 Label_strong, \2 Plain)
end operators
sequences are
"/*" Comment "*/",
"//" Comment,
"(*" Comment "*)",
"\\literate" Comment "\\begin{code}",
"\\end{code}" Comment "\\begin{code}",
C-string
end sequences
end style
|