summaryrefslogtreecommitdiff
path: root/src/csv.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/csv.adb')
-rw-r--r--src/csv.adb11
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;