mirror of
https://github.com/markdavidlong/AppleSAWS.git
synced 2025-04-07 16:39:54 +00:00
Fixed bug with formatter
This commit is contained in:
parent
171f8d5959
commit
e4c81ee70c
@ -47,13 +47,31 @@ QString ApplesoftFormatter::formatText()
|
||||
firstToken = false;
|
||||
}
|
||||
|
||||
//TODO: Move this to the parser...
|
||||
//TODO: Move this to the parser.
|
||||
//TODO: This doesn't yet handle: ON expr GOTO/GOSUB n1,n2,n3,...
|
||||
if (previousToken.getTokenId() == ApplesoftToken::ASGoto ||
|
||||
previousToken.getTokenId() == ApplesoftToken::ASGosub ||
|
||||
previousToken.getTokenId() == ApplesoftToken::ASThen)
|
||||
{
|
||||
isFlowTarget = true;
|
||||
m_flowTargets.append(line.linenum);
|
||||
isFlowTarget = false;
|
||||
if (previousToken.getTokenId() == ApplesoftToken::ASGoto ||
|
||||
previousToken.getTokenId() == ApplesoftToken::ASGosub)
|
||||
{
|
||||
isFlowTarget = true;
|
||||
}
|
||||
else if (previousToken.getTokenId() == ApplesoftToken::ASThen &&
|
||||
token.getTokenId() == ApplesoftToken::IntegerTokenVal)
|
||||
{
|
||||
isFlowTarget = true;
|
||||
}
|
||||
|
||||
if (isFlowTarget)
|
||||
{
|
||||
QPair<quint16,quint16> pair;
|
||||
pair.first = line.linenum;
|
||||
pair.second = token.getWordValue();
|
||||
m_flowTargets.append(pair);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_format_options.testFlag(ShowIntsAsHex)) {
|
||||
@ -61,7 +79,6 @@ QString ApplesoftFormatter::formatText()
|
||||
{
|
||||
bool okToConvert = !isFlowTarget;
|
||||
|
||||
|
||||
if (okToConvert)
|
||||
{
|
||||
quint32 ui32val = token.getIntegerValue();
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
|
||||
QString formatText();
|
||||
|
||||
QList<QPair<quint16, quint16> > flowTargets() const { return m_flowTargets; }
|
||||
|
||||
signals:
|
||||
void newFile(ApplesoftFile *file);
|
||||
@ -41,7 +42,7 @@ public slots:
|
||||
|
||||
private:
|
||||
FormatOptions m_format_options;
|
||||
QList<quint16> m_flowTargets;
|
||||
QList<QPair<quint16, quint16> > m_flowTargets;
|
||||
|
||||
ApplesoftFile *m_file;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user