Ejemplo n.º 1
0
def capture_gb_eval_print(code):
    temp_stdout = StringIO()
    # redirect stdout to catch print statement from eval function
    with contextlib.redirect_stdout(temp_stdout):
        greenBerry_eval(code)
    output = temp_stdout.getvalue().strip()
    return output
Ejemplo n.º 2
0
 def test_null(self):
     # check null input
     x = ''
     try:
         greenBerry_eval(x)
     except:
         error = True
     self.assertTrue(error)
Ejemplo n.º 3
0
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 31 22:54:37 2017

@author: ARJ
"""

from greenBerry import greenBerry_eval

x = ''

with open('main.gb', 'r') as f:
    x = f.read()

greenBerry_eval(x)
Ejemplo n.º 4
0
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 31 22:21:00 2017

@author: ARJ
"""
from greenBerry import greenBerry_eval

print('''
      ---greenBerry(c)---
      welcome to the .gb REPL
      ---greenBerry(c)---
      ''')
isSessionOn = 1
while isSessionOn == 1:
    x = input('---> ')
    greenBerry_eval(x)
    if x == 'berry exit':
        isSessionOn = 0
    print()
print('''
      ---greenBerry(c)---
      .gb REPL exited. see you soon _ _
      ---greenBerry(c)---
      ''')
    def run_command(self, event=0):
        x = self.txt.get("1.0", END + "-1c")

        greenBerry_eval(x)
        print("=" * 30)