/src/tools/syntax/tree/liberty_ast_agent_signature.e

http://github.com/tybor/Liberty · Specman e · 68 lines · 44 code · 10 blank · 14 comment · 2 complexity · 90724123a3f7f23982064fed6930d668 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_AGENT_SIGNATURE
  16. inherit
  17. LIBERTY_AST_NON_TERMINAL_NODE
  18. create {LIBERTY_NODE_FACTORY}
  19. make
  20. feature {LIBERTY_AST_HANDLER}
  21. has_return_type: BOOLEAN is
  22. do
  23. Result := (count = 3 or else count = 6)
  24. check
  25. Result = nodes.last.name.is_equal(once "Type_Definition")
  26. end
  27. end
  28. return_type: LIBERTY_AST_TYPE_DEFINITION is
  29. require
  30. has_return_type
  31. do
  32. Result ::= nodes.last
  33. end
  34. has_parameters: BOOLEAN is
  35. do
  36. Result := (count = 4 or else count = 6)
  37. check
  38. Result = (count > 2) and then nodes.item(2).name.is_equal(once "Declaration*")
  39. end
  40. end
  41. parameters: EIFFEL_LIST_NODE is
  42. require
  43. has_parameters
  44. do
  45. Result ::= nodes.item(2)
  46. end
  47. feature {ANY}
  48. count: INTEGER is
  49. do
  50. Result := nodes.count
  51. end
  52. name: STRING is "Agent_Signature"
  53. feature {}
  54. possible_counts: SET[INTEGER] is
  55. once
  56. Result := {AVL_SET[INTEGER] << 1, 3, 4, 6 >> }
  57. end
  58. end