diff options
author | Jed Barber <jjbarber@y7mail.com> | 2017-02-10 18:41:36 +1100 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2017-02-10 18:41:36 +1100 |
commit | 60b2207a469a5a1e7a7e5619a8eb1b01c67f314a (patch) | |
tree | c928299d78242f2b36798e8c1802914552626352 /src/csv.adb | |
parent | 964a28e91593c4bf1e1c132536828d87f8d12c84 (diff) |
Preference data reads into Bundles properly, with packed memory and a few fixed bugs
Diffstat (limited to 'src/csv.adb')
-rw-r--r-- | src/csv.adb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/csv.adb b/src/csv.adb index 1b8fd7f..6bc5880 100644 --- a/src/csv.adb +++ b/src/csv.adb @@ -22,10 +22,11 @@ package body CSV is then Result := SU.To_Unbounded_String (0); This_In := SU.Tail (Input, SU.Length (Input) - 1); - while SU.Length (This_In) > 0 loop + while SU.Length (This_In) > 0 and then + SU.Element (This_In, 1) /= Quote + loop SU.Append (Result, SU.Head (This_In, 1)); This_In := SU.Tail (This_In, SU.Length (This_In) - 1); - exit when SU.Length (This_In) > 0 and then SU.Element (This_In, 1) = Quote; end loop; Output := Result; if SU.Length (This_In) > 0 then @@ -111,14 +112,12 @@ package body CSV is function Separator (Input : in SU.Unbounded_String; - Output : out SU.Unbounded_String; Remaining : out SU.Unbounded_String) return Boolean is begin if SU.Length (Input) > 0 and then SU.Element (Input, 1) = Delimiter then - Output := SU.Head (Input, 1); Remaining := SU.Tail (Input, SU.Length (Input) - 1); return True; else @@ -140,9 +139,7 @@ package body CSV is loop Field (This_In, This_Out, This_Remaining); Result.Append (This_Out); - This_In := This_Remaining; - exit when not Separator (This_In, This_Out, This_Remaining); - This_In := This_Remaining; + exit when not Separator (This_Remaining, This_In); end loop; return Result; end Parse_Line; |