Natools

Check-in [edac345527]
Login
Overview
Comment:s_expressions-parsers: fix parsing of nested subexpressions
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: edac34552735a7ff4be08d6d0baf290d493447ce
User & Date: nat on 2014-01-21 20:16:26
Other Links: manifest | tags
Context
2014-01-22
22:26
s_expressions-parsers-tests: new test for Parser direct interface check-in: ba3f2acfaa user: nat tags: trunk
2014-01-21
20:16
s_expressions-parsers: fix parsing of nested subexpressions check-in: edac345527 user: nat tags: trunk
2014-01-20
19:48
s_expressions-atom_buffers-tests: add tests for the new octet stack interface check-in: 71a9406a61 user: nat tags: trunk
Changes

Modified src/natools-s_expressions-parsers.adb from [7fddb024b2] to [a9ae89461f].

94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
               when others => null;
            end case;
            exit;
         end if;

         --  Read a single octet from source

         if P.Override_Pos < P.Override.Length then
            P.Override_Pos := P.Override_Pos + 1;
            O := P.Override.Element (P.Override_Pos);

            if P.Override_Pos >= P.Override.Length then
               P.Override.Hard_Reset;
               P.Override_Pos := 0;
            end if;
         else
            Input.Read (Item, Last);
            if Last not in Item'Range then
               P.Latest := Events.End_Of_Input;
               exit;
            end if;
            O := Item (Last);







|
<
<
<
<
|
<
<







94
95
96
97
98
99
100
101




102


103
104
105
106
107
108
109
               when others => null;
            end case;
            exit;
         end if;

         --  Read a single octet from source

         if P.Override.Length > 0 then




            P.Override.Pop (O);


         else
            Input.Read (Item, Last);
            if Last not in Item'Range then
               P.Latest := Events.End_Of_Input;
               exit;
            end if;
            O := Item (Last);
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
               then
                  P.Buffer.Append
                    (Encodings.Decode_Base64 (P.Internal.Chunk.Data
                                          (0 .. P.Internal.Chunk.Length - 1)));
                  if P.Internal.State = Base64_Atom then
                     P.Latest := Events.Add_Atom;
                  else
                     P.Override.Append (P.Buffer.Data);
                     P.Buffer.Soft_Reset;
                  end if;
                  P.Internal := (State => Waiting);
               end if;

            when Hex_Atom =>
               if Encodings.Is_Hex_Digit (O) then







|







163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
               then
                  P.Buffer.Append
                    (Encodings.Decode_Base64 (P.Internal.Chunk.Data
                                          (0 .. P.Internal.Chunk.Length - 1)));
                  if P.Internal.State = Base64_Atom then
                     P.Latest := Events.Add_Atom;
                  else
                     P.Override.Append_Reverse (P.Buffer.Data);
                     P.Buffer.Soft_Reset;
                  end if;
                  P.Internal := (State => Waiting);
               end if;

            when Hex_Atom =>
               if Encodings.Is_Hex_Digit (O) then

Modified src/natools-s_expressions-parsers.ads from [089b8c8cea] to [90e8bf6ef8].

108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
      end case;
   end record;

   type Parser is tagged record
      Internal     : State_Data;
      Pending      : Events.Event := Events.End_Of_Input;
      Override     : Atom_Buffers.Atom_Buffer;
      Override_Pos : Count := 0;
      Latest       : Events.Event := Events.Error;
      Buffer       : Atom_Buffers.Atom_Buffer;
      Level        : Natural := 0;
   end record;

   type Subparser
     (Backend : access Parser;







<







108
109
110
111
112
113
114

115
116
117
118
119
120
121
      end case;
   end record;

   type Parser is tagged record
      Internal     : State_Data;
      Pending      : Events.Event := Events.End_Of_Input;
      Override     : Atom_Buffers.Atom_Buffer;

      Latest       : Events.Event := Events.Error;
      Buffer       : Atom_Buffers.Atom_Buffer;
      Level        : Natural := 0;
   end record;

   type Subparser
     (Backend : access Parser;