Browse Source

add 'deftype' keyword to tokenizer

pull/13/head
nisstyre56 11 years ago
parent
commit
8c84fdec2e
  1. 2
      errors.js
  2. 6
      tokenize.js

2
errors.js

@ -11,7 +11,7 @@ function JSyntaxError(linenum, charnum, message) {
this.errormessage = message; this.errormessage = message;
this.stxerror = function() { this.stxerror = function() {
console.log("Syntax Error\n", console.log("Syntax Error\n",
"Line #", this.linenum-2,"\n", "Line #", this.linenum,"\n",
"Near character #", this.charnum, "\n", "Near character #", this.charnum, "\n",
this.errormessage); this.errormessage);
}; };

6
tokenize.js

@ -299,6 +299,12 @@ function tokenize(tokstream, matchop) {
tokstream = tokstream.substr(5); tokstream = tokstream.substr(5);
break; break;
} }
var deftype = peek(tokstream, "deftype", "deftype");
if (deftype) {
tokens.push(["deftype", "deftype", charnum, linenum]);
tokstream = tokstream.substr(7);
break
}
var def = peek(tokstream, "def", "def"); var def = peek(tokstream, "def", "def");
if (def) { if (def) {
tokens.push(["def", "def", charnum, linenum]); tokens.push(["def", "def", charnum, linenum]);

Loading…
Cancel
Save