Simplify tokenizers; remove jslint cruft
This commit is contained in:
parent
73802c7eb7
commit
e2891cfcef
71
basic.js
71
basic.js
|
@ -51,10 +51,7 @@ if(!Array.prototype.reduce){Array.prototype.reduce=function(fun){if(this===void
|
||||||
// Functions from harmony.js, via jsmin, for running via console
|
// Functions from harmony.js, via jsmin, for running via console
|
||||||
if(!String.prototype.repeat){String.prototype.repeat=function(count){var array=[];array.length=count+1;return array.join(String(this));};}
|
if(!String.prototype.repeat){String.prototype.repeat=function(count){var array=[];array.length=count+1;return array.join(String(this));};}
|
||||||
|
|
||||||
/*global window, java*/
|
|
||||||
var basic = (function() {
|
var basic = (function() {
|
||||||
/*jslint bitwise: false, onevar:false*/
|
|
||||||
function unused() { } // explicitly mark unused parameters (for jslint)
|
|
||||||
|
|
||||||
var basic = {
|
var basic = {
|
||||||
STATE_STOPPED: 0,
|
STATE_STOPPED: 0,
|
||||||
|
@ -360,7 +357,7 @@ var basic = (function() {
|
||||||
|
|
||||||
var regexWhitespace = /^[ \t]+/,
|
var regexWhitespace = /^[ \t]+/,
|
||||||
regexQuotedString = /^"([^"]*?)"/,
|
regexQuotedString = /^"([^"]*?)"/,
|
||||||
regexUnquotedString = /^([^:,\r\n]*)/,
|
regexUnquotedString = /^[^:,\r\n]*/,
|
||||||
regexComma = /^,/;
|
regexComma = /^,/;
|
||||||
|
|
||||||
return function _parseDataInput(stream, items) {
|
return function _parseDataInput(stream, items) {
|
||||||
|
@ -373,7 +370,7 @@ var basic = (function() {
|
||||||
items.push(stream.lastMatch[1]);
|
items.push(stream.lastMatch[1]);
|
||||||
} else if (stream.match(regexUnquotedString)) {
|
} else if (stream.match(regexUnquotedString)) {
|
||||||
// unquoted string
|
// unquoted string
|
||||||
items.push(stream.lastMatch[1]);
|
items.push(stream.lastMatch[0]);
|
||||||
}
|
}
|
||||||
} while (stream.match(regexComma));
|
} while (stream.match(regexComma));
|
||||||
};
|
};
|
||||||
|
@ -382,7 +379,6 @@ var basic = (function() {
|
||||||
|
|
||||||
basic.compile = function _compile(source) {
|
basic.compile = function _compile(source) {
|
||||||
"use strict";
|
"use strict";
|
||||||
/*jslint continue: true*/ // for readability
|
|
||||||
|
|
||||||
function vartype(name) {
|
function vartype(name) {
|
||||||
var s = name.charAt(name.length - 1);
|
var s = name.charAt(name.length - 1);
|
||||||
|
@ -458,20 +454,20 @@ var basic = (function() {
|
||||||
0x00E6: function(v) { if (env.display) { env.display.hires_plotting_page = (v === 64 ? 2 : 1); } },
|
0x00E6: function(v) { if (env.display) { env.display.hires_plotting_page = (v === 64 ? 2 : 1); } },
|
||||||
|
|
||||||
// Keyboard strobe
|
// Keyboard strobe
|
||||||
0xC010: function(v) { unused(v); if (env.tty.clearKeyboardStrobe) { env.tty.clearKeyboardStrobe(); } },
|
0xC010: function(v) { if (env.tty.clearKeyboardStrobe) { env.tty.clearKeyboardStrobe(); } },
|
||||||
|
|
||||||
// Display switches
|
// Display switches
|
||||||
0xC050: function(v) { unused(v); if (env.display) { env.display.setState("graphics", true); } }, // Graphics
|
0xC050: function(v) { if (env.display) { env.display.setState("graphics", true); } }, // Graphics
|
||||||
0xC051: function(v) { unused(v); if (env.display) { env.display.setState("graphics", false); } }, // Text
|
0xC051: function(v) { if (env.display) { env.display.setState("graphics", false); } }, // Text
|
||||||
0xC052: function(v) { unused(v); if (env.display) { env.display.setState("full", true); } }, // Full Graphics
|
0xC052: function(v) { if (env.display) { env.display.setState("full", true); } }, // Full Graphics
|
||||||
0xC053: function(v) { unused(v); if (env.display) { env.display.setState("full", false); } }, // Split Screen
|
0xC053: function(v) { if (env.display) { env.display.setState("full", false); } }, // Split Screen
|
||||||
0xC054: function(v) { unused(v); if (env.display) { env.display.setState("page1", true); } }, // Page 1
|
0xC054: function(v) { if (env.display) { env.display.setState("page1", true); } }, // Page 1
|
||||||
0xC055: function(v) { unused(v); if (env.display) { env.display.setState("page1", false); } }, // Page 2
|
0xC055: function(v) { if (env.display) { env.display.setState("page1", false); } }, // Page 2
|
||||||
0xC056: function(v) { unused(v); if (env.display) { env.display.setState("lores", true); } }, // Lo-Res
|
0xC056: function(v) { if (env.display) { env.display.setState("lores", true); } }, // Lo-Res
|
||||||
0xC057: function(v) { unused(v); if (env.display) { env.display.setState("lores", false); } }, // Hi-Res
|
0xC057: function(v) { if (env.display) { env.display.setState("lores", false); } }, // Hi-Res
|
||||||
|
|
||||||
// Speaker toggle
|
// Speaker toggle
|
||||||
0xC030: function(v) { unused(v); } // no-op
|
0xC030: function(v) { } // no-op
|
||||||
};
|
};
|
||||||
|
|
||||||
call_table = {
|
call_table = {
|
||||||
|
@ -528,7 +524,6 @@ var basic = (function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
'on_goto': function ON_GOTO(index, line1, line2 /* ... */) {
|
'on_goto': function ON_GOTO(index, line1, line2 /* ... */) {
|
||||||
unused(line1, line2);
|
|
||||||
index = (index - 1) >> 0;
|
index = (index - 1) >> 0;
|
||||||
var lines = Array.prototype.slice.call(arguments, 1);
|
var lines = Array.prototype.slice.call(arguments, 1);
|
||||||
|
|
||||||
|
@ -547,7 +542,6 @@ var basic = (function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
'on_gosub': function ON_GOSUB(index, line1, line2 /* ... */) {
|
'on_gosub': function ON_GOSUB(index, line1, line2 /* ... */) {
|
||||||
unused(line1, line2);
|
|
||||||
index = (index - 1) >> 0;
|
index = (index - 1) >> 0;
|
||||||
var lines = Array.prototype.slice.call(arguments, 1);
|
var lines = Array.prototype.slice.call(arguments, 1);
|
||||||
if (index < 0 || index >= lines.length) {
|
if (index < 0 || index >= lines.length) {
|
||||||
|
@ -597,8 +591,6 @@ var basic = (function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
'next': function NEXT(var1, var2 /* ... */) {
|
'next': function NEXT(var1, var2 /* ... */) {
|
||||||
unused(var1, var2);
|
|
||||||
|
|
||||||
var varnames = Array.prototype.slice.call(arguments),
|
var varnames = Array.prototype.slice.call(arguments),
|
||||||
varname, stack_record, value;
|
varname, stack_record, value;
|
||||||
do {
|
do {
|
||||||
|
@ -669,8 +661,6 @@ var basic = (function() {
|
||||||
|
|
||||||
// PERF: optimize by turning into a function, e.g. "state.parsevar(name, lib.read())"
|
// PERF: optimize by turning into a function, e.g. "state.parsevar(name, lib.read())"
|
||||||
'read': function READ(lvalue1, lvalue2 /* ... */) {
|
'read': function READ(lvalue1, lvalue2 /* ... */) {
|
||||||
unused(lvalue1, lvalue2);
|
|
||||||
|
|
||||||
var lvalues = Array.prototype.slice.call(arguments);
|
var lvalues = Array.prototype.slice.call(arguments);
|
||||||
while (lvalues.length) {
|
while (lvalues.length) {
|
||||||
if (state.data_index >= state.data.length) {
|
if (state.data_index >= state.data.length) {
|
||||||
|
@ -688,8 +678,6 @@ var basic = (function() {
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
'print': function PRINT(string1, string2 /* ... */) {
|
'print': function PRINT(string1, string2 /* ... */) {
|
||||||
unused(string1, string2);
|
|
||||||
|
|
||||||
var args = Array.prototype.slice.call(arguments), arg;
|
var args = Array.prototype.slice.call(arguments), arg;
|
||||||
while (args.length) {
|
while (args.length) {
|
||||||
arg = args.shift();
|
arg = args.shift();
|
||||||
|
@ -745,7 +733,6 @@ var basic = (function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
'input': function INPUT(prompt, var1, var2 /* ... */) {
|
'input': function INPUT(prompt, var1, var2 /* ... */) {
|
||||||
unused(var1, var2);
|
|
||||||
var varlist = Array.prototype.slice.call(arguments, 1); // copy for closure
|
var varlist = Array.prototype.slice.call(arguments, 1); // copy for closure
|
||||||
var im, ih;
|
var im, ih;
|
||||||
im = function(cb) { return env.tty.readLine(cb, prompt); };
|
im = function(cb) { return env.tty.readLine(cb, prompt); };
|
||||||
|
@ -941,8 +928,6 @@ var basic = (function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
'hplot': function HPLOT(x1, y1, x2, y2 /* ... */) {
|
'hplot': function HPLOT(x1, y1, x2, y2 /* ... */) {
|
||||||
unused(x1, y1, x2, y2);
|
|
||||||
|
|
||||||
var hires = env.display.hires_plotting_page === 2 ? env.hires2 : env.hires;
|
var hires = env.display.hires_plotting_page === 2 ? env.hires2 : env.hires;
|
||||||
if (!hires) { runtime_error('Hires graphics not supported'); }
|
if (!hires) { runtime_error('Hires graphics not supported'); }
|
||||||
|
|
||||||
|
@ -969,8 +954,6 @@ var basic = (function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
'hplot_to': function HPLOT_TO(x1, y1, x2, y2 /* ... */) {
|
'hplot_to': function HPLOT_TO(x1, y1, x2, y2 /* ... */) {
|
||||||
unused(x1, y1, x2, y2);
|
|
||||||
|
|
||||||
var hires = env.display.hires_plotting_page === 2 ? env.hires2 : env.hires;
|
var hires = env.display.hires_plotting_page === 2 ? env.hires2 : env.hires;
|
||||||
if (!hires) { runtime_error('Hires graphics not supported'); }
|
if (!hires) { runtime_error('Hires graphics not supported'); }
|
||||||
|
|
||||||
|
@ -1071,8 +1054,6 @@ var basic = (function() {
|
||||||
|
|
||||||
// Apply a signature [return_type, arg0_type, arg1_type, ...] to a function
|
// Apply a signature [return_type, arg0_type, arg1_type, ...] to a function
|
||||||
function funcsign(func, return_type, arg0_type, arg1_type /* ... */) {
|
function funcsign(func, return_type, arg0_type, arg1_type /* ... */) {
|
||||||
unused(return_type, arg0_type, arg1_type);
|
|
||||||
|
|
||||||
func.signature = Array.prototype.slice.call(arguments, 1);
|
func.signature = Array.prototype.slice.call(arguments, 1);
|
||||||
return func;
|
return func;
|
||||||
}
|
}
|
||||||
|
@ -1126,7 +1107,7 @@ var basic = (function() {
|
||||||
funlib[kws.MID$] = funcsign(function MID$(s, n, n2) { return n2 === (void 0) ? s.substring(n - 1) : s.substring(n - 1, n + n2 - 1); }, 'string', 'string', 'number', 'number?');
|
funlib[kws.MID$] = funcsign(function MID$(s, n, n2) { return n2 === (void 0) ? s.substring(n - 1) : s.substring(n - 1, n + n2 - 1); }, 'string', 'string', 'number', 'number?');
|
||||||
funlib[kws.RIGHT$] = funcsign(function RIGHT$(s, n) { return s.length < n ? s : s.substring(s.length - n); }, 'string', 'string', 'number');
|
funlib[kws.RIGHT$] = funcsign(function RIGHT$(s, n) { return s.length < n ? s : s.substring(s.length - n); }, 'string', 'string', 'number');
|
||||||
|
|
||||||
funlib[kws.POS] = funcsign(function POS(n) { unused(n); return env.tty.getCursorPosition().x; }, 'number', 'number');
|
funlib[kws.POS] = funcsign(function POS(n) { return env.tty.getCursorPosition().x; }, 'number', 'number');
|
||||||
funlib[kws.SCRN] = funcsign(function SCRN(x, y) {
|
funlib[kws.SCRN] = funcsign(function SCRN(x, y) {
|
||||||
if (!env.lores) { runtime_error("Graphics not supported"); }
|
if (!env.lores) { runtime_error("Graphics not supported"); }
|
||||||
x = x >> 0;
|
x = x >> 0;
|
||||||
|
@ -1160,7 +1141,6 @@ var basic = (function() {
|
||||||
}
|
}
|
||||||
}, 'number', 'number');
|
}, 'number', 'number');
|
||||||
funlib[kws.FRE] = funcsign(function FRE(n) {
|
funlib[kws.FRE] = funcsign(function FRE(n) {
|
||||||
unused(n);
|
|
||||||
return JSON ? JSON.stringify([state.variables, state.arrays, state.functions]).length : 0;
|
return JSON ? JSON.stringify([state.variables, state.arrays, state.functions]).length : 0;
|
||||||
}, 'number', 'number');
|
}, 'number', 'number');
|
||||||
funlib[kws.PEEK] = funcsign(function PEEK(address) {
|
funlib[kws.PEEK] = funcsign(function PEEK(address) {
|
||||||
|
@ -1172,7 +1152,7 @@ var basic = (function() {
|
||||||
}, 'number', 'number');
|
}, 'number', 'number');
|
||||||
|
|
||||||
// Not supported
|
// Not supported
|
||||||
funlib[kws.USR] = funcsign(function USR(n) { unused(n); runtime_error("USR Function not supported"); }, 'number', 'number');
|
funlib[kws.USR] = funcsign(function USR(n) { runtime_error("USR Function not supported"); }, 'number', 'number');
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -1238,11 +1218,12 @@ var basic = (function() {
|
||||||
var regexReservedWords = new RegExp("^(" + RESERVED_WORDS.map(munge).join("|") + ")", "i"),
|
var regexReservedWords = new RegExp("^(" + RESERVED_WORDS.map(munge).join("|") + ")", "i"),
|
||||||
regexIdentifier = /^([A-Za-z][A-Za-z0-9]?)[A-Za-z0-9]*(\$|%)?/,
|
regexIdentifier = /^([A-Za-z][A-Za-z0-9]?)[A-Za-z0-9]*(\$|%)?/,
|
||||||
regexStringLiteral = /^"([^"]*?)(?:"|(?=\n|\r|$))/,
|
regexStringLiteral = /^"([^"]*?)(?:"|(?=\n|\r|$))/,
|
||||||
regexNumberLiteral = /^([0-9]*\.?[0-9]+(?:[eE]\s*[\-+]?\s*[0-9]+)?)/,
|
regexNumberLiteral = /^[0-9]*\.?[0-9]+(?:[eE]\s*[\-+]?\s*[0-9]+)?/,
|
||||||
|
regexHexLiteral = /^\$[0-9A-Fa-f]+/,
|
||||||
regexOperator = /^(;|<[ \t]*=|=[ \t]*<|>[ \t]*=|=[ \t]*>|=[ \t]*=|<[ \t]*>|>[ \t]*<|=|<|>|\+|-|\*|\/|\^|\(|\)|,)/,
|
regexOperator = /^(;|<[ \t]*=|=[ \t]*<|>[ \t]*=|=[ \t]*>|=[ \t]*=|<[ \t]*>|>[ \t]*<|=|<|>|\+|-|\*|\/|\^|\(|\)|,)/,
|
||||||
|
|
||||||
regexLineNumber = /^([0-9]+)/,
|
regexLineNumber = /^[0-9]+/,
|
||||||
regexSeparator = /^(:)/,
|
regexSeparator = /^:/,
|
||||||
|
|
||||||
regexRemark = new RegExp('^(' + munge(kws.REM) + '([^\r\n]*))', 'i'),
|
regexRemark = new RegExp('^(' + munge(kws.REM) + '([^\r\n]*))', 'i'),
|
||||||
regexData = new RegExp('^(' + munge(kws.DATA) + ')', 'i'),
|
regexData = new RegExp('^(' + munge(kws.DATA) + ')', 'i'),
|
||||||
|
@ -1288,10 +1269,10 @@ var basic = (function() {
|
||||||
|
|
||||||
if (newline) {
|
if (newline) {
|
||||||
if (stream.match(regexLineNumber)) {
|
if (stream.match(regexLineNumber)) {
|
||||||
token.lineNumber = Number(stream.lastMatch[1]);
|
token.lineNumber = Number(stream.lastMatch[0]);
|
||||||
} else if (stream.match(regexSeparator)) {
|
} else if (stream.match(regexSeparator)) {
|
||||||
// Extension - allow leading : to continue previous line
|
// Extension - allow leading : to continue previous line
|
||||||
token.separator = stream.lastMatch[1];
|
token.separator = stream.lastMatch[0];
|
||||||
} else {
|
} else {
|
||||||
parse_error("Syntax error: Expected line number or separator");
|
parse_error("Syntax error: Expected line number or separator");
|
||||||
}
|
}
|
||||||
|
@ -1308,11 +1289,13 @@ var basic = (function() {
|
||||||
} else if (stream.match(regexStringLiteral)) {
|
} else if (stream.match(regexStringLiteral)) {
|
||||||
token.string = stream.lastMatch[1];
|
token.string = stream.lastMatch[1];
|
||||||
} else if (stream.match(regexNumberLiteral)) {
|
} else if (stream.match(regexNumberLiteral)) {
|
||||||
token.number = parseFloat(stream.lastMatch[1].replace(/\s+/g, ''));
|
token.number = parseFloat(stream.lastMatch[0].replace(/\s+/g, ''));
|
||||||
|
} else if (stream.match(regexHexLiteral)) {
|
||||||
|
token.number = parseInt(stream.lastMatch[0].substring(1), 16);
|
||||||
} else if (stream.match(regexOperator)) {
|
} else if (stream.match(regexOperator)) {
|
||||||
token.operator = stream.lastMatch[1].replace(/\s+/g, '');
|
token.operator = stream.lastMatch[0].replace(/\s+/g, '');
|
||||||
} else if (stream.match(regexSeparator)) {
|
} else if (stream.match(regexSeparator)) {
|
||||||
token.separator = stream.lastMatch[1];
|
token.separator = stream.lastMatch[0];
|
||||||
} else {
|
} else {
|
||||||
parse_error("Syntax error: Unexpected '" + source.substr(0, 40) + "'");
|
parse_error("Syntax error: Unexpected '" + source.substr(0, 40) + "'");
|
||||||
}
|
}
|
||||||
|
@ -1713,7 +1696,6 @@ var basic = (function() {
|
||||||
function parseCommand() {
|
function parseCommand() {
|
||||||
|
|
||||||
function slib(name, arg0, arg1 /* ... */) {
|
function slib(name, arg0, arg1 /* ... */) {
|
||||||
unused(arg0, arg1);
|
|
||||||
var args = Array.prototype.slice.call(arguments, 1);
|
var args = Array.prototype.slice.call(arguments, 1);
|
||||||
return 'lib[' + quote(name) + '](' + args.join(',') + ');';
|
return 'lib[' + quote(name) + '](' + args.join(',') + ');';
|
||||||
}
|
}
|
||||||
|
@ -2142,7 +2124,6 @@ var basic = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
function mkfun(js) {
|
function mkfun(js) {
|
||||||
/*jslint evil:true*/
|
|
||||||
var fun; // NOTE: for IE; would prefer Function()
|
var fun; // NOTE: for IE; would prefer Function()
|
||||||
eval('fun = (function (){' + js + '});');
|
eval('fun = (function (){' + js + '});');
|
||||||
return fun;
|
return fun;
|
||||||
|
@ -2393,8 +2374,6 @@ var basic = (function() {
|
||||||
|
|
||||||
if (typeof window === 'undefined') {
|
if (typeof window === 'undefined') {
|
||||||
(function() {
|
(function() {
|
||||||
/*jslint windows: true, rhino: true */
|
|
||||||
|
|
||||||
var console, program, state, filename, source;
|
var console, program, state, filename, source;
|
||||||
|
|
||||||
if (typeof WScript === 'object') {
|
if (typeof WScript === 'object') {
|
||||||
|
|
53
cm/basic.js
53
cm/basic.js
|
@ -139,41 +139,23 @@ CodeMirror.defineMode('basic', function(config, parserConfig) {
|
||||||
if (stream.eatSpace()) {
|
if (stream.eatSpace()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
else if (/[0-9.]/.test(stream.peek())) {
|
|
||||||
stream.eatWhile(/[0-9]/);
|
if (stream.match(/^[0-9]*\.?[0-9]+(?:[eE]\s*[\-+]?\s*[0-9]+)?/, true)) {
|
||||||
if (stream.peek() === '.') {
|
|
||||||
stream.next();
|
|
||||||
stream.eatWhile(/[0-9]/);
|
|
||||||
}
|
|
||||||
if (/[eE]/.test(stream.peek())) {
|
|
||||||
stream.next();
|
|
||||||
stream.eatWhile(/[ \u00a0]/);
|
|
||||||
if (stream.peek() === '-' || stream.peek() === '+') {
|
|
||||||
stream.next();
|
|
||||||
}
|
|
||||||
stream.eatWhile(/[ \u00a0]/);
|
|
||||||
stream.eatWhile(/[0-9]/);
|
|
||||||
}
|
|
||||||
return 'basic-number';
|
return 'basic-number';
|
||||||
}
|
}
|
||||||
else if (stream.peek() === '"') {
|
if (stream.match(/^\$[0-9A-Fa-f]+/, true)) {
|
||||||
stream.next();
|
return 'basic-number';
|
||||||
while (!stream.eol()) {
|
|
||||||
if (stream.next() === '"') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 'basic-string';
|
|
||||||
}
|
}
|
||||||
else if (/[;=<>+\-*\/\^(),]/.test(stream.peek())) {
|
if (stream.match(/^[;=<>+\-*\/\^(),]/, true)) {
|
||||||
stream.next();
|
|
||||||
return 'basic-operator';
|
return 'basic-operator';
|
||||||
}
|
}
|
||||||
else if (stream.peek() === ':') {
|
if (stream.match(/^:/, true)) {
|
||||||
stream.next();
|
|
||||||
return 'basic-separator';
|
return 'basic-separator';
|
||||||
}
|
}
|
||||||
else if (stream.match('REM', true, true)) {
|
if (stream.match(/^"([^"]*?)(?:"|(?=\n|\r|$))/, true)) {
|
||||||
|
return 'basic-string';
|
||||||
|
}
|
||||||
|
if (stream.match('REM', true, true)) {
|
||||||
stream.eatWhile(/[ \u00a0]/);
|
stream.eatWhile(/[ \u00a0]/);
|
||||||
if (!stream.eol()) {
|
if (!stream.eol()) {
|
||||||
state.state = 'comment';
|
state.state = 'comment';
|
||||||
|
@ -190,30 +172,23 @@ CodeMirror.defineMode('basic', function(config, parserConfig) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (/[A-Za-z]/.test(stream.peek())) {
|
if (stream.match(/[A-Za-z][A-Za-z0-9]*(\$|%)?/, true)) {
|
||||||
stream.next();
|
|
||||||
stream.eatWhile(/[A-Za-z0-9]/);
|
|
||||||
if (stream.peek() === '$' || stream.peek() === '%') {
|
|
||||||
stream.next();
|
|
||||||
}
|
|
||||||
return 'basic-identifier';
|
return 'basic-identifier';
|
||||||
}
|
}
|
||||||
|
|
||||||
stream.next();
|
stream.next();
|
||||||
return 'basic-error';
|
return 'basic-error';
|
||||||
}
|
}
|
||||||
else if (state.state === 'comment') {
|
|
||||||
|
if (state.state === 'comment') {
|
||||||
while (!stream.eol()) {
|
while (!stream.eol()) {
|
||||||
stream.next();
|
stream.next();
|
||||||
}
|
}
|
||||||
state.state = 'normal';
|
state.state = 'normal';
|
||||||
return 'basic-comment';
|
return 'basic-comment';
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
throw 'WTF!?';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
throw 'WTF!?';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
3
dos.js
3
dos.js
|
@ -21,10 +21,7 @@
|
||||||
// var dos = new DOS( tty ) // hooks tty's writeChar/readChar/readLine
|
// var dos = new DOS( tty ) // hooks tty's writeChar/readChar/readLine
|
||||||
// dos.reset() // Close all open buffers
|
// dos.reset() // Close all open buffers
|
||||||
|
|
||||||
/*global basic*/
|
|
||||||
|
|
||||||
function DOS(tty) {
|
function DOS(tty) {
|
||||||
/*jslint bitwise: false, browser: true*/
|
|
||||||
|
|
||||||
var DOSErrors = {
|
var DOSErrors = {
|
||||||
LANGUAGE_NOT_AVAILABLE: [1, "Language not available"],
|
LANGUAGE_NOT_AVAILABLE: [1, "Language not available"],
|
||||||
|
|
1
hires.js
1
hires.js
|
@ -135,7 +135,6 @@ function HiRes(element, width, height) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getPixel = function(x, y) {
|
this.getPixel = function(x, y) {
|
||||||
/*jslint bitwise:false*/
|
|
||||||
return pixels[y * width + x] >>> 0;
|
return pixels[y * width + x] >>> 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
2
lores.js
2
lores.js
|
@ -43,8 +43,6 @@
|
||||||
|
|
||||||
function LoRes(element, width, height) {
|
function LoRes(element, width, height) {
|
||||||
|
|
||||||
/*jslint browser: true*/
|
|
||||||
|
|
||||||
var COLORS, // Apple II to HTML color table
|
var COLORS, // Apple II to HTML color table
|
||||||
loresPixel = [], // element references
|
loresPixel = [], // element references
|
||||||
pixels = [], // color values
|
pixels = [], // color values
|
||||||
|
|
5
tty.js
5
tty.js
|
@ -55,12 +55,7 @@
|
||||||
// </style>
|
// </style>
|
||||||
// <div id="screen" tabindex="0"></div>
|
// <div id="screen" tabindex="0"></div>
|
||||||
|
|
||||||
/*global getClassList*/ // from polyfill.js
|
|
||||||
/*global identifyKey */ // From keyboard.js
|
|
||||||
|
|
||||||
function TTY(screenElement, keyboardElement, bell) {
|
function TTY(screenElement, keyboardElement, bell) {
|
||||||
/*jslint browser: true, white: false, bitwise: false */
|
|
||||||
|
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue