-- file : scantest.adb -- Test driver for the package Scanner. -- to compile: "gnatmake scantest" -- to execute: "scantest" "scantest " with Ada.Command_Line; with Ada.Text_IO; use Ada.Text_IO; with Scanner; procedure ScanTest is Input : File_Type; begin if Ada.Command_Line.Argument_Count = 1 then begin Open (Input, In_File, Ada.Command_Line.Argument (1)); Set_Input (Input); exception when others => Put_Line ("scanner: unable to open file " & Ada.Command_Line.Argument (1)); return; end; elsif Ada.Command_Line.Argument_Count /= 0 then Put_Line ("scanner: too many arguments"); end if; loop Scanner.Get_Next_Token; Put_Line ("token: " & Scanner.Image (Scanner.Current_Token)); end loop; exception when End_Error => null; end ScanTest;