-
Notifications
You must be signed in to change notification settings - Fork 9
/
quine.eiffel.e
83 lines (83 loc) · 2.34 KB
/
quine.eiffel.e
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
class QUINE
creation make
feature
make
local
s:STRING
i,j:INTEGER
do
s := "class QUINE%N%
%creation make%N%
%feature%N%
% make%N%
% local%N%
% s:STRING%N%
% i,j:INTEGER%N%
% do%N%
% s := $%N%
% from%N%
% i := 1%N%
% until i > s.count%N%
% loop%N%
% if '%%/36/' = s.item(i) then%N%
% io.put_character('%"')%N%
% from%N%
% j := 1%N%
% until j > s.count%N%
% loop%N%
% inspect s.item(j)%N%
% when '%%N' then%N%
% io.put_string(%"%%%%N%%%%%")%N%
% io.put_new_line%N%
% io.put_string(%" %%%%%")%N%
% when '%"' then%N%
% io.put_string(%"%%%%%%%"%")%N%
% when '%%%%' then%N%
% io.put_string(%"%%%%%%%%%")%N%
% else%N%
% io.put_character(s.item(j))%N%
% end%N%
% j := j + 1%N%
% end%N%
% io.put_character('%"')%N%
% else%N%
% io.put_character(s.item(i))%N%
% end%N%
% i := i + 1%N%
% end%N%
% io.put_new_line%N%
% end%N%
%end"
from
i := 1
until i > s.count
loop
if '%/36/' = s.item(i) then
io.put_character('"')
from
j := 1
until j > s.count
loop
inspect s.item(j)
when '%N' then
io.put_string("%%N%%")
io.put_new_line
io.put_string(" %%")
when '"' then
io.put_string("%%%"")
when '%%' then
io.put_string("%%%%")
else
io.put_character(s.item(j))
end
j := j + 1
end
io.put_character('"')
else
io.put_character(s.item(i))
end
i := i + 1
end
io.put_new_line
end
end