/src/lib/parse/eiffel/eiffel_non_terminal_node.e

http://github.com/tybor/Liberty · Specman e · 102 lines · 66 code · 13 blank · 23 comment · 3 complexity · d676d73f5def5602fb0794f8fe45e5a5 MD5 · raw file

  1. -- This file is part of a Liberty Eiffel library.
  2. -- See the full copyright at the end.
  3. --
  4. deferred class EIFFEL_NON_TERMINAL_NODE
  5. inherit
  6. EIFFEL_NODE
  7. feature {ANY}
  8. name_at (index: INTEGER): FIXED_STRING is
  9. require
  10. valid_index(index)
  11. deferred
  12. end
  13. node_at (index: INTEGER): EIFFEL_NODE is
  14. require
  15. valid_index(index)
  16. deferred
  17. end
  18. valid_index (index: INTEGER): BOOLEAN is
  19. deferred
  20. ensure
  21. definition: Result = (index >= lower and then index <= upper)
  22. end
  23. lower: INTEGER is
  24. deferred
  25. ensure
  26. Result >= 0
  27. end
  28. upper: INTEGER is
  29. deferred
  30. ensure
  31. Result >= upper - 1
  32. end
  33. count: INTEGER is
  34. deferred
  35. ensure
  36. definition: Result = upper - lower + 1
  37. end
  38. is_empty: BOOLEAN is
  39. deferred
  40. ensure
  41. definition: Result = (count = 0)
  42. end
  43. source_line: INTEGER is
  44. do
  45. if count > 0 then
  46. Result := node_at(0).source_line
  47. end
  48. end
  49. source_column: INTEGER is
  50. do
  51. if count > 0 then
  52. Result := node_at(0).source_column
  53. end
  54. end
  55. source_index: INTEGER is
  56. do
  57. if count > 0 then
  58. Result := node_at(0).source_index
  59. end
  60. end
  61. feature {EIFFEL_GRAMMAR}
  62. set (index: INTEGER; node: EIFFEL_NODE) is
  63. require
  64. valid_index(index)
  65. deferred
  66. ensure
  67. node_at(index) = node
  68. end
  69. end -- class EIFFEL_NON_TERMINAL_NODE
  70. --
  71. -- Copyright (c) 2009 by all the people cited in the AUTHORS file.
  72. --
  73. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  74. -- of this software and associated documentation files (the "Software"), to deal
  75. -- in the Software without restriction, including without limitation the rights
  76. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  77. -- copies of the Software, and to permit persons to whom the Software is
  78. -- furnished to do so, subject to the following conditions:
  79. --
  80. -- The above copyright notice and this permission notice shall be included in
  81. -- all copies or substantial portions of the Software.
  82. --
  83. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  84. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  85. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  86. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  87. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  88. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  89. -- THE SOFTWARE.