File: sdc.adb

package info (click to toggle)
gnat-gps 4.3-5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 49,096 kB
  • ctags: 20,461
  • sloc: ada: 274,120; ansic: 154,849; python: 9,890; tcl: 9,812; sh: 8,192; xml: 7,970; cpp: 4,737; yacc: 3,520; makefile: 2,136; lex: 2,043; java: 1,638; perl: 302; awk: 265; sed: 161; asm: 14; fortran: 2; lisp: 1
file content (50 lines) | stat: -rw-r--r-- 1,054 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
with Except;
with Screen_Output; use Screen_Output;
with Stack;
with Tokens; use Tokens;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Command_Line; use Ada.Command_Line;

procedure Sdc is
   File : File_Type;
begin
   Msg ("Welcome to sdc. Go ahead type your commands ...");

   if Argument_Count = 1 then
      begin
         Open (File, In_File, Argument (1));
      exception
         when Use_Error | Name_Error =>
            Error_Msg ("Could not open input file, exiting.");
            return;
      end;

      Set_Input (File);
   end if;

   loop
      --  Open a block to catch Stack Overflow and Underflow exceptions.

     begin

        Process (Next);
        --  Read the next Token from the input and process it.

     exception
        when Stack.Underflow =>
           Error_Msg ("Not enough values in the Stack.");

        when Stack.Overflow =>
          null;
     end;

   end loop;

exception
   when Except.Exit_SDC =>
      Msg ("Thank you for using sdc.");

   when others =>
      Msg ("*** Internal Error ***.");

end Sdc;