Natools

Diff
Login

Differences From Artifact [3aa2c30191]:

To Artifact [7fddb024b2]:


287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
                        when Encodings.Digit_0 .. Encodings.Digit_0 + 3
                          | Character'Pos ('x')
                          | Encodings.CR | Encodings.LF =>
                           P.Internal.Escape.Data (1) := O;
                           P.Internal.Escape.Length := 2;

                        when others =>
                           P.Buffer.Append
                             ((1 => P.Internal.Escape.Data (0), 2 => O));
                           P.Internal.Escape.Length := 0;
                     end case;

                  when 2 =>
                     if (P.Internal.Escape.Data (1) in Encodings.Digit_0
                                                    .. Encodings.Digit_0 + 3
                         and O in Encodings.Digit_0 .. Encodings.Digit_0 + 7)
                       or (P.Internal.Escape.Data (1) = Character'Pos ('x')
                           and then Encodings.Is_Hex_Digit (O))
                     then
                        P.Internal.Escape.Data (2) := O;
                        P.Internal.Escape.Length := 3;

                     elsif P.Internal.Escape.Data (1) = Encodings.CR
                       or P.Internal.Escape.Data (1) = Encodings.LF
                     then
                        P.Internal.Escape.Length := 0;
                        if not ((O = Encodings.CR or O = Encodings.LF)
                                and O /= P.Internal.Escape.Data (1))
                        then
                           P.Buffer.Append (O);
                        end if;

                     else
                        P.Buffer.Append
                          ((P.Internal.Escape.Data (0),
                            P.Internal.Escape.Data (1),
                            O));
                        P.Internal.Escape.Length := 0;
                     end if;

                  when 3 =>
                     if P.Internal.Escape.Data (1) = Character'Pos ('x') then
                        if Encodings.Is_Hex_Digit (O) then
                           P.Buffer.Append
                             (Encodings.Decode_Hex (P.Internal.Escape.Data (2),
                                                    O));
                        else
                           P.Buffer.Append
                             ((P.Internal.Escape.Data (0),
                               P.Internal.Escape.Data (1),
                               P.Internal.Escape.Data (2),
                               O));
                        end if;
                     else
                        pragma Assert (P.Internal.Escape.Data (1)
                          in Encodings.Digit_0 .. Encodings.Digit_0 + 3);
                        if O in Encodings.Digit_0 .. Encodings.Digit_0 + 7 then
                           Atom_Buffers.Append
                             (P.Buffer,
                              (P.Internal.Escape.Data (1) - Encodings.Digit_0)
                               * 2**6 +
                              (P.Internal.Escape.Data (2) - Encodings.Digit_0)
                               * 2**3 +
                              (O - Encodings.Digit_0));
                        else
                           P.Buffer.Append
                             ((P.Internal.Escape.Data (0),
                               P.Internal.Escape.Data (1),
                               P.Internal.Escape.Data (2),
                               O));
                        end if;
                     end if;
                     P.Internal.Escape.Length := 0;

                  when 4 =>
                     raise Program_Error;
               end case;







|
|




















|





|
|













|
|
















|
|







287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
                        when Encodings.Digit_0 .. Encodings.Digit_0 + 3
                          | Character'Pos ('x')
                          | Encodings.CR | Encodings.LF =>
                           P.Internal.Escape.Data (1) := O;
                           P.Internal.Escape.Length := 2;

                        when others =>
                           P.Buffer.Append (P.Internal.Escape.Data (0));
                           P.Override.Append (O);
                           P.Internal.Escape.Length := 0;
                     end case;

                  when 2 =>
                     if (P.Internal.Escape.Data (1) in Encodings.Digit_0
                                                    .. Encodings.Digit_0 + 3
                         and O in Encodings.Digit_0 .. Encodings.Digit_0 + 7)
                       or (P.Internal.Escape.Data (1) = Character'Pos ('x')
                           and then Encodings.Is_Hex_Digit (O))
                     then
                        P.Internal.Escape.Data (2) := O;
                        P.Internal.Escape.Length := 3;

                     elsif P.Internal.Escape.Data (1) = Encodings.CR
                       or P.Internal.Escape.Data (1) = Encodings.LF
                     then
                        P.Internal.Escape.Length := 0;
                        if not ((O = Encodings.CR or O = Encodings.LF)
                                and O /= P.Internal.Escape.Data (1))
                        then
                           P.Override.Append (O);
                        end if;

                     else
                        P.Buffer.Append
                          ((P.Internal.Escape.Data (0),
                            P.Internal.Escape.Data (1)));
                        P.Override.Append (O);
                        P.Internal.Escape.Length := 0;
                     end if;

                  when 3 =>
                     if P.Internal.Escape.Data (1) = Character'Pos ('x') then
                        if Encodings.Is_Hex_Digit (O) then
                           P.Buffer.Append
                             (Encodings.Decode_Hex (P.Internal.Escape.Data (2),
                                                    O));
                        else
                           P.Buffer.Append
                             ((P.Internal.Escape.Data (0),
                               P.Internal.Escape.Data (1),
                               P.Internal.Escape.Data (2)));
                           P.Override.Append (O);
                        end if;
                     else
                        pragma Assert (P.Internal.Escape.Data (1)
                          in Encodings.Digit_0 .. Encodings.Digit_0 + 3);
                        if O in Encodings.Digit_0 .. Encodings.Digit_0 + 7 then
                           Atom_Buffers.Append
                             (P.Buffer,
                              (P.Internal.Escape.Data (1) - Encodings.Digit_0)
                               * 2**6 +
                              (P.Internal.Escape.Data (2) - Encodings.Digit_0)
                               * 2**3 +
                              (O - Encodings.Digit_0));
                        else
                           P.Buffer.Append
                             ((P.Internal.Escape.Data (0),
                               P.Internal.Escape.Data (1),
                               P.Internal.Escape.Data (2)));
                           P.Override.Append (O);
                        end if;
                     end if;
                     P.Internal.Escape.Length := 0;

                  when 4 =>
                     raise Program_Error;
               end case;