/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. --
  15. class LIBERTY_INTERPRETER_EXTERNAL_TYPE_BOOLEAN_BUILTINS
  16. inherit
  17. LIBERTY_INTERPRETER_EXTERNAL_TYPED_BUILTINS[BOOLEAN]
  18. redefine
  19. call_implies, call_or_else, call_and_then
  20. end
  21. creation {LIBERTY_INTERPRETER_EXTERNAL_BUILTIN_CALL}
  22. make
  23. feature {LIBERTY_FEATURE_LOCAL_CONTEXT}
  24. call_implies (f: LIBERTY_FEATURE) is
  25. do
  26. if not left then
  27. returned := interpreter.new_boolean(True, builtin_call.position)
  28. elseif right then
  29. returned := interpreter.new_boolean(True, builtin_call.position)
  30. else
  31. returned := interpreter.new_boolean(False, builtin_call.position)
  32. end
  33. end
  34. call_or_else (f: LIBERTY_FEATURE) is
  35. do
  36. if left then
  37. returned := interpreter.new_boolean(True, builtin_call.position)
  38. elseif right then
  39. returned := interpreter.new_boolean(True, builtin_call.position)
  40. else
  41. returned := interpreter.new_boolean(False, builtin_call.position)
  42. end
  43. end
  44. call_and_then (f: LIBERTY_FEATURE) is
  45. do
  46. if not left then
  47. returned := interpreter.new_boolean(False, builtin_call.position)
  48. elseif right then
  49. returned := interpreter.new_boolean(True, builtin_call.position)
  50. else
  51. returned := interpreter.new_boolean(False, builtin_call.position)
  52. end
  53. end
  54. end -- class LIBERTY_INTERPRETER_EXTERNAL_TYPE_BOOLEAN_BUILTINS