Exemplo n.º 1
0
def analizar_texto():
    txt_resultado_compilado['state'] = tk.NORMAL
    txt_resultado_compilado.delete(1.0, tk.END)
    txt_resultado_compilado['state'] = tk.DISABLED
    text = txt_edit.get(1.0, tk.END)
    text = text.lstrip()
    text = text.rstrip()
    resultados = ''

    if (text != ''):
        result, error = basic.run('<stdin>', text)
        if error:
            label_mensaje['text'] = 'Mensaje: Error - ' + error.as_string()
        elif result:
            if len(result.elements) == 1:
                resultados = repr(result.elements[0])
                print(repr(result.elements[0]))
            else:
                resultados = repr(result)
                print(repr(result))

            label_mensaje['text'] = 'Mensaje: Todo cool :)'
            txt_resultado_compilado['state'] = tk.NORMAL
            txt_resultado_compilado.insert(1.0, resultados)
            txt_resultado_compilado['state'] = tk.DISABLED
    else:
        label_mensaje['text'] = 'Mensaje: Texto vacío'
Exemplo n.º 2
0
def dodo():
    while True:
        stri = input()
        string = stri.split()
        do = ""

        if do == "f**k":
            break
        result = basic.run("<stdin>", string)
        try:
            for i in string:
                if i == "Begir":
                    x = int(input())
                    continue
                if i == "('%d',x)":
                    continue
                if i in tokens:
                    # import ipdb; ipdb.set_trace()
                    do += tokens[i]
                else:
                    do += i

            # print("do si " , do)
            # print(do)
            exec(do)
        except EOFError:
            print("an error happend")
Exemplo n.º 3
0
def main():
    signal.signal(signal.SIGINT, Exit)
    while True:
        text = input("REPL > ").strip()
        if (text == ''): continue
        result, error = basic.run('<stdin>', text)
        print(error.as_string() if error else result)
Exemplo n.º 4
0
def check_function_body(file_content_lst, types_list):
    function_body = []
    start = 0
    for token in file_content_lst:  # target the start of the body
        if token != "{":
            start = start + 1
        else:
            start = start + 1
            break
    for i in range(start, len(file_content_lst) - 1):
        function_body.append(file_content_lst[i])
    function_body_string = ""
    for i in function_body:
        function_body_string = function_body_string + i

    result, error = basic.run('<stdin>', function_body_string)

    if error:
        print(error.as_string())
    else:
        print(result)
Exemplo n.º 5
0
	def execute_run(self, exec_ctx):
		filename = (exec_ctx.symbol_table.get("fn"))
		if not isinstance(filename, String):
			return RTResult().failure(
				RunTimeError(
        			self.pos_start, 
					self.pos_end,
        			"Filename must be string",
        			exec_ctx
      		)
		)
		import basic
		try:
			with open(str(filename), "r+") as f:
				text = f.read()
		except Exception as e:
			return RTResult().failure(
				RunTimeError(
					self.pos_start,
					self.pos_end,
					f"Failed to load script \"{filename}\"\n" + str(e),
					exec_ctx
				)
			)
		
		_, error = basic.run(filename, text)
		
		if error:
			return RTResult().failure(
				RunTimeError(
					self.pos_start,
					self.pos_end,
					f"Failed to finish executing script \"{filename}\"\n" + str(error),
					exec_ctx
				)
			)
		return RTResult().success(NoneType())
import basic

while True:
    text = input('Kelompok 8 >> ')
    if text.strip() == "": continue
    hasil, error = basic.run('<stdin>', text)

    if error:
        print(error.as_string())
    elif hasil:
        if len(hasil.elements) == 1:
            print(repr(hasil.elements[0]))
        else:
            print(repr(hasil))
Exemplo n.º 7
0
import basic

while True:
    text = input('basic > ')
    result = basic.run(text)

    print(result)
Exemplo n.º 8
0
def validar_linea(text, cuadro_text):

    result, error = basic.run('<stdin>', text)
    if error:
        MessageBox.showerror("Compilador", error.as_string() + "en la  linea")
    if result: cuadro_text.insert(END, result)
Exemplo n.º 9
0
import basic
import sys

if len(sys.argv)>1:
	fn=sys.argv[1]
	result, error=basic.run('<stdin>', f'RUN("{fn}")')
	if error: print(error.as_string())
	elif result: print(result)
	sys.exit()

while True:
	text=input("basic> ")
	result, error=basic.run('<stdin>', text)

	if error: 
		'''
		try:
			exec(text)
		except:
			'''
		print(error.as_string())
	elif result: print(result)
Exemplo n.º 10
0
import basic

while True:
    text = input("> ")

    result, error = basic.run(text)

    if error: print(error)
    else: print(result)
Exemplo n.º 11
0
from basic import run

while True:
    result, err = run("<stdin>", input("kripp >> "))

    if err:
        print(err.as_string())
    else:
        print(result)
Exemplo n.º 12
0
# -- Configuration (Settings) -- #

user_color = "white"
user_style = "none"
console_color = "white"
console_style = "none"

pointer = "ParaCode Shell >>>"
pointer_color = "green"
pointer_style = "none"

error_color = "red"
error_style = "none"


while True:
    if used == 0:
        # print('ParaCode Shell Launched Successfully!')
        # print("")
        # print("")
        # print("")
        if __name__ == "__main__":
            os.system('')
            init()
            args = sys.argv
            if len(args) == 2:
                print(pointer_color + pointer_style + pointer + console_color + console_style + " " + args[1])
                time.sleep(1.25)
                basic.run('<stdin>', 'RUN("' + str(os.path.join(sys._MEIPASS, "shellTemplate.para")).replace('\\', '/').replace("'", '"') + '")')
        used = 1
Exemplo n.º 13
0
def getJSON(query):
    temp = {"query": query}
    basic.run(query)
    return (json.dumps(temp))
Exemplo n.º 14
0
import basic

while True:
    text = input('basic > ')
    if text.strip() == "": continue
    result, error, should_exit = basic.run('<stdin>', text)

    if error:
        print(error.as_string())
    elif result:
        if len(result.elements) == 1:
            print(repr(result.elements[0]))
        else:
            print(repr(result))

    if should_exit:
        break
Exemplo n.º 15
0
''')

parser = argparse.ArgumentParser()
parser.add_argument('filename', nargs="*")
args = parser.parse_args()
try:
    fn = f"{str(args.filename[0])}"
except:
    fn = None


def print_result(result, error=None):
    if type(result) == tuple:
        print_result(result[0], result[1])
    else:
        if error:
            print(error)
        elif result and repr(result.elements[0]) != "None":
            if len(result.elements) == 1:
                print(repr(result.elements[0]))
            else:
                print(repr(result))


if fn:
    print_result(basic.run(__name__, f'run("{fn}")'))
while not fn:
    text = input("Cobalt > ")
    result, error = basic.run(__name__, text)
    print_result(result, error)
Exemplo n.º 16
0
import os
import basic

os.system("clear")
while True:
    text = input("basic> ")
    if text.lower() == "clear":
        os.system("clear")
        continue
    result, error = basic.run("<stdin>", text)

    if error:
        print(error.as_string())
    else:
        print(result)
Exemplo n.º 17
0
import basic

while (True):
    text = input('basic > ')
    result, error = basic.run('<stdin>', text)  #call run method from basic

    if error:
        print(error.as_string())

    else:
        print(result)
Exemplo n.º 18
0
import basic
import basic2
import nested
import inheritance
import complex_types
import libuse
import parallel

from autolog import Autolog

autolog = Autolog(
    [basic, basic2, nested, inheritance, complex_types, libuse, parallel])
autolog.run()  # by running this function, logging is activated

complex_types.run()
libuse.run()
basic.run()
basic2.run()
nested.run()
inheritance.run()
parallel.run()
Exemplo n.º 19
0
Doggoscript Version: {ds_ver}
Python Version: {platform.python_version()}

Node Name: {platform.node()}
Platform: {platform.platform()} {platform.machine()}
Processor: {platform.processor()}
Architecture: {" ".join(platform.architecture())}
""")
    print(
        f"\nDoggoscript has ran into a exception! Log {y}.log has been created."
    )


while True:
    try:
        result, error = basic.run("<stdin>", f"run(\"{sys.argv[1]}\")")

        if error:
            print(error.as_string())
        elif result:
            if len(result.elements) == 1:
                print(repr(result.elements[0]))
            else:
                print(repr(result))
        break
    except IndexError:
        try:
            text = input("DoggoScript >>> ")
        except KeyboardInterrupt:
            break
        except EOFError:
Exemplo n.º 20
0
import basic

print("Land 1.1.3")

while True:
    text = input('>> ')
    if text.strip() == "": continue
    result, error = basic.run('<stdin>', text)

    if error:
        print(error.as_string())
    elif result:
        if len(result.elements) == 1:
            print(repr(result.elements[0]))

        else:
            print(repr(result))
Exemplo n.º 21
0
import basic

code = open("sample.txt", 'r')

# basic.run(code.read())

import codecs
with codecs.open('sample.txt', encoding='utf-8') as f:
    i = f.read().encode('utf-8')
    basic.run(i.decode('utf-8'))