ruby: slicc state machine error fixes
Added error messages when: - a state does not exist in a machine's list of known states. - an event does not exist in a machine - the actions of a certain machine have not been declared
This commit is contained in:
parent
e84881b7a3
commit
cc2db929cb
1 changed files with 11 additions and 0 deletions
|
@ -46,9 +46,20 @@ class TransitionDeclAST(DeclAST):
|
|||
if machine is None:
|
||||
self.error("Transition declaration not part of a machine.")
|
||||
|
||||
for action in self.actions:
|
||||
if action not in machine.actions:
|
||||
self.error("Invalid action: %s is not part of machine: %s" % \
|
||||
(action, machine))
|
||||
|
||||
for state in self.states:
|
||||
if state not in machine.states:
|
||||
self.error("Invalid state: %s is not part of machine: %s" % \
|
||||
(state, machine))
|
||||
next_state = self.next_state or state
|
||||
for event in self.events:
|
||||
if event not in machine.events:
|
||||
self.error("Invalid event: %s is not part of machine: %s" % \
|
||||
(event, machine))
|
||||
t = Transition(self.symtab, machine, state, event, next_state,
|
||||
self.actions, self.location, self.pairs)
|
||||
machine.addTransition(t)
|
||||
|
|
Loading…
Reference in a new issue