/src/tools/syntax/tree/liberty_ast_target.e

http://github.com/tybor/Liberty · Specman e · 103 lines · 72 code · 17 blank · 14 comment · 1 complexity · 6c2422bb492a33fe14fc192bf043e915 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_AST_TARGET
  16. inherit
  17. LIBERTY_AST_NON_TERMINAL_NODE
  18. create {LIBERTY_NODE_FACTORY}
  19. make
  20. feature {LIBERTY_AST_HANDLER}
  21. is_result: BOOLEAN is
  22. do
  23. Result := count = 1 and then nodes.first.name.is_equal(once "KW Result")
  24. end
  25. is_current: BOOLEAN is
  26. do
  27. Result := count = 1 and then nodes.first.name.is_equal(once "KW Current")
  28. end
  29. is_parenthesized_expression: BOOLEAN is
  30. do
  31. Result := count = 3 and then nodes.first.name.is_equal(once "KW (")
  32. end
  33. is_precursor: BOOLEAN is
  34. do
  35. Result := count = 3 and then nodes.first.name.is_equal(once "KW Precursor")
  36. end
  37. is_implicit_feature_call: BOOLEAN is
  38. do
  39. Result := count = 2 and then nodes.first.name.is_equal(once "KW entity name")
  40. end
  41. is_manifest_or_type_test: BOOLEAN is
  42. do
  43. Result := count = 1 and then nodes.first.name.is_equal(once "Manifest_Or_Type_Test")
  44. end
  45. manifest_or_type_test: LIBERTY_AST_MANIFEST_OR_TYPE_TEST is
  46. require
  47. is_manifest_or_type_test
  48. do
  49. Result ::= nodes.item(0)
  50. end
  51. parenthesized_expression: LIBERTY_AST_EXPRESSION is
  52. require
  53. is_parenthesized_expression
  54. do
  55. Result ::= nodes.item(1)
  56. end
  57. precursor_type_mark: LIBERTY_AST_PRECURSOR_TYPE_MARK is
  58. require
  59. is_precursor
  60. do
  61. Result ::= nodes.item(1)
  62. end
  63. implicit_feature_name: LIBERTY_AST_ENTITY_NAME is
  64. require
  65. is_implicit_feature_call
  66. do
  67. Result ::= nodes.item(0)
  68. end
  69. actuals: LIBERTY_AST_ACTUALS is
  70. require
  71. is_precursor or else is_implicit_feature_call
  72. do
  73. Result ::= nodes.last
  74. end
  75. feature {ANY}
  76. count: INTEGER is
  77. do
  78. Result := nodes.count
  79. end
  80. name: STRING is "Target"
  81. feature {}
  82. possible_counts: SET[INTEGER] is
  83. once
  84. Result := {AVL_SET[INTEGER] << 1, 2, 3 >> }
  85. end
  86. end