Exemplo n.º 1
0
 def interpret(x):
     if isinstance(x, Ast):
         return x.jsonNode(False, set())
     elif isinstance(x, basestring):
         return ppfa(x).jsonNode(False, set())
     else:
         return pfa(x).jsonNode(False, set())
Exemplo n.º 2
0
    def interpret(x):
        """Interpret expression from a PFA abstract syntax tree or PrettyPFA string.

        :type x: titus.datatype.Ast, PrettyPFA string
        :param x: input PFA
        :rtype: Pythonized JSON
        :return: the PFA as Pythonized JSON
        """

        if isinstance(x, Ast):
            return x.jsonNode(False, set())
        elif isinstance(x, str):
            return ppfa(x).jsonNode(False, set())
        else:
            return pfa(x).jsonNode(False, set())
Exemplo n.º 3
0
    def interpret(x):
        """Interpret expression from a PFA abstract syntax tree or PrettyPFA string.

        :type x: titus.datatype.Ast, PrettyPFA string
        :param x: input PFA
        :rtype: Pythonized JSON
        :return: the PFA as Pythonized JSON
        """

        if isinstance(x, Ast):
            return x.jsonNode(False, set())
        elif isinstance(x, basestring):
            return ppfa(x).jsonNode(False, set())
        else:
            return pfa(x).jsonNode(False, set())