-- file : scantest2.adb -- Test driver for the package Scanner2. -- to compile: "gnatmake scantest2" -- to execute: "scantest2" or "scantest2 " with Ada.Command_Line; with Ada.Text_IO; use Ada.Text_IO; with Scanner2; procedure ScanTest2 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 Scanner2.Get_Next_Token; Put_Line ("token: " & Scanner2.Image); end loop; exception when End_Error => null; end ScanTest2;