}
this.vt100((this.cursorX != 0 ? '\r\n' : '') + '\u0007? ' + msg +
(this.currentLineIndex >= 0 ?
- ' in line ' + this.program[this.currentLineIndex].lineNumber() :
+ ' in line ' + this.program[this.evalLineIndex].lineNumber() :
'') + '\r\n');
this.gotoState(2 /* STATE_PROMPT */);
this.currentLineIndex = -1;
+ this.evalLineIndex = -1;
return undefined;
};
this.keys = '';
this.line = '';
this.currentLineIndex = -1;
+ this.evalLineIndex = -1;
this.vt100((this.cursorX != 0 ? '\r\n' : '') + '> ');
this.gotoState(3 /* STATE_READLINE */);
return false;
}
} else {
this.currentLineIndex = -1;
+ this.evalLineIndex = -1;
this.tokens = tokens;
this.gotoState(5 /* STATE_EVAL */);
}
};
Demo.prototype.doExec = function() {
- this.tokens = this.program[this.currentLineIndex++].tokens();
+ this.evalLineIndex = this.currentLineIndex++;
+ this.tokens = this.program[this.evalLineIndex].tokens();
this.tokens.reset();
this.doEval();
if (this.currentLineIndex < 0) {
Demo.prototype.factor = function() {
var token = this.tokens.nextToken();
if (!token) {
- return token;
+ return this.error();
}
var value = undefined;
}
this.vt100((this.cursorX != 0 ? '\r\n' : '') + '\u0007? ' + msg +
(this.currentLineIndex >= 0 ?
- ' in line ' + this.program[this.currentLineIndex].lineNumber() :
+ ' in line ' + this.program[this.evalLineIndex].lineNumber() :
'') + '\r\n');
this.gotoState(STATE_PROMPT);
this.currentLineIndex = -1;
+ this.evalLineIndex = -1;
return undefined;
};
this.keys = '';
this.line = '';
this.currentLineIndex = -1;
+ this.evalLineIndex = -1;
this.vt100((this.cursorX != 0 ? '\r\n' : '') + '> ');
this.gotoState(STATE_READLINE);
return false;
}
} else {
this.currentLineIndex = -1;
+ this.evalLineIndex = -1;
this.tokens = tokens;
this.gotoState(STATE_EVAL);
}
};
Demo.prototype.doExec = function() {
- this.tokens = this.program[this.currentLineIndex++].tokens();
+ this.evalLineIndex = this.currentLineIndex++;
+ this.tokens = this.program[this.evalLineIndex].tokens();
this.tokens.reset();
this.doEval();
if (this.currentLineIndex < 0) {
Demo.prototype.factor = function() {
var token = this.tokens.nextToken();
if (!token) {
- return token;
+ return this.error();
}
var value = undefined;