aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/par-ch11.adb
diff options
context:
space:
mode:
authorJustin Squirek <squirek@adacore.com>2021-03-29 10:06:55 -0400
committerPierre-Marie de Rodat <derodat@adacore.com>2021-06-21 06:45:19 -0400
commiteba1160fddffe86acd62411b79e0147ea96bd3f2 (patch)
treed869e2abc241f899550f0aa4e0245119d17d7948 /gcc/ada/par-ch11.adb
parent20922782976048592eb9240ad2ab8690b207dc24 (diff)
downloadgcc-eba1160fddffe86acd62411b79e0147ea96bd3f2.zip
gcc-eba1160fddffe86acd62411b79e0147ea96bd3f2.tar.gz
gcc-eba1160fddffe86acd62411b79e0147ea96bd3f2.tar.bz2
[Ada] INOX: prototype "when" constructs
gcc/ada/ * doc/gnat_rm/implementation_defined_pragmas.rst: Document new feature under pragma Extensions_Allowed. * gnat_rm.texi: Regenerate. * errout.adb, errout.ads (Error_Msg_GNAT_Extension): Created to issue errors when parsing extension only constructs. * exp_ch11.adb, exp_ch11.ads (Expand_N_Raise_When_Statement): Created to expand raise ... when constucts. * exp_ch5.adb, exp_ch5.ads (Expand_N_Goto_When_Statement): Created to expand goto ... when constructs. * exp_ch6.adb, exp_ch6.ads (Expand_N_Return_When_Statement): Created to expand return ... when constructs. * expander.adb (Expand): Add case entries for "when" constructs. * gen_il-gen-gen_nodes.adb, gen_il-types.ads: Add entries for "when" constructs. * par-ch11.adb (P_Raise_Statement): Add processing for raise ... when. * par-ch5.adb (Missing_Semicolon_On_Exit): Renamed to Missing_Semicolon_On_When and moved to par-util.adb. * par-ch6.adb (Get_Return_Kind): Renamed from Is_Simple and processing added for "return ... when" return kind. (Is_Simple): Renamed to Get_Return_Kind. (P_Return_Statement): Add case for return ... when variant of return statement. * par-util.adb, par.adb (Missing_Semicolon_On_When): Added to centeralize parsing of "when" keywords in the context of "when" constructs. * sem.adb (Analyze): Add case for "when" constructs. * sem_ch11.adb, sem_ch11.ads (Analyze_Raise_When_Statement): Created to analyze raise ... when constructs. * sem_ch5.adb, sem_ch5.ads (Analyzed_Goto_When_Statement): Created to analyze goto ... when constructs. * sem_ch6.adb, sem_ch6.ads (Analyze_Return_When_Statement): Created to analyze return ... when constructs. * sprint.adb (Sprint_Node_Actual): Add entries for new "when" nodes.
Diffstat (limited to 'gcc/ada/par-ch11.adb')
-rw-r--r--gcc/ada/par-ch11.adb18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/ada/par-ch11.adb b/gcc/ada/par-ch11.adb
index 87751d1..8304c3e 100644
--- a/gcc/ada/par-ch11.adb
+++ b/gcc/ada/par-ch11.adb
@@ -233,6 +233,24 @@ package body Ch11 is
Set_Expression (Raise_Node, P_Expression);
end if;
+ if Token = Tok_When then
+ Error_Msg_GNAT_Extension ("raise when statement");
+
+ Mutate_Nkind (Raise_Node, N_Raise_When_Statement);
+
+ if Token = Tok_When and then not Missing_Semicolon_On_When then
+ Scan; -- past WHEN
+ Set_Condition (Raise_Node, P_Expression_No_Right_Paren);
+
+ -- Allow IF instead of WHEN, giving error message
+
+ elsif Token = Tok_If then
+ T_When;
+ Scan; -- past IF used in place of WHEN
+ Set_Condition (Raise_Node, P_Expression_No_Right_Paren);
+ end if;
+ end if;
+
TF_Semicolon;
return Raise_Node;
end P_Raise_Statement;