Natools

Check-in [14fcb09484]
Login
Overview
Comment:s_expressions: new primitive to update a descriptor until end of list
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 14fcb0948448fcec2e2d571e34ac109778bd2786
User & Date: nat on 2016-09-03 21:36:02
Other Links: manifest | tags
Context
2016-09-04
20:27
smaz-tools: new package with tools to help with Smaz dictionaries check-in: a168e51311 user: nat tags: trunk
2016-09-03
21:36
s_expressions: new primitive to update a descriptor until end of list check-in: 14fcb09484 user: nat tags: trunk
2016-09-02
20:48
smaz: new package providing a simple compressor for small strings check-in: d98a8c25da user: nat tags: trunk
Changes

Modified src/natools-s_expressions.adb from [cff366157d] to [7b55adc7b9].

46
47
48
49
50
51
52





























53
   procedure Next (Object : in out Descriptor'Class) is
      Discarded : Events.Event;
      pragma Unreferenced (Discarded);
   begin
      Next (Object, Discarded);
   end Next;






























end Natools.S_Expressions;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
   procedure Next (Object : in out Descriptor'Class) is
      Discarded : Events.Event;
      pragma Unreferenced (Discarded);
   begin
      Next (Object, Discarded);
   end Next;


   procedure Close_Current_List (Object : in out Descriptor'Class) is
      Level : Natural := 0;
      Event : Events.Event := Object.Current_Event;
   begin
      if Object.Current_Event in Events.Error | Events.End_Of_Input then
         return;
      end if;

      loop
         Object.Next (Event);

         case Event is
            when Events.Error | Events.End_Of_Input =>
               exit;

            when Events.Open_List =>
               Level := Level + 1;

            when Events.Close_List =>
               exit when Level = 0;
               Level := Level - 1;

            when Events.Add_Atom =>
               null;
         end case;
      end loop;
   end Close_Current_List;

end Natools.S_Expressions;

Modified src/natools-s_expressions.ads from [44bdbebcd7] to [7d5a33af66].

111
112
113
114
115
116
117







118
119
120
121
122
123
124
125
126
   procedure Next
     (Object : in out Descriptor;
      Event : out Events.Event) is abstract;
      --  Update Object to reflect the next event in the S-expression

   procedure Next (Object : in out Descriptor'Class);
      --  Call Next discarding current event








private

   use type Ada.Streams.Stream_Element;
   use type Ada.Streams.Stream_Element_Offset;
   use type Ada.Streams.Stream_Element_Array;
   use type Events.Event;

end Natools.S_Expressions;







>
>
>
>
>
>
>









111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
   procedure Next
     (Object : in out Descriptor;
      Event : out Events.Event) is abstract;
      --  Update Object to reflect the next event in the S-expression

   procedure Next (Object : in out Descriptor'Class);
      --  Call Next discarding current event

   procedure Close_Current_List (Object : in out Descriptor'Class);
      --  Repeatedly call Next until reaching end-of-input or the Close_List
      --  event matching the current list.
      --  Note: if current event is Open_List, then this is the designated list
      --  while for other events, including Close_List, the designated list
      --  contains the current object or the just-closed list.

private

   use type Ada.Streams.Stream_Element;
   use type Ada.Streams.Stream_Element_Offset;
   use type Ada.Streams.Stream_Element_Array;
   use type Events.Event;

end Natools.S_Expressions;