@staticmethod
    def getRulesAndTokens( parsercls ):
        """
        build the tokens and precedence tuples from inherited declarations.
        gather tokens and rules definition from Parser class members (own and inherited)
        """

        tokensDict = {}
        rulesDict = {}
        for name, obj in inspect.getmembers(parsercls):
            if name.startswith('t_') and name != 't_error' :

                if isinstance(obj, basestring) :
                    v = obj
                elif inspect.isfunction(obj) or inspect.ismethod(obj) :
                    v = obj.__doc__
                else :
                    raise SyntaxError, "Token definition %s defines neither a string nor a function, unable to parse" % m[0]
                k = name[2:]
                tokensDict[k] = obj
            elif name.startswith('p_') and inspect.ismethod(obj) and name != 'p_error' :
                k = name[2:]
                rulesDict[k] = obj
#            elif name == '_reserved' and isinstance(obj,dict):
#                # reserved attribute holds a list of reserved token keywords.
#                # these should only exist on
#                print "FOUND reserved!"
#                for k,v in obj.items():
#                    tokensDict[v]=None

        return rulesDict, tokensDict
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.5/pymel/util/objectParser.py/Parser.getRulesAndTokens/original