/[eiffelstudio]/vendor/gobosoft.com/gobo/4.0d/library/tools/src/eiffel/processor/et_ast_printer.e
ViewVC logotype

Contents of /vendor/gobosoft.com/gobo/4.0d/library/tools/src/eiffel/processor/et_ast_printer.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 98698 - (show annotations)
Mon May 9 13:53:54 2016 UTC (3 years, 5 months ago) by manus
File size: 5991 byte(s)
Update 4.0d version with changes in Gobo from 2016/05/09

1 note
2
3 description:
4
5 "Eiffel AST printers"
6
7 library: "Gobo Eiffel Tools Library"
8 copyright: "Copyright (c) 2002-2016, Eric Bezault and others"
9 license: "MIT License"
10 date: "$Date$"
11 revision: "$Revision$"
12
13 class ET_AST_PRINTER
14
15 inherit
16
17 ET_AST_ITERATOR
18 rename
19 make as make_null
20 redefine
21 make_null,
22 process_break,
23 process_binary_integer_constant,
24 process_c1_character_constant,
25 process_c2_character_constant,
26 process_c3_character_constant,
27 process_hexadecimal_integer_constant,
28 process_octal_integer_constant,
29 process_regular_integer_constant,
30 process_underscored_integer_constant,
31 process_regular_real_constant,
32 process_underscored_real_constant,
33 process_regular_manifest_string,
34 process_special_manifest_string,
35 process_verbatim_string,
36 process_symbol,
37 process_token
38 end
39
40 KL_SHARED_STREAMS
41
42 create
43
44 make, make_null
45
46 feature {NONE} -- Initialization
47
48 make (a_file: like file)
49 -- Create a new AST printer, using `a_file' as output file.
50 require
51 a_file_not_void: a_file /= Void
52 a_file_is_open_write: a_file.is_open_write
53 do
54 file := a_file
55 ensure
56 file_set: file = a_file
57 end
58
59 make_null
60 -- Create a new AST printer, initialized with a null output stream.
61 do
62 make (null_output_stream)
63 ensure then
64 file_set: file = null_output_stream
65 end
66
67 feature -- Access
68
69 file: KI_CHARACTER_OUTPUT_STREAM
70 -- Output file
71
72 feature -- Setting
73
74 set_file (a_file: like file)
75 -- Set `file' to `a_file'.
76 require
77 a_file_not_void: a_file /= Void
78 a_file_is_open_write: a_file.is_open_write
79 do
80 file := a_file
81 ensure
82 file_set: file = a_file
83 end
84
85 set_null_file
86 -- Set `file' to `null_output_stream'.
87 do
88 file := null_output_stream
89 ensure
90 file_set: file = null_output_stream
91 end
92
93 feature {ET_AST_NODE} -- Processing
94
95 process_binary_integer_constant (a_constant: ET_BINARY_INTEGER_CONSTANT)
96 -- Process `a_constant'.
97 do
98 precursor (a_constant)
99 file.put_string (a_constant.literal)
100 process_break (a_constant.break)
101 end
102
103 process_break (a_break: detachable ET_BREAK)
104 -- Process `a_break'.
105 do
106 if a_break /= Void then
107 file.put_string (a_break.text)
108 end
109 end
110
111 process_c1_character_constant (a_constant: ET_C1_CHARACTER_CONSTANT)
112 -- Process `a_constant'.
113 do
114 precursor (a_constant)
115 file.put_character ('%'')
116 file.put_character (a_constant.literal)
117 file.put_character ('%'')
118 process_break (a_constant.break)
119 end
120
121 process_c2_character_constant (a_constant: ET_C2_CHARACTER_CONSTANT)
122 -- Process `a_constant'.
123 do
124 precursor (a_constant)
125 file.put_character ('%'')
126 file.put_character ('%%')
127 file.put_character (a_constant.literal)
128 file.put_character ('%'')
129 process_break (a_constant.break)
130 end
131
132 process_c3_character_constant (a_constant: ET_C3_CHARACTER_CONSTANT)
133 -- Process `a_constant'.
134 do
135 precursor (a_constant)
136 file.put_character ('%'')
137 file.put_character ('%%')
138 file.put_character ('/')
139 file.put_string (a_constant.literal)
140 file.put_character ('/')
141 file.put_character ('%'')
142 process_break (a_constant.break)
143 end
144
145 process_hexadecimal_integer_constant (a_constant: ET_HEXADECIMAL_INTEGER_CONSTANT)
146 -- Process `a_constant'.
147 do
148 precursor (a_constant)
149 file.put_string (a_constant.literal)
150 process_break (a_constant.break)
151 end
152
153 process_octal_integer_constant (a_constant: ET_OCTAL_INTEGER_CONSTANT)
154 -- Process `a_constant'.
155 do
156 precursor (a_constant)
157 file.put_string (a_constant.literal)
158 process_break (a_constant.break)
159 end
160
161 process_regular_integer_constant (a_constant: ET_REGULAR_INTEGER_CONSTANT)
162 -- Process `a_constant'.
163 do
164 precursor (a_constant)
165 file.put_string (a_constant.literal)
166 process_break (a_constant.break)
167 end
168
169 process_regular_manifest_string (a_string: ET_REGULAR_MANIFEST_STRING)
170 -- Process `a_string'.
171 do
172 precursor (a_string)
173 file.put_character ('%"')
174 file.put_string (a_string.literal)
175 file.put_character ('%"')
176 process_break (a_string.break)
177 end
178
179 process_regular_real_constant (a_constant: ET_REGULAR_REAL_CONSTANT)
180 -- Process `a_constant'.
181 do
182 precursor (a_constant)
183 file.put_string (a_constant.literal)
184 process_break (a_constant.break)
185 end
186
187 process_special_manifest_string (a_string: ET_SPECIAL_MANIFEST_STRING)
188 -- Process `a_string'.
189 do
190 precursor (a_string)
191 file.put_character ('%"')
192 file.put_string (a_string.literal)
193 file.put_character ('%"')
194 process_break (a_string.break)
195 end
196
197 process_symbol (a_symbol: ET_SYMBOL)
198 -- Process `a_symbol'.
199 do
200 file.put_string (a_symbol.text)
201 process_break (a_symbol.break)
202 end
203
204 process_token (a_token: ET_TOKEN)
205 -- Process `a_token'.
206 do
207 file.put_string (a_token.text)
208 process_break (a_token.break)
209 end
210
211 process_underscored_integer_constant (a_constant: ET_UNDERSCORED_INTEGER_CONSTANT)
212 -- Process `a_constant'.
213 do
214 precursor (a_constant)
215 file.put_string (a_constant.literal)
216 process_break (a_constant.break)
217 end
218
219 process_underscored_real_constant (a_constant: ET_UNDERSCORED_REAL_CONSTANT)
220 -- Process `a_constant'.
221 do
222 precursor (a_constant)
223 file.put_string (a_constant.literal)
224 process_break (a_constant.break)
225 end
226
227 process_verbatim_string (a_string: ET_VERBATIM_STRING)
228 -- Process `a_string'.
229 do
230 precursor (a_string)
231 file.put_character ('%"')
232 file.put_string (a_string.marker)
233 if a_string.is_left_aligned then
234 file.put_character ('[')
235 else
236 file.put_character ('{')
237 end
238 file.put_string (a_string.open_white_characters)
239 file.put_string (a_string.literal)
240 file.put_string (a_string.close_white_characters)
241 if a_string.is_left_aligned then
242 file.put_character (']')
243 else
244 file.put_character ('}')
245 end
246 file.put_string (a_string.marker)
247 file.put_character ('%"')
248 process_break (a_string.break)
249 end
250
251 invariant
252
253 file_not_void: file /= Void
254 file_is_open_write: file.is_open_write
255
256 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23