/src/tools/semantics/code/expressions/liberty_infix_operator.e

http://github.com/tybor/Liberty · Specman e · 66 lines · 44 code · 8 blank · 14 comment · 0 complexity · 4729fa2bc83a053c1af9b770ffee064a 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_INFIX_OPERATOR
  16. inherit
  17. LIBERTY_INFIX_CALL
  18. rename
  19. make as infix_make
  20. end
  21. create {LIBERTY_BUILDER_TOOLS}
  22. make
  23. create {LIBERTY_INFIX_OPERATOR}
  24. new
  25. feature {}
  26. make (a_left, a_right: LIBERTY_EXPRESSION; a_entity: like entity; a_position: like position) is
  27. require
  28. a_left /= Void
  29. a_right /= Void
  30. a_entity.feature_name.is_infix
  31. a_position /= Void
  32. do
  33. target := a_left
  34. actuals_list := {FAST_ARRAY[LIBERTY_EXPRESSION] << a_right >> }
  35. entity := a_entity
  36. position := a_position
  37. ensure
  38. target = a_left
  39. actuals.first = a_right
  40. position = a_position
  41. end
  42. the_infix_name: FIXED_STRING is
  43. do
  44. check False end
  45. end
  46. make_new (a_target: like target; a_entity: like entity; a_actuals: like actuals_list; a_position: like position): like Current is
  47. do
  48. create Result.new(a_target, a_entity, a_actuals, a_position)
  49. end
  50. feature {ANY}
  51. accept (v: VISITOR) is
  52. local
  53. v0: LIBERTY_INFIX_OPERATOR_VISITOR
  54. do
  55. v0 ::= v
  56. v0.visit_liberty_infix_operator(Current)
  57. end
  58. end