mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-16 16:06:06 +09:00
basic: somewhat improved error messages
This commit is contained in:
@@ -104,7 +104,7 @@ lang.refError = function(line, obj) {
|
|||||||
};
|
};
|
||||||
lang.nowhereToReturn = function(line) { return "RETURN without GOSUB in " + line; };
|
lang.nowhereToReturn = function(line) { return "RETURN without GOSUB in " + line; };
|
||||||
lang.errorinline = function(line, stmt, errobj) {
|
lang.errorinline = function(line, stmt, errobj) {
|
||||||
return Error('Error'+((line !== undefined) ? (" in "+line) : "")+' on statement "'+stmt+'": '+errobj);
|
return Error('Error'+((line !== undefined) ? (" in "+line) : "")+' on "'+stmt+'": '+errobj);
|
||||||
};
|
};
|
||||||
lang.parserError = function(line, errorobj) {
|
lang.parserError = function(line, errorobj) {
|
||||||
return Error("Parser error in " + line + ": " + errorobj);
|
return Error("Parser error in " + line + ": " + errorobj);
|
||||||
@@ -290,6 +290,7 @@ let resolve = function(variable) {
|
|||||||
return variable.troValue;
|
return variable.troValue;
|
||||||
else if (variable.troType == "lit") {
|
else if (variable.troType == "lit") {
|
||||||
var basicVar = bStatus.vars[variable.troValue];
|
var basicVar = bStatus.vars[variable.troValue];
|
||||||
|
if (basicVar === undefined) throw lang.refError(undefined, variable.troValue);
|
||||||
if (basicVar.bvLiteral === "") return "";
|
if (basicVar.bvLiteral === "") return "";
|
||||||
return (basicVar !== undefined) ? basicVar.bvLiteral : undefined;
|
return (basicVar !== undefined) ? basicVar.bvLiteral : undefined;
|
||||||
}
|
}
|
||||||
@@ -340,8 +341,8 @@ let curryDefun = function(inputTree, inputValue) {
|
|||||||
return exprTree;
|
return exprTree;
|
||||||
}
|
}
|
||||||
let argCheckErr = function(lnum, o) {
|
let argCheckErr = function(lnum, o) {
|
||||||
if (o === undefined || o.troType == "null") throw lang.refError(lnum, o);
|
if (o === undefined || o.troType == "null") throw lang.refError(lnum, "(variable undefined)");
|
||||||
if (o.troType == "lit" && bStatus.vars[o.troValue] === undefined) throw lang.refError(lnum, o);
|
if (o.troType == "lit" && bStatus.vars[o.troValue] === undefined) throw lang.refError(lnum, o.troValue);
|
||||||
}
|
}
|
||||||
let oneArg = function(lnum, stmtnum, args, action) {
|
let oneArg = function(lnum, stmtnum, args, action) {
|
||||||
if (args.length != 1) throw lang.syntaxfehler(lnum, args.length+lang.aG);
|
if (args.length != 1) throw lang.syntaxfehler(lnum, args.length+lang.aG);
|
||||||
|
|||||||
Reference in New Issue
Block a user