summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2020-11-14 00:30:36 +1100
committerJed Barber <jjbarber@y7mail.com>2020-11-14 00:30:36 +1100
commitf8869a5efae197a77b238576a6863a3e1459399d (patch)
treeaf26e9286c3d7dc006f0995f7daa52d376769828 /src
parent4c7395f7e2aae8e134b783aa98c82b1cece8bea7 (diff)
Removed label cutoff from Parse_Graph debug strings
Diffstat (limited to 'src')
-rw-r--r--src/packrat-parse_graphs.adb31
-rw-r--r--src/packrat-parse_graphs.ads3
2 files changed, 10 insertions, 24 deletions
diff --git a/src/packrat-parse_graphs.adb b/src/packrat-parse_graphs.adb
index c743163..c44500f 100644
--- a/src/packrat-parse_graphs.adb
+++ b/src/packrat-parse_graphs.adb
@@ -211,8 +211,7 @@ package body Packrat.Parse_Graphs is
function Debug_String
- (Container : in Parse_Graph;
- Cutoff : in Positive := 4)
+ (Container : in Parse_Graph)
return String
is
function Generate_Map
@@ -233,19 +232,6 @@ package body Packrat.Parse_Graphs is
end Generate_Map;
function Image
- (Input : in Traits.Label_Enum)
- return String
- is
- Raw : String := Traits.Label_Enum'Image (Input);
- begin
- if Raw'Length <= Cutoff then
- return Raw;
- else
- return Ada.Strings.Fixed.Head (Raw, Cutoff);
- end if;
- end Image;
-
- function Image
(Input : in Integer)
return String is
begin
@@ -257,10 +243,10 @@ package body Packrat.Parse_Graphs is
Result : SU.Unbounded_String;
begin
for Iter in Mapping.Iterate loop
- SU.Append (Result, Image (Enum_Node_Maps.Key (Iter)) & Latin.HT);
+ SU.Append (Result, Traits.Label_Enum'Image (Enum_Node_Maps.Key (Iter)) & Latin.LF);
for Node of Enum_Node_Maps.Element (Iter) loop
Current := Container.Internal_Graph.Label (Node);
- SU.Append (Result, Image (Traits.Tokens.Start (Current)) & " ->" & Latin.HT);
+ SU.Append (Result, " " & Image (Traits.Tokens.Start (Current)) & " ->" & Latin.HT);
for Fin of In_Finishes (Container, Node) loop
SU.Append (Result, Image (Fin) & " ->" & Latin.HT);
declare
@@ -268,18 +254,19 @@ package body Packrat.Parse_Graphs is
begin
if Groupings'Length = 0 then
SU.Append (Result, "Leaf" & Latin.LF);
- SU.Append (Result, SU."*" (3, Latin.HT));
+ SU.Append (Result, SU."*" (2, Latin.HT));
else
for Grouping of Groupings loop
for Fin_Token of Elements (Grouping) loop
- SU.Append (Result, "Subnode " &
- Image (Traits.Tokens.Label (Fin_Token.Token)) &
+ SU.Append (Result, "Sub " &
+ Traits.Label_Enum'Image
+ (Traits.Tokens.Label (Fin_Token.Token)) &
" (" & Image (Traits.Tokens.Start (Fin_Token.Token)) &
"," & Image (Fin_Token.Finish) & "), ");
end loop;
SU.Delete (Result, SU.Length (Result) - 1, SU.Length (Result));
SU.Append (Result, Latin.LF);
- SU.Append (Result, SU."*" (3, Latin.HT));
+ SU.Append (Result, SU."*" (2, Latin.HT));
end loop;
end if;
end;
@@ -288,7 +275,7 @@ package body Packrat.Parse_Graphs is
SU.Delete (Result, SU.Length (Result), SU.Length (Result));
end loop;
SU.Delete (Result, SU.Length (Result), SU.Length (Result));
- SU.Append (Result, Latin.LF);
+ SU.Append (Result, Latin.LF & Latin.LF);
end loop;
SU.Delete (Result, SU.Length (Result) - 1, SU.Length (Result));
return SU.To_String (Result);
diff --git a/src/packrat-parse_graphs.ads b/src/packrat-parse_graphs.ads
index 6d79802..595c695 100644
--- a/src/packrat-parse_graphs.ads
+++ b/src/packrat-parse_graphs.ads
@@ -99,8 +99,7 @@ package Packrat.Parse_Graphs is
function Debug_String
- (Container : in Parse_Graph;
- Cutoff : in Positive := 4)
+ (Container : in Parse_Graph)
return String;