home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #4 / amigaacscoverdisc1998-041998.iso / utilities / shareware / dev / ppcsmalleiffel / lib_se / index_clause.e < prev    next >
Encoding:
Text File  |  1998-01-16  |  2.3 KB  |  101 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr 
  4. --                       http://www.loria.fr/SmallEiffel
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it 
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later 
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License 
  11. -- for  more  details.  You  should  have  received a copy of the GNU General 
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. class INDEX_CLAUSE
  17.    --   
  18.    --
  19.  
  20. inherit GLOBALS;
  21.  
  22. creation {EIFFEL_PARSER} make
  23.          
  24. feature 
  25.    
  26.    index: STRING;
  27.    
  28. feature {NONE}
  29.    
  30.    list: ARRAY[EXPRESSION];
  31.    
  32. feature {NONE}
  33.    
  34.    make(i: like index) is
  35.       require
  36.      i /= Void;
  37.       do
  38.      index := i;
  39.       ensure
  40.      index = i;
  41.       end;
  42.  
  43. feature
  44.    
  45.    isa_index_value(value: EXPRESSION): BOOLEAN is
  46.       local
  47.      sfn: SIMPLE_FEATURE_NAME;
  48.      ms: MANIFEST_STRING;
  49.      btc: BASE_TYPE_CONSTANT;
  50.       do
  51.      sfn ?= value;
  52.      ms ?= value;
  53.      btc ?= value;
  54.      Result := (sfn/= Void) or else (ms /= Void) or else (btc /= Void);
  55.       end;
  56.  
  57.    pretty_print is
  58.       local
  59.      i: INTEGER;
  60.       do
  61.      if index /= void then
  62.         fmt.put_string(index);
  63.         fmt.put_string(": ");
  64.      end;
  65.      if list /= Void then
  66.         fmt.level_incr;
  67.         from  
  68.            i := list.lower;
  69.         until
  70.            i > list.upper
  71.         loop
  72.            list.item(i).pretty_print;
  73.            i := i + 1;
  74.            if i <= list.upper then
  75.           fmt.put_string(", ");
  76.            end;
  77.         end;
  78.         fmt.level_decr;
  79.      end;
  80.       end;
  81.    
  82. feature {EIFFEL_PARSER}   
  83.    
  84.    add_index_value(value: EXPRESSION) is
  85.       require
  86.      isa_index_value(value);
  87.       do
  88.      if list = Void then
  89.         list := <<value>>;
  90.      else
  91.         list.add_last(value);
  92.      end;
  93.       end;
  94.    
  95. invariant
  96.    
  97.    index /= Void;
  98.    
  99. end -- INDEX_CLAUSE
  100.  
  101.