PageRenderTime 24ms CodeModel.GetById 17ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/src/tools/interpreter/builtins/liberty_interpreter_external_type_boolean_builtins.e

http://github.com/tybor/Liberty
Specman e | 60 lines | 40 code | 6 blank | 14 comment | 3 complexity | b2a0218df85f9b260b696f27e31a16dd 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_INTERPRETER_EXTERNAL_TYPE_BOOLEAN_BUILTINS
16
17inherit
18   LIBERTY_INTERPRETER_EXTERNAL_TYPED_BUILTINS[BOOLEAN]
19      redefine
20         call_implies, call_or_else, call_and_then
21      end
22
23creation {LIBERTY_INTERPRETER_EXTERNAL_BUILTIN_CALL}
24   make
25
26feature {LIBERTY_FEATURE_LOCAL_CONTEXT}
27   call_implies (f: LIBERTY_FEATURE) is
28      do
29         if not left then
30            returned := interpreter.new_boolean(True, builtin_call.position)
31         elseif right then
32            returned := interpreter.new_boolean(True, builtin_call.position)
33         else
34            returned := interpreter.new_boolean(False, builtin_call.position)
35         end
36      end
37
38   call_or_else (f: LIBERTY_FEATURE) is
39      do
40         if left then
41            returned := interpreter.new_boolean(True, builtin_call.position)
42         elseif right then
43            returned := interpreter.new_boolean(True, builtin_call.position)
44         else
45            returned := interpreter.new_boolean(False, builtin_call.position)
46         end
47      end
48
49   call_and_then (f: LIBERTY_FEATURE) is
50      do
51         if not left then
52            returned := interpreter.new_boolean(False, builtin_call.position)
53         elseif right then
54            returned := interpreter.new_boolean(True, builtin_call.position)
55         else
56            returned := interpreter.new_boolean(False, builtin_call.position)
57         end
58      end
59
60end -- class LIBERTY_INTERPRETER_EXTERNAL_TYPE_BOOLEAN_BUILTINS