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

Contents of /vendor/gobosoft.com/gobo/4.0d/library/tools/src/eiffel/processor/et_ast_pretty_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: 164786 byte(s)
Update 4.0d version with changes in Gobo from 2016/05/09

1 note
2
3 description:
4
5 "Eiffel AST pretty printers"
6
7 library: "Gobo Eiffel Tools Library"
8 copyright: "Copyright (c) 2007-2016, Eric Bezault and others"
9 license: "MIT License"
10 date: "$Date$"
11 revision: "$Revision$"
12
13 class ET_AST_PRETTY_PRINTER
14
15 inherit
16
17 ET_AST_PRINTER
18 redefine
19 make, file,
20 process_across_expression,
21 process_across_instruction,
22 process_actual_argument_list,
23 process_actual_parameter_list,
24 process_agent_argument_operand_list,
25 process_agent_typed_open_argument,
26 process_alias_free_name,
27 process_alias_name,
28 process_aliased_feature_name,
29 process_all_export,
30 process_assign_feature_name,
31 process_assigner_instruction,
32 process_assignment,
33 process_assignment_attempt,
34 process_attachment_separate_keywords,
35 process_attachment_symbol_separate_keyword,
36 process_attribute,
37 process_bang_instruction,
38 process_binary_integer_constant,
39 process_braced_type_list,
40 process_bracket_argument_list,
41 process_bracket_expression,
42 process_break,
43 process_c1_character_constant,
44 process_c2_character_constant,
45 process_c3_character_constant,
46 process_call_agent,
47 process_check_instruction,
48 process_choice_list,
49 process_choice_range,
50 process_class,
51 process_class_type,
52 process_clients,
53 process_colon_type,
54 process_compound,
55 process_constant_attribute,
56 process_constrained_formal_parameter,
57 process_constraint_creator,
58 process_convert_feature_list,
59 process_convert_function,
60 process_convert_procedure,
61 process_create_expression,
62 process_create_instruction,
63 process_creator,
64 process_creator_list,
65 process_custom_attribute,
66 process_debug_instruction,
67 process_deferred_function,
68 process_deferred_procedure,
69 process_do_function,
70 process_do_function_inline_agent,
71 process_do_procedure,
72 process_do_procedure_inline_agent,
73 process_dotnet_function,
74 process_dotnet_procedure,
75 process_elseif_part,
76 process_elseif_part_list,
77 process_equality_expression,
78 process_export_list,
79 process_extended_attribute,
80 process_external_function,
81 process_external_function_inline_agent,
82 process_external_procedure,
83 process_external_procedure_inline_agent,
84 process_feature_clause,
85 process_feature_clause_list,
86 process_feature_export,
87 process_features,
88 process_formal_argument,
89 process_formal_argument_list,
90 process_formal_comma_argument,
91 process_formal_parameter,
92 process_formal_parameter_list,
93 process_formal_parameter_type,
94 process_hexadecimal_integer_constant,
95 process_if_instruction,
96 process_indexing_list,
97 process_indexing_term_list,
98 process_infix_and_then_operator,
99 process_infix_expression,
100 process_infix_name,
101 process_infix_or_else_operator,
102 process_inspect_instruction,
103 process_invariants,
104 process_keyword_expression,
105 process_keyword_feature_name_list,
106 process_keyword_manifest_string,
107 process_labeled_actual_parameter,
108 process_labeled_comma_actual_parameter,
109 process_like_current,
110 process_like_feature,
111 process_local_comma_variable,
112 process_local_variable,
113 process_local_variable_list,
114 process_loop_instruction,
115 process_loop_invariants,
116 process_manifest_array,
117 process_manifest_string_list,
118 process_manifest_tuple,
119 process_named_object_test,
120 process_object_equality_expression,
121 process_object_test,
122 process_octal_integer_constant,
123 process_old_expression,
124 process_old_object_test,
125 process_once_function,
126 process_once_function_inline_agent,
127 process_once_manifest_string,
128 process_once_procedure,
129 process_once_procedure_inline_agent,
130 process_parent,
131 process_parent_list,
132 process_postconditions,
133 process_preconditions,
134 process_precursor_expression,
135 process_precursor_instruction,
136 process_prefix_expression,
137 process_prefix_name,
138 process_qualified_call,
139 process_qualified_call_expression,
140 process_qualified_call_instruction,
141 process_qualified_like_braced_type,
142 process_qualified_like_type,
143 process_qualified_regular_feature_call,
144 process_regular_integer_constant,
145 process_regular_manifest_string,
146 process_regular_real_constant,
147 process_rename,
148 process_rename_list,
149 process_result,
150 process_result_address,
151 process_retry_instruction,
152 process_semicolon_symbol,
153 process_special_manifest_string,
154 process_static_call_expression,
155 process_static_call_instruction,
156 process_strip_expression,
157 process_symbol,
158 process_tagged_assertion,
159 process_tagged_indexing,
160 process_token,
161 process_true_constant,
162 process_tuple_type,
163 process_underscored_integer_constant,
164 process_underscored_real_constant,
165 process_unique_attribute,
166 process_unqualified_call_expression,
167 process_unqualified_call_instruction,
168 process_unqualified_regular_feature_call,
169 process_variant,
170 process_verbatim_string,
171 process_void,
172 process_when_part,
173 process_when_part_list
174 end
175
176 KL_IMPORTED_STRING_ROUTINES
177 export {NONE} all end
178
179 KL_IMPORTED_ANY_ROUTINES
180 export {NONE} all end
181
182 ET_SHARED_TOKEN_CONSTANTS
183 export {NONE} all end
184
185 create
186
187 make, make_null
188
189 feature {NONE} -- Initialization
190
191 make (a_file: like file)
192 -- Create a new AST pretty-printer, using `a_file' as output file.
193 do
194 precursor (a_file)
195 create comment_finder.make
196 create comment_list.make (20)
197 end
198
199 feature -- Initialization
200
201 reset
202 -- Reset for another pretty-printing.
203 do
204 reset_indentation
205 indentation_printed := False
206 comment_printed := False
207 comment_list.wipe_out
208 comment_finder.reset_excluded_nodes
209 end
210
211 feature -- Access
212
213 file: KI_TEXT_OUTPUT_STREAM
214 -- Output file
215
216 feature -- Indentation
217
218 indentation: INTEGER
219 -- Indentation in `file'
220
221 indent
222 -- Increment indentation.
223 do
224 indentation := indentation + 1
225 ensure
226 one_more: indentation = old indentation + 1
227 end
228
229 dedent
230 -- Decrement indentation.
231 do
232 indentation := indentation - 1
233 ensure
234 one_less: indentation = old indentation - 1
235 end
236
237 reset_indentation
238 -- Reset indentation.
239 do
240 indentation := 0
241 ensure
242 indentation_reset: indentation = 0
243 end
244
245 feature {ET_AST_NODE} -- Processing
246
247 process_across_expression (an_expression: ET_ACROSS_EXPRESSION)
248 -- Process `an_expression'.
249 local
250 l_iteration_conditional: ET_CONDITIONAL
251 l_expression: ET_EXPRESSION
252 do
253 an_expression.across_keyword.process (Current)
254 print_space
255 an_expression.iterable_expression.process (Current)
256 print_space
257 an_expression.as_keyword.process (Current)
258 print_space
259 an_expression.cursor_name.process (Current)
260 print_space
261 if attached an_expression.invariant_part as l_invariant_part then
262 l_invariant_part.process (Current)
263 end
264 if attached an_expression.until_conditional as l_until_conditional then
265 tokens.until_keyword.process (Current)
266 print_space
267 l_expression := l_until_conditional.expression
268 l_expression.process (Current)
269 comment_finder.add_excluded_node (l_expression)
270 comment_finder.find_comments (l_until_conditional, comment_list)
271 comment_finder.reset_excluded_nodes
272 print_space
273 end
274 l_iteration_conditional := an_expression.iteration_conditional
275 if an_expression.is_all then
276 tokens.all_keyword.process (Current)
277 else
278 tokens.some_keyword.process (Current)
279 end
280 print_space
281 l_expression := l_iteration_conditional.expression
282 l_expression.process (Current)
283 comment_finder.add_excluded_node (l_expression)
284 comment_finder.find_comments (l_iteration_conditional, comment_list)
285 comment_finder.reset_excluded_nodes
286 print_space
287 if attached an_expression.variant_part as l_variant_part then
288 l_variant_part.process (Current)
289 print_space
290 end
291 an_expression.end_keyword.process (Current)
292 end
293
294 process_across_instruction (an_instruction: ET_ACROSS_INSTRUCTION)
295 -- Process `an_instruction'.
296 local
297 l_expression: ET_EXPRESSION
298 do
299 an_instruction.across_keyword.process (Current)
300 print_new_line
301 indent
302 process_comments
303 an_instruction.iterable_expression.process (Current)
304 print_new_line
305 process_comments
306 dedent
307 an_instruction.as_keyword.process (Current)
308 print_new_line
309 indent
310 process_comments
311 an_instruction.cursor_name.process (Current)
312 print_new_line
313 process_comments
314 dedent
315 if attached an_instruction.from_compound as l_from_compound then
316 l_from_compound.process (Current)
317 print_new_line
318 process_comments
319 end
320 if attached an_instruction.invariant_part as l_invariant_part then
321 l_invariant_part.process (Current)
322 process_comments
323 end
324 if attached an_instruction.until_conditional as l_conditional then
325 tokens.until_keyword.process (Current)
326 print_new_line
327 indent
328 process_comments
329 l_expression := l_conditional.expression
330 l_expression.process (Current)
331 comment_finder.add_excluded_node (l_expression)
332 comment_finder.find_comments (l_conditional, comment_list)
333 comment_finder.reset_excluded_nodes
334 print_new_line
335 process_comments
336 dedent
337 end
338 if attached an_instruction.loop_compound as l_loop_compound then
339 l_loop_compound.process (Current)
340 else
341 tokens.loop_keyword.process (Current)
342 end
343 print_new_line
344 process_comments
345 if attached an_instruction.variant_part as l_variant_part then
346 l_variant_part.process (Current)
347 print_new_line
348 process_comments
349 end
350 an_instruction.end_keyword.process (Current)
351 end
352
353 process_actual_argument_list (a_list: ET_ACTUAL_ARGUMENT_LIST)
354 -- Process `a_list'.
355 local
356 i, nb: INTEGER
357 l_item: ET_EXPRESSION_ITEM
358 l_expression: ET_EXPRESSION
359 do
360 a_list.left_symbol.process (Current)
361 nb := a_list.count
362 from i := 1 until i > nb loop
363 l_item := a_list.item (i)
364 l_expression := l_item.expression
365 l_expression.process (Current)
366 comment_finder.add_excluded_node (l_expression)
367 comment_finder.find_comments (l_item, comment_list)
368 comment_finder.reset_excluded_nodes
369 if i /= nb then
370 -- The AST may or may not contain the comma.
371 -- So we have to print it explicitly here.
372 tokens.comma_symbol.process (Current)
373 print_space
374 end
375 i := i + 1
376 end
377 a_list.right_symbol.process (Current)
378 end
379
380 process_actual_parameter_list (a_list: ET_ACTUAL_PARAMETER_LIST)
381 -- Process `a_list'.
382 local
383 i, nb: INTEGER
384 l_item: ET_ACTUAL_PARAMETER_ITEM
385 l_unlabeled: BOOLEAN
386 l_type: ET_TYPE
387 l_comment: ET_COMMENT
388 do
389 a_list.left_bracket.process (Current)
390 nb := a_list.count
391 -- The actual parameter list is considered as unlabeled (i.e. not being part
392 -- of a Labeled Tuple type declaration) as soon as one of the parameters is
393 -- unlabeled. In that case no labels will be printed, so that the pretty-printed
394 -- text is syntactically correct. Indeed the compiler can deal with a mix of
395 -- labeled and unlabeled actual parameters but the Eiffel standard enforces that
396 -- they are all labeled or all unlabeled within the same actual parameter list.
397 from i := 1 until i > nb loop
398 if a_list.item (i).label = Void then
399 l_unlabeled := True
400 i := nb + 1
401 end
402 i := i + 1
403 end
404 from i := 1 until i > nb loop
405 l_item := a_list.item (i)
406 if attached l_item.label as l_label then
407 if l_unlabeled then
408 -- This label cannot be printed here, otherwise the result would
409 -- not be syntactically correct (see comment above). The name of
410 -- the label is printed in a comment so that we don't lose any
411 -- valuable information in the pretty-printed text.
412 create l_comment.make ("-- label: " + l_label.name)
413 comment_list.force_last (l_comment)
414 else
415 l_label.process (Current)
416 comment_finder.add_excluded_node (l_label)
417 end
418 end
419 if l_unlabeled then
420 l_type := l_item.type
421 l_type.process (Current)
422 comment_finder.add_excluded_node (l_type)
423 comment_finder.find_comments (l_item, comment_list)
424 comment_finder.reset_excluded_nodes
425 if i /= nb then
426 -- The AST may or may not contain the comma.
427 -- So we have to print it explicitly here.
428 tokens.comma_symbol.process (Current)
429 print_space
430 end
431 elseif l_item.is_last_entity or i = nb then
432 tokens.colon_symbol.process (Current)
433 print_space
434 l_type := l_item.type
435 l_type.process (Current)
436 comment_finder.add_excluded_node (l_type)
437 comment_finder.find_comments (l_item, comment_list)
438 comment_finder.reset_excluded_nodes
439 if i /= nb then
440 -- The AST may or may not contain the semicolon.
441 -- So we have to print it explicitly here.
442 tokens.semicolon_symbol.process (Current)
443 print_space
444 end
445 else
446 comment_finder.find_comments (l_item, comment_list)
447 comment_finder.reset_excluded_nodes
448 -- The AST may or may not contain the comma.
449 -- So we have to print it explicitly here.
450 tokens.comma_symbol.process (Current)
451 print_space
452 end
453 i := i + 1
454 end
455 a_list.right_bracket.process (Current)
456 end
457
458 process_agent_argument_operand_list (a_list: ET_AGENT_ARGUMENT_OPERAND_LIST)
459 -- Process `a_list'.
460 local
461 i, nb: INTEGER
462 l_item: ET_AGENT_ARGUMENT_OPERAND_ITEM
463 l_argument: ET_AGENT_ARGUMENT_OPERAND
464 do
465 a_list.left_parenthesis.process (Current)
466 nb := a_list.count
467 from i := 1 until i > nb loop
468 l_item := a_list.item (i)
469 l_argument := l_item.agent_actual_argument
470 l_argument.process (Current)
471 comment_finder.add_excluded_node (l_argument)
472 comment_finder.find_comments (l_item, comment_list)
473 comment_finder.reset_excluded_nodes
474 if i /= nb then
475 -- The AST may or may not contain the comma.
476 -- So we have to print it explicitly here.
477 tokens.comma_symbol.process (Current)
478 print_space
479 end
480 i := i + 1
481 end
482 a_list.right_parenthesis.process (Current)
483 end
484
485 process_agent_typed_open_argument (an_argument: ET_AGENT_TYPED_OPEN_ARGUMENT)
486 -- Process `an_argument'.
487 do
488 an_argument.left_brace.process (Current)
489 an_argument.type.process (Current)
490 an_argument.right_brace.process (Current)
491 print_space
492 an_argument.question_mark.process (Current)
493 end
494
495 process_alias_free_name (a_name: ET_ALIAS_FREE_NAME)
496 -- Process `a_name'.
497 do
498 a_name.alias_keyword.process (Current)
499 print_space
500 a_name.alias_string.process (Current)
501 end
502
503 process_alias_name (a_name: ET_ALIAS_NAME)
504 -- Process `a_name'.
505 do
506 a_name.alias_keyword.process (Current)
507 print_space
508 a_name.alias_string.process (Current)
509 end
510
511 process_aliased_feature_name (a_name: ET_ALIASED_FEATURE_NAME)
512 -- Process `a_name'.
513 do
514 a_name.feature_name.process (Current)
515 print_space
516 a_name.alias_name.process (Current)
517 end
518
519 process_all_export (an_export: ET_ALL_EXPORT)
520 -- Process `an_export'.
521 do
522 an_export.clients_clause.process (Current)
523 print_space
524 an_export.all_keyword.process (Current)
525 end
526
527 process_assertions (a_list: ET_ASSERTIONS)
528 -- Process `a_list'.
529 require
530 a_list_not_void: a_list /= Void
531 local
532 i, nb: INTEGER
533 l_item: ET_ASSERTION_ITEM
534 l_assertion: ET_ASSERTION
535 do
536 nb := a_list.count
537 from i := 1 until i > nb loop
538 l_item := a_list.item (i)
539 l_assertion := l_item.assertion
540 l_assertion.process (Current)
541 comment_finder.add_excluded_node (l_assertion)
542 comment_finder.find_comments (l_item, comment_list)
543 comment_finder.reset_excluded_nodes
544 if i /= nb then
545 if attached {ET_IDENTIFIER} l_assertion.last_leaf and attached {ET_SYMBOL} a_list.item (i + 1).first_leaf as l_symbol and then (l_symbol.is_left_parenthesis or l_symbol.is_left_bracket) then
546 -- Print a semicolon in order to avoid syntax ambiguity.
547 -- For example if we have:
548 --
549 -- check
550 -- f.g
551 -- (a + b).h
552 -- end
553 --
554 -- it could also be seen as:
555 --
556 -- check
557 -- f.g (a + b).h
558 -- end
559 --
560 tokens.semicolon_symbol.process (Current)
561 end
562 end
563 process_comments
564 print_new_line
565 i := i + 1
566 end
567 end
568
569 process_assign_feature_name (an_assigner: ET_ASSIGN_FEATURE_NAME)
570 -- Process `an_assigner'.
571 do
572 an_assigner.assign_keyword.process (Current)
573 print_space
574 an_assigner.feature_name.process (Current)
575 end
576
577 process_assigner_instruction (an_instruction: ET_ASSIGNER_INSTRUCTION)
578 -- Process `an_instruction'.
579 do
580 an_instruction.call.process (Current)
581 print_space
582 an_instruction.assign_symbol.process (Current)
583 print_space
584 an_instruction.source.process (Current)
585 end
586
587 process_assignment (an_instruction: ET_ASSIGNMENT)
588 -- Process `an_instruction'.
589 do
590 an_instruction.target.process (Current)
591 print_space
592 an_instruction.assign_symbol.process (Current)
593 print_space
594 an_instruction.source.process (Current)
595 end
596
597 process_assignment_attempt (an_instruction: ET_ASSIGNMENT_ATTEMPT)
598 -- Process `an_instruction'.
599 do
600 an_instruction.target.process (Current)
601 print_space
602 an_instruction.assign_attempt_symbol.process (Current)
603 print_space
604 an_instruction.source.process (Current)
605 end
606
607 process_attachment_separate_keywords (a_keywords: ET_ATTACHMENT_SEPARATE_KEYWORDS)
608 -- Process `a_keywords'.
609 do
610 a_keywords.attachment_keyword.process (Current)
611 print_space
612 a_keywords.separateness_keyword.process (Current)
613 end
614
615 process_attachment_symbol_separate_keyword (a_keywords: ET_ATTACHMENT_SYMBOL_SEPARATE_KEYWORD)
616 -- Process `a_keywords'.
617 do
618 a_keywords.attachment_symbol.process (Current)
619 print_space
620 a_keywords.separateness_keyword.process (Current)
621 end
622
623 process_attribute (a_feature: ET_ATTRIBUTE)
624 -- Process `a_feature'.
625 local
626 l_synonym: detachable ET_FEATURE
627 l_extended_feature_name: ET_EXTENDED_FEATURE_NAME
628 l_feature_name: ET_FEATURE_NAME
629 l_declared_type: ET_DECLARED_TYPE
630 l_type: ET_TYPE
631 do
632 from
633 l_synonym := a_feature
634 until
635 l_synonym = Void
636 loop
637 if attached l_synonym.frozen_keyword as l_frozen_keyword then
638 l_frozen_keyword.process (Current)
639 print_space
640 end
641 l_extended_feature_name := l_synonym.extended_name
642 l_feature_name := l_extended_feature_name.feature_name
643 l_feature_name.process (Current)
644 if attached l_extended_feature_name.alias_name as l_alias_name and then not ANY_.same_objects (l_alias_name, l_feature_name) then
645 -- For infix and prefix features, do not repeat the name twice.
646 print_space
647 l_alias_name.process (Current)
648 comment_finder.add_excluded_node (l_alias_name)
649 end
650 comment_finder.add_excluded_node (l_feature_name)
651 comment_finder.find_comments (l_extended_feature_name, comment_list)
652 comment_finder.reset_excluded_nodes
653 l_synonym := l_synonym.synonym
654 if l_synonym /= Void then
655 -- The AST may or may not contain the comma.
656 -- So we have to print it explicitly here.
657 tokens.comma_symbol.process (Current)
658 print_space
659 end
660 end
661 -- The AST may or may not contain the colon.
662 -- So we have to print it explicitly here.
663 l_declared_type := a_feature.declared_type
664 l_type := l_declared_type.type
665 tokens.colon_symbol.process (Current)
666 comment_finder.add_excluded_node (l_type)
667 comment_finder.find_comments (l_declared_type, comment_list)
668 comment_finder.reset_excluded_nodes
669 print_space
670 l_type.process (Current)
671 if attached a_feature.assigner as l_assigner then
672 print_space
673 l_assigner.process (Current)
674 end
675 if attached a_feature.semicolon as l_semicolon then
676 -- Do not print the semicolon, but keep track of its comments if any.
677 process_break (l_semicolon.break)
678 end
679 -- Print header comment.
680 indent
681 process_comments
682 dedent
683 end
684
685 process_bang_instruction (an_instruction: ET_BANG_INSTRUCTION)
686 -- Process `an_instruction'.
687 do
688 -- Use the keyword 'create' even if the original class text was using the old syntax with '!!'.
689 -- The following code will try to print the comments at the right place if any, even when
690 -- replacing '!!' with 'create'.
691 tokens.create_keyword.process (Current)
692 print_space
693 process_break (an_instruction.left_bang.break)
694 if attached an_instruction.type as l_type then
695 tokens.left_brace_symbol.process (Current)
696 l_type.process (Current)
697 tokens.right_brace_symbol.process (Current)
698 print_space
699 end
700 process_break (an_instruction.right_bang.break)
701 an_instruction.target.process (Current)
702 if attached an_instruction.creation_call as l_creation_call then
703 l_creation_call.process (Current)
704 end
705 end
706
707 process_binary_integer_constant (a_constant: ET_BINARY_INTEGER_CONSTANT)
708 -- Process `a_constant'.
709 local
710 l_type: ET_TYPE
711 do
712 if attached a_constant.cast_type as l_cast_type then
713 -- The AST may or may not contain the braces.
714 -- So we have to print them explicitly here.
715 l_type := l_cast_type.type
716 tokens.left_brace_symbol.process (Current)
717 l_type.type.process (Current)
718 tokens.right_brace_symbol.process (Current)
719 comment_finder.add_excluded_node (l_type)
720 comment_finder.find_comments (l_cast_type, comment_list)
721 comment_finder.reset_excluded_nodes
722 print_space
723 end
724 if attached a_constant.sign as l_sign then
725 l_sign.process (Current)
726 end
727 print_string (a_constant.literal)
728 process_break (a_constant.break)
729 end
730
731 process_braced_type_list (a_list: ET_BRACED_TYPE_LIST)
732 -- Process `a_list'.
733 local
734 i, nb: INTEGER
735 l_item: ET_TYPE_ITEM
736 l_type: ET_TYPE
737 do
738 a_list.left_brace.process (Current)
739 nb := a_list.count
740 from i := 1 until i > nb loop
741 l_item := a_list.item (i)
742 l_type := l_item.type
743 l_type.process (Current)
744 comment_finder.add_excluded_node (l_type)
745 comment_finder.find_comments (l_item, comment_list)
746 comment_finder.reset_excluded_nodes
747 if i /= nb then
748 -- The AST may or may not contain the comma.
749 -- So we have to print it explicitly here.
750 tokens.comma_symbol.process (Current)
751 print_space
752 end
753 i := i + 1
754 end
755 a_list.right_brace.process (Current)
756 end
757
758 process_bracket_argument_list (a_list: ET_BRACKET_ARGUMENT_LIST)
759 -- Process `a_list'.
760 local
761 i, nb: INTEGER
762 l_item: ET_EXPRESSION_ITEM
763 l_expression: ET_EXPRESSION
764 do
765 a_list.left_symbol.process (Current)
766 nb := a_list.count
767 from i := 1 until i > nb loop
768 l_item := a_list.item (i)
769 l_expression := l_item.expression
770 l_expression.process (Current)
771 comment_finder.add_excluded_node (l_expression)
772 comment_finder.find_comments (l_item, comment_list)
773 comment_finder.reset_excluded_nodes
774 if i /= nb then
775 -- The AST may or may not contain the comma.
776 -- So we have to print it explicitly here.
777 tokens.comma_symbol.process (Current)
778 print_space
779 end
780 i := i + 1
781 end
782 a_list.right_symbol.process (Current)
783 end
784
785 process_bracket_expression (an_expression: ET_BRACKET_EXPRESSION)
786 -- Process `an_expression'.
787 do
788 an_expression.target.process (Current)
789 if attached an_expression.arguments as l_arguments then
790 print_space
791 l_arguments.process (Current)
792 end
793 end
794
795 process_break (a_break: detachable ET_BREAK)
796 -- Process `a_break'.
797 do
798 if a_break /= Void and then a_break.has_comment then
799 comment_list.force_last (a_break)
800 end
801 end
802
803 process_c1_character_constant (a_constant: ET_C1_CHARACTER_CONSTANT)
804 -- Process `a_constant'.
805 local
806 l_type: ET_TYPE
807 do
808 if attached a_constant.cast_type as l_cast_type then
809 -- The AST may or may not contain the braces.
810 -- So we have to print them explicitly here.
811 l_type := l_cast_type.type
812 tokens.left_brace_symbol.process (Current)
813 l_type.type.process (Current)
814 tokens.right_brace_symbol.process (Current)
815 comment_finder.add_excluded_node (l_type)
816 comment_finder.find_comments (l_cast_type, comment_list)
817 comment_finder.reset_excluded_nodes
818 print_space
819 end
820 print_character ('%'')
821 print_character (a_constant.literal)
822 print_character ('%'')
823 process_break (a_constant.break)
824 end
825
826 process_c2_character_constant (a_constant: ET_C2_CHARACTER_CONSTANT)
827 -- Process `a_constant'.
828 local
829 l_type: ET_TYPE
830 do
831 if attached a_constant.cast_type as l_cast_type then
832 -- The AST may or may not contain the braces.
833 -- So we have to print them explicitly here.
834 l_type := l_cast_type.type
835 tokens.left_brace_symbol.process (Current)
836 l_type.type.process (Current)
837 tokens.right_brace_symbol.process (Current)
838 comment_finder.add_excluded_node (l_type)
839 comment_finder.find_comments (l_cast_type, comment_list)
840 comment_finder.reset_excluded_nodes
841 print_space
842 end
843 print_character ('%'')
844 print_character ('%%')
845 print_character (a_constant.literal)
846 print_character ('%'')
847 process_break (a_constant.break)
848 end
849
850 process_c3_character_constant (a_constant: ET_C3_CHARACTER_CONSTANT)
851 -- Process `a_constant'.
852 local
853 l_type: ET_TYPE
854 do
855 if attached a_constant.cast_type as l_cast_type then
856 -- The AST may or may not contain the braces.
857 -- So we have to print them explicitly here.
858 l_type := l_cast_type.type
859 tokens.left_brace_symbol.process (Current)
860 l_type.type.process (Current)
861 tokens.right_brace_symbol.process (Current)
862 comment_finder.add_excluded_node (l_type)
863 comment_finder.find_comments (l_cast_type, comment_list)
864 comment_finder.reset_excluded_nodes
865 print_space
866 end
867 print_character ('%'')
868 print_character ('%%')
869 print_character ('/')
870 print_string (a_constant.literal)
871 print_character ('/')
872 print_character ('%'')
873 process_break (a_constant.break)
874 end
875
876 process_call_agent (an_expression: ET_CALL_AGENT)
877 -- Process `an_expression'.
878 local
879 l_qualified_feature_name: ET_QUALIFIED_FEATURE_NAME
880 l_feature_name: ET_FEATURE_NAME
881 do
882 -- Use the keyword 'agent' even if the original class text was using the old syntax with '~'.
883 tokens.agent_keyword.process (Current)
884 process_break (an_expression.agent_keyword.break)
885 print_space
886 if an_expression.is_qualified_call then
887 an_expression.target.process (Current)
888 -- The AST may or may not contain the dot.
889 -- So we have to print them explicitly here.
890 tokens.dot_symbol.process (Current)
891 end
892 l_qualified_feature_name := an_expression.qualified_name
893 l_feature_name := l_qualified_feature_name.feature_name
894 l_feature_name.process (Current)
895 comment_finder.add_excluded_node (l_feature_name)
896 comment_finder.find_comments (l_qualified_feature_name, comment_list)
897 comment_finder.reset_excluded_nodes
898 if attached {ET_AGENT_ARGUMENT_OPERAND_LIST} an_expression.arguments as l_arguments then
899 -- Do not print implicit argument operands (they were not in the original class text anyway).
900 if l_arguments.is_empty then
901 -- Do not print empty parentheses, but keep the comments if any.
902 comment_finder.find_comments (l_arguments, comment_list)
903 else
904 print_space
905 l_arguments.process (Current)
906 end
907 end
908 end
909
910 process_check_instruction (an_instruction: ET_CHECK_INSTRUCTION)
911 -- Process `an_instruction'.
912 do
913 an_instruction.check_keyword.process (Current)
914 print_new_line
915 indent
916 process_comments
917 process_assertions (an_instruction)
918 process_comments
919 dedent
920 if attached an_instruction.then_compound as l_then_compound then
921 l_then_compound.process (Current)
922 process_comments
923 print_new_line
924 end
925 an_instruction.end_keyword.process (Current)
926 end
927
928 process_choice_list (a_list: ET_CHOICE_LIST)
929 -- Process `a_list'.
930 local
931 i, nb: INTEGER
932 l_item: ET_CHOICE_ITEM
933 l_choice: ET_CHOICE
934 do
935 a_list.when_keyword.process (Current)
936 if not a_list.is_empty then
937 print_space
938 nb := a_list.count
939 from i := 1 until i > nb loop
940 l_item := a_list.item (i)
941 l_choice := l_item.choice
942 l_choice.process (Current)
943 comment_finder.add_excluded_node (l_choice)
944 comment_finder.find_comments (l_item, comment_list)
945 comment_finder.reset_excluded_nodes
946 if i /= nb then
947 -- The AST may or may not contain the comma.
948 -- So we have to print it explicitly here.
949 tokens.comma_symbol.process (Current)
950 print_space
951 end
952 i := i + 1
953 end
954 end
955 end
956
957 process_choice_range (a_choice: ET_CHOICE_RANGE)
958 -- Process `a_choice'.
959 do
960 a_choice.lower.process (Current)
961 print_space
962 a_choice.dotdot.process (Current)
963 print_space
964 a_choice.upper.process (Current)
965 end
966
967 process_class (a_class: ET_CLASS)
968 -- Process `a_class'.
969 local
970 l_obsolete_string: ET_MANIFEST_STRING
971 do
972 process_break (a_class.leading_break)
973 if not comment_list.is_empty then
974 process_comments
975 -- Add an extra line after the comment.
976 print_new_line
977 end
978 if attached a_class.first_indexing as l_indexing then
979 l_indexing.process (Current)
980 process_comments
981 print_new_line
982 print_new_line
983 end
984 if attached a_class.frozen_keyword as l_frozen_keyword then
985 l_frozen_keyword.process (Current)
986 print_space
987 end
988 if attached a_class.class_mark as l_class_mark then
989 l_class_mark.process (Current)
990 print_space
991 end
992 if attached a_class.external_keyword as l_external_keyword then
993 l_external_keyword.process (Current)
994 print_space
995 end
996 a_class.class_keyword.process (Current)
997 print_space
998 a_class.name.process (Current)
999 if attached a_class.formal_parameters as l_formal_parameters then
1000 if l_formal_parameters.is_empty then
1001 -- Do not print empty brackets, but keep the comments if any.
1002 comment_finder.find_comments (l_formal_parameters, comment_list)
1003 else
1004 print_space
1005 l_formal_parameters.process (Current)
1006 end
1007 end
1008 process_comments
1009 print_new_line
1010 print_new_line
1011 if attached a_class.obsolete_message as l_obsolete_message then
1012 tokens.obsolete_keyword.process (Current)
1013 l_obsolete_string := l_obsolete_message.manifest_string
1014 comment_finder.add_excluded_node (l_obsolete_string)
1015 comment_finder.find_comments (l_obsolete_message, comment_list)
1016 comment_finder.reset_excluded_nodes
1017 indent
1018 process_comments
1019 print_new_line
1020 print_new_line
1021 l_obsolete_string.process (Current)
1022 dedent
1023 process_comments
1024 print_new_line
1025 print_new_line
1026 end
1027 if attached a_class.parent_clause as l_parents then
1028 l_parents.process (Current)
1029 process_comments
1030 print_new_line
1031 print_new_line
1032 end
1033 if attached a_class.creators as l_creators then
1034 l_creators.process (Current)
1035 process_comments
1036 print_new_line
1037 print_new_line
1038 end
1039 if attached a_class.convert_features as l_convert_features then
1040 l_convert_features.process (Current)
1041 process_comments
1042 print_new_line
1043 print_new_line
1044 end
1045 process_features (a_class)
1046 if attached a_class.invariants as l_invariants then
1047 l_invariants.process (Current)
1048 process_comments
1049 end
1050 if attached a_class.second_indexing as l_indexing then
1051 l_indexing.process (Current)
1052 process_comments
1053 print_new_line
1054 print_new_line
1055 end
1056 a_class.end_keyword.process (Current)
1057 process_comments_on_same_line
1058 print_new_line
1059 end
1060
1061 process_class_type (a_type: ET_CLASS_TYPE)
1062 -- Process `a_type'.
1063 do
1064 if attached a_type.type_mark as l_type_mark then
1065 l_type_mark.process (Current)
1066 if not l_type_mark.is_implicit_mark then
1067 print_space
1068 end
1069 end
1070 a_type.name.process (Current)
1071 if not attached a_type.actual_parameters as l_actual_parameters then
1072 -- Do nothing.
1073 elseif l_actual_parameters.is_empty then
1074 -- Do not print empty brackets, but keep the comments if any.
1075 comment_finder.find_comments (l_actual_parameters, comment_list)
1076 else
1077 print_space
1078 l_actual_parameters.process (Current)
1079 end
1080 end
1081
1082 process_clients (a_list: ET_CLIENTS)
1083 -- Process `a_list'.
1084 local
1085 i, nb: INTEGER
1086 l_item: ET_CLIENT_ITEM
1087 l_client_name: ET_CLASS_NAME
1088 do
1089 a_list.left_brace.process (Current)
1090 nb := a_list.count
1091 from i := 1 until i > nb loop
1092 l_item := a_list.item (i)
1093 l_client_name := l_item.name
1094 l_client_name.process (Current)
1095 comment_finder.add_excluded_node (l_client_name)
1096 comment_finder.find_comments (l_item, comment_list)
1097 comment_finder.reset_excluded_nodes
1098 if i /= nb then
1099 -- The AST may or may not contain the comma.
1100 -- So we have to print it explicitly here.
1101 tokens.comma_symbol.process (Current)
1102 print_space
1103 end
1104 i := i + 1
1105 end
1106 a_list.right_brace.process (Current)
1107 end
1108
1109 process_colon_type (a_type: ET_COLON_TYPE)
1110 -- Process `a_type'.
1111 do
1112 a_type.colon.process (Current)
1113 print_space
1114 a_type.type.process (Current)
1115 end
1116
1117 process_comments
1118 -- Process comments that have not been printed yet.
1119 -- Print comments in `comment_list' on their own line (go to
1120 -- next line if necessary), with an extra indentation level.
1121 -- Comments are followed by a new-line. Then wipe out the list.
1122 do
1123 print_indented_comments (comment_list)
1124 comment_list.wipe_out
1125 ensure
1126 no_more_comments: comment_list.is_empty
1127 end
1128
1129 process_comments_on_same_line
1130 -- Process comments that have not been printed yet.
1131 -- If `comment_list' is not empty, then print a space followed by
1132 -- the first comment on the current line. The remaining comments
1133 -- are printed on their own line, with an extra indentation level.
1134 -- Comments are followed by a new-line. Then wipe out the list.
1135 do
1136 print_comments_on_same_line (comment_list)
1137 comment_list.wipe_out
1138 ensure
1139 no_more_comments: comment_list.is_empty
1140 end
1141
1142 process_compound (a_list: ET_COMPOUND)
1143 -- Process `a_list'.
1144 do
1145 a_list.keyword.process (Current)
1146 indent
1147 process_instruction_list (a_list)
1148 dedent
1149 end
1150
1151 process_constant_attribute (a_feature: ET_CONSTANT_ATTRIBUTE)
1152 -- Process `a_feature'.
1153 local
1154 l_synonym: detachable ET_FEATURE
1155 l_extended_feature_name: ET_EXTENDED_FEATURE_NAME
1156 l_feature_name: ET_FEATURE_NAME
1157 l_declared_type: ET_DECLARED_TYPE
1158 l_type: ET_TYPE
1159 do
1160 from
1161 l_synonym := a_feature
1162 until
1163 l_synonym = Void
1164 loop
1165 if attached l_synonym.frozen_keyword as l_frozen_keyword then
1166 l_frozen_keyword.process (Current)
1167 print_space
1168 end
1169 l_extended_feature_name := l_synonym.extended_name
1170 l_feature_name := l_extended_feature_name.feature_name
1171 l_feature_name.process (Current)
1172 if attached l_extended_feature_name.alias_name as l_alias_name and then not ANY_.same_objects (l_alias_name, l_feature_name) then
1173 -- For infix and prefix features, do not repeat the name twice.
1174 print_space
1175 l_alias_name.process (Current)
1176 comment_finder.add_excluded_node (l_alias_name)
1177 end
1178 comment_finder.add_excluded_node (l_feature_name)
1179 comment_finder.find_comments (l_extended_feature_name, comment_list)
1180 comment_finder.reset_excluded_nodes
1181 l_synonym := l_synonym.synonym
1182 if l_synonym /= Void then
1183 -- The AST may or may not contain the comma.
1184 -- So we have to print it explicitly here.
1185 tokens.comma_symbol.process (Current)
1186 print_space
1187 end
1188 end
1189 -- The AST may or may not contain the colon.
1190 -- So we have to print it explicitly here.
1191 l_declared_type := a_feature.declared_type
1192 l_type := l_declared_type.type
1193 tokens.colon_symbol.process (Current)
1194 comment_finder.add_excluded_node (l_type)
1195 comment_finder.find_comments (l_declared_type, comment_list)
1196 comment_finder.reset_excluded_nodes
1197 print_space
1198 l_type.process (Current)
1199 print_space
1200 if attached a_feature.assigner as l_assigner then
1201 l_assigner.process (Current)
1202 print_space
1203 end
1204 tokens.is_keyword.process (Current)
1205 process_break (a_feature.is_keyword.break)
1206 print_space
1207 a_feature.constant.process (Current)
1208 if attached a_feature.semicolon as l_semicolon then
1209 -- Do not print the semicolon, but keep track of its comments if any.
1210 process_break (l_semicolon.break)
1211 end
1212 -- Print header comment.
1213 indent
1214 process_comments
1215 dedent
1216 end
1217
1218 process_constrained_formal_parameter (a_parameter: ET_CONSTRAINED_FORMAL_PARAMETER)
1219 -- Process `a_parameter'.
1220 do
1221 if attached a_parameter.type_mark as l_type_mark then
1222 l_type_mark.process (Current)
1223 print_space
1224 end
1225 a_parameter.name.process (Current)
1226 print_space
1227 a_parameter.arrow_symbol.process (Current)
1228 print_space
1229 a_parameter.constraint.process (Current)
1230 if attached a_parameter.creation_procedures as l_creation_procedures then
1231 print_space
1232 l_creation_procedures.process (Current)
1233 end
1234 end
1235
1236 process_constraint_creator (a_list: ET_CONSTRAINT_CREATOR)
1237 -- Process `a_list'.
1238 local
1239 i, nb: INTEGER
1240 l_item: ET_FEATURE_NAME_ITEM
1241 l_feature_name: ET_FEATURE_NAME
1242 do
1243 a_list.create_keyword.process (Current)
1244 print_space
1245 nb := a_list.count
1246 from i := 1 until i > nb loop
1247 l_item := a_list.item (i)
1248 l_feature_name := l_item.feature_name
1249 l_feature_name.process (Current)
1250 if i /= nb then
1251 -- The AST may or may not contain the comma.
1252 -- So we have to print it explicitly here.
1253 tokens.comma_symbol.process (Current)
1254 end
1255 comment_finder.add_excluded_node (l_feature_name)
1256 comment_finder.find_comments (l_item, comment_list)
1257 comment_finder.reset_excluded_nodes
1258 print_space
1259 i := i + 1
1260 end
1261 a_list.end_keyword.process (Current)
1262 end
1263
1264 process_convert_feature_list (a_list: ET_CONVERT_FEATURE_LIST)
1265 -- Process `a_list'.
1266 local
1267 i, nb: INTEGER
1268 l_item: ET_CONVERT_FEATURE_ITEM
1269 l_convert_feature: ET_CONVERT_FEATURE
1270 do
1271 a_list.convert_keyword.process (Current)
1272 nb := a_list.count
1273 if nb /= 0 then
1274 process_comments
1275 print_new_line
1276 end
1277 indent
1278 from i := 1 until i > nb loop
1279 l_item := a_list.item (i)
1280 l_convert_feature := l_item.convert_feature
1281 process_comments
1282 print_new_line
1283 l_convert_feature.process (Current)
1284 if i /= nb then
1285 -- The AST may or may not contain the comma.
1286 -- So we have to print it explicitly here.
1287 tokens.comma_symbol.process (Current)
1288 end
1289 comment_finder.add_excluded_node (l_convert_feature)
1290 comment_finder.find_comments (l_item, comment_list)
1291 comment_finder.reset_excluded_nodes
1292 i := i + 1
1293 end
1294 dedent
1295 end
1296
1297 process_convert_function (a_convert_function: ET_CONVERT_FUNCTION)
1298 -- Process `a_convert_function'.
1299 do
1300 a_convert_function.name.process (Current)
1301 a_convert_function.colon.process (Current)
1302 print_space
1303 a_convert_function.types.process (Current)
1304 end
1305
1306 process_convert_procedure (a_convert_procedure: ET_CONVERT_PROCEDURE)
1307 -- Process `a_convert_procedure'.
1308 do
1309 a_convert_procedure.name.process (Current)
1310 print_space
1311 a_convert_procedure.left_parenthesis.process (Current)
1312 a_convert_procedure.types.process (Current)
1313 a_convert_procedure.right_parenthesis.process (Current)
1314 end
1315
1316 process_create_expression (an_expression: ET_CREATE_EXPRESSION)
1317 -- Process `an_expression'.
1318 local
1319 l_creation_type: ET_TARGET_TYPE
1320 l_type: ET_TYPE
1321 do
1322 an_expression.create_keyword.process (Current)
1323 print_space
1324 l_creation_type := an_expression.creation_type
1325 l_type := l_creation_type.type
1326 tokens.left_brace_symbol.process (Current)
1327 l_type.process (Current)
1328 tokens.right_brace_symbol.process (Current)
1329 comment_finder.add_excluded_node (l_type)
1330 comment_finder.find_comments (l_creation_type, comment_list)
1331 comment_finder.reset_excluded_nodes
1332 if attached an_expression.creation_call as l_creation_call then
1333 l_creation_call.process (Current)
1334 end
1335 end
1336
1337 process_create_instruction (an_instruction: ET_CREATE_INSTRUCTION)
1338 -- Process `an_instruction'.
1339 local
1340 l_type: ET_TYPE
1341 do
1342 an_instruction.create_keyword.process (Current)
1343 print_space
1344 if attached an_instruction.creation_type as l_creation_type then
1345 l_type := l_creation_type.type
1346 tokens.left_brace_symbol.process (Current)
1347 l_type.process (Current)
1348 tokens.right_brace_symbol.process (Current)
1349 comment_finder.add_excluded_node (l_type)
1350 comment_finder.find_comments (l_creation_type, comment_list)
1351 comment_finder.reset_excluded_nodes
1352 print_space
1353 end
1354 an_instruction.target.process (Current)
1355 if attached an_instruction.creation_call as l_creation_call then
1356 l_creation_call.process (Current)
1357 end
1358 end
1359
1360 process_creator (a_list: ET_CREATOR)
1361 -- Process `a_list'.
1362 local
1363 i, nb: INTEGER
1364 l_item: ET_FEATURE_NAME_ITEM
1365 l_feature_name: ET_FEATURE_NAME
1366 do
1367 a_list.creation_keyword.process (Current)
1368 if attached a_list.clients_clause as l_clients then
1369 print_space
1370 l_clients.process (Current)
1371 end
1372 nb := a_list.count
1373 if nb /= 0 then
1374 process_comments
1375 print_new_line
1376 end
1377 indent
1378 from i := 1 until i > nb loop
1379 process_comments
1380 print_new_line
1381 l_item := a_list.item (i)
1382 l_feature_name := l_item.feature_name
1383 l_feature_name.process (Current)
1384 if i /= nb then
1385 -- The AST may or may not contain the comma.
1386 -- So we have to print it explicitly here.
1387 tokens.comma_symbol.process (Current)
1388 end
1389 comment_finder.add_excluded_node (l_feature_name)
1390 comment_finder.find_comments (l_item, comment_list)
1391 comment_finder.reset_excluded_nodes
1392 i := i + 1
1393 end
1394 dedent
1395 end
1396
1397 process_creator_list (a_list: ET_CREATOR_LIST)
1398 -- Process `a_list'.
1399 local
1400 i, nb: INTEGER
1401 l_creator: ET_CREATOR
1402 do
1403 nb := a_list.count
1404 from i := 1 until i > nb loop
1405 l_creator := a_list.item (i)
1406 l_creator.process (Current)
1407 if i /= nb then
1408 process_comments
1409 print_new_line
1410 print_new_line
1411 end
1412 i := i + 1
1413 end
1414 end
1415
1416 process_custom_attribute (an_attribute: ET_CUSTOM_ATTRIBUTE)
1417 -- Process `an_attribute'.
1418 do
1419 an_attribute.creation_expression.process (Current)
1420 print_space
1421 if attached an_attribute.settings as l_settings then
1422 l_settings.process (Current)
1423 print_space
1424 end
1425 an_attribute.end_keyword.process (Current)
1426 end
1427
1428 process_debug_instruction (an_instruction: ET_DEBUG_INSTRUCTION)
1429 -- Process `an_instruction'.
1430 local
1431 l_compound: detachable ET_COMPOUND
1432 do
1433 tokens.debug_keyword.process (Current)
1434 l_compound := an_instruction.compound
1435 if l_compound /= Void then
1436 process_break (l_compound.keyword.break)
1437 end
1438 if attached an_instruction.keys as l_keys then
1439 if l_keys.is_empty then
1440 -- Do not print empty parentheses, but keep the comments if any.
1441 comment_finder.find_comments (l_keys, comment_list)
1442 else
1443 print_space
1444 l_keys.process (Current)
1445 end
1446 end
1447 if l_compound /= Void then
1448 indent
1449 process_instruction_list (l_compound)
1450 dedent
1451 else
1452 process_comments
1453 end
1454 print_new_line
1455 an_instruction.end_keyword.process (Current)
1456 end
1457
1458 process_deferred_function (a_feature: ET_DEFERRED_FUNCTION)
1459 -- Process `a_feature'.
1460 local
1461 l_extended_feature_name: ET_EXTENDED_FEATURE_NAME
1462 l_feature_name: ET_FEATURE_NAME
1463 l_declared_type: ET_DECLARED_TYPE
1464 l_type: ET_TYPE
1465 l_synonym: detachable ET_FEATURE
1466 l_obsolete_string: ET_MANIFEST_STRING
1467 do
1468 from
1469 l_synonym := a_feature
1470 until
1471 l_synonym = Void
1472 loop
1473 if attached l_synonym.frozen_keyword as l_frozen_keyword then
1474 l_frozen_keyword.process (Current)
1475 print_space
1476 end
1477 l_extended_feature_name := l_synonym.extended_name
1478 l_feature_name := l_extended_feature_name.feature_name
1479 l_feature_name.process (Current)
1480 if attached l_extended_feature_name.alias_name as l_alias_name and then not ANY_.same_objects (l_alias_name, l_feature_name) then
1481 -- For infix and prefix features, do not repeat the name twice.
1482 print_space
1483 l_alias_name.process (Current)
1484 comment_finder.add_excluded_node (l_alias_name)
1485 end
1486 comment_finder.add_excluded_node (l_feature_name)
1487 comment_finder.find_comments (l_extended_feature_name, comment_list)
1488 comment_finder.reset_excluded_nodes
1489 l_synonym := l_synonym.synonym
1490 if l_synonym /= Void then
1491 -- The AST may or may not contain the comma.
1492 -- So we have to print it explicitly here.
1493 tokens.comma_symbol.process (Current)
1494 print_space
1495 end
1496 end
1497 if attached a_feature.arguments as l_arguments then
1498 if l_arguments.is_empty then
1499 -- Do not print empty parentheses, but keep the comments if any.
1500 comment_finder.find_comments (l_arguments, comment_list)
1501 else
1502 print_space
1503 l_arguments.process (Current)
1504 end
1505 end
1506 -- The AST may or may not contain the colon.
1507 -- So we have to print it explicitly here.
1508 l_declared_type := a_feature.declared_type
1509 l_type := l_declared_type.type
1510 tokens.colon_symbol.process (Current)
1511 comment_finder.add_excluded_node (l_type)
1512 comment_finder.find_comments (l_declared_type, comment_list)
1513 comment_finder.reset_excluded_nodes
1514 print_space
1515 l_type.process (Current)
1516 if attached a_feature.assigner as l_assigner then
1517 print_space
1518 l_assigner.process (Current)
1519 end
1520 print_space
1521 tokens.is_keyword.process (Current)
1522 if attached a_feature.is_keyword as l_is_keyword then
1523 process_break (l_is_keyword.break)
1524 end
1525 indent
1526 process_comments
1527 print_new_line
1528 if attached a_feature.first_indexing as l_indexing then
1529 process_indexing_clause (l_indexing, False)
1530 process_comments
1531 print_new_line
1532 end
1533 if attached a_feature.obsolete_message as l_obsolete_message then
1534 tokens.obsolete_keyword.process (Current)
1535 l_obsolete_string := l_obsolete_message.manifest_string
1536 comment_finder.add_excluded_node (l_obsolete_string)
1537 comment_finder.find_comments (l_obsolete_message, comment_list)
1538 comment_finder.reset_excluded_nodes
1539 indent
1540 process_comments
1541 print_new_line
1542 l_obsolete_string.process (Current)
1543 process_comments
1544 print_new_line
1545 dedent
1546 end
1547 if attached a_feature.preconditions as l_preconditions then
1548 l_preconditions.process (Current)
1549 process_comments
1550 end
1551 a_feature.deferred_keyword.process (Current)
1552 process_comments
1553 print_new_line
1554 if attached a_feature.postconditions as l_postconditions then
1555 l_postconditions.process (Current)
1556 process_comments
1557 end
1558 a_feature.end_keyword.process (Current)
1559 if attached a_feature.semicolon as l_semicolon then
1560 -- Do not print the semicolon, but keep track of its comments if any.
1561 process_break (l_semicolon.break)
1562 end
1563 dedent
1564 end
1565
1566 process_deferred_procedure (a_feature: ET_DEFERRED_PROCEDURE)
1567 -- Process `a_feature'.
1568 local
1569 l_extended_feature_name: ET_EXTENDED_FEATURE_NAME
1570 l_feature_name: ET_FEATURE_NAME
1571 l_synonym: detachable ET_FEATURE
1572 l_obsolete_string: ET_MANIFEST_STRING
1573 do
1574 from
1575 l_synonym := a_feature
1576 until
1577 l_synonym = Void
1578 loop
1579 if attached l_synonym.frozen_keyword as l_frozen_keyword then
1580 l_frozen_keyword.process (Current)
1581 print_space
1582 end
1583 l_extended_feature_name := l_synonym.extended_name
1584 l_feature_name := l_extended_feature_name.feature_name
1585 l_feature_name.process (Current)
1586 if attached l_extended_feature_name.alias_name as l_alias_name and then not ANY_.same_objects (l_alias_name, l_feature_name) then
1587 -- For infix and prefix features, do not repeat the name twice.
1588 print_space
1589 l_alias_name.process (Current)
1590 comment_finder.add_excluded_node (l_alias_name)
1591 end
1592 comment_finder.add_excluded_node (l_feature_name)
1593 comment_finder.find_comments (l_extended_feature_name, comment_list)
1594 comment_finder.reset_excluded_nodes
1595 l_synonym := l_synonym.synonym
1596 if l_synonym /= Void then
1597 -- The AST may or may not contain the comma.
1598 -- So we have to print it explicitly here.
1599 tokens.comma_symbol.process (Current)
1600 print_space
1601 end
1602 end
1603 if attached a_feature.arguments as l_arguments then
1604 if l_arguments.is_empty then
1605 -- Do not print empty parentheses, but keep the comments if any.
1606 comment_finder.find_comments (l_arguments, comment_list)
1607 else
1608 print_space
1609 l_arguments.process (Current)
1610 end
1611 end
1612 print_space
1613 tokens.is_keyword.process (Current)
1614 if attached a_feature.is_keyword as l_is_keyword then
1615 process_break (l_is_keyword.break)
1616 end
1617 indent
1618 process_comments
1619 print_new_line
1620 if attached a_feature.first_indexing as l_indexing then
1621 process_indexing_clause (l_indexing, False)
1622 process_comments
1623 print_new_line
1624 end
1625 if attached a_feature.obsolete_message as l_obsolete_message then
1626 tokens.obsolete_keyword.process (Current)
1627 l_obsolete_string := l_obsolete_message.manifest_string
1628 comment_finder.add_excluded_node (l_obsolete_string)
1629 comment_finder.find_comments (l_obsolete_message, comment_list)
1630 comment_finder.reset_excluded_nodes
1631 indent
1632 process_comments
1633 print_new_line
1634 l_obsolete_string.process (Current)
1635 process_comments
1636 print_new_line
1637 dedent
1638 end
1639 if attached a_feature.preconditions as l_preconditions then
1640 l_preconditions.process (Current)
1641 process_comments
1642 end
1643 a_feature.deferred_keyword.process (Current)
1644 process_comments
1645 print_new_line
1646 if attached a_feature.postconditions as l_postconditions then
1647 l_postconditions.process (Current)
1648 process_comments
1649 end
1650 a_feature.end_keyword.process (Current)
1651 if attached a_feature.semicolon as l_semicolon then
1652 -- Do not print the semicolon, but keep track of its comments if any.
1653 process_break (l_semicolon.break)
1654 end
1655 dedent
1656 end
1657
1658 process_do_function (a_feature: ET_DO_FUNCTION)
1659 -- Process `a_feature'.
1660 local
1661 l_extended_feature_name: ET_EXTENDED_FEATURE_NAME
1662 l_feature_name: ET_FEATURE_NAME
1663 l_declared_type: ET_DECLARED_TYPE
1664 l_type: ET_TYPE
1665 l_synonym: detachable ET_FEATURE
1666 l_obsolete_string: ET_MANIFEST_STRING
1667 do
1668 from
1669 l_synonym := a_feature
1670 until
1671 l_synonym = Void
1672 loop
1673 if attached l_synonym.frozen_keyword as l_frozen_keyword then
1674 l_frozen_keyword.process (Current)
1675 print_space
1676 end
1677 l_extended_feature_name := l_synonym.extended_name
1678 l_feature_name := l_extended_feature_name.feature_name
1679 l_feature_name.process (Current)
1680 if attached l_extended_feature_name.alias_name as l_alias_name and then not ANY_.same_objects (l_alias_name, l_feature_name) then
1681 -- For infix and prefix features, do not repeat the name twice.
1682 print_space
1683 l_alias_name.process (Current)
1684 comment_finder.add_excluded_node (l_alias_name)
1685 end
1686 comment_finder.add_excluded_node (l_feature_name)
1687 comment_finder.find_comments (l_extended_feature_name, comment_list)
1688 comment_finder.reset_excluded_nodes
1689 l_synonym := l_synonym.synonym
1690 if l_synonym /= Void then
1691 -- The AST may or may not contain the comma.
1692 -- So we have to print it explicitly here.
1693 tokens.comma_symbol.process (Current)
1694 print_space
1695 end
1696 end
1697 if attached a_feature.arguments as l_arguments then
1698 if l_arguments.is_empty then
1699 -- Do not print empty parentheses, but keep the comments if any.
1700 comment_finder.find_comments (l_arguments, comment_list)
1701 else
1702 print_space
1703 l_arguments.process (Current)
1704 end
1705 end
1706 -- The AST may or may not contain the colon.
1707 -- So we have to print it explicitly here.
1708 l_declared_type := a_feature.declared_type
1709 l_type := l_declared_type.type
1710 tokens.colon_symbol.process (Current)
1711 comment_finder.add_excluded_node (l_type)
1712 comment_finder.find_comments (l_declared_type, comment_list)
1713 comment_finder.reset_excluded_nodes
1714 print_space
1715 l_type.process (Current)
1716 if attached a_feature.assigner as l_assigner then
1717 print_space
1718 l_assigner.process (Current)
1719 end
1720 print_space
1721 tokens.is_keyword.process (Current)
1722 if attached a_feature.is_keyword as l_is_keyword then
1723 process_break (l_is_keyword.break)
1724 end
1725 indent
1726 process_comments
1727 print_new_line
1728 if attached a_feature.first_indexing as l_indexing then
1729 process_indexing_clause (l_indexing, False)
1730 process_comments
1731 print_new_line
1732 end
1733 if attached a_feature.obsolete_message as l_obsolete_message then
1734 tokens.obsolete_keyword.process (Current)
1735 l_obsolete_string := l_obsolete_message.manifest_string
1736 comment_finder.add_excluded_node (l_obsolete_string)
1737 comment_finder.find_comments (l_obsolete_message, comment_list)
1738 comment_finder.reset_excluded_nodes
1739 indent
1740 process_comments
1741 print_new_line
1742 l_obsolete_string.process (Current)
1743 process_comments
1744 print_new_line
1745 dedent
1746 end
1747 if attached a_feature.preconditions as l_preconditions then
1748 l_preconditions.process (Current)
1749 process_comments
1750 end
1751 if attached a_feature.locals as l_locals then
1752 l_locals.process (Current)
1753 process_comments
1754 end
1755 if attached a_feature.compound as l_compound then
1756 l_compound.process (Current)
1757 else
1758 tokens.do_keyword.process (Current)
1759 end
1760 process_comments
1761 print_new_line
1762 if attached a_feature.postconditions as l_postconditions then
1763 l_postconditions.process (Current)
1764 process_comments
1765 end
1766 if attached a_feature.rescue_clause as l_rescue_clause then
1767 l_rescue_clause.process (Current)
1768 process_comments
1769 print_new_line
1770 end
1771 a_feature.end_keyword.process (Current)
1772 if attached a_feature.semicolon as l_semicolon then
1773 -- Do not print the semicolon, but keep track of its comments if any.
1774 process_break (l_semicolon.break)
1775 end
1776 dedent
1777 end
1778
1779 process_do_function_inline_agent (an_expression: ET_DO_FUNCTION_INLINE_AGENT)
1780 -- Process `an_expression'.
1781 local
1782 l_declared_type: ET_DECLARED_TYPE
1783 l_type: ET_TYPE
1784 do
1785 an_expression.agent_keyword.process (Current)
1786 print_space
1787 if attached an_expression.formal_arguments as l_formal_arguments then
1788 if l_formal_arguments.is_empty then
1789 -- Do not print empty parentheses, but keep the comments if any.
1790 comment_finder.find_comments (l_formal_arguments, comment_list)
1791 else
1792 l_formal_arguments.process (Current)
1793 end
1794 end
1795 -- The AST may or may not contain the colon.
1796 -- So we have to print it explicitly here.
1797 l_declared_type := an_expression.declared_type
1798 l_type := l_declared_type.type
1799 tokens.colon_symbol.process (Current)
1800 comment_finder.add_excluded_node (l_type)
1801 comment_finder.find_comments (l_declared_type, comment_list)
1802 comment_finder.reset_excluded_nodes
1803 print_space
1804 l_type.process (Current)
1805 process_comments
1806 print_new_line
1807 if attached an_expression.preconditions as l_preconditions then
1808 l_preconditions.process (Current)
1809 process_comments
1810 end
1811 if attached an_expression.locals as l_locals then
1812 l_locals.process (Current)
1813 process_comments
1814 end
1815 if attached an_expression.compound as l_compound then
1816 l_compound.process (Current)
1817 else
1818 tokens.do_keyword.process (Current)
1819 end
1820 process_comments
1821 print_new_line
1822 if attached an_expression.postconditions as l_postconditions then
1823 l_postconditions.process (Current)
1824 process_comments
1825 end
1826 if attached an_expression.rescue_clause as l_rescue_clause then
1827 l_rescue_clause.process (Current)
1828 process_comments
1829 print_new_line
1830 end
1831 an_expression.end_keyword.process (Current)
1832 if attached {ET_AGENT_ARGUMENT_OPERAND_LIST} an_expression.actual_arguments as l_actual_arguments then
1833 -- Do not print implicit argument operands (they were not in the original class text anyway).
1834 if l_actual_arguments.is_empty then
1835 -- Do not print empty parentheses, but keep the comments if any.
1836 comment_finder.find_comments (l_actual_arguments, comment_list)
1837 else
1838 print_space
1839 l_actual_arguments.process (Current)
1840 end
1841 end
1842 end
1843
1844 process_do_procedure (a_feature: ET_DO_PROCEDURE)
1845 -- Process `a_feature'.
1846 local
1847 l_extended_feature_name: ET_EXTENDED_FEATURE_NAME
1848 l_feature_name: ET_FEATURE_NAME
1849 l_synonym: detachable ET_FEATURE
1850 l_obsolete_string: ET_MANIFEST_STRING
1851 do
1852 from
1853 l_synonym := a_feature
1854 until
1855 l_synonym = Void
1856 loop
1857 if attached l_synonym.frozen_keyword as l_frozen_keyword then
1858 l_frozen_keyword.process (Current)
1859 print_space
1860 end
1861 l_extended_feature_name := l_synonym.extended_name
1862 l_feature_name := l_extended_feature_name.feature_name
1863 l_feature_name.process (Current)
1864 if attached l_extended_feature_name.alias_name as l_alias_name and then not ANY_.same_objects (l_alias_name, l_feature_name) then
1865 -- For infix and prefix features, do not repeat the name twice.
1866 print_space
1867 l_alias_name.process (Current)
1868 comment_finder.add_excluded_node (l_alias_name)
1869 end
1870 comment_finder.add_excluded_node (l_feature_name)
1871 comment_finder.find_comments (l_extended_feature_name, comment_list)
1872 comment_finder.reset_excluded_nodes
1873 l_synonym := l_synonym.synonym
1874 if l_synonym /= Void then
1875 -- The AST may or may not contain the comma.
1876 -- So we have to print it explicitly here.
1877 tokens.comma_symbol.process (Current)
1878 print_space
1879 end
1880 end
1881 if attached a_feature.arguments as l_arguments then
1882 if l_arguments.is_empty then
1883 -- Do not print empty parentheses, but keep the comments if any.
1884 comment_finder.find_comments (l_arguments, comment_list)
1885 else
1886 print_space
1887 l_arguments.process (Current)
1888 end
1889 end
1890 print_space
1891 tokens.is_keyword.process (Current)
1892 if attached a_feature.is_keyword as l_is_keyword then
1893 process_break (l_is_keyword.break)
1894 end
1895 indent
1896 process_comments
1897 print_new_line
1898 if attached a_feature.first_indexing as l_indexing then
1899 process_indexing_clause (l_indexing, False)
1900 process_comments
1901 print_new_line
1902 end
1903 if attached a_feature.obsolete_message as l_obsolete_message then
1904 tokens.obsolete_keyword.process (Current)
1905 l_obsolete_string := l_obsolete_message.manifest_string
1906 comment_finder.add_excluded_node (l_obsolete_string)
1907 comment_finder.find_comments (l_obsolete_message, comment_list)
1908 comment_finder.reset_excluded_nodes
1909 indent
1910 process_comments
1911 print_new_line
1912 l_obsolete_string.process (Current)
1913 process_comments
1914 print_new_line
1915 dedent
1916 end
1917 if attached a_feature.preconditions as l_preconditions then
1918 l_preconditions.process (Current)
1919 process_comments
1920 end
1921 if attached a_feature.locals as l_locals then
1922 l_locals.process (Current)
1923 process_comments
1924 end
1925 if attached a_feature.compound as l_compound then
1926 l_compound.process (Current)
1927 else
1928 tokens.do_keyword.process (Current)
1929 end
1930 process_comments
1931 print_new_line
1932 if attached a_feature.postconditions as l_postconditions then
1933 l_postconditions.process (Current)
1934 process_comments
1935 end
1936 if attached a_feature.rescue_clause as l_rescue_clause then
1937 l_rescue_clause.process (Current)
1938 process_comments
1939 print_new_line
1940 end
1941 a_feature.end_keyword.process (Current)
1942 if attached a_feature.semicolon as l_semicolon then
1943 -- Do not print the semicolon, but keep track of its comments if any.
1944 process_break (l_semicolon.break)
1945 end
1946 dedent
1947 end
1948
1949 process_do_procedure_inline_agent (an_expression: ET_DO_PROCEDURE_INLINE_AGENT)
1950 -- Process `an_expression'.
1951 do
1952 an_expression.agent_keyword.process (Current)
1953 if attached an_expression.formal_arguments as l_formal_arguments then
1954 if l_formal_arguments.is_empty then
1955 -- Do not print empty parentheses, but keep the comments if any.
1956 comment_finder.find_comments (l_formal_arguments, comment_list)
1957 else
1958 print_space
1959 l_formal_arguments.process (Current)
1960 end
1961 end
1962 process_comments
1963 print_new_line
1964 if attached an_expression.preconditions as l_preconditions then
1965 l_preconditions.process (Current)
1966 process_comments
1967 end
1968 if attached an_expression.locals as l_locals then
1969 l_locals.process (Current)
1970 process_comments
1971 end
1972 if attached an_expression.compound as l_compound then
1973 l_compound.process (Current)
1974 else
1975 tokens.do_keyword.process (Current)
1976 end
1977 process_comments
1978 print_new_line
1979 if attached an_expression.postconditions as l_postconditions then
1980 l_postconditions.process (Current)
1981 process_comments
1982 end
1983 if attached an_expression.rescue_clause as l_rescue_clause then
1984 l_rescue_clause.process (Current)
1985 process_comments
1986 print_new_line
1987 end
1988 an_expression.end_keyword.process (Current)
1989 if attached {ET_AGENT_ARGUMENT_OPERAND_LIST} an_expression.actual_arguments as l_actual_arguments then
1990 -- Do not print implicit argument operands (they were not in the original class text anyway).
1991 if l_actual_arguments.is_empty then
1992 -- Do not print empty parentheses, but keep the comments if any.
1993 comment_finder.find_comments (l_actual_arguments, comment_list)
1994 else
1995 print_space
1996 l_actual_arguments.process (Current)
1997 end
1998 end
1999 end
2000
2001 process_dotnet_function (a_feature: ET_DOTNET_FUNCTION)
2002 -- Process `a_feature'.
2003 local
2004 l_extended_feature_name: ET_EXTENDED_FEATURE_NAME
2005 l_feature_name: ET_FEATURE_NAME
2006 l_declared_type: ET_DECLARED_TYPE
2007 l_type: ET_TYPE
2008 l_synonym: detachable ET_FEATURE
2009 do
2010 from
2011 l_synonym := a_feature
2012 until
2013 l_synonym = Void
2014 loop
2015 if attached l_synonym.frozen_keyword as l_frozen_keyword then
2016 l_frozen_keyword.process (Current)
2017 print_space
2018 end
2019 l_extended_feature_name := l_synonym.extended_name
2020 l_feature_name := l_extended_feature_name.feature_name
2021 l_feature_name.process (Current)
2022 if attached l_extended_feature_name.alias_name as l_alias_name and then not ANY_.same_objects (l_alias_name, l_feature_name) then
2023 -- For infix and prefix features, do not repeat the name twice.
2024 print_space
2025 l_alias_name.process (Current)
2026 comment_finder.add_excluded_node (l_alias_name)
2027 end
2028 comment_finder.add_excluded_node (l_feature_name)
2029 comment_finder.find_comments (l_extended_feature_name, comment_list)
2030 comment_finder.reset_excluded_nodes
2031 l_synonym := l_synonym.synonym
2032 if l_synonym /= Void then
2033 -- The AST may or may not contain the comma.
2034 -- So we have to print it explicitly here.
2035 tokens.comma_symbol.process (Current)
2036 print_space
2037 end
2038 end
2039 if attached a_feature.arguments as l_arguments then
2040 if l_arguments.is_empty then
2041 -- Do not print empty parentheses, but keep the comments if any.
2042 comment_finder.find_comments (l_arguments, comment_list)
2043 else
2044 print_space
2045 l_arguments.process (Current)
2046 end
2047 end
2048 -- The AST may or may not contain the colon.
2049 -- So we have to print it explicitly here.
2050 l_declared_type := a_feature.declared_type
2051 l_type := l_declared_type.type
2052 tokens.colon_symbol.process (Current)
2053 comment_finder.add_excluded_node (l_type)
2054 comment_finder.find_comments (l_declared_type, comment_list)
2055 comment_finder.reset_excluded_nodes
2056 print_space
2057 l_type.process (Current)
2058 if attached a_feature.assigner as l_assigner then
2059 print_space
2060 l_assigner.process (Current)
2061 end
2062 print_space
2063 tokens.is_keyword.process (Current)
2064 if attached a_feature.is_keyword as l_is_keyword then
2065 process_break (l_is_keyword.break)
2066 end
2067 indent
2068 process_comments
2069 print_new_line
2070 tokens.do_keyword.process (Current)
2071 process_comments
2072 print_new_line
2073 a_feature.end_keyword.process (Current)
2074 if attached a_feature.semicolon as l_semicolon then
2075 -- Do not print the semicolon, but keep track of its comments if any.
2076 process_break (l_semicolon.break)
2077 end
2078 dedent
2079 end
2080
2081 process_dotnet_procedure (a_feature: ET_DOTNET_PROCEDURE)
2082 -- Process `a_feature'.
2083 local
2084 l_extended_feature_name: ET_EXTENDED_FEATURE_NAME
2085 l_feature_name: ET_FEATURE_NAME
2086 l_synonym: detachable ET_FEATURE
2087 do
2088 from
2089 l_synonym := a_feature
2090 until
2091 l_synonym = Void
2092 loop
2093 if attached l_synonym.frozen_keyword as l_frozen_keyword then
2094 l_frozen_keyword.process (Current)
2095 print_space
2096 end
2097 l_extended_feature_name := l_synonym.extended_name
2098 l_feature_name := l_extended_feature_name.feature_name
2099 l_feature_name.process (Current)
2100 if attached l_extended_feature_name.alias_name as l_alias_name and then not ANY_.same_objects (l_alias_name, l_feature_name) then
2101 -- For infix and prefix features, do not repeat the name twice.
2102 print_space
2103 l_alias_name.process (Current)
2104 comment_finder.add_excluded_node (l_alias_name)
2105 end
2106 comment_finder.add_excluded_node (l_feature_name)
2107 comment_finder.find_comments (l_extended_feature_name, comment_list)
2108 comment_finder.reset_excluded_nodes
2109 l_synonym := l_synonym.synonym
2110 if l_synonym /= Void then
2111 -- The AST may or may not contain the comma.
2112 -- So we have to print it explicitly here.
2113 tokens.comma_symbol.process (Current)
2114 print_space
2115 end
2116 end
2117 if attached a_feature.arguments as l_arguments then
2118 if l_arguments.is_empty then
2119 -- Do not print empty parentheses, but keep the comments if any.
2120 comment_finder.find_comments (l_arguments, comment_list)
2121 else
2122 print_space
2123 l_arguments.process (Current)
2124 end
2125 end
2126 print_space
2127 tokens.is_keyword.process (Current)
2128 if attached a_feature.is_keyword as l_is_keyword then
2129 process_break (l_is_keyword.break)
2130 end
2131 indent
2132 process_comments
2133 print_new_line
2134 tokens.do_keyword.process (Current)
2135 process_comments
2136 print_new_line
2137 a_feature.end_keyword.process (Current)
2138 if attached a_feature.semicolon as l_semicolon then
2139 -- Do not print the semicolon, but keep track of its comments if any.
2140 process_break (l_semicolon.break)
2141 end
2142 dedent
2143 end
2144
2145 process_elseif_part (an_elseif_part: ET_ELSEIF_PART)
2146 -- Process `an_elseif_part'.
2147 local
2148 l_conditional: ET_CONDITIONAL
2149 l_expression: ET_EXPRESSION
2150 do
2151 tokens.elseif_keyword.process (Current)
2152 print_space
2153 l_conditional := an_elseif_part.conditional
2154 l_expression := l_conditional.expression
2155 l_expression.process (Current)
2156 comment_finder.add_excluded_node (l_expression)
2157 comment_finder.find_comments (l_conditional, comment_list)
2158 comment_finder.reset_excluded_nodes
2159 print_space
2160 if attached an_elseif_part.then_compound as l_then_compound then
2161 l_then_compound.process (Current)
2162 else
2163 tokens.then_keyword.process (Current)
2164 end
2165 end
2166
2167 process_elseif_part_list (a_list: ET_ELSEIF_PART_LIST)
2168 -- Process `a_list'.
2169 local
2170 i, nb: INTEGER
2171 do
2172 nb := a_list.count
2173 from i := 1 until i > nb loop
2174 if i /= 1 then
2175 print_new_line
2176 end
2177 a_list.item (i).process (Current)
2178 process_comments
2179 i := i + 1
2180 end
2181 end
2182
2183 process_equality_expression (an_expression: ET_EQUALITY_EXPRESSION)
2184 -- Process `an_expression'.
2185 do
2186 an_expression.left.process (Current)
2187 print_space
2188 an_expression.operator.process (Current)
2189 print_space
2190 an_expression.right.process (Current)
2191 end
2192
2193 process_export_list (a_list: ET_EXPORT_LIST)
2194 -- Process `a_list'.
2195 local
2196 i, nb: INTEGER
2197 l_export: ET_EXPORT
2198 do
2199 if a_list.has_non_null_export then
2200 a_list.export_keyword.process (Current)
2201 indent
2202 nb := a_list.count
2203 from i := 1 until i > nb loop
2204 l_export := a_list.item (i)
2205 if l_export.is_semicolon then
2206 -- Skip null export.
2207 comment_finder.find_comments (l_export, comment_list)
2208 else
2209 process_comments
2210 print_new_line
2211 l_export.process (Current)
2212 end
2213 i := i + 1
2214 end
2215 process_comments
2216 dedent
2217 else
2218 comment_finder.find_comments (a_list, comment_list)
2219 end
2220 end
2221
2222 process_export_list_same_line (a_list: ET_EXPORT_LIST)
2223 -- Process `a_list'.
2224 -- Print every thing on the same line.
2225 require
2226 a_list_not_void: a_list /= Void
2227 local
2228 i, nb: INTEGER
2229 l_export: ET_EXPORT
2230 do
2231 if a_list.has_non_null_export then
2232 a_list.export_keyword.process (Current)
2233 indent
2234 nb := a_list.count
2235 from i := 1 until i > nb loop
2236 l_export := a_list.item (i)
2237 if l_export.is_semicolon then
2238 -- Skip null export.
2239 comment_finder.find_comments (l_export, comment_list)
2240 else
2241 print_space
2242 l_export.process (Current)
2243 end
2244 i := i + 1
2245 end
2246 process_comments
2247 dedent
2248 else
2249 comment_finder.find_comments (a_list, comment_list)
2250 end
2251 end
2252
2253 process_extended_attribute (a_feature: ET_EXTENDED_ATTRIBUTE)
2254 -- Process `a_feature'.
2255 local
2256 l_extended_feature_name: ET_EXTENDED_FEATURE_NAME
2257 l_feature_name: ET_FEATURE_NAME
2258 l_declared_type: ET_DECLARED_TYPE
2259 l_type: ET_TYPE
2260 l_synonym: detachable ET_FEATURE
2261 l_obsolete_string: ET_MANIFEST_STRING
2262 do
2263 from
2264 l_synonym := a_feature
2265 until
2266 l_synonym = Void
2267 loop
2268 if attached l_synonym.frozen_keyword as l_frozen_keyword then
2269 l_frozen_keyword.process (Current)
2270 print_space
2271 end
2272 l_extended_feature_name := l_synonym.extended_name
2273 l_feature_name := l_extended_feature_name.feature_name
2274 l_feature_name.process (Current)
2275 if attached l_extended_feature_name.alias_name as l_alias_name and then not ANY_.same_objects (l_alias_name, l_feature_name) then
2276 -- For infix and prefix features, do not repeat the name twice.
2277 print_space
2278 l_alias_name.process (Current)
2279 comment_finder.add_excluded_node (l_alias_name)
2280 end
2281 comment_finder.add_excluded_node (l_feature_name)
2282 comment_finder.find_comments (l_extended_feature_name, comment_list)
2283 comment_finder.reset_excluded_nodes
2284 l_synonym := l_synonym.synonym
2285 if l_synonym /= Void then
2286 -- The AST may or may not contain the comma.
2287 -- So we have to print it explicitly here.
2288 tokens.comma_symbol.process (Current)
2289 print_space
2290 end
2291 end
2292 -- The AST may or may not contain the colon.
2293 -- So we have to print it explicitly here.
2294 l_declared_type := a_feature.declared_type
2295 l_type := l_declared_type.type
2296 tokens.colon_symbol.process (Current)
2297 comment_finder.add_excluded_node (l_type)
2298 comment_finder.find_comments (l_declared_type, comment_list)
2299 comment_finder.reset_excluded_nodes
2300 print_space
2301 l_type.process (Current)
2302 if attached a_feature.assigner as l_assigner then
2303 print_space
2304 l_assigner.process (Current)
2305 end
2306 indent
2307 process_comments
2308 print_new_line
2309 if attached a_feature.first_indexing as l_indexing then
2310 process_indexing_clause (l_indexing, False)
2311 process_comments
2312 print_new_line
2313 end
2314 if attached a_feature.obsolete_message as l_obsolete_message then
2315 tokens.obsolete_keyword.process (Current)
2316 l_obsolete_string := l_obsolete_message.manifest_string
2317 comment_finder.add_excluded_node (l_obsolete_string)
2318 comment_finder.find_comments (l_obsolete_message, comment_list)
2319 comment_finder.reset_excluded_nodes
2320 indent
2321 process_comments
2322 print_new_line
2323 l_obsolete_string.process (Current)
2324 process_comments
2325 print_new_line
2326 dedent
2327 end
2328 if attached a_feature.preconditions as l_preconditions then
2329 l_preconditions.process (Current)
2330 process_comments
2331 end
2332 if attached a_feature.locals as l_locals then
2333 l_locals.process (Current)
2334 process_comments
2335 end
2336 if attached a_feature.compound as l_compound then
2337 l_compound.process (Current)
2338 else
2339 tokens.do_keyword.process (Current)
2340 end
2341 process_comments
2342 print_new_line
2343 if attached a_feature.postconditions as l_postconditions then
2344 l_postconditions.process (Current)
2345 process_comments
2346 end
2347 if attached a_feature.rescue_clause as l_rescue_clause then
2348 l_rescue_clause.process (Current)
2349 process_comments
2350 print_new_line
2351 end
2352 a_feature.end_keyword.process (Current)
2353 if attached a_feature.semicolon as l_semicolon then
2354 -- Do not print the semicolon, but keep track of its comments if any.
2355 process_break (l_semicolon.break)
2356 end
2357 dedent
2358 end
2359
2360 process_external_function (a_feature: ET_EXTERNAL_FUNCTION)
2361 -- Process `a_feature'.
2362 local
2363 l_extended_feature_name: ET_EXTENDED_FEATURE_NAME
2364 l_feature_name: ET_FEATURE_NAME
2365 l_declared_type: ET_DECLARED_TYPE
2366 l_type: ET_TYPE
2367 l_synonym: detachable ET_FEATURE
2368 l_obsolete_string: ET_MANIFEST_STRING
2369 l_external_language: ET_EXTERNAL_LANGUAGE
2370 l_manifest_string: ET_MANIFEST_STRING
2371 do
2372 from
2373 l_synonym := a_feature
2374 until
2375 l_synonym = Void
2376 loop
2377 if attached l_synonym.frozen_keyword as l_frozen_keyword then
2378 l_frozen_keyword.process (Current)
2379 print_space
2380 end
2381 l_extended_feature_name := l_synonym.extended_name
2382 l_feature_name := l_extended_feature_name.feature_name
2383 l_feature_name.process (Current)
2384 if attached l_extended_feature_name.alias_name as l_alias_name and then not ANY_.same_objects (l_alias_name, l_feature_name) then
2385 -- For infix and prefix features, do not repeat the name twice.
2386 print_space
2387 l_alias_name.process (Current)
2388 comment_finder.add_excluded_node (l_alias_name)
2389 end
2390 comment_finder.add_excluded_node (l_feature_name)
2391 comment_finder.find_comments (l_extended_feature_name, comment_list)
2392 comment_finder.reset_excluded_nodes
2393 l_synonym := l_synonym.synonym
2394 if l_synonym /= Void then
2395 -- The AST may or may not contain the comma.
2396 -- So we have to print it explicitly here.
2397 tokens.comma_symbol.process (Current)
2398 print_space
2399 end
2400 end
2401 if attached a_feature.arguments as l_arguments then
2402 if l_arguments.is_empty then
2403 -- Do not print empty parentheses, but keep the comments if any.
2404 comment_finder.find_comments (l_arguments, comment_list)
2405 else
2406 print_space
2407 l_arguments.process (Current)
2408 end
2409 end
2410 -- The AST may or may not contain the colon.
2411 -- So we have to print it explicitly here.
2412 l_declared_type := a_feature.declared_type
2413 l_type := l_declared_type.type
2414 tokens.colon_symbol.process (Current)
2415 comment_finder.add_excluded_node (l_type)
2416 comment_finder.find_comments (l_declared_type, comment_list)
2417 comment_finder.reset_excluded_nodes
2418 print_space
2419 l_type.process (Current)
2420 if attached a_feature.assigner as l_assigner then
2421 print_space
2422 l_assigner.process (Current)
2423 end
2424 print_space
2425 tokens.is_keyword.process (Current)
2426 if attached a_feature.is_keyword as l_is_keyword then
2427 process_break (l_is_keyword.break)
2428 end
2429 indent
2430 process_comments
2431 print_new_line
2432 if attached a_feature.first_indexing as l_indexing then
2433 process_indexing_clause (l_indexing, False)
2434 process_comments
2435 print_new_line
2436 end
2437 if attached a_feature.obsolete_message as l_obsolete_message then
2438 tokens.obsolete_keyword.process (Current)
2439 l_obsolete_string := l_obsolete_message.manifest_string
2440 comment_finder.add_excluded_node (l_obsolete_string)
2441 comment_finder.find_comments (l_obsolete_message, comment_list)
2442 comment_finder.reset_excluded_nodes
2443 indent
2444 process_comments
2445 print_new_line
2446 l_obsolete_string.process (Current)
2447 dedent
2448 process_comments
2449 print_new_line
2450 end
2451 if attached a_feature.preconditions as l_preconditions then
2452 l_preconditions.process (Current)
2453 process_comments
2454 end
2455 tokens.external_keyword.process (Current)
2456 l_external_language := a_feature.language
2457 l_manifest_string := l_external_language.manifest_string
2458 comment_finder.add_excluded_node (l_manifest_string)
2459 comment_finder.find_comments (l_external_language, comment_list)
2460 comment_finder.reset_excluded_nodes
2461 indent
2462 process_comments
2463 print_new_line
2464 l_manifest_string.process (Current)
2465 process_comments
2466 print_new_line
2467 dedent
2468 if attached a_feature.alias_clause as l_external_alias then
2469 tokens.alias_keyword.process (Current)
2470 l_manifest_string := l_external_alias.manifest_string
2471 comment_finder.add_excluded_node (l_manifest_string)
2472 comment_finder.find_comments (l_external_alias, comment_list)
2473 comment_finder.reset_excluded_nodes
2474 indent
2475 process_comments
2476 print_new_line
2477 l_manifest_string.process (Current)
2478 process_comments
2479 print_new_line
2480 dedent
2481 end
2482 if attached a_feature.postconditions as l_postconditions then
2483 l_postconditions.process (Current)
2484 process_comments
2485 end
2486 a_feature.end_keyword.process (Current)
2487 if attached a_feature.semicolon as l_semicolon then
2488 -- Do not print the semicolon, but keep track of its comments if any.
2489 process_break (l_semicolon.break)
2490 end
2491 dedent
2492 end
2493
2494 process_external_function_inline_agent (an_expression: ET_EXTERNAL_FUNCTION_INLINE_AGENT)
2495 -- Process `an_expression'.
2496 local
2497 l_declared_type: ET_DECLARED_TYPE
2498 l_type: ET_TYPE
2499 l_external_language: ET_EXTERNAL_LANGUAGE
2500 l_manifest_string: ET_MANIFEST_STRING
2501 do
2502 an_expression.agent_keyword.process (Current)
2503 print_space
2504 if attached an_expression.formal_arguments as l_formal_arguments then
2505 if l_formal_arguments.is_empty then
2506 -- Do not print empty parentheses, but keep the comments if any.
2507 comment_finder.find_comments (l_formal_arguments, comment_list)
2508 else
2509 l_formal_arguments.process (Current)
2510 end
2511 end
2512 -- The AST may or may not contain the colon.
2513 -- So we have to print it explicitly here.
2514 l_declared_type := an_expression.declared_type
2515 l_type := l_declared_type.type
2516 tokens.colon_symbol.process (Current)
2517 comment_finder.add_excluded_node (l_type)
2518 comment_finder.find_comments (l_declared_type, comment_list)
2519 comment_finder.reset_excluded_nodes
2520 print_space
2521 l_type.process (Current)
2522 process_comments
2523 print_new_line
2524 if attached an_expression.preconditions as l_preconditions then
2525 l_preconditions.process (Current)
2526 process_comments
2527 end
2528 tokens.external_keyword.process (Current)
2529 l_external_language := an_expression.language
2530 l_manifest_string := l_external_language.manifest_string
2531 comment_finder.add_excluded_node (l_manifest_string)
2532 comment_finder.find_comments (l_external_language, comment_list)
2533 comment_finder.reset_excluded_nodes
2534 indent
2535 process_comments
2536 print_new_line
2537 l_manifest_string.process (Current)
2538 process_comments
2539 print_new_line
2540 dedent
2541 if attached an_expression.alias_clause as l_external_alias then
2542 tokens.alias_keyword.process (Current)
2543 l_manifest_string := l_external_alias.manifest_string
2544 comment_finder.add_excluded_node (l_manifest_string)
2545 comment_finder.find_comments (l_external_alias, comment_list)
2546 comment_finder.reset_excluded_nodes
2547 indent
2548 process_comments
2549 print_new_line
2550 l_manifest_string.process (Current)
2551 process_comments
2552 print_new_line
2553 dedent
2554 end
2555 process_comments
2556 print_new_line
2557 if attached an_expression.postconditions as l_postconditions then
2558 l_postconditions.process (Current)
2559 process_comments
2560 end
2561 an_expression.end_keyword.process (Current)
2562 if attached {ET_AGENT_ARGUMENT_OPERAND_LIST} an_expression.actual_arguments as l_actual_arguments then
2563 -- Do not print implicit argument operands (they were not in the original class text anyway).
2564 if l_actual_arguments.is_empty then
2565 -- Do not print empty parentheses, but keep the comments if any.
2566 comment_finder.find_comments (l_actual_arguments, comment_list)
2567 else
2568 print_space
2569 l_actual_arguments.process (Current)
2570 end
2571 end
2572 end
2573
2574 process_external_procedure (a_feature: ET_EXTERNAL_PROCEDURE)
2575 -- Process `a_feature'.
2576 local
2577 l_extended_feature_name: ET_EXTENDED_FEATURE_NAME
2578 l_feature_name: ET_FEATURE_NAME
2579 l_synonym: detachable ET_FEATURE
2580 l_obsolete_string: ET_MANIFEST_STRING
2581 l_external_language: ET_EXTERNAL_LANGUAGE
2582 l_manifest_string: ET_MANIFEST_STRING
2583 do
2584 from
2585 l_synonym := a_feature
2586 until
2587 l_synonym = Void
2588 loop
2589 if attached l_synonym.frozen_keyword as l_frozen_keyword then
2590 l_frozen_keyword.process (Current)
2591 print_space
2592 end
2593 l_extended_feature_name := l_synonym.extended_name
2594 l_feature_name := l_extended_feature_name.feature_name
2595 l_feature_name.process (Current)
2596 if attached l_extended_feature_name.alias_name as l_alias_name and then not ANY_.same_objects (l_alias_name, l_feature_name) then
2597 -- For infix and prefix features, do not repeat the name twice.
2598 print_space
2599 l_alias_name.process (Current)
2600 comment_finder.add_excluded_node (l_alias_name)
2601 end
2602 comment_finder.add_excluded_node (l_feature_name)
2603 comment_finder.find_comments (l_extended_feature_name, comment_list)
2604 comment_finder.reset_excluded_nodes
2605 l_synonym := l_synonym.synonym
2606 if l_synonym /= Void then
2607 -- The AST may or may not contain the comma.
2608 -- So we have to print it explicitly here.
2609 tokens.comma_symbol.process (Current)
2610 print_space
2611 end
2612 end
2613 if attached a_feature.arguments as l_arguments then
2614 if l_arguments.is_empty then
2615 -- Do not print empty parentheses, but keep the comments if any.
2616 comment_finder.find_comments (l_arguments, comment_list)
2617 else
2618 print_space
2619 l_arguments.process (Current)
2620 end
2621 end
2622 print_space
2623 tokens.is_keyword.process (Current)
2624 if attached a_feature.is_keyword as l_is_keyword then
2625 process_break (l_is_keyword.break)
2626 end
2627 indent
2628 process_comments
2629 print_new_line
2630 if attached a_feature.first_indexing as l_indexing then
2631 process_indexing_clause (l_indexing, False)
2632 process_comments
2633 print_new_line
2634 end
2635 if attached a_feature.obsolete_message as l_obsolete_message then
2636 tokens.obsolete_keyword.process (Current)
2637 l_obsolete_string := l_obsolete_message.manifest_string
2638 comment_finder.add_excluded_node (l_obsolete_string)
2639 comment_finder.find_comments (l_obsolete_message, comment_list)
2640 comment_finder.reset_excluded_nodes
2641 indent
2642 process_comments
2643 print_new_line
2644 l_obsolete_string.process (Current)
2645 dedent
2646 process_comments
2647 print_new_line
2648 end
2649 if attached a_feature.preconditions as l_preconditions then
2650 l_preconditions.process (Current)
2651 process_comments
2652 end
2653 tokens.external_keyword.process (Current)
2654 l_external_language := a_feature.language
2655 l_manifest_string := l_external_language.manifest_string
2656 comment_finder.add_excluded_node (l_manifest_string)
2657 comment_finder.find_comments (l_external_language, comment_list)
2658 comment_finder.reset_excluded_nodes
2659 indent
2660 process_comments
2661 print_new_line
2662 l_manifest_string.process (Current)
2663 process_comments
2664 print_new_line
2665 dedent
2666 if attached a_feature.alias_clause as l_external_alias then
2667 tokens.alias_keyword.process (Current)
2668 l_manifest_string := l_external_alias.manifest_string
2669 comment_finder.add_excluded_node (l_manifest_string)
2670 comment_finder.find_comments (l_external_alias, comment_list)
2671 comment_finder.reset_excluded_nodes
2672 indent
2673 process_comments
2674 print_new_line
2675 l_manifest_string.process (Current)
2676 process_comments
2677 print_new_line
2678 dedent
2679 end
2680 if attached a_feature.postconditions as l_postconditions then
2681 l_postconditions.process (Current)
2682 process_comments
2683 end
2684 a_feature.end_keyword.process (Current)
2685 if attached a_feature.semicolon as l_semicolon then
2686 -- Do not print the semicolon, but keep track of its comments if any.
2687 process_break (l_semicolon.break)
2688 end
2689 dedent
2690 end
2691
2692 process_external_procedure_inline_agent (an_expression: ET_EXTERNAL_PROCEDURE_INLINE_AGENT)
2693 -- Process `an_expression'.
2694 local
2695 l_external_language: ET_EXTERNAL_LANGUAGE
2696 l_manifest_string: ET_MANIFEST_STRING
2697 do
2698 an_expression.agent_keyword.process (Current)
2699 print_space
2700 if attached an_expression.formal_arguments as l_formal_arguments then
2701 if l_formal_arguments.is_empty then
2702 -- Do not print empty parentheses, but keep the comments if any.
2703 comment_finder.find_comments (l_formal_arguments, comment_list)
2704 else
2705 l_formal_arguments.process (Current)
2706 end
2707 end
2708 process_comments
2709 print_new_line
2710 if attached an_expression.preconditions as l_preconditions then
2711 l_preconditions.process (Current)
2712 process_comments
2713 end
2714 tokens.external_keyword.process (Current)
2715 l_external_language := an_expression.language
2716 l_manifest_string := l_external_language.manifest_string
2717 comment_finder.add_excluded_node (l_manifest_string)
2718 comment_finder.find_comments (l_external_language, comment_list)
2719 comment_finder.reset_excluded_nodes
2720 indent
2721 process_comments
2722 print_new_line
2723 l_manifest_string.process (Current)
2724 process_comments
2725 print_new_line
2726 dedent
2727 if attached an_expression.alias_clause as l_external_alias then
2728 tokens.alias_keyword.process (Current)
2729 l_manifest_string := l_external_alias.manifest_string
2730 comment_finder.add_excluded_node (l_manifest_string)
2731 comment_finder.find_comments (l_external_alias, comment_list)
2732 comment_finder.reset_excluded_nodes
2733 indent
2734 process_comments
2735 print_new_line
2736 l_manifest_string.process (Current)
2737 process_comments
2738 print_new_line
2739 dedent
2740 end
2741 process_comments
2742 print_new_line
2743 if attached an_expression.postconditions as l_postconditions then
2744 l_postconditions.process (Current)
2745 process_comments
2746 end
2747 an_expression.end_keyword.process (Current)
2748 if attached {ET_AGENT_ARGUMENT_OPERAND_LIST} an_expression.actual_arguments as l_actual_arguments then
2749 -- Do not print implicit argument operands (they were not in the original class text anyway).
2750 if l_actual_arguments.is_empty then
2751 -- Do not print empty parentheses, but keep the comments if any.
2752 comment_finder.find_comments (l_actual_arguments, comment_list)
2753 else
2754 print_space
2755 l_actual_arguments.process (Current)
2756 end
2757 end
2758 end
2759
2760 process_feature_clause (a_feature_clause: ET_FEATURE_CLAUSE)
2761 -- Process `a_feature_clause'.
2762 do
2763 a_feature_clause.feature_keyword.process (Current)
2764 if attached a_feature_clause.clients_clause as l_clients then
2765 print_space
2766 l_clients.process (Current)
2767 end
2768 process_comments_on_same_line
2769 end
2770
2771 process_feature_clause_list (a_list: ET_FEATURE_CLAUSE_LIST)
2772 -- Process `a_list'.
2773 local
2774 i, nb: INTEGER
2775 do
2776 nb := a_list.count
2777 from i := 1 until i > nb loop
2778 a_list.item (i).process (Current)
2779 process_comments
2780 print_new_line
2781 print_new_line
2782 i := i + 1
2783 end
2784 end
2785
2786 process_feature_export (an_export: ET_FEATURE_EXPORT)
2787 -- Process `an_export'.
2788 local
2789 i, nb: INTEGER
2790 l_item: ET_FEATURE_NAME_ITEM
2791 l_feature_name: ET_FEATURE_NAME
2792 do
2793 if not an_export.is_empty then
2794 an_export.clients_clause.process (Current)
2795 nb := an_export.count
2796 indent
2797 from i := 1 until i > nb loop
2798 process_comments
2799 print_new_line
2800 l_item := an_export.item (i)
2801 l_feature_name := l_item.feature_name
2802 l_feature_name.process (Current)
2803 if i /= nb then
2804 -- The AST may or may not contain the comma.
2805 -- So we have to print it explicitly here.
2806 tokens.comma_symbol.process (Current)
2807 end
2808 comment_finder.add_excluded_node (l_feature_name)
2809 comment_finder.find_comments (l_item, comment_list)
2810 comment_finder.reset_excluded_nodes
2811 i := i + 1
2812 end
2813 dedent
2814 else
2815 comment_finder.find_comments (an_export, comment_list)
2816 end
2817 end
2818
2819 process_features (a_class: ET_CLASS)
2820 -- Process feature clauses of `a_class'.
2821 local
2822 a_feature_clause: ET_FEATURE_CLAUSE
2823 l_queries: ET_QUERY_LIST
2824 l_query: detachable ET_QUERY
2825 l_procedures: ET_PROCEDURE_LIST
2826 l_procedure: detachable ET_PROCEDURE
2827 i, nb: INTEGER
2828 j, nb_queries: INTEGER
2829 k, nb_procedures: INTEGER
2830 do
2831 if attached a_class.feature_clauses as a_feature_clauses then
2832 j := 1
2833 l_queries := a_class.queries
2834 nb_queries := l_queries.declared_count
2835
2836 k := 1
2837 l_procedures := a_class.procedures
2838 nb_procedures := l_procedures.declared_count
2839 nb := a_feature_clauses.count
2840 from i := 1 until i > nb loop
2841 a_feature_clause := a_feature_clauses.item (i)
2842 a_feature_clause.process (Current)
2843 process_comments
2844 print_new_line
2845 print_new_line
2846 from
2847 if j <= nb_queries then
2848 l_query := l_queries.item (j)
2849 if l_query.feature_clause /= a_feature_clause then
2850 l_query := Void
2851 end
2852 end
2853 if k <= nb_procedures then
2854 l_procedure := l_procedures.item (k)
2855 if l_procedure.feature_clause /= a_feature_clause then
2856 l_procedure := Void
2857 end
2858 end
2859 until
2860 l_query = Void and l_procedure = Void
2861 loop
2862 indent
2863 if l_query /= Void and then (l_procedure = Void or else (l_query.name.position < l_procedure.name.position)) then
2864 l_query.process (Current)
2865 from
2866 until
2867 l_query = Void or else l_query.synonym = Void
2868 loop
2869 j := j + 1
2870 if j <= nb_queries then
2871 l_query := l_queries.item (j)
2872 else
2873 l_query := Void
2874 end
2875 end
2876 j := j + 1
2877 if j <= nb_queries then
2878 l_query := l_queries.item (j)
2879 if l_query.feature_clause /= a_feature_clause then
2880 l_query := Void
2881 end
2882 else
2883 l_query := Void
2884 end
2885 elseif l_procedure /= Void then
2886 l_procedure.process (Current)
2887 from
2888 until
2889 l_procedure = Void or else l_procedure.synonym = Void
2890 loop
2891 k := k + 1
2892 if k <= nb_procedures then
2893 l_procedure := l_procedures.item (k)
2894 else
2895 l_procedure := Void
2896 end
2897 end
2898 k := k + 1
2899 if k <= nb_procedures then
2900 l_procedure := l_procedures.item (k)
2901 if l_procedure.feature_clause /= a_feature_clause then
2902 l_procedure := Void
2903 end
2904 else
2905 l_procedure := Void
2906 end
2907 end
2908 dedent
2909 print_new_line
2910 print_new_line
2911 end
2912 i := i + 1
2913 end
2914 end
2915 end
2916
2917 process_formal_argument (an_argument: ET_FORMAL_ARGUMENT)
2918 -- Process `an_argument'.
2919 local
2920 l_name_item: ET_ARGUMENT_NAME
2921 l_name: ET_IDENTIFIER
2922 l_declared_type: ET_DECLARED_TYPE
2923 l_type: ET_TYPE
2924 do
2925 l_name_item := an_argument.name_item
2926 l_name := l_name_item.identifier
2927 l_name.process (Current)
2928 comment_finder.add_excluded_node (l_name)
2929 comment_finder.find_comments (l_name_item, comment_list)
2930 comment_finder.reset_excluded_nodes
2931 -- The AST may or may not contain the colon.
2932 -- So we have to print it explicitly here.
2933 l_declared_type := an_argument.declared_type
2934 l_type := l_declared_type.type
2935 tokens.colon_symbol.process (Current)
2936 comment_finder.add_excluded_node (l_type)
2937 comment_finder.find_comments (l_declared_type, comment_list)
2938 comment_finder.reset_excluded_nodes
2939 print_space
2940 l_type.process (Current)
2941 end
2942
2943 process_formal_argument_list (a_list: ET_FORMAL_ARGUMENT_LIST)
2944 -- Process `a_list'.
2945 local
2946 i, nb: INTEGER
2947 l_item: ET_FORMAL_ARGUMENT_ITEM
2948 l_name: ET_IDENTIFIER
2949 l_type: ET_TYPE
2950 do
2951 a_list.left_parenthesis.process (Current)
2952 nb := a_list.count
2953 from i := 1 until i > nb loop
2954 l_item := a_list.item (i)
2955 l_name := l_item.name
2956 l_name.process (Current)
2957 if l_item.is_last_entity or i = nb then
2958 tokens.colon_symbol.process (Current)
2959 print_space
2960 l_type := l_item.type
2961 l_type.process (Current)
2962 comment_finder.add_excluded_node (l_name)
2963 comment_finder.add_excluded_node (l_type)
2964 comment_finder.find_comments (l_item, comment_list)
2965 comment_finder.reset_excluded_nodes
2966 if i /= nb then
2967 -- The AST may or may not contain the semicolon.
2968 -- So we have to print it explicitly here.
2969 tokens.semicolon_symbol.process (Current)
2970 print_space
2971 end
2972 else
2973 comment_finder.add_excluded_node (l_name)
2974 comment_finder.find_comments (l_item, comment_list)
2975 comment_finder.reset_excluded_nodes
2976 -- The AST may or may not contain the comma.
2977 -- So we have to print it explicitly here.
2978 tokens.comma_symbol.process (Current)
2979 print_space
2980 end
2981 i := i + 1
2982 end
2983 a_list.right_parenthesis.process (Current)
2984 end
2985
2986 process_formal_comma_argument (an_argument: ET_FORMAL_COMMA_ARGUMENT)
2987 -- Process `an_argument'.
2988 local
2989 l_name_item: ET_ARGUMENT_NAME
2990 l_name: ET_IDENTIFIER
2991 do
2992 l_name_item := an_argument.name_item
2993 l_name := l_name_item.identifier
2994 l_name.process (Current)
2995 comment_finder.add_excluded_node (l_name)
2996 comment_finder.find_comments (l_name_item, comment_list)
2997 comment_finder.reset_excluded_nodes
2998 -- The AST may or may not contain the comma.
2999 -- So we have to print it explicitly here.
3000 tokens.comma_symbol.process (Current)
3001 end
3002
3003 process_formal_parameter (a_parameter: ET_FORMAL_PARAMETER)
3004 -- Process `a_parameter'.
3005 do
3006 if attached a_parameter.type_mark as l_type_mark then
3007 l_type_mark.process (Current)
3008 print_space
3009 end
3010 a_parameter.name.process (Current)
3011 end
3012
3013 process_formal_parameter_list (a_list: ET_FORMAL_PARAMETER_LIST)
3014 -- Process `a_list'.
3015 local
3016 i, nb: INTEGER
3017 l_item: ET_FORMAL_PARAMETER_ITEM
3018 l_formal_parameter: ET_FORMAL_PARAMETER
3019 do
3020 a_list.left_bracket.process (Current)
3021 nb := a_list.count
3022 from i := 1 until i > nb loop
3023 l_item := a_list.item (i)
3024 l_formal_parameter := l_item.formal_parameter
3025 l_formal_parameter.process (Current)
3026 comment_finder.add_excluded_node (l_formal_parameter)
3027 comment_finder.find_comments (l_item, comment_list)
3028 comment_finder.reset_excluded_nodes
3029 if i /= nb then
3030 -- The AST may or may not contain the comma.
3031 -- So we have to print it explicitly here.
3032 tokens.comma_symbol.process (Current)
3033 print_space
3034 end
3035 i := i + 1
3036 end
3037 a_list.right_bracket.process (Current)
3038 end
3039
3040 process_formal_parameter_type (a_type: ET_FORMAL_PARAMETER_TYPE)
3041 -- Process `a_type'.
3042 do
3043 if attached a_type.type_mark as l_type_mark then
3044 l_type_mark.process (Current)
3045 if not l_type_mark.is_implicit_mark then
3046 print_space
3047 end
3048 end
3049 a_type.name.process (Current)
3050 end
3051
3052 process_hexadecimal_integer_constant (a_constant: ET_HEXADECIMAL_INTEGER_CONSTANT)
3053 -- Process `a_constant'.
3054 local
3055 l_type: ET_TYPE
3056 do
3057 if attached a_constant.cast_type as l_cast_type then
3058 -- The AST may or may not contain the braces.
3059 -- So we have to print them explicitly here.
3060 l_type := l_cast_type.type
3061 tokens.left_brace_symbol.process (Current)
3062 l_type.type.process (Current)
3063 tokens.right_brace_symbol.process (Current)
3064 comment_finder.add_excluded_node (l_type)
3065 comment_finder.find_comments (l_cast_type, comment_list)
3066 comment_finder.reset_excluded_nodes
3067 print_space
3068 end
3069 if attached a_constant.sign as l_sign then
3070 l_sign.process (Current)
3071 end
3072 print_string (a_constant.literal)
3073 process_break (a_constant.break)
3074 end
3075
3076 process_if_instruction (an_instruction: ET_IF_INSTRUCTION)
3077 -- Process `an_instruction'.
3078 local
3079 l_conditional: ET_CONDITIONAL
3080 l_expression: ET_EXPRESSION
3081 do
3082 tokens.if_keyword.process (Current)
3083 print_space
3084 l_conditional := an_instruction.conditional
3085 l_expression := l_conditional.expression
3086 l_expression.process (Current)
3087 comment_finder.add_excluded_node (l_expression)
3088 comment_finder.find_comments (l_conditional, comment_list)
3089 comment_finder.reset_excluded_nodes
3090 print_space
3091 if attached an_instruction.then_compound as l_then_compound then
3092 l_then_compound.process (Current)
3093 else
3094 tokens.then_keyword.process (Current)
3095 end
3096 if attached an_instruction.elseif_parts as l_elseif_parts then
3097 process_comments
3098 print_new_line
3099 l_elseif_parts.process (Current)
3100 end
3101 if attached an_instruction.else_compound as l_else_compound then
3102 process_comments
3103 print_new_line
3104 l_else_compound.process (Current)
3105 end
3106 process_comments
3107 print_new_line
3108 an_instruction.end_keyword.process (Current)
3109 end
3110
3111 process_indexing_list (a_list: ET_INDEXING_LIST)
3112 -- Process `a_list'.
3113 do
3114 process_indexing_clause (a_list, True)
3115 end
3116
3117 process_indexing_clause (a_list: ET_INDEXING_LIST; a_new_line: BOOLEAN)
3118 -- Process `a_list'.
3119 -- `a_new_line' indicates that an empty new-line should
3120 -- appear between the 'indexing' keyword and the first item.
3121 local
3122 i, nb: INTEGER
3123 l_item: ET_INDEXING_ITEM
3124 l_indexing: ET_INDEXING
3125 do
3126 if a_list.is_empty then
3127 -- Do not print empty note clause, but keep the comments if any.
3128 comment_finder.find_comments (a_list, comment_list)
3129 else
3130 a_list.indexing_keyword.process (Current)
3131 indent
3132 process_comments
3133 if a_new_line then
3134 print_new_line
3135 end
3136 nb := a_list.count
3137 from i := 1 until i > nb loop
3138 process_comments
3139 print_new_line
3140 l_item := a_list.item (i)
3141 l_indexing := l_item.indexing_clause
3142 if attached {ET_TAGGED_INDEXING} l_indexing as l_tagged_indexing and then STRING_.same_string (l_tagged_indexing.tag.identifier.lower_name, "description") then
3143 process_tagged_indexing_indented (l_tagged_indexing)
3144 print_new_line
3145 else
3146 l_indexing.process (Current)
3147 end
3148 comment_finder.add_excluded_node (l_indexing)
3149 comment_finder.find_comments (l_item, comment_list)
3150 comment_finder.reset_excluded_nodes
3151 i := i + 1
3152 end
3153 dedent
3154 end
3155 end
3156
3157 process_indexing_term_list (a_list: ET_INDEXING_TERM_LIST)
3158 -- Process `a_list'.
3159 local
3160 i, nb: INTEGER
3161 l_item: ET_INDEXING_TERM_ITEM
3162 l_indexing_term: ET_INDEXING_TERM
3163 do
3164 nb := a_list.count
3165 from i := 1 until i > nb loop
3166 l_item := a_list.item (i)
3167 l_indexing_term := l_item.indexing_term
3168 l_indexing_term.process (Current)
3169 comment_finder.add_excluded_node (l_indexing_term)
3170 comment_finder.find_comments (l_item, comment_list)
3171 comment_finder.reset_excluded_nodes
3172 if i /= nb then
3173 -- The AST may or may not contain the comma.
3174 -- So we have to print it explicitly here.
3175 tokens.comma_symbol.process (Current)
3176 print_space
3177 end
3178 i := i + 1
3179 end
3180 end
3181
3182 process_infix_and_then_operator (an_operator: ET_INFIX_AND_THEN_OPERATOR)
3183 -- Process `an_operator'.
3184 do
3185 an_operator.and_keyword.process (Current)
3186 print_space
3187 an_operator.then_keyword.process (Current)
3188 end
3189
3190 process_infix_expression (an_expression: ET_INFIX_EXPRESSION)
3191 -- Process `an_expression'.
3192 do
3193 an_expression.left.process (Current)
3194 print_space
3195 an_expression.name.process (Current)
3196 print_space
3197 an_expression.right.process (Current)
3198 end
3199
3200 process_infix_name (a_name: ET_INFIX_NAME)
3201 -- Process `a_name'.
3202 do
3203 a_name.infix_keyword.process (Current)
3204 print_space
3205 a_name.operator_name.process (Current)
3206 end
3207
3208 process_infix_or_else_operator (an_operator: ET_INFIX_OR_ELSE_OPERATOR)
3209 -- Process `an_operator'.
3210 do
3211 an_operator.or_keyword.process (Current)
3212 print_space
3213 an_operator.else_keyword.process (Current)
3214 end
3215
3216 process_inspect_instruction (an_instruction: ET_INSPECT_INSTRUCTION)
3217 -- Process `an_instruction'.
3218 local
3219 l_conditional: ET_CONDITIONAL
3220 l_expression: ET_EXPRESSION
3221 do
3222 tokens.inspect_keyword.process (Current)
3223 print_space
3224 l_conditional := an_instruction.conditional
3225 l_expression := l_conditional.expression
3226 l_expression.process (Current)
3227 comment_finder.add_excluded_node (l_expression)
3228 comment_finder.find_comments (l_conditional, comment_list)
3229 comment_finder.reset_excluded_nodes
3230 process_comments
3231 print_new_line
3232 if attached an_instruction.when_parts as l_when_parts then
3233 l_when_parts.process (Current)
3234 process_comments
3235 if not l_when_parts.is_empty then
3236 print_new_line
3237 end
3238 end
3239 if attached an_instruction.else_compound as l_else_compound then
3240 l_else_compound.process (Current)
3241 process_comments
3242 print_new_line
3243 end
3244 process_comments
3245 an_instruction.end_keyword.process (Current)
3246 end
3247
3248 process_instruction_list (a_list: ET_COMPOUND)
3249 -- Process `a_list'.
3250 require
3251 a_list_not_void: a_list /= Void
3252 local
3253 i, nb: INTEGER
3254 l_instruction: ET_INSTRUCTION
3255 do
3256 nb := a_list.count
3257 -- Start to skip all leading null instructions.
3258 from
3259 i := 1
3260 until
3261 i > nb or else not a_list.item (i).is_semicolon
3262 loop
3263 comment_finder.find_comments (a_list.item (i), comment_list)
3264 i := i + 1
3265 end
3266 process_comments
3267 from until i > nb loop
3268 l_instruction := a_list.item (i)
3269 print_new_line
3270 l_instruction.process (Current)
3271 -- Skip null instructions.
3272 from
3273 i := i + 1
3274 until
3275 i > nb or else not a_list.item (i).is_semicolon
3276 loop
3277 comment_finder.find_comments (a_list.item (i), comment_list)
3278 i := i + 1
3279 end
3280 if i <= nb then
3281 if attached {ET_IDENTIFIER} l_instruction.last_leaf and attached {ET_SYMBOL} a_list.item (i).first_leaf as l_symbol and then (l_symbol.is_left_parenthesis or l_symbol.is_left_bracket) then
3282 -- Print a semicolon in order to avoid syntax ambiguity.
3283 -- For example if we have:
3284 --
3285 -- do
3286 -- f.g
3287 -- (a + b).h
3288 --
3289 -- it could also be seen as:
3290 --
3291 -- do
3292 -- f.g (a + b).h
3293 --
3294 tokens.semicolon_symbol.process (Current)
3295 end
3296 end
3297 process_comments
3298 end
3299 end
3300
3301 process_invariants (a_list: ET_INVARIANTS)
3302 -- Process `a_list'.
3303 local
3304 l_has_comment_assertion: BOOLEAN
3305 do
3306 l_has_comment_assertion := attached a_list.break as l_break and then l_break.has_comment
3307 if a_list.is_empty and not l_has_comment_assertion then
3308 -- Do not print empty invariants, but keep the comments if any.
3309 -- Note that a comment is considered as an assertion here,
3310 -- and the invariant is not considered empty in that case.
3311 comment_finder.find_comments (a_list, comment_list)
3312 else
3313 a_list.invariant_keyword.process (Current)
3314 print_new_line
3315 print_new_line
3316 indent
3317 process_comments
3318 process_assertions (a_list)
3319 if a_list.is_empty then
3320 print_new_line
3321 end
3322 print_new_line
3323 process_comments
3324 dedent
3325 end
3326 end
3327
3328 process_keyword_expression (an_expression: ET_KEYWORD_EXPRESSION)
3329 -- Process `an_expression'.
3330 do
3331 an_expression.keyword.process (Current)
3332 print_space
3333 an_expression.expression.process (Current)
3334 end
3335
3336 process_keyword_feature_name_list (a_list: ET_KEYWORD_FEATURE_NAME_LIST)
3337 -- Process `a_list'.
3338 local
3339 i, nb: INTEGER
3340 l_item: ET_FEATURE_NAME_ITEM
3341 l_feature_name: ET_FEATURE_NAME
3342 do
3343 a_list.keyword.process (Current)
3344 indent
3345 nb := a_list.count
3346 from i := 1 until i > nb loop
3347 process_comments
3348 print_new_line
3349 l_item := a_list.item (i)
3350 l_feature_name := l_item.feature_name
3351 l_feature_name.process (Current)
3352 comment_finder.add_excluded_node (l_feature_name)
3353 comment_finder.find_comments (l_item, comment_list)
3354 comment_finder.reset_excluded_nodes
3355 if i /= nb then
3356 -- The AST may or may not contain the comma.
3357 -- So we have to print it explicitly here.
3358 tokens.comma_symbol.process (Current)
3359 end
3360 i := i + 1
3361 end
3362 dedent
3363 end
3364
3365 process_keyword_manifest_string (a_string: ET_KEYWORD_MANIFEST_STRING)
3366 -- Process `a_string'.
3367 do
3368 a_string.keyword.process (Current)
3369 print_space
3370 a_string.manifest_string.process (Current)
3371 end
3372
3373 process_labeled_actual_parameter (a_parameter: ET_LABELED_ACTUAL_PARAMETER)
3374 -- Process `a_parameter'.
3375 local
3376 l_name_item: ET_LABEL
3377 l_name: ET_IDENTIFIER
3378 l_declared_type: ET_DECLARED_TYPE
3379 l_type: ET_TYPE
3380 do
3381 l_name_item := a_parameter.label_item
3382 l_name := l_name_item.identifier
3383 l_name.process (Current)
3384 comment_finder.add_excluded_node (l_name)
3385 comment_finder.find_comments (l_name_item, comment_list)
3386 comment_finder.reset_excluded_nodes
3387 -- The AST may or may not contain the colon.
3388 -- So we have to print it explicitly here.
3389 l_declared_type := a_parameter.declared_type
3390 l_type := l_declared_type.type
3391 tokens.colon_symbol.process (Current)
3392 comment_finder.add_excluded_node (l_type)
3393 comment_finder.find_comments (l_declared_type, comment_list)
3394 comment_finder.reset_excluded_nodes
3395 print_space
3396 l_type.process (Current)
3397 end
3398
3399 process_labeled_comma_actual_parameter (a_parameter: ET_LABELED_COMMA_ACTUAL_PARAMETER)
3400 -- Process `a_parameter'.
3401 local
3402 l_name_item: ET_LABEL
3403 l_name: ET_IDENTIFIER
3404 do
3405 l_name_item := a_parameter.label_item
3406 l_name := l_name_item.identifier
3407 l_name.process (Current)
3408 comment_finder.add_excluded_node (l_name)
3409 comment_finder.find_comments (l_name_item, comment_list)
3410 comment_finder.reset_excluded_nodes
3411 -- The AST may or may not contain the comma.
3412 -- So we have to print it explicitly here.
3413 tokens.comma_symbol.process (Current)
3414 end
3415
3416 process_like_current (a_type: ET_LIKE_CURRENT)
3417 -- Process `a_type'.
3418 do
3419 if attached a_type.type_mark as l_type_mark then
3420 l_type_mark.process (Current)
3421 if not l_type_mark.is_implicit_mark then
3422 print_space
3423 end
3424 end
3425 a_type.like_keyword.process (Current)
3426 print_space
3427 a_type.current_keyword.process (Current)
3428 end
3429
3430 process_like_feature (a_type: ET_LIKE_FEATURE)
3431 -- Process `a_type'.
3432 do
3433 if attached a_type.type_mark as l_type_mark then
3434 l_type_mark.process (Current)
3435 if not l_type_mark.is_implicit_mark then
3436 print_space
3437 end
3438 end
3439 a_type.like_keyword.process (Current)
3440 print_space
3441 a_type.name.process (Current)
3442 end
3443
3444 process_local_comma_variable (a_local: ET_LOCAL_COMMA_VARIABLE)
3445 -- Process `a_local'.
3446 local
3447 l_name_item: ET_LOCAL_NAME
3448 l_name: ET_IDENTIFIER
3449 do
3450 l_name_item := a_local.name_item
3451 l_name := l_name_item.identifier
3452 l_name.process (Current)
3453 comment_finder.add_excluded_node (l_name)
3454 comment_finder.find_comments (l_name_item, comment_list)
3455 comment_finder.reset_excluded_nodes
3456 -- The AST may or may not contain the comma.
3457 -- So we have to print it explicitly here.
3458 tokens.comma_symbol.process (Current)
3459 end
3460
3461 process_local_variable (a_local: ET_LOCAL_VARIABLE)
3462 -- Process `a_local'.
3463 local
3464 l_name_item: ET_LOCAL_NAME
3465 l_name: ET_IDENTIFIER
3466 l_declared_type: ET_DECLARED_TYPE
3467 l_type: ET_TYPE
3468 do
3469 l_name_item := a_local.name_item
3470 l_name := l_name_item.identifier
3471 l_name.process (Current)
3472 comment_finder.add_excluded_node (l_name)
3473 comment_finder.find_comments (l_name_item, comment_list)
3474 comment_finder.reset_excluded_nodes
3475 -- The AST may or may not contain the colon.
3476 -- So we have to print it explicitly here.
3477 l_declared_type := a_local.declared_type
3478 l_type := l_declared_type.type
3479 tokens.colon_symbol.process (Current)
3480 comment_finder.add_excluded_node (l_type)
3481 comment_finder.find_comments (l_declared_type, comment_list)
3482 comment_finder.reset_excluded_nodes
3483 print_space
3484 l_type.process (Current)
3485 end
3486
3487 process_local_variable_list (a_list: ET_LOCAL_VARIABLE_LIST)
3488 -- Process `a_list'.
3489 local
3490 i, nb: INTEGER
3491 l_item: ET_LOCAL_VARIABLE_ITEM
3492 l_name: ET_IDENTIFIER
3493 l_type: ET_TYPE
3494 l_has_comment_assertion: BOOLEAN
3495 do
3496 l_has_comment_assertion := attached a_list.break as l_break and then l_break.has_comment
3497 if a_list.is_empty and not l_has_comment_assertion then
3498 -- Do not print empty local variable clause, but keep the comments if any.
3499 --
3500 -- Note that a comment could be a commented out local variable,
3501 -- so the local variable clause is not considered empty in that case.
3502 comment_finder.find_comments (a_list, comment_list)
3503 else
3504 a_list.local_keyword.process (Current)
3505 print_new_line
3506 indent
3507 process_comments
3508 nb := a_list.count
3509 from i := 1 until i > nb loop
3510 l_item := a_list.item (i)
3511 l_name := l_item.name
3512 l_name.process (Current)
3513 if l_item.is_last_entity or i = nb then
3514 tokens.colon_symbol.process (Current)
3515 print_space
3516 l_type := l_item.type
3517 l_type.process (Current)
3518 comment_finder.add_excluded_node (l_name)
3519 comment_finder.add_excluded_node (l_type)
3520 comment_finder.find_comments (l_item, comment_list)
3521 comment_finder.reset_excluded_nodes
3522 print_new_line
3523 process_comments
3524 else
3525 comment_finder.add_excluded_node (l_name)
3526 comment_finder.find_comments (l_item, comment_list)
3527 comment_finder.reset_excluded_nodes
3528 -- The AST may or may not contain the comma.
3529 -- So we have to print it explicitly here.
3530 tokens.comma_symbol.process (Current)
3531 print_space
3532 end
3533 i := i + 1
3534 end
3535 process_comments
3536 dedent
3537 end
3538 end
3539
3540 process_loop_instruction (an_instruction: ET_LOOP_INSTRUCTION)
3541 -- Process `an_instruction'.
3542 local
3543 l_conditional: ET_CONDITIONAL
3544 l_expression: ET_EXPRESSION
3545 do
3546 if attached an_instruction.from_compound as l_from_compound then
3547 l_from_compound.process (Current)
3548 else
3549 tokens.from_keyword.process (Current)
3550 end
3551 print_new_line
3552 process_comments
3553 if attached an_instruction.invariant_part as l_invariant_part then
3554 l_invariant_part.process (Current)
3555 process_comments
3556 end
3557 if an_instruction.has_old_variant_syntax and then attached an_instruction.variant_part as l_variant_part then
3558 l_variant_part.process (Current)
3559 print_new_line
3560 process_comments
3561 end
3562 tokens.until_keyword.process (Current)
3563 print_new_line
3564 indent
3565 process_comments
3566 l_conditional := an_instruction.until_conditional
3567 l_expression := l_conditional.expression
3568 l_expression.process (Current)
3569 comment_finder.add_excluded_node (l_expression)
3570 comment_finder.find_comments (l_conditional, comment_list)
3571 comment_finder.reset_excluded_nodes
3572 print_new_line
3573 process_comments
3574 dedent
3575 if attached an_instruction.loop_compound as l_loop_compound then
3576 l_loop_compound.process (Current)
3577 else
3578 tokens.loop_keyword.process (Current)
3579 end
3580 print_new_line
3581 process_comments
3582 if not an_instruction.has_old_variant_syntax and then attached an_instruction.variant_part as l_variant_part then
3583 l_variant_part.process (Current)
3584 print_new_line
3585 process_comments
3586 end
3587 an_instruction.end_keyword.process (Current)
3588 end
3589
3590 process_loop_invariants (a_list: ET_LOOP_INVARIANTS)
3591 -- Process `a_list'.
3592 local
3593 l_has_comment_assertion: BOOLEAN
3594 do
3595 l_has_comment_assertion := attached a_list.break as l_break and then l_break.has_comment
3596 if a_list.is_empty and not l_has_comment_assertion then
3597 -- Do not print empty invariants, but keep the comments if any.
3598 -- Note that a comment is considered as an assertion here,
3599 -- and the invariant is not considered empty in that case.
3600 comment_finder.find_comments (a_list, comment_list)
3601 else
3602 a_list.invariant_keyword.process (Current)
3603 print_new_line
3604 indent
3605 process_comments
3606 process_assertions (a_list)
3607 process_comments
3608 dedent
3609 end
3610 end
3611
3612 process_manifest_array (an_expression: ET_MANIFEST_ARRAY)
3613 -- Process `an_expression'.
3614 local
3615 i, nb: INTEGER
3616 l_item: ET_EXPRESSION_ITEM
3617 l_expression: ET_EXPRESSION
3618 do
3619 an_expression.left_symbol.process (Current)
3620 nb := an_expression.count
3621 from i := 1 until i > nb loop
3622 l_item := an_expression.item (i)
3623 l_expression := l_item.expression
3624 l_expression.process (Current)
3625 comment_finder.add_excluded_node (l_expression)
3626 comment_finder.find_comments (l_item, comment_list)
3627 comment_finder.reset_excluded_nodes
3628 if i /= nb then
3629 -- The AST may or may not contain the comma.
3630 -- So we have to print it explicitly here.
3631 tokens.comma_symbol.process (Current)
3632 print_space
3633 end
3634 i := i + 1
3635 end
3636 an_expression.right_symbol.process (Current)
3637 end
3638
3639 process_manifest_string_list (a_list: ET_MANIFEST_STRING_LIST)
3640 -- Process `a_list'.
3641 local
3642 i, nb: INTEGER
3643 l_item: ET_MANIFEST_STRING_ITEM
3644 l_manifest_string: ET_MANIFEST_STRING
3645 do
3646 a_list.left_parenthesis.process (Current)
3647 nb := a_list.count
3648 from i := 1 until i > nb loop
3649 l_item := a_list.item (i)
3650 l_manifest_string := l_item.manifest_string
3651 l_manifest_string.process (Current)
3652 comment_finder.add_excluded_node (l_manifest_string)
3653 comment_finder.find_comments (l_item, comment_list)
3654 comment_finder.reset_excluded_nodes
3655 if i /= nb then
3656 -- The AST may or may not contain the comma.
3657 -- So we have to print it explicitly here.
3658 tokens.comma_symbol.process (Current)
3659 print_space
3660 end
3661 i := i + 1
3662 end
3663 a_list.right_parenthesis.process (Current)
3664 end
3665
3666 process_manifest_tuple (an_expression: ET_MANIFEST_TUPLE)
3667 -- Process `an_expression'.
3668 local
3669 i, nb: INTEGER
3670 l_item: ET_EXPRESSION_ITEM
3671 l_expression: ET_EXPRESSION
3672 do
3673 an_expression.left_symbol.process (Current)
3674 nb := an_expression.count
3675 from i := 1 until i > nb loop
3676 l_item := an_expression.item (i)
3677 l_expression := l_item.expression
3678 l_expression.process (Current)
3679 comment_finder.add_excluded_node (l_expression)
3680 comment_finder.find_comments (l_item, comment_list)
3681 comment_finder.reset_excluded_nodes
3682 if i /= nb then
3683 -- The AST may or may not contain the comma.
3684 -- So we have to print it explicitly here.
3685 tokens.comma_symbol.process (Current)
3686 print_space
3687 end
3688 i := i + 1
3689 end
3690 an_expression.right_symbol.process (Current)
3691 end
3692
3693 process_named_object_test (an_expression: ET_NAMED_OBJECT_TEST)
3694 -- Process `an_expression'.
3695 local
3696 l_type: ET_TYPE
3697 do
3698 an_expression.attached_keyword.process (Current)
3699 print_space
3700 if attached an_expression.declared_type as l_declared_type then
3701 l_type := l_declared_type.type
3702 tokens.left_brace_symbol.process (Current)
3703 l_type.process (Current)
3704 tokens.right_brace_symbol.process (Current)
3705 comment_finder.add_excluded_node (l_type)
3706 comment_finder.find_comments (l_declared_type, comment_list)
3707 comment_finder.reset_excluded_nodes
3708 print_space
3709 end
3710 an_expression.expression.process (Current)
3711 print_space
3712 an_expression.as_keyword.process (Current)
3713 print_space
3714 an_expression.name.process (Current)
3715 end
3716
3717 process_object_equality_expression (an_expression: ET_OBJECT_EQUALITY_EXPRESSION)
3718 -- Process `an_expression'.
3719 do
3720 an_expression.left.process (Current)
3721 print_space
3722 an_expression.operator.process (Current)
3723 print_space
3724 an_expression.right.process (Current)
3725 end
3726
3727 process_object_test (an_expression: ET_OBJECT_TEST)
3728 -- Process `an_expression'.
3729 local
3730 l_type: ET_TYPE
3731 do
3732 an_expression.attached_keyword.process (Current)
3733 print_space
3734 if attached an_expression.declared_type as l_declared_type then
3735 l_type := l_declared_type.type
3736 tokens.left_brace_symbol.process (Current)
3737 l_type.process (Current)
3738 tokens.right_brace_symbol.process (Current)
3739 comment_finder.add_excluded_node (l_type)
3740 comment_finder.find_comments (l_declared_type, comment_list)
3741 comment_finder.reset_excluded_nodes
3742 print_space
3743 end
3744 an_expression.expression.process (Current)
3745 end
3746
3747 process_octal_integer_constant (a_constant: ET_OCTAL_INTEGER_CONSTANT)
3748 -- Process `a_constant'.
3749 local
3750 l_type: ET_TYPE
3751 do
3752 if attached a_constant.cast_type as l_cast_type then
3753 -- The AST may or may not contain the braces.
3754 -- So we have to print them explicitly here.
3755 l_type := l_cast_type.type
3756 tokens.left_brace_symbol.process (Current)
3757 l_type.type.process (Current)
3758 tokens.right_brace_symbol.process (Current)
3759 comment_finder.add_excluded_node (l_type)
3760 comment_finder.find_comments (l_cast_type, comment_list)
3761 comment_finder.reset_excluded_nodes
3762 print_space
3763 end
3764 if attached a_constant.sign as l_sign then
3765 l_sign.process (Current)
3766 end
3767 print_string (a_constant.literal)
3768 process_break (a_constant.break)
3769 end
3770
3771 process_old_expression (an_expression: ET_OLD_EXPRESSION)
3772 -- Process `an_expression'.
3773 do
3774 an_expression.old_keyword.process (Current)
3775 print_space
3776 an_expression.expression.process (Current)
3777 end
3778
3779 process_old_object_test (an_expression: ET_OLD_OBJECT_TEST)
3780 -- Process `an_expression'.
3781 do
3782 an_expression.left_brace.process (Current)
3783 an_expression.name.process (Current)
3784 an_expression.colon.process (Current)
3785 print_space
3786 an_expression.type.process (Current)
3787 an_expression.right_brace.process (Current)
3788 print_space
3789 an_expression.expression.process (Current)
3790 end
3791
3792 process_once_function (a_feature: ET_ONCE_FUNCTION)
3793 -- Process `a_feature'.
3794 local
3795 l_extended_feature_name: ET_EXTENDED_FEATURE_NAME
3796 l_feature_name: ET_FEATURE_NAME
3797 l_declared_type: ET_DECLARED_TYPE
3798 l_type: ET_TYPE
3799 l_synonym: detachable ET_FEATURE
3800 l_obsolete_string: ET_MANIFEST_STRING
3801 l_compound: detachable ET_COMPOUND
3802 do
3803 from
3804 l_synonym := a_feature
3805 until
3806 l_synonym = Void
3807 loop
3808 if attached l_synonym.frozen_keyword as l_frozen_keyword then
3809 l_frozen_keyword.process (Current)
3810 print_space
3811 end
3812 l_extended_feature_name := l_synonym.extended_name
3813 l_feature_name := l_extended_feature_name.feature_name
3814 l_feature_name.process (Current)
3815 if attached l_extended_feature_name.alias_name as l_alias_name and then not ANY_.same_objects (l_alias_name, l_feature_name) then
3816 -- For infix and prefix features, do not repeat the name twice.
3817 print_space
3818 l_alias_name.process (Current)
3819 comment_finder.add_excluded_node (l_alias_name)
3820 end
3821 comment_finder.add_excluded_node (l_feature_name)
3822 comment_finder.find_comments (l_extended_feature_name, comment_list)
3823 comment_finder.reset_excluded_nodes
3824 l_synonym := l_synonym.synonym
3825 if l_synonym /= Void then
3826 -- The AST may or may not contain the comma.
3827 -- So we have to print it explicitly here.
3828 tokens.comma_symbol.process (Current)
3829 print_space
3830 end
3831 end
3832 if attached a_feature.arguments as l_arguments then
3833 if l_arguments.is_empty then
3834 -- Do not print empty parentheses, but keep the comments if any.
3835 comment_finder.find_comments (l_arguments, comment_list)
3836 else
3837 print_space
3838 l_arguments.process (Current)
3839 end
3840 end
3841 -- The AST may or may not contain the colon.
3842 -- So we have to print it explicitly here.
3843 l_declared_type := a_feature.declared_type
3844 l_type := l_declared_type.type
3845 tokens.colon_symbol.process (Current)
3846 comment_finder.add_excluded_node (l_type)
3847 comment_finder.find_comments (l_declared_type, comment_list)
3848 comment_finder.reset_excluded_nodes
3849 print_space
3850 l_type.process (Current)
3851 if attached a_feature.assigner as l_assigner then
3852 print_space
3853 l_assigner.process (Current)
3854 end
3855 print_space
3856 tokens.is_keyword.process (Current)
3857 if attached a_feature.is_keyword as l_is_keyword then
3858 process_break (l_is_keyword.break)
3859 end
3860 indent
3861 process_comments
3862 print_new_line
3863 if attached a_feature.first_indexing as l_indexing then
3864 process_indexing_clause (l_indexing, False)
3865 process_comments
3866 print_new_line
3867 end
3868 if attached a_feature.obsolete_message as l_obsolete_message then
3869 tokens.obsolete_keyword.process (Current)
3870 l_obsolete_string := l_obsolete_message.manifest_string
3871 comment_finder.add_excluded_node (l_obsolete_string)
3872 comment_finder.find_comments (l_obsolete_message, comment_list)
3873 comment_finder.reset_excluded_nodes
3874 indent
3875 process_comments
3876 print_new_line
3877 l_obsolete_string.process (Current)
3878 process_comments
3879 print_new_line
3880 dedent
3881 end
3882 if attached a_feature.preconditions as l_preconditions then
3883 l_preconditions.process (Current)
3884 process_comments
3885 end
3886 if attached a_feature.locals as l_locals then
3887 l_locals.process (Current)
3888 process_comments
3889 end
3890 tokens.once_keyword.process (Current)
3891 l_compound := a_feature.compound
3892 if l_compound /= Void then
3893 process_break (l_compound.keyword.break)
3894 end
3895 if attached a_feature.keys as l_keys then
3896 if l_keys.is_empty then
3897 -- Do not print empty parentheses, but keep the comments if any.
3898 comment_finder.find_comments (l_keys, comment_list)
3899 else
3900 print_space
3901 l_keys.process (Current)
3902 end
3903 end
3904 if l_compound /= Void then
3905 indent
3906 process_instruction_list (l_compound)
3907 dedent
3908 else
3909 process_comments
3910 end
3911 print_new_line
3912 if attached a_feature.postconditions as l_postconditions then
3913 l_postconditions.process (Current)
3914 process_comments
3915 end
3916 if attached a_feature.rescue_clause as l_rescue_clause then
3917 l_rescue_clause.process (Current)
3918 process_comments
3919 print_new_line
3920 end
3921 a_feature.end_keyword.process (Current)
3922 if attached a_feature.semicolon as l_semicolon then
3923 -- Do not print the semicolon, but keep track of its comments if any.
3924 process_break (l_semicolon.break)
3925 end
3926 dedent
3927 end
3928
3929 process_once_function_inline_agent (an_expression: ET_ONCE_FUNCTION_INLINE_AGENT)
3930 -- Process `an_expression'.
3931 local
3932 l_compound: detachable ET_COMPOUND
3933 l_declared_type: ET_DECLARED_TYPE
3934 l_type: ET_TYPE
3935 do
3936 an_expression.agent_keyword.process (Current)
3937 print_space
3938 if attached an_expression.formal_arguments as l_formal_arguments then
3939 if l_formal_arguments.is_empty then
3940 -- Do not print empty parentheses, but keep the comments if any.
3941 comment_finder.find_comments (l_formal_arguments, comment_list)
3942 else
3943 l_formal_arguments.process (Current)
3944 end
3945 end
3946 -- The AST may or may not contain the colon.
3947 -- So we have to print it explicitly here.
3948 l_declared_type := an_expression.declared_type
3949 l_type := l_declared_type.type
3950 tokens.colon_symbol.process (Current)
3951 comment_finder.add_excluded_node (l_type)
3952 comment_finder.find_comments (l_declared_type, comment_list)
3953 comment_finder.reset_excluded_nodes
3954 print_space
3955 l_type.process (Current)
3956 process_comments
3957 print_new_line
3958 if attached an_expression.preconditions as l_preconditions then
3959 l_preconditions.process (Current)
3960 process_comments
3961 end
3962 if attached an_expression.locals as l_locals then
3963 l_locals.process (Current)
3964 process_comments
3965 end
3966 tokens.once_keyword.process (Current)
3967 l_compound := an_expression.compound
3968 if l_compound /= Void then
3969 process_break (l_compound.keyword.break)
3970 end
3971 if attached an_expression.keys as l_keys then
3972 if l_keys.is_empty then
3973 -- Do not print empty parentheses, but keep the comments if any.
3974 comment_finder.find_comments (l_keys, comment_list)
3975 else
3976 print_space
3977 l_keys.process (Current)
3978 end
3979 end
3980 if l_compound /= Void then
3981 indent
3982 process_instruction_list (l_compound)
3983 dedent
3984 else
3985 process_comments
3986 end
3987 print_new_line
3988 if attached an_expression.postconditions as l_postconditions then
3989 l_postconditions.process (Current)
3990 process_comments
3991 end
3992 if attached an_expression.rescue_clause as l_rescue_clause then
3993 l_rescue_clause.process (Current)
3994 process_comments
3995 print_new_line
3996 end
3997 an_expression.end_keyword.process (Current)
3998 if attached {ET_AGENT_ARGUMENT_OPERAND_LIST} an_expression.actual_arguments as l_actual_arguments then
3999 -- Do not print implicit argument operands (they were not in the original class text anyway).
4000 if l_actual_arguments.is_empty then
4001 -- Do not print empty parentheses, but keep the comments if any.
4002 comment_finder.find_comments (l_actual_arguments, comment_list)
4003 else
4004 print_space
4005 l_actual_arguments.process (Current)
4006 end
4007 end
4008 end
4009
4010 process_once_manifest_string (an_expression: ET_ONCE_MANIFEST_STRING)
4011 -- Process `an_expression'.
4012 do
4013 an_expression.once_keyword.process (Current)
4014 print_space
4015 an_expression.manifest_string.process (Current)
4016 end
4017
4018 process_once_procedure (a_feature: ET_ONCE_PROCEDURE)
4019 -- Process `a_feature'.
4020 local
4021 l_extended_feature_name: ET_EXTENDED_FEATURE_NAME
4022 l_feature_name: ET_FEATURE_NAME
4023 l_synonym: detachable ET_FEATURE
4024 l_obsolete_string: ET_MANIFEST_STRING
4025 l_compound: detachable ET_COMPOUND
4026 do
4027 from
4028 l_synonym := a_feature
4029 until
4030 l_synonym = Void
4031 loop
4032 if attached l_synonym.frozen_keyword as l_frozen_keyword then
4033 l_frozen_keyword.process (Current)
4034 print_space
4035 end
4036 l_extended_feature_name := l_synonym.extended_name
4037 l_feature_name := l_extended_feature_name.feature_name
4038 l_feature_name.process (Current)
4039 if attached l_extended_feature_name.alias_name as l_alias_name and then not ANY_.same_objects (l_alias_name, l_feature_name) then
4040 -- For infix and prefix features, do not repeat the name twice.
4041 print_space
4042 l_alias_name.process (Current)
4043 comment_finder.add_excluded_node (l_alias_name)
4044 end
4045 comment_finder.add_excluded_node (l_feature_name)
4046 comment_finder.find_comments (l_extended_feature_name, comment_list)
4047 comment_finder.reset_excluded_nodes
4048 l_synonym := l_synonym.synonym
4049 if l_synonym /= Void then
4050 -- The AST may or may not contain the comma.
4051 -- So we have to print it explicitly here.
4052 tokens.comma_symbol.process (Current)
4053 print_space
4054 end
4055 end
4056 if attached a_feature.arguments as l_arguments then
4057 if l_arguments.is_empty then
4058 -- Do not print empty parentheses, but keep the comments if any.
4059 comment_finder.find_comments (l_arguments, comment_list)
4060 else
4061 print_space
4062 l_arguments.process (Current)
4063 end
4064 end
4065 print_space
4066 tokens.is_keyword.process (Current)
4067 if attached a_feature.is_keyword as l_is_keyword then
4068 process_break (l_is_keyword.break)
4069 end
4070 indent
4071 process_comments
4072 print_new_line
4073 if attached a_feature.first_indexing as l_indexing then
4074 process_indexing_clause (l_indexing, False)
4075 process_comments
4076 print_new_line
4077 end
4078 if attached a_feature.obsolete_message as l_obsolete_message then
4079 tokens.obsolete_keyword.process (Current)
4080 l_obsolete_string := l_obsolete_message.manifest_string
4081 comment_finder.add_excluded_node (l_obsolete_string)
4082 comment_finder.find_comments (l_obsolete_message, comment_list)
4083 comment_finder.reset_excluded_nodes
4084 indent
4085 process_comments
4086 print_new_line
4087 l_obsolete_string.process (Current)
4088 process_comments
4089 print_new_line
4090 dedent
4091 end
4092 if attached a_feature.preconditions as l_preconditions then
4093 l_preconditions.process (Current)
4094 process_comments
4095 end
4096 if attached a_feature.locals as l_locals then
4097 l_locals.process (Current)
4098 process_comments
4099 end
4100 tokens.once_keyword.process (Current)
4101 l_compound := a_feature.compound
4102 if l_compound /= Void then
4103 process_break (l_compound.keyword.break)
4104 end
4105 if attached a_feature.keys as l_keys then
4106 if l_keys.is_empty then
4107 -- Do not print empty parentheses, but keep the comments if any.
4108 comment_finder.find_comments (l_keys, comment_list)
4109 else
4110 print_space
4111 l_keys.process (Current)
4112 end
4113 end
4114 if l_compound /= Void then
4115 indent
4116 process_instruction_list (l_compound)
4117 dedent
4118 else
4119 process_comments
4120 end
4121 print_new_line
4122 if attached a_feature.postconditions as l_postconditions then
4123 l_postconditions.process (Current)
4124 process_comments
4125 end
4126 if attached a_feature.rescue_clause as l_rescue_clause then
4127 l_rescue_clause.process (Current)
4128 process_comments
4129 print_new_line
4130 end
4131 a_feature.end_keyword.process (Current)
4132 if attached a_feature.semicolon as l_semicolon then
4133 -- Do not print the semicolon, but keep track of its comments if any.
4134 process_break (l_semicolon.break)
4135 end
4136 dedent
4137 end
4138
4139 process_once_procedure_inline_agent (an_expression: ET_ONCE_PROCEDURE_INLINE_AGENT)
4140 -- Process `an_expression'.
4141 local
4142 l_compound: detachable ET_COMPOUND
4143 do
4144 an_expression.agent_keyword.process (Current)
4145 if attached an_expression.formal_arguments as l_formal_arguments then
4146 if l_formal_arguments.is_empty then
4147 -- Do not print empty parentheses, but keep the comments if any.
4148 comment_finder.find_comments (l_formal_arguments, comment_list)
4149 else
4150 print_space
4151 l_formal_arguments.process (Current)
4152 end
4153 end
4154 process_comments
4155 print_new_line
4156 if attached an_expression.preconditions as l_preconditions then
4157 l_preconditions.process (Current)
4158 process_comments
4159 end
4160 if attached an_expression.locals as l_locals then
4161 l_locals.process (Current)
4162 process_comments
4163 end
4164 tokens.once_keyword.process (Current)
4165 l_compound := an_expression.compound
4166 if l_compound /= Void then
4167 process_break (l_compound.keyword.break)
4168 end
4169 if attached an_expression.keys as l_keys then
4170 if l_keys.is_empty then
4171 -- Do not print empty parentheses, but keep the comments if any.
4172 comment_finder.find_comments (l_keys, comment_list)
4173 else
4174 print_space
4175 l_keys.process (Current)
4176 end
4177 end
4178 if l_compound /= Void then
4179 indent
4180 process_instruction_list (l_compound)
4181 dedent
4182 else
4183 process_comments
4184 end
4185 print_new_line
4186 if attached an_expression.postconditions as l_postconditions then
4187 l_postconditions.process (Current)
4188 process_comments
4189 end
4190 if attached an_expression.rescue_clause as l_rescue_clause then
4191 l_rescue_clause.process (Current)
4192 process_comments
4193 print_new_line
4194 end
4195 an_expression.end_keyword.process (Current)
4196 if attached {ET_AGENT_ARGUMENT_OPERAND_LIST} an_expression.actual_arguments as l_actual_arguments then
4197 -- Do not print implicit argument operands (they were not in the original class text anyway).
4198 if l_actual_arguments.is_empty then
4199 -- Do not print empty parentheses, but keep the comments if any.
4200 comment_finder.find_comments (l_actual_arguments, comment_list)
4201 else
4202 print_space
4203 l_actual_arguments.process (Current)
4204 end
4205 end
4206 end
4207
4208 process_parent (a_parent: ET_PARENT)
4209 -- Process `a_parent'.
4210 local
4211 a_renames: detachable ET_RENAME_LIST
4212 an_exports: detachable ET_EXPORT_LIST
4213 an_undefines: detachable ET_KEYWORD_FEATURE_NAME_LIST
4214 a_redefines: detachable ET_KEYWORD_FEATURE_NAME_LIST
4215 a_selects: detachable ET_KEYWORD_FEATURE_NAME_LIST
4216 an_end_keyword: detachable ET_TOKEN
4217 do
4218 a_parent.type.process (Current)
4219 indent
4220 a_renames := a_parent.renames
4221 an_exports := a_parent.exports
4222 an_undefines := a_parent.undefines
4223 a_redefines := a_parent.redefines
4224 a_selects := a_parent.selects
4225 an_end_keyword := a_parent.end_keyword
4226 if a_renames = Void and an_undefines = Void and a_redefines = Void and a_selects = Void then
4227 if an_exports = Void then
4228 -- Do not print the 'end' keyword if any.
4229 if an_end_keyword /= Void then
4230 comment_finder.find_comments (an_end_keyword, comment_list)
4231 end
4232 process_comments
4233 elseif an_exports.is_none_all then
4234 -- Print everything on the same line.
4235 print_new_line
4236 process_comments
4237 process_export_list_same_line (an_exports)
4238 if an_end_keyword /= Void then
4239 print_space
4240 an_end_keyword.process (Current)
4241 end
4242 else
4243 print_new_line
4244 process_comments
4245 an_exports.process (Current)
4246 if an_end_keyword /= Void then
4247 print_new_line
4248 process_comments
4249 an_end_keyword.process (Current)
4250 end
4251 end
4252 else
4253 if a_renames /= Void then
4254 print_new_line
4255 process_comments
4256 a_renames.process (Current)
4257 end
4258 if an_exports /= Void then
4259 print_new_line
4260 process_comments
4261 an_exports.process (Current)
4262 end
4263 if an_undefines /= Void then
4264 print_new_line
4265 process_comments
4266 an_undefines.process (Current)
4267 end
4268 if a_redefines /= Void then
4269 print_new_line
4270 process_comments
4271 a_redefines.process (Current)
4272 end
4273 if a_selects /= Void then
4274 print_new_line
4275 process_comments
4276 a_selects.process (Current)
4277 end
4278 if an_end_keyword /= Void then
4279 print_new_line
4280 process_comments
4281 an_end_keyword.process (Current)
4282 end
4283 end
4284 dedent
4285 end
4286
4287 process_parent_list (a_list: ET_PARENT_LIST)
4288 -- Process `a_list'.
4289 local
4290 i, nb: INTEGER
4291 l_item: ET_PARENT_ITEM
4292 l_parent: ET_PARENT
4293 do
4294 a_list.inherit_keyword.process (Current)
4295 print_new_line
4296 print_new_line
4297 indent
4298 process_comments
4299 nb := a_list.count
4300 from i := 1 until i > nb loop
4301 l_item := a_list.item (i)
4302 l_parent := l_item.parent
4303 l_parent.process (Current)
4304 comment_finder.add_excluded_node (l_parent)
4305 comment_finder.find_comments (l_item, comment_list)
4306 comment_finder.reset_excluded_nodes
4307 if i /= nb then
4308 process_comments
4309 print_new_line
4310 print_new_line
4311 end
4312 i := i + 1
4313 end
4314 process_comments
4315 dedent
4316 end
4317
4318 process_postconditions (a_list: ET_POSTCONDITIONS)
4319 -- Process `a_list'.
4320 local
4321 l_has_comment_assertion: BOOLEAN
4322 do
4323 l_has_comment_assertion := attached a_list.break as l_break and then l_break.has_comment
4324 if a_list.is_empty and not l_has_comment_assertion then
4325 -- Do not print empty postconditions, but keep the comments if any.
4326 -- Note that a comment is considered as an assertion here,
4327 -- and the postcondition is not considered empty in that case.
4328 comment_finder.find_comments (a_list, comment_list)
4329 else
4330 a_list.ensure_keyword.process (Current)
4331 if attached a_list.then_keyword as l_then_keyword then
4332 print_space
4333 l_then_keyword.process (Current)
4334 end
4335 print_new_line
4336 indent
4337 process_comments
4338 process_assertions (a_list)
4339 process_comments
4340 dedent
4341 end
4342 end
4343
4344 process_preconditions (a_list: ET_PRECONDITIONS)
4345 -- Process `a_list'.
4346 local
4347 l_has_comment_assertion: BOOLEAN
4348 do
4349 l_has_comment_assertion := attached a_list.break as l_break and then l_break.has_comment
4350 if a_list.is_empty and not l_has_comment_assertion then
4351 -- Do not print empty preconditions, but keep the comments if any.
4352 -- Note that a comment is considered as an assertion here,
4353 -- and the precondition is not considered empty in that case.
4354 comment_finder.find_comments (a_list, comment_list)
4355 else
4356 a_list.require_keyword.process (Current)
4357 if attached a_list.else_keyword as l_else_keyword then
4358 print_space
4359 l_else_keyword.process (Current)
4360 end
4361 print_new_line
4362 indent
4363 process_comments
4364 process_assertions (a_list)
4365 process_comments
4366 dedent
4367 end
4368 end
4369
4370 process_precursor_expression (an_expression: ET_PRECURSOR_EXPRESSION)
4371 -- Process `an_expression'.
4372 local
4373 l_class_name: ET_CLASS_NAME
4374 do
4375 an_expression.precursor_keyword.process (Current)
4376 if attached an_expression.parent_name as l_parent_name then
4377 print_space
4378 tokens.left_brace_symbol.process (Current)
4379 l_class_name := l_parent_name.class_name
4380 l_class_name.process (Current)
4381 comment_finder.add_excluded_node (l_class_name)
4382 comment_finder.find_comments (l_parent_name, comment_list)
4383 comment_finder.reset_excluded_nodes
4384 tokens.right_brace_symbol.process (Current)
4385 end
4386 if attached an_expression.arguments as l_arguments then
4387 if l_arguments.is_empty then
4388 -- Do not print empty parentheses, but keep the comments if any.
4389 comment_finder.find_comments (l_arguments, comment_list)
4390 else
4391 print_space
4392 l_arguments.process (Current)
4393 end
4394 end
4395 end
4396
4397 process_precursor_instruction (an_instruction: ET_PRECURSOR_INSTRUCTION)
4398 -- Process `an_instruction'.
4399 local
4400 l_class_name: ET_CLASS_NAME
4401 do
4402 an_instruction.precursor_keyword.process (Current)
4403 if attached an_instruction.parent_name as l_parent_name then
4404 print_space
4405 tokens.left_brace_symbol.process (Current)
4406 l_class_name := l_parent_name.class_name
4407 l_class_name.process (Current)
4408 comment_finder.add_excluded_node (l_class_name)
4409 comment_finder.find_comments (l_parent_name, comment_list)
4410 comment_finder.reset_excluded_nodes
4411 tokens.right_brace_symbol.process (Current)
4412 end
4413 if attached an_instruction.arguments as l_arguments then
4414 if l_arguments.is_empty then
4415 -- Do not print empty parentheses, but keep the comments if any.
4416 comment_finder.find_comments (l_arguments, comment_list)
4417 else
4418 print_space
4419 l_arguments.process (Current)
4420 end
4421 end
4422 end
4423
4424 process_prefix_expression (an_expression: ET_PREFIX_EXPRESSION)
4425 -- Process `an_expression'.
4426 local
4427 l_operator: ET_OPERATOR
4428 l_expression: ET_EXPRESSION
4429 do
4430 l_operator := an_expression.name
4431 l_expression := an_expression.expression
4432 l_operator.process (Current)
4433 if l_operator.is_prefix_minus or l_operator.is_prefix_plus then
4434 if l_expression.is_prefix_expression then
4435 print_space
4436 end
4437 else
4438 print_space
4439 end
4440 an_expression.expression.process (Current)
4441 end
4442
4443 process_prefix_name (a_name: ET_PREFIX_NAME)
4444 -- Process `a_name'.
4445 do
4446 a_name.prefix_keyword.process (Current)
4447 print_space
4448 a_name.operator_name.process (Current)
4449 end
4450
4451 process_qualified_call (a_call: ET_QUALIFIED_CALL)
4452 -- Process `a_call'.
4453 local
4454 l_qualified_feature_name: ET_QUALIFIED_FEATURE_NAME
4455 l_feature_name: ET_FEATURE_NAME
4456 do
4457 -- The AST may or may not contain the dot.
4458 -- So we have to print them explicitly here.
4459 tokens.dot_symbol.process (Current)
4460 l_qualified_feature_name := a_call.qualified_name
4461 l_feature_name := l_qualified_feature_name.feature_name
4462 l_feature_name.process (Current)
4463 comment_finder.add_excluded_node (l_feature_name)
4464 comment_finder.find_comments (l_qualified_feature_name, comment_list)
4465 comment_finder.reset_excluded_nodes
4466 if attached a_call.arguments as l_arguments then
4467 if l_arguments.is_empty then
4468 -- Do not print empty parentheses, but keep the comments if any.
4469 comment_finder.find_comments (l_arguments, comment_list)
4470 else
4471 print_space
4472 l_arguments.process (Current)
4473 end
4474 end
4475 end
4476
4477 process_qualified_call_expression (an_expression: ET_QUALIFIED_CALL_EXPRESSION)
4478 -- Process `an_expression'.
4479 do
4480 process_qualified_regular_feature_call (an_expression)
4481 end
4482
4483 process_qualified_call_instruction (an_instruction: ET_QUALIFIED_CALL_INSTRUCTION)
4484 -- Process `an_instruction'.
4485 do
4486 process_qualified_regular_feature_call (an_instruction)
4487 end
4488
4489 process_qualified_like_braced_type (a_type: ET_QUALIFIED_LIKE_BRACED_TYPE)
4490 -- Process `a_type'.
4491 local
4492 l_qualified_feature_name: ET_QUALIFIED_FEATURE_NAME
4493 l_feature_name: ET_FEATURE_NAME
4494 do
4495 if attached a_type.type_mark as l_type_mark then
4496 l_type_mark.process (Current)
4497 if not l_type_mark.is_implicit_mark then
4498 print_space
4499 end
4500 end
4501 a_type.like_keyword.process (Current)
4502 print_space
4503 a_type.left_brace.process (Current)
4504 a_type.target_type.process (Current)
4505 a_type.right_brace.process (Current)
4506 -- The AST may or may not contain the dot.
4507 -- So we have to print them explicitly here.
4508 tokens.dot_symbol.process (Current)
4509 l_qualified_feature_name := a_type.qualified_name
4510 l_feature_name := l_qualified_feature_name.feature_name
4511 l_feature_name.process (Current)
4512 comment_finder.add_excluded_node (l_feature_name)
4513 comment_finder.find_comments (l_qualified_feature_name, comment_list)
4514 comment_finder.reset_excluded_nodes
4515 end
4516
4517 process_qualified_like_type (a_type: ET_QUALIFIED_LIKE_TYPE)
4518 -- Process `a_type'.
4519 local
4520 l_qualified_feature_name: ET_QUALIFIED_FEATURE_NAME
4521 l_feature_name: ET_FEATURE_NAME
4522 do
4523 if attached a_type.type_mark as l_type_mark then
4524 l_type_mark.process (Current)
4525 if not l_type_mark.is_implicit_mark then
4526 print_space
4527 end
4528 end
4529 a_type.target_type.process (Current)
4530 -- The AST may or may not contain the dot.
4531 -- So we have to print them explicitly here.
4532 tokens.dot_symbol.process (Current)
4533 l_qualified_feature_name := a_type.qualified_name
4534 l_feature_name := l_qualified_feature_name.feature_name
4535 l_feature_name.process (Current)
4536 comment_finder.add_excluded_node (l_feature_name)
4537 comment_finder.find_comments (l_qualified_feature_name, comment_list)
4538 comment_finder.reset_excluded_nodes
4539 end
4540
4541 process_qualified_regular_feature_call (a_call: ET_QUALIFIED_REGULAR_FEATURE_CALL)
4542 -- Process `a_call'.
4543 local
4544 l_qualified_feature_name: ET_QUALIFIED_FEATURE_NAME
4545 l_feature_name: ET_FEATURE_NAME
4546 do
4547 a_call.target.process (Current)
4548 -- The AST may or may not contain the dot.
4549 -- So we have to print them explicitly here.
4550 tokens.dot_symbol.process (Current)
4551 l_qualified_feature_name := a_call.qualified_name
4552 l_feature_name := l_qualified_feature_name.feature_name
4553 l_feature_name.process (Current)
4554 comment_finder.add_excluded_node (l_feature_name)
4555 comment_finder.find_comments (l_qualified_feature_name, comment_list)
4556 comment_finder.reset_excluded_nodes
4557 if attached a_call.arguments as l_arguments then
4558 if l_arguments.is_empty then
4559 -- Do not print empty parentheses, but keep the comments if any.
4560 comment_finder.find_comments (l_arguments, comment_list)
4561 else
4562 print_space
4563 l_arguments.process (Current)
4564 end
4565 end
4566 end
4567
4568 process_regular_integer_constant (a_constant: ET_REGULAR_INTEGER_CONSTANT)
4569 -- Process `a_constant'.
4570 local
4571 l_type: ET_TYPE
4572 do
4573 if attached a_constant.cast_type as l_cast_type then
4574 -- The AST may or may not contain the braces.
4575 -- So we have to print them explicitly here.
4576 l_type := l_cast_type.type
4577 tokens.left_brace_symbol.process (Current)
4578 l_type.type.process (Current)
4579 tokens.right_brace_symbol.process (Current)
4580 comment_finder.add_excluded_node (l_type)
4581 comment_finder.find_comments (l_cast_type, comment_list)
4582 comment_finder.reset_excluded_nodes
4583 print_space
4584 end
4585 if attached a_constant.sign as l_sign then
4586 l_sign.process (Current)
4587 end
4588 print_string (a_constant.literal)
4589 process_break (a_constant.break)
4590 end
4591
4592 process_regular_manifest_string (a_string: ET_REGULAR_MANIFEST_STRING)
4593 -- Process `a_string'.
4594 local
4595 l_type: ET_TYPE
4596 do
4597 if attached a_string.cast_type as l_cast_type then
4598 -- The AST may or may not contain the braces.
4599 -- So we have to print them explicitly here.
4600 l_type := l_cast_type.type
4601 tokens.left_brace_symbol.process (Current)
4602 l_type.type.process (Current)
4603 tokens.right_brace_symbol.process (Current)
4604 comment_finder.add_excluded_node (l_type)
4605 comment_finder.find_comments (l_cast_type, comment_list)
4606 comment_finder.reset_excluded_nodes
4607 print_space
4608 end
4609 print_character ('%"')
4610 print_string (a_string.literal)
4611 print_character ('%"')
4612 process_break (a_string.break)
4613 end
4614
4615 process_regular_real_constant (a_constant: ET_REGULAR_REAL_CONSTANT)
4616 -- Process `a_constant'.
4617 local
4618 l_type: ET_TYPE
4619 do
4620 if attached a_constant.cast_type as l_cast_type then
4621 -- The AST may or may not contain the braces.
4622 -- So we have to print them explicitly here.
4623 l_type := l_cast_type.type
4624 tokens.left_brace_symbol.process (Current)
4625 l_type.type.process (Current)
4626 tokens.right_brace_symbol.process (Current)
4627 comment_finder.add_excluded_node (l_type)
4628 comment_finder.find_comments (l_cast_type, comment_list)
4629 comment_finder.reset_excluded_nodes
4630 print_space
4631 end
4632 if attached a_constant.sign as l_sign then
4633 l_sign.process (Current)
4634 end
4635 print_string (a_constant.literal)
4636 process_break (a_constant.break)
4637 end
4638
4639 process_rename (a_rename: ET_RENAME)
4640 -- Process `a_rename'.
4641 do
4642 a_rename.old_name.process (Current)
4643 print_space
4644 a_rename.as_keyword.process (Current)
4645 print_space
4646 a_rename.new_name.process (Current)
4647 end
4648
4649 process_rename_list (a_list: ET_RENAME_LIST)
4650 -- Process `a_list'.
4651 local
4652 i, nb: INTEGER
4653 l_item: ET_RENAME_ITEM
4654 l_rename: ET_RENAME
4655 do
4656 a_list.rename_keyword.process (Current)
4657 indent
4658 nb := a_list.count
4659 from i := 1 until i > nb loop
4660 process_comments
4661 print_new_line
4662 l_item := a_list.item (i)
4663 l_rename := l_item.rename_pair
4664 process_rename (l_rename)
4665 comment_finder.add_excluded_node (l_rename.old_name)
4666 comment_finder.add_excluded_node (l_rename.as_keyword)
4667 comment_finder.add_excluded_node (l_rename.new_name)
4668 comment_finder.find_comments (l_item, comment_list)
4669 comment_finder.reset_excluded_nodes
4670 if i /= nb then
4671 -- The AST may or may not contain the comma.
4672 -- So we have to print it explicitly here.
4673 tokens.comma_symbol.process (Current)
4674 end
4675 i := i + 1
4676 end
4677 dedent
4678 end
4679
4680 process_result (an_expression: ET_RESULT)
4681 -- Process `an_expression'.
4682 do
4683 process_keyword (tokens.result_keyword)
4684 comment_finder.find_comments (an_expression, comment_list)
4685 end
4686
4687 process_result_address (an_expression: ET_RESULT_ADDRESS)
4688 -- Process `an_expression'.
4689 do
4690 tokens.dollar_symbol.process (Current)
4691 tokens.result_keyword.process (Current)
4692 comment_finder.find_comments (an_expression, comment_list)
4693 end
4694
4695 process_retry_instruction (an_instruction: ET_RETRY_INSTRUCTION)
4696 -- Process `an_instruction'.
4697 do
4698 process_keyword (tokens.retry_keyword)
4699 comment_finder.find_comments (an_instruction, comment_list)
4700 end
4701
4702 process_semicolon_symbol (a_symbol: ET_SEMICOLON_SYMBOL)
4703 -- Process `a_symbol'.
4704 do
4705 process_symbol (tokens.semicolon_symbol)
4706 comment_finder.find_comments (a_symbol, comment_list)
4707 end
4708
4709 process_special_manifest_string (a_string: ET_SPECIAL_MANIFEST_STRING)
4710 -- Process `a_string'.
4711 local
4712 l_type: ET_TYPE
4713 do
4714 if attached a_string.cast_type as l_cast_type then
4715 -- The AST may or may not contain the braces.
4716 -- So we have to print them explicitly here.
4717 l_type := l_cast_type.type
4718 tokens.left_brace_symbol.process (Current)
4719 l_type.type.process (Current)
4720 tokens.right_brace_symbol.process (Current)
4721 comment_finder.add_excluded_node (l_type)
4722 comment_finder.find_comments (l_cast_type, comment_list)
4723 comment_finder.reset_excluded_nodes
4724 print_space
4725 end
4726 print_character ('%"')
4727 print_string (a_string.literal)
4728 print_character ('%"')
4729 process_break (a_string.break)
4730 end
4731
4732 process_static_call_expression (an_expression: ET_STATIC_CALL_EXPRESSION)
4733 -- Process `an_expression'.
4734 local
4735 l_static_type: ET_TARGET_TYPE
4736 l_type: ET_TYPE
4737 do
4738 if attached an_expression.feature_keyword as l_feature_keyword then
4739 comment_finder.find_comments (l_feature_keyword, comment_list)
4740 end
4741 l_static_type := an_expression.static_type
4742 l_type := l_static_type.type
4743 tokens.left_brace_symbol.process (Current)
4744 l_type.process (Current)
4745 tokens.right_brace_symbol.process (Current)
4746 comment_finder.add_excluded_node (l_type)
4747 comment_finder.find_comments (l_static_type, comment_list)
4748 comment_finder.reset_excluded_nodes
4749 process_qualified_call (an_expression)
4750 end
4751
4752 process_static_call_instruction (an_instruction: ET_STATIC_CALL_INSTRUCTION)
4753 -- Process `an_instruction'.
4754 local
4755 l_static_type: ET_TARGET_TYPE
4756 l_type: ET_TYPE
4757 do
4758 if attached an_instruction.feature_keyword as l_feature_keyword then
4759 comment_finder.find_comments (l_feature_keyword, comment_list)
4760 end
4761 l_static_type := an_instruction.static_type
4762 l_type := l_static_type.type
4763 tokens.left_brace_symbol.process (Current)
4764 l_type.process (Current)
4765 tokens.right_brace_symbol.process (Current)
4766 comment_finder.add_excluded_node (l_type)
4767 comment_finder.find_comments (l_static_type, comment_list)
4768 comment_finder.reset_excluded_nodes
4769 process_qualified_call (an_instruction)
4770 end
4771
4772 process_strip_expression (an_expression: ET_STRIP_EXPRESSION)
4773 -- Process `an_expression'.
4774 local
4775 i, nb: INTEGER
4776 l_item: ET_FEATURE_NAME_ITEM
4777 l_feature_name: ET_FEATURE_NAME
4778 do
4779 an_expression.strip_keyword.process (Current)
4780 print_space
4781 an_expression.left_parenthesis.process (Current)
4782 nb := an_expression.count
4783 from i := 1 until i > nb loop
4784 l_item := an_expression.item (i)
4785 l_feature_name := l_item.feature_name
4786 l_feature_name.process (Current)
4787 comment_finder.add_excluded_node (l_feature_name)
4788 comment_finder.find_comments (l_item, comment_list)
4789 comment_finder.reset_excluded_nodes
4790 if i /= nb then
4791 -- The AST may or may not contain the comma.
4792 -- So we have to print it explicitly here.
4793 tokens.comma_symbol.process (Current)
4794 print_space
4795 end
4796 i := i + 1
4797 end
4798 an_expression.right_parenthesis.process (Current)
4799 end
4800
4801 process_symbol (a_symbol: ET_SYMBOL)
4802 -- Process `a_symbol'.
4803 do
4804 print_string (a_symbol.text)
4805 process_break (a_symbol.break)
4806 end
4807
4808 process_tagged_assertion (an_assertion: ET_TAGGED_ASSERTION)
4809 -- Process `an_assertion'.
4810 local
4811 l_tag: ET_TAG
4812 l_identifier: ET_IDENTIFIER
4813 do
4814 l_tag := an_assertion.tag
4815 l_identifier := l_tag.identifier
4816 l_identifier.process (Current)
4817 comment_finder.add_excluded_node (l_identifier)
4818 comment_finder.find_comments (l_tag, comment_list)
4819 comment_finder.reset_excluded_nodes
4820 -- The AST may or may not contain the colon.
4821 -- So we have to print it explicitly here.
4822 tokens.colon_symbol.process (Current)
4823 if attached an_assertion.expression as l_expression then
4824 print_space
4825 l_expression.process (Current)
4826 end
4827 end
4828
4829 process_tagged_indexing (an_indexing: ET_TAGGED_INDEXING)
4830 -- Process `an_indexing'.
4831 local
4832 l_tag: ET_TAG
4833 l_identifier: ET_IDENTIFIER
4834 do
4835 l_tag := an_indexing.tag
4836 l_identifier := l_tag.identifier
4837 l_identifier.process (Current)
4838 comment_finder.add_excluded_node (l_identifier)
4839 comment_finder.find_comments (l_tag, comment_list)
4840 comment_finder.reset_excluded_nodes
4841 -- The AST may or may not contain the colon.
4842 -- So we have to print it explicitly here.
4843 tokens.colon_symbol.process (Current)
4844 print_space
4845 process_indexing (an_indexing)
4846 end
4847
4848 process_tagged_indexing_indented (an_indexing: ET_TAGGED_INDEXING)
4849 -- Process `an_indexing'.
4850 -- Print the tag, then the note terms indented two lines below.
4851 require
4852 an_indexing_not_void: an_indexing /= Void
4853 local
4854 l_tag: ET_TAG
4855 l_identifier: ET_IDENTIFIER
4856 l_terms: ET_INDEXING_TERM_LIST
4857 do
4858 l_tag := an_indexing.tag
4859 l_identifier := l_tag.identifier
4860 l_identifier.process (Current)
4861 comment_finder.add_excluded_node (l_identifier)
4862 comment_finder.find_comments (l_tag, comment_list)
4863 comment_finder.reset_excluded_nodes
4864 -- The AST may or may not contain the colon.
4865 -- So we have to print it explicitly here.
4866 tokens.colon_symbol.process (Current)
4867 l_terms := an_indexing.terms
4868 if l_terms.count = 1 and then attached {ET_VERBATIM_STRING} l_terms.first.indexing_term as l_verbatim_string then
4869 print_new_line
4870 process_indexing (an_indexing)
4871 -- We make as if a comment was printed so that
4872 -- a subsequent call to `print_new_line' in
4873 -- `process_indexing_list' will not print anything.
4874 comment_printed := True
4875 else
4876 print_new_line
4877 print_new_line
4878 indent
4879 process_indexing (an_indexing)
4880 dedent
4881 end
4882 end
4883
4884 process_token (a_token: ET_TOKEN)
4885 -- Process `a_token'.
4886 do
4887 print_string (a_token.text)
4888 process_break (a_token.break)
4889 end
4890
4891 process_true_constant (a_constant: ET_TRUE_CONSTANT)
4892 -- Process `a_constant'.
4893 do
4894 process_keyword (tokens.true_keyword)
4895 comment_finder.find_comments (a_constant, comment_list)
4896 end
4897
4898 process_tuple_type (a_type: ET_TUPLE_TYPE)
4899 -- Process `a_type'.
4900 do
4901 if attached a_type.type_mark as l_type_mark then
4902 l_type_mark.process (Current)
4903 if not l_type_mark.is_implicit_mark then
4904 print_space
4905 end
4906 end
4907 process_token (tokens.tuple_keyword)
4908 comment_finder.find_comments (a_type.tuple_keyword, comment_list)
4909 if not attached a_type.actual_parameters as l_actual_parameters then
4910 -- Do nothing.
4911 elseif l_actual_parameters.is_empty then
4912 -- Do not print empty brackets, but keep the comments if any.
4913 comment_finder.find_comments (l_actual_parameters, comment_list)
4914 else
4915 print_space
4916 l_actual_parameters.process (Current)
4917 end
4918 end
4919
4920 process_underscored_integer_constant (a_constant: ET_UNDERSCORED_INTEGER_CONSTANT)
4921 -- Process `a_constant'.
4922 local
4923 l_type: ET_TYPE
4924 do
4925 if attached a_constant.cast_type as l_cast_type then
4926 -- The AST may or may not contain the braces.
4927 -- So we have to print them explicitly here.
4928 l_type := l_cast_type.type
4929 tokens.left_brace_symbol.process (Current)
4930 l_type.type.process (Current)
4931 tokens.right_brace_symbol.process (Current)
4932 comment_finder.add_excluded_node (l_type)
4933 comment_finder.find_comments (l_cast_type, comment_list)
4934 comment_finder.reset_excluded_nodes
4935 print_space
4936 end
4937 if attached a_constant.sign as l_sign then
4938 l_sign.process (Current)
4939 end
4940 print_string (a_constant.literal)
4941 process_break (a_constant.break)
4942 end
4943
4944 process_underscored_real_constant (a_constant: ET_UNDERSCORED_REAL_CONSTANT)
4945 -- Process `a_constant'.
4946 local
4947 l_type: ET_TYPE
4948 do
4949 if attached a_constant.cast_type as l_cast_type then
4950 -- The AST may or may not contain the braces.
4951 -- So we have to print them explicitly here.
4952 l_type := l_cast_type.type
4953 tokens.left_brace_symbol.process (Current)
4954 l_type.type.process (Current)
4955 tokens.right_brace_symbol.process (Current)
4956 comment_finder.add_excluded_node (l_type)
4957 comment_finder.find_comments (l_cast_type, comment_list)
4958 comment_finder.reset_excluded_nodes
4959 print_space
4960 end
4961 if attached a_constant.sign as l_sign then
4962 l_sign.process (Current)
4963 end
4964 print_string (a_constant.literal)
4965 process_break (a_constant.break)
4966 end
4967
4968 process_unique_attribute (a_feature: ET_UNIQUE_ATTRIBUTE)
4969 -- Process `a_feature'.
4970 local
4971 l_synonym: detachable ET_FEATURE
4972 l_extended_feature_name: ET_EXTENDED_FEATURE_NAME
4973 l_feature_name: ET_FEATURE_NAME
4974 l_declared_type: ET_DECLARED_TYPE
4975 l_type: ET_TYPE
4976 do
4977 from
4978 l_synonym := a_feature
4979 until
4980 l_synonym = Void
4981 loop
4982 if attached l_synonym.frozen_keyword as l_frozen_keyword then
4983 l_frozen_keyword.process (Current)
4984 print_space
4985 end
4986 l_extended_feature_name := l_synonym.extended_name
4987 l_feature_name := l_extended_feature_name.feature_name
4988 l_feature_name.process (Current)
4989 if attached l_extended_feature_name.alias_name as l_alias_name and then not ANY_.same_objects (l_alias_name, l_feature_name) then
4990 -- For infix and prefix features, do not repeat the name twice.
4991 print_space
4992 l_alias_name.process (Current)
4993 comment_finder.add_excluded_node (l_alias_name)
4994 end
4995 comment_finder.add_excluded_node (l_feature_name)
4996 comment_finder.find_comments (l_extended_feature_name, comment_list)
4997 comment_finder.reset_excluded_nodes
4998 l_synonym := l_synonym.synonym
4999 if l_synonym /= Void then
5000 -- The AST may or may not contain the comma.
5001 -- So we have to print it explicitly here.
5002 tokens.comma_symbol.process (Current)
5003 print_space
5004 end
5005 end
5006 -- The AST may or may not contain the colon.
5007 -- So we have to print it explicitly here.
5008 l_declared_type := a_feature.declared_type
5009 l_type := l_declared_type.type
5010 tokens.colon_symbol.process (Current)
5011 comment_finder.add_excluded_node (l_type)
5012 comment_finder.find_comments (l_declared_type, comment_list)
5013 comment_finder.reset_excluded_nodes
5014 print_space
5015 l_type.process (Current)
5016 print_space
5017 if attached a_feature.assigner as l_assigner then
5018 l_assigner.process (Current)
5019 print_space
5020 end
5021 tokens.is_keyword.process (Current)
5022 process_break (a_feature.is_keyword.break)
5023 print_space
5024 tokens.unique_keyword.process (Current)
5025 process_break (a_feature.unique_keyword.break)
5026 if attached a_feature.semicolon as l_semicolon then
5027 -- Do not print the semicolon, but keep track of its comments if any.
5028 process_break (l_semicolon.break)
5029 end
5030 -- Print header comment.
5031 indent
5032 process_comments
5033 dedent
5034 end
5035
5036 process_unqualified_call_expression (an_expression: ET_UNQUALIFIED_CALL_EXPRESSION)
5037 -- Process `an_expression'.
5038 do
5039 process_unqualified_regular_feature_call (an_expression)
5040 end
5041
5042 process_unqualified_call_instruction (an_instruction: ET_UNQUALIFIED_CALL_INSTRUCTION)
5043 -- Process `an_instruction'.
5044 do
5045 process_unqualified_regular_feature_call (an_instruction)
5046 end
5047
5048 process_unqualified_regular_feature_call (a_call: ET_UNQUALIFIED_REGULAR_FEATURE_CALL)
5049 -- Process `a_call'.
5050 do
5051 a_call.name.process (Current)
5052 if attached a_call.arguments as l_arguments then
5053 if l_arguments.is_empty then
5054 -- Do not print empty parentheses, but keep the comments if any.
5055 comment_finder.find_comments (l_arguments, comment_list)
5056 else
5057 print_space
5058 l_arguments.process (Current)
5059 end
5060 end
5061 end
5062
5063 process_variant (a_variant: ET_VARIANT)
5064 -- Process `a_variant'.
5065 local
5066 l_identifier: ET_IDENTIFIER
5067 do
5068 a_variant.variant_keyword.process (Current)
5069 indent
5070 print_new_line
5071 process_comments
5072 if attached a_variant.tag as l_tag then
5073 l_identifier := l_tag.identifier
5074 l_identifier.process (Current)
5075 comment_finder.add_excluded_node (l_identifier)
5076 comment_finder.find_comments (l_tag, comment_list)
5077 comment_finder.reset_excluded_nodes
5078 -- The AST may or may not contain the colon.
5079 -- So we have to print it explicitly here.
5080 tokens.colon_symbol.process (Current)
5081 print_space
5082 end
5083 a_variant.expression.process (Current)
5084 process_comments
5085 dedent
5086 end
5087
5088 process_verbatim_string (a_string: ET_VERBATIM_STRING)
5089 -- Process `a_string'.
5090 local
5091 l_type: ET_TYPE
5092 do
5093 if attached a_string.cast_type as l_cast_type then
5094 -- The AST may or may not contain the braces.
5095 -- So we have to print them explicitly here.
5096 l_type := l_cast_type.type
5097 tokens.left_brace_symbol.process (Current)
5098 l_type.type.process (Current)
5099 tokens.right_brace_symbol.process (Current)
5100 comment_finder.add_excluded_node (l_type)
5101 comment_finder.find_comments (l_cast_type, comment_list)
5102 comment_finder.reset_excluded_nodes
5103 print_space
5104 end
5105 print_character ('%"')
5106 print_string (a_string.marker)
5107 if a_string.is_left_aligned then
5108 print_character ('[')
5109 else
5110 print_character ('{')
5111 end
5112 print_string (a_string.open_white_characters)
5113 print_string (a_string.literal)
5114 print_string (a_string.close_white_characters)
5115 if a_string.is_left_aligned then
5116 print_character (']')
5117 else
5118 print_character ('}')
5119 end
5120 print_string (a_string.marker)
5121 print_character ('%"')
5122 process_break (a_string.break)
5123 end
5124
5125 process_void (an_expression: ET_VOID)
5126 -- Process `an_expression'.
5127 do
5128 process_keyword (tokens.void_keyword)
5129 comment_finder.find_comments (an_expression, comment_list)
5130 end
5131
5132 process_when_part (a_when_part: ET_WHEN_PART)
5133 -- Process `a_when_part'.
5134 do
5135 a_when_part.choices.process (Current)
5136 print_space
5137 if attached a_when_part.then_compound as l_then_compound then
5138 l_then_compound.process (Current)
5139 else
5140 tokens.then_keyword.process (Current)
5141 end
5142 end
5143
5144 process_when_part_list (a_list: ET_WHEN_PART_LIST)
5145 -- Process `a_list'.
5146 local
5147 i, nb: INTEGER
5148 do
5149 nb := a_list.count
5150 from i := 1 until i > nb loop
5151 a_list.item (i).process (Current)
5152 if i /= nb then
5153 print_new_line
5154 process_comments
5155 end
5156 i := i + 1
5157 end
5158 end
5159
5160 feature {NONE} -- Printing
5161
5162 print_character (c: CHARACTER)
5163 -- Print character `c'.
5164 -- Print indentation first if not done yet.
5165 do
5166 if not indentation_printed then
5167 print_indentation
5168 end
5169 file.put_character (c)
5170 comment_printed := False
5171 end
5172
5173 print_space
5174 -- Print space character, unless a comment had just been printed.
5175 do
5176 if not comment_printed then
5177 print_character (' ')
5178 end
5179 comment_printed := False
5180 end
5181
5182 print_string (s: STRING)
5183 -- Print string `s'.
5184 -- Print indentation first if not done yet.
5185 require
5186 s_not_void: s /= Void
5187 do
5188 if not indentation_printed then
5189 print_indentation
5190 end
5191 file.put_string (s)
5192 comment_printed := False
5193 end
5194
5195 print_new_line
5196 -- Print new-line character unless a comment had just been printed.
5197 do
5198 if not comment_printed then
5199 file.put_new_line
5200 indentation_printed := False
5201 end
5202 comment_printed := False
5203 end
5204
5205 feature {NONE} -- Indentation
5206
5207 print_indentation
5208 -- Print indentation to `file'.
5209 local
5210 i, nb: INTEGER
5211 do
5212 nb := indentation
5213 from i := 1 until i > nb loop
5214 file.put_character ('%T')
5215 i := i + 1
5216 end
5217 indentation_printed := True
5218 comment_printed := False
5219 end
5220
5221 indentation_printed: BOOLEAN
5222 -- Has indentation already been printed on the current line?
5223
5224 feature {NONE} -- Comments
5225
5226 print_comment (a_break: ET_BREAK)
5227 -- Print comment held in `a_break', followed by a new-line.
5228 require
5229 a_break_not_void: a_break /= Void
5230 a_break_has_comment: a_break.has_comment
5231 local
5232 l_comment: STRING
5233 i, nb: INTEGER
5234 c: CHARACTER
5235 l_in_comment: BOOLEAN
5236 do
5237 comment_printed := False
5238 l_comment := a_break.text
5239 nb := l_comment.count
5240 from i := 1 until i > nb loop
5241 c := l_comment.item (i)
5242 inspect c
5243 when ' ', '%T', '%R' then
5244 if l_in_comment then
5245 print_character (c)
5246 end
5247 when '%N' then
5248 if l_in_comment then
5249 print_new_line
5250 l_in_comment := False
5251 end
5252 when '-' then
5253 if not l_in_comment then
5254 if i = 1 or else l_comment.item (i - 1) /= '%N' then
5255 -- This comment does not appear at the beginning of a line.
5256 elseif i + 2 > nb or else l_comment.item (i + 2) /= '%T' then
5257 -- The two dashes are not followed by a tab.
5258 else
5259 -- This looks like code that has been commented out
5260 -- (either manually or using EiffelStudio).
5261 -- Do not indent this comment.
5262 indentation_printed := True
5263 end
5264 end
5265 print_character (c)
5266 l_in_comment := True
5267 else
5268 print_character (c)
5269 end
5270 i := i + 1
5271 end
5272 if l_in_comment then
5273 -- There was no new-line at the end of the comment
5274 -- (probably because it appeared at the end of the file).
5275 -- But in the header comment we promised to write one.
5276 print_new_line
5277 end
5278 comment_printed := True
5279 end
5280
5281 print_indented_comment (a_break: ET_BREAK)
5282 -- Print comment held in `a_break' on its own line (go to next
5283 -- line if necessary), with an extra indentation level.
5284 -- Comments are followed by a new-line.
5285 require
5286 a_break_not_void: a_break /=