2015-12-01 16:24:51 +00:00
|
|
|
#ifndef APPLESOFTFILE_H
|
|
|
|
#define APPLESOFTFILE_H
|
|
|
|
|
|
|
|
#include <QByteArray>
|
|
|
|
#include <QStringList>
|
|
|
|
#include <QMap>
|
2015-12-14 09:20:36 +00:00
|
|
|
#include <QVector>
|
2015-12-01 16:24:51 +00:00
|
|
|
|
2016-01-21 02:58:48 +00:00
|
|
|
#include "applesoftline.h"
|
2015-12-01 16:24:51 +00:00
|
|
|
#include "genericfile.h"
|
2015-12-14 09:20:36 +00:00
|
|
|
#include "applesofttoken.h"
|
2015-12-01 16:24:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ApplesoftFile : public GenericFile
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ApplesoftFile(QByteArray data = QByteArray());
|
|
|
|
void setData(QByteArray data);
|
|
|
|
QByteArray extraData();
|
|
|
|
QStringList extraDataHexValues();
|
|
|
|
|
2015-12-14 10:48:19 +00:00
|
|
|
QVector<ApplesoftLine> getLines() const { return m_lines; }
|
|
|
|
|
2016-02-10 16:10:37 +00:00
|
|
|
quint16 length() const { return m_length; }
|
2015-12-14 10:48:19 +00:00
|
|
|
|
2016-02-11 23:46:10 +00:00
|
|
|
QByteArray rawData();
|
2016-07-05 13:35:38 +00:00
|
|
|
|
2015-12-01 16:24:51 +00:00
|
|
|
private:
|
2015-12-14 10:48:19 +00:00
|
|
|
void parse(quint16 start_address = 0x0801);
|
2015-12-01 16:24:51 +00:00
|
|
|
|
2015-12-14 10:48:19 +00:00
|
|
|
QVector<ApplesoftLine> m_lines;
|
2015-12-01 16:24:51 +00:00
|
|
|
int m_data_end;
|
|
|
|
quint16 m_length;
|
2015-12-14 09:20:36 +00:00
|
|
|
|
|
|
|
friend class Retokenizer;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Retokenizer {
|
|
|
|
public:
|
|
|
|
static void retokenize(ApplesoftLine &line);
|
2016-10-12 21:50:49 +00:00
|
|
|
|
2015-12-14 09:20:36 +00:00
|
|
|
private:
|
2016-10-12 21:50:49 +00:00
|
|
|
static QVector<ApplesoftToken> retokenizeRems(QVector<ApplesoftToken> &datatokens);
|
|
|
|
static QVector<ApplesoftToken> retokenizeStrings(QVector<ApplesoftToken> &datatokens);
|
|
|
|
static QVector<ApplesoftToken> retokenizeDataStatements(QVector<ApplesoftToken> &datatokens);
|
|
|
|
static QVector<ApplesoftToken> processDataPayload(QVector<ApplesoftToken> &datatokens);
|
|
|
|
static QVector<ApplesoftToken> retokenizeVariables(QVector<ApplesoftToken> &datatokens);
|
|
|
|
static QVector<ApplesoftToken> retokenizeNumbers(QVector<ApplesoftToken> &datatokens);
|
2015-12-01 16:24:51 +00:00
|
|
|
};
|
|
|
|
|
2016-10-12 21:50:49 +00:00
|
|
|
|
2015-12-01 16:24:51 +00:00
|
|
|
#endif // APPLESOFTFILE_H
|