function lexer() { // The order of the Regular Expressions in the list is important! // *do not change the position* Append addtional RegExp's if you found some missing elements. var xulelements = { "=\"&(.*)\.label;\"" : "=\"$1\"", "=\"&(.*)\.(.*);\"" : "=\"$1.$2\"", "<.*xml version=\"1.0\" \?>" : "", "<.*xml-(.*)>" : "", "<.*xml version(.*)>" : "", "" : "", "\n\n\n" : "\n", "xmlns:html=\"http://www.w3.org/1999/xhtml\"" : "", "xmlns=\"htt(p|ps)://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul\"" : "", "persist=\".*\"" : "", "chrome://" : "./", "" : "", "" : "", "" : "
  • ", "" : "", "" : "", "
    " : "", "" : "", "" : "", "" : "", "" : "", "" : "", "" : "", "" : "", "" : "
    ", "" : "", "" : "
    ", "
    " : "", "" : "", "" : "", "" : "", "" : "", "" : "
    ", "" : "
    ", "" : "", "flex=\"" : "id=\"flex", "oncommand" : "onclick", "" : "", "fixed=\"false\"" : "", "fixed=\"true\"" : "", " = \"" : "=\"", " = '" : "=\"", "= '" : "=\"", " =\"" : "=\"", " ='" : "=\"", "='" : "=\"", "class=\"(.*)\" class=\"(.*)\"" : "class=\"$1 $2\"", "class=\"(.*)\"(.*)class=\"(.*)\"" : "class=\"$1 $3\" $2", "class\"(.*)\" class=\"(.*)\"" : "class=\"$1 $2\"", "broadcast" : "onbroadcast", "close" : "onclose", "command" : "oncommand", "commandupdate" : "oncommandupdate", "contextmenu" : "oncontextmenu", "drag" : "ondrag=", "dragdrop" : "ondragdrop", "dragend" : "ondragend", "dragenter" : "ondragenter", "dragexit" : "ondragexit", "draggesture" : "ondraggesture", "dragover" : "ondragover", "overflow" : "onoverflow", "popuphidden" : "onpopuphidden", "popuphiding" : "onpopuphiding", "popupshowing" : "onpopupshowing", "popupshown" : "onpopupshown", "syncfrompreference" : "onsyncfrompreference", "synctopreference" : "onsynctopreference", "underflow" : "onunderflow", "blur" : "onblur", "change" : "onchange", "click" : "onclick", "dblclick" : "ondblclick", "focus" : "onfocus", "keydown" : "onkeydown", "keypress" : "onkeypress", "keyup" : "onkeyup", "load" : "onload", "mousedown" : "onmousedown", "mousemove" : "onmousemove", "mouseout" : "onmouseout", "mouseover" : "onmouseover", "mouseup" : "onmouseup", "select" : "onselect", "unload": "onunload" }; var XUL_ATTRIBUTES = ['acceltext', 'accessible', 'accesskey', 'activetitlebarcolor', 'afterselected', 'align', 'allowevents', 'allownegativeassertions', 'alternatingbackground', 'alwaysopenpopup', 'attribute', 'autoCheck', 'autocompleteenabled', 'autocompletepopup', 'autocompletesearch', 'autocompletesearchparam', 'autoFill', 'autoFillAfterMatch', 'autoscroll', 'beforeselected', 'buttonaccesskeyaccept', 'buttonaccesskeycancel', 'buttonaccesskeydisclosure', 'buttonaccesskeyextra1', 'buttonaccesskeyextra2', 'buttonaccesskeyhelp', 'buttonalign', 'buttondir', 'buttondisabledaccept', 'buttonlabelaccept', 'buttonlabelcancel', 'buttonlabeldisclosure', 'buttonlabelextra1', 'buttonlabelextra2', 'buttonlabelhelp', 'buttonorient', 'buttonpack', 'buttons', 'checked', 'checkState', 'class', 'closebutton', 'closemenu', 'coalesceduplicatearcs', 'collapse', 'collapsed', 'color', 'cols', 'command', 'commandupdater', 'completedefaultindex', 'container', 'containment', 'contentcontextmenu', 'contenttooltip', 'context', 'contextmenu', 'control', 'crop', 'curpos', 'current', 'currentset', 'customindex', 'customizable', 'cycler', 'datasources', 'decimalplaces', 'default', 'defaultButton', 'defaultset', 'description', 'dir', 'disableAutocomplete', 'disableautoselect', 'disableclose', 'disabled', 'disablehistory', 'disableKeyNavigation', 'disablesecurity', 'dlgtype', 'dragging', 'editable', 'editortype', 'element', 'empty', 'emptytext', 'enableColumnDrag', 'enablehistory', 'equalsize', 'eventnode', 'events', 'expr', 'firstdayofweek', 'firstpage', 'first-tab', 'fixed', 'flags', 'flex', 'focused', 'forceComplete', 'grippyhidden', 'grippytooltiptext', 'group', 'handleCtrlPageUpDown', 'handleCtrlTab', 'height', 'helpURI', 'hidden', 'hidechrome', 'hidecolumnpicker', 'hideheader', 'hideseconds', 'hidespinbuttons', 'highlightnonmatches', 'homepage', 'href', 'icon', 'id', 'ignoreBlurWhileSearching', 'ignorecase', 'ignoreincolumnpicker', 'ignorekeys', 'image', 'inactivetitlebarcolor', 'increment', 'index', 'inputtooltiptext', 'insertafter', 'insertbefore', 'instantApply', 'inverted', 'iscontainer', 'isempty', 'key', 'keycode', 'keytext', 'label', 'lastpage', 'lastSelected', 'last-tab', 'left', 'linkedpanel', 'max', 'maxheight', 'maxlength', 'maxpos', 'maxrows', 'maxwidth', 'member', 'menu', 'menuactive', 'min', 'minheight', 'minResultsForPopup', 'minwidth', 'mode', 'modifiers', 'mousethrough', 'movetoclick', 'multiline', 'multiple', 'name', 'negate', 'newlines', 'next', 'noautofocus', 'noautohide', 'noinitialfocus', 'nomatch', 'norestorefocus', 'object', 'observes', 'onbeforeaccept', 'onbookmarkgroup', 'onchange', 'onclick', 'onclosetab', 'oncommand', 'oncommandupdate', 'ondialogaccept', 'ondialogcancel', 'ondialogclosure', 'ondialogextra1', 'ondialogextra2', 'ondialoghelp', 'onerror', 'onerrorcommand', 'onextra1', 'onextra2', 'oninput', 'onload', 'onnewtab', 'onpageadvanced', 'onpagehide', 'onpagerewound', 'onpageshow', 'onpaneload', 'onpopuphidden', 'onpopuphiding', 'onpopupshowing', 'onpopupshown', 'onsearchcomplete', 'onselect', 'ontextcommand', 'ontextentered', 'ontextrevert', 'ontextreverted', 'onwizardback', 'onwizardcancel', 'onwizardfinish', 'onwizardnext', 'open', 'ordinal', 'orient', 'pack', 'pageid', 'pageincrement', 'pagestep', 'parent', 'parsetype', 'persist', 'persistence', 'phase', 'pickertooltiptext', 'placeholder', 'popup', 'position', 'predicate', 'preference', 'preference-editable', 'primary', 'priority', 'properties', 'querytype', 'readonly', 'ref', 'rel', 'removeelement', 'resizeafter', 'resizebefore', 'rows', 'screenX', 'screenY', 'searchbutton', 'searchSessions', 'searchlabel', 'selected', 'selectedIndex', 'seltype', 'setfocus', 'showcaret', 'showCommentColumn', 'showpopup', 'size', 'sizemode', 'sizetopopup', 'smoothscroll', 'sort', 'sortActive', 'sortDirection', 'sortResource', 'sortResource2', 'spellcheck', 'src', 'state', 'statedatasource', 'statusbar', 'statustext', 'style', 'subject', 'substate', 'suppressonselect', 'tabindex', 'tabScrolling', 'targets', 'template', 'timeout', 'title', 'toolbarname', 'tooltip', 'tooltiptext', 'tooltiptextnew', 'top', 'type', 'uri', 'userAction', 'validate', 'value', 'var', 'wait-cursor', 'width', 'windowtype', 'wrap', 'wraparound']; var sourcecode = document.getElementById('xulsource').value; for (var v in xulelements) { sourcecode = sourcecode.replace(new RegExp(v, "gim"), xulelements[v]); } document.getElementById('xulsource').value = sourcecode; writeFrame('iframe',sourcecode); } function writeFrame(id,data) { document.getElementById('data').innerHTML = data; } function loadSample() { var sample = "\ \n\t\t\t\t\t\t\t\t\ \n\t\t\t\t\t\t\t\t\t\ \n\t\t\t\t\t\t\t\t\ \n\t\t\t\t\t\t\t\t\ \n\t\t\t\t\t\t\t\t\ \n\t\t\t\t\t\t\t\t\t