raise SyntaxError("{} is not permitted outside of {}"
.format(construct, context))
else:
- raise SyntaxError("{} is not permitted directly inside of {}"
- .format(construct, self._ctrl_context))
+ if self._ctrl_context == "Switch":
+ secondary_context = "Case"
+ if self._ctrl_context == "FSM":
+ secondary_context = "State"
+ raise SyntaxError("{} is not permitted directly inside of {}; it is permitted "
+ "inside of {} {}"
+ .format(construct, self._ctrl_context,
+ self._ctrl_context, secondary_context))
def _get_ctrl(self, name):
if self._ctrl_stack:
m = Module()
with m.Switch(self.s1):
with self.assertRaises(SyntaxError,
- msg="If is not permitted directly inside of Switch"):
+ msg="If is not permitted directly inside of Switch; "
+ "it is permitted inside of Switch Case"):
with m.If(self.s2):
pass
with m.State("FOO"):
pass
with self.assertRaises(SyntaxError,
- msg="If is not permitted directly inside of FSM"):
+ msg="If is not permitted directly inside of FSM; "
+ "it is permitted inside of FSM State"):
with m.If(self.s2):
pass