Beispiel #1
0
 def validate(self):
     with open(self.upload_folder + self.filename, "r") as file:
         code = file.read()
         cr = Lexical(code)
         result = cr.run()
         return jsonify({
             'code': code,
             'lexical_table': result,
             'syntatic_result': []
         })
Beispiel #2
0
def validate():
    assert request.path == '/validate'
    assert request.method == 'POST'

    cr = Lexical(request.form['code'])
    lexical_result = cr.run()

    s = Syntatic(request.form['code'], cr.getTokens())
    syntatic_result = s.run()

    return jsonify({
        'code': request.form['code'],
        'lexical_table': lexical_result,
        'syntatic_result': syntatic_result
    })