Commit 268bf2d6 authored by Victor Yacovlev's avatar Victor Yacovlev

Everywhere: Line number instruction has 2 meanings; highlight statement

in line
parent 3a9e25bf
......@@ -182,7 +182,7 @@ void KumirProgram::setBytecodeRun(KPlugin *run)
connect(run, SIGNAL(stopped(int)),
this, SLOT(handleRunnerStopped(int)));
connect(run, SIGNAL(lineChanged(int)), this, SLOT(handleLineChanged(int)));
connect(run, SIGNAL(lineChanged(int,quint32,quint32)), this, SLOT(handleLineChanged(int,quint32,quint32)));
connect(run, SIGNAL(marginText(int,QString)), this, SLOT(handleMarginTextRequest(int,QString)));
connect(run, SIGNAL(clearMargin(int,int)), this, SLOT(handleMarginClearRequest(int,int)));
connect(run, SIGNAL(replaceMarginText(int,QString, bool)),
......@@ -456,7 +456,7 @@ void KumirProgram::handleRunnerStopped(int rr)
else if (reason==Shared::RunInterface::SR_Error) {
s_endStatus = tr("Evaluation error");
m_terminal->error(plugin_bytecodeRun->error());
plugin_editor->highlightLineRed(documentId_, plugin_bytecodeRun->currentLineNo());
plugin_editor->highlightLineRed(documentId_, plugin_bytecodeRun->currentLineNo(), plugin_bytecodeRun->currentColumn().first, plugin_bytecodeRun->currentColumn().second);
PluginManager::instance()->switchGlobalState(GS_Observe);
e_state = Idle;
m_terminal->clearFocus();
......@@ -492,14 +492,14 @@ void KumirProgram::handleRunnerStopped(int rr)
}
void KumirProgram::handleLineChanged(int lineNo)
void KumirProgram::handleLineChanged(int lineNo, quint32 colStart, quint32 colEnd)
{
emit activateDocumentTab(documentId_);
if (lineNo!=-1) {
if (plugin_bytecodeRun->error().isEmpty())
plugin_editor->highlightLineGreen(documentId_, lineNo);
plugin_editor->highlightLineGreen(documentId_, lineNo, colStart, colEnd);
else
plugin_editor->highlightLineRed(documentId_, lineNo);
plugin_editor->highlightLineRed(documentId_, lineNo, colStart, colEnd);
}
else {
plugin_editor->unhighlightLine(documentId_);
......
......@@ -54,7 +54,7 @@ public slots:
void stepOut();
void stop();
void switchGlobalState(ExtensionSystem::GlobalState old, ExtensionSystem::GlobalState cur);
void handleLineChanged(int lineNo);
void handleLineChanged(int lineNo, quint32 colStart, quint32 colEnd);
void handleMarginTextRequest(int lineNo, const QString & text);
void handleMarginClearRequest(int fromLine, int toLine);
void handleMarginTextReplace(int,const QString&,bool);
......
......@@ -48,7 +48,7 @@ MainWindow::MainWindow(Plugin * p) :
QObject * runnerObject =
ExtensionSystem::PluginManager::instance()->findKPlugin<Shared::RunInterface>();
if (runnerObject) {
connect(runnerObject, SIGNAL(updateStepsCounter(ulong)), this, SLOT(checkCounterValue()));
connect(runnerObject, SIGNAL(updateStepsCounter(quint64)), this, SLOT(checkCounterValue()));
}
connect(ui->actionPreferences, SIGNAL(triggered()), this, SLOT(showPreferences()));
......
......@@ -115,9 +115,9 @@ void Editor::clearMarginText(uint fromLine, uint toLine)
update();
}
void Editor::setLineHighlighted(int lineNo, const QColor &color)
void Editor::setLineHighlighted(int lineNo, const QColor &color, quint32 colStart, quint32 colEnd)
{
d->plane->setLineHighlighted(lineNo, color);
d->plane->setLineHighlighted(lineNo, color, colStart, colEnd);
}
QList<QWidget*> Editor::statusbarWidgets()
......
......@@ -40,7 +40,7 @@ public:
void checkForClean();
void lock();
void unlock();
void setLineHighlighted(int lineNo, const QColor & color);
void setLineHighlighted(int lineNo, const QColor & color, quint32 colStart, quint32 colEnd);
void ensureAnalized();
QByteArray saveState() const;
void restoreState(const QByteArray &data);
......
......@@ -42,6 +42,8 @@ EditorPlane::EditorPlane(TextDocument * doc
editor_ = editor;
analizer_ = analizer;
highlightedTextLineNumber_ = -1;
highlightedTextColumnStartNumber_ = 0u;
highlightedTextColumnEndNumber_ = 0u;
highlightedLockSymbolLineNumber_ = -1;
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
marginBackgroundAlpha_ = 255;
......@@ -93,10 +95,12 @@ void EditorPlane::setTeacherMode(bool v)
teacherModeFlag_ = v;
}
void EditorPlane::setLineHighlighted(int lineNo, const QColor &color)
void EditorPlane::setLineHighlighted(int lineNo, const QColor &color, quint32 colStart, quint32 colEnd)
{
highlightedTextLineNumber_ = lineNo;
highlightedTextLineColor_ = color;
highlightedTextColumnStartNumber_ = colStart;
highlightedTextColumnEndNumber_ = colEnd;
if (lineNo>-1) {
ensureHighlightedLineVisible();
}
......@@ -926,6 +930,24 @@ void EditorPlane::paintEvent(QPaintEvent *e)
p.drawLine(highlightRightRect.bottomLeft(),
highlightRightRect.bottomRight());
if (highlightedTextColumnStartNumber_ != highlightedTextColumnEndNumber_) {
// Draw a rect around statement
QPen pen;
pen.setColor(highlightedTextLineColor_);
pen.setStyle(Qt::SolidLine);
pen.setWidth(2);
p.setPen(pen);
p.setBrush(Qt::NoBrush);
uint cw = charWidth();
uint left = cw * highlightedTextColumnStartNumber_;
uint right = cw * highlightedTextColumnEndNumber_;
left += cw * 2 * document_->indentAt(highlightedTextLineNumber_);
right += cw * 2 * document_->indentAt(highlightedTextLineNumber_);
p.drawRoundedRect(left, highlightLeftRect.top(),
int(right) - int(left), highlightLeftRect.height(),
2, 2);
}
// Restore a pen
p.setPen(Qt::NoPen);
......
......@@ -50,7 +50,7 @@ public slots:
void cut();
void removeLine();
void removeLineTail();
void setLineHighlighted(int lineNo, const QColor & color);
void setLineHighlighted(int lineNo, const QColor & color, quint32 colStart, quint32 colEnd);
void signalizeNotEditable();
protected:
static QPolygon errorUnderline(int x, int y, int len);
......@@ -130,6 +130,8 @@ private:
int highlightedTextLineNumber_;
QColor highlightedTextLineColor_;
int highlightedLockSymbolLineNumber_;
quint32 highlightedTextColumnStartNumber_;
quint32 highlightedTextColumnEndNumber_ ;
class SuggestionsWindow * autocompleteWidget_;
Shared::AnalizerInterface * analizer_;
QList<QAction*> contextMenuActions_;
......
......@@ -341,22 +341,22 @@ void EditorPlugin::changeGlobalState(ExtensionSystem::GlobalState prev, Extensio
}
}
void EditorPlugin::highlightLineGreen(int documentId, int lineNo)
void EditorPlugin::highlightLineGreen(int documentId, int lineNo, quint32 colStart, quint32 colEnd)
{
if (d->editors[documentId].e)
d->editors[documentId].e->setLineHighlighted(lineNo, QColor(Qt::darkGreen));
d->editors[documentId].e->setLineHighlighted(lineNo, QColor(Qt::darkGreen), colStart, colEnd);
}
void EditorPlugin::highlightLineRed(int documentId, int lineNo)
void EditorPlugin::highlightLineRed(int documentId, int lineNo, quint32 colStart, quint32 colEnd)
{
if (d->editors[documentId].e)
d->editors[documentId].e->setLineHighlighted(lineNo, QColor(Qt::red));
d->editors[documentId].e->setLineHighlighted(lineNo, QColor(Qt::red), colStart, colEnd);
}
void EditorPlugin::unhighlightLine(int documentId)
{
if (d->editors[documentId].e)
d->editors[documentId].e->setLineHighlighted(-1, QColor::Invalid);
d->editors[documentId].e->setLineHighlighted(-1, QColor::Invalid, 0u, 0u);
}
void EditorPlugin::ensureAnalized(int documentId)
......
......@@ -33,8 +33,8 @@ public:
KumFile::Data documentContent(int documentId) const;
Shared::AnalizerInterface * analizer(int documentId);
quint32 errorsLinesCount(int documentId) const;
void highlightLineGreen(int documentId, int lineNo);
void highlightLineRed(int documentId, int lineNo);
void highlightLineGreen(int documentId, int lineNo, quint32 colStart, quint32 colEnd);
void highlightLineRed(int documentId, int lineNo, quint32 colStart, quint32 colEnd);
void unhighlightLine(int documentId);
void appendMarginText(int documentId, int lineNo, const QString & text);
void setMarginText(int documentId, int lineNo, const QString & text, const QColor & fgColor);
......
......@@ -3,7 +3,7 @@
#include "vm/vm.hpp"
#include "extensionsystem/pluginmanager.h"
#include "interfaces/actorinterface.h"
#include "shared/dataformats/lexem.h"
namespace KumirCodeGenerator {
......@@ -427,11 +427,7 @@ void Generator::addInputArgumentsMainAlgorhitm(int moduleId, int algorhitmId, co
{
// Generate hidden algorhitm, which will called before main to input arguments
int algId = mod->impl.algorhitms.size();
QList<Bytecode::Instruction> instrs;
Bytecode::Instruction l;
l.type = Bytecode::LINE;
l.arg = alg->impl.headerLexems[0]->lineNo;
instrs << l;
QList<Bytecode::Instruction> instrs = makeLineInstructions(alg->impl.headerLexems);
QList<quint16> varsToOut;
int locOffset = 0;
......@@ -704,11 +700,7 @@ void Generator::addFunction(int id, int moduleId, Bytecode::ElemType type, const
func.moduleName = mod->header.name.toStdWString();
QList<Bytecode::Instruction> argHandle;
Bytecode::Instruction l;
l.type = Bytecode::LINE;
l.arg = alg->impl.headerLexems[0]->lineNo;
if (debugLevel_!=GeneratorInterface::NoDebug)
argHandle << l;
argHandle += makeLineInstructions(alg->impl.headerLexems);
if (headerError.length()>0) {
Bytecode::Instruction err;
......@@ -723,6 +715,8 @@ void Generator::addFunction(int id, int moduleId, Bytecode::ElemType type, const
l.type = Bytecode::LINE;
l.arg = alg->impl.headerRuntimeErrorLine;
argHandle << l;
Bytecode::setColumnPositionsToLineInstruction(l, 0u, 0u);
argHandle << l;
l.type = Bytecode::ERRORR;
l.scope = Bytecode::CONSTT;
l.arg = constantValue(Bytecode::VT_string, 0,
......@@ -785,9 +779,7 @@ void Generator::addFunction(int id, int moduleId, Bytecode::ElemType type, const
}
if (alg->impl.beginLexems.size()) {
l.arg = alg->impl.beginLexems[0]->lineNo;
if (debugLevel_!=GeneratorInterface::NoDebug)
argHandle << l;
argHandle += makeLineInstructions(alg->impl.beginLexems);
}
if (beginError.length()>0) {
......@@ -819,14 +811,7 @@ void Generator::addFunction(int id, int moduleId, Bytecode::ElemType type, const
setBreakAddress(body, 0, retIp);
Bytecode::Instruction line;
line.type = Bytecode::LINE;
if (alg->impl.endLexems.size()>0) {
line.arg = alg->impl.endLexems[0]->lineNo;
if (debugLevel_!=GeneratorInterface::NoDebug)
ret << line;
}
ret += makeLineInstructions(alg->impl.endLexems);
if (alg->impl.endLexems.size()>0) {
QString endError;
......@@ -945,17 +930,12 @@ quint16 Generator::constantValue(const QList<Bytecode::ValueType> & type, quint8
void Generator::ERRORR(int , int , int , const AST::StatementPtr st, QList<Bytecode::Instruction> & result)
{
int lineNo = st->lexems[0]->lineNo;
Bytecode::Instruction l;
l.type = Bytecode::LINE;
l.arg = lineNo;
result += makeLineInstructions(st->lexems);
const QString error = ErrorMessages::message("KumirAnalizer", QLocale::Russian, st->error);
Bytecode::Instruction e;
e.type = Bytecode::ERRORR;
e.scope = Bytecode::CONSTT;
e.arg = constantValue(Bytecode::VT_string, 0, error, QString(), QString());
if (debugLevel_!=GeneratorInterface::NoDebug)
result << l;
result << e;
}
......@@ -1007,14 +987,36 @@ void Generator::findFunction(const AST::AlgorithmPtr alg, quint8 &module, quint1
}
}
QList<Bytecode::Instruction> Generator::makeLineInstructions(const QList<AST::Lexem *> &lexems) const
{
QList<Bytecode::Instruction> result;
if (debugLevel_ != GeneratorInterface::NoDebug) {
Bytecode::Instruction lineNoInstruction, lineColInstruction;
lineNoInstruction.type = lineColInstruction.type = Bytecode::LINE;
lineNoInstruction.lineSpec = Bytecode::LINE_NUMBER;
if (lexems.size() > 0 && lexems.first()->lineNo != -1) {
AST::Lexem * first = lexems.first();
AST::Lexem * last = first;
foreach (AST::Lexem * lx, lexems) {
if (lx->type != Shared::LxTypeComment)
last = lx;
}
quint16 lineNo = first->lineNo;
lineNoInstruction.arg = lineNo;
quint32 colStart = first->linePos;
quint32 colEnd = last->linePos + last->data.length();
if (last->type == Shared::LxConstLiteral)
colEnd += 2; // two quote symbols are not in lexem data
Bytecode::setColumnPositionsToLineInstruction(lineColInstruction, colStart, colEnd);
result << lineNoInstruction << lineColInstruction;
}
}
return result;
}
void Generator::ASSIGN(int modId, int algId, int level, const AST::StatementPtr st, QList<Bytecode::Instruction> & result)
{
int lineNo = st->lexems[0]->lineNo;
Bytecode::Instruction l;
l.type = Bytecode::LINE;
l.arg = lineNo;
if (debugLevel_!=GeneratorInterface::NoDebug)
result << l;
result += makeLineInstructions(st->lexems);
const AST::ExpressionPtr rvalue = st->expressions[0];
QList<Bytecode::Instruction> rvalueInstructions = calculate(modId, algId, level, rvalue);
......@@ -1247,27 +1249,17 @@ QList<Bytecode::Instruction> Generator::calculate(int modId, int algId, int leve
void Generator::PAUSE_STOP(int , int , int , const AST::StatementPtr st, QList<Bytecode::Instruction> & result)
{
int lineNo = st->lexems[0]->lineNo;
Bytecode::Instruction l;
l.type = Bytecode::LINE;
l.arg = lineNo;
if (debugLevel_!=GeneratorInterface::NoDebug)
result << l;
result += makeLineInstructions(st->lexems);
Bytecode::Instruction a;
a.type = st->type==AST::StPause? Bytecode::PAUSE : Bytecode::HALT;
a.arg = lineNo;
a.arg = 0u;
result << a;
}
void Generator::ASSERT(int modId, int algId, int level, const AST::StatementPtr st, QList<Bytecode::Instruction> & result)
{
int lineNo = st->lexems[0]->lineNo;
Bytecode::Instruction l;
l.type = Bytecode::LINE;
l.arg = lineNo;
if (debugLevel_!=GeneratorInterface::NoDebug)
result << l;
result += makeLineInstructions(st->lexems);
for (int i=0; i<st->expressions.size(); i++) {
QList<Bytecode::Instruction> exprInstrs;
......@@ -1299,12 +1291,7 @@ void Generator::ASSERT(int modId, int algId, int level, const AST::StatementPtr
void Generator::INIT(int modId, int algId, int level, const AST::StatementPtr st, QList<Bytecode::Instruction> & result)
{
int lineNo = st->lexems[0]->lineNo;
Bytecode::Instruction l;
l.type = Bytecode::LINE;
l.arg = lineNo;
if (debugLevel_!=GeneratorInterface::NoDebug)
result << l;
result += makeLineInstructions(st->lexems);
for (int i=0; i<st->variables.size(); i++) {
const AST::VariablePtr var = st->variables[i];
......@@ -1349,12 +1336,7 @@ void Generator::INIT(int modId, int algId, int level, const AST::StatementPtr s
void Generator::CALL_SPECIAL(int modId, int algId, int level, const AST::StatementPtr st, QList<Bytecode::Instruction> & result)
{
int lineNo = st->lexems[0]->lineNo;
Bytecode::Instruction l;
l.type = Bytecode::LINE;
l.arg = lineNo;
if (debugLevel_!=GeneratorInterface::NoDebug)
result << l;
result += makeLineInstructions(st->lexems);
quint16 argsCount;
......@@ -1439,12 +1421,7 @@ void Generator::CALL_SPECIAL(int modId, int algId, int level, const AST::Stateme
void Generator::IFTHENELSE(int modId, int algId, int level, const AST::StatementPtr st, QList<Bytecode::Instruction> &result)
{
int jzIP = -1;
int lineNo = st->lexems[0]->lineNo;
Bytecode::Instruction l;
l.type = Bytecode::LINE;
l.arg = lineNo;
if (debugLevel_!=GeneratorInterface::NoDebug)
result << l;
result += makeLineInstructions(st->lexems);
if (st->conditionals[0].condition) {
QList<Bytecode::Instruction> conditionInstructions = calculate(modId, algId, level, st->conditionals[0].condition);
......@@ -1467,6 +1444,8 @@ void Generator::IFTHENELSE(int modId, int algId, int level, const AST::Statement
garbage.type = Bytecode::LINE;
garbage.arg = st->headerErrorLine;
result << garbage;
Bytecode::setColumnPositionsToLineInstruction(garbage, 0u, 0u);
result << garbage;
garbage.type = Bytecode::ERRORR;
garbage.scope = Bytecode::CONSTT;
garbage.arg = constantValue(Bytecode::VT_string, 0,
......@@ -1484,18 +1463,19 @@ void Generator::IFTHENELSE(int modId, int algId, int level, const AST::Statement
}
Bytecode::Instruction ll, error;
if (st->conditionals[0].conditionError.size()>0) {
ll.type = Bytecode::LINE;
if (st->conditionals[0].lexems.isEmpty())
ll.arg = st->lexems[0]->lineNo;
else
ll.arg = st->conditionals[0].lexems[0]->lineNo;
Bytecode::Instruction error;
if (st->conditionals[0].conditionError.size()>0) {
if (st->conditionals[0].lexems.isEmpty()) {
result += makeLineInstructions(st->lexems);
}
else {
result += makeLineInstructions(st->conditionals[0].lexems);
}
const QString msg = ErrorMessages::message("KumirAnalizer", QLocale::Russian, st->conditionals[0].conditionError);
error.type = Bytecode::ERRORR;
error.scope = Bytecode::CONSTT;
error.arg = constantValue(Bytecode::VT_string, 0, msg, QString(), QString());
result << ll << error;
result << error;
}
else {
QList<Bytecode::Instruction> thenInstrs = instructions(modId, algId, level, st->conditionals[0].body);
......@@ -1514,15 +1494,16 @@ void Generator::IFTHENELSE(int modId, int algId, int level, const AST::Statement
result[jzIP].arg = result.size();
if (st->conditionals[1].conditionError.size()>0) {
const QString msg = ErrorMessages::message("KumirAnalizer", QLocale::Russian, st->conditionals[1].conditionError);
ll.type = Bytecode::LINE;
if (st->conditionals[1].lexems.isEmpty())
ll.arg = st->lexems[0]->lineNo;
else
ll.arg = st->conditionals[1].lexems[0]->lineNo;
if (st->conditionals[1].lexems.isEmpty()) {
result += makeLineInstructions(st->lexems);
}
else {
result += makeLineInstructions(st->conditionals[1].lexems);
}
error.type = Bytecode::ERRORR;
error.scope = Bytecode::CONSTT;
error.arg = constantValue(Bytecode::VT_string, 0, msg, QString(), QString());
result << ll << error;
result << error;
}
else {
QList<Bytecode::Instruction> elseInstrs = instructions(modId, algId, level, st->conditionals[1].body);
......@@ -1534,15 +1515,16 @@ void Generator::IFTHENELSE(int modId, int algId, int level, const AST::Statement
if (st->endBlockError.size()>0) {
const QString msg = ErrorMessages::message("KumirAnalizer", QLocale::Russian, st->endBlockError);
ll.type = Bytecode::LINE;
if (st->endBlockLexems.size()==0)
ll.arg = st->lexems[0]->lineNo;
else
ll.arg = st->endBlockLexems[0]->lineNo;
if (st->conditionals[0].lexems.isEmpty()) {
result += makeLineInstructions(st->lexems);
}
else {
result += makeLineInstructions(st->endBlockLexems);
}
error.type = Bytecode::ERRORR;
error.scope = Bytecode::CONSTT;
error.arg = constantValue(Bytecode::VT_string, 0, msg, QString(), QString());
result << ll << error;
result << error;
}
}
......@@ -1554,6 +1536,8 @@ void Generator::SWITCHCASEELSE(int modId, int algId, int level, const AST::State
garbage.type = Bytecode::LINE;
garbage.arg = st->headerErrorLine;
result << garbage;
Bytecode::setColumnPositionsToLineInstruction(garbage, 0u, 0u);
result << garbage;
garbage.type = Bytecode::ERRORR;
garbage.scope = Bytecode::CONSTT;
garbage.arg = constantValue(Bytecode::VT_string, 0,
......@@ -1564,12 +1548,8 @@ void Generator::SWITCHCASEELSE(int modId, int algId, int level, const AST::State
return;
}
Bytecode::Instruction l;
l.type = Bytecode::LINE;
if (st->beginBlockError.size()>0) {
if (st->beginBlockError.size()>0) {
const QString error = ErrorMessages::message("KumirAnalizer", QLocale::Russian, st->beginBlockError);
result << l;
Bytecode::Instruction err;
err.type = Bytecode::ERRORR;
err.scope = Bytecode::CONSTT;
......@@ -1588,18 +1568,9 @@ void Generator::SWITCHCASEELSE(int modId, int algId, int level, const AST::State
result[lastJzIp].arg = result.size();
lastJzIp = -1;
}
if (st->conditionals[i].lexems.size()>0) {
int lineNo = st->conditionals[i].lexems[0]->lineNo;
l.arg = lineNo;
}
else {
l.arg = -1;
}
if (debugLevel_!=GeneratorInterface::NoDebug)
result << l;
result += makeLineInstructions(st->conditionals[i].lexems);
if (!st->conditionals[i].conditionError.isEmpty()) {
const QString error = ErrorMessages::message("KumirAnalizer", QLocale::Russian, st->conditionals[i].conditionError);
result << l;
Bytecode::Instruction err;
err.type = Bytecode::ERRORR;
err.scope = Bytecode::CONSTT;
......@@ -1657,12 +1628,7 @@ void Generator::BREAK(int , int , int level,
const AST::StatementPtr st,
QList<Bytecode::Instruction> & result)
{
int lineNo = st->lexems[0]->lineNo;
Bytecode::Instruction l;
l.type = Bytecode::LINE;
l.arg = lineNo;
if (debugLevel_!=GeneratorInterface::NoDebug)
result << l;
result += makeLineInstructions(st->lexems);
Bytecode::Instruction jump;
// jump.type = Bytecode::JUMP;
......@@ -1677,13 +1643,6 @@ void Generator::LOOP(int modId, int algId,
const AST::StatementPtr st,
QList<Bytecode::Instruction> &result)
{
int lineNo = st->lexems[0]->lineNo;
Bytecode::Instruction l;
l.type = Bytecode::LINE;
l.arg = lineNo;
Bytecode::Instruction ctlOn;
ctlOn.module = 0x00;
ctlOn.arg = 0x0001;
......@@ -1696,7 +1655,7 @@ void Generator::LOOP(int modId, int algId,
if (st->beginBlockError.size()>0) {
const QString error = ErrorMessages::message("KumirAnalizer", QLocale::Russian, st->beginBlockError);
result << l;
result += makeLineInstructions(st->lexems);
Bytecode::Instruction err;
err.type = Bytecode::ERRORR;
err.scope = Bytecode::CONSTT;
......@@ -1721,10 +1680,7 @@ void Generator::LOOP(int modId, int algId,
if (st->loop.type==AST::LoopWhile || st->loop.type==AST::LoopForever) {
// Highlight line and clear margin
if (lineNo!=-1) {
if (debugLevel_!=GeneratorInterface::NoDebug)
result << l;
}
result += makeLineInstructions(st->lexems);
if (st->loop.whileCondition) {
// Calculate condition
......@@ -1738,7 +1694,7 @@ void Generator::LOOP(int modId, int algId,
a.registerr = level * 5;
result << a;
if (lineNo!=-1 &&
if (st->lexems.size() > 0 && st->lexems.first()->lineNo!=-1 &&
debugLevel_==GeneratorInterface::LinesAndVariables)
{
if (st->loop.type==AST::LoopWhile) {
......@@ -1753,7 +1709,7 @@ void Generator::LOOP(int modId, int algId,
a.registerr = level * 5;
result << a;
if (lineNo!=-1 &&
if (st->lexems.size() > 0 && st->lexems.first()->lineNo!=-1 &&
debugLevel_==GeneratorInterface::LinesAndVariables)
{
result << clmarg;
......@@ -1761,7 +1717,8 @@ void Generator::LOOP(int modId, int algId,
}
else {
if (lineNo!=-1 && debugLevel_==GeneratorInterface::LinesAndVariables) {
if (st->lexem