def load(filename): print "Loading and executing %s" % filename rps = 0 full_line = "" line_num = 1 for line in open(filename, "r"): line = line.strip() full_line += line rps += line.count("(") - line.count(")") if rps == 0 and full_line.strip() != "": try: tokens = tokenize(full_line) while len(tokens) > 0: tree = parse(tokens) if tree is not None: eval(tree, global_env) except SystemExit: exit() except Exception as e: print "\nAn error occurred on line %d:\n\t%s\n" % (line_num, full_line) print e.message #traceback.print_exc() break full_line = "" line_num += 1
def load(filename): print "Loading and executing %s" % filename rps = 0 full_line = "" line_num = 1 for line in open(filename, "r"): line = line.strip() full_line += line rps += line.count("(")-line.count(")") if rps == 0 and full_line.strip() != "": try: tokens = tokenize(full_line) while len(tokens) > 0: tree = parse(tokens) if tree is not None: eval(tree,global_env) except SystemExit: exit() except Exception as e: print "\nAn error occurred on line %d:\n\t%s\n" % (line_num,full_line) print e.message #traceback.print_exc() break full_line = "" line_num += 1
def repl(prompt='vau> '): try: while True: full_line = raw_input(prompt) rps = full_line.count("(")-full_line.count(")") while rps != 0 or full_line == "": line = raw_input(">\t") full_line += line rps += line.count("(")-line.count(")") try: tokens = tokenize(full_line) while len(tokens) > 0: val = eval(parse(tokens),global_env) if val is not None: print to_string(val) except ValueError as e: print e.message except (KeyboardInterrupt, SystemExit): pass except: print "\nFatal Error\n" traceback.print_exc()
def repl(prompt='vau> '): try: while True: full_line = raw_input(prompt) rps = full_line.count("(") - full_line.count(")") while rps != 0 or full_line == "": line = raw_input(">\t") full_line += line rps += line.count("(") - line.count(")") try: tokens = tokenize(full_line) while len(tokens) > 0: tree = parse(tokens) if tree is not None: val = eval(tree, global_env) if val is not None: print to_string(val) except ValueError as e: print e.message except (KeyboardInterrupt, SystemExit): pass except: print "\nFatal Error\n" traceback.print_exc()
import re from sparser import parse import json from flask import request, url_for from flask_api import FlaskAPI, status, exceptions app = FlaskAPI(__name__) rd = parse() def schedule_repr(key, action): text = "{}" if (action == 'schedule'): if (key in rd): text = rd[key] if (action == 'near'): if (key == 'D734'): text = "{'near': Мастер-класс\nперенесен в аудиторию D733\n⇦}" if (key == 'D733'): text = "{'near': Мастер-класс\n13:30-15:00}" if (action == 'work'): if (key == 'D951'): text = "{'work': РЕЖИМ РАБОТЫ\n09:00-17:00}" if (action == 'history'): if (key == 'A941'): text = "{'history': Этот кабинет посетил\nПрезидент Российской Федерации\nВ.В. Путин}" if (action == 'food'): if (key == 'A841'): text = "{'food': 🍲Здесь можно поесть🍲}" if (action == 'event'): if (key == 'A841'):