pyrser/ast/state.py
def nextstate(self, newstate, treenode=None, user_data=None):
        """
        Manage transition of state.
        """
        if newstate is None:
            return self
        if isinstance(newstate, State) and id(newstate) != id(self):
            return newstate
        elif isinstance(newstate, StateEvent):
            self.state_register.named_events[newstate.name] = True
            return newstate.st
        elif isinstance(newstate, StatePrecond):
            return newstate.st
        elif isinstance(newstate, StateHook):
            # final API using PSL
            newstate.call(treenode, user_data)
            return newstate.st
        return self
def nextstate(self, newstate, treenode=None, user_data=None):
        """
        Manage transition of state.
        """
        if newstate is None:
            return self
        if isinstance(newstate, State) and id(newstate) != id(self):
            return newstate
        elif isinstance(newstate, StateEvent):
            self.state_register.named_events[newstate.name] = True
            return newstate.st
        elif isinstance(newstate, StatePrecond):
            return newstate.st
        elif isinstance(newstate, StateHook):
            # final API using PSL
            newstate.call(treenode, user_data)
            return newstate.st
        return self
Manage transition of state.