/src/tools/syntax/tree/liberty_ast_old_creation.e

http://github.com/tybor/Liberty · Specman e · 80 lines · 55 code · 11 blank · 14 comment · 5 complexity · a65d486cd8c69168043da6c3a39e343f 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_OLD_CREATION
  16. inherit
  17. LIBERTY_AST_CREATION
  18. redefine
  19. has_type_definition, has_creation_feature_call,
  20. writable, type_definition, creation_feature_name, creation_feature_actuals,
  21. possible_counts, name
  22. end
  23. create {LIBERTY_NODE_FACTORY}
  24. make
  25. feature {LIBERTY_AST_HANDLER}
  26. has_type_definition: BOOLEAN is
  27. do
  28. Result := count = 4 or else count = 7
  29. end
  30. has_creation_feature_call: BOOLEAN is
  31. do
  32. Result := count = 6 or else count = 7
  33. end
  34. writable: LIBERTY_AST_WRITABLE is
  35. do
  36. if has_type_definition then
  37. Result ::= nodes.item(3)
  38. else
  39. Result ::= nodes.item(2)
  40. end
  41. end
  42. type_definition: LIBERTY_AST_TYPE_DEFINITION is
  43. do
  44. Result ::= nodes.item(1)
  45. end
  46. creation_feature_name: LIBERTY_AST_ENTITY_NAME is
  47. do
  48. if has_type_definition then
  49. Result ::= nodes.item(5)
  50. else
  51. Result ::= nodes.item(4)
  52. end
  53. end
  54. creation_feature_actuals: LIBERTY_AST_ACTUALS is
  55. do
  56. if has_type_definition then
  57. Result ::= nodes.item(6)
  58. else
  59. Result ::= nodes.item(5)
  60. end
  61. end
  62. feature {ANY}
  63. name: STRING is "Old_Creation"
  64. feature {}
  65. possible_counts: SET[INTEGER] is
  66. once
  67. Result := {AVL_SET[INTEGER] << 3, 4, 6, 7 >> }
  68. end
  69. end