// Setup editors function setupInfoArea(id) { const e = ace.edit(id); e.setShowPrintMargin(false); e.setOptions({ readOnly: true, highlightActiveLine: false, highlightGutterLine: false }) e.renderer.$cursorLayer.element.style.opacity=0; return e; } function setupEditorArea(id, lsKey) { const e = ace.edit(id); e.setShowPrintMargin(false); e.setValue(localStorage.getItem(lsKey) || ''); e.moveCursorTo(0, 0); return e; } const grammar = setupEditorArea("grammar-editor", "grammarText"); const code = setupEditorArea("code-editor", "codeText"); const codeAst = setupInfoArea("code-ast"); const codeAstOptimized = setupInfoArea("code-ast-optimized"); const codeProfile = setupInfoArea("code-profile"); $('#opt-mode').val(localStorage.getItem('optimizationMode') || 'all'); $('#start-rule').val(localStorage.getItem('startRule') || ''); $('#packrat').prop('checked', localStorage.getItem('packrat') === 'true'); $('#auto-refresh').prop('checked', localStorage.getItem('autoRefresh') === 'true'); $('#parse').prop('disabled', $('#auto-refresh').prop('checked')); // Parse function escapeHtml(unsafe) { return unsafe .replace(/&/g, "&") .replace(//g, ">") .replace(/"/g, """) .replace(/'/g, "'"); } function generateErrorListHTML(errors) { let html = '