home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #4 / amigaacscoverdisc1998-041998.iso / utilities / shareware / dev / ppcsmalleiffel / lib_se / call_prefix.e < prev    next >
Encoding:
Text File  |  1998-01-16  |  2.4 KB  |  96 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 CALL_PREFIX
  17. --   
  18. -- For all sort of prefix operators.
  19. -- Root of all CALL_PREFIX_*.
  20. --   
  21.  
  22. inherit
  23.    CALL_0
  24.       rename make as make_call0
  25.       undefine precedence
  26.       redefine precedence, feature_name, print_as_target
  27.       end;
  28.    
  29. feature {ANY}
  30.    
  31.    feature_name: PREFIX_NAME;
  32.    
  33.    operator: STRING is
  34.       deferred
  35.       end;
  36.    
  37.    precedence: INTEGER is
  38.       deferred
  39.       end;
  40.    
  41.    make(operator_position: POSITION; rp: like target) is
  42.       do
  43.      !!feature_name.make(operator,operator_position);
  44.      make_call0(rp,feature_name);
  45.       end;
  46.  
  47.    is_pre_computable: BOOLEAN is false;
  48.    
  49.    frozen bracketed_pretty_print is
  50.       do
  51.      fmt.put_character('(');
  52.      pretty_print;
  53.      fmt.put_character(')');
  54.       end;
  55.  
  56.    frozen pretty_print is
  57.       do
  58.      feature_name.pretty_print;
  59.      fmt.put_character(' ');
  60.      if target.precedence < precedence then
  61.         fmt.put_character('(');
  62.         target.pretty_print;
  63.         fmt.put_character(')');
  64.      else
  65.         target.pretty_print;
  66.      end;
  67.       end;
  68.    
  69.    print_as_target is
  70.       do
  71.      fmt.put_character('(');
  72.      pretty_print;
  73.      fmt.put_character(')');
  74.      fmt.put_character('.');
  75.       end;
  76.  
  77.    frozen short is
  78.       do
  79.      short_print.a_prefix_name(feature_name);
  80.      if target.precedence < precedence then
  81.         target.bracketed_short;
  82.      else
  83.         target.short;
  84.      end;
  85.       end;
  86.    
  87.    frozen short_target is
  88.       do
  89.      bracketed_short;
  90.      short_print.a_dot;
  91.       end;
  92.  
  93. end -- CALL_PREFIX
  94.  
  95.  
  96.