aboutsummaryrefslogtreecommitdiffstats
path: root/src/psl/psl-optimize.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/psl/psl-optimize.adb')
-rw-r--r--src/psl/psl-optimize.adb13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/psl/psl-optimize.adb b/src/psl/psl-optimize.adb
index a9391d5ae..792aaacf9 100644
--- a/src/psl/psl-optimize.adb
+++ b/src/psl/psl-optimize.adb
@@ -36,15 +36,15 @@ package body PSL.Optimize is
procedure Remove_Unreachable_States (N : NFA)
is
+ Start : constant NFA_State := Get_Start_State (N);
+ Final : constant NFA_State := Get_Final_State (N);
+ Active : constant NFA_State := Get_Active_State (N);
Head : NFA_State;
- Start, Final : NFA_State;
E : NFA_Edge;
S, N_S : NFA_State;
begin
-- Remove unreachable states, ie states that can't be reached from
-- start state.
- Start := Get_Start_State (N);
- Final := Get_Final_State (N);
Head := No_State;
@@ -77,6 +77,10 @@ package body PSL.Optimize is
-- Do not remove final state!
-- FIXME: deconnect state?
null;
+ elsif S = Active then
+ -- Do not remove the active state, so that user can see that's
+ -- vacuous.
+ null;
else
Remove_State (N, S);
end if;
@@ -115,6 +119,9 @@ package body PSL.Optimize is
-- Do not remove start state!
-- FIXME: deconnect state?
null;
+ elsif S = Active then
+ -- The active state is not expected to be reach the final state.
+ null;
else
Remove_State (N, S);
end if;