# Path: tensorlog/parser.py
# def isProcessedConstant(a):
# def isProcessedVariable(a):
# def isVariableAtom(a):
#     def __init__(self,functor,args):
#     def _setArgs(self,args):
#     def __str__(self):
#     def __repr__(self):
#     def __init__(self,lhs,rhs,features=None,findall=None):
#     def variabilize(self):
#             def convertArgs(args):
#             def convertGoal(g):
#     def __str__(self):
#     def asString(self,syntax=None):
#     def __init__(self,syntax=None):
#     def _key(self,g):
#     def add(self,r):
#     def size(self):
#     def rulesFor(self,g):
#     def mapRules(self,mapfun):
#     def listing(self):
#     def __iter__(self):
#     def equals(self,other):
#   def __init__(self,syntax=None):
#   def setSyntax(self,syntax):
#   def _convertGoal(self,ptree):
#   def _convertRule(self,ptree):
#   def parseGoal(self,s):
#   def parseGoalList(self,s):
#   def parseRule(self,s):
#   def parseQuery(self,s):
#   def parseFile(self,filename,rules=None):
#   def parseStream(self,fileLike,rules=None):
# class Goal(object):
# class Rule(object):
# class RuleCollection(object):
# class Parser(object):


from tensorlog import parser
# (C) William W. Cohen and Carnegie Mellon University, 2016

# mode declarations for Tensorlog (and eventually type declarations)


def asMode(spec):
    """Convert strings like "foo(i,o)" or "foo/io" to ModeDeclarations.
    Or, if given a ModeDeclaration object, return that object.
    """
    if type(spec)==type("") and spec.find("/")>=0:
        functor,rest = spec.split("/")
        return ModeDeclaration(parser.Goal(functor,list(rest)))
    elif type(spec)==type(""):
        return ModeDeclaration(spec)
    else:
        return spec

class AbstractDeclaration(object):
    """Mode - or later - type - declaration for a predicate."""
    def __init__(self,goal):
        if type(goal)==type(""):

# Path: tensorlog/parser.py
# def isProcessedConstant(a):
# def isProcessedVariable(a):
# def isVariableAtom(a):
#     def __init__(self,functor,args):
#     def _setArgs(self,args):
#     def __str__(self):
#     def __repr__(self):
#     def __init__(self,lhs,rhs,features=None,findall=None):
#     def variabilize(self):
#             def convertArgs(args):
#             def convertGoal(g):
#     def __str__(self):
#     def asString(self,syntax=None):
#     def __init__(self,syntax=None):
#     def _key(self,g):
#     def add(self,r):
#     def size(self):
#     def rulesFor(self,g):
#     def mapRules(self,mapfun):
#     def listing(self):
#     def __iter__(self):
#     def equals(self,other):
#   def __init__(self,syntax=None):
#   def setSyntax(self,syntax):
#   def _convertGoal(self,ptree):
#   def _convertRule(self,ptree):
#   def parseGoal(self,s):
#   def parseGoalList(self,s):
#   def parseRule(self,s):
#   def parseQuery(self,s):
#   def parseFile(self,filename,rules=None):
#   def parseStream(self,fileLike,rules=None):
# class Goal(object):
# class Rule(object):
# class RuleCollection(object):
# class Parser(object):


# Path: tensorlog/declare.py
from tensorlog import parser

# (C) William W. Cohen and Carnegie Mellon University, 2016

# mode declarations for Tensorlog (and eventually type declarations)


def asMode(spec):
    """Convert strings like "foo(i,o)" or "foo/io" to ModeDeclarations.
    Or, if given a ModeDeclaration object, return that object.
    """
    if type(spec)==type("") and spec.find("/")>=0:
        functor,rest = spec.split("/")
        return ModeDeclaration(parser.Goal(functor,list(rest)))
    elif type(spec)==type(""):
        return ModeDeclaration(spec)
    else:
        return spec

class AbstractDeclaration(object):
    """Mode - or later - type - declaration for a predicate."""
    def __init__(self,goal):
        if type(goal)==type(""):

            goal = parser.Parser().parseGoal(goal)