Exemplo n.º 1
0
    def runsource(self, source, filename="<input>", symbol="single"):
        try:
            source = core.transpile(source)
            if source.endswith('\n'):
                source = source[:-1]
            code = self.compile(source, filename, symbol)
        except (OverflowError, SyntaxError, ValueError):
            # Case 1
            print(source)
            self.showsyntaxerror(filename)
            return False

        if code is None:
            # Case 2
            return True

        # Case 3
        self.runcode(code)
        return False
Exemplo n.º 2
0
    def runsource(self, source, filename="<input>", symbol="single"):
        try:
            source = core.transpile(source)
            if source.endswith('\n'):
                source = source[:-1]
            code = self.compile(source, filename, symbol)
        except (OverflowError, SyntaxError, ValueError):
            # Case 1
            print(source)
            self.showsyntaxerror(filename)
            return False

        if code is None:
            # Case 2
            return True

        # Case 3
        self.runcode(code)
        return False
Exemplo n.º 3
0
 def runcode(self, code):
     if isinstance(code, str):
         code = core.transpile(code)
     super(PyTugaConsole, self).runcode(code)
Exemplo n.º 4
0
def pytg(src):
    return [repr(x) for x in fromstring(transpile(src))]
Exemplo n.º 5
0
def test_transpile():
    py = transpile('enquanto verdadeiro ou falso: prosseguir')
    assert py == 'while True or False: pass'
Exemplo n.º 6
0
def pytg(src):
    return [repr(x) for x in fromstring(transpile(src))]
Exemplo n.º 7
0
def pytg(src):
    return [repr(x) for x in tokenize(transpile(src))]
Exemplo n.º 8
0
 def runcode(self, code):
     if isinstance(code, str):
         code = core.transpile(code)
     super(PyTugaConsole, self).runcode(code)