/src/lib/parse/eiffel/eiffel_left_associative_expression.e

http://github.com/tybor/Liberty · Specman e · 71 lines · 42 code · 6 blank · 23 comment · 0 complexity · ad3fa4fc9d1b1a16819dbbf1f0e030a4 MD5 · raw file

  1. -- This file is part of a Liberty Eiffel library.
  2. -- See the full copyright at the end.
  3. --
  4. expanded class EIFFEL_LEFT_ASSOCIATIVE_EXPRESSION
  5. feature {EIFFEL_GRAMMAR}
  6. expression_name: FIXED_STRING
  7. right_node: EIFFEL_NODE
  8. operator_nodes: COLLECTION[EIFFEL_NODE]
  9. set (a_expression_name: like expression_name; a_operator_names: like operator_names;
  10. a_right_node: like right_node; a_operator_nodes: like operator_nodes) is
  11. require
  12. a_operator_names.for_all(agent (o: ABSTRACT_STRING): BOOLEAN is do Result := o /= Void end)
  13. do
  14. expression_name := a_expression_name
  15. operator_names := a_operator_names
  16. right_node := a_right_node
  17. operator_nodes := a_operator_nodes
  18. ensure
  19. expression_name = a_expression_name
  20. operator_names = a_operator_names
  21. right_node = a_right_node
  22. operator_nodes = a_operator_nodes
  23. end
  24. append_operators_in (operators: COLLECTION[FIXED_STRING]) is
  25. require
  26. operators /= Void
  27. local
  28. i: INTEGER
  29. do
  30. from
  31. i := operator_names.lower
  32. until
  33. i > operator_names.upper
  34. loop
  35. operators.add_last(operator_names.item(i).intern)
  36. i := i + 1
  37. end
  38. end
  39. operator_names_out: STRING is
  40. do
  41. Result := operator_names.out
  42. end
  43. feature {}
  44. operator_names: COLLECTION[ABSTRACT_STRING]
  45. end -- class EIFFEL_LEFT_ASSOCIATIVE_EXPRESSION
  46. --
  47. -- Copyright (c) 2009 by all the people cited in the AUTHORS file.
  48. --
  49. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  50. -- of this software and associated documentation files (the "Software"), to deal
  51. -- in the Software without restriction, including without limitation the rights
  52. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  53. -- copies of the Software, and to permit persons to whom the Software is
  54. -- furnished to do so, subject to the following conditions:
  55. --
  56. -- The above copyright notice and this permission notice shall be included in
  57. -- all copies or substantial portions of the Software.
  58. --
  59. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  60. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  61. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  62. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  63. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  64. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  65. -- THE SOFTWARE.