summaryrefslogtreecommitdiff
path: root/src/packrat-errors.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/packrat-errors.adb')
-rw-r--r--src/packrat-errors.adb19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/packrat-errors.adb b/src/packrat-errors.adb
index d59e4c7..62a96a7 100644
--- a/src/packrat-errors.adb
+++ b/src/packrat-errors.adb
@@ -3,7 +3,8 @@
with
Ada.Strings.Fixed,
- Ada.Characters.Handling;
+ Ada.Characters.Handling,
+ Ada.Characters.Latin_1;
separate (Packrat)
@@ -13,6 +14,7 @@ package body Errors is
package SU renames Ada.Strings.Unbounded;
package SF renames Ada.Strings.Fixed;
package CH renames Ada.Characters.Handling;
+ package Latin renames Ada.Characters.Latin_1;
@@ -199,6 +201,21 @@ package body Errors is
end Valid_Message;
+ function Debug_String
+ (This : in Error_Message)
+ return String
+ is
+ Result : SU.Unbounded_String := +"";
+ Info : Error_Info_Array := Decode (This);
+ begin
+ for E of Info loop
+ SU.Append (Result, "Expected " & (-E.Symbol) &
+ " at input position" & Integer'Image (E.Position) & Latin.LF);
+ end loop;
+ return -Result;
+ end Debug_String;
+
+