PageRenderTime 19ms CodeModel.GetById 16ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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