-----Original Message-----
From: g...@cmdmail.amd.com [mailto:g...@cmdmail.amd.com] 
Sent: Monday, November 09, 2009 10:32 AM
To: Beckmann, Brad
Subject: [PATCH 19 of 31] ruby: slicc state machine error fixes

# HG changeset patch
# User Brad Beckmann <brad.beckm...@amd.com>
# Date 1257791383 28800
# Node ID 7c1e8f3ed3d6d8f9767743dc59ba05270ed87020
# Parent  10193adc8288db1c97ae94f9c8fad02a2b116bf5
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

diff -r 10193adc8288 -r 7c1e8f3ed3d6
src/mem/slicc/ast/TransitionDeclAST.py
--- a/src/mem/slicc/ast/TransitionDeclAST.py    Mon Nov 09 10:29:43 2009
-0800
+++ b/src/mem/slicc/ast/TransitionDeclAST.py    Mon Nov 09 10:29:43 2009
-0800
@@ -46,9 +46,20 @@
         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)

_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to