예제 #1
0
    def getANSIC():
        import_file_path = filedialog.askopenfilename(
            title="Seleccionar Archivo", filetypes=((".c Files", "*.c"), ))
        Buffer.cargar_buffer(import_file_path)

        # Listas para cada lista devuelta lista de la función tokenizar
        token = []
        lexema = []
        fila = []
        columna = []
        total = []

        # tokenizar y recargando el buffer
        for i in Buffer.cargar_buffer(import_file_path):
            t, lex, lin, col, tot = Analizador.tokenizar(i)
            token += t
            lexema += lex
            fila += lin
            columna += col
            total += [str(tot)]

        S = tk.Scrollbar(root)
        T = tk.Text(root, height=20, width=92)
        S.pack(side=tk.RIGHT, fill=tk.Y)
        T.pack(side=tk.LEFT, fill=tk.Y)
        S.config(command=T.yview)
        T.config(yscrollcommand=S.set)

        res = '\nTokens reconocidos:\n\n' + str(
            token) + '\n\n\nLISTA DE TOKENS DETALLADA: \n\n' + '\n'.join(
                [str(elem) for elem in total])
        T.insert(tk.END, res)