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