eval(readFile('Compiled_LJS_Parser')) eval(readFile('Compiled_LJS_Helpers')) ometa LJS2JS <: JSTranslator { loop curlyTrans:body -> { wrapLoop('$tLoop.loop', 'while (true)' + body)}, stop -> { doOrPropagate('$tAction.br', '$tLoop.loop', 'break', 'break')}, start trans:body -> { wrapLoop('$tLoop.start', 'while (true) {' + body + 'break;}')}, repeat -> { doOrPropagate('$tAction.cont', '$tLoop.start', 'continue', 'break')}, while trans:cond curlyTrans:body -> { wrapLoop('$tLoop.js', 'while(' + cond + ')' + body) }, break -> { doOrPropagate('$tAction.br', '$tLoop.js', 'break', 'break') }, continue -> { doOrPropagate('$tAction.cont', '$tLoop.js', 'continue', 'break') }, taskswitcher trans:firstTask trans:body -> { '$tLoop.ts.currentTask = ' + firstTask + ';' + wrapLoop('$tLoop.ts', 'while (true) {' + body + 'break; }' ) }, runtask trans:e -> { '$tLoop.ts.currentTask = ' + e + ';' + doOrPropagate('$tAction.cont', '$tLoop.ts', 'continue', 'break') }, task trans:e curlyTrans:body -> { 'if ($tLoop.ts.currentTask == ' + e + ')' + body }, exittask -> { doOrPropagate('$tAction.br', '$tLoop.ts', 'break', 'break') } } programStr = ' var i = 1; start { loop { while (true) { if (i > 0) { alert(i); i--; repeat; } else stop; } } } alert("ok") ' programStr2 = ' loop { taskswitcher : 1 { task 1 {alert(1);runtask 2;} task 2 {alert(2);stop;} } alert("exited from the task switcher"); } ' a = LJS2JSParser.matchAll(programStr2, "topLevel") b = LJS2JS.match(a, "trans") eval(b)