~ubuntu-branches/ubuntu/karmic/asis/karmic

« back to all changes in this revision

Viewing changes to tutorial/using_templets/style_ckecker/README

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Quinot
  • Date: 2002-03-03 19:55:58 UTC
  • Revision ID: james.westby@ubuntu.com-20020303195558-g7dp4vaq1zdkf814
Tags: upstream-3.14p
ImportĀ upstreamĀ versionĀ 3.14p

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Task 1:
 
2
======
 
3
The initial version of the style checker should check the following
 
4
coding style rule:
 
5
 
 
6
   All subprograms should have separate declarations;
 
7
 
 
8
Task 2:
 
9
======
 
10
Add to the initial version of the style checker checks for the
 
11
following rules:
 
12
 
 
13
   All the generic instantiation should contain only named generic
 
14
   associations;
 
15
 
 
16
   Any declaration should define exactly one entity (that is,
 
17
   multi-identifier declarations are not allowed);
 
18
 
 
19
The diagnosis generated when a style rule violation is detected
 
20
should contain the location of the syntax construct for which the
 
21
violation is detected.
 
22
 
 
23
The subdirectory 'task_1' contains three files:
 
24
 
 
25
- actuals_for_traversing-pre_op.adb - actual Pre-Operation to
 
26
    instantiate Traverse_Element, this file should replace the file
 
27
    with the same name in ASIS Application Templates to get the
 
28
    solution for Task 1.
 
29
 
 
30
- style_checker_utilities.ads and style_checker_utilities.adb - the
 
31
    package Style_Checker_Utilities, contains the procedure for
 
32
    printing out the style violation diagnosis.
 
33
 
 
34
The subdirectory 'task_2' contains one file:
 
35
 
 
36
- actuals_for_traversing-pre_op.adb - actual Pre-Operation to
 
37
    instantiate Traverse_Element, this file should replace the file
 
38
    with the same name in ASIS Application Templates to get the
 
39
    solution for Task 2, it is the extended version of the same
 
40
    file from subdirectory 'task_1', and it contains the code for
 
41
    checks to be implemented for Task 2. This file uses the same
 
42
    version of Style_Checker_Utilities as for Task 1.
 
43
 
 
44
 
 
45
Hints for Task 1
 
46
----------------
 
47
The only thing to do to solve Task 1 is to provide the real code for
 
48
actual Pre-Operation for Traverse_Element. You do not need to do
 
49
anything in Post-Operation: Pre-Operation will give you the natural
 
50
left-to-right top-down sequence of style rule checking.
 
51
 
 
52
The rule to check is about declarations, and, more specific, about
 
53
only specific kinds of declarations - namely, about the subprogram
 
54
body declarations. So, the first thing to do is to define the kind of
 
55
the argument Element in Pre-Operation, and if it is a declaration
 
56
Element, you have to define its subordinate declaration kind.
 
57
 
 
58
Actually, you have to check, that each Element which represents a
 
59
subprogram body has the corresponding separate subprogram
 
60
declaration Element. To get the declaration for a body, you need the
 
61
Asis.Declarations.Corresponding_Declaration query. See also the
 
62
Element classification hierarchy defined in the Asis package and
 
63
classification queries in the package Asis.Elements.
 
64
 
 
65
Hints for Task 2 are given as comments in the solution for Task 1
 
66
(file task_1/actuals_for_traversing-pre_op.adb).
 
 
b'\\ No newline at end of file'