Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function compile(){
var src = oberonEditor.getValue();
var result;
var errors = "";
var start = new Date();
try {
var language = require(
document.getElementById("eberon").checked
? "eberon/eberon_grammar.js"
: "oberon/oberon_grammar.js").language;
var options = {checkIndexes: document.getElementById("checkIndexesOption").checked};
result = require("oc.js").compile(
src,
language,
function(e){errors += e;},
options
);
}
catch (e) {
errors += e;
}
var compileTime = (new Date() - start) / 1000;
if (!result)
result = "";
javascriptEditor.setValue(result);
document.getElementById("compileErrors").textContent = errors;
document.getElementById("compileTime").textContent = "compile time (seconds): " + compileTime;