PageRenderTime 13ms CodeModel.GetById 11ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 1ms

/src/tools/syntax/tree/liberty_ast_if.e

http://github.com/tybor/Liberty
Specman e | 68 lines | 40 code | 10 blank | 18 comment | 0 complexity | c2330987f566cfc708f48a1cab930ac7 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_IF
16   --
17   -- This class handles both "if" and "elseif" hence the redefines
18   --
19
20inherit
21   LIBERTY_AST_NON_TERMINAL_NODE
22      redefine
23         valid_name, make
24      end
25
26create {LIBERTY_NODE_FACTORY}
27   make
28
29feature {LIBERTY_AST_HANDLER}
30   expression: LIBERTY_AST_EXPRESSION is
31      do
32         Result ::= nodes.item(1)
33      end
34
35   instructions: EIFFEL_LIST_NODE is
36      do
37         Result ::= nodes.item(3)
38      end
39
40feature {ANY}
41   count: INTEGER is 4
42
43   name: STRING
44
45feature {}
46   make (a_name: like eiffel_name; a_names: TRAVERSABLE[FIXED_STRING]) is
47      do
48         name := a_name.out
49         Precursor(a_name, a_names)
50      end
51
52   possible_counts: SET[INTEGER] is
53      once
54         Result := {AVL_SET[INTEGER] << 4 >> }
55      end
56
57   valid_name (a_name: like eiffel_name): BOOLEAN is
58      do
59         inspect
60            a_name
61         when "If", "ElseIf" then
62            Result := True
63         else
64            --Result := False
65         end
66      end
67
68end