home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #4 / amigaacscoverdisc1998-041998.iso / utilities / shareware / dev / ppcsmalleiffel / lib_se / feature_name.e < prev    next >
Encoding:
Text File  |  1998-01-16  |  3.0 KB  |  137 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. deferred class FEATURE_NAME
  17. --   
  18. -- Root of INFIX_NAME, PREFIX_NAME and SIMPLE_NAME.
  19. --
  20.  
  21. inherit NAME;
  22.    
  23. feature 
  24.    
  25.    start_position: POSITION;
  26.    
  27.    is_frozen: BOOLEAN;
  28.    
  29. feature {FEATURE_NAME}
  30.  
  31.    make(n: STRING; sp: like start_position) is
  32.       require
  33.      n.count >= 1;
  34.      sp /= Void
  35.       deferred
  36.       ensure
  37.      to_string = unique_string.item(n);
  38.      start_position = sp;
  39.      to_key = unique_string.item(to_key)
  40.       end;
  41.  
  42. feature
  43.  
  44.    origin_base_class: BASE_CLASS is
  45.      -- Void or the BASE_CLASS where Current is written in.
  46.       local
  47.      sp: like start_position;
  48.       do
  49.      sp := start_position;
  50.      if sp /= Void then
  51.         Result := sp.base_class;
  52.      end;
  53.       end;
  54.  
  55. feature 
  56.  
  57.    mapping_c_in(str: STRING) is
  58.       do
  59.      str.append(to_key);
  60.       end;
  61.  
  62. feature 
  63.    
  64.    cpp_put_infix_or_prefix is
  65.       deferred
  66.       end;
  67.  
  68.    name_in(sc: BASE_CLASS): FEATURE_NAME is
  69.      --                 ************
  70.      -- ***             like Current
  71.      --                 ************
  72.      -- Using the `start_position', compute possible renaming
  73.      -- when starting look_up from `sc'.
  74.       require
  75.      origin_base_class = sc or else 
  76.      sc.is_subclass_of(origin_base_class)
  77.       local
  78.      bc: BASE_CLASS;
  79.       do
  80.      bc := origin_base_class
  81.      if bc = sc then
  82.         Result := Current;
  83.      else
  84.         Result := sc.new_name_of(bc,Current);
  85.      end;
  86.       ensure
  87.      Result /= Void
  88.       end;
  89.    
  90.    is_freeop: BOOLEAN is
  91.       do
  92.      inspect 
  93.         to_string @ 1
  94.      when '@', '#', '|', '&' then
  95.         Result := true;
  96.      else
  97.      end;
  98.       end;
  99.  
  100. feature -- For pretty :   
  101.  
  102.    definition_pretty_print is
  103.       deferred
  104.       end;
  105.  
  106. feature
  107.  
  108.    short is
  109.       deferred
  110.       end;
  111.  
  112. feature {EIFFEL_PARSER}
  113.    
  114.    set_is_frozen(value: BOOLEAN) is
  115.       do
  116.      is_frozen := value;
  117.       ensure
  118.      is_frozen = value;
  119.       end;
  120.  
  121. feature {E_FEATURE}
  122.  
  123.    undefine_in(bc: BASE_CLASS) is
  124.       require
  125.      bc /= Void
  126.       do
  127.      if is_frozen then
  128.         error(start_position,
  129.           "A frozen feature must not be undefined (VDUS).");
  130.         bc.fatal_undefine(Current);
  131.      end;
  132.       end;
  133.  
  134. end -- FEATURE_NAME
  135.  
  136.  
  137.