PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/src/tools/syntax/tree/liberty_ast_exp2.e

http://github.com/tybor/Liberty
Specman e | 48 lines | 27 code | 7 blank | 14 comment | 0 complexity | 973520ae33efb5faf7e4f0fc8618f061 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_EXP2
16
17inherit
18   LIBERTY_AST_EXPRESSION_BINARY[LIBERTY_AST_E2]
19
20create {LIBERTY_NODE_FACTORY}
21   make
22
23feature {LIBERTY_AST_HANDLER}
24   is_or_else: BOOLEAN is
25      do
26         Result := count = 4
27         check
28            Result implies nodes.item(1).name.is_equal(once "KW or")
29            Result implies nodes.item(2).name.is_equal(once "KW else")
30         end
31      ensure
32         Result implies not is_empty
33      end
34
35   is_or: BOOLEAN is
36      do
37         Result := count = 3 and then nodes.item(1).name.is_equal(once "KW or")
38      end
39
40   is_xor: BOOLEAN is
41      do
42         Result := count = 3 and then nodes.item(1).name.is_equal(once "KW xor")
43      end
44
45feature {ANY}
46   name: STRING is "e2-exp"
47
48end