view scripttags.js @ 23:068d63627b16

Populate in scope symbol buttons when clicking on a symbol in the source
author Mike Pavone <pavone@retrodev.com>
date Mon, 26 Mar 2012 21:29:03 -0700
parents 37d7f60a8ea1
children 4d87c38404d6
line wrap: on
line source


function compileAndRun(src)
{
	var ast = parser.parse(src);
	var js = ast.toJSModule();
	mainModule = eval(js)();
	mainModule.main();
}

onReady(function() {
	var tags = qall('script[type="text/tabletprog"]');
	for (var i = 0; i < tags.length; ++i) {
		if (tags[i].src) {
			get(tags[i].src, function(req) {
				compileAndRun(req.responseText);
			});
		} else {
			compileAndRun(tags[i].innerHTML);
		}
	}
});