An experiment in parentheses-free lisp (in JavaScript)
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.
 
 

35 lines
813 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
*/
var JLException = {
stxerror :
function () {
console.log("There was an error\n",
"Line #",this.linenum,"\n",
"Character #", this.charnum,"\n",
this.errormessage);
},
type_error :
function () {
return;
}
}
function SyntaxError(linenum, charnum, message) {
this.linenum = linenum;
this.charnum = charnum;
this.errormessage = message;
return this;
}
function TypeError(linenum, charnum, token, message) {
this.linenum = linenum;
this.charnum = charnum;
this.errormessage = message;
this.token = token;
return this;
}