blob: e7a4b3d5216e607a1063c777a027724b74b39af3 [file] [log] [blame]
swissChilid85daa92022-02-24 15:29:02 -08001#pragma once
2
3#include <QObject>
4#include <QThread>
5#include <QQueue>
6
7#include "Cell.h"
8#include "../Token.h"
9#include "../Evaluator.h"
10#include "../Parser.h"
11
swissChili732628e2022-02-25 10:35:56 -080012class NbRuntime : public QObject
swissChilid85daa92022-02-24 15:29:02 -080013{
14 Q_OBJECT
15
16public:
17 explicit NbRuntime(QObject *parent = nullptr);
18
19public slots:
20 void queueCell(Cell *cell);
21 void unqueueCell(Cell *cell);
22
23signals:
24 void cellFinishedRunning(Cell *cell, RuntimeResult result);
swissChiliece1ac82022-02-25 11:20:42 -080025 void cellFailedToParse(Cell *cell, ParseResult result, Parser parser);
swissChilid85daa92022-02-24 15:29:02 -080026 void cellWaiting(Cell *cell);
27 void cellRunning(Cell *cell);
28 void cellQuit(Cell *cell);
29
30protected:
31 void evalRemaining();
32
33 Evaluator _eval;
34 QQueue<Cell *> _cells;
35 Cell *_running = nullptr;
36 VarContext _ctx;
37};