Natools

Check-in [e4eacf664f]
Login
Overview
Comment:s_expressions-printers-pretty: fix unwanted escape of the second byte of two-byte newlines
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e4eacf664f731f8ba246594fb1570b8d46b36eaa
User & Date: nat on 2014-01-31 10:40:08
Other Links: manifest | tags
Context
2014-02-01
13:27
s_expressions-printers-pretty: fix width overflow in quoted string escapes check-in: da55fecd97 user: nat tags: trunk
2014-01-31
10:40
s_expressions-printers-pretty: fix unwanted escape of the second byte of two-byte newlines check-in: e4eacf664f user: nat tags: trunk
2014-01-30
20:53
s_expressions-printers-pretty-tests: new test for quoted string escape sequences check-in: e499a522b3 user: nat tags: trunk
Changes

Modified src/natools-s_expressions-printers-pretty.adb from [c7513de8cf] to [978118703a].

345
346
347
348
349
350
351


352




353
354
355
356
357
358
359
               if Single_Line
                 or else I > Last_Non_NL
                 or else not Is_Newline (Data, I, Newline)
               then
                  Size := Size + 2;
                  Cursor := Cursor + 2;
               else


                  Size := Size + 1;




                  Cursor := 1;
               end if;
            when 0 .. 7 | 14 .. 31 =>
               Size := Size + 4;
               Cursor := Cursor + 4;
            when 16#80# .. 16#FF# =>
               case Encoding is







>
>
|
>
>
>
>







345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
               if Single_Line
                 or else I > Last_Non_NL
                 or else not Is_Newline (Data, I, Newline)
               then
                  Size := Size + 2;
                  Cursor := Cursor + 2;
               else
                  case Newline is
                     when LF | CR =>
                        Size := Size + 1;
                     when CR_LF | LF_CR =>
                        Size := Size + 2;
                        I := I + 1;
                  end case;
                  Cursor := 1;
               end if;
            when 0 .. 7 | 14 .. 31 =>
               Size := Size + 4;
               Cursor := Cursor + 4;
            when 16#80# .. 16#FF# =>
               case Encoding is
626
627
628
629
630
631
632







633
634
635
636
637
638
639
                     Result (O + 1) := Character'Pos ('n');
                     O := O + 2;
                     Output.Cursor := Output.Cursor + 2;
                  else
                     Result (O) := Data (I);
                     O := O + 1;
                     Output.Cursor := 1;







                  end if;
               when 11 =>
                  Result (O) := Encodings.Escape;
                  Result (O + 1) := Character'Pos ('v');
                  O := O + 2;
                  Output.Cursor := Output.Cursor + 2;
               when 12 =>







>
>
>
>
>
>
>







632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
                     Result (O + 1) := Character'Pos ('n');
                     O := O + 2;
                     Output.Cursor := Output.Cursor + 2;
                  else
                     Result (O) := Data (I);
                     O := O + 1;
                     Output.Cursor := 1;
                     if Output.Param.Newline = CR_LF
                       or Output.Param.Newline = LF_CR
                     then
                        I := I + 1;
                        Result (O) := Data (I);
                        O := O + 1;
                     end if;
                  end if;
               when 11 =>
                  Result (O) := Encodings.Escape;
                  Result (O + 1) := Character'Pos ('v');
                  O := O + 2;
                  Output.Cursor := Output.Cursor + 2;
               when 12 =>
650
651
652
653
654
655
656







657
658
659
660
661
662
663
                     Result (O + 1) := Character'Pos ('r');
                     O := O + 2;
                     Output.Cursor := Output.Cursor + 2;
                  else
                     Result (O) := Data (I);
                     O := O + 1;
                     Output.Cursor := 1;







                  end if;
               when Encodings.Quoted_Atom_End | Encodings.Escape =>
                  Result (O) := Encodings.Escape;
                  Result (O + 1) := Data (I);
                  O := O + 2;
                  Output.Cursor := Output.Cursor + 2;
               when 0 .. 7 | 14 .. 31 =>







>
>
>
>
>
>
>







663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
                     Result (O + 1) := Character'Pos ('r');
                     O := O + 2;
                     Output.Cursor := Output.Cursor + 2;
                  else
                     Result (O) := Data (I);
                     O := O + 1;
                     Output.Cursor := 1;
                     if Output.Param.Newline = CR_LF
                       or Output.Param.Newline = LF_CR
                     then
                        I := I + 1;
                        Result (O) := Data (I);
                        O := O + 1;
                     end if;
                  end if;
               when Encodings.Quoted_Atom_End | Encodings.Escape =>
                  Result (O) := Encodings.Escape;
                  Result (O + 1) := Data (I);
                  O := O + 2;
                  Output.Cursor := Output.Cursor + 2;
               when 0 .. 7 | 14 .. 31 =>