/src/tools/wrappers-generator/words.e

http://github.com/tybor/Liberty · Specman e · 55 lines · 35 code · 6 blank · 14 comment · 3 complexity · 58cf51c187d51abdcc218ae888227efb MD5 · raw file

  1. class WORDS
  2. -- An hashed set of words, usually read from a file
  3. inherit
  4. HASHED_SET[STRING]
  5. create {ANY}
  6. make
  7. feature {ANY}
  8. add_from_file (a_file_name: STRING)
  9. -- Add to Current the words read from the file named `a_file_name'. If
  10. -- it does not exists or if it is not a file nothing is done.
  11. require
  12. a_file_name /= Void
  13. local
  14. words: ARRAY[STRING]; line: STRING; file: TEXT_FILE_READ
  15. do
  16. create file.connect_to(a_file_name)
  17. if file.is_connected then
  18. from
  19. file.read_line
  20. until
  21. file.end_of_input
  22. loop
  23. line := file.last_string
  24. if line /= Void then
  25. words := line.split
  26. if words /= Void then
  27. words.for_each(agent add(?))
  28. end
  29. end
  30. file.read_line
  31. end
  32. end
  33. end
  34. print_all
  35. do
  36. for_each(agent std_output.put_line)
  37. end
  38. end -- class WORDS
  39. -- Copyright (C) 2008-2017: ,2009 Paolo Redaelli
  40. -- eiffel-gcc-xml is free software: you can redistribute it and/or modify it
  41. -- under the terms of the GNU General Public License as publhed by the Free
  42. -- Software Foundation, either version 2 of the License, or (at your option)
  43. -- any later version.
  44. -- eiffel-gcc-xml is distributed in the hope that it will be useful, but
  45. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  46. -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  47. -- more details.
  48. -- You should have received a copy of the GNU General Public License along with
  49. -- th program. If not, see <http://www.gnu.org/licenses/>.