diff options
author | Brad Beckmann <Brad.Beckmann@amd.com> | 2009-11-18 13:55:58 -0800 |
---|---|---|
committer | Brad Beckmann <Brad.Beckmann@amd.com> | 2009-11-18 13:55:58 -0800 |
commit | cc2db929cbdb95168600de42a45a361f3a9e7318 (patch) | |
tree | 1c10a67a8ef615ef1d03640e004dca4f77b93c83 | |
parent | e84881b7a353e8a45640f7d53fa032003272656a (diff) | |
download | gem5-cc2db929cbdb95168600de42a45a361f3a9e7318.tar.xz |
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
-rw-r--r-- | src/mem/slicc/ast/TransitionDeclAST.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mem/slicc/ast/TransitionDeclAST.py b/src/mem/slicc/ast/TransitionDeclAST.py index ef745fd50..a941d7b0c 100644 --- a/src/mem/slicc/ast/TransitionDeclAST.py +++ b/src/mem/slicc/ast/TransitionDeclAST.py @@ -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) |