Exemplo n.º 1
0
def add():
    expression = text = request.form['expression']
    p = Parser(expression)
    value = p.getValue()
    now = datetime.utcnow()

    db.session.add(Expression(text=expression, value=value, now=now))
    db.session.commit()

    return redirect(url_for('index'))
Exemplo n.º 2
0
def main():
    print('Hello!')

    while True:
        source = input('>>')
        source = source.replace(' ', '')
        source = source.strip()

        if source == 'q':
            print('Goodbye!')
            break
        elif len(source) == 0:
            continue

        ast = Parser(source).parse()

        print(ast.getValue())