


-------------------------------------------------
--                                             -- 
--       Scanner generated by Coco/R           --
--                                             -- 
-- (assuming FileIO library will be available) --
-------------------------------------------------

with FileIO;

package CRS is


   subtype INT32     is FileIO.INT32;
   subtype CARDINAL  is FileIO.CARDINAL;


   Source   : aliased FileIO.File;  -- source/list files. To be opened by the main pgm
   Listing  : aliased FileIO.File;

   directory :  String (1 .. 256);   -- of source file

   line     :  Integer;    -- line and column of current symbol
   col      :  Integer;

   len      :  CARDINAL;   -- length of current symbol
   pos      :  INT32;      -- file position of current symbol
   nextLine :  Integer;    -- line of lookahead symbol
   nextCol  :  Integer;    -- column of lookahead symbol
   nextLen  :  CARDINAL;   -- length of lookahead symbol
   nextPos  :  INT32;      -- file position of lookahead symbol
   errors   :  Integer;    -- number of detected errors


   type Error_Procedure is access
      procedure
        (nr    : in     Integer;
         line  : in     Integer;
         col   : in     Integer;
         pos   : in     INT32);

   Error    : Error_Procedure;



   --
   -- Gets next symbol from source file 
   --
   procedure Get (sym:    out CARDINAL);

   --
   -- Retrieves exact The_String of max The_Length from The_Position in source file
   --
   procedure Get_String
     (The_Position   : in     INT32;
      The_Length     : in     CARDINAL;
      The_String     :    out FileIO.String_Ptr);

   --
   -- Retrieves The_Name of symbol of The_Length at The_Position in source file
   --
   procedure Get_Name
     (The_Position   : in     INT32;
      The_Length     : in     CARDINAL;
      The_Name       :    out FileIO.String_Ptr);

   --
   -- Returns exact character at position pos in source file 
   --
   function Char_At (The_Position: in     INT32) return Character;

   --
   -- Reads and stores source file internally 
   --
   procedure Reset;

end CRS;





