From 98067eb30f0097955b086b3bf3ad5da51e558546 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sat, 4 Jan 2014 01:46:59 +0100 Subject: Improve error recovery for invalid bit string. --- scan.adb | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scan.adb b/scan.adb index 3490e4e..a8ac7d1 100644 --- a/scan.adb +++ b/scan.adb @@ -495,10 +495,20 @@ package body Scan is ("underscore not allowed at the end of a bit string"); end if; goto Again; - when others => + when '"' => + pragma Assert (Mark = '%'); Error_Msg_Scan - ("character '" & C & "' not allowed in a bit string"); - goto Again; + ("'""' cannot close a bit string opened by '%'"); + exit; + when '%' => + pragma Assert (Mark = '%'); + Error_Msg_Scan + ("'%' cannot close a bit string opened by '""'"); + exit; + when others => + Error_Msg_Scan ("bit string not terminated"); + Pos := Pos - 1; + exit; end case; case Base_Len is -- cgit