ANY NONE NUMBER_TOOLS
expanded class interface NUMBER_TOOLS
   --
   -- This class provides abstract creation functions for NUMBERs as well as 
   -- some other useful tools for NUMBERs.
   --
   -- Because this class is expanded, one may simply declare some entity of 
   -- type NUMBER_TOOLS to use those NUMBER tools. One may also inherit this 
   -- class in order to use those tools as well.
   --

feature(s) from NUMBER_TOOLS
   from_integer (n: INTEGER): NUMBER
      -- Uses value n to create a new NUMBER.
      ensure
         Result.to_integer = n

   from_string (formula: STRING): NUMBER
      -- Parse the contents of formula to create a new NUMBER. If some 
      -- error occurs (like for example a division by zero), the Result 
      -- is Void and the error report is left in the parser_buffer. 
      require
         is_number(formula)
      ensure
         Result /= Void xor parser_buffer.last_error /= Void

   from_input_stream (input: INPUT_STREAM): NUMBER
      -- Create a number from a file or standard input
      require
         input.is_connected
      ensure
         Result /= Void xor parser_buffer.last_error /= Void

   is_number (formula: STRING): BOOLEAN
      -- Is the formula a correct notation to create a NUMBER ?
      -- Actually, any correct formula using a combination of litteral 
      -- integer constants with + - * / () and ! is a correct notation to 
      -- create a NUMBER. Traditional priority rules are used for 
      -- operators and the ! character denote the factorial computation.
      -- Here is the BNF grammar used:
      --
      --  E0 = E1 R1
      --  E1 = E2 R2
      --  E2 = E3 R3
      --  E3 = "+" E3 | "-" E3 | "(" E0 ")" | "constant"
      --  R1 = "+" E1 R1 | "-" E1 R1 | ^
      --  R2 = "*" E2 R2 | "/" E2 R2 | ^
      --  R3 = "!" | ^
      require
         not formula.is_empty
      ensure
         Result xor parser_buffer.last_error /= Void

   parser_buffer: MINI_PARSER_BUFFER
      -- This once function gives access to the unique parser_buffer to 
      -- allow the memorization of the Current position and the 
      -- memorization of the last error message.

feature(s) from NUMBER_TOOLS
   Base: INTEGER
      -- The Base is the grater number which is like 10^x and
      -- which is inferior to the Maximu_integer value.
      --
      -- So if Maximum_number is 2147483647 :
      -- The Base is :           1000000000.
      -- A number has a value between 0-9 so a number in a
      -- item of a FIXED_ARRAY[INTEGER] must be a succession
      -- of 9 so the value of the greater item is 999999999.
      -- And the Base is the greater value of a item + 1.



end of expanded NUMBER_TOOLS