aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/par-ch4.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/par-ch4.adb')
-rw-r--r--gcc/ada/par-ch4.adb16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb
index 82b09b2..f5a34ec 100644
--- a/gcc/ada/par-ch4.adb
+++ b/gcc/ada/par-ch4.adb
@@ -2319,6 +2319,14 @@ package body Ch4 is
if Token in Token_Class_Sterm then
null;
+ -- Handle '}' as expression terminator of an interpolated
+ -- expression.
+
+ elsif Inside_Interpolated_String_Literal
+ and then Token = Tok_Right_Curly_Bracket
+ then
+ null;
+
-- If we do not have an expression terminator, then complete the
-- scan of a simple expression. This code duplicates the code
-- found in P_Term and P_Factor.
@@ -2557,8 +2565,13 @@ package body Ch4 is
-- an expression terminator, and is not in Token_Class_Sterm, but
-- in this special case we know that the expression is complete.
+ -- We disable this error recovery machinery when we are processing an
+ -- interpolated string and we reach the expression terminator '}'.
+
if not Token_Is_At_Start_Of_Line
and then Token not in Token_Class_Sterm
+ and then not (Inside_Interpolated_String_Literal
+ and then Token = Tok_Right_Curly_Bracket)
then
-- Normally the right error message is indeed that we expected a
-- binary operator, but in the case of being between a right and left
@@ -2851,6 +2864,9 @@ package body Ch4 is
when Tok_Left_Bracket =>
return P_Aggregate;
+ when Tok_Left_Interpolated_String =>
+ return P_Interpolated_String_Literal;
+
-- Allocator
when Tok_New =>