Natools

Check-in [179da1f3db]
Login
Overview
Comment:s_expressions-interpreters: add a String-based command addition, since it's the overwhelmingly most common use case
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 179da1f3db9a7619e2d34d44ab2b4b7ca3c1ece3
User & Date: nat on 2014-05-11 20:04:28
Other Links: manifest | tags
Context
2014-05-12
17:22
s_expressions-interpreter_tests: use the new Add procedure, to keep complete coverage check-in: db048daa0f user: nat tags: trunk
2014-05-11
20:04
s_expressions-interpreters: add a String-based command addition, since it's the overwhelmingly most common use case check-in: 179da1f3db user: nat tags: trunk
2014-05-10
20:43
s_expressions-atom_refs: new package for atom references, taken out from Atom_Buffers check-in: 4627abed57 user: nat tags: trunk
Changes

Modified src/natools-s_expressions-interpreters.adb from [d5c37017fd] to [25b368150e].

25
26
27
28
29
30
31









32
33
34
35
36
37
38
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47







+
+
+
+
+
+
+
+
+







      Name : in Atom;
      Cmd : in Command'Class) is
   begin
      Self.Commands.Insert (Name, Cmd);
      Self.Max_Length := Count'Max (Self.Max_Length, Name'Length);
   end Add_Command;


   procedure Add
     (Self : in out Interpreter;
      Name : in String;
      Cmd : in Command'Class) is
   begin
      Self.Add_Command (To_Atom (Name), Cmd);
   end Add;


   function Has_Command (Self : Interpreter; Name : Atom) return Boolean is
   begin
      return Self.Commands.Contains (Name);
   end Has_Command;


Modified src/natools-s_expressions-interpreters.ads from [4923890aab] to [4e8e3fffbf].

67
68
69
70
71
72
73





74
75
76
77
78
79
80
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85







+
+
+
+
+







   type Interpreter is new Command with private;

   procedure Add_Command
     (Self : in out Interpreter;
      Name : in Atom;
      Cmd : in Command'Class);

   procedure Add
     (Self : in out Interpreter;
      Name : in String;
      Cmd : in Command'Class);

   function Has_Command (Self : Interpreter; Name : Atom) return Boolean;

   function Is_Empty (Self : Interpreter) return Boolean;

   procedure Set_Fallback
     (Self : in out Interpreter;
      Name : in Atom);