/src/tools/syntax/tree/liberty_ast_feature_name_or_alias.e

http://github.com/tybor/Liberty · Specman e · 73 lines · 48 code · 11 blank · 14 comment · 1 complexity · 2c23584ee0b6ecde4d107fa87f8b9590 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_FEATURE_NAME_OR_ALIAS
  16. inherit
  17. LIBERTY_AST_NON_TERMINAL_NODE
  18. create {LIBERTY_NODE_FACTORY}
  19. make
  20. feature {LIBERTY_AST_HANDLER}
  21. is_infix: BOOLEAN is
  22. do
  23. Result := count = 2 and then nodes.first.name.is_equal(once "KW infix")
  24. ensure
  25. Result implies not is_regular and then not is_prefix
  26. end
  27. is_prefix: BOOLEAN is
  28. do
  29. Result := count = 2 and then nodes.first.name.is_equal(once "KW prefix")
  30. ensure
  31. Result implies not is_regular and then not is_infix
  32. end
  33. is_regular: BOOLEAN is
  34. do
  35. Result := count = 1
  36. ensure
  37. Result implies not is_prefix and then not is_infix
  38. end
  39. entity_name: LIBERTY_AST_ENTITY_NAME is
  40. require
  41. is_regular
  42. do
  43. Result ::= nodes.item(0)
  44. end
  45. free_operator_name: LIBERTY_AST_STRING is
  46. require
  47. is_prefix or else is_infix
  48. do
  49. Result ::= nodes.item(1)
  50. end
  51. feature {ANY}
  52. count: INTEGER is
  53. do
  54. Result := nodes.count
  55. end
  56. name: STRING is "Feature_Name_Or_Alias"
  57. feature {}
  58. possible_counts: SET[INTEGER] is
  59. once
  60. Result := {AVL_SET[INTEGER] << 1, 2 >> }
  61. end
  62. end