PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/src/tools/syntax/tree/liberty_ast_old_creation.e

http://github.com/tybor/Liberty
Specman e | 80 lines | 55 code | 11 blank | 14 comment | 5 complexity | a65d486cd8c69168043da6c3a39e343f MD5 | raw file
 1-- This file is part of Liberty Eiffel.
 2--
 3-- Liberty Eiffel is free software: you can redistribute it and/or modify
 4-- it under the terms of the GNU General Public License as published by
 5-- the Free Software Foundation, version 3 of the License.
 6--
 7-- Liberty Eiffel is distributed in the hope that it will be useful,
 8-- but WITHOUT ANY WARRANTY; without even the implied warranty of
 9-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10-- GNU General Public License for more details.
11--
12-- You should have received a copy of the GNU General Public License
13-- along with Liberty Eiffel.  If not, see <http://www.gnu.org/licenses/>.
14--
15class LIBERTY_AST_OLD_CREATION
16
17inherit
18   LIBERTY_AST_CREATION
19      redefine
20         has_type_definition, has_creation_feature_call,
21         writable, type_definition, creation_feature_name, creation_feature_actuals,
22         possible_counts, name
23      end
24
25create {LIBERTY_NODE_FACTORY}
26   make
27
28feature {LIBERTY_AST_HANDLER}
29   has_type_definition: BOOLEAN is
30      do
31         Result := count = 4 or else count = 7
32      end
33
34   has_creation_feature_call: BOOLEAN is
35      do
36         Result := count = 6 or else count = 7
37      end
38
39   writable: LIBERTY_AST_WRITABLE is
40      do
41         if has_type_definition then
42            Result ::= nodes.item(3)
43         else
44            Result ::= nodes.item(2)
45         end
46      end
47
48   type_definition: LIBERTY_AST_TYPE_DEFINITION is
49      do
50         Result ::= nodes.item(1)
51      end
52
53   creation_feature_name: LIBERTY_AST_ENTITY_NAME is
54      do
55         if has_type_definition then
56            Result ::= nodes.item(5)
57         else
58            Result ::= nodes.item(4)
59         end
60      end
61
62   creation_feature_actuals: LIBERTY_AST_ACTUALS is
63      do
64         if has_type_definition then
65            Result ::= nodes.item(6)
66         else
67            Result ::= nodes.item(5)
68         end
69      end
70
71feature {ANY}
72   name: STRING is "Old_Creation"
73
74feature {}
75   possible_counts: SET[INTEGER] is
76      once
77         Result := {AVL_SET[INTEGER] << 3, 4, 6, 7 >> }
78      end
79
80end