view testparse.js @ 72:ab6f24d6945d

Fix determination of whether a method call has an implicit self argument or not. Cleanup C warnings in output.
author Mike Pavone <pavone@retrodev.com>
date Sat, 14 Jul 2012 21:00:21 -0700
parents 668f533e5284
children
line wrap: on
line source


onReady(function() {
	q('#parse').onclick = function() {
		var text = q('textarea').value;
		try {
			var parsed = parser.parse(text);
			q('pre').innerHTML = text + "\n\n" + JSON.stringify(parsed);
			console.log(parsed);
		} catch(e) {
			q('pre').innerHTML = e.message + '\nLine: ' + e.line + '\nCol: ' + e.column;
		}
	}
	q('#tojs').onclick = function() {
		var text = q('textarea').value;
		//try {
			var parsed = parser.parse(text);
			var js = parsed.toJSModule();
			q('pre').innerHTML = js;
			console.log(parsed);
		/*} catch(e) {
			q('pre').innerHTML = e.message + '\nLine: ' + e.line + '\nCol: ' + e.column;
		}*/
	}
	q('#toc').onclick = function() {
		var text = q('textarea').value;
		//try {
			var parsed = parser.parse(text);
			var c = parsed.toCModule();
			setText(q('pre'), c);
			console.log(parsed);
		/*} catch(e) {
			q('pre').innerHTML = e.message + '\nLine: ' + e.line + '\nCol: ' + e.column;
		}*/
	}
	q('#run').onclick = function() {
		var text = q('textarea').value;
		//try {
			var parsed = parser.parse(text);
			var js = parsed.toJSModule();
			mainModule = eval(js)();
			q('pre').innerHTML = mainModule.main();
		/*} catch(e) {
			q('pre').innerHTML = e.message + '\nLine: ' + e.line + '\nCol: ' + e.column;
		}*/
	}
});