You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
807 B
31 lines
807 B
/*
|
|
* This file defines common error objects
|
|
* for reporting on syntax errors, type errors,
|
|
* and perhaps runtime exceptions although I have
|
|
* not thought about how that will work much
|
|
*/
|
|
|
|
function JSyntaxError(linenum, charnum, message) {
|
|
this.linenum = linenum;
|
|
this.charnum = charnum;
|
|
this.errormessage = message;
|
|
this.stxerror = function() {
|
|
console.log("Syntax Error\n",
|
|
"Line #", this.linenum,"\n",
|
|
"Near character #", this.charnum, "\n",
|
|
this.errormessage);
|
|
};
|
|
return this;
|
|
}
|
|
|
|
function JTypeError(linenum, charnum, token, message) {
|
|
this.linenum = linenum;
|
|
this.charnum = charnum;
|
|
this.errormessage = message;
|
|
this.token = token;
|
|
return this;
|
|
}
|
|
|
|
module.exports =
|
|
{JSyntaxError : JSyntaxError,
|
|
JTypeError : JTypeError};
|
|
|