blob: 2f6a84537b622952834de3d622312675239422ee [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
12class NbRuntime : public QThread
13{
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);
25 void cellFailedToParse(Cell *cell, ParseResult result);
26 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};