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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
%D \module
%D [ filefile=verb-eif,
%D version=2000.08.23,
%D title=\CONTEXT\ Verbatim Macros,
%D subtitle=Pretty Eiffel Verbatim,
%D author={Berend de Boer \& Hans Hagen},
%D date=\currentdate,
%D copyright={Berend de Boer \& Hans Hagen}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
% This module will be cleaned up a bit in the process of more
% flexible verbatim options.
\writestatus{loading}{Context Support Macros / Pretty EIFFEL Verbatim}
%D \startbuffer
%D \startEIFFEL
%D class TEST
%D
%D creation
%D make
%D
%D feature -- creation
%D
%D make is
%D do
%D print ("hello world")
%D end
%D
%D end
%D \stopEIFFEL
%D \stopbuffer
%D
%D
%D If a variable in a comment is quoted with `..', it is typeset
%D as a variable (common Eiffel convention for pretty typesetters):
%D
%D \startbuffer
%D \startEIFFEL
%D class TEST
%D
%D feature
%D
%D say (something: STRING) is
%D -- say `something' to stdout
%D do
%D print (something)
%D end
%D
%D end -- class TEST
%D \stopEIFFEL
%D \stopbuffer
%D
%D
%D Recommended, OOSC2 style setting is:
%D
%D \setuptyping
%D [EIFFEL]
%D [margin=1em,palet=,color=blue,style=\it,icommand=\bf,ccommand=\tf]
%D
%D We borrow most of the macros from the \PERL\ driver.
\ifx\undefined\setupprettyPLtype \input verb-pl \relax \fi
\unprotect
%D \EIFFEL\ has only the one line comment sequence \type{--}.
\gdef\EIFsetspecials%
{\PLsetspecials
\setpretty`\#=32
\setpretty`\{=33 \setpretty`\}=33
\setpretty`\[=33 \setpretty`\]=33 \setpretty`\(=33 \setpretty`\)=33
\setpretty`\;=33 \setpretty`\:=33
\setpretty`\!=33 \setpretty`\?=33
\setpretty`\==33 \setpretty`\~=33 \setpretty`\<=33 \setpretty`\>=33
\setpretty`\-=33 \setpretty`\+=33 \setpretty`\/=33 \setpretty`\*=33
\setpretty`\^=33
\setpretty`\%=41 \setpretty`\-=45
\setpretty`\`=81 \setpretty`\'=82 }
\gdef\EIFsethandlers%
{\PLsethandlers
\installprettyhandler 33 \EIFtypesymbol
\installprettyhandler 45 \EIFtypefourfive
\installprettyhandler 81 \EIFtypeeightone
\installprettyhandler 82 \EIFtypeeighttwo
\installprettyhandler 90 \EIFtypenine }
\gdef\EIFsetcontrols%
{\PLsetcontrols
\def\flushrestofverbatimline%
{\endPLtypesix
\inPLcommentfalse
\verbatimfont
\PLverbosefalse
\PLverboseskipped=0}}
\gdef\EIFsetvariables
{\PLsetvariables}
\gdef\setupprettyEIFtype%
{\def\prettyidentifier{EIF}%
\let\PLidentifiers=\EIFidentifiers
\let\PLvariables=\EIFvariables
\EIFsetvariables
\EIFsetcontrols
\EIFsethandlers
\EIFsetspecials
\PLsetdiagnostics}
% symbols should appear in roman
\gdef\EIFtypesymbol#1%
{\endPLtypesix
\ifinPLcomment
\getpretty{#1}%
\else
{\prettynaturalfont\/%
\beginofpretty[\!!prettythree]\getpretty{#1}\endofpretty}%
\fi}
% recognize comments
\gdef\EIFtypefourfive%
{\handlenextnextpretty\doEIFtypefourfive\PLtypefourtwo}
\gdef\doEIFtypefourfive#1#2%
{\endPLtypesix
\getprettydata{#2}%
\ifnum\prettytype=45
\let\next=\dodoEIFtypefourfive
\else
\let\next=\PLtypefourtwo
\fi
\next{#1}#2}
\gdef\dodoEIFtypefourfive% #1%
{\endPLtypesix
\handlenextnextpretty\dododoEIFtypefourfive\dodododoPLtypefourfive}
\gdef\dododoEIFtypefourfive%
{\ifnewpretty\expandafter\handlenewpretty\fi\dodododoEIFtypefourfive}
\gdef\dodododoEIFtypefourfive#1#2%
{\ifinPLcomment
\getpretties{#1}{#2}%
\else
\ifinPLdouble
\getpretties{#1}{#2}%
\else
\global\inPLcommenttrue
\PLverbosecorrection
\def\next{\beginofpretty[\!!prettyone]\getpretties{#1}{#2}\endofpretty\prettynaturalfont}%
\expandafter\next
\fi
\fi}
% recognize `name' in comments and format them like variables
\gdef\EIFtypeeightone#1%
{\endPLtypesix
\ifinPLcomment
\verbatimfont
\else
\getpretty{#1}%
\fi}
\gdef\EIFtypeeighttwo#1%
{\endPLtypesix
\ifinPLcomment
\prettynaturalfont
\else
{\prettynaturalfont\/%
\beginofpretty[\!!prettythree]\getpretty{#1}\endofpretty}%
\fi}
% double quote
\gdef\EIFtypenine#1%
{\endPLtypesix
\ifinPLcomment
\getpretty{#1}%
\else\ifinPLsingle
\getpretty{#1}%
\else\ifinPLdouble
\global\inPLdoublefalse
{\prettynaturalfont\/%
\beginofpretty[\!!prettythree]\getpretty{#1}\endofpretty}%
\else
\global\inPLdoubletrue
{\prettynaturalfont
\beginofpretty[\!!prettythree]\getpretty{#1}\endofpretty}%
\fi\fi\fi}
\useprettyidentifiers \EIFidentifiers \EIFsetspecials
alias all and as check class create creation debug deferred do else
elseif end ensure expanded export external false feature from frozen
if implies indexing infix inherit inspect invariant is like local
loop not obsolete old once or prefix redefine rename require rescue
precursor retry select separate strip then true undefine unique
until variant when xor
\useprettyidentifiers \EIFvariables \EIFsetspecials
not-yet-defined
\protect \endinput
|