You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2013/10/29 16:39:46 UTC

[01/51] [partial] working replacement

Updated Branches:
  refs/heads/1911-ace-editor [created] 9abd128cb


http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/xquery/Readme.md
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/xquery/Readme.md b/src/fauxton/assets/js/libs/ace/mode/xquery/Readme.md
new file mode 100644
index 0000000..0ebee1d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/xquery/Readme.md
@@ -0,0 +1,6 @@
+WARNING!
+============================
+
+Files in this folder are generated automatically from the xquery.js project (https://github.com/wcandillon/xquery.js).
+Instructions on how to generate the XQuery parser are available at https://github.com/wcandillon/xquery.js
+


[43/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/emmet.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/emmet.js b/src/fauxton/assets/js/libs/ace/ext/emmet.js
new file mode 100644
index 0000000..6647da4
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/emmet.js
@@ -0,0 +1,415 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+var HashHandler = require("ace/keyboard/hash_handler").HashHandler;
+var Editor = require("ace/editor").Editor;
+var snippetManager = require("ace/snippets").snippetManager;
+var Range = require("ace/range").Range;
+var emmet;
+
+Editor.prototype.indexToPosition = function(index) {
+    return this.session.doc.indexToPosition(index);
+};
+
+Editor.prototype.positionToIndex = function(pos) {
+    return this.session.doc.positionToIndex(pos);
+};
+
+/**
+ * Implementation of {@link IEmmetEditor} interface for Ace
+ */
+function AceEmmetEditor() {}
+
+AceEmmetEditor.prototype = {
+    setupContext: function(editor) {
+        this.ace = editor;
+        this.indentation = editor.session.getTabString();
+        if (!emmet)
+            emmet = window.emmet;
+        emmet.require("resources").setVariable("indentation", this.indentation);
+        this.$syntax = null;
+        this.$syntax = this.getSyntax();
+    },
+    /**
+     * Returns character indexes of selected text: object with <code>start</code>
+     * and <code>end</code> properties. If there's no selection, should return
+     * object with <code>start</code> and <code>end</code> properties referring
+     * to current caret position
+     * @return {Object}
+     * @example
+     * var selection = editor.getSelectionRange();
+     * alert(selection.start + ', ' + selection.end);
+     */
+    getSelectionRange: function() {
+        // TODO should start be caret position instead?
+        var range = this.ace.getSelectionRange();
+        return {
+            start: this.ace.positionToIndex(range.start),
+            end: this.ace.positionToIndex(range.end)
+        };
+    },
+
+    /**
+     * Creates selection from <code>start</code> to <code>end</code> character
+     * indexes. If <code>end</code> is ommited, this method should place caret
+     * and <code>start</code> index
+     * @param {Number} start
+     * @param {Number} [end]
+     * @example
+     * editor.createSelection(10, 40);
+     *
+     * //move caret to 15th character
+     * editor.createSelection(15);
+     */
+    createSelection: function(start, end) {
+        this.ace.selection.setRange({
+            start: this.ace.indexToPosition(start),
+            end: this.ace.indexToPosition(end)
+        });
+    },
+
+    /**
+     * Returns current line's start and end indexes as object with <code>start</code>
+     * and <code>end</code> properties
+     * @return {Object}
+     * @example
+     * var range = editor.getCurrentLineRange();
+     * alert(range.start + ', ' + range.end);
+     */
+    getCurrentLineRange: function() {
+        var row = this.ace.getCursorPosition().row;
+        var lineLength = this.ace.session.getLine(row).length;
+        var index = this.ace.positionToIndex({row: row, column: 0});
+        return {
+            start: index,
+            end: index + lineLength
+        };
+    },
+
+    /**
+     * Returns current caret position
+     * @return {Number|null}
+     */
+    getCaretPos: function(){
+        var pos = this.ace.getCursorPosition();
+        return this.ace.positionToIndex(pos);
+    },
+
+    /**
+     * Set new caret position
+     * @param {Number} index Caret position
+     */
+    setCaretPos: function(index){
+        var pos = this.ace.indexToPosition(index);
+        this.ace.clearSelection();
+        this.ace.selection.moveCursorToPosition(pos);
+    },
+
+    /**
+     * Returns content of current line
+     * @return {String}
+     */
+    getCurrentLine: function() {
+        var row = this.ace.getCursorPosition().row;
+        return this.ace.session.getLine(row);
+    },
+
+    /**
+     * Replace editor's content or it's part (from <code>start</code> to
+     * <code>end</code> index). If <code>value</code> contains
+     * <code>caret_placeholder</code>, the editor will put caret into
+     * this position. If you skip <code>start</code> and <code>end</code>
+     * arguments, the whole target's content will be replaced with
+     * <code>value</code>.
+     *
+     * If you pass <code>start</code> argument only,
+     * the <code>value</code> will be placed at <code>start</code> string
+     * index of current content.
+     *
+     * If you pass <code>start</code> and <code>end</code> arguments,
+     * the corresponding substring of current target's content will be
+     * replaced with <code>value</code>.
+     * @param {String} value Content you want to paste
+     * @param {Number} [start] Start index of editor's content
+     * @param {Number} [end] End index of editor's content
+     * @param {Boolean} [noIndent] Do not auto indent <code>value</code>
+     */
+    replaceContent: function(value, start, end, noIndent) {
+        if (end == null)
+            end = start == null ? this.getContent().length : start;
+        if (start == null)
+            start = 0;        
+        
+        var editor = this.ace;
+        var range = Range.fromPoints(editor.indexToPosition(start), editor.indexToPosition(end));
+        editor.session.remove(range);
+        
+        range.end = range.start;
+        //editor.selection.setRange(range);
+        
+        value = this.$updateTabstops(value);
+        snippetManager.insertSnippet(editor, value)
+    },
+
+    /**
+     * Returns editor's content
+     * @return {String}
+     */
+    getContent: function(){
+        return this.ace.getValue();
+    },
+
+    /**
+     * Returns current editor's syntax mode
+     * @return {String}
+     */
+    getSyntax: function() {
+        if (this.$syntax)
+            return this.$syntax;
+        var syntax = this.ace.session.$modeId.split("/").pop();
+        if (syntax == "html" || syntax == "php") {
+            var cursor = this.ace.getCursorPosition();
+            var state = this.ace.session.getState(cursor.row);
+            if (typeof state != "string")
+                state = state[0];
+            if (state) {
+                state = state.split("-");
+                if (state.length > 1)
+                    syntax = state[0];
+                else if (syntax == "php")
+                    syntax = "html";
+            }
+        }
+        return syntax;
+    },
+
+    /**
+     * Returns current output profile name (@see emmet#setupProfile)
+     * @return {String}
+     */
+    getProfileName: function() {
+        switch(this.getSyntax()) {
+          case "css": return "css";
+          case "xml":
+          case "xsl":
+            return "xml";
+          case "html":
+            var profile = emmet.require("resources").getVariable("profile");
+            // no forced profile, guess from content html or xhtml?
+            if (!profile)
+                profile = this.ace.session.getLines(0,2).join("").search(/<!DOCTYPE[^>]+XHTML/i) != -1 ? "xhtml": "html";
+            return profile;
+        }
+        return "xhtml";
+    },
+
+    /**
+     * Ask user to enter something
+     * @param {String} title Dialog title
+     * @return {String} Entered data
+     * @since 0.65
+     */
+    prompt: function(title) {
+        return prompt(title);
+    },
+
+    /**
+     * Returns current selection
+     * @return {String}
+     * @since 0.65
+     */
+    getSelection: function() {
+        return this.ace.session.getTextRange();
+    },
+
+    /**
+     * Returns current editor's file path
+     * @return {String}
+     * @since 0.65
+     */
+    getFilePath: function() {
+        return "";
+    },
+    
+    // update tabstops: make sure all caret placeholders are unique
+    // by default, abbreviation parser generates all unlinked (un-mirrored)
+    // tabstops as ${0}, so we have upgrade all caret tabstops with unique
+    // positions but make sure that all other tabstops are not linked accidentally
+    // based on https://github.com/sergeche/emmet-sublime/blob/master/editor.js#L119-L171
+    $updateTabstops: function(value) {
+        var base = 1000;
+        var zeroBase = 0;
+        var lastZero = null;
+        var range = emmet.require('range');
+        var ts = emmet.require('tabStops');
+        var settings = emmet.require('resources').getVocabulary("user");
+        var tabstopOptions = {
+            tabstop: function(data) {
+                var group = parseInt(data.group, 10);
+                var isZero = group === 0;
+                if (isZero)
+                    group = ++zeroBase;
+                else
+                    group += base;
+
+                var placeholder = data.placeholder;
+                if (placeholder) {
+                    // recursively update nested tabstops
+                    placeholder = ts.processText(placeholder, tabstopOptions);
+                }
+
+                var result = '${' + group + (placeholder ? ':' + placeholder : '') + '}';
+
+                if (isZero) {
+                    lastZero = range.create(data.start, result);
+                }
+
+                return result
+            },
+            escape: function(ch) {
+                if (ch == '$') return '\\$';
+                if (ch == '\\') return '\\\\';
+                return ch;
+            }
+        };
+
+        value = ts.processText(value, tabstopOptions);
+
+        if (settings.variables['insert_final_tabstop'] && !/\$\{0\}$/.test(value)) {
+            value += '${0}';
+        } else if (lastZero) {
+            value = emmet.require('utils').replaceSubstring(value, '${0}', lastZero);
+        }
+        
+        return value;
+    }
+};
+
+
+var keymap = {
+    expand_abbreviation: {"mac": "ctrl+alt+e", "win": "alt+e"},
+    match_pair_outward: {"mac": "ctrl+d", "win": "ctrl+,"},
+    match_pair_inward: {"mac": "ctrl+j", "win": "ctrl+shift+0"},
+    matching_pair: {"mac": "ctrl+alt+j", "win": "alt+j"},
+    next_edit_point: "alt+right",
+    prev_edit_point: "alt+left",
+    toggle_comment: {"mac": "command+/", "win": "ctrl+/"},
+    split_join_tag: {"mac": "shift+command+'", "win": "shift+ctrl+`"},
+    remove_tag: {"mac": "command+'", "win": "shift+ctrl+;"},
+    evaluate_math_expression: {"mac": "shift+command+y", "win": "shift+ctrl+y"},
+    increment_number_by_1: "ctrl+up",
+    decrement_number_by_1: "ctrl+down",
+    increment_number_by_01: "alt+up",
+    decrement_number_by_01: "alt+down",
+    increment_number_by_10: {"mac": "alt+command+up", "win": "shift+alt+up"},
+    decrement_number_by_10: {"mac": "alt+command+down", "win": "shift+alt+down"},
+    select_next_item: {"mac": "shift+command+.", "win": "shift+ctrl+."},
+    select_previous_item: {"mac": "shift+command+,", "win": "shift+ctrl+,"},
+    reflect_css_value: {"mac": "shift+command+r", "win": "shift+ctrl+r"},
+
+    encode_decode_data_url: {"mac": "shift+ctrl+d", "win": "ctrl+'"},
+    // update_image_size: {"mac": "shift+ctrl+i", "win": "ctrl+u"},
+    // expand_as_you_type: "ctrl+alt+enter",
+    // wrap_as_you_type: {"mac": "shift+ctrl+g", "win": "shift+ctrl+g"},
+    expand_abbreviation_with_tab: "Tab",
+    wrap_with_abbreviation: {"mac": "shift+ctrl+a", "win": "shift+ctrl+a"}
+};
+
+var editorProxy = new AceEmmetEditor();
+exports.commands = new HashHandler();
+exports.runEmmetCommand = function(editor) {
+    editorProxy.setupContext(editor);
+    if (editorProxy.getSyntax() == "php")
+        return false;
+    var actions = emmet.require("actions");
+
+    if (this.action == "expand_abbreviation_with_tab") {
+        if (!editor.selection.isEmpty())
+            return false;
+    }
+    
+    if (this.action == "wrap_with_abbreviation") {
+        // without setTimeout prompt doesn't work on firefox
+        return setTimeout(function() {
+            actions.run("wrap_with_abbreviation", editorProxy);
+        }, 0);
+    }
+    
+    try {
+        var result = actions.run(this.action, editorProxy);
+    } catch(e) {
+        editor._signal("changeStatus", typeof e == "string" ? e : e.message);
+        console.log(e);
+    }
+    return result;
+};
+
+for (var command in keymap) {
+    exports.commands.addCommand({
+        name: "emmet:" + command,
+        action: command,
+        bindKey: keymap[command],
+        exec: exports.runEmmetCommand,
+        multiSelectAction: "forEach"
+    });
+}
+
+var onChangeMode = function(e, target) {
+    var editor = target;
+    if (!editor)
+        return;
+    var modeId = editor.session.$modeId;
+    var enabled = modeId && /css|less|scss|sass|stylus|html|php/.test(modeId);
+    if (e.enableEmmet === false)
+        enabled = false;
+    if (enabled)
+        editor.keyBinding.addKeyboardHandler(exports.commands);
+    else
+        editor.keyBinding.removeKeyboardHandler(exports.commands);
+};
+
+
+exports.AceEmmetEditor = AceEmmetEditor;
+require("ace/config").defineOptions(Editor.prototype, "editor", {
+    enableEmmet: {
+        set: function(val) {
+            this[val ? "on" : "removeListener"]("changeMode", onChangeMode);
+            onChangeMode({enableEmmet: !!val}, this);
+        },
+        value: true
+    }
+});
+
+
+exports.setCore = function(e) {emmet = e;};
+});
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/keybinding_menu.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/keybinding_menu.js b/src/fauxton/assets/js/libs/ace/ext/keybinding_menu.js
new file mode 100644
index 0000000..bf8189a
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/keybinding_menu.js
@@ -0,0 +1,86 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl
+ * All rights reserved.
+ *
+ * Contributed to Ajax.org under the BSD license.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/
+/*global define, require */
+
+/**
+ * Show Keyboard Shortcuts
+ * @fileOverview Show Keyboard Shortcuts <br />
+ * Generates a menu which displays the keyboard shortcuts.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ */
+
+define(function(require, exports, module) {
+    "use strict";
+    var Editor = require("ace/editor").Editor;
+    /**
+     * Generates a menu which displays the keyboard shortcuts.
+     * @author <a href="mailto:matthewkastor@gmail.com">
+     *  Matthew Christopher Kastor-Inare III </a><br />
+     *  ☭ Hial Atropa!! ☭
+     * @param {ace.Editor} editor An instance of the ace editor.
+     */
+    function showKeyboardShortcuts (editor) {
+        // make sure the menu isn't open already.
+        if(!document.getElementById('kbshortcutmenu')) {
+            var overlayPage = require('./menu_tools/overlay_page').overlayPage;
+            var getEditorKeybordShortcuts = require('./menu_tools/get_editor_keyboard_shortcuts').getEditorKeybordShortcuts;
+            var kb = getEditorKeybordShortcuts(editor);
+            var el = document.createElement('div');
+            var commands = kb.reduce(function(previous, current) {
+                return previous + '<div class="ace_optionsMenuEntry"><span class="ace_optionsMenuCommand">' 
+                    + current.command + '</span> : '
+                    + '<span class="ace_optionsMenuKey">' + current.key + '</span></div>';
+            }, '');
+
+            el.id = 'kbshortcutmenu';
+            el.innerHTML = '<h1>Keyboard Shortcuts</h1>' + commands + '</div>';
+            overlayPage(editor, el, '0', '0', '0', null);
+        }
+    };
+    module.exports.init = function(editor) {
+        Editor.prototype.showKeyboardShortcuts = function() {
+            showKeyboardShortcuts(this);
+        };
+        editor.commands.addCommands([{
+            name: "showKeyboardShortcuts",
+            bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"},
+            exec: function(editor, line) {
+                editor.showKeyboardShortcuts();
+            }
+        }]);
+    };
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/language_tools.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/language_tools.js b/src/fauxton/assets/js/libs/ace/ext/language_tools.js
new file mode 100644
index 0000000..e5cd8bb
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/language_tools.js
@@ -0,0 +1,129 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var snippetManager = require("../snippets").snippetManager;
+var Autocomplete = require("../autocomplete").Autocomplete;
+var config = require("../config");
+
+var textCompleter = require("../autocomplete/text_completer");
+var keyWordCompleter = {
+    getCompletions: function(editor, session, pos, prefix, callback) {
+        var state = editor.session.getState(pos.row);
+        var completions = session.$mode.getCompletions(state, session, pos, prefix);
+        callback(null, completions);
+    }
+};
+
+var snippetCompleter = {
+    getCompletions: function(editor, session, pos, prefix, callback) {
+        var scope = snippetManager.$getScope(editor);
+        var snippetMap = snippetManager.snippetMap;
+        var completions = [];
+        [scope, "_"].forEach(function(scope) {
+            var snippets = snippetMap[scope] || [];
+            for (var i = snippets.length; i--;) {
+                var s = snippets[i];
+                var caption = s.name || s.tabTrigger;
+                if (!caption)
+                    continue;
+                completions.push({
+                    caption: caption,
+                    snippet: s.content,
+                    meta: s.tabTrigger && !s.name ? s.tabTrigger + "\u21E5 " : "snippet"
+                });
+            }
+        }, this);
+        callback(null, completions);
+    }
+};
+
+var completers = [snippetCompleter, textCompleter, keyWordCompleter];
+exports.addCompleter = function(completer) {
+    completers.push(completer);
+};
+
+var expandSnippet = {
+    name: "expandSnippet",
+    exec: function(editor) {
+        var success = snippetManager.expandWithTab(editor);
+        if (!success)
+            editor.execCommand("indent");
+    },
+    bindKey: "tab"
+}
+
+var onChangeMode = function(e, editor) {
+    var mode = editor.session.$mode;
+    var id = mode.$id
+    if (!snippetManager.files) snippetManager.files = {};
+    if (id && !snippetManager.files[id]) {
+        var snippetFilePath = id.replace("mode", "snippets");
+        config.loadModule(snippetFilePath, function(m) {
+            if (m) {
+                snippetManager.files[id] = m;
+                m.snippets = snippetManager.parseSnippetFile(m.snippetText);
+                snippetManager.register(m.snippets, m.scope);
+            }
+        });
+    }
+};
+
+var Editor = require("../editor").Editor;
+require("../config").defineOptions(Editor.prototype, "editor", {
+    enableBasicAutocompletion: {
+        set: function(val) {
+            if (val) {
+                this.completers = completers
+                this.commands.addCommand(Autocomplete.startCommand);
+            } else {
+                this.commands.removeCommand(Autocomplete.startCommand);
+            }
+        },
+        value: false
+    },
+    enableSnippets: {
+        set: function(val) {
+            if (val) {
+                this.commands.addCommand(expandSnippet);
+                this.on("changeMode", onChangeMode);
+                onChangeMode(null, this)
+            } else {
+                this.commands.removeCommand(expandSnippet);
+                this.off("changeMode", onChangeMode);
+            }
+        },
+        value: false
+    }
+});
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/menu_tools/add_editor_menu_options.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/menu_tools/add_editor_menu_options.js b/src/fauxton/assets/js/libs/ace/ext/menu_tools/add_editor_menu_options.js
new file mode 100644
index 0000000..fd56859
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/menu_tools/add_editor_menu_options.js
@@ -0,0 +1,103 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl
+ * All rights reserved.
+ *
+ * Contributed to Ajax.org under the BSD license.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/
+/*global define, require */
+
+/**
+ * Add Editor Menu Options
+ * @fileOverview Add Editor Menu Options <br />
+ * The menu options property needs to be added to the editor
+ *  so that the settings menu can know about options for
+ *  selection elements and track which option is selected.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ */
+
+define(function(require, exports, module) {
+'use strict';
+
+/**
+ * The menu options property needs to be added to the editor
+ *  so that the settings menu can know about options for
+ *  selection elements and track which option is selected.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ * @param {ace.Editor} editor An instance of the ace editor.
+ */
+module.exports.addEditorMenuOptions = function addEditorMenuOptions (editor) {
+    var modelist = require('../modelist');
+    var themelist = require('../themelist');
+    editor.menuOptions = {
+        "setNewLineMode" : [{
+            "textContent" : "unix",
+            "value" : "unix"
+        }, {
+            "textContent" : "windows",
+            "value" : "windows"
+        }, {
+            "textContent" : "auto",
+            "value" : "auto"
+        }],
+        "setTheme" : [],
+        "setMode" : [],
+        "setKeyboardHandler": [{
+            "textContent" : "ace",
+            "value" : ""
+        }, {
+            "textContent" : "vim",
+            "value" : "ace/keyboard/vim"
+        }, {
+            "textContent" : "emacs",
+            "value" : "ace/keyboard/emacs"
+        }]
+    };
+
+    editor.menuOptions.setTheme = themelist.themes.map(function(theme) {
+        return {
+            'textContent' : theme.desc,
+            'value' : theme.theme
+        };
+    });
+
+    editor.menuOptions.setMode = modelist.modes.map(function(mode) {
+        return {
+            'textContent' : mode.name,
+            'value' : mode.mode
+        };
+    });
+};
+
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/menu_tools/element_generator.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/menu_tools/element_generator.js b/src/fauxton/assets/js/libs/ace/ext/menu_tools/element_generator.js
new file mode 100644
index 0000000..ec6ba93
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/menu_tools/element_generator.js
@@ -0,0 +1,148 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl
+ * All rights reserved.
+ *
+ * Contributed to Ajax.org under the BSD license.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/
+/*global define, require */
+
+/**
+ * Element Generator
+ * @fileOverview Element Generator <br />
+ * Contains methods for generating elements.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ */
+
+define(function(require, exports, module) {
+'use strict';
+/**
+ * Creates a DOM option element
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ * @param {object} obj An object containing properties to add to the dom
+ *  element. If one of those properties is named `selected` then it will be
+ *  added as an attribute on the element instead.
+ */
+module.exports.createOption = function createOption (obj) {
+    var attribute;
+    var el = document.createElement('option');
+    for(attribute in obj) {
+        if(obj.hasOwnProperty(attribute)) {
+            if(attribute === 'selected') {
+                el.setAttribute(attribute, obj[attribute]);
+            } else {
+                el[attribute] = obj[attribute];
+            }
+        }
+    }
+    return el;
+};
+/**
+ * Creates a DOM checkbox element.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ * @param {string} id The id of the element.
+ * @param {boolean} checked Whether or not the element is checked.
+ * @param {string} clss The class of the element.
+ * @returns {DOMElement} Returns a checkbox element reference.
+ */
+module.exports.createCheckbox = function createCheckbox (id, checked, clss) {
+    var el = document.createElement('input');
+    el.setAttribute('type', 'checkbox');
+    el.setAttribute('id', id);
+    el.setAttribute('name', id);
+    el.setAttribute('value', checked);
+    el.setAttribute('class', clss);
+    if(checked) {
+        el.setAttribute('checked', 'checked');
+    }
+    return el;
+};
+/**
+ * Creates a DOM text input element.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ * @param {string} id The id of the element.
+ * @param {string} value The default value of the input element.
+ * @param {string} clss The class of the element.
+ * @returns {DOMElement} Returns an input element reference.
+ */
+module.exports.createInput = function createInput (id, value, clss) {
+    var el = document.createElement('input');
+    el.setAttribute('type', 'text');
+    el.setAttribute('id', id);
+    el.setAttribute('name', id);
+    el.setAttribute('value', value);
+    el.setAttribute('class', clss);
+    return el;
+};
+/**
+ * Creates a DOM label element.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ * @param {string} text The label text.
+ * @param {string} labelFor The id of the element being labeled.
+ * @returns {DOMElement} Returns a label element reference.
+ */
+module.exports.createLabel = function createLabel (text, labelFor) {
+    var el = document.createElement('label');
+    el.setAttribute('for', labelFor);
+    el.textContent = text;
+    return el;
+};
+/**
+ * Creates a DOM selection element.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ * @param {string} id The id of the element.
+ * @param {string} values An array of objects suitable for `createOption`
+ * @param {string} clss The class of the element.
+ * @returns {DOMElement} Returns a selection element reference.
+ * @see ace/ext/element_generator.createOption
+ */
+module.exports.createSelection = function createSelection (id, values, clss) {
+    var el = document.createElement('select');
+    el.setAttribute('id', id);
+    el.setAttribute('name', id);
+    el.setAttribute('class', clss);
+    values.forEach(function(item) {
+        el.appendChild(module.exports.createOption(item));
+    });
+    return el;
+};
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/menu_tools/generate_settings_menu.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/menu_tools/generate_settings_menu.js b/src/fauxton/assets/js/libs/ace/ext/menu_tools/generate_settings_menu.js
new file mode 100644
index 0000000..16d3a76
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/menu_tools/generate_settings_menu.js
@@ -0,0 +1,258 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl
+ * All rights reserved.
+ *
+ * Contributed to Ajax.org under the BSD license.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/
+/*global define*/
+
+/**
+ * Generates the settings menu
+ * @fileOverview Generates the settings menu.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ */
+
+define(function(require, exports, module) {
+'use strict';
+var egen = require('./element_generator');
+var addEditorMenuOptions = require('./add_editor_menu_options').addEditorMenuOptions;
+var getSetFunctions = require('./get_set_functions').getSetFunctions;
+
+/**
+ * Generates an interactive menu with settings useful to end users.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ * @param {ace.Editor} editor An instance of the ace editor.
+ */
+module.exports.generateSettingsMenu = function generateSettingsMenu (editor) {
+    /**
+     * container for dom elements that will go in the menu.
+     * @author <a href="mailto:matthewkastor@gmail.com">
+     *  Matthew Christopher Kastor-Inare III </a><br />
+     *  ☭ Hial Atropa!! ☭
+     */
+    var elements = [];
+    /**
+     * Sorts the menu entries (elements var) so they'll appear in alphabetical order
+     *  the sort is performed based on the value of the contains property
+     *  of each element. Since this is an `array.sort` the array is sorted
+     *  in place.
+     * @author <a href="mailto:matthewkastor@gmail.com">
+     *  Matthew Christopher Kastor-Inare III </a><br />
+     *  ☭ Hial Atropa!! ☭
+     */
+    function cleanupElementsList() {
+        elements.sort(function(a, b) {
+            var x = a.getAttribute('contains');
+            var y = b.getAttribute('contains');
+            return x.localeCompare(y);
+        });
+    }
+    /**
+     * Wraps all dom elements contained in the elements var with a single
+     *  div.
+     * @author <a href="mailto:matthewkastor@gmail.com">
+     *  Matthew Christopher Kastor-Inare III </a><br />
+     *  ☭ Hial Atropa!! ☭
+     */
+    function wrapElements() {
+        var topmenu = document.createElement('div');
+        topmenu.setAttribute('id', 'ace_settingsmenu');
+        elements.forEach(function(element) {
+            topmenu.appendChild(element);
+        });
+        return topmenu;
+    }
+    /**
+     * Creates a new menu entry.
+     * @author <a href="mailto:matthewkastor@gmail.com">
+     *  Matthew Christopher Kastor-Inare III </a><br />
+     *  ☭ Hial Atropa!! ☭
+     * @param {object} obj This is a reference to the object containing the
+     *  set function. It is used to set up event listeners for when the
+     *  menu options change.
+     * @param {string} clss Maps to the class of the dom element. This is
+     *  the name of the object containing the set function e.g. `editor`,
+     *  `session`, `renderer`.
+     * @param {string} item  This is the set function name. It maps to the
+     *  id of the dom element (check, select, input) and to the "contains"
+     *  attribute of the div holding both the element and its label.
+     * @param {mixed} val This is the value of the setting. It is mapped to
+     *  the dom element's value, checked, or selected option accordingly.
+     */
+    function createNewEntry(obj, clss, item, val) {
+        var el;
+        var div = document.createElement('div');
+        div.setAttribute('contains', item);
+        div.setAttribute('class', 'ace_optionsMenuEntry');
+        div.setAttribute('style', 'clear: both;');
+
+        div.appendChild(egen.createLabel(
+            item.replace(/^set/, '').replace(/([A-Z])/g, ' $1').trim(),
+            item
+        ));
+
+        if (Array.isArray(val)) {
+            el = egen.createSelection(item, val, clss);
+            el.addEventListener('change', function(e) {
+                try{
+                    editor.menuOptions[e.target.id].forEach(function(x) {
+                        if(x.textContent !== e.target.textContent) {
+                            delete x.selected;
+                        }
+                    });
+                    obj[e.target.id](e.target.value);
+                } catch (err) {
+                    throw new Error(err);
+                }
+            });
+        } else if(typeof val === 'boolean') {
+            el = egen.createCheckbox(item, val, clss);
+            el.addEventListener('change', function(e) {
+                try{
+                    // renderer['setHighlightGutterLine'](true);
+                    obj[e.target.id](!!e.target.checked);
+                } catch (err) {
+                    throw new Error(err);
+                }
+            });
+        } else {
+            // this aids in giving the ability to specify settings through
+            // post and get requests.
+            // /ace_editor.html?setMode=ace/mode/html&setOverwrite=true
+            el = egen.createInput(item, val, clss);
+            el.addEventListener('change', function(e) {
+                try{
+                    if(e.target.value === 'true') {
+                        obj[e.target.id](true);
+                    } else if(e.target.value === 'false') {
+                        obj[e.target.id](false);
+                    } else {
+                        obj[e.target.id](e.target.value);
+                    }
+                } catch (err) {
+                    throw new Error(err);
+                }
+            });
+        }
+        el.style.cssText = 'float:right;';
+        div.appendChild(el);
+        return div;
+    }
+    /**
+     * Generates selection fields for the menu and populates their options
+     *  using information from `editor.menuOptions`
+     * @author <a href="mailto:matthewkastor@gmail.com">
+     *  Matthew Christopher Kastor-Inare III </a><br />
+     *  ☭ Hial Atropa!! ☭
+     * @param {string} item The set function name.
+     * @param {object} esr A reference to the object having the set function.
+     * @param {string} clss The name of the object containing the set function.
+     * @param {string} fn The matching get function's function name.
+     * @returns {DOMElement} Returns a dom element containing a selection
+     *  element populated with options. The option whose value matches that
+     *  returned from `esr[fn]()` will be selected.
+     */
+    function makeDropdown(item, esr, clss, fn) {
+        var val = editor.menuOptions[item];
+        var currentVal = esr[fn]();
+        if (typeof currentVal == 'object')
+            currentVal = currentVal.$id;
+        val.forEach(function(valuex) {
+            if (valuex.value === currentVal)
+                valuex.selected = 'selected';
+        });
+        return createNewEntry(esr, clss, item, val);
+    }
+    /**
+     * Processes the set functions returned from `getSetFunctions`. First it
+     *  checks for menu options defined in `editor.menuOptions`. If no
+     *  options are specified then it checks whether there is a get function
+     *  (replace set with get) for the setting. When either of those
+     *  conditions are met it will attempt to create a new entry for the
+     *  settings menu and push it into the elements array defined above.
+     *  It can only do so for get functions which return
+     *  strings, numbers, and booleans. A special case is written in for
+     *  `getMode` where it looks at the returned objects `$id` property and
+     *  forwards that through instead. Other special cases could be written
+     *  in but that would get a bit ridiculous.
+     * @author <a href="mailto:matthewkastor@gmail.com">
+     *  Matthew Christopher Kastor-Inare III </a><br />
+     *  ☭ Hial Atropa!! ☭
+     * @param {object} setObj An item from the array returned by
+     *  `getSetFunctions`.
+     */
+    function handleSet(setObj) {
+        var item = setObj.functionName;
+        var esr = setObj.parentObj;
+        var clss = setObj.parentName;
+        var val;
+        var fn = item.replace(/^set/, 'get');
+        if(editor.menuOptions[item] !== undefined) {
+            // has options for select element
+            elements.push(makeDropdown(item, esr, clss, fn));
+        } else if(typeof esr[fn] === 'function') {
+            // has get function
+            try {
+                val = esr[fn]();
+                if(typeof val === 'object') {
+                    // setMode takes a string, getMode returns an object
+                    // the $id property of that object is the string
+                    // which may be given to setMode...
+                    val = val.$id;
+                }
+                // the rest of the get functions return strings,
+                // booleans, or numbers.
+                elements.push(
+                    createNewEntry(esr, clss, item, val)
+                );
+            } catch (e) {
+                // if there are errors it is because the element
+                // does not belong in the settings menu
+            }
+        }
+    }
+    addEditorMenuOptions(editor);
+    // gather the set functions
+    getSetFunctions(editor).forEach(function(setObj) {
+        // populate the elements array with good stuff.
+        handleSet(setObj);
+    });
+    // sort the menu entries in the elements list so people can find
+    // the settings in alphabetical order.
+    cleanupElementsList();
+    // dump the entries from the elements list and wrap them up in a div
+    return wrapElements();
+};
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/menu_tools/get_editor_keyboard_shortcuts.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/menu_tools/get_editor_keyboard_shortcuts.js b/src/fauxton/assets/js/libs/ace/ext/menu_tools/get_editor_keyboard_shortcuts.js
new file mode 100644
index 0000000..e412bfb
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/menu_tools/get_editor_keyboard_shortcuts.js
@@ -0,0 +1,100 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl
+ * All rights reserved.
+ *
+ * Contributed to Ajax.org under the BSD license.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/
+/*global define, require */
+
+/**
+ * Get Editor Keyboard Shortcuts
+ * @fileOverview Get Editor Keyboard Shortcuts <br />
+ * Gets a map of keyboard shortcuts to command names for the current platform.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ */
+
+define(function(require, exports, module) {
+"use strict";
+var keys = require("../../lib/keys");
+
+/**
+ * Gets a map of keyboard shortcuts to command names for the current platform.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ * @param {ace.Editor} editor An editor instance.
+ * @returns {Array} Returns an array of objects representing the keyboard
+ *  shortcuts for the given editor.
+ * @example
+ * var getKbShortcuts = require('./get_keyboard_shortcuts');
+ * console.log(getKbShortcuts(editor));
+ * // [
+ * //     {'command' : aCommand, 'key' : 'Control-d'},
+ * //     {'command' : aCommand, 'key' : 'Control-d'}
+ * // ]
+ */
+module.exports.getEditorKeybordShortcuts = function(editor) {
+    var KEY_MODS = keys.KEY_MODS;
+    var keybindings = [];
+    var commandMap = {};
+    editor.keyBinding.$handlers.forEach(function(handler) {
+        var ckb = handler.commandKeyBinding;
+        for (var i in ckb) {
+            var modifier = parseInt(i);
+            if (modifier == -1) {
+                modifier = "";
+            } else if(isNaN(modifier)) {
+                modifier = i;
+            } else {
+                modifier = "" +
+                    (modifier & KEY_MODS.command ? "Cmd-"   : "") +
+                    (modifier & KEY_MODS.ctrl    ? "Ctrl-"  : "") +
+                    (modifier & KEY_MODS.alt     ? "Alt-"   : "") +
+                    (modifier & KEY_MODS.shift   ? "Shift-" : "");
+            }
+            for (var key in ckb[i]) {
+                var command = ckb[i][key]
+                if (typeof command != "string")
+                    command  = command.name
+                if (commandMap[command]) {
+                    commandMap[command].key += "|" + modifier + key;
+                } else {
+                    commandMap[command] = {key: modifier+key, command: command};
+                    keybindings.push(commandMap[command]);
+                }
+            }
+        }
+    });
+    return keybindings;
+};
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/menu_tools/get_set_functions.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/menu_tools/get_set_functions.js b/src/fauxton/assets/js/libs/ace/ext/menu_tools/get_set_functions.js
new file mode 100644
index 0000000..4cd6550
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/menu_tools/get_set_functions.js
@@ -0,0 +1,141 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl
+ * All rights reserved.
+ *
+ * Contributed to Ajax.org under the BSD license.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true */
+/*global define*/
+
+/**
+ * Get Set Functions
+ * @fileOverview Get Set Functions <br />
+ * Gets various functions for setting settings.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ */
+
+define(function(require, exports, module) {
+'use strict';
+/**
+ * Generates a list of set functions for the settings menu.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ * @param {object} editor The editor instance
+ * @return {array} Returns an array of objects. Each object contains the
+ *  following properties: functionName, parentObj, and parentName. The
+ *  function name will be the name of a method beginning with the string
+ *  `set` which was found. The parent object will be a reference to the
+ *  object having the method matching the function name. The parent name
+ *  will be a string representing the identifier of the parent object e.g.
+ *  `editor`, `session`, or `renderer`.
+ */
+module.exports.getSetFunctions = function getSetFunctions (editor) {
+    /**
+     * Output array. Will hold the objects described above.
+     * @author <a href="mailto:matthewkastor@gmail.com">
+     *  Matthew Christopher Kastor-Inare III </a><br />
+     *  ☭ Hial Atropa!! ☭
+     */
+    var out = [];
+    /**
+     * This object provides a map between the objects which will be
+     *  traversed and the parent name which will appear in the output.
+     * @author <a href="mailto:matthewkastor@gmail.com">
+     *  Matthew Christopher Kastor-Inare III </a><br />
+     *  ☭ Hial Atropa!! ☭
+     */
+    var my = {
+        'editor' : editor,
+        'session' : editor.session,
+        'renderer' : editor.renderer
+    };
+    /**
+     * This array will hold the set function names which have already been
+     *  found so that they are not added to the output multiple times.
+     * @author <a href="mailto:matthewkastor@gmail.com">
+     *  Matthew Christopher Kastor-Inare III </a><br />
+     *  ☭ Hial Atropa!! ☭
+     */
+    var opts = [];
+    /**
+     * This is a list of set functions which will not appear in the settings
+     *  menu. I don't know what to do with setKeyboardHandler. When I tried
+     *  to use it, it didn't appear to be working. Someone who knows better
+     *  could remove it from this list and add it's options to
+     *  add_editor_menu_options.js
+     * @author <a href="mailto:matthewkastor@gmail.com">
+     *  Matthew Christopher Kastor-Inare III </a><br />
+     *  ☭ Hial Atropa!! ☭
+     */
+    var skip = [
+        'setOption',
+        'setUndoManager',
+        'setDocument',
+        'setValue',
+        'setBreakpoints',
+        'setScrollTop',
+        'setScrollLeft',
+        'setSelectionStyle',
+        'setWrapLimitRange'
+    ];
+
+
+    /**
+     * This will search the objects mapped to the `my` variable above. When
+     *  it finds a set function in the object that is not listed in the
+     *  `skip` list or the `opts` list it will push a new object to the
+     *  output array.
+     * @author <a href="mailto:matthewkastor@gmail.com">
+     *  Matthew Christopher Kastor-Inare III </a><br />
+     *  ☭ Hial Atropa!! ☭
+     */
+    ['renderer', 'session', 'editor'].forEach(function(esra) {
+        var esr = my[esra];
+        var clss = esra;
+        for(var fn in esr) {
+            if(skip.indexOf(fn) === -1) {
+                if(/^set/.test(fn) && opts.indexOf(fn) === -1) {
+                    // found set function
+                    opts.push(fn);
+                    out.push({
+                        'functionName' : fn,
+                        'parentObj' : esr,
+                        'parentName' : clss
+                    });
+                }
+            }
+        }
+    });
+    return out;
+};
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/menu_tools/overlay_page.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/menu_tools/overlay_page.js b/src/fauxton/assets/js/libs/ace/ext/menu_tools/overlay_page.js
new file mode 100644
index 0000000..bf985e2
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/menu_tools/overlay_page.js
@@ -0,0 +1,116 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl
+ * All rights reserved.
+ *
+ * Contributed to Ajax.org under the BSD license.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/
+/*global define, require */
+
+/**
+ * Overlay Page
+ * @fileOverview Overlay Page <br />
+ * Generates an overlay for displaying menus. The overlay is an absolutely
+ *  positioned div.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ */
+
+define(function(require, exports, module) {
+'use strict';
+var dom = require("../../lib/dom");
+var cssText = require("../../requirejs/text!./settings_menu.css");
+dom.importCssString(cssText);
+
+/**
+ * Generates an overlay for displaying menus. The overlay is an absolutely
+ *  positioned div.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ * @param {DOMElement} contentElement Any element which may be presented inside
+ *  a div.
+ * @param {string|number} top absolute position value.
+ * @param {string|number} right absolute position value.
+ * @param {string|number} bottom absolute position value.
+ * @param {string|number} left absolute position value.
+ */
+module.exports.overlayPage = function overlayPage(editor, contentElement, top, right, bottom, left) {
+    top = top ? 'top: ' + top + ';' : '';
+    bottom = bottom ? 'bottom: ' + bottom + ';' : '';
+    right = right ? 'right: ' + right + ';' : '';
+    left = left ? 'left: ' + left + ';' : '';
+
+    var closer = document.createElement('div');
+    var contentContainer = document.createElement('div');
+
+    function documentEscListener(e) {
+        if (e.keyCode === 27) {
+            closer.click();
+        }
+    }
+
+    closer.style.cssText = 'margin: 0; padding: 0; ' +
+        'position: fixed; top:0; bottom:0; left:0; right:0;' +
+        'z-index: 9990; ' +
+        'background-color: rgba(0, 0, 0, 0.3);';
+    closer.addEventListener('click', function() {
+        document.removeEventListener('keydown', documentEscListener);
+        closer.parentNode.removeChild(closer);
+        editor.focus();
+        closer = null;
+    });
+    // click closer if esc key is pressed
+    document.addEventListener('keydown', documentEscListener);
+
+    contentContainer.style.cssText = top + right + bottom + left;
+    contentContainer.addEventListener('click', function(e) {
+        e.stopPropagation();
+    });
+
+    var wrapper = dom.createElement("div");
+    wrapper.style.position = "relative";
+    
+    var closeButton = dom.createElement("div");
+    closeButton.className = "ace_closeButton";
+    closeButton.addEventListener('click', function() {
+        closer.click();
+    });
+    
+    wrapper.appendChild(closeButton);
+    contentContainer.appendChild(wrapper);
+    
+    contentContainer.appendChild(contentElement);
+    closer.appendChild(contentContainer);
+    document.body.appendChild(closer);
+    editor.blur();
+};
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/menu_tools/settings_menu.css
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/menu_tools/settings_menu.css b/src/fauxton/assets/js/libs/ace/ext/menu_tools/settings_menu.css
new file mode 100644
index 0000000..f8b761c
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/menu_tools/settings_menu.css
@@ -0,0 +1,48 @@
+#ace_settingsmenu, #kbshortcutmenu {
+    background-color: #F7F7F7;
+    color: black;
+    box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);
+    padding: 1em 0.5em 2em 1em;
+    overflow: auto;
+    position: absolute;
+    margin: 0;
+    bottom: 0;
+    right: 0;
+    top: 0;
+    z-index: 9991;
+    cursor: default;
+}
+
+.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {
+    box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);
+    background-color: rgba(255, 255, 255, 0.6);
+    color: black;
+}
+
+.ace_optionsMenuEntry:hover {
+    background-color: rgba(100, 100, 100, 0.1);
+    -webkit-transition: all 0.5s;
+    transition: all 0.3s
+}
+
+.ace_closeButton {
+    background: rgba(245, 146, 146, 0.5);
+    border: 1px solid #F48A8A;
+    border-radius: 50%;
+    padding: 7px;
+    position: absolute;
+    right: -8px;
+    top: -8px;
+    z-index: 1000;
+}
+.ace_closeButton{
+    background: rgba(245, 146, 146, 0.9);
+}
+.ace_optionsMenuKey {
+    color: darkslateblue;
+    font-weight: bold;
+}
+.ace_optionsMenuCommand {
+    color: darkcyan;
+    font-weight: normal;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/modelist.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/modelist.js b/src/fauxton/assets/js/libs/ace/ext/modelist.js
new file mode 100644
index 0000000..88b0218
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/modelist.js
@@ -0,0 +1,174 @@
+define(function(require, exports, module) {
+"use strict";
+
+var modes = [];
+/**
+ * Suggests a mode based on the file extension present in the given path
+ * @param {string} path The path to the file
+ * @returns {object} Returns an object containing information about the
+ *  suggested mode.
+ */
+function getModeForPath(path) {
+    var mode = modesByName.text;
+    var fileName = path.split(/[\/\\]/).pop();
+    for (var i = 0; i < modes.length; i++) {
+        if (modes[i].supportsFile(fileName)) {
+            mode = modes[i];
+            break;
+        }
+    }
+    return mode;
+}
+
+var Mode = function(name, caption, extensions) {
+    this.name = name;
+    this.caption = caption;
+    this.mode = "ace/mode/" + name;
+    this.extensions = extensions;
+    if (/\^/.test(extensions)) {
+        var re = extensions.replace(/\|(\^)?/g, function(a, b){
+            return "$|" + (b ? "^" : "^.*\\.");
+        }) + "$";
+    } else {
+        var re = "^.*\\.(" + extensions + ")$";
+    }
+
+    this.extRe = new RegExp(re, "gi");
+};
+
+Mode.prototype.supportsFile = function(filename) {
+    return filename.match(this.extRe);
+};
+
+// todo firstlinematch
+var supportedModes = {
+    ABAP:        ["abap"],
+    ActionScript:["as"],
+    ADA:         ["ada|adb"],
+    AsciiDoc:    ["asciidoc"],
+    Assembly_x86:["asm"],
+    AutoHotKey:  ["ahk"],
+    BatchFile:   ["bat|cmd"],
+    C9Search:    ["c9search_results"],
+    C_Cpp:       ["cpp|c|cc|cxx|h|hh|hpp"],
+    Clojure:     ["clj"],
+    Cobol:       ["CBL|COB"],
+    coffee:      ["coffee|cf|cson|^Cakefile"],
+    ColdFusion:  ["cfm"],
+    CSharp:      ["cs"],
+    CSS:         ["css"],
+    Curly:       ["curly"],
+    D:           ["d|di"],
+    Dart:        ["dart"],
+    Diff:        ["diff|patch"],
+    Dot:         ["dot"],
+    Erlang:      ["erl|hrl"],
+    EJS:         ["ejs"],
+    Forth:       ["frt|fs|ldr"],
+    FTL:         ["ftl"],
+    Glsl:        ["glsl|frag|vert"],
+    golang:      ["go"],
+    Groovy:      ["groovy"],
+    HAML:        ["haml"],
+    Handlebars:  ["hbs|handlebars|tpl|mustache"],
+    Haskell:     ["hs"],
+    haXe:        ["hx"],
+    HTML:        ["html|htm|xhtml"],
+    HTML_Ruby:   ["erb|rhtml|html.erb"],
+    INI:         ["ini|conf|cfg|prefs"],
+    Jack:        ["jack"],
+    Jade:        ["jade"],
+    Java:        ["java"],
+    JavaScript:  ["js|jsm"],
+    JSON:        ["json"],
+    JSONiq:      ["jq"],
+    JSP:         ["jsp"],
+    JSX:         ["jsx"],
+    Julia:       ["jl"],
+    LaTeX:       ["tex|latex|ltx|bib"],
+    LESS:        ["less"],
+    Liquid:      ["liquid"],
+    Lisp:        ["lisp"],
+    LiveScript:  ["ls"],
+    LogiQL:      ["logic|lql"],
+    LSL:         ["lsl"],
+    Lua:         ["lua"],
+    LuaPage:     ["lp"],
+    Lucene:      ["lucene"],
+    Makefile:    ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
+    MATLAB:      ["matlab"],
+    Markdown:    ["md|markdown"],
+    MySQL:       ["mysql"],
+    MUSHCode:    ["mc|mush"],
+    Nix:         ["nix"],
+    ObjectiveC:  ["m|mm"],
+    OCaml:       ["ml|mli"],
+    Pascal:      ["pas|p"],
+    Perl:        ["pl|pm"],
+    pgSQL:       ["pgsql"],
+    PHP:         ["php|phtml"],
+    Powershell:  ["ps1"],
+    Prolog:      ["plg|prolog"],
+    Properties:  ["properties"],
+    Protobuf:    ["proto"],
+    Python:      ["py"],
+    R:           ["r"],
+    RDoc:        ["Rd"],
+    RHTML:       ["Rhtml"],
+    Ruby:        ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
+    Rust:        ["rs"],
+    SASS:        ["sass"],
+    SCAD:        ["scad"],
+    Scala:       ["scala"],
+    Scheme:      ["scm|rkt"],
+    SCSS:        ["scss"],
+    SH:          ["sh|bash|^.bashrc"],
+    SJS:         ["sjs"],
+    Space:       ["space"],
+    snippets:    ["snippets"],
+    Soy_Template:["soy"],
+    SQL:         ["sql"],
+    Stylus:      ["styl|stylus"],
+    SVG:         ["svg"],
+    Tcl:         ["tcl"],
+    Tex:         ["tex"],
+    Text:        ["txt"],
+    Textile:     ["textile"],
+    Toml:        ["toml"],
+    Twig:        ["twig"],
+    Typescript:  ["ts|typescript|str"],
+    VBScript:    ["vbs"],
+    Velocity:    ["vm"],
+    Verilog:     ["v|vh|sv|svh"],
+    XML:         ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
+    XQuery:      ["xq"],
+    YAML:        ["yaml|yml"]
+};
+
+var nameOverrides = {
+    ObjectiveC: "Objective-C",
+    CSharp: "C#",
+    golang: "Go",
+    C_Cpp: "C/C++",
+    coffee: "CoffeeScript",
+    HTML_Ruby: "HTML (Ruby)",
+    FTL: "FreeMarker"
+};
+var modesByName = {};
+for (var name in supportedModes) {
+    var data = supportedModes[name];
+    var displayName = nameOverrides[name] || name;
+    var filename = name.toLowerCase();
+    var mode = new Mode(filename, displayName, data[0]);
+    modesByName[filename] = mode;
+    modes.push(mode);
+}
+
+module.exports = {
+    getModeForPath: getModeForPath,
+    modes: modes,
+    modesByName: modesByName
+};
+
+});
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/old_ie.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/old_ie.js b/src/fauxton/assets/js/libs/ace/ext/old_ie.js
new file mode 100644
index 0000000..ca67888
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/old_ie.js
@@ -0,0 +1,108 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+var MAX_TOKEN_COUNT = 1000;
+var useragent = require("../lib/useragent");
+var TokenizerModule = require("../tokenizer");
+
+function patch(obj, name, regexp, replacement) {
+    eval("obj['" + name + "']=" + obj[name].toString().replace(
+        regexp, replacement
+    ));
+}
+
+if (useragent.isIE && useragent.isIE < 10 && window.top.document.compatMode === "BackCompat")
+    useragent.isOldIE = true;
+
+if (typeof document != "undefined" && !document.documentElement.querySelector) {    
+    useragent.isOldIE = true;
+    var qs = function(el, selector) {
+        if (selector.charAt(0) == ".") {
+            var classNeme = selector.slice(1);
+        } else {
+            var m = selector.match(/(\w+)=(\w+)/);
+            var attr = m && m[1];
+            var attrVal = m && m[2];
+        }
+        for (var i = 0; i < el.all.length; i++) {
+            var ch = el.all[i];
+            if (classNeme) {
+                if (ch.className.indexOf(classNeme) != -1)
+                    return ch;
+            } else if (attr) {
+                if (ch.getAttribute(attr) == attrVal)
+                    return ch;
+            }
+        }
+    };
+    var sb = require("./searchbox").SearchBox.prototype;
+    patch(
+        sb, "$initElements",
+        /([^\s=]*).querySelector\((".*?")\)/g, 
+        "qs($1, $2)"
+    );
+}
+    
+var compliantExecNpcg = /()??/.exec("")[1] === undefined;
+if (compliantExecNpcg)
+    return;
+var proto = TokenizerModule.Tokenizer.prototype;
+TokenizerModule.Tokenizer_orig = TokenizerModule.Tokenizer;
+proto.getLineTokens_orig = proto.getLineTokens;
+
+patch(
+    TokenizerModule, "Tokenizer",
+    "ruleRegExps.push(adjustedregex);\n", 
+    function(m) {
+        return m + '\
+        if (state[i].next && RegExp(adjustedregex).test(""))\n\
+            rule._qre = RegExp(adjustedregex, "g");\n\
+        ';
+    }
+);
+TokenizerModule.Tokenizer.prototype = proto;
+patch(
+    proto, "getLineTokens",
+    /if \(match\[i \+ 1\] === undefined\)\s*continue;/, 
+    "if (!match[i + 1]) {\n\
+        if (value)continue;\n\
+        var qre = state[mapping[i]]._qre;\n\
+        if (!qre) continue;\n\
+        qre.lastIndex = lastIndex;\n\
+        if (!qre.exec(line) || qre.lastIndex != lastIndex)\n\
+            continue;\n\
+    }"
+);
+
+useragent.isOldIE = true;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/old_ie_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/old_ie_test.js b/src/fauxton/assets/js/libs/ace/ext/old_ie_test.js
new file mode 100644
index 0000000..98652e1
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/old_ie_test.js
@@ -0,0 +1,77 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var assert = require("../test/assertions");
+
+module.exports = {
+    "test: getTokenizer() (smoke test)" : function() {
+        var exec = RegExp.prototype.exec
+        var brokenExec = function(str) {
+            var result = exec.call(this, str);
+            if (result) {
+                for (var i = result.length; i--;)
+                    if (!result[i])
+                        result[i] = "";
+            }
+            return result;
+        }
+        
+        try {
+            // break this to emulate old ie
+            RegExp.prototype.exec = brokenExec;
+            require("./old_ie");
+            var Tokenizer = require("../tokenizer").Tokenizer;
+            var JavaScriptHighlightRules = require("../mode/javascript_highlight_rules").JavaScriptHighlightRules;
+            var tokenizer = new Tokenizer((new JavaScriptHighlightRules).getRules());
+            
+            var tokens = tokenizer.getLineTokens("'juhu'", "start").tokens;
+            assert.equal("string", tokens[0].type);
+        } finally {
+            // restore modified functions
+            RegExp.prototype.exec = exec;
+            var module = require("../tokenizer");
+            module.Tokenizer = module.Tokenizer_orig;
+            module.Tokenizer.prototype.getLineTokens = module.Tokenizer.prototype.getLineTokens_orig;
+        }
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/searchbox.css
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/searchbox.css b/src/fauxton/assets/js/libs/ace/ext/searchbox.css
new file mode 100644
index 0000000..c0f5f28
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/searchbox.css
@@ -0,0 +1,157 @@
+
+
+/* ------------------------------------------------------------------------------------------
+ * Editor Search Form
+ * --------------------------------------------------------------------------------------- */
+ .ace_search {
+    background-color: #ddd;
+    border: 1px solid #cbcbcb;
+    border-top: 0 none;
+    max-width: 297px;
+    overflow: hidden;
+    margin: 0;
+    padding: 4px;
+    padding-right: 6px;
+    padding-bottom: 0;
+    position: absolute;
+    top: 0px;
+    z-index: 99;
+}
+.ace_search.left {
+    border-left: 0 none;
+    border-radius: 0px 0px 5px 0px;
+    left: 0;
+}
+.ace_search.right {
+    border-radius: 0px 0px 0px 5px;
+    border-right: 0 none;
+    right: 0;
+}
+
+.ace_search_form, .ace_replace_form {
+    border-radius: 3px;
+    border: 1px solid #cbcbcb;
+    float: left;
+    margin-bottom: 4px;
+    overflow: hidden;
+}
+.ace_search_form.ace_nomatch {
+    outline: 1px solid red;
+}
+
+.ace_search_field {
+    background-color: white;
+    border-right: 1px solid #cbcbcb;
+    border: 0 none;
+    -webkit-box-sizing: border-box;
+       -moz-box-sizing: border-box;
+            box-sizing: border-box;
+    display: block;
+    float: left;
+    height: 22px;
+    outline: 0;
+    padding: 0 7px;
+    width: 214px;
+    margin: 0;
+}
+.ace_searchbtn,
+.ace_replacebtn {
+    background: #fff;
+    border: 0 none;
+    border-left: 1px solid #dcdcdc;
+    cursor: pointer;
+    display: block;
+    float: left;
+    height: 22px;
+    margin: 0;
+    padding: 0;
+    position: relative;
+}
+.ace_searchbtn:last-child,
+.ace_replacebtn:last-child {
+    border-top-right-radius: 3px;
+    border-bottom-right-radius: 3px;
+}
+.ace_searchbtn:disabled {
+    background: none;
+    cursor: default;
+}
+.ace_searchbtn {
+    background-position: 50% 50%;
+    background-repeat: no-repeat;
+    width: 27px;
+}
+.ace_searchbtn.prev {
+    background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiSU1NZUAC/6E0I0yACYskCpsJiySKIiY0SUZk40FyTEgCjGgKwTRAgAEAQJUIPCE+qfkAAAAASUVORK5CYII=);    
+}
+.ace_searchbtn.next {
+    background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNpiTE1NZQCC/0DMyIAKwGJMUAYDEo3M/s+EpvM/mkKwCQxYjIeLMaELoLMBAgwAU7UJObTKsvAAAAAASUVORK5CYII=);    
+}
+.ace_searchbtn_close {
+    background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;
+    border-radius: 50%;
+    border: 0 none;
+    color: #656565;
+    cursor: pointer;
+    display: block;
+    float: right;
+    font-family: Arial;
+    font-size: 16px;
+    height: 14px;
+    line-height: 16px;
+    margin: 5px 1px 9px 5px;
+    padding: 0;
+    text-align: center;
+    width: 14px;
+}
+.ace_searchbtn_close:hover {
+    background-color: #656565;
+    background-position: 50% 100%;
+    color: white;
+}
+.ace_replacebtn.prev {
+    width: 54px
+}
+.ace_replacebtn.next {
+    width: 27px
+}
+
+.ace_button {
+    margin-left: 2px;
+    cursor: pointer;
+    -webkit-user-select: none;
+    -moz-user-select: none;
+    -o-user-select: none;
+    -ms-user-select: none;
+    user-select: none;
+    overflow: hidden;
+    opacity: 0.7;
+    border: 1px solid rgba(100,100,100,0.23);
+    padding: 1px;
+    -moz-box-sizing: border-box;
+    box-sizing:    border-box;
+    color: black;
+}
+
+.ace_button:hover {
+    background-color: #eee;
+    opacity:1;
+}
+.ace_button:active {
+    background-color: #ddd;
+}
+
+.ace_button.checked {
+    border-color: #3399ff;
+    opacity:1;
+}
+
+.ace_search_options{
+    margin-bottom: 3px;
+    text-align: right;
+    -webkit-user-select: none;
+    -moz-user-select: none;
+    -o-user-select: none;
+    -ms-user-select: none;
+    user-select: none;
+}
\ No newline at end of file


[23/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/css/csslint.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/css/csslint.js b/src/fauxton/assets/js/libs/ace/mode/css/csslint.js
new file mode 100644
index 0000000..9f4c3bc
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/css/csslint.js
@@ -0,0 +1,9206 @@
+define(function(require, exports, module) {
+/*!
+CSSLint
+Copyright (c) 2011 Nicole Sullivan and Nicholas C. Zakas. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+*/
+/* Build time: 17-January-2013 10:55:01 */
+/*!
+Parser-Lib
+Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+*/
+/* Version v0.2.2, Build time: 17-January-2013 10:26:34 */
+var parserlib = {};
+(function(){
+
+
+/**
+ * A generic base to inherit from for any object
+ * that needs event handling.
+ * @class EventTarget
+ * @constructor
+ */
+function EventTarget(){
+
+    /**
+     * The array of listeners for various events.
+     * @type Object
+     * @property _listeners
+     * @private
+     */
+    this._listeners = {};    
+}
+
+EventTarget.prototype = {
+
+    //restore constructor
+    constructor: EventTarget,
+
+    /**
+     * Adds a listener for a given event type.
+     * @param {String} type The type of event to add a listener for.
+     * @param {Function} listener The function to call when the event occurs.
+     * @return {void}
+     * @method addListener
+     */
+    addListener: function(type, listener){
+        if (!this._listeners[type]){
+            this._listeners[type] = [];
+        }
+
+        this._listeners[type].push(listener);
+    },
+    
+    /**
+     * Fires an event based on the passed-in object.
+     * @param {Object|String} event An object with at least a 'type' attribute
+     *      or a string indicating the event name.
+     * @return {void}
+     * @method fire
+     */    
+    fire: function(event){
+        if (typeof event == "string"){
+            event = { type: event };
+        }
+        if (typeof event.target != "undefined"){
+            event.target = this;
+        }
+        
+        if (typeof event.type == "undefined"){
+            throw new Error("Event object missing 'type' property.");
+        }
+        
+        if (this._listeners[event.type]){
+        
+            //create a copy of the array and use that so listeners can't chane
+            var listeners = this._listeners[event.type].concat();
+            for (var i=0, len=listeners.length; i < len; i++){
+                listeners[i].call(this, event);
+            }
+        }            
+    },
+
+    /**
+     * Removes a listener for a given event type.
+     * @param {String} type The type of event to remove a listener from.
+     * @param {Function} listener The function to remove from the event.
+     * @return {void}
+     * @method removeListener
+     */
+    removeListener: function(type, listener){
+        if (this._listeners[type]){
+            var listeners = this._listeners[type];
+            for (var i=0, len=listeners.length; i < len; i++){
+                if (listeners[i] === listener){
+                    listeners.splice(i, 1);
+                    break;
+                }
+            }
+            
+            
+        }            
+    }
+};
+/**
+ * Convenient way to read through strings.
+ * @namespace parserlib.util
+ * @class StringReader
+ * @constructor
+ * @param {String} text The text to read.
+ */
+function StringReader(text){
+
+    /**
+     * The input text with line endings normalized.
+     * @property _input
+     * @type String
+     * @private
+     */
+    this._input = text.replace(/\n\r?/g, "\n");
+
+
+    /**
+     * The row for the character to be read next.
+     * @property _line
+     * @type int
+     * @private
+     */
+    this._line = 1;
+
+
+    /**
+     * The column for the character to be read next.
+     * @property _col
+     * @type int
+     * @private
+     */
+    this._col = 1;
+
+    /**
+     * The index of the character in the input to be read next.
+     * @property _cursor
+     * @type int
+     * @private
+     */
+    this._cursor = 0;
+}
+
+StringReader.prototype = {
+
+    //restore constructor
+    constructor: StringReader,
+
+    //-------------------------------------------------------------------------
+    // Position info
+    //-------------------------------------------------------------------------
+
+    /**
+     * Returns the column of the character to be read next.
+     * @return {int} The column of the character to be read next.
+     * @method getCol
+     */
+    getCol: function(){
+        return this._col;
+    },
+
+    /**
+     * Returns the row of the character to be read next.
+     * @return {int} The row of the character to be read next.
+     * @method getLine
+     */
+    getLine: function(){
+        return this._line ;
+    },
+
+    /**
+     * Determines if you're at the end of the input.
+     * @return {Boolean} True if there's no more input, false otherwise.
+     * @method eof
+     */
+    eof: function(){
+        return (this._cursor == this._input.length);
+    },
+
+    //-------------------------------------------------------------------------
+    // Basic reading
+    //-------------------------------------------------------------------------
+
+    /**
+     * Reads the next character without advancing the cursor.
+     * @param {int} count How many characters to look ahead (default is 1).
+     * @return {String} The next character or null if there is no next character.
+     * @method peek
+     */
+    peek: function(count){
+        var c = null;
+        count = (typeof count == "undefined" ? 1 : count);
+
+        //if we're not at the end of the input...
+        if (this._cursor < this._input.length){
+
+            //get character and increment cursor and column
+            c = this._input.charAt(this._cursor + count - 1);
+        }
+
+        return c;
+    },
+
+    /**
+     * Reads the next character from the input and adjusts the row and column
+     * accordingly.
+     * @return {String} The next character or null if there is no next character.
+     * @method read
+     */
+    read: function(){
+        var c = null;
+
+        //if we're not at the end of the input...
+        if (this._cursor < this._input.length){
+
+            //if the last character was a newline, increment row count
+            //and reset column count
+            if (this._input.charAt(this._cursor) == "\n"){
+                this._line++;
+                this._col=1;
+            } else {
+                this._col++;
+            }
+
+            //get character and increment cursor and column
+            c = this._input.charAt(this._cursor++);
+        }
+
+        return c;
+    },
+
+    //-------------------------------------------------------------------------
+    // Misc
+    //-------------------------------------------------------------------------
+
+    /**
+     * Saves the current location so it can be returned to later.
+     * @method mark
+     * @return {void}
+     */
+    mark: function(){
+        this._bookmark = {
+            cursor: this._cursor,
+            line:   this._line,
+            col:    this._col
+        };
+    },
+
+    reset: function(){
+        if (this._bookmark){
+            this._cursor = this._bookmark.cursor;
+            this._line = this._bookmark.line;
+            this._col = this._bookmark.col;
+            delete this._bookmark;
+        }
+    },
+
+    //-------------------------------------------------------------------------
+    // Advanced reading
+    //-------------------------------------------------------------------------
+
+    /**
+     * Reads up to and including the given string. Throws an error if that
+     * string is not found.
+     * @param {String} pattern The string to read.
+     * @return {String} The string when it is found.
+     * @throws Error when the string pattern is not found.
+     * @method readTo
+     */
+    readTo: function(pattern){
+
+        var buffer = "",
+            c;
+
+        /*
+         * First, buffer must be the same length as the pattern.
+         * Then, buffer must end with the pattern or else reach the
+         * end of the input.
+         */
+        while (buffer.length < pattern.length || buffer.lastIndexOf(pattern) != buffer.length - pattern.length){
+            c = this.read();
+            if (c){
+                buffer += c;
+            } else {
+                throw new Error("Expected \"" + pattern + "\" at line " + this._line  + ", col " + this._col + ".");
+            }
+        }
+
+        return buffer;
+
+    },
+
+    /**
+     * Reads characters while each character causes the given
+     * filter function to return true. The function is passed
+     * in each character and either returns true to continue
+     * reading or false to stop.
+     * @param {Function} filter The function to read on each character.
+     * @return {String} The string made up of all characters that passed the
+     *      filter check.
+     * @method readWhile
+     */
+    readWhile: function(filter){
+
+        var buffer = "",
+            c = this.read();
+
+        while(c !== null && filter(c)){
+            buffer += c;
+            c = this.read();
+        }
+
+        return buffer;
+
+    },
+
+    /**
+     * Reads characters that match either text or a regular expression and
+     * returns those characters. If a match is found, the row and column
+     * are adjusted; if no match is found, the reader's state is unchanged.
+     * reading or false to stop.
+     * @param {String|RegExp} matchter If a string, then the literal string
+     *      value is searched for. If a regular expression, then any string
+     *      matching the pattern is search for.
+     * @return {String} The string made up of all characters that matched or
+     *      null if there was no match.
+     * @method readMatch
+     */
+    readMatch: function(matcher){
+
+        var source = this._input.substring(this._cursor),
+            value = null;
+
+        //if it's a string, just do a straight match
+        if (typeof matcher == "string"){
+            if (source.indexOf(matcher) === 0){
+                value = this.readCount(matcher.length);
+            }
+        } else if (matcher instanceof RegExp){
+            if (matcher.test(source)){
+                value = this.readCount(RegExp.lastMatch.length);
+            }
+        }
+
+        return value;
+    },
+
+
+    /**
+     * Reads a given number of characters. If the end of the input is reached,
+     * it reads only the remaining characters and does not throw an error.
+     * @param {int} count The number of characters to read.
+     * @return {String} The string made up the read characters.
+     * @method readCount
+     */
+    readCount: function(count){
+        var buffer = "";
+
+        while(count--){
+            buffer += this.read();
+        }
+
+        return buffer;
+    }
+
+};
+/**
+ * Type to use when a syntax error occurs.
+ * @class SyntaxError
+ * @namespace parserlib.util
+ * @constructor
+ * @param {String} message The error message.
+ * @param {int} line The line at which the error occurred.
+ * @param {int} col The column at which the error occurred.
+ */
+function SyntaxError(message, line, col){
+
+    /**
+     * The column at which the error occurred.
+     * @type int
+     * @property col
+     */
+    this.col = col;
+
+    /**
+     * The line at which the error occurred.
+     * @type int
+     * @property line
+     */
+    this.line = line;
+
+    /**
+     * The text representation of the unit.
+     * @type String
+     * @property text
+     */
+    this.message = message;
+
+}
+
+//inherit from Error
+SyntaxError.prototype = new Error();
+/**
+ * Base type to represent a single syntactic unit.
+ * @class SyntaxUnit
+ * @namespace parserlib.util
+ * @constructor
+ * @param {String} text The text of the unit.
+ * @param {int} line The line of text on which the unit resides.
+ * @param {int} col The column of text on which the unit resides.
+ */
+function SyntaxUnit(text, line, col, type){
+
+
+    /**
+     * The column of text on which the unit resides.
+     * @type int
+     * @property col
+     */
+    this.col = col;
+
+    /**
+     * The line of text on which the unit resides.
+     * @type int
+     * @property line
+     */
+    this.line = line;
+
+    /**
+     * The text representation of the unit.
+     * @type String
+     * @property text
+     */
+    this.text = text;
+
+    /**
+     * The type of syntax unit.
+     * @type int
+     * @property type
+     */
+    this.type = type;
+}
+
+/**
+ * Create a new syntax unit based solely on the given token.
+ * Convenience method for creating a new syntax unit when
+ * it represents a single token instead of multiple.
+ * @param {Object} token The token object to represent.
+ * @return {parserlib.util.SyntaxUnit} The object representing the token.
+ * @static
+ * @method fromToken
+ */
+SyntaxUnit.fromToken = function(token){
+    return new SyntaxUnit(token.value, token.startLine, token.startCol);
+};
+
+SyntaxUnit.prototype = {
+
+    //restore constructor
+    constructor: SyntaxUnit,
+    
+    /**
+     * Returns the text representation of the unit.
+     * @return {String} The text representation of the unit.
+     * @method valueOf
+     */
+    valueOf: function(){
+        return this.toString();
+    },
+    
+    /**
+     * Returns the text representation of the unit.
+     * @return {String} The text representation of the unit.
+     * @method toString
+     */
+    toString: function(){
+        return this.text;
+    }
+
+};
+/*global StringReader, SyntaxError*/
+
+/**
+ * Generic TokenStream providing base functionality.
+ * @class TokenStreamBase
+ * @namespace parserlib.util
+ * @constructor
+ * @param {String|StringReader} input The text to tokenize or a reader from 
+ *      which to read the input.
+ */
+function TokenStreamBase(input, tokenData){
+
+    /**
+     * The string reader for easy access to the text.
+     * @type StringReader
+     * @property _reader
+     * @private
+     */
+    this._reader = input ? new StringReader(input.toString()) : null;
+    
+    /**
+     * Token object for the last consumed token.
+     * @type Token
+     * @property _token
+     * @private
+     */
+    this._token = null;    
+    
+    /**
+     * The array of token information.
+     * @type Array
+     * @property _tokenData
+     * @private
+     */
+    this._tokenData = tokenData;
+    
+    /**
+     * Lookahead token buffer.
+     * @type Array
+     * @property _lt
+     * @private
+     */
+    this._lt = [];
+    
+    /**
+     * Lookahead token buffer index.
+     * @type int
+     * @property _ltIndex
+     * @private
+     */
+    this._ltIndex = 0;
+    
+    this._ltIndexCache = [];
+}
+
+/**
+ * Accepts an array of token information and outputs
+ * an array of token data containing key-value mappings
+ * and matching functions that the TokenStream needs.
+ * @param {Array} tokens An array of token descriptors.
+ * @return {Array} An array of processed token data.
+ * @method createTokenData
+ * @static
+ */
+TokenStreamBase.createTokenData = function(tokens){
+
+    var nameMap     = [],
+        typeMap     = {},
+        tokenData     = tokens.concat([]),
+        i            = 0,
+        len            = tokenData.length+1;
+    
+    tokenData.UNKNOWN = -1;
+    tokenData.unshift({name:"EOF"});
+
+    for (; i < len; i++){
+        nameMap.push(tokenData[i].name);
+        tokenData[tokenData[i].name] = i;
+        if (tokenData[i].text){
+            typeMap[tokenData[i].text] = i;
+        }
+    }
+    
+    tokenData.name = function(tt){
+        return nameMap[tt];
+    };
+    
+    tokenData.type = function(c){
+        return typeMap[c];
+    };
+    
+    return tokenData;
+};
+
+TokenStreamBase.prototype = {
+
+    //restore constructor
+    constructor: TokenStreamBase,    
+    
+    //-------------------------------------------------------------------------
+    // Matching methods
+    //-------------------------------------------------------------------------
+    
+    /**
+     * Determines if the next token matches the given token type.
+     * If so, that token is consumed; if not, the token is placed
+     * back onto the token stream. You can pass in any number of
+     * token types and this will return true if any of the token
+     * types is found.
+     * @param {int|int[]} tokenTypes Either a single token type or an array of
+     *      token types that the next token might be. If an array is passed,
+     *      it's assumed that the token can be any of these.
+     * @param {variant} channel (Optional) The channel to read from. If not
+     *      provided, reads from the default (unnamed) channel.
+     * @return {Boolean} True if the token type matches, false if not.
+     * @method match
+     */
+    match: function(tokenTypes, channel){
+    
+        //always convert to an array, makes things easier
+        if (!(tokenTypes instanceof Array)){
+            tokenTypes = [tokenTypes];
+        }
+                
+        var tt  = this.get(channel),
+            i   = 0,
+            len = tokenTypes.length;
+            
+        while(i < len){
+            if (tt == tokenTypes[i++]){
+                return true;
+            }
+        }
+        
+        //no match found, put the token back
+        this.unget();
+        return false;
+    },    
+    
+    /**
+     * Determines if the next token matches the given token type.
+     * If so, that token is consumed; if not, an error is thrown.
+     * @param {int|int[]} tokenTypes Either a single token type or an array of
+     *      token types that the next token should be. If an array is passed,
+     *      it's assumed that the token must be one of these.
+     * @param {variant} channel (Optional) The channel to read from. If not
+     *      provided, reads from the default (unnamed) channel.
+     * @return {void}
+     * @method mustMatch
+     */    
+    mustMatch: function(tokenTypes, channel){
+
+        var token;
+
+        //always convert to an array, makes things easier
+        if (!(tokenTypes instanceof Array)){
+            tokenTypes = [tokenTypes];
+        }
+
+        if (!this.match.apply(this, arguments)){    
+            token = this.LT(1);
+            throw new SyntaxError("Expected " + this._tokenData[tokenTypes[0]].name + 
+                " at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol);
+        }
+    },
+    
+    //-------------------------------------------------------------------------
+    // Consuming methods
+    //-------------------------------------------------------------------------
+    
+    /**
+     * Keeps reading from the token stream until either one of the specified
+     * token types is found or until the end of the input is reached.
+     * @param {int|int[]} tokenTypes Either a single token type or an array of
+     *      token types that the next token should be. If an array is passed,
+     *      it's assumed that the token must be one of these.
+     * @param {variant} channel (Optional) The channel to read from. If not
+     *      provided, reads from the default (unnamed) channel.
+     * @return {void}
+     * @method advance
+     */
+    advance: function(tokenTypes, channel){
+        
+        while(this.LA(0) !== 0 && !this.match(tokenTypes, channel)){
+            this.get();
+        }
+
+        return this.LA(0);    
+    },
+    
+    /**
+     * Consumes the next token from the token stream. 
+     * @return {int} The token type of the token that was just consumed.
+     * @method get
+     */      
+    get: function(channel){
+    
+        var tokenInfo   = this._tokenData,
+            reader      = this._reader,
+            value,
+            i           =0,
+            len         = tokenInfo.length,
+            found       = false,
+            token,
+            info;
+            
+        //check the lookahead buffer first
+        if (this._lt.length && this._ltIndex >= 0 && this._ltIndex < this._lt.length){  
+                           
+            i++;
+            this._token = this._lt[this._ltIndex++];
+            info = tokenInfo[this._token.type];
+            
+            //obey channels logic
+            while((info.channel !== undefined && channel !== info.channel) &&
+                    this._ltIndex < this._lt.length){
+                this._token = this._lt[this._ltIndex++];
+                info = tokenInfo[this._token.type];
+                i++;
+            }
+            
+            //here be dragons
+            if ((info.channel === undefined || channel === info.channel) &&
+                    this._ltIndex <= this._lt.length){
+                this._ltIndexCache.push(i);
+                return this._token.type;
+            }
+        }
+        
+        //call token retriever method
+        token = this._getToken();
+
+        //if it should be hidden, don't save a token
+        if (token.type > -1 && !tokenInfo[token.type].hide){
+                     
+            //apply token channel
+            token.channel = tokenInfo[token.type].channel;
+         
+            //save for later
+            this._token = token;
+            this._lt.push(token);
+
+            //save space that will be moved (must be done before array is truncated)
+            this._ltIndexCache.push(this._lt.length - this._ltIndex + i);  
+        
+            //keep the buffer under 5 items
+            if (this._lt.length > 5){
+                this._lt.shift();                
+            }
+            
+            //also keep the shift buffer under 5 items
+            if (this._ltIndexCache.length > 5){
+                this._ltIndexCache.shift();
+            }
+                
+            //update lookahead index
+            this._ltIndex = this._lt.length;
+        }
+            
+        /*
+         * Skip to the next token if:
+         * 1. The token type is marked as hidden.
+         * 2. The token type has a channel specified and it isn't the current channel.
+         */
+        info = tokenInfo[token.type];
+        if (info && 
+                (info.hide || 
+                (info.channel !== undefined && channel !== info.channel))){
+            return this.get(channel);
+        } else {
+            //return just the type
+            return token.type;
+        }
+    },
+    
+    /**
+     * Looks ahead a certain number of tokens and returns the token type at
+     * that position. This will throw an error if you lookahead past the
+     * end of input, past the size of the lookahead buffer, or back past
+     * the first token in the lookahead buffer.
+     * @param {int} The index of the token type to retrieve. 0 for the
+     *      current token, 1 for the next, -1 for the previous, etc.
+     * @return {int} The token type of the token in the given position.
+     * @method LA
+     */
+    LA: function(index){
+        var total = index,
+            tt;
+        if (index > 0){
+            //TODO: Store 5 somewhere
+            if (index > 5){
+                throw new Error("Too much lookahead.");
+            }
+        
+            //get all those tokens
+            while(total){
+                tt = this.get();   
+                total--;                            
+            }
+            
+            //unget all those tokens
+            while(total < index){
+                this.unget();
+                total++;
+            }
+        } else if (index < 0){
+        
+            if(this._lt[this._ltIndex+index]){
+                tt = this._lt[this._ltIndex+index].type;
+            } else {
+                throw new Error("Too much lookbehind.");
+            }
+        
+        } else {
+            tt = this._token.type;
+        }
+        
+        return tt;
+    
+    },
+    
+    /**
+     * Looks ahead a certain number of tokens and returns the token at
+     * that position. This will throw an error if you lookahead past the
+     * end of input, past the size of the lookahead buffer, or back past
+     * the first token in the lookahead buffer.
+     * @param {int} The index of the token type to retrieve. 0 for the
+     *      current token, 1 for the next, -1 for the previous, etc.
+     * @return {Object} The token of the token in the given position.
+     * @method LA
+     */    
+    LT: function(index){
+    
+        //lookahead first to prime the token buffer
+        this.LA(index);
+        
+        //now find the token, subtract one because _ltIndex is already at the next index
+        return this._lt[this._ltIndex+index-1];    
+    },
+    
+    /**
+     * Returns the token type for the next token in the stream without 
+     * consuming it.
+     * @return {int} The token type of the next token in the stream.
+     * @method peek
+     */
+    peek: function(){
+        return this.LA(1);
+    },
+    
+    /**
+     * Returns the actual token object for the last consumed token.
+     * @return {Token} The token object for the last consumed token.
+     * @method token
+     */
+    token: function(){
+        return this._token;
+    },
+    
+    /**
+     * Returns the name of the token for the given token type.
+     * @param {int} tokenType The type of token to get the name of.
+     * @return {String} The name of the token or "UNKNOWN_TOKEN" for any
+     *      invalid token type.
+     * @method tokenName
+     */
+    tokenName: function(tokenType){
+        if (tokenType < 0 || tokenType > this._tokenData.length){
+            return "UNKNOWN_TOKEN";
+        } else {
+            return this._tokenData[tokenType].name;
+        }
+    },
+    
+    /**
+     * Returns the token type value for the given token name.
+     * @param {String} tokenName The name of the token whose value should be returned.
+     * @return {int} The token type value for the given token name or -1
+     *      for an unknown token.
+     * @method tokenName
+     */    
+    tokenType: function(tokenName){
+        return this._tokenData[tokenName] || -1;
+    },
+    
+    /**
+     * Returns the last consumed token to the token stream.
+     * @method unget
+     */      
+    unget: function(){
+        //if (this._ltIndex > -1){
+        if (this._ltIndexCache.length){
+            this._ltIndex -= this._ltIndexCache.pop();//--;
+            this._token = this._lt[this._ltIndex - 1];
+        } else {
+            throw new Error("Too much lookahead.");
+        }
+    }
+
+};
+
+
+
+
+parserlib.util = {
+StringReader: StringReader,
+SyntaxError : SyntaxError,
+SyntaxUnit  : SyntaxUnit,
+EventTarget : EventTarget,
+TokenStreamBase : TokenStreamBase
+};
+})();
+
+
+/*
+Parser-Lib
+Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+*/
+/* Version v0.2.2, Build time: 17-January-2013 10:26:34 */
+(function(){
+var EventTarget = parserlib.util.EventTarget,
+TokenStreamBase = parserlib.util.TokenStreamBase,
+StringReader = parserlib.util.StringReader,
+SyntaxError = parserlib.util.SyntaxError,
+SyntaxUnit  = parserlib.util.SyntaxUnit;
+
+
+var Colors = {
+    aliceblue       :"#f0f8ff",
+    antiquewhite    :"#faebd7",
+    aqua            :"#00ffff",
+    aquamarine      :"#7fffd4",
+    azure           :"#f0ffff",
+    beige           :"#f5f5dc",
+    bisque          :"#ffe4c4",
+    black           :"#000000",
+    blanchedalmond  :"#ffebcd",
+    blue            :"#0000ff",
+    blueviolet      :"#8a2be2",
+    brown           :"#a52a2a",
+    burlywood       :"#deb887",
+    cadetblue       :"#5f9ea0",
+    chartreuse      :"#7fff00",
+    chocolate       :"#d2691e",
+    coral           :"#ff7f50",
+    cornflowerblue  :"#6495ed",
+    cornsilk        :"#fff8dc",
+    crimson         :"#dc143c",
+    cyan            :"#00ffff",
+    darkblue        :"#00008b",
+    darkcyan        :"#008b8b",
+    darkgoldenrod   :"#b8860b",
+    darkgray        :"#a9a9a9",
+    darkgreen       :"#006400",
+    darkkhaki       :"#bdb76b",
+    darkmagenta     :"#8b008b",
+    darkolivegreen  :"#556b2f",
+    darkorange      :"#ff8c00",
+    darkorchid      :"#9932cc",
+    darkred         :"#8b0000",
+    darksalmon      :"#e9967a",
+    darkseagreen    :"#8fbc8f",
+    darkslateblue   :"#483d8b",
+    darkslategray   :"#2f4f4f",
+    darkturquoise   :"#00ced1",
+    darkviolet      :"#9400d3",
+    deeppink        :"#ff1493",
+    deepskyblue     :"#00bfff",
+    dimgray         :"#696969",
+    dodgerblue      :"#1e90ff",
+    firebrick       :"#b22222",
+    floralwhite     :"#fffaf0",
+    forestgreen     :"#228b22",
+    fuchsia         :"#ff00ff",
+    gainsboro       :"#dcdcdc",
+    ghostwhite      :"#f8f8ff",
+    gold            :"#ffd700",
+    goldenrod       :"#daa520",
+    gray            :"#808080",
+    green           :"#008000",
+    greenyellow     :"#adff2f",
+    honeydew        :"#f0fff0",
+    hotpink         :"#ff69b4",
+    indianred       :"#cd5c5c",
+    indigo          :"#4b0082",
+    ivory           :"#fffff0",
+    khaki           :"#f0e68c",
+    lavender        :"#e6e6fa",
+    lavenderblush   :"#fff0f5",
+    lawngreen       :"#7cfc00",
+    lemonchiffon    :"#fffacd",
+    lightblue       :"#add8e6",
+    lightcoral      :"#f08080",
+    lightcyan       :"#e0ffff",
+    lightgoldenrodyellow  :"#fafad2",
+    lightgray       :"#d3d3d3",
+    lightgreen      :"#90ee90",
+    lightpink       :"#ffb6c1",
+    lightsalmon     :"#ffa07a",
+    lightseagreen   :"#20b2aa",
+    lightskyblue    :"#87cefa",
+    lightslategray  :"#778899",
+    lightsteelblue  :"#b0c4de",
+    lightyellow     :"#ffffe0",
+    lime            :"#00ff00",
+    limegreen       :"#32cd32",
+    linen           :"#faf0e6",
+    magenta         :"#ff00ff",
+    maroon          :"#800000",
+    mediumaquamarine:"#66cdaa",
+    mediumblue      :"#0000cd",
+    mediumorchid    :"#ba55d3",
+    mediumpurple    :"#9370d8",
+    mediumseagreen  :"#3cb371",
+    mediumslateblue :"#7b68ee",
+    mediumspringgreen   :"#00fa9a",
+    mediumturquoise :"#48d1cc",
+    mediumvioletred :"#c71585",
+    midnightblue    :"#191970",
+    mintcream       :"#f5fffa",
+    mistyrose       :"#ffe4e1",
+    moccasin        :"#ffe4b5",
+    navajowhite     :"#ffdead",
+    navy            :"#000080",
+    oldlace         :"#fdf5e6",
+    olive           :"#808000",
+    olivedrab       :"#6b8e23",
+    orange          :"#ffa500",
+    orangered       :"#ff4500",
+    orchid          :"#da70d6",
+    palegoldenrod   :"#eee8aa",
+    palegreen       :"#98fb98",
+    paleturquoise   :"#afeeee",
+    palevioletred   :"#d87093",
+    papayawhip      :"#ffefd5",
+    peachpuff       :"#ffdab9",
+    peru            :"#cd853f",
+    pink            :"#ffc0cb",
+    plum            :"#dda0dd",
+    powderblue      :"#b0e0e6",
+    purple          :"#800080",
+    red             :"#ff0000",
+    rosybrown       :"#bc8f8f",
+    royalblue       :"#4169e1",
+    saddlebrown     :"#8b4513",
+    salmon          :"#fa8072",
+    sandybrown      :"#f4a460",
+    seagreen        :"#2e8b57",
+    seashell        :"#fff5ee",
+    sienna          :"#a0522d",
+    silver          :"#c0c0c0",
+    skyblue         :"#87ceeb",
+    slateblue       :"#6a5acd",
+    slategray       :"#708090",
+    snow            :"#fffafa",
+    springgreen     :"#00ff7f",
+    steelblue       :"#4682b4",
+    tan             :"#d2b48c",
+    teal            :"#008080",
+    thistle         :"#d8bfd8",
+    tomato          :"#ff6347",
+    turquoise       :"#40e0d0",
+    violet          :"#ee82ee",
+    wheat           :"#f5deb3",
+    white           :"#ffffff",
+    whitesmoke      :"#f5f5f5",
+    yellow          :"#ffff00",
+    yellowgreen     :"#9acd32",
+    //CSS2 system colors http://www.w3.org/TR/css3-color/#css2-system
+    activeBorder        :"Active window border.",
+    activecaption       :"Active window caption.",
+    appworkspace        :"Background color of multiple document interface.",
+    background          :"Desktop background.",
+    buttonface          :"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.",
+    buttonhighlight     :"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",
+    buttonshadow        :"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",
+    buttontext          :"Text on push buttons.",
+    captiontext         :"Text in caption, size box, and scrollbar arrow box.",
+    graytext            :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.",
+    highlight           :"Item(s) selected in a control.",
+    highlighttext       :"Text of item(s) selected in a control.",
+    inactiveborder      :"Inactive window border.",
+    inactivecaption     :"Inactive window caption.",
+    inactivecaptiontext :"Color of text in an inactive caption.",
+    infobackground      :"Background color for tooltip controls.",
+    infotext            :"Text color for tooltip controls.",
+    menu                :"Menu background.",
+    menutext            :"Text in menus.",
+    scrollbar           :"Scroll bar gray area.",
+    threeddarkshadow    :"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
+    threedface          :"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
+    threedhighlight     :"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
+    threedlightshadow   :"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
+    threedshadow        :"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
+    window              :"Window background.",
+    windowframe         :"Window frame.",
+    windowtext          :"Text in windows."
+};
+/*global SyntaxUnit, Parser*/
+/**
+ * Represents a selector combinator (whitespace, +, >).
+ * @namespace parserlib.css
+ * @class Combinator
+ * @extends parserlib.util.SyntaxUnit
+ * @constructor
+ * @param {String} text The text representation of the unit. 
+ * @param {int} line The line of text on which the unit resides.
+ * @param {int} col The column of text on which the unit resides.
+ */
+function Combinator(text, line, col){
+    
+    SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE);
+
+    /**
+     * The type of modifier.
+     * @type String
+     * @property type
+     */
+    this.type = "unknown";
+    
+    //pretty simple
+    if (/^\s+$/.test(text)){
+        this.type = "descendant";
+    } else if (text == ">"){
+        this.type = "child";
+    } else if (text == "+"){
+        this.type = "adjacent-sibling";
+    } else if (text == "~"){
+        this.type = "sibling";
+    }
+
+}
+
+Combinator.prototype = new SyntaxUnit();
+Combinator.prototype.constructor = Combinator;
+
+
+/*global SyntaxUnit, Parser*/
+/**
+ * Represents a media feature, such as max-width:500.
+ * @namespace parserlib.css
+ * @class MediaFeature
+ * @extends parserlib.util.SyntaxUnit
+ * @constructor
+ * @param {SyntaxUnit} name The name of the feature.
+ * @param {SyntaxUnit} value The value of the feature or null if none.
+ */
+function MediaFeature(name, value){
+    
+    SyntaxUnit.call(this, "(" + name + (value !== null ? ":" + value : "") + ")", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE);
+
+    /**
+     * The name of the media feature
+     * @type String
+     * @property name
+     */
+    this.name = name;
+
+    /**
+     * The value for the feature or null if there is none.
+     * @type SyntaxUnit
+     * @property value
+     */
+    this.value = value;
+}
+
+MediaFeature.prototype = new SyntaxUnit();
+MediaFeature.prototype.constructor = MediaFeature;
+
+
+/*global SyntaxUnit, Parser*/
+/**
+ * Represents an individual media query.
+ * @namespace parserlib.css
+ * @class MediaQuery
+ * @extends parserlib.util.SyntaxUnit
+ * @constructor
+ * @param {String} modifier The modifier "not" or "only" (or null).
+ * @param {String} mediaType The type of media (i.e., "print").
+ * @param {Array} parts Array of selectors parts making up this selector.
+ * @param {int} line The line of text on which the unit resides.
+ * @param {int} col The column of text on which the unit resides.
+ */
+function MediaQuery(modifier, mediaType, features, line, col){
+    
+    SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE); 
+
+    /**
+     * The media modifier ("not" or "only")
+     * @type String
+     * @property modifier
+     */
+    this.modifier = modifier;
+
+    /**
+     * The mediaType (i.e., "print")
+     * @type String
+     * @property mediaType
+     */
+    this.mediaType = mediaType;    
+    
+    /**
+     * The parts that make up the selector.
+     * @type Array
+     * @property features
+     */
+    this.features = features;
+
+}
+
+MediaQuery.prototype = new SyntaxUnit();
+MediaQuery.prototype.constructor = MediaQuery;
+
+
+/*global Tokens, TokenStream, SyntaxError, Properties, Validation, ValidationError, SyntaxUnit,
+    PropertyValue, PropertyValuePart, SelectorPart, SelectorSubPart, Selector,
+    PropertyName, Combinator, MediaFeature, MediaQuery, EventTarget */
+
+/**
+ * A CSS3 parser.
+ * @namespace parserlib.css
+ * @class Parser
+ * @constructor
+ * @param {Object} options (Optional) Various options for the parser:
+ *      starHack (true|false) to allow IE6 star hack as valid,
+ *      underscoreHack (true|false) to interpret leading underscores
+ *      as IE6-7 targeting for known properties, ieFilters (true|false)
+ *      to indicate that IE < 8 filters should be accepted and not throw
+ *      syntax errors.
+ */
+function Parser(options){
+
+    //inherit event functionality
+    EventTarget.call(this);
+
+
+    this.options = options || {};
+
+    this._tokenStream = null;
+}
+
+//Static constants
+Parser.DEFAULT_TYPE = 0;
+Parser.COMBINATOR_TYPE = 1;
+Parser.MEDIA_FEATURE_TYPE = 2;
+Parser.MEDIA_QUERY_TYPE = 3;
+Parser.PROPERTY_NAME_TYPE = 4;
+Parser.PROPERTY_VALUE_TYPE = 5;
+Parser.PROPERTY_VALUE_PART_TYPE = 6;
+Parser.SELECTOR_TYPE = 7;
+Parser.SELECTOR_PART_TYPE = 8;
+Parser.SELECTOR_SUB_PART_TYPE = 9;
+
+Parser.prototype = function(){
+
+    var proto = new EventTarget(),  //new prototype
+        prop,
+        additions =  {
+        
+            //restore constructor
+            constructor: Parser,
+                        
+            //instance constants - yuck
+            DEFAULT_TYPE : 0,
+            COMBINATOR_TYPE : 1,
+            MEDIA_FEATURE_TYPE : 2,
+            MEDIA_QUERY_TYPE : 3,
+            PROPERTY_NAME_TYPE : 4,
+            PROPERTY_VALUE_TYPE : 5,
+            PROPERTY_VALUE_PART_TYPE : 6,
+            SELECTOR_TYPE : 7,
+            SELECTOR_PART_TYPE : 8,
+            SELECTOR_SUB_PART_TYPE : 9,            
+        
+            //-----------------------------------------------------------------
+            // Grammar
+            //-----------------------------------------------------------------
+        
+            _stylesheet: function(){
+            
+                /*
+                 * stylesheet
+                 *  : [ CHARSET_SYM S* STRING S* ';' ]?
+                 *    [S|CDO|CDC]* [ import [S|CDO|CDC]* ]*
+                 *    [ namespace [S|CDO|CDC]* ]*
+                 *    [ [ ruleset | media | page | font_face | keyframes ] [S|CDO|CDC]* ]*
+                 *  ;
+                 */ 
+               
+                var tokenStream = this._tokenStream,
+                    charset     = null,
+                    count,
+                    token,
+                    tt;
+                    
+                this.fire("startstylesheet");
+            
+                //try to read character set
+                this._charset();
+                
+                this._skipCruft();
+
+                //try to read imports - may be more than one
+                while (tokenStream.peek() == Tokens.IMPORT_SYM){
+                    this._import();
+                    this._skipCruft();
+                }
+                
+                //try to read namespaces - may be more than one
+                while (tokenStream.peek() == Tokens.NAMESPACE_SYM){
+                    this._namespace();
+                    this._skipCruft();
+                }
+                
+                //get the next token
+                tt = tokenStream.peek();
+                
+                //try to read the rest
+                while(tt > Tokens.EOF){
+                
+                    try {
+                
+                        switch(tt){
+                            case Tokens.MEDIA_SYM:
+                                this._media();
+                                this._skipCruft();
+                                break;
+                            case Tokens.PAGE_SYM:
+                                this._page(); 
+                                this._skipCruft();
+                                break;                   
+                            case Tokens.FONT_FACE_SYM:
+                                this._font_face(); 
+                                this._skipCruft();
+                                break;  
+                            case Tokens.KEYFRAMES_SYM:
+                                this._keyframes(); 
+                                this._skipCruft();
+                                break;                                
+                            case Tokens.UNKNOWN_SYM:  //unknown @ rule
+                                tokenStream.get();
+                                if (!this.options.strict){
+                                
+                                    //fire error event
+                                    this.fire({
+                                        type:       "error",
+                                        error:      null,
+                                        message:    "Unknown @ rule: " + tokenStream.LT(0).value + ".",
+                                        line:       tokenStream.LT(0).startLine,
+                                        col:        tokenStream.LT(0).startCol
+                                    });                          
+                                    
+                                    //skip braces
+                                    count=0;
+                                    while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) == Tokens.LBRACE){
+                                        count++;    //keep track of nesting depth
+                                    }
+                                    
+                                    while(count){
+                                        tokenStream.advance([Tokens.RBRACE]);
+                                        count--;
+                                    }
+                                    
+                                } else {
+                                    //not a syntax error, rethrow it
+                                    throw new SyntaxError("Unknown @ rule.", tokenStream.LT(0).startLine, tokenStream.LT(0).startCol);
+                                }                                
+                                break;
+                            case Tokens.S:
+                                this._readWhitespace();
+                                break;
+                            default:                            
+                                if(!this._ruleset()){
+                                
+                                    //error handling for known issues
+                                    switch(tt){
+                                        case Tokens.CHARSET_SYM:
+                                            token = tokenStream.LT(1);
+                                            this._charset(false);
+                                            throw new SyntaxError("@charset not allowed here.", token.startLine, token.startCol);
+                                        case Tokens.IMPORT_SYM:
+                                            token = tokenStream.LT(1);
+                                            this._import(false);
+                                            throw new SyntaxError("@import not allowed here.", token.startLine, token.startCol);
+                                        case Tokens.NAMESPACE_SYM:
+                                            token = tokenStream.LT(1);
+                                            this._namespace(false);
+                                            throw new SyntaxError("@namespace not allowed here.", token.startLine, token.startCol);
+                                        default:
+                                            tokenStream.get();  //get the last token
+                                            this._unexpectedToken(tokenStream.token());
+                                    }
+                                
+                                }
+                        }
+                    } catch(ex) {
+                        if (ex instanceof SyntaxError && !this.options.strict){
+                            this.fire({
+                                type:       "error",
+                                error:      ex,
+                                message:    ex.message,
+                                line:       ex.line,
+                                col:        ex.col
+                            });                     
+                        } else {
+                            throw ex;
+                        }
+                    }
+                    
+                    tt = tokenStream.peek();
+                }
+                
+                if (tt != Tokens.EOF){
+                    this._unexpectedToken(tokenStream.token());
+                }
+            
+                this.fire("endstylesheet");
+            },
+            
+            _charset: function(emit){
+                var tokenStream = this._tokenStream,
+                    charset,
+                    token,
+                    line,
+                    col;
+                    
+                if (tokenStream.match(Tokens.CHARSET_SYM)){
+                    line = tokenStream.token().startLine;
+                    col = tokenStream.token().startCol;
+                
+                    this._readWhitespace();
+                    tokenStream.mustMatch(Tokens.STRING);
+                    
+                    token = tokenStream.token();
+                    charset = token.value;
+                    
+                    this._readWhitespace();
+                    tokenStream.mustMatch(Tokens.SEMICOLON);
+                    
+                    if (emit !== false){
+                        this.fire({ 
+                            type:   "charset",
+                            charset:charset,
+                            line:   line,
+                            col:    col
+                        });
+                    }
+                }            
+            },
+            
+            _import: function(emit){
+                /*
+                 * import
+                 *   : IMPORT_SYM S*
+                 *    [STRING|URI] S* media_query_list? ';' S*
+                 */    
+            
+                var tokenStream = this._tokenStream,
+                    tt,
+                    uri,
+                    importToken,
+                    mediaList   = [];
+                
+                //read import symbol
+                tokenStream.mustMatch(Tokens.IMPORT_SYM);
+                importToken = tokenStream.token();
+                this._readWhitespace();
+                
+                tokenStream.mustMatch([Tokens.STRING, Tokens.URI]);
+                
+                //grab the URI value
+                uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1");                
+
+                this._readWhitespace();
+                
+                mediaList = this._media_query_list();
+                
+                //must end with a semicolon
+                tokenStream.mustMatch(Tokens.SEMICOLON);
+                this._readWhitespace();
+                
+                if (emit !== false){
+                    this.fire({
+                        type:   "import",
+                        uri:    uri,
+                        media:  mediaList,
+                        line:   importToken.startLine,
+                        col:    importToken.startCol
+                    });
+                }
+        
+            },
+            
+            _namespace: function(emit){
+                /*
+                 * namespace
+                 *   : NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S*
+                 */    
+            
+                var tokenStream = this._tokenStream,
+                    line,
+                    col,
+                    prefix,
+                    uri;
+                
+                //read import symbol
+                tokenStream.mustMatch(Tokens.NAMESPACE_SYM);
+                line = tokenStream.token().startLine;
+                col = tokenStream.token().startCol;
+                this._readWhitespace();
+                
+                //it's a namespace prefix - no _namespace_prefix() method because it's just an IDENT
+                if (tokenStream.match(Tokens.IDENT)){
+                    prefix = tokenStream.token().value;
+                    this._readWhitespace();
+                }
+                
+                tokenStream.mustMatch([Tokens.STRING, Tokens.URI]);
+                /*if (!tokenStream.match(Tokens.STRING)){
+                    tokenStream.mustMatch(Tokens.URI);
+                }*/
+                
+                //grab the URI value
+                uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1");                
+
+                this._readWhitespace();
+
+                //must end with a semicolon
+                tokenStream.mustMatch(Tokens.SEMICOLON);
+                this._readWhitespace();
+                
+                if (emit !== false){
+                    this.fire({
+                        type:   "namespace",
+                        prefix: prefix,
+                        uri:    uri,
+                        line:   line,
+                        col:    col
+                    });
+                }
+        
+            },            
+                       
+            _media: function(){
+                /*
+                 * media
+                 *   : MEDIA_SYM S* media_query_list S* '{' S* ruleset* '}' S*
+                 *   ;
+                 */
+                var tokenStream     = this._tokenStream,
+                    line,
+                    col,
+                    mediaList;//       = [];
+                
+                //look for @media
+                tokenStream.mustMatch(Tokens.MEDIA_SYM);
+                line = tokenStream.token().startLine;
+                col = tokenStream.token().startCol;
+                
+                this._readWhitespace();               
+
+                mediaList = this._media_query_list();
+
+                tokenStream.mustMatch(Tokens.LBRACE);
+                this._readWhitespace();
+                
+                this.fire({
+                    type:   "startmedia",
+                    media:  mediaList,
+                    line:   line,
+                    col:    col
+                });
+                
+                while(true) {
+                    if (tokenStream.peek() == Tokens.PAGE_SYM){
+                        this._page();
+                    } else if (!this._ruleset()){
+                        break;
+                    }                
+                }
+                
+                tokenStream.mustMatch(Tokens.RBRACE);
+                this._readWhitespace();
+        
+                this.fire({
+                    type:   "endmedia",
+                    media:  mediaList,
+                    line:   line,
+                    col:    col
+                });
+            },                           
+        
+
+            //CSS3 Media Queries
+            _media_query_list: function(){
+                /*
+                 * media_query_list
+                 *   : S* [media_query [ ',' S* media_query ]* ]?
+                 *   ;
+                 */
+                var tokenStream = this._tokenStream,
+                    mediaList   = [];
+                
+                
+                this._readWhitespace();
+                
+                if (tokenStream.peek() == Tokens.IDENT || tokenStream.peek() == Tokens.LPAREN){
+                    mediaList.push(this._media_query());
+                }
+                
+                while(tokenStream.match(Tokens.COMMA)){
+                    this._readWhitespace();
+                    mediaList.push(this._media_query());
+                }
+                
+                return mediaList;
+            },
+            
+            /*
+             * Note: "expression" in the grammar maps to the _media_expression
+             * method.
+             
+             */
+            _media_query: function(){
+                /*
+                 * media_query
+                 *   : [ONLY | NOT]? S* media_type S* [ AND S* expression ]*
+                 *   | expression [ AND S* expression ]*
+                 *   ;
+                 */
+                var tokenStream = this._tokenStream,
+                    type        = null,
+                    ident       = null,
+                    token       = null,
+                    expressions = [];
+                    
+                if (tokenStream.match(Tokens.IDENT)){
+                    ident = tokenStream.token().value.toLowerCase();
+                    
+                    //since there's no custom tokens for these, need to manually check
+                    if (ident != "only" && ident != "not"){
+                        tokenStream.unget();
+                        ident = null;
+                    } else {
+                        token = tokenStream.token();
+                    }
+                }
+                                
+                this._readWhitespace();
+                
+                if (tokenStream.peek() == Tokens.IDENT){
+                    type = this._media_type();
+                    if (token === null){
+                        token = tokenStream.token();
+                    }
+                } else if (tokenStream.peek() == Tokens.LPAREN){
+                    if (token === null){
+                        token = tokenStream.LT(1);
+                    }
+                    expressions.push(this._media_expression());
+                }                               
+                
+                if (type === null && expressions.length === 0){
+                    return null;
+                } else {                
+                    this._readWhitespace();
+                    while (tokenStream.match(Tokens.IDENT)){
+                        if (tokenStream.token().value.toLowerCase() != "and"){
+                            this._unexpectedToken(tokenStream.token());
+                        }
+                        
+                        this._readWhitespace();
+                        expressions.push(this._media_expression());
+                    }
+                }
+
+                return new MediaQuery(ident, type, expressions, token.startLine, token.startCol);
+            },
+
+            //CSS3 Media Queries
+            _media_type: function(){
+                /*
+                 * media_type
+                 *   : IDENT
+                 *   ;
+                 */
+                return this._media_feature();           
+            },
+
+            /**
+             * Note: in CSS3 Media Queries, this is called "expression".
+             * Renamed here to avoid conflict with CSS3 Selectors
+             * definition of "expression". Also note that "expr" in the
+             * grammar now maps to "expression" from CSS3 selectors.
+             * @method _media_expression
+             * @private
+             */
+            _media_expression: function(){
+                /*
+                 * expression
+                 *  : '(' S* media_feature S* [ ':' S* expr ]? ')' S*
+                 *  ;
+                 */
+                var tokenStream = this._tokenStream,
+                    feature     = null,
+                    token,
+                    expression  = null;
+                
+                tokenStream.mustMatch(Tokens.LPAREN);
+                
+                feature = this._media_feature();
+                this._readWhitespace();
+                
+                if (tokenStream.match(Tokens.COLON)){
+                    this._readWhitespace();
+                    token = tokenStream.LT(1);
+                    expression = this._expression();
+                }
+                
+                tokenStream.mustMatch(Tokens.RPAREN);
+                this._readWhitespace();
+
+                return new MediaFeature(feature, (expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null));            
+            },
+
+            //CSS3 Media Queries
+            _media_feature: function(){
+                /*
+                 * media_feature
+                 *   : IDENT
+                 *   ;
+                 */
+                var tokenStream = this._tokenStream;
+                    
+                tokenStream.mustMatch(Tokens.IDENT);
+                
+                return SyntaxUnit.fromToken(tokenStream.token());            
+            },
+            
+            //CSS3 Paged Media
+            _page: function(){
+                /*
+                 * page:
+                 *    PAGE_SYM S* IDENT? pseudo_page? S* 
+                 *    '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S*
+                 *    ;
+                 */            
+                var tokenStream = this._tokenStream,
+                    line,
+                    col,
+                    identifier  = null,
+                    pseudoPage  = null;
+                
+                //look for @page
+                tokenStream.mustMatch(Tokens.PAGE_SYM);
+                line = tokenStream.token().startLine;
+                col = tokenStream.token().startCol;
+                
+                this._readWhitespace();
+                
+                if (tokenStream.match(Tokens.IDENT)){
+                    identifier = tokenStream.token().value;
+
+                    //The value 'auto' may not be used as a page name and MUST be treated as a syntax error.
+                    if (identifier.toLowerCase() === "auto"){
+                        this._unexpectedToken(tokenStream.token());
+                    }
+                }                
+                
+                //see if there's a colon upcoming
+                if (tokenStream.peek() == Tokens.COLON){
+                    pseudoPage = this._pseudo_page();
+                }
+            
+                this._readWhitespace();
+                
+                this.fire({
+                    type:   "startpage",
+                    id:     identifier,
+                    pseudo: pseudoPage,
+                    line:   line,
+                    col:    col
+                });                   
+
+                this._readDeclarations(true, true);                
+                
+                this.fire({
+                    type:   "endpage",
+                    id:     identifier,
+                    pseudo: pseudoPage,
+                    line:   line,
+                    col:    col
+                });             
+            
+            },
+            
+            //CSS3 Paged Media
+            _margin: function(){
+                /*
+                 * margin :
+                 *    margin_sym S* '{' declaration [ ';' S* declaration? ]* '}' S*
+                 *    ;
+                 */
+                var tokenStream = this._tokenStream,
+                    line,
+                    col,
+                    marginSym   = this._margin_sym();
+
+                if (marginSym){
+                    line = tokenStream.token().startLine;
+                    col = tokenStream.token().startCol;
+                
+                    this.fire({
+                        type: "startpagemargin",
+                        margin: marginSym,
+                        line:   line,
+                        col:    col
+                    });    
+                    
+                    this._readDeclarations(true);
+
+                    this.fire({
+                        type: "endpagemargin",
+                        margin: marginSym,
+                        line:   line,
+                        col:    col
+                    });    
+                    return true;
+                } else {
+                    return false;
+                }
+            },
+
+            //CSS3 Paged Media
+            _margin_sym: function(){
+            
+                /*
+                 * margin_sym :
+                 *    TOPLEFTCORNER_SYM | 
+                 *    TOPLEFT_SYM | 
+                 *    TOPCENTER_SYM | 
+                 *    TOPRIGHT_SYM | 
+                 *    TOPRIGHTCORNER_SYM |
+                 *    BOTTOMLEFTCORNER_SYM | 
+                 *    BOTTOMLEFT_SYM | 
+                 *    BOTTOMCENTER_SYM | 
+                 *    BOTTOMRIGHT_SYM |
+                 *    BOTTOMRIGHTCORNER_SYM |
+                 *    LEFTTOP_SYM |
+                 *    LEFTMIDDLE_SYM |
+                 *    LEFTBOTTOM_SYM |
+                 *    RIGHTTOP_SYM |
+                 *    RIGHTMIDDLE_SYM |
+                 *    RIGHTBOTTOM_SYM 
+                 *    ;
+                 */
+            
+                var tokenStream = this._tokenStream;
+            
+                if(tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM,
+                        Tokens.TOPCENTER_SYM, Tokens.TOPRIGHT_SYM, Tokens.TOPRIGHTCORNER_SYM,
+                        Tokens.BOTTOMLEFTCORNER_SYM, Tokens.BOTTOMLEFT_SYM, 
+                        Tokens.BOTTOMCENTER_SYM, Tokens.BOTTOMRIGHT_SYM,
+                        Tokens.BOTTOMRIGHTCORNER_SYM, Tokens.LEFTTOP_SYM, 
+                        Tokens.LEFTMIDDLE_SYM, Tokens.LEFTBOTTOM_SYM, Tokens.RIGHTTOP_SYM,
+                        Tokens.RIGHTMIDDLE_SYM, Tokens.RIGHTBOTTOM_SYM]))
+                {
+                    return SyntaxUnit.fromToken(tokenStream.token());                
+                } else {
+                    return null;
+                }
+            
+            },
+            
+            _pseudo_page: function(){
+                /*
+                 * pseudo_page
+                 *   : ':' IDENT
+                 *   ;    
+                 */
+        
+                var tokenStream = this._tokenStream;
+                
+                tokenStream.mustMatch(Tokens.COLON);
+                tokenStream.mustMatch(Tokens.IDENT);
+                
+                //TODO: CSS3 Paged Media says only "left", "center", and "right" are allowed
+                
+                return tokenStream.token().value;
+            },
+            
+            _font_face: function(){
+                /*
+                 * font_face
+                 *   : FONT_FACE_SYM S* 
+                 *     '{' S* declaration [ ';' S* declaration ]* '}' S*
+                 *   ;
+                 */     
+                var tokenStream = this._tokenStream,
+                    line,
+                    col;
+                
+                //look for @page
+                tokenStream.mustMatch(Tokens.FONT_FACE_SYM);
+                line = tokenStream.token().startLine;
+                col = tokenStream.token().startCol;
+                
+                this._readWhitespace();
+
+                this.fire({
+                    type:   "startfontface",
+                    line:   line,
+                    col:    col
+                });                    
+                
+                this._readDeclarations(true);
+                
+                this.fire({
+                    type:   "endfontface",
+                    line:   line,
+                    col:    col
+                });              
+            },
+
+            _operator: function(inFunction){
+            
+                /*
+                 * operator (outside function)
+                 *  : '/' S* | ',' S* | /( empty )/
+                 * operator (inside function)
+                 *  : '/' S* | '+' S* | '*' S* | '-' S* /( empty )/
+                 *  ;
+                 */    
+                 
+                var tokenStream = this._tokenStream,
+                    token       = null;
+                
+                if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) ||
+                    (inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS]))){
+                    token =  tokenStream.token();
+                    this._readWhitespace();
+                } 
+                return token ? PropertyValuePart.fromToken(token) : null;
+                
+            },
+            
+            _combinator: function(){
+            
+                /*
+                 * combinator
+                 *  : PLUS S* | GREATER S* | TILDE S* | S+
+                 *  ;
+                 */    
+                 
+                var tokenStream = this._tokenStream,
+                    value       = null,
+                    token;
+                
+                if(tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])){                
+                    token = tokenStream.token();
+                    value = new Combinator(token.value, token.startLine, token.startCol);
+                    this._readWhitespace();
+                }
+                
+                return value;
+            },
+            
+            _unary_operator: function(){
+            
+                /*
+                 * unary_operator
+                 *  : '-' | '+'
+                 *  ;
+                 */
+                 
+                var tokenStream = this._tokenStream;
+                
+                if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])){
+                    return tokenStream.token().value;
+                } else {
+                    return null;
+                }         
+            },
+            
+            _property: function(){
+            
+                /*
+                 * property
+                 *   : IDENT S*
+                 *   ;        
+                 */
+                 
+                var tokenStream = this._tokenStream,
+                    value       = null,
+                    hack        = null,
+                    tokenValue,
+                    token,
+                    line,
+                    col;
+                    
+                //check for star hack - throws error if not allowed
+                if (tokenStream.peek() == Tokens.STAR && this.options.starHack){
+                    tokenStream.get();
+                    token = tokenStream.token();
+                    hack = token.value;
+                    line = token.startLine;
+                    col = token.startCol;
+                }
+                
+                if(tokenStream.match(Tokens.IDENT)){
+                    token = tokenStream.token();
+                    tokenValue = token.value;
+                    
+                    //check for underscore hack - no error if not allowed because it's valid CSS syntax
+                    if (tokenValue.charAt(0) == "_" && this.options.underscoreHack){
+                        hack = "_";
+                        tokenValue = tokenValue.substring(1);
+                    }
+                    
+                    value = new PropertyName(tokenValue, hack, (line||token.startLine), (col||token.startCol));
+                    this._readWhitespace();
+                }
+                
+                return value;
+            },
+        
+            //Augmented with CSS3 Selectors
+            _ruleset: function(){
+                /*
+                 * ruleset
+                 *   : selectors_group
+                 *     '{' S* declaration? [ ';' S* declaration? ]* '}' S*
+                 *   ;    
+                 */    
+                 
+                var tokenStream = this._tokenStream,
+                    tt,
+                    selectors;
+
+
+                /*
+                 * Error Recovery: If even a single selector fails to parse,
+                 * then the entire ruleset should be thrown away.
+                 */
+                try {
+                    selectors = this._selectors_group();
+                } catch (ex){
+                    if (ex instanceof SyntaxError && !this.options.strict){
+                    
+                        //fire error event
+                        this.fire({
+                            type:       "error",
+                            error:      ex,
+                            message:    ex.message,
+                            line:       ex.line,
+                            col:        ex.col
+                        });                          
+                        
+                        //skip over everything until closing brace
+                        tt = tokenStream.advance([Tokens.RBRACE]);
+                        if (tt == Tokens.RBRACE){
+                            //if there's a right brace, the rule is finished so don't do anything
+                        } else {
+                            //otherwise, rethrow the error because it wasn't handled properly
+                            throw ex;
+                        }                        
+                        
+                    } else {
+                        //not a syntax error, rethrow it
+                        throw ex;
+                    }                
+                
+                    //trigger parser to continue
+                    return true;
+                }
+                
+                //if it got here, all selectors parsed
+                if (selectors){ 
+                                    
+                    this.fire({
+                        type:       "startrule",
+                        selectors:  selectors,
+                        line:       selectors[0].line,
+                        col:        selectors[0].col
+                    });                
+                    
+                    this._readDeclarations(true);                
+                    
+                    this.fire({
+                        type:       "endrule",
+                        selectors:  selectors,
+                        line:       selectors[0].line,
+                        col:        selectors[0].col
+                    });  
+                    
+                }
+                
+                return selectors;
+                
+            },
+
+            //CSS3 Selectors
+            _selectors_group: function(){
+            
+                /*            
+                 * selectors_group
+                 *   : selector [ COMMA S* selector ]*
+                 *   ;
+                 */           
+                var tokenStream = this._tokenStream,
+                    selectors   = [],
+                    selector;
+                    
+                selector = this._selector();
+                if (selector !== null){
+                
+                    selectors.push(selector);
+                    while(tokenStream.match(Tokens.COMMA)){
+                        this._readWhitespace();
+                        selector = this._selector();
+                        if (selector !== null){
+                            selectors.push(selector);
+                        } else {
+                            this._unexpectedToken(tokenStream.LT(1));
+                        }
+                    }
+                }
+
+                return selectors.length ? selectors : null;
+            },
+                
+            //CSS3 Selectors
+            _selector: function(){
+                /*
+                 * selector
+                 *   : simple_selector_sequence [ combinator simple_selector_sequence ]*
+                 *   ;    
+                 */
+                 
+                var tokenStream = this._tokenStream,
+                    selector    = [],
+                    nextSelector = null,
+                    combinator  = null,
+                    ws          = null;
+                
+                //if there's no simple selector, then there's no selector
+                nextSelector = this._simple_selector_sequence();
+                if (nextSelector === null){
+                    return null;
+                }
+                
+                selector.push(nextSelector);
+                
+                do {
+                    
+                    //look for a combinator
+                    combinator = this._combinator();
+                    
+                    if (combinator !== null){
+                        selector.push(combinator);
+                        nextSelector = this._simple_selector_sequence();
+                        
+                        //there must be a next selector
+                        if (nextSelector === null){
+                            this._unexpectedToken(tokenStream.LT(1));
+                        } else {
+                        
+                            //nextSelector is an instance of SelectorPart
+                            selector.push(nextSelector);
+                        }
+                    } else {
+                        
+                        //if there's not whitespace, we're done
+                        if (this._readWhitespace()){           
+        
+                            //add whitespace separator
+                            ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol);
+                            
+                            //combinator is not required
+                            combinator = this._combinator();
+                            
+                            //selector is required if there's a combinator
+                            nextSelector = this._simple_selector_sequence();
+                            if (nextSelector === null){                        
+                                if (combinator !== null){
+                                    this._unexpectedToken(tokenStream.LT(1));
+                                }
+                            } else {
+                                
+                                if (combinator !== null){
+                                    selector.push(combinator);
+                                } else {
+                                    selector.push(ws);
+                                }
+                                
+                                selector.push(nextSelector);
+                            }     
+                        } else {
+                            break;
+                        }               
+                    
+                    }
+                } while(true);
+                
+                return new Selector(selector, selector[0].line, selector[0].col);
+            },
+            
+            //CSS3 Selectors
+            _simple_selector_sequence: function(){
+                /*
+                 * simple_selector_sequence
+                 *   : [ type_selector | universal ]
+                 *     [ HASH | class | attrib | pseudo | negation ]*
+                 *   | [ HASH | class | attrib | pseudo | negation ]+
+                 *   ;
+                 */
+                 
+                var tokenStream = this._tokenStream,
+                
+                    //parts of a simple selector
+                    elementName = null,
+                    modifiers   = [],
+                    
+                    //complete selector text
+                    selectorText= "",
+
+                    //the different parts after the element name to search for
+                    components  = [
+                        //HASH
+                        function(){
+                            return tokenStream.match(Tokens.HASH) ?
+                                    new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) :
+                                    null;
+                        },
+                        this._class,
+                        this._attrib,
+                        this._pseudo,
+                        this._negation
+                    ],
+                    i           = 0,
+                    len         = components.length,
+                    component   = null,
+                    found       = false,
+                    line,
+                    col;
+                    
+                    
+                //get starting line and column for the selector
+                line = tokenStream.LT(1).startLine;
+                col = tokenStream.LT(1).startCol;
+                                        
+                elementName = this._type_selector();
+                if (!elementName){
+                    elementName = this._universal();
+                }
+                
+                if (elementName !== null){
+                    selectorText += elementName;
+                }                
+                
+                while(true){
+
+                    //whitespace means we're done
+                    if (tokenStream.peek() === Tokens.S){
+                        break;
+                    }
+                
+                    //check for each component
+                    while(i < len && component === null){
+                        component = components[i++].call(this);
+                    }
+        
+                    if (component === null){
+                    
+                        //we don't have a selector
+                        if (selectorText === ""){
+                            return null;
+                        } else {
+                            break;
+                        }
+                    } else {
+                        i = 0;
+                        modifiers.push(component);
+                        selectorText += component.toString(); 
+                        component = null;
+                    }
+                }
+
+                 
+                return selectorText !== "" ?
+                        new SelectorPart(elementName, modifiers, selectorText, line, col) :
+                        null;
+            },            
+            
+            //CSS3 Selectors
+            _type_selector: function(){
+                /*
+                 * type_selector
+                 *   : [ namespace_prefix ]? element_name
+                 *   ;
+                 */
+                 
+                var tokenStream = this._tokenStream,
+                    ns          = this._namespace_prefix(),
+                    elementName = this._element_name();
+                    
+                if (!elementName){                    
+                    /*
+                     * Need to back out the namespace that was read due to both
+                     * type_selector and universal reading namespace_prefix
+                     * first. Kind of hacky, but only way I can figure out
+                     * right now how to not change the grammar.
+                     */
+                    if (ns){
+                        tokenStream.unget();
+                        if (ns.length > 1){
+                            tokenStream.unget();
+                        }
+                    }
+                
+                    return null;
+                } else {     
+                    if (ns){
+                        elementName.text = ns + elementName.text;
+                        elementName.col -= ns.length;
+                    }
+                    return elementName;
+                }
+            },
+            
+            //CSS3 Selectors
+            _class: function(){
+                /*
+                 * class
+                 *   : '.' IDENT
+                 *   ;
+                 */    
+                 
+                var tokenStream = this._tokenStream,
+                    token;
+                
+                if (tokenStream.match(Tokens.DOT)){
+                    tokenStream.mustMatch(Tokens.IDENT);    
+                    token = tokenStream.token();
+                    return new SelectorSubPart("." + token.value, "class", token.startLine, token.startCol - 1);        
+                } else {
+                    return null;
+                }
+        
+            },
+            
+            //CSS3 Selectors
+            _element_name: function(){
+                /*
+                 * element_name
+                 *   : IDENT
+                 *   ;
+                 */    
+                
+                var tokenStream = this._tokenStream,
+                    token;
+                
+                if (tokenStream.match(Tokens.IDENT)){
+                    token = tokenStream.token();
+                    return new SelectorSubPart(token.value, "elementName", token.startLine, token.startCol);        
+                
+                } else {
+                    return null;
+                }
+            },
+            
+            //CSS3 Selectors
+            _namespace_prefix: function(){
+                /*            
+                 * namespace_prefix
+                 *   : [ IDENT | '*' ]? '|'
+                 *   ;
+                 */
+                var tokenStream = this._tokenStream,
+                    value       = "";
+                    
+                //verify that this is a namespace prefix
+                if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE){
+                        
+                    if(tokenStream.match([Tokens.IDENT, Tokens.STAR])){
+                        value += tokenStream.token().value;
+                    }
+                    
+                    tokenStream.mustMatch(Tokens.PIPE);
+                    value += "|";
+                    
+                }
+                
+                return value.length ? value : null;                
+            },
+            
+            //CSS3 Selectors
+            _universal: function(){
+                /*
+                 * universal
+                 *   : [ namespace_prefix ]? '*'
+                 *   ;            
+                 */
+                var tokenStream = this._tokenStream,
+                    value       = "",
+                    ns;
+                    
+                ns = this._namespace_prefix();
+                if(ns){
+                    value += ns;
+                }
+                
+                if(tokenStream.match(Tokens.STAR)){
+                    value += "*";
+                }
+                
+                return value.length ? value : null;
+                
+           },
+            
+            //CSS3 Selectors
+            _attrib: function(){
+                /*
+                 * attrib
+                 *   : '[' S* [ namespace_prefix ]? IDENT S*
+                 *         [ [ PREFIXMATCH |
+                 *             SUFFIXMATCH |
+                 *             SUBSTRINGMATCH |
+                 *             '=' |
+                 *             INCLUDES |
+                 *             DASHMATCH ] S* [ IDENT | STRING ] S*
+                 *         ]? ']'
+                 *   ;    
+                 */
+                 
+                var tokenStream = this._tokenStream,
+                    value       = null,
+                    ns,
+                    token;
+                
+                if (tokenStream.match(Tokens.LBRACKET)){
+                    token = tokenStream.token();
+                    value = token.value;
+                    value += this._readWhitespace();
+                    
+                    ns = this._namespace_prefix();
+                    
+                    if (ns){
+                        value += ns;
+                    }
+                                        
+                    tokenStream.mustMatch(Tokens.IDENT);
+                    value += tokenStream.token().value;                    
+                    value += this._readWhitespace();
+       

<TRUNCATED>

[40/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/keyboard/vim/commands.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/keyboard/vim/commands.js b/src/fauxton/assets/js/libs/ace/keyboard/vim/commands.js
new file mode 100644
index 0000000..dd3357d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/keyboard/vim/commands.js
@@ -0,0 +1,613 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+ 
+define(function(require, exports, module) {
+
+"never use strict";
+
+var lang = require("../../lib/lang");
+var util = require("./maps/util");
+var motions = require("./maps/motions");
+var operators = require("./maps/operators");
+var alias = require("./maps/aliases");
+var registers = require("./registers");
+
+var NUMBER = 1;
+var OPERATOR = 2;
+var MOTION = 3;
+var ACTION = 4;
+var HMARGIN = 8; // Minimum amount of line separation between margins;
+
+var repeat = function repeat(fn, count, args) {
+    while (0 < count--)
+        fn.apply(this, args);
+};
+
+var ensureScrollMargin = function(editor) {
+    var renderer = editor.renderer;
+    var pos = renderer.$cursorLayer.getPixelPosition();
+
+    var top = pos.top;
+
+    var margin = HMARGIN * renderer.layerConfig.lineHeight;
+    if (2 * margin > renderer.$size.scrollerHeight)
+        margin = renderer.$size.scrollerHeight / 2;
+
+    if (renderer.scrollTop > top - margin) {
+        renderer.session.setScrollTop(top - margin);
+    }
+
+    if (renderer.scrollTop + renderer.$size.scrollerHeight < top + margin + renderer.lineHeight) {
+        renderer.session.setScrollTop(top + margin + renderer.lineHeight - renderer.$size.scrollerHeight);
+    }
+};
+
+var actions = exports.actions = {
+    "z": {
+        param: true,
+        fn: function(editor, range, count, param) {
+            switch (param) {
+                case "z":
+                    editor.renderer.alignCursor(null, 0.5);
+                    break;
+                case "t":
+                    editor.renderer.alignCursor(null, 0);
+                    break;
+                case "b":
+                    editor.renderer.alignCursor(null, 1);
+                    break;
+                case "c":
+                    editor.session.onFoldWidgetClick(range.start.row, {domEvent:{target :{}}});
+                    break;
+                case "o":
+                    editor.session.onFoldWidgetClick(range.start.row, {domEvent:{target :{}}});
+                    break;
+                case "C":
+                    editor.session.foldAll();
+                    break;
+                case "O":
+                    editor.session.unfold();
+                    break;
+            }
+        }
+    },
+    "r": {
+        param: true,
+        fn: function(editor, range, count, param) {
+            if (param && param.length) {
+                if (param.length > 1)
+                    param = param == "return" ? "\n" : param == "tab" ? "\t" : param;
+                repeat(function() { editor.insert(param); }, count || 1);
+                editor.navigateLeft();
+            }
+        }
+    },
+    "R": {
+        fn: function(editor, range, count, param) {
+            util.insertMode(editor);
+            editor.setOverwrite(true);
+        }
+    },
+    "~": {
+        fn: function(editor, range, count) {
+            repeat(function() {
+                var range = editor.selection.getRange();
+                if (range.isEmpty())
+                    range.end.column++;
+                var text = editor.session.getTextRange(range);
+                var toggled = text.toUpperCase();
+                if (toggled == text)
+                    editor.navigateRight();
+                else
+                    editor.session.replace(range, toggled);
+            }, count || 1);
+        }
+    },
+    "*": {
+        fn: function(editor, range, count, param) {
+            editor.selection.selectWord();
+            editor.findNext();
+            ensureScrollMargin(editor);
+            var r = editor.selection.getRange();
+            editor.selection.setSelectionRange(r, true);
+        }
+    },
+    "#": {
+        fn: function(editor, range, count, param) {
+            editor.selection.selectWord();
+            editor.findPrevious();
+            ensureScrollMargin(editor);
+            var r = editor.selection.getRange();
+            editor.selection.setSelectionRange(r, true);
+        }
+    },
+    "m": {
+        param: true,
+        fn: function(editor, range, count, param) {
+            var s =  editor.session;
+            var markers = s.vimMarkers || (s.vimMarkers = {});
+            var c = editor.getCursorPosition();
+            if (!markers[param]) {
+                markers[param] = editor.session.doc.createAnchor(c);
+            }
+            markers[param].setPosition(c.row, c.column, true);
+        }
+    },
+    "n": {
+        fn: function(editor, range, count, param) {
+            var options = editor.getLastSearchOptions();
+            options.backwards = false;
+
+            editor.selection.moveCursorRight();
+            editor.selection.clearSelection();
+            editor.findNext(options);
+
+            ensureScrollMargin(editor);
+            var r = editor.selection.getRange();
+            r.end.row = r.start.row;
+            r.end.column = r.start.column;
+            editor.selection.setSelectionRange(r, true);
+        }
+    },
+    "N": {
+        fn: function(editor, range, count, param) {
+            var options = editor.getLastSearchOptions();
+            options.backwards = true;
+
+            editor.findPrevious(options);
+            ensureScrollMargin(editor);
+            var r = editor.selection.getRange();
+            r.end.row = r.start.row;
+            r.end.column = r.start.column;
+            editor.selection.setSelectionRange(r, true);
+        }
+    },
+    "v": {
+        fn: function(editor, range, count, param) {
+            editor.selection.selectRight();
+            util.visualMode(editor, false);
+        },
+        acceptsMotion: true
+    },
+    "V": {
+        fn: function(editor, range, count, param) {
+            //editor.selection.selectLine();
+            //editor.selection.selectLeft();
+            var row = editor.getCursorPosition().row;
+            editor.selection.clearSelection();
+            editor.selection.moveCursorTo(row, 0);
+            editor.selection.selectLineEnd();
+            editor.selection.visualLineStart = row;
+
+            util.visualMode(editor, true);
+        },
+        acceptsMotion: true
+    },
+    "Y": {
+        fn: function(editor, range, count, param) {
+            util.copyLine(editor);
+        }
+    },
+    "p": {
+        fn: function(editor, range, count, param) {
+            var defaultReg = registers._default;
+
+            editor.setOverwrite(false);
+            if (defaultReg.isLine) {
+                var pos = editor.getCursorPosition();
+                pos.column = editor.session.getLine(pos.row).length;
+                var text = lang.stringRepeat("\n" + defaultReg.text, count || 1);
+                editor.session.insert(pos, text);
+                editor.moveCursorTo(pos.row + 1, 0);
+            }
+            else {
+                editor.navigateRight();
+                editor.insert(lang.stringRepeat(defaultReg.text, count || 1));
+                editor.navigateLeft();
+            }
+            editor.setOverwrite(true);
+            editor.selection.clearSelection();
+        }
+    },
+    "P": {
+        fn: function(editor, range, count, param) {
+            var defaultReg = registers._default;
+            editor.setOverwrite(false);
+
+            if (defaultReg.isLine) {
+                var pos = editor.getCursorPosition();
+                pos.column = 0;
+                var text = lang.stringRepeat(defaultReg.text + "\n", count || 1);
+                editor.session.insert(pos, text);
+                editor.moveCursorToPosition(pos);
+            }
+            else {
+                editor.insert(lang.stringRepeat(defaultReg.text, count || 1));
+            }
+            editor.setOverwrite(true);
+            editor.selection.clearSelection();
+        }
+    },
+    "J": {
+        fn: function(editor, range, count, param) {
+            var session = editor.session;
+            range = editor.getSelectionRange();
+            var pos = {row: range.start.row, column: range.start.column};
+            count = count || range.end.row - range.start.row;
+            var maxRow = Math.min(pos.row + (count || 1), session.getLength() - 1);
+
+            range.start.column = session.getLine(pos.row).length;
+            range.end.column = session.getLine(maxRow).length;
+            range.end.row = maxRow;
+
+            var text = "";
+            for (var i = pos.row; i < maxRow; i++) {
+                var nextLine = session.getLine(i + 1);
+                text += " " + /^\s*(.*)$/.exec(nextLine)[1] || "";
+            }
+
+            session.replace(range, text);
+            editor.moveCursorTo(pos.row, pos.column);
+        }
+    },
+    "u": {
+        fn: function(editor, range, count, param) {
+            count = parseInt(count || 1, 10);
+            for (var i = 0; i < count; i++) {
+                editor.undo();
+            }
+            editor.selection.clearSelection();
+        }
+    },
+    "ctrl-r": {
+        fn: function(editor, range, count, param) {
+            count = parseInt(count || 1, 10);
+            for (var i = 0; i < count; i++) {
+                editor.redo();
+            }
+            editor.selection.clearSelection();
+        }
+    },
+    ":": {
+        fn: function(editor, range, count, param) {
+            var val = ":";
+            if (count > 1)
+                val = ".,.+" + count + val;
+            if (editor.showCommandLine)
+                editor.showCommandLine(val);
+        }
+    },
+    "/": {
+        fn: function(editor, range, count, param) {
+            if (editor.showCommandLine)
+                editor.showCommandLine("/");
+        }
+    },
+    "?": {
+        fn: function(editor, range, count, param) {
+            if (editor.showCommandLine)
+                editor.showCommandLine("?");
+        }
+    },
+    ".": {
+        fn: function(editor, range, count, param) {
+            util.onInsertReplaySequence = inputBuffer.lastInsertCommands;
+            var previous = inputBuffer.previous;
+            if (previous) // If there is a previous action
+                inputBuffer.exec(editor, previous.action, previous.param);
+        }
+    },
+    "ctrl-x": {
+        fn: function(editor, range, count, param) {
+            editor.modifyNumber(-(count || 1));
+        }
+    },
+    "ctrl-a": {
+        fn: function(editor, range, count, param) {
+            editor.modifyNumber(count || 1);
+        }
+    }
+};
+
+var inputBuffer = exports.inputBuffer = {
+    accepting: [NUMBER, OPERATOR, MOTION, ACTION],
+    currentCmd: null,
+    //currentMode: 0,
+    currentCount: "",
+    status: "",
+
+    // Types
+    operator: null,
+    motion: null,
+
+    lastInsertCommands: [],
+
+    push: function(editor, ch, keyId) {
+        var status = this.status;
+        var isKeyHandled = true;
+        this.idle = false;
+        var wObj = this.waitingForParam;
+        if (/^numpad\d+$/i.test(ch))
+            ch = ch.substr(6);
+            
+        if (wObj) {
+            this.exec(editor, wObj, ch);
+        }
+        // If input is a number (that doesn't start with 0)
+        else if (!(ch === "0" && !this.currentCount.length) &&
+            (/^\d+$/.test(ch) && this.isAccepting(NUMBER))) {
+            // Assuming that ch is always of type String, and not Number
+            this.currentCount += ch;
+            this.currentCmd = NUMBER;
+            this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
+        }
+        else if (!this.operator && this.isAccepting(OPERATOR) && operators[ch]) {
+            this.operator = {
+                ch: ch,
+                count: this.getCount()
+            };
+            this.currentCmd = OPERATOR;
+            this.accepting = [NUMBER, MOTION, ACTION];
+            this.exec(editor, { operator: this.operator });
+        }
+        else if (motions[ch] && this.isAccepting(MOTION)) {
+            this.currentCmd = MOTION;
+
+            var ctx = {
+                operator: this.operator,
+                motion: {
+                    ch: ch,
+                    count: this.getCount()
+                }
+            };
+
+            if (motions[ch].param)
+                this.waitForParam(ctx);
+            else
+                this.exec(editor, ctx);
+        }
+        else if (alias[ch] && this.isAccepting(MOTION)) {
+            alias[ch].operator.count = this.getCount();
+            this.exec(editor, alias[ch]);
+        }
+        else if (actions[ch] && this.isAccepting(ACTION)) {
+            var actionObj = {
+                action: {
+                    fn: actions[ch].fn,
+                    count: this.getCount()
+                }
+            };
+
+            if (actions[ch].param) {
+                this.waitForParam(actionObj);
+            }
+            else {
+                this.exec(editor, actionObj);
+            }
+
+            if (actions[ch].acceptsMotion)
+                this.idle = false;
+        }
+        else if (this.operator) {
+            this.operator.count = this.getCount();
+            this.exec(editor, { operator: this.operator }, ch);
+        }
+        else {
+            isKeyHandled = ch.length == 1;
+            this.reset();
+        }
+        
+        if (this.waitingForParam || this.motion || this.operator) {
+            this.status += ch;
+        } else if (this.currentCount) {
+            this.status = this.currentCount;
+        } else if (this.status) {
+            this.status = "";
+        }
+        if (this.status != status)
+            editor._emit("changeStatus");
+        return isKeyHandled;
+    },
+
+    waitForParam: function(cmd) {
+        this.waitingForParam = cmd;
+    },
+
+    getCount: function() {
+        var count = this.currentCount;
+        this.currentCount = "";
+        return count && parseInt(count, 10);
+    },
+
+    exec: function(editor, action, param) {
+        var m = action.motion;
+        var o = action.operator;
+        var a = action.action;
+
+        if (!param)
+            param = action.param;
+
+        if (o) {
+            this.previous = {
+                action: action,
+                param: param
+            };
+        }
+
+        if (o && !editor.selection.isEmpty()) {
+            if (operators[o.ch].selFn) {
+                operators[o.ch].selFn(editor, editor.getSelectionRange(), o.count, param);
+                this.reset();
+            }
+            return;
+        }
+
+        // There is an operator, but no motion or action. We try to pass the
+        // current ch to the operator to see if it responds to it (an example
+        // of this is the 'dd' operator).
+        else if (!m && !a && o && param) {
+            operators[o.ch].fn(editor, null, o.count, param);
+            this.reset();
+        }
+        else if (m) {
+            var run = function(fn) {
+                if (fn && typeof fn === "function") { // There should always be a motion
+                    if (m.count && !motionObj.handlesCount)
+                        repeat(fn, m.count, [editor, null, m.count, param]);
+                    else
+                        fn(editor, null, m.count, param);
+                }
+            };
+
+            var motionObj = motions[m.ch];
+            var selectable = motionObj.sel;
+
+            if (!o) {
+                if ((util.onVisualMode || util.onVisualLineMode) && selectable)
+                    run(motionObj.sel);
+                else
+                    run(motionObj.nav);
+            }
+            else if (selectable) {
+                repeat(function() {
+                    run(motionObj.sel);
+                    operators[o.ch].fn(editor, editor.getSelectionRange(), o.count, param);
+                }, o.count || 1);
+            }
+            this.reset();
+        }
+        else if (a) {
+            a.fn(editor, editor.getSelectionRange(), a.count, param);
+            this.reset();
+        }
+        handleCursorMove(editor);
+    },
+
+    isAccepting: function(type) {
+        return this.accepting.indexOf(type) !== -1;
+    },
+
+    reset: function() {
+        this.operator = null;
+        this.motion = null;
+        this.currentCount = "";
+        this.status = "";
+        this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
+        this.idle = true;
+        this.waitingForParam = null;
+    }
+};
+
+function setPreviousCommand(fn) {
+    inputBuffer.previous = { action: { action: { fn: fn } } };
+}
+
+exports.coreCommands = {
+    start: {
+        exec: function start(editor) {
+            util.insertMode(editor);
+            setPreviousCommand(start);
+        }
+    },
+    startBeginning: {
+        exec: function startBeginning(editor) {
+            editor.navigateLineStart();
+            util.insertMode(editor);
+            setPreviousCommand(startBeginning);
+        }
+    },
+    // Stop Insert mode as soon as possible. Works like typing <Esc> in
+    // insert mode.
+    stop: {
+        exec: function stop(editor) {
+            inputBuffer.reset();
+            util.onVisualMode = false;
+            util.onVisualLineMode = false;
+            inputBuffer.lastInsertCommands = util.normalMode(editor);
+        }
+    },
+    append: {
+        exec: function append(editor) {
+            var pos = editor.getCursorPosition();
+            var lineLen = editor.session.getLine(pos.row).length;
+            if (lineLen)
+                editor.navigateRight();
+            util.insertMode(editor);
+            setPreviousCommand(append);
+        }
+    },
+    appendEnd: {
+        exec: function appendEnd(editor) {
+            editor.navigateLineEnd();
+            util.insertMode(editor);
+            setPreviousCommand(appendEnd);
+        }
+    }
+};
+
+var handleCursorMove = exports.onCursorMove = function(editor, e) {
+    if (util.currentMode === 'insert' || handleCursorMove.running)
+        return;
+    else if(!editor.selection.isEmpty()) {
+        handleCursorMove.running = true;
+        if (util.onVisualLineMode) {
+            var originRow = editor.selection.visualLineStart;
+            var cursorRow = editor.getCursorPosition().row;
+            if(originRow <= cursorRow) {
+                var endLine = editor.session.getLine(cursorRow);
+                editor.selection.clearSelection();
+                editor.selection.moveCursorTo(originRow, 0);
+                editor.selection.selectTo(cursorRow, endLine.length);
+            } else {
+                var endLine = editor.session.getLine(originRow);
+                editor.selection.clearSelection();
+                editor.selection.moveCursorTo(originRow, endLine.length);
+                editor.selection.selectTo(cursorRow, 0);
+            }
+        }
+        handleCursorMove.running = false;
+        return;
+    }
+    else {
+        if (e && (util.onVisualLineMode || util.onVisualMode)) {
+            editor.selection.clearSelection();
+            util.normalMode(editor);
+        }
+
+        handleCursorMove.running = true;
+        var pos = editor.getCursorPosition();
+        var lineLen = editor.session.getLine(pos.row).length;
+
+        if (lineLen && pos.column === lineLen)
+            editor.navigateLeft();
+        handleCursorMove.running = false;
+    }
+};
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/keyboard/vim/maps/aliases.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/keyboard/vim/maps/aliases.js b/src/fauxton/assets/js/libs/ace/keyboard/vim/maps/aliases.js
new file mode 100644
index 0000000..1a5f32f
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/keyboard/vim/maps/aliases.js
@@ -0,0 +1,94 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+ 
+"use strict"
+
+define(function(require, exports, module) {
+module.exports = {
+    "x": {
+        operator: {
+            ch: "d",
+            count: 1
+        },
+        motion: {
+            ch: "l",
+            count: 1
+        }
+    },
+    "X": {
+        operator: {
+            ch: "d",
+            count: 1
+        },
+        motion: {
+            ch: "h",
+            count: 1
+        }
+    },
+    "D": {
+        operator: {
+            ch: "d",
+            count: 1
+        },
+        motion: {
+            ch: "$",
+            count: 1
+        }
+    },
+    "C": {
+        operator: {
+            ch: "c",
+            count: 1
+        },
+        motion: {
+            ch: "$",
+            count: 1
+        }
+    },
+    "s": {
+        operator: {
+            ch: "c",
+            count: 1
+        },
+        motion: {
+            ch: "l",
+            count: 1
+        }
+    },
+    "S": {
+        operator: {
+            ch: "c",
+            count: 1
+        },
+        param: "c"
+    }
+};
+});
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/keyboard/vim/maps/motions.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/keyboard/vim/maps/motions.js b/src/fauxton/assets/js/libs/ace/keyboard/vim/maps/motions.js
new file mode 100644
index 0000000..91c8b8a
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/keyboard/vim/maps/motions.js
@@ -0,0 +1,664 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+
+define(function(require, exports, module) {
+"use strict";
+
+var util = require("./util");
+
+var keepScrollPosition = function(editor, fn) {
+    var scrollTopRow = editor.renderer.getScrollTopRow();
+    var initialRow = editor.getCursorPosition().row;
+    var diff = initialRow - scrollTopRow;
+    fn && fn.call(editor);
+    editor.renderer.scrollToRow(editor.getCursorPosition().row - diff);
+};
+
+function Motion(m) {
+    if (typeof m == "function") {
+        var getPos = m;
+        m = this;
+    } else {
+        var getPos = m.getPos;
+    }
+    m.nav = function(editor, range, count, param) {
+        var a = getPos(editor, range, count, param, false);
+        if (!a)
+            return;
+        editor.clearSelection();
+        editor.moveCursorTo(a.row, a.column);
+    };
+    m.sel = function(editor, range, count, param) {
+        var a = getPos(editor, range, count, param, true);
+        if (!a)
+            return;
+        editor.selection.selectTo(a.row, a.column);
+    };
+    return m;
+}
+
+var nonWordRe = /[\s.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
+var wordSeparatorRe = /[.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
+var whiteRe = /\s/;
+var StringStream = function(editor, cursor) {
+    var sel = editor.selection;
+    this.range = sel.getRange();
+    cursor = cursor || sel.selectionLead;
+    this.row = cursor.row;
+    this.col = cursor.column;
+    var line = editor.session.getLine(this.row);
+    var maxRow = editor.session.getLength();
+    this.ch = line[this.col] || '\n';
+    this.skippedLines = 0;
+
+    this.next = function() {
+        this.ch = line[++this.col] || this.handleNewLine(1);
+        //this.debug()
+        return this.ch;
+    };
+    this.prev = function() {
+        this.ch = line[--this.col] || this.handleNewLine(-1);
+        //this.debug()
+        return this.ch;
+    };
+    this.peek = function(dir) {
+        var ch = line[this.col + dir];
+        if (ch)
+            return ch;
+        if (dir == -1)
+            return '\n';
+        if (this.col == line.length - 1)
+            return '\n';
+        return editor.session.getLine(this.row + 1)[0] || '\n';
+    };
+
+    this.handleNewLine = function(dir) {
+        if (dir == 1){
+            if (this.col == line.length)
+                return '\n';
+            if (this.row == maxRow - 1)
+                return '';
+            this.col = 0;
+            this.row ++;
+            line = editor.session.getLine(this.row);
+            this.skippedLines++;
+            return line[0] || '\n';
+        }
+        if (dir == -1) {
+            if (this.row === 0)
+                return '';
+            this.row --;
+            line = editor.session.getLine(this.row);
+            this.col = line.length;
+            this.skippedLines--;
+            return '\n';
+        }
+    };
+    this.debug = function() {
+        console.log(line.substring(0, this.col)+'|'+this.ch+'\''+this.col+'\''+line.substr(this.col+1));
+    };
+};
+
+var Search = require("../../../search").Search;
+var search = new Search();
+
+function find(editor, needle, dir) {
+    search.$options.needle = needle;
+    search.$options.backwards = dir == -1;
+    return search.find(editor.session);
+}
+
+var Range = require("../../../range").Range;
+
+var LAST_SEARCH_MOTION = {};
+
+module.exports = {
+    "w": new Motion(function(editor) {
+        var str = new StringStream(editor);
+
+        if (str.ch && wordSeparatorRe.test(str.ch)) {
+            while (str.ch && wordSeparatorRe.test(str.ch))
+                str.next();
+        } else {
+            while (str.ch && !nonWordRe.test(str.ch))
+                str.next();
+        }
+        while (str.ch && whiteRe.test(str.ch) && str.skippedLines < 2)
+            str.next();
+
+        str.skippedLines == 2 && str.prev();
+        return {column: str.col, row: str.row};
+    }),
+    "W": new Motion(function(editor) {
+        var str = new StringStream(editor);
+        while(str.ch && !(whiteRe.test(str.ch) && !whiteRe.test(str.peek(1))) && str.skippedLines < 2)
+            str.next();
+        if (str.skippedLines == 2)
+            str.prev();
+        else
+            str.next();
+
+        return {column: str.col, row: str.row};
+    }),
+    "b": new Motion(function(editor) {
+        var str = new StringStream(editor);
+
+        str.prev();
+        while (str.ch && whiteRe.test(str.ch) && str.skippedLines > -2)
+            str.prev();
+
+        if (str.ch && wordSeparatorRe.test(str.ch)) {
+            while (str.ch && wordSeparatorRe.test(str.ch))
+                str.prev();
+        } else {
+            while (str.ch && !nonWordRe.test(str.ch))
+                str.prev();
+        }
+        str.ch && str.next();
+        return {column: str.col, row: str.row};
+    }),
+    "B": new Motion(function(editor) {
+        var str = new StringStream(editor);
+        str.prev();
+        while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(-1))) && str.skippedLines > -2)
+            str.prev();
+
+        if (str.skippedLines == -2)
+            str.next();
+
+        return {column: str.col, row: str.row};
+    }),
+    "e": new Motion(function(editor) {
+        var str = new StringStream(editor);
+
+        str.next();
+        while (str.ch && whiteRe.test(str.ch))
+            str.next();
+
+        if (str.ch && wordSeparatorRe.test(str.ch)) {
+            while (str.ch && wordSeparatorRe.test(str.ch))
+                str.next();
+        } else {
+            while (str.ch && !nonWordRe.test(str.ch))
+                str.next();
+        }
+        str.ch && str.prev();
+        return {column: str.col, row: str.row};
+    }),
+    "E": new Motion(function(editor) {
+        var str = new StringStream(editor);
+        str.next();
+        while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(1))))
+            str.next();
+
+        return {column: str.col, row: str.row};
+    }),
+
+    "l": {
+        nav: function(editor) {
+            var pos = editor.getCursorPosition();
+            var col = pos.column;
+            var lineLen = editor.session.getLine(pos.row).length;
+            if (lineLen && col !== lineLen)
+                editor.navigateRight();
+        },
+        sel: function(editor) {
+            var pos = editor.getCursorPosition();
+            var col = pos.column;
+            var lineLen = editor.session.getLine(pos.row).length;
+
+            // Solving the behavior at the end of the line due to the
+            // different 0 index-based colum positions in ACE.
+            if (lineLen && col !== lineLen) //In selection mode you can select the newline
+                editor.selection.selectRight();
+        }
+    },
+    "h": {
+        nav: function(editor) {
+            var pos = editor.getCursorPosition();
+            if (pos.column > 0)
+                editor.navigateLeft();
+        },
+        sel: function(editor) {
+            var pos = editor.getCursorPosition();
+            if (pos.column > 0)
+                editor.selection.selectLeft();
+        }
+    },
+    "H": {
+        nav: function(editor) {
+            var row = editor.renderer.getScrollTopRow();
+            editor.moveCursorTo(row);
+        },
+        sel: function(editor) {
+            var row = editor.renderer.getScrollTopRow();
+            editor.selection.selectTo(row);
+        }
+    },
+    "M": {
+        nav: function(editor) {
+            var topRow = editor.renderer.getScrollTopRow();
+            var bottomRow = editor.renderer.getScrollBottomRow();
+            var row = topRow + ((bottomRow - topRow) / 2);
+            editor.moveCursorTo(row);
+        },
+        sel: function(editor) {
+            var topRow = editor.renderer.getScrollTopRow();
+            var bottomRow = editor.renderer.getScrollBottomRow();
+            var row = topRow + ((bottomRow - topRow) / 2);
+            editor.selection.selectTo(row);
+        }
+    },
+    "L": {
+        nav: function(editor) {
+            var row = editor.renderer.getScrollBottomRow();
+            editor.moveCursorTo(row);
+        },
+        sel: function(editor) {
+            var row = editor.renderer.getScrollBottomRow();
+            editor.selection.selectTo(row);
+        }
+    },
+    "k": {
+        nav: function(editor) {
+            editor.navigateUp();
+        },
+        sel: function(editor) {
+            editor.selection.selectUp();
+        }
+    },
+    "j": {
+        nav: function(editor) {
+            editor.navigateDown();
+        },
+        sel: function(editor) {
+            editor.selection.selectDown();
+        }
+    },
+
+    "i": {
+        param: true,
+        sel: function(editor, range, count, param) {
+            switch (param) {
+                case "w":
+                    editor.selection.selectWord();
+                    break;
+                case "W":
+                    editor.selection.selectAWord();
+                    break;
+                case "(":
+                case "{":
+                case "[":
+                    var cursor = editor.getCursorPosition();
+                    var end = editor.session.$findClosingBracket(param, cursor, /paren/);
+                    if (!end)
+                        return;
+                    var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/);
+                    if (!start)
+                        return;
+                    start.column ++;
+                    editor.selection.setSelectionRange(Range.fromPoints(start, end));
+                    break;
+                case "'":
+                case '"':
+                case "/":
+                    var end = find(editor, param, 1);
+                    if (!end)
+                        return;
+                    var start = find(editor, param, -1);
+                    if (!start)
+                        return;
+                    editor.selection.setSelectionRange(Range.fromPoints(start.end, end.start));
+                    break;
+            }
+        }
+    },
+    "a": {
+        param: true,
+        sel: function(editor, range, count, param) {
+            switch (param) {
+                case "w":
+                    editor.selection.selectAWord();
+                    break;
+                case "W":
+                    editor.selection.selectAWord();
+                    break;
+                case "(":
+                case "{":
+                case "[":
+                    var cursor = editor.getCursorPosition();
+                    var end = editor.session.$findClosingBracket(param, cursor, /paren/);
+                    if (!end)
+                        return;
+                    var start = editor.session.$findOpeningBracket(editor.session.$brackets[param], cursor, /paren/);
+                    if (!start)
+                        return;
+                    end.column ++;
+                    editor.selection.setSelectionRange(Range.fromPoints(start, end));
+                    break;
+                case "'":
+                case "\"":
+                case "/":
+                    var end = find(editor, param, 1);
+                    if (!end)
+                        return;
+                    var start = find(editor, param, -1);
+                    if (!start)
+                        return;
+                    end.column ++;
+                    editor.selection.setSelectionRange(Range.fromPoints(start.start, end.end));
+                    break;
+            }
+        }
+    },
+
+    "f": new Motion({
+        param: true,
+        handlesCount: true,
+        getPos: function(editor, range, count, param, isSel, isRepeat) {
+            if (!isRepeat)
+                LAST_SEARCH_MOTION = {ch: "f", param: param};
+            var cursor = editor.getCursorPosition();
+            var column = util.getRightNthChar(editor, cursor, param, count || 1);
+
+            if (typeof column === "number") {
+                cursor.column += column + (isSel ? 2 : 1);
+                return cursor;
+            }
+        }
+    }),
+    "F": new Motion({
+        param: true,
+        handlesCount: true,
+        getPos: function(editor, range, count, param, isSel, isRepeat) {
+            if (!isRepeat)
+                LAST_SEARCH_MOTION = {ch: "F", param: param};
+            var cursor = editor.getCursorPosition();
+            var column = util.getLeftNthChar(editor, cursor, param, count || 1);
+
+            if (typeof column === "number") {
+                cursor.column -= column + 1;
+                return cursor;
+            }
+        }
+    }),
+    "t": new Motion({
+        param: true,
+        handlesCount: true,
+        getPos: function(editor, range, count, param, isSel, isRepeat) {
+            if (!isRepeat)
+                LAST_SEARCH_MOTION = {ch: "t", param: param};
+            var cursor = editor.getCursorPosition();
+            var column = util.getRightNthChar(editor, cursor, param, count || 1);
+
+            if (isRepeat && column == 0 && !(count > 1))
+                var column = util.getRightNthChar(editor, cursor, param, 2);
+                
+            if (typeof column === "number") {
+                cursor.column += column + (isSel ? 1 : 0);
+                return cursor;
+            }
+        }
+    }),
+    "T": new Motion({
+        param: true,
+        handlesCount: true,
+        getPos: function(editor, range, count, param, isSel, isRepeat) {
+            if (!isRepeat)
+                LAST_SEARCH_MOTION = {ch: "T", param: param};
+            var cursor = editor.getCursorPosition();
+            var column = util.getLeftNthChar(editor, cursor, param, count || 1);
+
+            if (isRepeat && column == 0 && !(count > 1))
+                var column = util.getLeftNthChar(editor, cursor, param, 2);
+            
+            if (typeof column === "number") {
+                cursor.column -= column;
+                return cursor;
+            }
+        }
+    }),
+    ";": new Motion({
+        handlesCount: true,
+        getPos: function(editor, range, count, param, isSel) {
+            var ch = LAST_SEARCH_MOTION.ch;
+            if (!ch)
+                return;
+            return module.exports[ch].getPos(
+                editor, range, count, LAST_SEARCH_MOTION.param, isSel, true
+            );
+        }
+    }),
+    ",": new Motion({
+        handlesCount: true,
+        getPos: function(editor, range, count, param, isSel) {
+            var ch = LAST_SEARCH_MOTION.ch;
+            if (!ch)
+                return;
+            var up = ch.toUpperCase();
+            ch = ch === up ? ch.toLowerCase() : up;
+            
+            return module.exports[ch].getPos(
+                editor, range, count, LAST_SEARCH_MOTION.param, isSel, true
+            );
+        }
+    }),
+
+    "^": {
+        nav: function(editor) {
+            editor.navigateLineStart();
+        },
+        sel: function(editor) {
+            editor.selection.selectLineStart();
+        }
+    },
+    "$": {
+        nav: function(editor) {
+            editor.navigateLineEnd();
+        },
+        sel: function(editor) {
+            editor.selection.selectLineEnd();
+        }
+    },
+    "0": new Motion(function(ed) {
+        return {row: ed.selection.lead.row, column: 0};
+    }),
+    "G": {
+        nav: function(editor, range, count, param) {
+            if (!count && count !== 0) { // Stupid JS
+                count = editor.session.getLength();
+            }
+            editor.gotoLine(count);
+        },
+        sel: function(editor, range, count, param) {
+            if (!count && count !== 0) { // Stupid JS
+                count = editor.session.getLength();
+            }
+            editor.selection.selectTo(count, 0);
+        }
+    },
+    "g": {
+        param: true,
+        nav: function(editor, range, count, param) {
+            switch(param) {
+                case "m":
+                    console.log("Middle line");
+                    break;
+                case "e":
+                    console.log("End of prev word");
+                    break;
+                case "g":
+                    editor.gotoLine(count || 0);
+                case "u":
+                    editor.gotoLine(count || 0);
+                case "U":
+                    editor.gotoLine(count || 0);
+            }
+        },
+        sel: function(editor, range, count, param) {
+            switch(param) {
+                case "m":
+                    console.log("Middle line");
+                    break;
+                case "e":
+                    console.log("End of prev word");
+                    break;
+                case "g":
+                    editor.selection.selectTo(count || 0, 0);
+            }
+        }
+    },
+    "o": {
+        nav: function(editor, range, count, param) {
+            count = count || 1;
+            var content = "";
+            while (0 < count--)
+                content += "\n";
+
+            if (content.length) {
+                editor.navigateLineEnd()
+                editor.insert(content);
+                util.insertMode(editor);
+            }
+        }
+    },
+    "O": {
+        nav: function(editor, range, count, param) {
+            var row = editor.getCursorPosition().row;
+            count = count || 1;
+            var content = "";
+            while (0 < count--)
+                content += "\n";
+
+            if (content.length) {
+                if(row > 0) {
+                    editor.navigateUp();
+                    editor.navigateLineEnd()
+                    editor.insert(content);
+                } else {
+                    editor.session.insert({row: 0, column: 0}, content);
+                    editor.navigateUp();
+                }
+                util.insertMode(editor);
+            }
+        }
+    },
+    "%": new Motion(function(editor){
+        var brRe = /[\[\]{}()]/g;
+        var cursor = editor.getCursorPosition();
+        var ch = editor.session.getLine(cursor.row)[cursor.column];
+        if (!brRe.test(ch)) {
+            var range = find(editor, brRe);
+            if (!range)
+                return;
+            cursor = range.start;
+        }
+        var match = editor.session.findMatchingBracket({
+            row: cursor.row,
+            column: cursor.column + 1
+        });
+
+        return match;
+    }),
+    "{": new Motion(function(ed) {
+        var session = ed.session;
+        var row = session.selection.lead.row;
+        while(row > 0 && !/\S/.test(session.getLine(row)))
+            row--;
+        while(/\S/.test(session.getLine(row)))
+            row--;
+        return {column: 0, row: row};
+    }),
+    "}": new Motion(function(ed) {
+        var session = ed.session;
+        var l = session.getLength();
+        var row = session.selection.lead.row;
+        while(row < l && !/\S/.test(session.getLine(row)))
+            row++;
+        while(/\S/.test(session.getLine(row)))
+            row++;
+        return {column: 0, row: row};
+    }),
+    "ctrl-d": {
+        nav: function(editor, range, count, param) {
+            editor.selection.clearSelection();
+            keepScrollPosition(editor, editor.gotoPageDown);
+        },
+        sel: function(editor, range, count, param) {
+            keepScrollPosition(editor, editor.selectPageDown);
+        }
+    },
+    "ctrl-u": {
+        nav: function(editor, range, count, param) {
+            editor.selection.clearSelection();
+            keepScrollPosition(editor, editor.gotoPageUp);
+        },
+        sel: function(editor, range, count, param) {
+            keepScrollPosition(editor, editor.selectPageUp);
+        }
+    },
+    "`": new Motion({
+        param: true,
+        handlesCount: true,
+        getPos: function(editor, range, count, param, isSel) {
+            var s = editor.session;
+            var marker = s.vimMarkers && s.vimMarkers[param];
+            if (marker) {
+                return marker.getPosition();
+            }
+        }
+    }),
+    "'": new Motion({
+        param: true,
+        handlesCount: true,
+        getPos: function(editor, range, count, param, isSel) {
+            var s = editor.session;
+            var marker = s.vimMarkers && s.vimMarkers[param];
+            if (marker) {
+                var pos = marker.getPosition();
+                var line = editor.session.getLine(pos.row);                
+                pos.column = line.search(/\S/);
+                if (pos.column == -1)
+                    pos.column = line.length;
+                return pos;
+            }
+        }
+    })
+};
+
+module.exports.backspace = module.exports.left = module.exports.h;
+module.exports.space = module.exports['return'] = module.exports.right = module.exports.l;
+module.exports.up = module.exports.k;
+module.exports.down = module.exports.j;
+module.exports.pagedown = module.exports["ctrl-d"];
+module.exports.pageup = module.exports["ctrl-u"];
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/keyboard/vim/maps/operators.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/keyboard/vim/maps/operators.js b/src/fauxton/assets/js/libs/ace/keyboard/vim/maps/operators.js
new file mode 100644
index 0000000..067562a
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/keyboard/vim/maps/operators.js
@@ -0,0 +1,195 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+ 
+define(function(require, exports, module) {
+
+"use strict";
+
+var util = require("./util");
+var registers = require("../registers");
+
+module.exports = {
+    "d": {
+        selFn: function(editor, range, count, param) {
+            registers._default.text = editor.getCopyText();
+            registers._default.isLine = util.onVisualLineMode;
+            if(util.onVisualLineMode)
+                editor.removeLines();
+            else
+                editor.session.remove(range);
+            util.normalMode(editor);
+        },
+        fn: function(editor, range, count, param) {
+            count = count || 1;
+            switch (param) {
+                case "d":
+                    registers._default.text = "";
+                    registers._default.isLine = true;
+                    for (var i = 0; i < count; i++) {
+                        editor.selection.selectLine();
+                        registers._default.text += editor.getCopyText();
+                        var selRange = editor.getSelectionRange();
+                        // check if end of the document was reached
+                        if (!selRange.isMultiLine()) {
+                            var row = selRange.start.row - 1;
+                            var col = editor.session.getLine(row).length
+                            selRange.setStart(row, col);
+                            editor.session.remove(selRange);
+                            editor.selection.clearSelection();
+                            break;
+                        }
+                        editor.session.remove(selRange);
+                        editor.selection.clearSelection();
+                    }
+                    registers._default.text = registers._default.text.replace(/\n$/, "");
+                    break;
+                default:
+                    if (range) {
+                        editor.selection.setSelectionRange(range);
+                        registers._default.text = editor.getCopyText();
+                        registers._default.isLine = false;
+                        editor.session.remove(range);
+                        editor.selection.clearSelection();
+                    }
+            }
+        }
+    },
+    "c": {
+        selFn: function(editor, range, count, param) {
+            editor.session.remove(range);
+            util.insertMode(editor);
+        },
+        fn: function(editor, range, count, param) {
+            count = count || 1;
+            switch (param) {
+                case "c":
+                    for (var i = 0; i < count; i++) {
+                        editor.removeLines();
+                        util.insertMode(editor);
+                    }
+
+                    break;
+                default:
+                    if (range) {
+
+                        // range.end.column ++;
+                        editor.session.remove(range);
+                        util.insertMode(editor);
+                    }
+            }
+        }
+    },
+    "y": {
+        selFn: function(editor, range, count, param) {
+            registers._default.text = editor.getCopyText();
+            registers._default.isLine = util.onVisualLineMode;
+            editor.selection.clearSelection();
+            util.normalMode(editor);
+        },
+        fn: function(editor, range, count, param) {
+            count = count || 1;
+            switch (param) {
+                case "y":
+                    var pos = editor.getCursorPosition();
+                    editor.selection.selectLine();
+                    for (var i = 0; i < count - 1; i++) {
+                        editor.selection.moveCursorDown();
+                    }
+                    registers._default.text = editor.getCopyText().replace(/\n$/, "");
+                    editor.selection.clearSelection();
+                    registers._default.isLine = true;
+                    editor.moveCursorToPosition(pos);
+                    break;
+                default:
+                    if (range) {
+                        var pos = editor.getCursorPosition();
+                        editor.selection.setSelectionRange(range);
+                        registers._default.text = editor.getCopyText();
+                        registers._default.isLine = false;
+                        editor.selection.clearSelection();
+                        editor.moveCursorTo(pos.row, pos.column);
+                    }
+            }
+        }
+    },
+    ">": {
+        selFn: function(editor, range, count, param) {
+            count = count || 1;
+            for (var i = 0; i < count; i++) {
+                editor.indent();
+            }
+            util.normalMode(editor);
+        },
+        fn: function(editor, range, count, param) {
+            count = parseInt(count || 1, 10);
+            switch (param) {
+                case ">":
+                    var pos = editor.getCursorPosition();
+                    editor.selection.selectLine();
+                    for (var i = 0; i < count - 1; i++) {
+                        editor.selection.moveCursorDown();
+                    }
+                    editor.indent();
+                    editor.selection.clearSelection();
+                    editor.moveCursorToPosition(pos);
+                    editor.navigateLineEnd();
+                    editor.navigateLineStart();
+                    break;
+            }
+        }
+    },
+    "<": {
+        selFn: function(editor, range, count, param) {
+            count = count || 1;
+            for (var i = 0; i < count; i++) {
+                editor.blockOutdent();
+            }
+            util.normalMode(editor);
+        },
+        fn: function(editor, range, count, param) {
+            count = count || 1;
+            switch (param) {
+                case "<":
+                    var pos = editor.getCursorPosition();
+                    editor.selection.selectLine();
+                    for (var i = 0; i < count - 1; i++) {
+                        editor.selection.moveCursorDown();
+                    }
+                    editor.blockOutdent();
+                    editor.selection.clearSelection();
+                    editor.moveCursorToPosition(pos);
+                    editor.navigateLineEnd();
+                    editor.navigateLineStart();
+                    break;
+            }
+        }
+    }
+};
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/keyboard/vim/maps/util.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/keyboard/vim/maps/util.js b/src/fauxton/assets/js/libs/ace/keyboard/vim/maps/util.js
new file mode 100644
index 0000000..af0e07c
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/keyboard/vim/maps/util.js
@@ -0,0 +1,134 @@
+define(function(require, exports, module) {
+var registers = require("../registers");
+
+var dom = require("../../../lib/dom");
+dom.importCssString('.insert-mode .ace_cursor{\
+    border-left: 2px solid #333333;\
+}\
+.ace_dark.insert-mode .ace_cursor{\
+    border-left: 2px solid #eeeeee;\
+}\
+.normal-mode .ace_cursor{\
+    border: 0!important;\
+    background-color: red;\
+    opacity: 0.5;\
+}', 'vimMode');
+
+module.exports = {
+    onVisualMode: false,
+    onVisualLineMode: false,
+    currentMode: 'normal',
+    noMode: function(editor) {
+        editor.unsetStyle('insert-mode');
+        editor.unsetStyle('normal-mode');
+        if (editor.commands.recording)
+            editor.commands.toggleRecording(editor);
+        editor.setOverwrite(false);
+    },
+    insertMode: function(editor) {
+        this.currentMode = 'insert';
+        // Switch editor to insert mode
+        editor.setStyle('insert-mode');
+        editor.unsetStyle('normal-mode');
+
+        editor.setOverwrite(false);
+        editor.keyBinding.$data.buffer = "";
+        editor.keyBinding.$data.state = "insertMode";
+        this.onVisualMode = false;
+        this.onVisualLineMode = false;
+        if(this.onInsertReplaySequence) {
+            // Ok, we're apparently replaying ("."), so let's do it
+            editor.commands.macro = this.onInsertReplaySequence;
+            editor.commands.replay(editor);
+            this.onInsertReplaySequence = null;
+            this.normalMode(editor);
+        } else {
+            editor._emit("changeStatus");
+            // Record any movements, insertions in insert mode
+            if(!editor.commands.recording)
+                editor.commands.toggleRecording(editor);
+        }
+    },
+    normalMode: function(editor) {
+        // Switch editor to normal mode
+        this.currentMode = 'normal';
+
+        editor.unsetStyle('insert-mode');
+        editor.setStyle('normal-mode');
+        editor.clearSelection();
+
+        var pos;
+        if (!editor.getOverwrite()) {
+            pos = editor.getCursorPosition();
+            if (pos.column > 0)
+                editor.navigateLeft();
+        }
+
+        editor.setOverwrite(true);
+        editor.keyBinding.$data.buffer = "";
+        editor.keyBinding.$data.state = "start";
+        this.onVisualMode = false;
+        this.onVisualLineMode = false;
+        editor._emit("changeStatus");
+        // Save recorded keystrokes
+        if (editor.commands.recording) {
+            editor.commands.toggleRecording(editor);
+            return editor.commands.macro;
+        }
+        else {
+            return [];
+        }
+    },
+    visualMode: function(editor, lineMode) {
+        if (
+            (this.onVisualLineMode && lineMode)
+            || (this.onVisualMode && !lineMode)
+        ) {
+            this.normalMode(editor);
+            return;
+        }
+
+        editor.setStyle('insert-mode');
+        editor.unsetStyle('normal-mode');
+
+        editor._emit("changeStatus");
+        if (lineMode) {
+            this.onVisualLineMode = true;
+        } else {
+            this.onVisualMode = true;
+            this.onVisualLineMode = false;
+        }
+    },
+    getRightNthChar: function(editor, cursor, ch, n) {
+        var line = editor.getSession().getLine(cursor.row);
+        var matches = line.substr(cursor.column + 1).split(ch);
+
+        return n < matches.length ? matches.slice(0, n).join(ch).length : null;
+    },
+    getLeftNthChar: function(editor, cursor, ch, n) {
+        var line = editor.getSession().getLine(cursor.row);
+        var matches = line.substr(0, cursor.column).split(ch);
+
+        return n < matches.length ? matches.slice(-1 * n).join(ch).length : null;
+    },
+    toRealChar: function(ch) {
+        if (ch.length === 1)
+            return ch;
+
+        if (/^shift-./.test(ch))
+            return ch[ch.length - 1].toUpperCase();
+        else
+            return "";
+    },
+    copyLine: function(editor) {
+        var pos = editor.getCursorPosition();
+        editor.selection.clearSelection();
+        editor.moveCursorTo(pos.row, pos.column);
+        editor.selection.selectLine();
+        registers._default.isLine = true;
+        registers._default.text = editor.getCopyText().replace(/\n$/, "");
+        editor.selection.clearSelection();
+        editor.moveCursorTo(pos.row, pos.column);
+    }
+};
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/keyboard/vim/registers.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/keyboard/vim/registers.js b/src/fauxton/assets/js/libs/ace/keyboard/vim/registers.js
new file mode 100644
index 0000000..ef929a3
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/keyboard/vim/registers.js
@@ -0,0 +1,42 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+
+"never use strict";
+
+module.exports = {
+    _default: {
+        text: "",
+        isLine: false
+    }
+};
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/layer/cursor.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/layer/cursor.js b/src/fauxton/assets/js/libs/ace/layer/cursor.js
new file mode 100644
index 0000000..26ade52
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/layer/cursor.js
@@ -0,0 +1,217 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var dom = require("../lib/dom");
+
+var Cursor = function(parentEl) {
+    this.element = dom.createElement("div");
+    this.element.className = "ace_layer ace_cursor-layer";
+    parentEl.appendChild(this.element);
+
+    this.isVisible = false;
+    this.isBlinking = true;
+    this.blinkInterval = 1000;
+    this.smoothBlinking = false;
+
+    this.cursors = [];
+    this.cursor = this.addCursor();
+    dom.addCssClass(this.element, "ace_hidden-cursors");
+};
+
+(function() {
+
+    this.$padding = 0;
+    this.setPadding = function(padding) {
+        this.$padding = padding;
+    };
+
+    this.setSession = function(session) {
+        this.session = session;
+    };
+
+    this.setBlinking = function(blinking) {
+        if (blinking != this.isBlinking){
+            this.isBlinking = blinking;
+            this.restartTimer();
+        }
+    };
+
+    this.setBlinkInterval = function(blinkInterval) {
+        if (blinkInterval != this.blinkInterval){
+            this.blinkInterval = blinkInterval;
+            this.restartTimer();
+        }
+    };
+
+    this.setSmoothBlinking = function(smoothBlinking) {
+        if (smoothBlinking != this.smoothBlinking) {
+            this.smoothBlinking = smoothBlinking;
+            if (smoothBlinking)
+                dom.addCssClass(this.element, "ace_smooth-blinking");
+            else
+                dom.removeCssClass(this.element, "ace_smooth-blinking");
+            this.restartTimer();
+        }
+    };
+
+    this.addCursor = function() {
+        var el = dom.createElement("div");
+        el.className = "ace_cursor";
+        this.element.appendChild(el);
+        this.cursors.push(el);
+        return el;
+    };
+
+    this.removeCursor = function() {
+        if (this.cursors.length > 1) {
+            var el = this.cursors.pop();
+            el.parentNode.removeChild(el);
+            return el;
+        }
+    };
+
+    this.hideCursor = function() {
+        this.isVisible = false;
+        dom.addCssClass(this.element, "ace_hidden-cursors");
+        this.restartTimer();
+    };
+
+    this.showCursor = function() {
+        this.isVisible = true;
+        dom.removeCssClass(this.element, "ace_hidden-cursors");
+        this.restartTimer();
+    };
+
+    this.restartTimer = function() {
+        clearInterval(this.intervalId);
+        clearTimeout(this.timeoutId);
+        if (this.smoothBlinking)
+            dom.removeCssClass(this.element, "ace_smooth-blinking");
+        for (var i = this.cursors.length; i--; )
+            this.cursors[i].style.opacity = "";
+
+        if (!this.isBlinking || !this.blinkInterval || !this.isVisible)
+            return;
+
+        if (this.smoothBlinking)
+            setTimeout(function(){
+                dom.addCssClass(this.element, "ace_smooth-blinking");
+            }.bind(this));
+
+        var blink = function(){
+            this.timeoutId = setTimeout(function() {
+                for (var i = this.cursors.length; i--; ) {
+                    this.cursors[i].style.opacity = 0;
+                }
+            }.bind(this), 0.6 * this.blinkInterval);
+        }.bind(this);
+
+        this.intervalId = setInterval(function() {
+            for (var i = this.cursors.length; i--; ) {
+                this.cursors[i].style.opacity = "";
+            }
+            blink();
+        }.bind(this), this.blinkInterval);
+
+        blink();
+    };
+
+    this.getPixelPosition = function(position, onScreen) {
+        if (!this.config || !this.session)
+            return {left : 0, top : 0};
+
+        if (!position)
+            position = this.session.selection.getCursor();
+        var pos = this.session.documentToScreenPosition(position);
+        var cursorLeft = this.$padding + pos.column * this.config.characterWidth;
+        var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) *
+            this.config.lineHeight;
+
+        return {left : cursorLeft, top : cursorTop};
+    };
+
+    this.update = function(config) {
+        this.config = config;
+
+        var selections = this.session.$selectionMarkers;
+        var i = 0, cursorIndex = 0;
+
+        if (selections === undefined || selections.length === 0){
+            selections = [{cursor: null}];
+        }
+
+        for (var i = 0, n = selections.length; i < n; i++) {
+            var pixelPos = this.getPixelPosition(selections[i].cursor, true);
+            if ((pixelPos.top > config.height + config.offset ||
+                 pixelPos.top < -config.offset) && i > 1) {
+                continue;
+            }
+
+            var style = (this.cursors[cursorIndex++] || this.addCursor()).style;
+
+            style.left = pixelPos.left + "px";
+            style.top = pixelPos.top + "px";
+            style.width = config.characterWidth + "px";
+            style.height = config.lineHeight + "px";
+        }
+        while (this.cursors.length > cursorIndex)
+            this.removeCursor();
+
+        var overwrite = this.session.getOverwrite();
+        this.$setOverwrite(overwrite);
+
+        // cache for textarea and gutter highlight
+        this.$pixelPos = pixelPos;
+        this.restartTimer();
+    };
+
+    this.$setOverwrite = function(overwrite) {
+        if (overwrite != this.overwrite) {
+            this.overwrite = overwrite;
+            if (overwrite)
+                dom.addCssClass(this.element, "ace_overwrite-cursors");
+            else
+                dom.removeCssClass(this.element, "ace_overwrite-cursors");
+        }
+    };
+
+    this.destroy = function() {
+        clearInterval(this.intervalId);
+        clearTimeout(this.timeoutId);
+    };
+
+}).call(Cursor.prototype);
+
+exports.Cursor = Cursor;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/layer/gutter.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/layer/gutter.js b/src/fauxton/assets/js/libs/ace/layer/gutter.js
new file mode 100644
index 0000000..c1130d8
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/layer/gutter.js
@@ -0,0 +1,265 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var dom = require("../lib/dom");
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var EventEmitter = require("../lib/event_emitter").EventEmitter;
+
+var Gutter = function(parentEl) {
+    this.element = dom.createElement("div");
+    this.element.className = "ace_layer ace_gutter-layer";
+    parentEl.appendChild(this.element);
+    this.setShowFoldWidgets(this.$showFoldWidgets);
+    
+    this.gutterWidth = 0;
+
+    this.$annotations = [];
+    this.$updateAnnotations = this.$updateAnnotations.bind(this);
+
+    this.$cells = [];
+};
+
+(function() {
+
+    oop.implement(this, EventEmitter);
+
+    this.setSession = function(session) {
+        if (this.session)
+            this.session.removeEventListener("change", this.$updateAnnotations);
+        this.session = session;
+        session.on("change", this.$updateAnnotations);
+    };
+
+    this.addGutterDecoration = function(row, className){
+        if (window.console)
+            console.warn && console.warn("deprecated use session.addGutterDecoration");
+        this.session.addGutterDecoration(row, className);
+    };
+
+    this.removeGutterDecoration = function(row, className){
+        if (window.console)
+            console.warn && console.warn("deprecated use session.removeGutterDecoration");
+        this.session.removeGutterDecoration(row, className);
+    };
+
+    this.setAnnotations = function(annotations) {
+        // iterate over sparse array
+        this.$annotations = []
+        var rowInfo, row;
+        for (var i = 0; i < annotations.length; i++) {
+            var annotation = annotations[i];
+            var row = annotation.row;
+            var rowInfo = this.$annotations[row];
+            if (!rowInfo)
+                rowInfo = this.$annotations[row] = {text: []};
+           
+            var annoText = annotation.text;
+            annoText = annoText ? lang.escapeHTML(annoText) : annotation.html || "";
+
+            if (rowInfo.text.indexOf(annoText) === -1)
+                rowInfo.text.push(annoText);
+
+            var type = annotation.type;
+            if (type == "error")
+                rowInfo.className = " ace_error";
+            else if (type == "warning" && rowInfo.className != " ace_error")
+                rowInfo.className = " ace_warning";
+            else if (type == "info" && (!rowInfo.className))
+                rowInfo.className = " ace_info";
+        }
+    };
+
+    this.$updateAnnotations = function (e) {
+        if (!this.$annotations.length)
+            return;
+        var delta = e.data;
+        var range = delta.range;
+        var firstRow = range.start.row;
+        var len = range.end.row - firstRow;
+        if (len === 0) {
+            // do nothing
+        } else if (delta.action == "removeText" || delta.action == "removeLines") {
+            this.$annotations.splice(firstRow, len + 1, null);
+        } else {
+            var args = Array(len + 1);
+            args.unshift(firstRow, 1);
+            this.$annotations.splice.apply(this.$annotations, args);
+        }
+    };
+
+    this.update = function(config) {
+        var firstRow = config.firstRow;
+        var lastRow = config.lastRow;
+        var fold = this.session.getNextFoldLine(firstRow);
+        var foldStart = fold ? fold.start.row : Infinity;
+        var foldWidgets = this.$showFoldWidgets && this.session.foldWidgets;
+        var breakpoints = this.session.$breakpoints;
+        var decorations = this.session.$decorations;
+        var firstLineNumber = this.session.$firstLineNumber;
+        var lastLineNumber = 0;
+
+        var cell = null;
+        var index = -1;
+        var row = firstRow;
+        while (true) {
+            if (row > foldStart) {
+                row = fold.end.row + 1;
+                fold = this.session.getNextFoldLine(row, fold);
+                foldStart = fold ? fold.start.row : Infinity;
+            }
+            if (row > lastRow) {
+                while (this.$cells.length > index + 1) {
+                    cell = this.$cells.pop();
+                    this.element.removeChild(cell.element);
+                }
+                break;
+            }
+
+            cell = this.$cells[++index];
+            if (!cell) {
+                cell = {element: null, textNode: null, foldWidget: null};
+                cell.element = dom.createElement("div");
+                cell.textNode = document.createTextNode('');
+                cell.element.appendChild(cell.textNode);
+                this.element.appendChild(cell.element);
+                this.$cells[index] = cell;
+            }
+
+            var className = "ace_gutter-cell ";
+            if (breakpoints[row])
+                className += breakpoints[row];
+            if (decorations[row])
+                className += decorations[row];
+            if (this.$annotations[row])
+                className += this.$annotations[row].className;
+            if (cell.element.className != className)
+                cell.element.className = className;
+
+            var height = this.session.getRowLength(row) * config.lineHeight + "px";
+            if (height != cell.element.style.height)
+                cell.element.style.height = height;
+
+            var text = lastLineNumber = row + firstLineNumber;
+            if (text != cell.textNode.data)
+                cell.textNode.data  = text;
+
+            if (foldWidgets) {
+                var c = foldWidgets[row];
+                // check if cached value is invalidated and we need to recompute
+                if (c == null)
+                    c = foldWidgets[row] = this.session.getFoldWidget(row);
+            }
+
+            if (c) {
+                if (!cell.foldWidget) {
+                    cell.foldWidget = dom.createElement("span");
+                    cell.element.appendChild(cell.foldWidget);
+                }
+                var className = "ace_fold-widget ace_" + c;
+                if (c == "start" && row == foldStart && row < fold.end.row)
+                    className += " ace_closed";
+                else
+                    className += " ace_open";
+                if (cell.foldWidget.className != className)
+                    cell.foldWidget.className = className;
+
+                var height = config.lineHeight + "px";
+                if (cell.foldWidget.style.height != height)
+                    cell.foldWidget.style.height = height;
+            } else {
+                if (cell.foldWidget != null) {
+                    cell.element.removeChild(cell.foldWidget);
+                    cell.foldWidget = null;
+                }
+            }
+
+            row++;
+        }
+
+        this.element.style.height = config.minHeight + "px";
+
+        if (this.$fixedWidth || this.session.$useWrapMode)
+            lastLineNumber = this.session.getLength();
+
+        var gutterWidth = lastLineNumber.toString().length * config.characterWidth;
+        var padding = this.$padding || this.$computePadding();
+        gutterWidth += padding.left + padding.right;
+        if (gutterWidth !== this.gutterWidth && !isNaN(gutterWidth)) {
+            this.gutterWidth = gutterWidth;
+            this.element.style.width = Math.ceil(this.gutterWidth) + "px";
+            this._emit("changeGutterWidth", gutterWidth);
+        }
+    };
+
+    this.$fixedWidth = false;
+    
+    this.$showFoldWidgets = true;
+    this.setShowFoldWidgets = function(show) {
+        if (show)
+            dom.addCssClass(this.element, "ace_folding-enabled");
+        else
+            dom.removeCssClass(this.element, "ace_folding-enabled");
+
+        this.$showFoldWidgets = show;
+        this.$padding = null;
+    };
+    
+    this.getShowFoldWidgets = function() {
+        return this.$showFoldWidgets;
+    };
+
+    this.$computePadding = function() {
+        if (!this.element.firstChild)
+            return {left: 0, right: 0};
+        var style = dom.computedStyle(this.element.firstChild);
+        this.$padding = {};
+        this.$padding.left = parseInt(style.paddingLeft) + 1 || 0;
+        this.$padding.right = parseInt(style.paddingRight) || 0;
+        return this.$padding;
+    };
+
+    this.getRegion = function(point) {
+        var padding = this.$padding || this.$computePadding();
+        var rect = this.element.getBoundingClientRect();
+        if (point.x < padding.left + rect.left)
+            return "markers";
+        if (this.$showFoldWidgets && point.x > rect.right - padding.right)
+            return "foldWidgets";
+    };
+
+}).call(Gutter.prototype);
+
+exports.Gutter = Gutter;
+
+});


[38/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/lib/event.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/lib/event.js b/src/fauxton/assets/js/libs/ace/lib/event.js
new file mode 100644
index 0000000..691d001
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/lib/event.js
@@ -0,0 +1,353 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var keys = require("./keys");
+var useragent = require("./useragent");
+var dom = require("./dom");
+
+exports.addListener = function(elem, type, callback) {
+    if (elem.addEventListener) {
+        return elem.addEventListener(type, callback, false);
+    }
+    if (elem.attachEvent) {
+        var wrapper = function() {
+            callback.call(elem, window.event);
+        };
+        callback._wrapper = wrapper;
+        elem.attachEvent("on" + type, wrapper);
+    }
+};
+
+exports.removeListener = function(elem, type, callback) {
+    if (elem.removeEventListener) {
+        return elem.removeEventListener(type, callback, false);
+    }
+    if (elem.detachEvent) {
+        elem.detachEvent("on" + type, callback._wrapper || callback);
+    }
+};
+
+/*
+* Prevents propagation and clobbers the default action of the passed event
+*/
+exports.stopEvent = function(e) {
+    exports.stopPropagation(e);
+    exports.preventDefault(e);
+    return false;
+};
+
+exports.stopPropagation = function(e) {
+    if (e.stopPropagation)
+        e.stopPropagation();
+    else
+        e.cancelBubble = true;
+};
+
+exports.preventDefault = function(e) {
+    if (e.preventDefault)
+        e.preventDefault();
+    else
+        e.returnValue = false;
+};
+
+/*
+ * @return {Number} 0 for left button, 1 for middle button, 2 for right button
+ */
+exports.getButton = function(e) {
+    if (e.type == "dblclick")
+        return 0;
+    if (e.type == "contextmenu" || (e.ctrlKey && useragent.isMac))
+        return 2;
+
+    // DOM Event
+    if (e.preventDefault) {
+        return e.button;
+    }
+    // old IE
+    else {
+        return {1:0, 2:2, 4:1}[e.button];
+    }
+};
+
+exports.capture = function(el, eventHandler, releaseCaptureHandler) {
+    function onMouseUp(e) {
+        eventHandler && eventHandler(e);
+        releaseCaptureHandler && releaseCaptureHandler(e);
+
+        exports.removeListener(document, "mousemove", eventHandler, true);
+        exports.removeListener(document, "mouseup", onMouseUp, true);
+        exports.removeListener(document, "dragstart", onMouseUp, true);
+    }
+
+    exports.addListener(document, "mousemove", eventHandler, true);
+    exports.addListener(document, "mouseup", onMouseUp, true);
+    exports.addListener(document, "dragstart", onMouseUp, true);
+};
+
+exports.addMouseWheelListener = function(el, callback) {
+    if ("onmousewheel" in el) {
+        var factor = 8;
+        exports.addListener(el, "mousewheel", function(e) {
+            if (e.wheelDeltaX !== undefined) {
+                e.wheelX = -e.wheelDeltaX / factor;
+                e.wheelY = -e.wheelDeltaY / factor;
+            } else {
+                e.wheelX = 0;
+                e.wheelY = -e.wheelDelta / factor;
+            }
+            callback(e);
+        });
+    } else if ("onwheel" in el) {
+        exports.addListener(el, "wheel",  function(e) {
+            e.wheelX = (e.deltaX || 0) * 5;
+            e.wheelY = (e.deltaY || 0) * 5;
+            callback(e);
+        });
+    } else {
+        exports.addListener(el, "DOMMouseScroll", function(e) {
+            if (e.axis && e.axis == e.HORIZONTAL_AXIS) {
+                e.wheelX = (e.detail || 0) * 5;
+                e.wheelY = 0;
+            } else {
+                e.wheelX = 0;
+                e.wheelY = (e.detail || 0) * 5;
+            }
+            callback(e);
+        });
+    }
+};
+
+exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbackName) {
+    var clicks = 0;
+    var startX, startY, timer;
+    var eventNames = {
+        2: "dblclick",
+        3: "tripleclick",
+        4: "quadclick"
+    };
+
+    exports.addListener(el, "mousedown", function(e) {
+        if (exports.getButton(e) != 0) {
+            clicks = 0;
+        } else if (e.detail > 1) {
+            clicks++;
+            if (clicks > 4)
+                clicks = 1;
+        } else {
+            clicks = 1;
+        }
+        if (useragent.isIE) {
+            var isNewClick = Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5;
+            if (isNewClick) {
+                clicks = 1;
+            }
+            if (clicks == 1) {
+                startX = e.clientX;
+                startY = e.clientY;
+            }
+        }
+
+        eventHandler[callbackName]("mousedown", e);
+
+        if (clicks > 4)
+            clicks = 0;
+        else if (clicks > 1)
+            return eventHandler[callbackName](eventNames[clicks], e);
+    });
+
+    if (useragent.isOldIE) {
+        exports.addListener(el, "dblclick", function(e) {
+            clicks = 2;
+            if (timer)
+                clearTimeout(timer);
+            timer = setTimeout(function() {timer = null}, timeouts[clicks - 1] || 600);
+            eventHandler[callbackName]("mousedown", e);
+            eventHandler[callbackName](eventNames[clicks], e);
+        });
+    }
+};
+
+function normalizeCommandKeys(callback, e, keyCode) {
+    var hashId = 0;
+    if ((useragent.isOpera && !("KeyboardEvent" in window)) && useragent.isMac) {
+        hashId = 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0)
+            | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
+    } else {
+        hashId = 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0)
+            | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
+    }
+
+    if (!useragent.isMac && pressedKeys) {
+        if (pressedKeys[91] || pressedKeys[92])
+            hashId |= 8;
+        if (pressedKeys.altGr) {
+            if ((3 & hashId) != 3)
+                pressedKeys.altGr = 0
+            else
+                return;
+        }
+        if (keyCode === 18 || keyCode === 17) {
+            var location = e.location || e.keyLocation;
+            if (keyCode === 17 && location === 1) {
+                ts = e.timeStamp;
+            } else if (keyCode === 18 && hashId === 3 && location === 2) {
+                var dt = -ts;
+                ts = e.timeStamp;
+                dt += ts;
+                if (dt < 3)
+                    pressedKeys.altGr = true;
+            }
+        }
+    }
+    
+    if (keyCode in keys.MODIFIER_KEYS) {
+        switch (keys.MODIFIER_KEYS[keyCode]) {
+            case "Alt":
+                hashId = 2;
+                break;
+            case "Shift":
+                hashId = 4;
+                break;
+            case "Ctrl":
+                hashId = 1;
+                break;
+            default:
+                hashId = 8;
+                break;
+        }
+        keyCode = 0;
+    }
+
+    if (hashId & 8 && (keyCode === 91 || keyCode === 93)) {
+        keyCode = 0;
+    }
+    
+    if (!hashId && keyCode === 13) {
+        if (e.location || e.keyLocation === 3) {
+            callback(e, hashId, -keyCode)
+            if (e.defaultPrevented)
+                return;
+        }
+    }
+    
+
+    // If there is no hashId and the keyCode is not a function key, then
+    // we don't call the callback as we don't handle a command key here
+    // (it's a normal key/character input).
+    if (!hashId && !(keyCode in keys.FUNCTION_KEYS) && !(keyCode in keys.PRINTABLE_KEYS)) {
+        return false;
+    }
+    
+    
+    
+    return callback(e, hashId, keyCode);
+}
+
+var pressedKeys = null;
+var ts = 0;
+exports.addCommandKeyListener = function(el, callback) {
+    var addListener = exports.addListener;
+    if (useragent.isOldGecko || (useragent.isOpera && !("KeyboardEvent" in window))) {
+        // Old versions of Gecko aka. Firefox < 4.0 didn't repeat the keydown
+        // event if the user pressed the key for a longer time. Instead, the
+        // keydown event was fired once and later on only the keypress event.
+        // To emulate the 'right' keydown behavior, the keyCode of the initial
+        // keyDown event is stored and in the following keypress events the
+        // stores keyCode is used to emulate a keyDown event.
+        var lastKeyDownKeyCode = null;
+        addListener(el, "keydown", function(e) {
+            lastKeyDownKeyCode = e.keyCode;
+        });
+        addListener(el, "keypress", function(e) {
+            return normalizeCommandKeys(callback, e, lastKeyDownKeyCode);
+        });
+    } else {
+        var lastDefaultPrevented = null;
+
+        addListener(el, "keydown", function(e) {
+            pressedKeys[e.keyCode] = true;
+            var result = normalizeCommandKeys(callback, e, e.keyCode);
+            lastDefaultPrevented = e.defaultPrevented;
+            return result;
+        });
+
+        addListener(el, "keypress", function(e) {
+            if (lastDefaultPrevented && (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey)) {
+                exports.stopEvent(e);
+                lastDefaultPrevented = null;
+            }
+        });
+
+        addListener(el, "keyup", function(e) {
+            pressedKeys[e.keyCode] = null;
+        });
+
+        if (!pressedKeys) {
+            pressedKeys = Object.create(null);
+            addListener(window, "focus", function(e) {
+                pressedKeys = Object.create(null);
+            });
+        }
+    }
+};
+
+if (window.postMessage && !useragent.isOldIE) {
+    var postMessageId = 1;
+    exports.nextTick = function(callback, win) {
+        win = win || window;
+        var messageName = "zero-timeout-message-" + postMessageId;
+        exports.addListener(win, "message", function listener(e) {
+            if (e.data == messageName) {
+                exports.stopPropagation(e);
+                exports.removeListener(win, "message", listener);
+                callback();
+            }
+        });
+        win.postMessage(messageName, "*");
+    };
+}
+
+
+exports.nextFrame = window.requestAnimationFrame ||
+    window.mozRequestAnimationFrame ||
+    window.webkitRequestAnimationFrame ||
+    window.msRequestAnimationFrame ||
+    window.oRequestAnimationFrame;
+
+if (exports.nextFrame)
+    exports.nextFrame = exports.nextFrame.bind(window);
+else
+    exports.nextFrame = function(callback) {
+        setTimeout(callback, 17);
+    };
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/lib/event_emitter.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/lib/event_emitter.js b/src/fauxton/assets/js/libs/ace/lib/event_emitter.js
new file mode 100644
index 0000000..b986014
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/lib/event_emitter.js
@@ -0,0 +1,155 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var EventEmitter = {};
+var stopPropagation = function() { this.propagationStopped = true; };
+var preventDefault = function() { this.defaultPrevented = true; };
+
+EventEmitter._emit =
+EventEmitter._dispatchEvent = function(eventName, e) {
+    this._eventRegistry || (this._eventRegistry = {});
+    this._defaultHandlers || (this._defaultHandlers = {});
+
+    var listeners = this._eventRegistry[eventName] || [];
+    var defaultHandler = this._defaultHandlers[eventName];
+    if (!listeners.length && !defaultHandler)
+        return;
+
+    if (typeof e != "object" || !e)
+        e = {};
+
+    if (!e.type)
+        e.type = eventName;
+    if (!e.stopPropagation)
+        e.stopPropagation = stopPropagation;
+    if (!e.preventDefault)
+        e.preventDefault = preventDefault;
+
+    listeners = listeners.slice();
+    for (var i=0; i<listeners.length; i++) {
+        listeners[i](e, this);
+        if (e.propagationStopped)
+            break;
+    }
+    
+    if (defaultHandler && !e.defaultPrevented)
+        return defaultHandler(e, this);
+};
+
+
+EventEmitter._signal = function(eventName, e) {
+    var listeners = (this._eventRegistry || {})[eventName];
+    if (!listeners)
+        return;
+    listeners = listeners.slice();
+    for (var i=0; i<listeners.length; i++)
+        listeners[i](e, this);
+};
+
+EventEmitter.once = function(eventName, callback) {
+    var _self = this;
+    callback && this.addEventListener(eventName, function newCallback() {
+        _self.removeEventListener(eventName, newCallback);
+        callback.apply(null, arguments);
+    });
+};
+
+
+EventEmitter.setDefaultHandler = function(eventName, callback) {
+    var handlers = this._defaultHandlers
+    if (!handlers)
+        handlers = this._defaultHandlers = {_disabled_: {}};
+    
+    if (handlers[eventName]) {
+        var old = handlers[eventName];
+        var disabled = handlers._disabled_[eventName];
+        if (!disabled)
+            handlers._disabled_[eventName] = disabled = [];
+        disabled.push(old);
+        var i = disabled.indexOf(callback);
+        if (i != -1) 
+            disabled.splice(i, 1);
+    }
+    handlers[eventName] = callback;
+};
+EventEmitter.removeDefaultHandler = function(eventName, callback) {
+    var handlers = this._defaultHandlers
+    if (!handlers)
+        return;
+    var disabled = handlers._disabled_[eventName];
+    
+    if (handlers[eventName] == callback) {
+        var old = handlers[eventName];
+        if (disabled)
+            this.setDefaultHandler(eventName, disabled.pop());
+    } else if (disabled) {
+        var i = disabled.indexOf(callback);
+        if (i != -1)
+            disabled.splice(i, 1);
+    }
+};
+
+EventEmitter.on =
+EventEmitter.addEventListener = function(eventName, callback, capturing) {
+    this._eventRegistry = this._eventRegistry || {};
+
+    var listeners = this._eventRegistry[eventName];
+    if (!listeners)
+        listeners = this._eventRegistry[eventName] = [];
+
+    if (listeners.indexOf(callback) == -1)
+        listeners[capturing ? "unshift" : "push"](callback);
+    return callback;
+};
+
+EventEmitter.off =
+EventEmitter.removeListener =
+EventEmitter.removeEventListener = function(eventName, callback) {
+    this._eventRegistry = this._eventRegistry || {};
+
+    var listeners = this._eventRegistry[eventName];
+    if (!listeners)
+        return;
+
+    var index = listeners.indexOf(callback);
+    if (index !== -1)
+        listeners.splice(index, 1);
+};
+
+EventEmitter.removeAllListeners = function(eventName) {
+    if (this._eventRegistry) this._eventRegistry[eventName] = [];
+};
+
+exports.EventEmitter = EventEmitter;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/lib/event_emitter_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/lib/event_emitter_test.js b/src/fauxton/assets/js/libs/ace/lib/event_emitter_test.js
new file mode 100644
index 0000000..cc2804e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/lib/event_emitter_test.js
@@ -0,0 +1,65 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var EventEmitter = require("./event_emitter").EventEmitter;
+var assert = require("../test/assertions");
+
+var Emitter = function() {};
+
+oop.implement(Emitter.prototype, EventEmitter);
+
+module.exports = {
+    "test: dispatch event with no data" : function() {
+        var emitter = new Emitter();
+
+        var called = false;
+        emitter.addEventListener("juhu", function(e) {
+           called = true;
+           assert.equal(e.type, "juhu");
+        });
+
+        emitter._emit("juhu");
+        assert.ok(called);
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/lib/fixoldbrowsers.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/lib/fixoldbrowsers.js b/src/fauxton/assets/js/libs/ace/lib/fixoldbrowsers.js
new file mode 100644
index 0000000..2da9b10
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/lib/fixoldbrowsers.js
@@ -0,0 +1,19 @@
+// vim:set ts=4 sts=4 sw=4 st:
+// -- kriskowal Kris Kowal Copyright (C) 2009-2010 MIT License
+// -- tlrobinson Tom Robinson Copyright (C) 2009-2010 MIT License (Narwhal Project)
+// -- dantman Daniel Friesen Copyright(C) 2010 XXX No License Specified
+// -- fschaefer Florian Schäfer Copyright (C) 2010 MIT License
+// -- Irakli Gozalishvili Copyright (C) 2010 MIT License
+
+/*!
+    Copyright (c) 2009, 280 North Inc. http://280north.com/
+    MIT License. http://github.com/280north/narwhal/blob/master/README.md
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+require("./regexp");
+require("./es5-shim");
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/lib/keys.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/lib/keys.js b/src/fauxton/assets/js/libs/ace/lib/keys.js
new file mode 100644
index 0000000..42d427b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/lib/keys.js
@@ -0,0 +1,138 @@
+/*! @license
+==========================================================================
+SproutCore -- JavaScript Application Framework
+copyright 2006-2009, Sprout Systems Inc., Apple Inc. and contributors.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+SproutCore and the SproutCore logo are trademarks of Sprout Systems, Inc.
+
+For more information about SproutCore, visit http://www.sproutcore.com
+
+
+==========================================================================
+@license */
+
+// Most of the following code is taken from SproutCore with a few changes.
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("./oop");
+
+/*
+ * Helper functions and hashes for key handling.
+ */
+var Keys = (function() {
+    var ret = {
+        MODIFIER_KEYS: {
+            16: 'Shift', 17: 'Ctrl', 18: 'Alt', 224: 'Meta'
+        },
+
+        KEY_MODS: {
+            "ctrl": 1, "alt": 2, "option" : 2,
+            "shift": 4, "meta": 8, "command": 8, "cmd": 8
+        },
+
+        FUNCTION_KEYS : {
+            8  : "Backspace",
+            9  : "Tab",
+            13 : "Return",
+            19 : "Pause",
+            27 : "Esc",
+            32 : "Space",
+            33 : "PageUp",
+            34 : "PageDown",
+            35 : "End",
+            36 : "Home",
+            37 : "Left",
+            38 : "Up",
+            39 : "Right",
+            40 : "Down",
+            44 : "Print",
+            45 : "Insert",
+            46 : "Delete",
+            96 : "Numpad0",
+            97 : "Numpad1",
+            98 : "Numpad2",
+            99 : "Numpad3",
+            100: "Numpad4",
+            101: "Numpad5",
+            102: "Numpad6",
+            103: "Numpad7",
+            104: "Numpad8",
+            105: "Numpad9",
+            '-13': "NumpadEnter",
+            112: "F1",
+            113: "F2",
+            114: "F3",
+            115: "F4",
+            116: "F5",
+            117: "F6",
+            118: "F7",
+            119: "F8",
+            120: "F9",
+            121: "F10",
+            122: "F11",
+            123: "F12",
+            144: "Numlock",
+            145: "Scrolllock"
+        },
+
+        PRINTABLE_KEYS: {
+           32: ' ',  48: '0',  49: '1',  50: '2',  51: '3',  52: '4', 53:  '5',
+           54: '6',  55: '7',  56: '8',  57: '9',  59: ';',  61: '=', 65:  'a',
+           66: 'b',  67: 'c',  68: 'd',  69: 'e',  70: 'f',  71: 'g', 72:  'h',
+           73: 'i',  74: 'j',  75: 'k',  76: 'l',  77: 'm',  78: 'n', 79:  'o',
+           80: 'p',  81: 'q',  82: 'r',  83: 's',  84: 't',  85: 'u', 86:  'v',
+           87: 'w',  88: 'x',  89: 'y',  90: 'z', 107: '+', 109: '-', 110: '.',
+          188: ',', 190: '.', 191: '/', 192: '`', 219: '[', 220: '\\',
+          221: ']', 222: '\''
+        }
+    };
+
+    // A reverse map of FUNCTION_KEYS
+    for (var i in ret.FUNCTION_KEYS) {
+        var name = ret.FUNCTION_KEYS[i].toLowerCase();
+        ret[name] = parseInt(i, 10);
+    }
+
+    // Add the MODIFIER_KEYS, FUNCTION_KEYS and PRINTABLE_KEYS to the KEY
+    // variables as well.
+    oop.mixin(ret, ret.MODIFIER_KEYS);
+    oop.mixin(ret, ret.PRINTABLE_KEYS);
+    oop.mixin(ret, ret.FUNCTION_KEYS);
+
+    // aliases
+    ret.enter = ret["return"];
+    ret.escape = ret.esc;
+    ret.del = ret["delete"];
+    
+    // workaround for firefox bug
+    ret[173] = '-';
+
+    return ret;
+})();
+oop.mixin(exports, Keys);
+
+exports.keyCodeToString = function(keyCode) {
+    return (Keys[keyCode] || String.fromCharCode(keyCode)).toLowerCase();
+}
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/lib/lang.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/lib/lang.js b/src/fauxton/assets/js/libs/ace/lib/lang.js
new file mode 100644
index 0000000..4e6ebf2
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/lib/lang.js
@@ -0,0 +1,212 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+exports.stringReverse = function(string) {
+    return string.split("").reverse().join("");
+};
+
+exports.stringRepeat = function (string, count) {
+    var result = '';
+    while (count > 0) {
+        if (count & 1)
+            result += string;
+
+        if (count >>= 1)
+            string += string;
+    }
+    return result;
+};
+
+var trimBeginRegexp = /^\s\s*/;
+var trimEndRegexp = /\s\s*$/;
+
+exports.stringTrimLeft = function (string) {
+    return string.replace(trimBeginRegexp, '');
+};
+
+exports.stringTrimRight = function (string) {
+    return string.replace(trimEndRegexp, '');
+};
+
+exports.copyObject = function(obj) {
+    var copy = {};
+    for (var key in obj) {
+        copy[key] = obj[key];
+    }
+    return copy;
+};
+
+exports.copyArray = function(array){
+    var copy = [];
+    for (var i=0, l=array.length; i<l; i++) {
+        if (array[i] && typeof array[i] == "object")
+            copy[i] = this.copyObject( array[i] );
+        else 
+            copy[i] = array[i];
+    }
+    return copy;
+};
+
+exports.deepCopy = function (obj) {
+    if (typeof obj != "object") {
+        return obj;
+    }
+    
+    var copy = obj.constructor();
+    for (var key in obj) {
+        if (typeof obj[key] == "object") {
+            copy[key] = this.deepCopy(obj[key]);
+        } else {
+            copy[key] = obj[key];
+        }
+    }
+    return copy;
+};
+
+exports.arrayToMap = function(arr) {
+    var map = {};
+    for (var i=0; i<arr.length; i++) {
+        map[arr[i]] = 1;
+    }
+    return map;
+
+};
+
+exports.createMap = function(props) {
+    var map = Object.create(null);
+    for (var i in props) {
+        map[i] = props[i];
+    }
+    return map;
+};
+
+/*
+ * splice out of 'array' anything that === 'value'
+ */
+exports.arrayRemove = function(array, value) {
+  for (var i = 0; i <= array.length; i++) {
+    if (value === array[i]) {
+      array.splice(i, 1);
+    }
+  }
+};
+
+exports.escapeRegExp = function(str) {
+    return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
+};
+
+exports.escapeHTML = function(str) {
+    return str.replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
+};
+
+exports.getMatchOffsets = function(string, regExp) {
+    var matches = [];
+
+    string.replace(regExp, function(str) {
+        matches.push({
+            offset: arguments[arguments.length-2],
+            length: str.length
+        });
+    });
+
+    return matches;
+};
+
+/* deprecated */
+exports.deferredCall = function(fcn) {
+
+    var timer = null;
+    var callback = function() {
+        timer = null;
+        fcn();
+    };
+
+    var deferred = function(timeout) {
+        deferred.cancel();
+        timer = setTimeout(callback, timeout || 0);
+        return deferred;
+    };
+
+    deferred.schedule = deferred;
+
+    deferred.call = function() {
+        this.cancel();
+        fcn();
+        return deferred;
+    };
+
+    deferred.cancel = function() {
+        clearTimeout(timer);
+        timer = null;
+        return deferred;
+    };
+
+    return deferred;
+};
+
+
+exports.delayedCall = function(fcn, defaultTimeout) {
+    var timer = null;
+    var callback = function() {
+        timer = null;
+        fcn();
+    };
+
+    var _self = function(timeout) {
+        timer && clearTimeout(timer);
+        timer = setTimeout(callback, timeout || defaultTimeout);
+    };
+
+    _self.delay = _self;
+    _self.schedule = function(timeout) {
+        if (timer == null)
+            timer = setTimeout(callback, timeout || 0);
+    };
+
+    _self.call = function() {
+        this.cancel();
+        fcn();
+    };
+
+    _self.cancel = function() {
+        timer && clearTimeout(timer);
+        timer = null;
+    };
+
+    _self.isPending = function() {
+        return timer;
+    };
+
+    return _self;
+};
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/lib/net.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/lib/net.js b/src/fauxton/assets/js/libs/ace/lib/net.js
new file mode 100644
index 0000000..3869da4
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/lib/net.js
@@ -0,0 +1,41 @@
+/*
+ * based on code from:
+ *
+ * @license RequireJS text 0.25.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
+ * Available via the MIT or new BSD license.
+ * see: http://github.com/jrburke/requirejs for details
+ */
+define(function(require, exports, module) {
+"use strict";
+var dom = require("./dom");
+
+exports.get = function (url, callback) {
+    var xhr = new XMLHttpRequest();
+    xhr.open('GET', url, true);
+    xhr.onreadystatechange = function () {
+        //Do not explicitly handle errors, those should be
+        //visible via console output in the browser.
+        if (xhr.readyState === 4) {
+            callback(xhr.responseText);
+        }
+    };
+    xhr.send(null);
+};
+
+exports.loadScript = function(path, callback) {
+    var head = dom.getDocumentHead();
+    var s = document.createElement('script');
+
+    s.src = path;
+    head.appendChild(s);
+
+    s.onload = s.onreadystatechange = function(_, isAbort) {
+        if (isAbort || !s.readyState || s.readyState == "loaded" || s.readyState == "complete") {
+            s = s.onload = s.onreadystatechange = null;
+            if (!isAbort)
+                callback();
+        }
+    };
+};
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/lib/oop.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/lib/oop.js b/src/fauxton/assets/js/libs/ace/lib/oop.js
new file mode 100644
index 0000000..f3dbb1d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/lib/oop.js
@@ -0,0 +1,55 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+exports.inherits = (function() {
+    var tempCtor = function() {};
+    return function(ctor, superCtor) {
+        tempCtor.prototype = superCtor.prototype;
+        ctor.super_ = superCtor.prototype;
+        ctor.prototype = new tempCtor();
+        ctor.prototype.constructor = ctor;
+    };
+}());
+
+exports.mixin = function(obj, mixin) {
+    for (var key in mixin) {
+        obj[key] = mixin[key];
+    }
+    return obj;
+};
+
+exports.implement = function(proto, mixin) {
+    exports.mixin(proto, mixin);
+};
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/lib/regexp.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/lib/regexp.js b/src/fauxton/assets/js/libs/ace/lib/regexp.js
new file mode 100644
index 0000000..369f74f
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/lib/regexp.js
@@ -0,0 +1,113 @@
+/*
+ *  Based on code from:
+ *
+ * XRegExp 1.5.0
+ * (c) 2007-2010 Steven Levithan
+ * MIT License
+ * <http://xregexp.com>
+ * Provides an augmented, extensible, cross-browser implementation of regular expressions,
+ * including support for additional syntax, flags, and methods
+ */
+ 
+define(function(require, exports, module) {
+"use strict";
+
+    //---------------------------------
+    //  Private variables
+    //---------------------------------
+
+    var real = {
+            exec: RegExp.prototype.exec,
+            test: RegExp.prototype.test,
+            match: String.prototype.match,
+            replace: String.prototype.replace,
+            split: String.prototype.split
+        },
+        compliantExecNpcg = real.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups
+        compliantLastIndexIncrement = function () {
+            var x = /^/g;
+            real.test.call(x, "");
+            return !x.lastIndex;
+        }();
+
+    if (compliantLastIndexIncrement && compliantExecNpcg)
+        return;
+
+    //---------------------------------
+    //  Overriden native methods
+    //---------------------------------
+
+    // Adds named capture support (with backreferences returned as `result.name`), and fixes two
+    // cross-browser issues per ES3:
+    // - Captured values for nonparticipating capturing groups should be returned as `undefined`,
+    //   rather than the empty string.
+    // - `lastIndex` should not be incremented after zero-length matches.
+    RegExp.prototype.exec = function (str) {
+        var match = real.exec.apply(this, arguments),
+            name, r2;
+        if ( typeof(str) == 'string' && match) {
+            // Fix browsers whose `exec` methods don't consistently return `undefined` for
+            // nonparticipating capturing groups
+            if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) {
+                r2 = RegExp(this.source, real.replace.call(getNativeFlags(this), "g", ""));
+                // Using `str.slice(match.index)` rather than `match[0]` in case lookahead allowed
+                // matching due to characters outside the match
+                real.replace.call(str.slice(match.index), r2, function () {
+                    for (var i = 1; i < arguments.length - 2; i++) {
+                        if (arguments[i] === undefined)
+                            match[i] = undefined;
+                    }
+                });
+            }
+            // Attach named capture properties
+            if (this._xregexp && this._xregexp.captureNames) {
+                for (var i = 1; i < match.length; i++) {
+                    name = this._xregexp.captureNames[i - 1];
+                    if (name)
+                       match[name] = match[i];
+                }
+            }
+            // Fix browsers that increment `lastIndex` after zero-length matches
+            if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))
+                this.lastIndex--;
+        }
+        return match;
+    };
+
+    // Don't override `test` if it won't change anything
+    if (!compliantLastIndexIncrement) {
+        // Fix browser bug in native method
+        RegExp.prototype.test = function (str) {
+            // Use the native `exec` to skip some processing overhead, even though the overriden
+            // `exec` would take care of the `lastIndex` fix
+            var match = real.exec.call(this, str);
+            // Fix browsers that increment `lastIndex` after zero-length matches
+            if (match && this.global && !match[0].length && (this.lastIndex > match.index))
+                this.lastIndex--;
+            return !!match;
+        };
+    }
+
+    //---------------------------------
+    //  Private helper functions
+    //---------------------------------
+
+    function getNativeFlags (regex) {
+        return (regex.global     ? "g" : "") +
+               (regex.ignoreCase ? "i" : "") +
+               (regex.multiline  ? "m" : "") +
+               (regex.extended   ? "x" : "") + // Proposed for ES4; included in AS3
+               (regex.sticky     ? "y" : "");
+    }
+
+    function indexOf (array, item, from) {
+        if (Array.prototype.indexOf) // Use the native array method if available
+            return array.indexOf(item, from);
+        for (var i = from || 0; i < array.length; i++) {
+            if (array[i] === item)
+                return i;
+        }
+        return -1;
+    }
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/lib/useragent.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/lib/useragent.js b/src/fauxton/assets/js/libs/ace/lib/useragent.js
new file mode 100644
index 0000000..b6989a8
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/lib/useragent.js
@@ -0,0 +1,103 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+/*
+ * I hate doing this, but we need some way to determine if the user is on a Mac
+ * The reason is that users have different expectations of their key combinations.
+ *
+ * Take copy as an example, Mac people expect to use CMD or APPLE + C
+ * Windows folks expect to use CTRL + C
+ */
+exports.OS = {
+    LINUX: "LINUX",
+    MAC: "MAC",
+    WINDOWS: "WINDOWS"
+};
+
+/*
+ * Return an exports.OS constant
+ */
+exports.getOS = function() {
+    if (exports.isMac) {
+        return exports.OS.MAC;
+    } else if (exports.isLinux) {
+        return exports.OS.LINUX;
+    } else {
+        return exports.OS.WINDOWS;
+    }
+};
+
+// this can be called in non browser environments (e.g. from ace/requirejs/text)
+if (typeof navigator != "object")
+    return;
+
+var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
+var ua = navigator.userAgent;
+
+// Is the user using a browser that identifies itself as Windows
+exports.isWin = (os == "win");
+
+// Is the user using a browser that identifies itself as Mac OS
+exports.isMac = (os == "mac");
+
+// Is the user using a browser that identifies itself as Linux
+exports.isLinux = (os == "linux");
+
+// Windows Store JavaScript apps (aka Metro apps written in HTML5 and JavaScript) do not use the "Microsoft Internet Explorer" string in their user agent, but "MSAppHost" instead.
+exports.isIE = 
+    (navigator.appName == "Microsoft Internet Explorer" || navigator.appName.indexOf("MSAppHost") >= 0)
+    && parseFloat(navigator.userAgent.match(/MSIE ([0-9]+[\.0-9]+)/)[1]);
+    
+exports.isOldIE = exports.isIE && exports.isIE < 9;
+
+// Is this Firefox or related?
+exports.isGecko = exports.isMozilla = window.controllers && window.navigator.product === "Gecko";
+
+// oldGecko == rev < 2.0 
+exports.isOldGecko = exports.isGecko && parseInt((navigator.userAgent.match(/rv\:(\d+)/)||[])[1], 10) < 4;
+
+// Is this Opera 
+exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]";
+
+// Is the user using a browser that identifies itself as WebKit 
+exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined;
+
+exports.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined;
+
+exports.isAIR = ua.indexOf("AdobeAIR") >= 0;
+
+exports.isIPad = ua.indexOf("iPad") >= 0;
+
+exports.isTouchPad = ua.indexOf("TouchPad") >= 0;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/Readme.md
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/Readme.md b/src/fauxton/assets/js/libs/ace/mode/_test/Readme.md
new file mode 100644
index 0000000..c2871c0
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/Readme.md
@@ -0,0 +1,9 @@
+`tokens_<modeName>.json` files keep information about correct tokens and tokenizer states for all modes supported by ace.
+They are generated from `text_<modeName>.txt` or `demo/kitchen-sink/doc/*` with
+
+```sh
+node highlight_rules_test.js -gen
+```
+
+command.
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/highlight_rules_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/highlight_rules_test.js b/src/fauxton/assets/js/libs/ace/mode/_test/highlight_rules_test.js
new file mode 100644
index 0000000..be6656d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/highlight_rules_test.js
@@ -0,0 +1,152 @@
+var fs = require("fs");
+if (!fs.existsSync)
+    fs.existsSync = require("path").existsSync;
+
+require("amd-loader");
+
+var cwd = __dirname + "/";
+
+function generateTestData() {
+    var root = Array(5).join("../") + "/demo/kitchen-sink/docs";
+    var docs = fs.readdirSync(cwd + root);
+    var specialDocs = fs.readdirSync(cwd);
+    var modes = fs.readdirSync(cwd + "../").filter(function(x){
+        return !/(_highlight_rules|behaviour|worker)\.js$/.test(x) && /\.js$/.test(x);
+    }).map(function(x) {
+        return x.replace(/\.js$/, "");
+    });
+
+    console.log("Docs:", docs);
+    console.log("Modes:", modes);
+
+    docs.forEach(function(docName) {
+        var p = docName.toLowerCase().split(".");
+        if (!p[1])
+            return;
+        var modeName;
+        if (modes.indexOf(p[0]) != -1)
+            modeName = p[0];
+        else if (modes.indexOf(p[1]) != -1)
+            modeName = p[1];
+        else
+            modeName = {"txt": "text", cpp: "c_cpp"}[p[1]];
+
+        var filePath = "text_" + modeName + ".txt";
+        if (specialDocs.indexOf(filePath) == -1) {
+            filePath = root + "/" + docName;
+        }
+
+        var text = fs.readFileSync(cwd + filePath, "utf8");
+        try {
+            var Mode = require("../" + modeName).Mode;
+        } catch(e) {
+            console.warn("Can't load mode :" + modeName, p, e);
+            return;
+        }
+        var tokenizer = new Mode().getTokenizer();
+
+        var state = "start";
+        var data = text.split(/\n|\r|\r\n/).map(function(line) {
+            var data = tokenizer.getLineTokens(line, state);
+            var tmp = [];
+            tmp.push(JSON.stringify(data.state));
+            data.tokens.forEach(function(x) {
+                tmp.push(JSON.stringify([x.type, x.value]));
+            });
+            state = data.state;
+            return tmp.join(",\n  ");
+        });
+        
+        jsonStr = "[[\n   " + data.join("\n],[\n   ") + "\n]]";
+        fs.writeFileSync(cwd + "tokens_" + modeName + ".json", jsonStr, "utf8");
+    });
+}
+
+function test(startAt) {
+    var modes = fs.readdirSync(cwd).map(function(x) {
+        return (x.match(/tokens_(.*).json/) || {})[1];
+    }).filter(function(x){return !!x});
+
+    for (var i = Math.max(0, startAt||0); i < modes.length; i++)
+        testMode(modes[i], i);
+
+    console.log("\u001b[32m" + "all ok" + "\u001b[0m");
+}
+function testMode(modeName, i) {
+    console.log(padNumber(i+1, 3) + ") testing: \u001b[33m" + modeName + "\u001b[0m");
+
+    var text = fs.readFileSync(cwd + "tokens_" + modeName + ".json", "utf8");
+    var data = JSON.parse(text);
+    var Mode = require("../" + modeName).Mode;
+    var tokenizer = new Mode().getTokenizer();
+
+    var state = "start";
+    data.forEach(function(lineData) {
+        lineData.values = [];
+        lineData.types = [];
+        lineData.state = lineData.shift();
+        lineData.forEach(function(x) {
+            lineData.types.push(x[0]);
+            lineData.values.push(x[1]);
+        });
+
+        var line = lineData.values.join("");
+
+        var tokens = tokenizer.getLineTokens(line, state);
+        var values = tokens.tokens.map(function(x) {return x.value;});
+        var types = tokens.tokens.map(function(x) {return x.type;});
+
+        var success = true;
+        var err = testEqual([
+            lineData.state, tokens.state,
+            lineData.types, types,
+            lineData.values, values]);
+        
+        if (err) {
+            console.log(line)
+            throw "error";
+        }
+
+        state = lineData.state;
+    });
+}
+function testEqual(a) {
+    var err;
+    if (a[0] + "" !== a[1] + "") {
+        console.log(a[0],a[1]);
+        err = 1;
+    }
+
+    if ( a[2] + "" !== a[3] + "" || a[4] + "" !== a[5] + "") {
+        arrayDiff(a[2],a[3]);
+        arrayDiff(a[4],a[5]);
+        err = 1;
+    }
+    return err;
+}
+function arrayDiff(a1, a2) {
+    var l = Math.max(a1.length, a2.length);
+    var out = [];
+    for (var i = 0; i < l; i++) {
+        out.push("\n", padNumber(i+1, 3), ") ");
+        if (a1[i] !== a2[i])
+            out.push("\u001b[31m", a1[i], "\u001b[0m != \u001b[32m", a2[i], "\u001b[0m");
+        else
+            out.push(a1[i]);
+    }
+    console.log(out.join(""));
+}
+function padNumber(num, digits) {
+    return ("      " + num).slice(-digits);
+}
+
+// cli
+var arg = process.argv[2];
+if (!arg)
+    test()
+else if (/--?g(en)?/.test(arg))
+    generateTestData(process.argv.splice(3));
+else if (/\d+/.test(arg))
+    test(parseInt(process.argv[2],10) || 0);
+else
+    testMode(arg, -1)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/package.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/package.json b/src/fauxton/assets/js/libs/ace/mode/_test/package.json
new file mode 100644
index 0000000..3fdc706
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/package.json
@@ -0,0 +1,8 @@
+{
+    "name": "ace-mode-creator",
+    "version": "0.1.0",
+    "dependencies": {
+        "connect": "",
+        "socket.io": ""
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/text_asciidoc.txt
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/text_asciidoc.txt b/src/fauxton/assets/js/libs/ace/mode/_test/text_asciidoc.txt
new file mode 100644
index 0000000..af7eaec
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/text_asciidoc.txt
@@ -0,0 +1,111 @@
+------------------------------------
+-----------------------------------
+_ita_lic_, *bo*ld*, +mo+no+, normal. 
+``double quoted'', `single quoted'.
+  normal, ^super^, ~sub~.
+
+''''
+Escaped:
+\_italic_, +++_italic_+++,
+t\__e__st, +++t__e__st+++,
++++<b>bold</b>+++, $$<b>normal</b>$$
+\&#182; &#182;
+\`not single quoted'
+\`\`not double quoted''
+
+
+[fffff]
++++++++++++++++++++++++++++++++++++++
+(C) {ss} ss
++++++++++++++++++++++++++++++++++++++
+
+.............
+callout <1>
+..............
+
+> 1
+1> 2
+<2> 3
+
+Escaped:
+\_italic_,
+t\__e__st, o__
+
+.optional title
+.............
+callout <1>
+..............
+
+
+:macro: dddd
+
+.lists
+. 1
+.. 2
+... d
+..... big
++
+continue +
+next line
+xi) no ++la+tin++
+
+xi) la++tin++
+2. num__ber__  [red]#red#
+--
+  5. f <<x6,ssss>> {macro}
+--
+image::path[beauty] ->--<= -- replacements
+
+ image::s
+sssss
+sss 
+sssss
+
+
+== 1
+  heading
+=== not a heading
+====================================
+
+==================================
+====4 
+NOTE: above
+
+NOTE: above
+
+[[x6]]
+WARNING: 
+
+[options[]]
+---------------------------
+literal
+---------------------------
+
+
+= Tables
+|====================================
+| _italic_ |  *bold* | text | (R)
+
+|====================================
+
+
+[more, options]
+///////////
+comment
+///////////
+// one line comment
+
+
+
+[red]#red text# [yellow-background]#on yellow#
+[big]#large# [red yellow-background big]*all bold*
+
+	
+https://site text <ma...@i.am> callto:ace http://ace.ajaxorg.com[awesome]
+  .still normal text
+.break out thoug should not
+---------------------------
+///////////////////////////
+---------------------------
+
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/text_coffee.txt
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/text_coffee.txt b/src/fauxton/assets/js/libs/ace/mode/_test/text_coffee.txt
new file mode 100644
index 0000000..094e61b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/text_coffee.txt
@@ -0,0 +1,56 @@
+#test: tokenize keyword
+    for (i 1..2)
+#test: tokenize regexp
+/"[a]/
+#test: tokenize functions
+foo = ({args}) ->
+    foo = ({a1, a2}) ->
+    foo = ({@a1, a2}) ->
+    foo : ({args}) ->
+    foo = ({args}) ->
+    foo = ({0abc}) ->
+    foo = ({/abc}) =>
+    foo = ({abc/}) ->
+    foo = ({#abc}) ->
+    foo = ({abc#}) ->
+    foo = ({)abc}) ->
+    foo = ({abc)}) ->
+    foo = ({a{bc}) ->
+    foo = ({}) ->
+    foo = ({ }) ->
+    foo : ({}) ->
+    foo = (args) ->
+    foo = (arg1, arg2) ->
+    foo = (arg1 = 1, arg2 = 'name') ->
+    foo = (@arg1 = /abc/, arg2 = 'name') ->
+    #test: tokenize function: invalid case:
+    foo=(/args) ->
+    foo = () ->
+    foo = ( ) ->
+    foo : ( ) ->
+    window.foo = (args) ->
+    foo = ->
+    foo = ->
+    foo : ->
+    #test: tokenize callback function
+    foo bar: 1, (args) ->
+    foo = (1, 2 (x) ->
+#test: tokenize class
+class Foo
+class Foo extends Bar
+#test: tokenize illegal name property
+foo.static.function
+#!test tokenize string with interpolation
+a = "#{ 22 / 7 + {x: "#{a + b}"} + 2}"
+"""heredoc
+   """
+do ->
+    ###
+    herecomment
+    ###
+    re = /regex/imgy.test ///
+        heregex  # comment
+    ///imgy
+    this isnt: `just 
+       JavaScript`
+    undefined

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/text_curly.txt
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/text_curly.txt b/src/fauxton/assets/js/libs/ace/mode/_test/text_curly.txt
new file mode 100644
index 0000000..1be54b5
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/text_curly.txt
@@ -0,0 +1,9 @@
+tokenize Curly template{{test}}
+tokenize embedded script
+<script a='a'>var</script>'123'
+tokenize multiline attribute value with double quotes
+<a href="abc{{xyz}}
+def">
+tokenize multiline attribute value with single quotes
+<a href='abc
+def\"'>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/text_html.txt
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/text_html.txt b/src/fauxton/assets/js/libs/ace/mode/_test/text_html.txt
new file mode 100644
index 0000000..64a32cb
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/text_html.txt
@@ -0,0 +1,8 @@
+<html>
+<script a='a'>var</script>'123'
+<a href="abc
+  def">
+<a href='abc
+def\'>
+
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/text_javascript.txt
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/text_javascript.txt b/src/fauxton/assets/js/libs/ace/mode/_test/text_javascript.txt
new file mode 100644
index 0000000..6e18079
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/text_javascript.txt
@@ -0,0 +1,86 @@
+//test: tokenize 'standard' functions
+string.charCodeAt(23); document.getElementById('test'); console.log('Here it is');";
+test: /**tokenize doc*/ comment
+/**tokenize doc comment with @tag {}*/
+//test: tokenize parens
+    var line = "[{( )}]";
+//test tokenize arithmetic expression which looks like a regexp
+a/b/c
+a/=b/c
+//test tokenize reg exps
+a=/b/g
+a+/b/g
+a = 1 + /2 + 1/b
+a=/a/ / /a/
+case /a/.test(c)
+//test tokenize multi-line comment containing a single line comment
+noRegex
+/* foo // bar */
+canBeRegex;
+/* foo // bar */
+// test tokenize identifier with umlauts
+fu?e
+// test // is not a regexp
+{ // 123
+//test skipping escaped chars
+'Meh\\nNeh'
+console.log('\\u1232Feh'
+"test multiline\
+ strings"
+a='
+b="\
+still a string
+ 
+ 
+function foo(items, nada) {
+    for (var i=0; i<items.length; i++) {
+        alert(items[i] + "juhu\n");
+    }	// Real Tab.
+}
+
+regexp = /p|p/ // ends here
+
+r = /d{1,2}?f{e}++r*?\d+?[]r[^r-o\f\f[\f]?r{7}+r\{7}+rr--rr$^(?:d|s)(?=a|)(?!y)[]|$?|^*/ o
+a=/a/ jk = / / / / /
+ /************************************/
+/** total mess, tricky to highlight**/
+
+function () {
+	/**
+	 * docComment
+	 **/
+	r = /u\t*/
+	g = 1.00E^1, y = 1.2 + .2 + 052 + 0x25
+	t = ['d', '']
+}
+function () {
+	/* eee */
+}
+
+"s\
+s\u7824sss\u1"
+
+'\
+string'
+
+'
+string'
+
+"trailing space\   
+"         "    /not a regexp/g
+
+/**
+ *doc
+ */
+
+a = {
+	'a': b,
+	'g': function(t)
+	gta:function(a,b)
+}
+
+
+foo.protoype.d = function(a, b,
+                          c, d)
+foo.d =function(a,     b)
+foo.d =function(a,  /*****/ d"string"   

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/text_livescript.txt
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/text_livescript.txt b/src/fauxton/assets/js/libs/ace/mode/_test/text_livescript.txt
new file mode 100644
index 0000000..308ec1d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/text_livescript.txt
@@ -0,0 +1 @@
+# comment

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/text_lucene.txt
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/text_lucene.txt b/src/fauxton/assets/js/libs/ace/mode/_test/text_lucene.txt
new file mode 100644
index 0000000..c71f268
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/text_lucene.txt
@@ -0,0 +1,16 @@
+test: recognises AND as keyword
+test: recognises OR as keyword
+test: recognises NOT as keyword
+test: recognises "hello this is dog" as string
+test: recognises -"hello this is dog" as negation with string
+test: recognises ~100 as text with proximity
+test: recognises "hello this is dog"~100 as string with proximity
+test: recognises raw:"hello this is dog" as keyword
+test: recognises raw:foo as"keyword'
+test: recognises "(" as opening parenthesis
+test: recognises ")" as closing parenthesis
+test: recognises foo* as text with asterisk
+test: recognises foo? as text with interro
+test: recognises single word as text
+ foo
+ 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/text_markdown.txt
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/text_markdown.txt b/src/fauxton/assets/js/libs/ace/mode/_test/text_markdown.txt
new file mode 100644
index 0000000..0450c82
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/text_markdown.txt
@@ -0,0 +1,22 @@
+test: header 1 
+#f
+test: header 2
+## foo
+test: header ends with ' #'
+# # # 
+test: header ends with '#'
+#foo# 
+test: 6+ #s is not a valid header
+####### foo
+test: # followed be only space is not a valid header
+# 
+test: only space between #s is not a valid header
+#  #
+
+# test links  [Cloud9 IDE](http://www.c9.io/) #
+* [demo](http://ajaxorg.github.com/ace/) [+](escape(\) ) [+](a "title") [+](a "space" )
+* usually *work* fine (_em_)
+in lists
+
+in plain text <b>http://ace.ajaxorg.com<b>
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/text_ruby.txt
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/text_ruby.txt b/src/fauxton/assets/js/libs/ace/mode/_test/text_ruby.txt
new file mode 100644
index 0000000..1343a27
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/text_ruby.txt
@@ -0,0 +1,34 @@
+ #test: symbol tokenizer
+  [:@thing, :$thing, :_thing, :thing, :Thing, :thing1, :thing_a,
+              :THING, :thing!, :thing=, :thing?, :t?,
+              :, :@, :$, :1, :1thing, :th?ing, :thi=ng, :1thing,
+            :th!ing, :thing#
+    ]
+
+ #test: namespaces aren't symbols" : function() {
+   Namespaced::Class
+ #test: hex tokenizer 
+    0x9a, 0XA1, 0x9_a, 0x, 0x_9a, 0x9a_,
+ #test: float tokenizer
+    [1, +1, -1, 12_345, 0.000_1,
+    _, 3_1, 1_2, 1_.0, 0._1];
+ 
+{:id => 34, :key => "value"}
+
+=begin
+=end
+
+=begin x
+=end-
+=end   x
+
+    herDocs = [<<'FOO', <<BAR, <<-BAZ, <<-`EXEC`] #comment
+  FOO #{literal}
+FOO
+  BAR #{fact(10)}
+BAR
+  BAZ indented
+    BAZ
+        echo hi
+    EXEC
+puts herDocs
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/text_xml.txt
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/text_xml.txt b/src/fauxton/assets/js/libs/ace/mode/_test/text_xml.txt
new file mode 100644
index 0000000..01f7b8a
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/text_xml.txt
@@ -0,0 +1,7 @@
+<Juhu>//Juhu Kinners</Kinners>
+test: two tags in the same lines should be in separate tokens"
+<Juhu><Kinners>
+test: multiline attributes"
+<copy set="{
+}" undo="{
+}"/>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_abap.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_abap.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_abap.json
new file mode 100644
index 0000000..95f2f81
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_abap.json
@@ -0,0 +1,189 @@
+[[
+   "start",
+  ["doc.comment","***************************************"]
+],[
+   "start",
+  ["doc.comment","** Program: EXAMPLE                  **"]
+],[
+   "start",
+  ["doc.comment","** Author: Joe Byte, 07-Jul-2007     **"]
+],[
+   "start",
+  ["doc.comment","***************************************"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["keyword","REPORT"],
+  ["text"," BOOKINGS"],
+  ["keyword.operator","."]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["doc.comment","* Read flight bookings from the database"]
+],[
+   "start",
+  ["keyword","SELECT"],
+  ["keyword.operator"," * "],
+  ["keyword","FROM"],
+  ["text"," FLIGHTINFO"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","WHERE"],
+  ["text"," "],
+  ["keyword","CLASS"],
+  ["keyword.operator"," = "],
+  ["string","'Y'"],
+  ["text","       "],
+  ["comment","\"Y = economy"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","OR"],
+  ["text","    "],
+  ["keyword","CLASS"],
+  ["keyword.operator"," = "],
+  ["string","'C'"],
+  ["keyword.operator","."],
+  ["text","      "],
+  ["comment","\"C = business"]
+],[
+   "start",
+  ["paren.lparen","("],
+  ["invalid","..."],
+  ["paren.rparen",")"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","REPORT"],
+  ["text"," TEST"],
+  ["keyword.operator","."]
+],[
+   "start",
+  ["keyword","WRITE"],
+  ["text"," "],
+  ["string","'Hello World'"],
+  ["keyword.operator","."]
+],[
+   "start"
+],[
+   "start",
+  ["text","USERPROMPT"],
+  ["keyword.operator"," = "],
+  ["string","'Please double-click on a line in the output list '"],
+  ["text"," "],
+  ["keyword.operator","&"]
+],[
+   "start",
+  ["text","             "],
+  ["string","'to see the complete details of the transaction.'"],
+  ["keyword.operator","."]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["keyword","DATA"],
+  ["text"," LAST_EOM    "],
+  ["keyword","TYPE"],
+  ["text"," "],
+  ["support.type","D"],
+  ["keyword.operator","."],
+  ["text","  "],
+  ["comment","\"last end-of-month date"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["doc.comment","* Start from today's date"]
+],[
+   "start",
+  ["text","  LAST_EOM"],
+  ["keyword.operator"," = "],
+  ["variable.parameter","SY"],
+  ["keyword.operator","-"],
+  ["text","DATUM"],
+  ["keyword.operator","."]
+],[
+   "start",
+  ["doc.comment","* Set characters 6 and 7 (0-relative) of the YYYYMMDD string to \"01\","]
+],[
+   "start",
+  ["doc.comment","* giving the first day of the current month"]
+],[
+   "start",
+  ["text","  LAST_EOM"],
+  ["constant.numeric","+6"],
+  ["paren.lparen","("],
+  ["constant.numeric","2"],
+  ["paren.rparen",")"],
+  ["keyword.operator"," = "],
+  ["string","'01'"],
+  ["keyword.operator","."]
+],[
+   "start",
+  ["doc.comment","* Subtract one day"]
+],[
+   "start",
+  ["text","  LAST_EOM"],
+  ["keyword.operator"," = "],
+  ["text","LAST_EOM"],
+  ["keyword.operator"," - "],
+  ["constant.numeric","1"],
+  ["keyword.operator","."]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","WRITE"],
+  ["keyword.operator",":"],
+  ["text"," "],
+  ["string","'Last day of previous month was'"],
+  ["keyword.operator",","],
+  ["text"," LAST_EOM"],
+  ["keyword.operator","."]
+],[
+   "start",
+  ["text","  "]
+],[
+   "start",
+  ["keyword","DATA"],
+  ["text"," "],
+  ["keyword.operator",":"],
+  ["text"," "],
+  ["keyword","BEGIN OF"],
+  ["text"," I_VBRK "],
+  ["keyword","OCCURS"],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["keyword.operator",","]
+],[
+   "start",
+  ["text","         VBELN "],
+  ["keyword","LIKE"],
+  ["text"," "],
+  ["variable.parameter","VBRK-VBELN"],
+  ["keyword.operator",","]
+],[
+   "start",
+  ["text","         ZUONR "],
+  ["keyword","LIKE"],
+  ["text"," "],
+  ["variable.parameter","VBRK-ZUONR"],
+  ["keyword.operator",","]
+],[
+   "start",
+  ["text","       "],
+  ["keyword","END OF"],
+  ["text"," I_VBRK"],
+  ["keyword.operator","."]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_actionscript.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_actionscript.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_actionscript.json
new file mode 100644
index 0000000..e3fad38
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_actionscript.json
@@ -0,0 +1,263 @@
+[[
+   "start",
+  ["text","package code"]
+],[
+   "start",
+  ["text","{"]
+],[
+   "punctuation.definition.comment.actionscript.2",
+  ["text","    "],
+  ["punctuation.definition.comment.actionscript.2","/*"],
+  ["comment.block.actionscript.2","****************************************"]
+],[
+   "punctuation.definition.comment.actionscript.2",
+  ["comment.block.actionscript.2","\t * based on textmate actionscript bundle"]
+],[
+   "start",
+  ["comment.block.actionscript.2","\t ***************************************"],
+  ["punctuation.definition.comment.actionscript.2","*/"]
+],[
+   "start",
+  ["text","\t "]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword.control.actionscript.2","import"],
+  ["text"," fl.events.SliderEvent;"]
+],[
+   "start",
+  ["text","\t"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword.control.actionscript.2","public"],
+  ["text"," "],
+  ["storage.type.class.actionscript.2","class"],
+  ["meta.class.actionscript.2"," "],
+  ["entity.name.type.class.actionscript.2","Foo"],
+  ["meta.class.actionscript.2"," "],
+  ["storage.modifier.extends.actionscript.2","extends"],
+  ["meta.class.actionscript.2"," "],
+  ["entity.other.inherited-class.actionscript.2","MovieClip"]
+],[
+   "start",
+  ["text","\t{"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["punctuation.definition.comment.actionscript.2","//*************************"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["punctuation.definition.comment.actionscript.2","// Properties:"]
+],[
+   "start",
+  ["text","\t\t"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["keyword.control.actionscript.2","public"],
+  ["text"," "],
+  ["keyword.control.actionscript.2","var"],
+  ["text"," activeSwatch"],
+  ["keyword.operator.symbolic.actionscript.2",":"],
+  ["support.class.actionscript.2","MovieClip"],
+  ["text",";"]
+],[
+   "start",
+  ["text","\t\t"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["punctuation.definition.comment.actionscript.2","// Color offsets"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["keyword.control.actionscript.2","public"],
+  ["text"," "],
+  ["keyword.control.actionscript.2","var"],
+  ["text"," c1"],
+  ["keyword.operator.symbolic.actionscript.2",":"],
+  ["storage.type.actionscript.2","Number"],
+  ["text"," "],
+  ["keyword.operator.symbolic.actionscript.2","="],
+  ["text"," "],
+  ["constant.numeric.actionscript.2","0"],
+  ["text",";\t"],
+  ["punctuation.definition.comment.actionscript.2","// R"]
+],[
+   "start",
+  ["text","\t\t"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["punctuation.definition.comment.actionscript.2","//*************************"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["punctuation.definition.comment.actionscript.2","// Constructor:"]
+],[
+   "start",
+  ["text","\t\t"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["keyword.control.actionscript.2","public"],
+  ["text"," "],
+  ["storage.type.function.actionscript.2","function"],
+  ["meta.function.actionscript.2"," "],
+  ["entity.name.function.actionscript.2","Foo"],
+  ["punctuation.definition.parameters.begin.actionscript.2","("],
+  ["punctuation.definition.parameters.end.actionscript.2",")"]
+],[
+   "start",
+  ["text","\t\t{"]
+],[
+   "start",
+  ["text","\t\t\t"],
+  ["punctuation.definition.comment.actionscript.2","// Respond to mouse events"]
+],[
+   "start",
+  ["text","\t\t\tswatch1_btn."],
+  ["support.function.actionscript.2","addEventListener"],
+  ["text","(MouseEvent.CLICK,swatchHandler,"],
+  ["constant.language.actionscript.2","false"],
+  ["text",","],
+  ["constant.numeric.actionscript.2","0"],
+  ["text",","],
+  ["constant.language.actionscript.2","false"],
+  ["text",");"]
+],[
+   "start",
+  ["text","\t\t\tpreviewBox_btn."],
+  ["support.function.actionscript.2","addEventListener"],
+  ["text","(MouseEvent.MOUSE_DOWN,dragPressHandler);"]
+],[
+   "start",
+  ["text","\t\t\t"]
+],[
+   "start",
+  ["text","\t\t\t"],
+  ["punctuation.definition.comment.actionscript.2","// Respond to drag events"]
+],[
+   "start",
+  ["text","\t\t\tred_slider."],
+  ["support.function.actionscript.2","addEventListener"],
+  ["text","(SliderEvent.THUMB_DRAG,sliderHandler);"]
+],[
+   "start",
+  ["text","\t\t\t"]
+],[
+   "start",
+  ["text","\t\t\t"],
+  ["punctuation.definition.comment.actionscript.2","// Draw a frame later"]
+],[
+   "start",
+  ["text","\t\t\t"],
+  ["support.function.actionscript.2","addEventListener"],
+  ["text","(Event.ENTER_FRAME,"],
+  ["support.function.actionscript.2","draw"],
+  ["text",");"]
+],[
+   "start",
+  ["text","\t\t}"]
+],[
+   "start",
+  ["text","        "]
+],[
+   "start",
+  ["text","\t\tprotected "],
+  ["storage.type.function.actionscript.2","function"],
+  ["meta.function.actionscript.2"," "],
+  ["entity.name.function.actionscript.2","clickHandler"],
+  ["punctuation.definition.parameters.begin.actionscript.2","("],
+  ["variable.parameter.function.actionscript.2","event:MouseEvent"],
+  ["punctuation.definition.parameters.end.actionscript.2",")"],
+  ["keyword.operator.symbolic.actionscript.2",":"],
+  ["support.function.actionscript.2","void"]
+],[
+   "start",
+  ["text","\t\t{"]
+],[
+   "start",
+  ["text","\t\t\tcar.transform.colorTransform "],
+  ["keyword.operator.symbolic.actionscript.2","="],
+  ["text"," "],
+  ["keyword.control.actionscript.2","new"],
+  ["text"," ColorTransform("],
+  ["constant.numeric.actionscript.2","0"],
+  ["text",","],
+  ["constant.numeric.actionscript.2","0"],
+  ["text",","],
+  ["constant.numeric.actionscript.2","0"],
+  ["text",","],
+  ["constant.numeric.actionscript.2","1"],
+  ["text",",c1,c2,c3);"]
+],[
+   "start",
+  ["text","\t\t}"]
+],[
+   "start",
+  ["text","\t\t"]
+],[
+   "start",
+  ["text","\t\tprotected "],
+  ["storage.type.function.actionscript.2","function"],
+  ["meta.function.actionscript.2"," "],
+  ["entity.name.function.actionscript.2","changeRGBHandler"],
+  ["punctuation.definition.parameters.begin.actionscript.2","("],
+  ["variable.parameter.function.actionscript.2","event:Event"],
+  ["punctuation.definition.parameters.end.actionscript.2",")"],
+  ["keyword.operator.symbolic.actionscript.2",":"],
+  ["support.function.actionscript.2","void"]
+],[
+   "start",
+  ["text","\t\t{"]
+],[
+   "start",
+  ["text","\t\t\tc1 "],
+  ["keyword.operator.symbolic.actionscript.2","="],
+  ["text"," "],
+  ["storage.type.actionscript.2","Number"],
+  ["text","(c1_txt."],
+  ["support.function.actionscript.2","text"],
+  ["text",");"]
+],[
+   "start",
+  ["text","            "]
+],[
+   "start",
+  ["text","\t\t\t"],
+  ["keyword.control.actionscript.2","if"],
+  ["text","("],
+  ["keyword.operator.symbolic.actionscript.2","!"],
+  ["text","(c1>"],
+  ["keyword.operator.symbolic.actionscript.2","="],
+  ["constant.numeric.actionscript.2","0"],
+  ["text",")){"]
+],[
+   "start",
+  ["text","\t\t\t\tc1 "],
+  ["keyword.operator.symbolic.actionscript.2","="],
+  ["text"," "],
+  ["constant.numeric.actionscript.2","0"],
+  ["text",";"]
+],[
+   "start",
+  ["text","\t\t\t}\t\t\t"]
+],[
+   "start",
+  ["text","\t\t\t"]
+],[
+   "start",
+  ["text","\t\t\tupdateSliders();"]
+],[
+   "start",
+  ["text","\t\t}"]
+],[
+   "start",
+  ["text","\t}"]
+],[
+   "start",
+  ["text","}"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_asciidoc.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_asciidoc.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_asciidoc.json
new file mode 100644
index 0000000..f54c355
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_asciidoc.json
@@ -0,0 +1,422 @@
+[[
+   "literalBlock",
+  ["support.function","------------------------------------"]
+],[
+   "dissallowDelimitedBlock",
+  ["support.function","-----------------------------------"]
+],[
+   "text",
+  ["string.italic","_ita_lic_"],
+  ["text",", "],
+  ["keyword.bold","*bo*ld*"],
+  ["text",", "],
+  ["support.function","+mo+no+"],
+  ["text",", normal. "]
+],[
+   "text",
+  ["keyword","``"],
+  ["text","double quoted"],
+  ["keyword","''"],
+  ["text",", `single quoted'."]
+],[
+   "text",
+  ["text","  normal, ^super^, "],
+  ["keyword","~sub~"],
+  ["text","."]
+],[
+   "start"
+],[
+   "text",
+  ["text","''''"]
+],[
+   "text",
+  ["text","Escaped:"]
+],[
+   "text",
+  ["constant.language.escape","\\_"],
+  ["text","italic_, "],
+  ["support.function","+++"],
+  ["text","_italic_"],
+  ["support.function","+++"],
+  ["text",","]
+],[
+   "smallPassthrough",
+  ["text","t"],
+  ["constant.language.escape","\\_"],
+  ["text","_e"],
+  ["string.italic","__st, +++t__"],
+  ["text","e__st"],
+  ["support.function","+++"],
+  ["text",","]
+],[
+   "smallPassthrough",
+  ["support.function","+++"],
+  ["text","<b>bold</b>"],
+  ["support.function","+++"],
+  ["text",", $$<"],
+  ["support.function","b"],
+  ["text",">"],
+  ["support.function","normal"],
+  ["text","</"],
+  ["support.function","b"],
+  ["text",">$$"]
+],[
+   "smallPassthrough",
+  ["text","\\&#"],
+  ["support.function","182"],
+  ["text","; &#"],
+  ["support.function","182"],
+  ["text",";"]
+],[
+   "smallPassthrough",
+  ["text","\\`"],
+  ["support.function","not"],
+  ["text"," "],
+  ["support.function","single"],
+  ["text"," "],
+  ["support.function","quoted"],
+  ["text","'"]
+],[
+   "smallPassthrough",
+  ["text","\\`\\`"],
+  ["support.function","not"],
+  ["text"," "],
+  ["support.function","double"],
+  ["text"," "],
+  ["support.function","quoted"],
+  ["text","''"]
+],[
+   "dissallowDelimitedBlock"
+],[
+   "text"
+],[
+   "start",
+  ["string.regexp","[fffff]"]
+],[
+   "passthroughBlock",
+  ["string","+++++++++++++++++++++++++++++++++++++"]
+],[
+   "passthroughBlock",
+  ["support.function","(C) "],
+  ["constant.character","{ss}"],
+  ["support.function"," ss"]
+],[
+   "dissallowDelimitedBlock",
+  ["support.function","+++++++++++++++++++++++++++++++++++++"]
+],[
+   "text"
+],[
+   "listingBlock",
+  ["support.function","............."]
+],[
+   "listingBlock",
+  ["support.function","callout "],
+  ["constant.numeric","<1>"]
+],[
+   "dissallowDelimitedBlock",
+  ["support.function",".............."]
+],[
+   "text"
+],[
+   "text",
+  ["text","> 1"]
+],[
+   "text",
+  ["text","1> 2"]
+],[
+   "text",
+  ["text","<2> 3"]
+],[
+   "start"
+],[
+   "text",
+  ["text","Escaped:"]
+],[
+   "text",
+  ["constant.language.escape","\\_"],
+  ["text","italic_,"]
+],[
+   "text",
+  ["text","t"],
+  ["constant.language.escape","\\_"],
+  ["text","_e"],
+  ["string.italic","__st, o__"]
+],[
+   "start"
+],[
+   "start",
+  ["constant.numeric",".optional title"]
+],[
+   "listingBlock",
+  ["support.function","............."]
+],[
+   "listingBlock",
+  ["support.function","callout "],
+  ["constant.numeric","<1>"]
+],[
+   "dissallowDelimitedBlock",
+  ["support.function",".............."]
+],[
+   "text"
+],[
+   "start"
+],[
+   "text",
+  ["keyword",":macro:"],
+  ["text"," dddd"]
+],[
+   "start"
+],[
+   "start",
+  ["constant.numeric",".lists"]
+],[
+   "listText",
+  ["keyword",". "],
+  ["text","1"]
+],[
+   "listText",
+  ["keyword",".. "],
+  ["text","2"]
+],[
+   "listText",
+  ["keyword","... "],
+  ["text","d"]
+],[
+   "listText",
+  ["keyword","..... "],
+  ["text","big"]
+],[
+   "start",
+  ["keyword","+"]
+],[
+   "text",
+  ["text","continue"],
+  ["keyword"," +"]
+],[
+   "text",
+  ["text","next line"]
+],[
+   "text",
+  ["text","xi) no "],
+  ["support.function","++la+tin++"]
+],[
+   "start"
+],[
+   "listText",
+  ["keyword","xi) "],
+  ["text","la"],
+  ["support.function","++tin++"]
+],[
+   "listText",
+  ["keyword","2. "],
+  ["text","num"],
+  ["string.italic","__ber__"],
+  ["text","  [red]"],
+  ["keyword","#"],
+  ["text","red"],
+  ["keyword","#"]
+],[
+   "start",
+  ["keyword","--"]
+],[
+   "listText",
+  ["keyword","  5. "],
+  ["text","f "],
+  ["keyword","<<x6,"],
+  ["string","ssss"],
+  ["keyword",">>"],
+  ["text"," "],
+  ["constant.character","{macro}"]
+],[
+   "start",
+  ["keyword","--"]
+],[
+   "text",
+  ["markup.list.macro","image::"],
+  ["keyword","path"],
+  ["string","[beauty]"],
+  ["text"," "],
+  ["constant.language.escape","->"],
+  ["text","--"],
+  ["constant.language.escape","<= --"],
+  ["text"," replacements"]
+],[
+   "start"
+],[
+   "indentedBlock",
+  ["support.function"," image::s"]
+],[
+   "indentedBlock",
+  ["support.function","sssss"]
+],[
+   "indentedBlock",
+  ["support.function","sss "]
+],[
+   "indentedBlock",
+  ["support.function","sssss"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["markup.heading","== 1"]
+],[
+   "indentedBlock",
+  ["support.function","  heading"]
+],[
+   "start",
+  ["markup.heading","=== not a heading"]
+],[
+   "start",
+  ["keyword","===================================="]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","=================================="]
+],[
+   "text",
+  ["text","====4 "]
+],[
+   "text",
+  ["text","NOTE: above"]
+],[
+   "start"
+],[
+   "text",
+  ["keyword","NOTE:"],
+  ["text"," above"]
+],[
+   "start"
+],[
+   "start",
+  ["string.regexp","[[x6]]"]
+],[
+   "text",
+  ["keyword","WARNING:"],
+  ["text"," "]
+],[
+   "start"
+],[
+   "start",
+  ["string.regexp","[options[]]"]
+],[
+   "literalBlock",
+  ["support.function","---------------------------"]
+],[
+   "literalBlock",
+  ["support.function","literal"]
+],[
+   "dissallowDelimitedBlock",
+  ["support.function","---------------------------"]
+],[
+   "text"
+],[
+   "start"
+],[
+   "start",
+  ["markup.heading","= Tables"]
+],[
+   "tableBlock",
+  ["doc.comment","|===================================="]
+],[
+   "tableBlock",
+  ["doc.comment","|"],
+  ["text"," "],
+  ["string.italic","_italic_"],
+  ["text"," "],
+  ["doc.comment","|"],
+  ["text","  "],
+  ["keyword.bold","*bold*"],
+  ["text"," "],
+  ["doc.comment","|"],
+  ["text"," text "],
+  ["doc.comment","|"],
+  ["text"," "],
+  ["constant.language.escape","(R)"]
+],[
+   "tableBlock"
+],[
+   "dissallowDelimitedBlock",
+  ["doc.comment","|===================================="]
+],[
+   "text"
+],[
+   "start"
+],[
+   "start",
+  ["string.regexp","[more, options]"]
+],[
+   "commentBlock",
+  ["doc.comment","///////////"]
+],[
+   "commentBlock",
+  ["doc.comment","comment"]
+],[
+   "dissallowDelimitedBlock",
+  ["doc.comment","///////////"]
+],[
+   "text",
+  ["comment","// one line comment"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start"
+],[
+   "text",
+  ["text","[red]"],
+  ["keyword","#"],
+  ["text","red text"],
+  ["keyword","#"],
+  ["text"," [yellow-background]"],
+  ["keyword","#"],
+  ["text","on yellow"],
+  ["keyword","#"]
+],[
+   "text",
+  ["text","[big]"],
+  ["keyword","#"],
+  ["text","large"],
+  ["keyword","#"],
+  ["text"," [red yellow-background big]"],
+  ["keyword.bold","*all bold*"]
+],[
+   "start"
+],[
+   "start",
+  ["text","\t"]
+],[
+   "text",
+  ["markup.underline.list","https://site"],
+  ["text"," text <"],
+  ["markup.underline.list","mail@i.am"],
+  ["text","> "],
+  ["markup.underline.list","callto:ace"],
+  ["text"," "],
+  ["link","http://ace.ajaxorg.com"],
+  ["variable.language","[awesome]"]
+],[
+   "text",
+  ["text","  .still normal text"]
+],[
+   "start",
+  ["constant.numeric",".break out thoug should not"]
+],[
+   "literalBlock",
+  ["support.function","---------------------------"]
+],[
+   "literalBlock",
+  ["support.function","///////////////////////////"]
+],[
+   "dissallowDelimitedBlock",
+  ["support.function","---------------------------"]
+],[
+   "text"
+],[
+   "start"
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_assembly_x86.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_assembly_x86.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_assembly_x86.json
new file mode 100644
index 0000000..5da0470
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_assembly_x86.json
@@ -0,0 +1,114 @@
+[[
+   "start",
+  ["support.function.directive.assembly","section"],
+  ["text","\t.text"]
+],[
+   "start",
+  ["text","    "],
+  ["support.function.directive.assembly","global"],
+  ["text"," "],
+  ["entity.name.function.assembly","main"],
+  ["text","         "],
+  ["comment.assembly",";must be declared for using gcc"]
+],[
+   "start"
+],[
+   "start",
+  ["entity.name.function.assembly","main:"],
+  ["text","\t                "],
+  ["comment.assembly",";tell linker entry point"]
+],[
+   "start"
+],[
+   "start",
+  ["text","\t"],
+  ["keyword.control.assembly","mov"],
+  ["text","\t"],
+  ["variable.parameter.register.assembly","edx"],
+  ["text",", len\t    "],
+  ["comment.assembly",";message length"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword.control.assembly","mov"],
+  ["text","\t"],
+  ["variable.parameter.register.assembly","ecx"],
+  ["text",", msg\t    "],
+  ["comment.assembly",";message to write"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword.control.assembly","mov"],
+  ["text","\t"],
+  ["variable.parameter.register.assembly","ebx"],
+  ["text",", "],
+  ["constant.character.decimal.assembly","1"],
+  ["text","\t        "],
+  ["comment.assembly",";file descriptor (stdout)"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword.control.assembly","mov"],
+  ["text","\t"],
+  ["variable.parameter.register.assembly","eax"],
+  ["text",", "],
+  ["constant.character.decimal.assembly","4"],
+  ["text","\t        "],
+  ["comment.assembly",";system call number (sys_write)"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword.control.assembly","int"],
+  ["text","\t"],
+  ["constant.character.hexadecimal.assembly","0x80"],
+  ["text","\t        "],
+  ["comment.assembly",";call kernel"]
+],[
+   "start"
+],[
+   "start",
+  ["text","\t"],
+  ["keyword.control.assembly","mov"],
+  ["text","\t"],
+  ["variable.parameter.register.assembly","eax"],
+  ["text",", "],
+  ["constant.character.decimal.assembly","1"],
+  ["text","\t        "],
+  ["comment.assembly",";system call number (sys_exit)"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword.control.assembly","int"],
+  ["text","\t"],
+  ["constant.character.hexadecimal.assembly","0x80"],
+  ["text","\t        "],
+  ["comment.assembly",";call kernel"]
+],[
+   "start"
+],[
+   "start",
+  ["support.function.directive.assembly","section"],
+  ["text","\t.data"]
+],[
+   "start"
+],[
+   "start",
+  ["entity.name.function.assembly","msg"],
+  ["text","\t"],
+  ["support.function.directive.assembly","db"],
+  ["text","\t"],
+  ["string.assembly","'Hello, world!'"],
+  ["text",","],
+  ["constant.character.hexadecimal.assembly","0xa"],
+  ["text","\t"],
+  ["comment.assembly",";our dear string"]
+],[
+   "start",
+  ["entity.name.function.assembly","len"],
+  ["text","\t"],
+  ["support.function.directive.assembly","equ"],
+  ["text","\t$ - msg\t\t\t"],
+  ["comment.assembly",";length of our dear string"]
+],[
+   "start"
+]]
\ No newline at end of file


[44/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/editor_highlight_selected_word_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/editor_highlight_selected_word_test.js b/src/fauxton/assets/js/libs/ace/editor_highlight_selected_word_test.js
new file mode 100644
index 0000000..13e19c2
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/editor_highlight_selected_word_test.js
@@ -0,0 +1,223 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+    require("./test/mockdom");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("./edit_session").EditSession;
+var Editor = require("./editor").Editor;
+var MockRenderer = require("./test/mockrenderer").MockRenderer;
+var assert = require("./test/assertions");
+
+var lipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " +
+             "Mauris at arcu mi, eu lobortis mauris. Quisque ut libero eget " +
+             "diam congue vehicula. Quisque ut odio ut mi aliquam tincidunt. " +
+             "Duis lacinia aliquam lorem eget eleifend. Morbi eget felis mi. " +
+             "Duis quam ligula, consequat vitae convallis volutpat, blandit " +
+             "nec neque. Nulla facilisi. Etiam suscipit lorem ac justo " +
+             "sollicitudin tristique. Phasellus ut posuere nunc. Aliquam " +
+             "scelerisque mollis felis non gravida. Vestibulum lacus sem, " +
+             "posuere non bibendum id, luctus non dolor. Aenean id metus " +
+             "lorem, vel dapibus est. Donec gravida feugiat augue nec " +
+             "accumsan.Lorem ipsum dolor sit amet, consectetur adipiscing " +
+             "elit. Nulla vulputate, velit vitae tincidunt congue, nunc " +
+             "augue accumsan velit, eu consequat turpis lectus ac orci. " +
+             "Pellentesque ornare dolor feugiat dui auctor eu varius nulla " +
+             "fermentum. Sed aliquam odio at velit lacinia vel fermentum " +
+             "felis sodales. In dignissim magna eget nunc lobortis non " +
+             "fringilla nibh ullamcorper. Donec facilisis malesuada elit " +
+             "at egestas. Etiam bibendum, diam vitae tempor aliquet, dui " +
+             "libero vehicula odio, eget bibendum mauris velit eu lorem.\n" +
+             "consectetur";
+
+function callHighlighterUpdate(session, firstRow, lastRow) {
+    var rangeCount = 0;
+    var  mockMarkerLayer = { drawSingleLineMarker: function() {rangeCount++;} }
+    session.$searchHighlight.update([], mockMarkerLayer, session, {
+        firstRow: firstRow,
+        lastRow: lastRow
+    });
+    return rangeCount;
+}
+
+module.exports = {
+    setUp: function(next) {
+        this.session = new EditSession(lipsum);
+        this.editor = new Editor(new MockRenderer(), this.session);
+        this.selection = this.session.getSelection();
+        this.search = this.editor.$search;
+        next();
+    },
+
+    "test: highlight selected words by default": function() {
+        assert.equal(this.editor.getHighlightSelectedWord(), true);
+    },
+
+    "test: highlight a word": function() {
+        this.editor.moveCursorTo(0, 9);
+        this.selection.selectWord();
+
+        var highlighter = this.editor.session.$searchHighlight;
+        assert.ok(highlighter != null);
+
+        var range = this.selection.getRange();
+        assert.equal(this.session.getTextRange(range), "ipsum");
+        assert.equal(highlighter.cache.length, 0);
+        assert.equal(callHighlighterUpdate(this.session, 0, 0), 2);
+    },
+
+    "test: highlight a word and clear highlight": function() {
+        this.editor.moveCursorTo(0, 8);
+        this.selection.selectWord();
+
+        var range = this.selection.getRange();
+        assert.equal(this.session.getTextRange(range), "ipsum");
+        assert.equal(callHighlighterUpdate(this.session, 0, 0), 2);
+
+        this.session.highlight("");
+        assert.equal(this.session.$searchHighlight.cache.length, 0);
+        assert.equal(callHighlighterUpdate(this.session, 0, 0), 0);
+    },
+
+    "test: highlight another word": function() {
+        this.selection.moveCursorTo(0, 14);
+        this.selection.selectWord();
+
+        var range = this.selection.getRange();
+        assert.equal(this.session.getTextRange(range), "dolor");
+        assert.equal(callHighlighterUpdate(this.session, 0, 0), 4);
+    },
+
+    "test: no selection, no highlight": function() {
+        this.selection.clearSelection();
+        assert.equal(callHighlighterUpdate(this.session, 0, 0), 0);
+    },
+
+    "test: select a word, no highlight": function() {
+        this.selection.moveCursorTo(0, 14);
+        this.selection.selectWord();
+
+        this.editor.setHighlightSelectedWord(false);
+
+        var range = this.selection.getRange();
+        assert.equal(this.session.getTextRange(range), "dolor");
+        assert.equal(callHighlighterUpdate(this.session, 0, 0), 0);
+    },
+
+    "test: select a word with no matches": function() {
+        this.editor.setHighlightSelectedWord(true);
+
+        var currentOptions = this.search.getOptions();
+        var newOptions = {
+            wrap: true,
+            wholeWord: true,
+            caseSensitive: true,
+            needle: "Mauris"
+        };
+        this.search.set(newOptions);
+
+        var match = this.search.find(this.session);
+        assert.notEqual(match, null, "found a match for 'Mauris'");
+
+        this.search.set(currentOptions);
+
+        this.selection.setSelectionRange(match);
+
+        assert.equal(this.session.getTextRange(match), "Mauris");
+        assert.equal(callHighlighterUpdate(this.session, 0, 0), 1);
+    },
+
+    "test: partial word selection 1": function() {
+        this.selection.moveCursorTo(0, 14);
+        this.selection.selectWord();
+        this.selection.selectLeft();
+
+        var range = this.selection.getRange();
+        assert.equal(this.session.getTextRange(range), "dolo");
+        assert.equal(callHighlighterUpdate(this.session, 0, 0), 0);
+    },
+
+    "test: partial word selection 2": function() {
+        this.selection.moveCursorTo(0, 13);
+        this.selection.selectWord();
+        this.selection.selectRight();
+
+        var range = this.selection.getRange();
+        assert.equal(this.session.getTextRange(range), "dolor ");
+        assert.equal(callHighlighterUpdate(this.session, 0, 0), 0);
+    },
+
+    "test: partial word selection 3": function() {
+        this.selection.moveCursorTo(0, 14);
+        this.selection.selectWord();
+        this.selection.selectLeft();
+        this.selection.shiftSelection(1);
+
+        var range = this.selection.getRange();
+        assert.equal(this.session.getTextRange(range), "olor");
+        assert.equal(callHighlighterUpdate(this.session, 0, 0), 0);
+    },
+
+    "test: select last word": function() {
+        this.selection.moveCursorTo(0, 1);
+
+        var currentOptions = this.search.getOptions();
+        var newOptions = {
+            wrap: true,
+            wholeWord: true,
+            caseSensitive: true,
+            backwards: true,
+            needle: "consectetur"
+        };
+        this.search.set(newOptions);
+
+        var match = this.search.find(this.session);
+        assert.notEqual(match, null, "found a match for 'consectetur'");
+        assert.position(match.start, 1, 0);
+
+        this.search.set(currentOptions);
+
+        this.selection.setSelectionRange(match);
+
+        assert.equal(this.session.getTextRange(match), "consectetur");
+        assert.equal(callHighlighterUpdate(this.session, 0, 1), 3);
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec();
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/editor_navigation_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/editor_navigation_test.js b/src/fauxton/assets/js/libs/ace/editor_navigation_test.js
new file mode 100644
index 0000000..ab34824
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/editor_navigation_test.js
@@ -0,0 +1,164 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+    require("./test/mockdom");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("./edit_session").EditSession;
+var Editor = require("./editor").Editor;
+var MockRenderer = require("./test/mockrenderer").MockRenderer;
+var assert = require("./test/assertions");
+
+module.exports = {
+    createEditSession : function(rows, cols) {
+        var line = new Array(cols + 1).join("a");
+        var text = new Array(rows).join(line + "\n") + line;
+        return new EditSession(text);
+    },
+
+    "test: navigate to end of file should scroll the last line into view" : function() {
+        var doc = this.createEditSession(200, 10);
+        var editor = new Editor(new MockRenderer(), doc);
+
+        editor.navigateFileEnd();
+        var cursor = editor.getCursorPosition();
+
+        assert.ok(editor.getFirstVisibleRow() <= cursor.row);
+        assert.ok(editor.getLastVisibleRow() >= cursor.row);
+    },
+
+    "test: navigate to start of file should scroll the first row into view" : function() {
+        var doc = this.createEditSession(200, 10);
+        var editor = new Editor(new MockRenderer(), doc);
+
+        editor.moveCursorTo(editor.getLastVisibleRow() + 20);
+        editor.navigateFileStart();
+
+        assert.equal(editor.getFirstVisibleRow(), 0);
+    },
+
+    "test: goto hidden line should scroll the line into the middle of the viewport" : function() {
+        var editor = new Editor(new MockRenderer(), this.createEditSession(200, 5));
+
+        editor.navigateTo(0, 0);
+        editor.gotoLine(101);
+        assert.position(editor.getCursorPosition(), 100, 0);
+        assert.equal(editor.getFirstVisibleRow(), 89);
+
+        editor.navigateTo(100, 0);
+        editor.gotoLine(11);
+        assert.position(editor.getCursorPosition(), 10, 0);
+        assert.equal(editor.getFirstVisibleRow(), 0);
+
+        editor.navigateTo(100, 0);
+        editor.gotoLine(6);
+        assert.position(editor.getCursorPosition(), 5, 0);
+        assert.equal(0, editor.getFirstVisibleRow(), 0);
+
+        editor.navigateTo(100, 0);
+        editor.gotoLine(1);
+        assert.position(editor.getCursorPosition(), 0, 0);
+        assert.equal(editor.getFirstVisibleRow(), 0);
+
+        editor.navigateTo(0, 0);
+        editor.gotoLine(191);
+        assert.position(editor.getCursorPosition(), 190, 0);
+        assert.equal(editor.getFirstVisibleRow(), 179);
+
+        editor.navigateTo(0, 0);
+        editor.gotoLine(196);
+        assert.position(editor.getCursorPosition(), 195, 0);
+        assert.equal(editor.getFirstVisibleRow(), 180);
+    },
+
+    "test: goto visible line should only move the cursor and not scroll": function() {
+        var editor = new Editor(new MockRenderer(), this.createEditSession(200, 5));
+
+        editor.navigateTo(0, 0);
+        editor.gotoLine(12);
+        assert.position(editor.getCursorPosition(), 11, 0);
+        assert.equal(editor.getFirstVisibleRow(), 0);
+
+        editor.navigateTo(30, 0);
+        editor.gotoLine(33);
+        assert.position(editor.getCursorPosition(), 32, 0);
+        assert.equal(editor.getFirstVisibleRow(), 30);
+    },
+
+    "test: navigate from the end of a long line down to a short line and back should maintain the curser column": function() {
+        var editor = new Editor(new MockRenderer(), new EditSession(["123456", "1"]));
+
+        editor.navigateTo(0, 6);
+        assert.position(editor.getCursorPosition(), 0, 6);
+
+        editor.navigateDown();
+        assert.position(editor.getCursorPosition(), 1, 1);
+
+        editor.navigateUp();
+        assert.position(editor.getCursorPosition(), 0, 6);
+    },
+
+    "test: reset desired column on navigate left or right": function() {
+        var editor = new Editor(new MockRenderer(), new EditSession(["123456", "12"]));
+
+        editor.navigateTo(0, 6);
+        assert.position(editor.getCursorPosition(), 0, 6);
+
+        editor.navigateDown();
+        assert.position(editor.getCursorPosition(), 1, 2);
+
+        editor.navigateLeft();
+        assert.position(editor.getCursorPosition(), 1, 1);
+
+        editor.navigateUp();
+        assert.position(editor.getCursorPosition(), 0, 1);
+    },
+    
+    "test: typing text should update the desired column": function() {
+        var editor = new Editor(new MockRenderer(), new EditSession(["1234", "1234567890"]));
+
+        editor.navigateTo(0, 3);
+        editor.insert("juhu");
+        
+        editor.navigateDown();
+        assert.position(editor.getCursorPosition(), 1, 7);
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/editor_text_edit_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/editor_text_edit_test.js b/src/fauxton/assets/js/libs/ace/editor_text_edit_test.js
new file mode 100644
index 0000000..77ec34e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/editor_text_edit_test.js
@@ -0,0 +1,557 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+    require("./test/mockdom");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("./edit_session").EditSession;
+var Editor = require("./editor").Editor;
+var JavaScriptMode = require("./mode/javascript").Mode;
+var UndoManager = require("./undomanager").UndoManager;
+var MockRenderer = require("./test/mockrenderer").MockRenderer;
+var assert = require("./test/assertions");
+var whitespace = require("./ext/whitespace");
+
+module.exports = {
+    "test: delete line from the middle" : function() {
+        var session = new EditSession(["a", "b", "c", "d"].join("\n"));
+        var editor = new Editor(new MockRenderer(), session);
+
+        editor.moveCursorTo(1, 1);
+        editor.removeLines();
+
+        assert.equal(session.toString(), "a\nc\nd");
+        assert.position(editor.getCursorPosition(), 1, 0);
+
+        editor.removeLines();
+
+        assert.equal(session.toString(), "a\nd");
+        assert.position(editor.getCursorPosition(), 1, 0);
+
+        editor.removeLines();
+
+        assert.equal(session.toString(), "a");
+        assert.position(editor.getCursorPosition(), 0, 1);
+
+        editor.removeLines();
+
+        assert.equal(session.toString(), "");
+        assert.position(editor.getCursorPosition(), 0, 0);
+    },
+
+    "test: delete multiple selected lines" : function() {
+        var session = new EditSession(["a", "b", "c", "d"].join("\n"));
+        var editor = new Editor(new MockRenderer(), session);
+
+        editor.moveCursorTo(1, 1);
+        editor.getSelection().selectDown();
+
+        editor.removeLines();
+        assert.equal(session.toString(), "a\nd");
+        assert.position(editor.getCursorPosition(), 1, 0);
+    },
+
+    "test: delete first line" : function() {
+        var session = new EditSession(["a", "b", "c"].join("\n"));
+        var editor = new Editor(new MockRenderer(), session);
+
+        editor.removeLines();
+
+        assert.equal(session.toString(), "b\nc");
+        assert.position(editor.getCursorPosition(), 0, 0);
+    },
+
+    "test: delete last should also delete the new line of the previous line" : function() {
+        var session = new EditSession(["a", "b", "c", ""].join("\n"));
+        var editor = new Editor(new MockRenderer(), session);
+
+        editor.moveCursorTo(3, 0);
+
+        editor.removeLines();
+        assert.equal(session.toString(), "a\nb\nc");
+        assert.position(editor.getCursorPosition(), 2, 1);
+
+        editor.removeLines();
+        assert.equal(session.toString(), "a\nb");
+        assert.position(editor.getCursorPosition(), 1, 1);
+    },
+
+    "test: indent block" : function() {
+        var session = new EditSession(["a12345", "b12345", "c12345"].join("\n"));
+        var editor = new Editor(new MockRenderer(), session);
+
+        editor.moveCursorTo(1, 3);
+        editor.getSelection().selectDown();
+
+        editor.indent();
+
+        assert.equal(["a12345", "    b12345", "    c12345"].join("\n"), session.toString());
+
+        assert.position(editor.getCursorPosition(), 2, 7);
+
+        var range = editor.getSelectionRange();
+        assert.position(range.start, 1, 7);
+        assert.position(range.end, 2, 7);
+    },
+
+    "test: indent selected lines" : function() {
+        var session = new EditSession(["a12345", "b12345", "c12345"].join("\n"));
+        var editor = new Editor(new MockRenderer(), session);
+
+        editor.moveCursorTo(1, 0);
+        editor.getSelection().selectDown();
+
+        editor.indent();
+        assert.equal(["a12345", "    b12345", "c12345"].join("\n"), session.toString());
+    },
+
+    "test: no auto indent if cursor is before the {" : function() {
+        var session = new EditSession("{", new JavaScriptMode());
+        var editor = new Editor(new MockRenderer(), session);
+
+        editor.moveCursorTo(0, 0);
+        editor.onTextInput("\n");
+        assert.equal(["", "{"].join("\n"), session.toString());
+    },
+    
+    "test: outdent block" : function() {
+        var session = new EditSession(["        a12345", "    b12345", "        c12345"].join("\n"));
+        var editor = new Editor(new MockRenderer(), session);
+
+        editor.moveCursorTo(0, 5);
+        editor.getSelection().selectDown();
+        editor.getSelection().selectDown();
+
+        editor.blockOutdent();
+        assert.equal(session.toString(), ["    a12345", "b12345", "    c12345"].join("\n"));
+
+        assert.position(editor.getCursorPosition(), 2, 1);
+
+        var range = editor.getSelectionRange();
+        assert.position(range.start, 0, 1);
+        assert.position(range.end, 2, 1);
+
+        editor.blockOutdent();
+        assert.equal(session.toString(), ["a12345", "b12345", "c12345"].join("\n"));
+
+        var range = editor.getSelectionRange();
+        assert.position(range.start, 0, 0);
+        assert.position(range.end, 2, 0);
+    },
+
+    "test: outent without a selection should update cursor" : function() {
+        var session = new EditSession("        12");
+        var editor = new Editor(new MockRenderer(), session);
+
+        editor.moveCursorTo(0, 3);
+        editor.blockOutdent("  ");
+
+        assert.equal(session.toString(), "    12");
+        assert.position(editor.getCursorPosition(), 0, 0);
+    },
+
+    "test: comment lines should perserve selection" : function() {
+        var session = new EditSession(["  abc", "cde"].join("\n"), new JavaScriptMode());
+        var editor = new Editor(new MockRenderer(), session);
+        whitespace.detectIndentation(session);
+        
+        editor.moveCursorTo(0, 2);
+        editor.getSelection().selectDown();
+        editor.toggleCommentLines();
+
+        assert.equal(["//   abc", "// cde"].join("\n"), session.toString());
+
+        var selection = editor.getSelectionRange();
+        assert.position(selection.start, 0, 5);
+        assert.position(selection.end, 1, 5);
+    },
+
+    "test: uncomment lines should perserve selection" : function() {
+        var session = new EditSession(["//   abc", "//cde"].join("\n"), new JavaScriptMode());
+        var editor = new Editor(new MockRenderer(), session);
+        session.setTabSize(2);
+
+        editor.moveCursorTo(0, 1);
+        editor.getSelection().selectDown();
+        editor.getSelection().selectRight();
+        editor.getSelection().selectRight();
+
+        editor.toggleCommentLines();
+
+        assert.equal(["  abc", "cde"].join("\n"), session.toString());
+        assert.range(editor.getSelectionRange(), 0, 0, 1, 1);
+    },
+
+    "test: toggle comment lines twice should return the original text" : function() {
+        var session = new EditSession(["  abc", "cde", "fg"], new JavaScriptMode());
+        var editor = new Editor(new MockRenderer(), session);
+
+        editor.moveCursorTo(0, 0);
+        editor.getSelection().selectDown();
+        editor.getSelection().selectDown();
+
+        editor.toggleCommentLines();
+        editor.toggleCommentLines();
+
+        assert.equal(["  abc", "cde", "fg"].join("\n"), session.toString());
+    },
+
+
+    "test: comment lines - if the selection end is at the line start it should stay there": function() {
+        //select down
+        var session = new EditSession(["abc", "cde"].join("\n"), new JavaScriptMode());
+        var editor = new Editor(new MockRenderer(), session);
+
+        editor.moveCursorTo(0, 0);
+        editor.getSelection().selectDown();
+
+        editor.toggleCommentLines();
+        assert.range(editor.getSelectionRange(), 0, 3, 1, 0);
+
+        // select up
+        var session = new EditSession(["abc", "cde"].join("\n"), new JavaScriptMode());
+        var editor = new Editor(new MockRenderer(), session);
+
+        editor.moveCursorTo(1, 0);
+        editor.getSelection().selectUp();
+
+        editor.toggleCommentLines();
+        assert.range(editor.getSelectionRange(), 0, 3, 1, 0);
+    },
+
+    "test: move lines down should keep selection on moved lines" : function() {
+        var session = new EditSession(["11", "22", "33", "44"].join("\n"));
+        var editor = new Editor(new MockRenderer(), session);
+
+        editor.moveCursorTo(0, 1);
+        editor.getSelection().selectDown();
+
+        editor.moveLinesDown();
+        assert.equal(["33", "11", "22", "44"].join("\n"), session.toString());
+        assert.position(editor.getCursorPosition(), 2, 1);
+        assert.position(editor.getSelection().getSelectionAnchor(), 1, 1);
+        assert.position(editor.getSelection().getSelectionLead(), 2, 1);
+
+        editor.moveLinesDown();
+        assert.equal(["33", "44", "11", "22"].join("\n"), session.toString());
+        assert.position(editor.getCursorPosition(), 3, 1);
+        assert.position(editor.getSelection().getSelectionAnchor(), 2, 1);
+        assert.position(editor.getSelection().getSelectionLead(), 3, 1);
+
+        // moving again should have no effect
+        editor.moveLinesDown();
+        assert.equal(["33", "44", "11", "22"].join("\n"), session.toString());
+        assert.position(editor.getCursorPosition(), 3, 1);
+        assert.position(editor.getSelection().getSelectionAnchor(), 2, 1);
+        assert.position(editor.getSelection().getSelectionLead(), 3, 1);
+    },
+
+    "test: move lines up should keep selection on moved lines" : function() {
+        var session = new EditSession(["11", "22", "33", "44"].join("\n"));
+        var editor = new Editor(new MockRenderer(), session);
+
+        editor.moveCursorTo(2, 1);
+        editor.getSelection().selectDown();
+
+        editor.moveLinesUp();
+        assert.equal(session.toString(), ["11", "33", "44", "22"].join("\n"));
+        assert.position(editor.getCursorPosition(), 2, 1);
+        assert.position(editor.getSelection().getSelectionAnchor(), 1, 1);
+        assert.position(editor.getSelection().getSelectionLead(), 2, 1);
+
+        editor.moveLinesUp();
+        assert.equal(session.toString(), ["33", "44", "11", "22"].join("\n"));
+        assert.position(editor.getCursorPosition(), 1, 1);
+        assert.position(editor.getSelection().getSelectionAnchor(), 0, 1);
+        assert.position(editor.getSelection().getSelectionLead(), 1, 1);
+    },
+
+    "test: move line without active selection should not move cursor relative to the moved line" : function() {
+        var session = new EditSession(["11", "22", "33", "44"].join("\n"));
+        var editor = new Editor(new MockRenderer(), session);
+
+        editor.moveCursorTo(1, 1);
+        editor.clearSelection();
+
+        editor.moveLinesDown();
+        assert.equal(["11", "33", "22", "44"].join("\n"), session.toString());
+        assert.position(editor.getCursorPosition(), 2, 1);
+
+        editor.clearSelection();
+
+        editor.moveLinesUp();
+        assert.equal(["11", "22", "33", "44"].join("\n"), session.toString());
+        assert.position(editor.getCursorPosition(), 1, 1);
+    },
+
+    "test: copy lines down should keep selection" : function() {
+        var session = new EditSession(["11", "22", "33", "44"].join("\n"));
+        var editor = new Editor(new MockRenderer(), session);
+
+        editor.moveCursorTo(1, 1);
+        editor.getSelection().selectDown();
+
+        editor.copyLinesDown();
+        assert.equal(["11", "22", "33", "22", "33", "44"].join("\n"), session.toString());
+
+        assert.position(editor.getCursorPosition(), 4, 1);
+        assert.position(editor.getSelection().getSelectionAnchor(), 3, 1);
+        assert.position(editor.getSelection().getSelectionLead(), 4, 1);
+    },
+
+    "test: copy lines up should keep selection" : function() {
+        var session = new EditSession(["11", "22", "33", "44"].join("\n"));
+        var editor = new Editor(new MockRenderer(), session);
+
+        editor.moveCursorTo(1, 1);
+        editor.getSelection().selectDown();
+
+        editor.copyLinesUp();
+        assert.equal(["11", "22", "33", "22", "33", "44"].join("\n"), session.toString());
+
+        assert.position(editor.getCursorPosition(), 2, 1);
+        assert.position(editor.getSelection().getSelectionAnchor(), 1, 1);
+        assert.position(editor.getSelection().getSelectionLead(), 2, 1);
+    },
+
+    "test: input a tab with soft tab should convert it to spaces" : function() {
+        var session = new EditSession("");
+        var editor = new Editor(new MockRenderer(), session);
+
+        session.setTabSize(2);
+        session.setUseSoftTabs(true);
+
+        editor.onTextInput("\t");
+        assert.equal(session.toString(), "  ");
+
+        session.setTabSize(5);
+        editor.onTextInput("\t");
+        assert.equal(session.toString(), "       ");
+    },
+
+    "test: input tab without soft tabs should keep the tab character" : function() {
+        var session = new EditSession("");
+        var editor = new Editor(new MockRenderer(), session);
+
+        session.setUseSoftTabs(false);
+
+        editor.onTextInput("\t");
+        assert.equal(session.toString(), "\t");
+    },
+
+    "test: undo/redo for delete line" : function() {
+        var session = new EditSession(["111", "222", "333"]);
+        var undoManager = new UndoManager();
+        session.setUndoManager(undoManager);
+
+        var initialText = session.toString();
+        var editor = new Editor(new MockRenderer(), session);
+
+        editor.removeLines();
+        var step1 = session.toString();
+        assert.equal(step1, "222\n333");
+        session.$syncInformUndoManager();
+
+        editor.removeLines();
+        var step2 = session.toString();
+        assert.equal(step2, "333");
+        session.$syncInformUndoManager();
+
+        editor.removeLines();
+        var step3 = session.toString();
+        assert.equal(step3, "");
+        session.$syncInformUndoManager();
+
+        undoManager.undo();
+        session.$syncInformUndoManager();
+        assert.equal(session.toString(), step2);
+
+        undoManager.undo();
+        session.$syncInformUndoManager();
+        assert.equal(session.toString(), step1);
+
+        undoManager.undo();
+        session.$syncInformUndoManager();
+        assert.equal(session.toString(), initialText);
+
+        undoManager.undo();
+        session.$syncInformUndoManager();
+        assert.equal(session.toString(), initialText);
+    },
+
+    "test: remove left should remove character left of the cursor" : function() {
+        var session = new EditSession(["123", "456"]);
+
+        var editor = new Editor(new MockRenderer(), session);
+        editor.moveCursorTo(1, 1);
+        editor.remove("left");
+        assert.equal(session.toString(), "123\n56");
+    },
+
+    "test: remove left should remove line break if cursor is at line start" : function() {
+        var session = new EditSession(["123", "456"]);
+
+        var editor = new Editor(new MockRenderer(), session);
+        editor.moveCursorTo(1, 0);
+        editor.remove("left");
+        assert.equal(session.toString(), "123456");
+    },
+
+    "test: remove left should remove tabsize spaces if cursor is on a tab stop and preceeded by spaces" : function() {
+        var session = new EditSession(["123", "        456"]);
+        session.setUseSoftTabs(true);
+        session.setTabSize(4);
+
+        var editor = new Editor(new MockRenderer(), session);
+        editor.moveCursorTo(1, 8);
+        editor.remove("left");
+        assert.equal(session.toString(), "123\n    456");
+    },
+    
+    "test: transpose at line start should be a noop": function() {
+        var session = new EditSession(["123", "4567", "89"]);
+        
+        var editor = new Editor(new MockRenderer(), session);
+        editor.moveCursorTo(1, 0);
+        editor.transposeLetters();
+        
+        assert.equal(session.getValue(), ["123", "4567", "89"].join("\n"));
+    },
+    
+    "test: transpose in line should swap the charaters before and after the cursor": function() {
+        var session = new EditSession(["123", "4567", "89"]);
+        
+        var editor = new Editor(new MockRenderer(), session);
+        editor.moveCursorTo(1, 2);
+        editor.transposeLetters();
+        
+        assert.equal(session.getValue(), ["123", "4657", "89"].join("\n"));
+    },
+    
+    "test: transpose at line end should swap the last two characters": function() {
+        var session = new EditSession(["123", "4567", "89"]);
+        
+        var editor = new Editor(new MockRenderer(), session);
+        editor.moveCursorTo(1, 4);
+        editor.transposeLetters();
+        
+        assert.equal(session.getValue(), ["123", "4576", "89"].join("\n"));
+    },
+    
+    "test: transpose with non empty selection should be a noop": function() {
+        var session = new EditSession(["123", "4567", "89"]);
+        
+        var editor = new Editor(new MockRenderer(), session);
+        editor.moveCursorTo(1, 1);
+        editor.getSelection().selectRight();
+        editor.transposeLetters();
+        
+        assert.equal(session.getValue(), ["123", "4567", "89"].join("\n"));
+    },
+    
+    "test: transpose should move the cursor behind the last swapped character": function() {
+        var session = new EditSession(["123", "4567", "89"]);
+        
+        var editor = new Editor(new MockRenderer(), session);
+        editor.moveCursorTo(1, 2);
+        editor.transposeLetters();
+        assert.position(editor.getCursorPosition(), 1, 3);
+    },
+    
+    "test: remove to line end": function() {
+        var session = new EditSession(["123", "4567", "89"]);
+        
+        var editor = new Editor(new MockRenderer(), session);
+        editor.moveCursorTo(1, 2);
+        editor.removeToLineEnd();
+        assert.equal(session.getValue(), ["123", "45", "89"].join("\n"));
+    },
+    
+    "test: remove to line end at line end should remove the new line": function() {
+        var session = new EditSession(["123", "4567", "89"]);
+        
+        var editor = new Editor(new MockRenderer(), session);
+        editor.moveCursorTo(1, 4);
+        editor.removeToLineEnd();
+        assert.position(editor.getCursorPosition(), 1, 4);
+        assert.equal(session.getValue(), ["123", "456789"].join("\n"));
+    },
+
+    "test: transform selection to uppercase": function() {
+        var session = new EditSession(["ajax", "dot", "org"]);
+
+        var editor = new Editor(new MockRenderer(), session);
+        editor.moveCursorTo(1, 0);
+        editor.getSelection().selectLineEnd();
+        editor.toUpperCase()
+        assert.equal(session.getValue(), ["ajax", "DOT", "org"].join("\n"));
+    },
+
+    "test: transform word to uppercase": function() {
+        var session = new EditSession(["ajax", "dot", "org"]);
+
+        var editor = new Editor(new MockRenderer(), session);
+        editor.moveCursorTo(1, 0);
+        editor.toUpperCase()
+        assert.equal(session.getValue(), ["ajax", "DOT", "org"].join("\n"));
+        assert.position(editor.getCursorPosition(), 1, 0);
+    },
+
+    "test: transform selection to lowercase": function() {
+        var session = new EditSession(["AJAX", "DOT", "ORG"]);
+
+        var editor = new Editor(new MockRenderer(), session);
+        editor.moveCursorTo(1, 0);
+        editor.getSelection().selectLineEnd();
+        editor.toLowerCase()
+        assert.equal(session.getValue(), ["AJAX", "dot", "ORG"].join("\n"));
+    },
+
+    "test: transform word to lowercase": function() {
+        var session = new EditSession(["AJAX", "DOT", "ORG"]);
+
+        var editor = new Editor(new MockRenderer(), session);
+        editor.moveCursorTo(1, 0);
+        editor.toLowerCase()
+        assert.equal(session.getValue(), ["AJAX", "dot", "ORG"].join("\n"));
+        assert.position(editor.getCursorPosition(), 1, 0);
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/chromevox.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/chromevox.js b/src/fauxton/assets/js/libs/ace/ext/chromevox.js
new file mode 100644
index 0000000..9f7a799
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/chromevox.js
@@ -0,0 +1,980 @@
+define(function(require, exports, module) {
+
+/* ChromeVox Ace namespace. */
+var cvoxAce = {};
+
+/* Typedefs for Closure compiler. */
+/**
+ * @typedef {{
+    rate: number,
+    pitch: number,
+    volume: number,
+    relativePitch: number,
+    punctuationEcho: string
+   }}
+ */
+/* TODO(peterxiao): Export this typedef through cvox.Api. */
+cvoxAce.SpeechProperty;
+
+/**
+ * @typedef {{
+ *   row: number,
+ *   column: number
+ * }}
+ */
+cvoxAce.Cursor;
+
+/**
+ * @typedef {{
+    type: string,
+    value: string
+   }}
+ }
+ */
+cvoxAce.Token;
+
+/**
+ * These are errors and information that Ace will display in the gutter.
+ * @typedef {{
+    row: number,
+    column: number,
+    value: string
+   }}
+ }
+ */
+cvoxAce.Annotation;
+
+/* Speech Properties. */
+/**
+ * Speech property for speaking constant tokens.
+ * @type {cvoxAce.SpeechProperty}
+ */
+var CONSTANT_PROP = {
+  'rate': 0.8,
+  'pitch': 0.4,
+  'volume': 0.9
+};
+
+/**
+ * Default speech property for speaking tokens.
+ * @type {cvoxAce.SpeechProperty}
+ */
+var DEFAULT_PROP = {
+  'rate': 1,
+  'pitch': 0.5,
+  'volume': 0.9
+};
+
+/**
+ * Speech property for speaking entity tokens.
+ * @type {cvoxAce.SpeechProperty}
+ */
+var ENTITY_PROP = {
+  'rate': 0.8,
+  'pitch': 0.8,
+  'volume': 0.9
+};
+
+/**
+ * Speech property for speaking keywords.
+ * @type {cvoxAce.SpeechProperty}
+ */
+var KEYWORD_PROP = {
+  'rate': 0.8,
+  'pitch': 0.3,
+  'volume': 0.9
+};
+
+/**
+ * Speech property for speaking storage tokens.
+ * @type {cvoxAce.SpeechProperty}
+ */
+var STORAGE_PROP = {
+  'rate': 0.8,
+  'pitch': 0.7,
+  'volume': 0.9
+};
+
+/**
+ * Speech property for speaking variable tokens.
+ * @type {cvoxAce.SpeechProperty}
+ */
+var VARIABLE_PROP = {
+  'rate': 0.8,
+  'pitch': 0.8,
+  'volume': 0.9
+};
+
+/**
+ * Speech property for speaking deleted text.
+ * @type {cvoxAce.SpeechProperty}
+ */
+var DELETED_PROP = {
+  'punctuationEcho': 'none',
+  'relativePitch': -0.6
+};
+
+/* Constants for Earcons. */
+var ERROR_EARCON = 'ALERT_NONMODAL';
+var MODE_SWITCH_EARCON = 'ALERT_MODAL';
+var NO_MATCH_EARCON = 'INVALID_KEYPRESS';
+
+/* Constants for vim state. */
+var INSERT_MODE_STATE = 'insertMode';
+var COMMAND_MODE_STATE = 'start';
+
+var REPLACE_LIST = [
+  {
+    substr: ';',
+    newSubstr: ' semicolon '
+  },
+  {
+    substr: ':',
+    newSubstr: ' colon '
+  }
+];
+
+/**
+ * Context menu commands.
+ */
+var Command = {
+  SPEAK_ANNOT: 'annots',
+  SPEAK_ALL_ANNOTS: 'all_annots',
+  TOGGLE_LOCATION: 'toggle_location',
+  SPEAK_MODE: 'mode',
+  SPEAK_ROW_COL: 'row_col',
+  TOGGLE_DISPLACEMENT: 'toggle_displacement',
+  FOCUS_TEXT: 'focus_text'
+};
+
+/**
+ * Key prefix for each shortcut.
+ */
+var KEY_PREFIX = 'CONTROL + SHIFT ';
+
+/* Globals. */
+cvoxAce.editor = null;
+/**
+ * Last cursor position.
+ * @type {cvoxAce.Cursor}
+ */
+var lastCursor = null;
+
+/**
+ * Table of annotations.
+ * @typedef {!Object.<number, Object<number, cvoxAce.Annotation>>}
+ */
+var annotTable = {};
+
+/**
+ * Whether to speak character, word, and then line. This allows blind users
+ * to know the location of the cursor when they change lines.
+ * @typedef {boolean}
+ */
+var shouldSpeakRowLocation = false;
+
+/**
+ * Whether to speak displacement.
+ * @typedef {boolean}
+ */
+var shouldSpeakDisplacement = false;
+
+/**
+ * Whether text was changed to cause a cursor change event.
+ * @typedef {boolean}
+ */
+var changed = false;
+
+/**
+ * Current state vim is in.
+ */
+var vimState = null;
+
+/**
+ * Mapping from key code to shortcut.
+ */
+var keyCodeToShortcutMap = {};
+
+/**
+ * Mapping from command to shortcut.
+ */
+var cmdToShortcutMap = {};
+
+/**
+ * Get shortcut string from keyCode.
+ * @param {number} keyCode Key code of shortcut.
+ * @return {string} String representation of shortcut.
+ */
+var getKeyShortcutString = function(keyCode) {
+  return KEY_PREFIX + String.fromCharCode(keyCode);
+};
+
+/**
+ * Return if in vim mode.
+ * @return {boolean} True if in Vim mode.
+ */
+var isVimMode = function() {
+  var keyboardHandler = cvoxAce.editor.keyBinding.getKeyboardHandler();
+  return keyboardHandler.$id === 'ace/keyboard/vim';
+};
+
+/**
+ * Gets the current token.
+ * @param {!cvoxAce.Cursor} cursor Current position of the cursor.
+ * @return {!cvoxAce.Token} Token at the current position.
+ */
+var getCurrentToken = function(cursor) {
+  return cvoxAce.editor.getSession().getTokenAt(cursor.row, cursor.column + 1);
+};
+
+/**
+ * Gets the current line the cursor is under.
+ * @param {!cvoxAce.Cursor} cursor Current cursor position.
+ */
+var getCurrentLine = function(cursor) {
+  return cvoxAce.editor.getSession().getLine(cursor.row);
+};
+
+/**
+ * Event handler for row changes. When the user changes rows we want to speak
+ * the line so the user can work on this line. If shouldSpeakRowLocation is on
+ * then we speak the character, then the row, then the line so the user knows
+ * where the cursor is.
+ * @param {!cvoxAce.Cursor} currCursor Current cursor position.
+ */
+var onRowChange = function(currCursor) {
+  /* Notify that this line has an annotation. */
+  if (annotTable[currCursor.row]) {
+    cvox.Api.playEarcon(ERROR_EARCON);
+  }
+  if (shouldSpeakRowLocation) {
+    cvox.Api.stop();
+    speakChar(currCursor);
+    speakTokenQueue(getCurrentToken(currCursor));
+    speakLine(currCursor.row, 1);
+  } else {
+    speakLine(currCursor.row, 0);
+  }
+};
+
+/**
+ * Returns whether the cursor is at the beginning of a word. A word is
+ * a grouping of alphanumeric characters including underscores.
+ * @param {!cvoxAce.Cursor} cursor Current cursor position.
+ * @return {boolean} Whether there is word.
+ */
+var isWord = function(cursor) {
+  var line = getCurrentLine(cursor);
+  var lineSuffix = line.substr(cursor.column - 1);
+  if (cursor.column === 0) {
+    lineSuffix = ' ' + line;
+  }
+  /* Use regex to tell if the suffix is at the start of a new word. */
+  var firstWordRegExp = /^\W(\w+)/;
+  var words = firstWordRegExp.exec(lineSuffix);
+  return words !== null;
+};
+
+/**
+ * A mapping of syntax type to speech properties / expanding rules.
+ */
+var rules = {
+  'constant': {
+    prop: CONSTANT_PROP
+  },
+  'entity': {
+    prop: ENTITY_PROP
+  },
+  'keyword': {
+    prop: KEYWORD_PROP
+  },
+  'storage': {
+    prop: STORAGE_PROP
+  },
+  'variable': {
+    prop: VARIABLE_PROP
+  },
+  'meta': {
+    prop: DEFAULT_PROP,
+    replace: [
+      {
+        substr: '</',
+        newSubstr: ' closing tag '
+      },
+      {
+        substr: '/>',
+        newSubstr: ' close tag '
+      },
+      {
+        substr: '<',
+        newSubstr: ' tag start '
+      },
+      {
+        substr: '>',
+        newSubstr: ' tag end '
+      }
+    ]
+  }
+};
+
+/**
+ * Default rule to be used.
+ */
+var DEFAULT_RULE = {
+  prop: DEFAULT_RULE
+};
+
+/**
+ * Expands substrings to how they are read based on the given rules.
+ * @param {string} value Text to be expanded.
+ * @param {Array.<Object>} replaceRules Rules to determine expansion.
+ * @return {string} New expanded value.
+ */
+var expand = function(value, replaceRules) {
+  var newValue = value;
+  for (var i = 0; i < replaceRules.length; i++) {
+    var replaceRule = replaceRules[i];
+    var regexp = new RegExp(replaceRule.substr, 'g');
+    newValue = newValue.replace(regexp, replaceRule.newSubstr);
+  }
+  return newValue;
+};
+
+/**
+ * Merges tokens from start inclusive to end exclusive.
+ * @param {Array.<cvoxAce.Token>} Tokens to be merged.
+ * @param {number} start Start index inclusive.
+ * @param {number} end End index exclusive.
+ * @return {cvoxAce.Token} Merged token.
+ */
+var mergeTokens = function(tokens, start, end) {
+  /* Different type of token found! Merge all previous like tokens. */
+  var newToken = {};
+  newToken.value = '';
+  newToken.type = tokens[start].type;
+  for (var j = start; j < end; j++) {
+    newToken.value += tokens[j].value;
+  }
+  return newToken;
+};
+
+/**
+ * Merges tokens that use the same speech properties.
+ * @param {Array.<cvoxAce.Token>} tokens Tokens to be merged.
+ * @return {Array.<cvoxAce.Token>} Merged tokens.
+ */
+var mergeLikeTokens = function(tokens) {
+  if (tokens.length <= 1) {
+    return tokens;
+  }
+  var newTokens = [];
+  var lastLikeIndex = 0;
+  for (var i = 1; i < tokens.length; i++) {
+    var lastLikeToken = tokens[lastLikeIndex];
+    var currToken = tokens[i];
+    if (getTokenRule(lastLikeToken) !== getTokenRule(currToken)) {
+      newTokens.push(mergeTokens(tokens, lastLikeIndex, i));
+      lastLikeIndex = i;
+    }
+  }
+  newTokens.push(mergeTokens(tokens, lastLikeIndex, tokens.length));
+  return newTokens;
+};
+
+/**
+ * Returns if given row is a whitespace row.
+ * @param {number} row Row.
+ * @return {boolean} True if row is whitespaces.
+ */
+var isRowWhiteSpace = function(row) {
+  var line = cvoxAce.editor.getSession().getLine(row);
+  var whiteSpaceRegexp = /^\s*$/;
+  return whiteSpaceRegexp.exec(line) !== null;
+};
+
+/**
+ * Speak the line with syntax properties.
+ * @param {number} row Row to speak.
+ * @param {number} queue Queue mode to speak.
+ */
+var speakLine = function(row, queue) {
+  var tokens = cvoxAce.editor.getSession().getTokens(row);
+  if (tokens.length === 0 || isRowWhiteSpace(row)) {
+    cvox.Api.playEarcon('EDITABLE_TEXT');
+    return;
+  }
+  tokens = mergeLikeTokens(tokens);
+  var firstToken = tokens[0];
+  /* Filter out first token. */
+  tokens = tokens.filter(function(token) {
+    return token !== firstToken;
+  });
+  /* Speak first token separately to flush if queue. */
+  speakToken_(firstToken, queue);
+  /* Speak rest of tokens. */
+  tokens.forEach(speakTokenQueue);
+};
+
+/**
+ * Speak the token based on the syntax of the token, flushing.
+ * @param {!cvoxAce.Token} token Token to speak.
+ * @param {number} queue Queue mode.
+ */
+var speakTokenFlush = function(token) {
+  speakToken_(token, 0);
+};
+
+/**
+ * Speak the token based on the syntax of the token, queueing.
+ * @param {!cvoxAce.Token} token Token to speak.
+ * @param {number} queue Queue mode.
+ */
+var speakTokenQueue = function(token) {
+  speakToken_(token, 1);
+};
+
+/**
+ * @param {!cvoxAce.Token} token Token to speak.
+ * Get the token speech property.
+ */
+var getTokenRule = function(token) {
+  /* Types are period delimited. In this case, we only syntax speak the outer
+   * most type of token. */
+  if (!token || !token.type) {
+    return;
+  }
+  var split = token.type.split('.');
+  if (split.length === 0) {
+    return;
+  }
+  var type = split[0];
+  var rule = rules[type];
+  if (!rule) {
+    return DEFAULT_RULE;
+  }
+  return rule;
+};
+
+/**
+ * Speak the token based on the syntax of the token.
+ * @private
+ * @param {!cvoxAce.Token} token Token to speak.
+ * @param {number} queue Queue mode.
+ */
+var speakToken_ = function(token, queue) {
+  var rule = getTokenRule(token);
+  var value = expand(token.value, REPLACE_LIST);
+  if (rule.replace) {
+    value = expand(value, rule.replace);
+  }
+  cvox.Api.speak(value, queue, rule.prop);
+};
+
+/**
+ * Speaks the character under the cursor. This is queued.
+ * @param {!cvoxAce.Cursor} cursor Current cursor position.
+ * @return {string} Character.
+ */
+var speakChar = function(cursor) {
+  var line = getCurrentLine(cursor);
+  cvox.Api.speak(line[cursor.column], 1);
+};
+
+/**
+ * Speaks the jump from lastCursor to currCursor. This function assumes the
+ * jump takes place on the current line.
+ * @param {!cvoxAce.Cursor} lastCursor Previous cursor position.
+ * @param {!cvoxAce.Cursor} currCursor Current cursor position.
+ */
+var speakDisplacement = function(lastCursor, currCursor) {
+  var line = getCurrentLine(currCursor);
+
+  /* Get the text that we jumped past. */
+  var displace = line.substring(lastCursor.column, currCursor.column);
+
+  /* Speak out loud spaces. */
+  displace = displace.replace(/ /g, ' space ');
+  cvox.Api.speak(displace);
+};
+
+/**
+ * Speaks the word if the cursor jumped to a new word or to the beginning
+ * of the line. Otherwise speak the charactor.
+ * @param {!cvoxAce.Cursor} lastCursor Previous cursor position.
+ * @param {!cvoxAce.Cursor} currCursor Current cursor position.
+ */
+var speakCharOrWordOrLine = function(lastCursor, currCursor) {
+  /* Say word only if jump. */
+  if (Math.abs(lastCursor.column - currCursor.column) !== 1) {
+    var currLineLength = getCurrentLine(currCursor).length;
+    /* Speak line if jumping to beginning or end of line. */
+    if (currCursor.column === 0 || currCursor.column === currLineLength) {
+      speakLine(currCursor.row, 0);
+      return;
+    }
+    if (isWord(currCursor)) {
+      cvox.Api.stop();
+      speakTokenQueue(getCurrentToken(currCursor));
+      return;
+    }
+  }
+  speakChar(currCursor);
+};
+
+/**
+ * Event handler for column changes. If shouldSpeakDisplacement is on, then
+ * we just speak displacements in row changes. Otherwise, we either speak
+ * the character for single character movements, the word when jumping to the
+ * next word, or the entire line if jumping to beginning or end of the line.
+ * @param {!cvoxAce.Cursor} lastCursor Previous cursor position.
+ * @param {!cvoxAce.Cursor} currCursor Current cursor position.
+ */
+var onColumnChange = function(lastCursor, currCursor) {
+  if (!cvoxAce.editor.selection.isEmpty()) {
+    speakDisplacement(lastCursor, currCursor);
+    cvox.Api.speak('selected', 1);
+  }
+  else if (shouldSpeakDisplacement) {
+    speakDisplacement(lastCursor, currCursor);
+  } else {
+    speakCharOrWordOrLine(lastCursor, currCursor);
+  }
+};
+
+/**
+ * Event handler for cursor changes. Classify cursor changes as either row or
+ * column changes, then delegate accordingly.
+ * @param {!Event} evt The event.
+ */
+var onCursorChange = function(evt) {
+  /* Do not speak if cursor change was a result of text insertion. We want to
+   * speak the text that was inserted and not where the cursor lands. */
+  if (changed) {
+    changed = false;
+    return;
+  }
+  var currCursor = cvoxAce.editor.selection.getCursor();
+  if (currCursor.row !== lastCursor.row) {
+    onRowChange(currCursor);
+  } else {
+    onColumnChange(lastCursor, currCursor);
+  }
+  lastCursor = currCursor;
+};
+
+/**
+ * Event handler for selection changes.
+ * @param {!Event} evt The event.
+ */
+var onSelectionChange = function(evt) {
+  /* Assumes that when selection changes to empty, the user has unselected. */
+  if (cvoxAce.editor.selection.isEmpty()) {
+    cvox.Api.speak('unselected');
+  }
+};
+
+/**
+ * Event handler for source changes. We want auditory feedback for inserting
+ * and deleting text.
+ * @param {!Event} evt The event.
+ */
+var onChange = function(evt) {
+  var data = evt.data;
+  switch (data.action) {
+  case 'removeText':
+    cvox.Api.speak(data.text, 0, DELETED_PROP);
+    /* Let the future cursor change event know it's from text change. */
+    changed = true;
+    break;
+  case 'insertText':
+    cvox.Api.speak(data.text, 0);
+    /* Let the future cursor change event know it's from text change. */
+    changed = true;
+    break;
+  }
+};
+
+/**
+ * Returns whether or not the annotation is new.
+ * @param {!cvoxAce.Annotation} annot Annotation in question.
+ * @return {boolean} Whether annot is new.
+ */
+var isNewAnnotation = function(annot) {
+  var row = annot.row;
+  var col = annot.column;
+  return !annotTable[row] || !annotTable[row][col];
+};
+
+/**
+ * Populates the annotation table.
+ * @param {!Array.<cvoxAce.Annotation>} annotations Array of annotations.
+ */
+var populateAnnotations = function(annotations) {
+  annotTable = {};
+  for (var i = 0; i < annotations.length; i++) {
+    var annotation = annotations[i];
+    var row = annotation.row;
+    var col = annotation.column;
+    if (!annotTable[row]) {
+      annotTable[row] = {};
+    }
+    annotTable[row][col] = annotation;
+  }
+};
+
+/**
+ * Event handler for annotation changes. We want to notify the user when an
+ * a new annotation appears.
+ * @param {!Event} evt Event.
+ */
+var onAnnotationChange = function(evt) {
+  var annotations = cvoxAce.editor.getSession().getAnnotations();
+  var newAnnotations = annotations.filter(isNewAnnotation);
+  if (newAnnotations.length > 0) {
+    cvox.Api.playEarcon(ERROR_EARCON);
+  }
+  populateAnnotations(annotations);
+};
+
+/**
+ * Speak annotation.
+ * @param {!cvoxAce.Annotation} annot Annotation to speak.
+ */
+var speakAnnot = function(annot) {
+  var annotText = annot.type + ' ' + annot.text + ' on ' +
+      rowColToString(annot.row, annot.column);
+  annotText = annotText.replace(';', 'semicolon');
+  cvox.Api.speak(annotText, 1);
+};
+
+/**
+ * Speak annotations in a row.
+ * @param {number} row Row of annotations to speak.
+ */
+var speakAnnotsByRow = function(row) {
+  var annots = annotTable[row];
+  for (var col in annots) {
+    speakAnnot(annots[col]);
+  }
+};
+
+/**
+ * Get a string representation of a row and column.
+ * @param {boolean} row Zero indexed row.
+ * @param {boolean} col Zero indexed column.
+ * @return {string} Row and column to be spoken.
+ */
+var rowColToString = function(row, col) {
+  return 'row ' + (row + 1) + ' column ' + (col + 1);
+};
+
+/**
+ * Speaks the row and column.
+ */
+var speakCurrRowAndCol = function() {
+  cvox.Api.speak(rowColToString(lastCursor.row, lastCursor.column));
+};
+
+/**
+ * Speaks all annotations.
+ */
+var speakAllAnnots = function() {
+  for (var row in annotTable) {
+    speakAnnotsByRow(row);
+  }
+};
+
+/**
+ * Speak the vim mode. If no vim mode, this function does nothing.
+ */
+var speakMode = function() {
+  if (!isVimMode()) {
+    return;
+  }
+  switch (cvoxAce.editor.keyBinding.$data.state) {
+  case INSERT_MODE_STATE:
+    cvox.Api.speak('Insert mode');
+    break;
+  case COMMAND_MODE_STATE:
+    cvox.Api.speak('Command mode');
+    break;
+  }
+};
+
+/**
+ * Toggle speak location.
+ */
+var toggleSpeakRowLocation = function() {
+  shouldSpeakRowLocation = !shouldSpeakRowLocation;
+  /* Auditory feedback of the change. */
+  if (shouldSpeakRowLocation) {
+    cvox.Api.speak('Speak location on row change enabled.');
+  } else {
+    cvox.Api.speak('Speak location on row change disabled.');
+  }
+};
+
+/**
+ * Toggle speak displacement.
+ */
+var toggleSpeakDisplacement = function() {
+  shouldSpeakDisplacement = !shouldSpeakDisplacement;
+  /* Auditory feedback of the change. */
+  if (shouldSpeakDisplacement) {
+    cvox.Api.speak('Speak displacement on column changes.');
+  } else {
+    cvox.Api.speak('Speak current character or word on column changes.');
+  }
+};
+
+/**
+ * Event handler for key down events. Gets the right shortcut from the map,
+ * and calls the associated function.
+ * @param {!Event} evt Keyboard event.
+ */
+var onKeyDown = function(evt) {
+  if (evt.ctrlKey && evt.shiftKey) {
+    var shortcut = keyCodeToShortcutMap[evt.keyCode];
+    if (shortcut) {
+      shortcut.func();
+    }
+  }
+};
+
+/**
+ * Event handler for status change events. Auditory feedback of changing
+ * between vim states.
+ * @param {!Event} evt Change status event.
+ * @param {!Object} editor Editor state.
+ */
+var onChangeStatus = function(evt, editor) {
+  if (!isVimMode()) {
+    return;
+  }
+  var state = editor.keyBinding.$data.state;
+  if (state === vimState) {
+    /* State hasn't changed, do nothing. */
+    return;
+  }
+  switch (state) {
+  case INSERT_MODE_STATE:
+    cvox.Api.playEarcon(MODE_SWITCH_EARCON);
+    /* When in insert mode, we want to speak out keys as feedback. */
+    cvox.Api.setKeyEcho(true);
+    break;
+  case COMMAND_MODE_STATE:
+    cvox.Api.playEarcon(MODE_SWITCH_EARCON);
+    /* When in command mode, we want don't speak out keys because those keys
+    * are not being inserted in the document. */
+    cvox.Api.setKeyEcho(false);
+    break;
+  }
+  vimState = state;
+};
+
+/**
+ * Handles context menu events. This is a ChromeVox feature where hitting
+ * the shortcut ChromeVox + comma will open up a search bar where you can
+ * type in various commands. All keyboard shortcuts are also commands that
+ * can be invoked. This handles the event that ChromeVox sends to the page.
+ * @param {Event} evt Event received.
+ */
+var contextMenuHandler = function(evt) {
+  var cmd = evt.detail['customCommand'];
+  var shortcut = cmdToShortcutMap[cmd];
+  if (shortcut) {
+    shortcut.func();
+    /* ChromeVox will bring focus to an element near the cursor instead of the
+     * text input. */
+    cvoxAce.editor.focus();
+  }
+};
+
+/**
+ * Initialize the ChromeVox context menu.
+ */
+var initContextMenu = function() {
+  var ACTIONS = SHORTCUTS.map(function(shortcut) {
+    return {
+      desc: shortcut.desc + getKeyShortcutString(shortcut.keyCode),
+      cmd: shortcut.cmd
+    };
+  });
+
+  /* Attach ContextMenuActions. */
+  var body = document.querySelector('body');
+  body.setAttribute('contextMenuActions', JSON.stringify(ACTIONS));
+
+  /* Listen for ContextMenu events. */
+  body.addEventListener('ATCustomEvent', contextMenuHandler, true);
+};
+
+/**
+ * Event handler for find events. When there is a match, we want to speak the
+ * line we are now at. Otherwise, we want to notify the user there was no
+ * match
+ * @param {!Event} evt The event.
+ */
+var onFindSearchbox = function(evt) {
+  if (evt.match) {
+    /* There is still a match! Speak the line. */
+    speakLine(lastCursor.row, 0);
+  } else {
+    /* No match, give auditory feedback! */
+    cvox.Api.playEarcon(NO_MATCH_EARCON);
+  }
+};
+
+/**
+ * Focus to text input.
+ */
+var focus = function() {
+  cvoxAce.editor.focus();
+};
+
+/**
+ * Shortcut definitions.
+ */
+var SHORTCUTS = [
+  {
+    /* 1 key. */
+    keyCode: 49,
+    func: function() {
+      speakAnnotsByRow(lastCursor.row);
+    },
+    cmd: Command.SPEAK_ANNOT,
+    desc: 'Speak annotations on line'
+  },
+  {
+    /* 2 key. */
+    keyCode: 50,
+    func: speakAllAnnots,
+    cmd: Command.SPEAK_ALL_ANNOTS,
+    desc: 'Speak all annotations'
+  },
+  {
+    /* 3 key. */
+    keyCode: 51,
+    func: speakMode,
+    cmd: Command.SPEAK_MODE,
+    desc: 'Speak Vim mode'
+  },
+  {
+    /* 4 key. */
+    keyCode: 52,
+    func: toggleSpeakRowLocation,
+    cmd: Command.TOGGLE_LOCATION,
+    desc: 'Toggle speak row location'
+  },
+  {
+    /* 5 key. */
+    keyCode: 53,
+    func: speakCurrRowAndCol,
+    cmd: Command.SPEAK_ROW_COL,
+    desc: 'Speak row and column'
+  },
+  {
+    /* 6 key. */
+    keyCode: 54,
+    func: toggleSpeakDisplacement,
+    cmd: Command.TOGGLE_DISPLACEMENT,
+    desc: 'Toggle speak displacement'
+  },
+  {
+    /* 7 key. */
+    keyCode: 55,
+    func: focus,
+    cmd: Command.FOCUS_TEXT,
+    desc: 'Focus text'
+  }
+];
+
+/**
+ * Event handler for focus events.
+ */
+var onFocus = function() {
+  cvoxAce.editor = editor;
+
+  /* Set up listeners. */
+  editor.getSession().selection.on('changeCursor', onCursorChange);
+  editor.getSession().selection.on('changeSelection', onSelectionChange);
+  editor.getSession().on('change', onChange);
+  editor.getSession().on('changeAnnotation', onAnnotationChange);
+  editor.on('changeStatus', onChangeStatus);
+  editor.on('findSearchBox', onFindSearchbox);
+  editor.container.addEventListener('keydown', onKeyDown);
+
+  lastCursor = editor.selection.getCursor();
+};
+
+/**
+ * Initialize the theme.
+ * @param {Object} editor Editor to use.
+ */
+var init = function(editor) {
+  onFocus();
+
+  /* Construct maps. */
+  SHORTCUTS.forEach(function(shortcut) {
+    keyCodeToShortcutMap[shortcut.keyCode] = shortcut;
+    cmdToShortcutMap[shortcut.cmd] = shortcut;
+  });
+
+  editor.on('focus', onFocus);
+
+  /* Assume we start in command mode if vim. */
+  if (isVimMode()) {
+    cvox.Api.setKeyEcho(false);
+  }
+  initContextMenu();
+};
+
+/**
+ * Returns if cvox exists, and the api exists.
+ * @return {boolean} Whether not Cvox Api exists.
+ */
+function cvoxApiExists() {
+  return (typeof(cvox) !== 'undefined') && cvox && cvox.Api;
+}
+
+/**
+ * Number of tries for Cvox loading.
+ * @type {number}
+ */
+var tries = 0;
+
+/**
+ * Max number of tries to watch for Cvox loading.
+ * @type {number}
+ */
+var MAX_TRIES = 15;
+
+/**
+ * Check for ChromeVox load.
+ * @param {Object} editor Editor to use.
+ */
+function watchForCvoxLoad(editor) {
+  if (cvoxApiExists()) {
+    init(editor);
+  } else {
+    tries++;
+    if (tries >= MAX_TRIES) {
+      return;
+    }
+    window.setTimeout(watchForCvoxLoad, 500, editor);
+  }
+}
+
+var Editor = require('../editor').Editor;
+require('../config').defineOptions(Editor.prototype, 'editor', {
+  enableChromevoxEnhancements: {
+    set: function(val) {
+      if (val) {
+        watchForCvoxLoad(this);
+      }
+    },
+    value: true // turn it on by default or check for window.cvox
+  }
+});
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/elastic_tabstops_lite.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/elastic_tabstops_lite.js b/src/fauxton/assets/js/libs/ace/ext/elastic_tabstops_lite.js
new file mode 100644
index 0000000..9901c5d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/elastic_tabstops_lite.js
@@ -0,0 +1,319 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var ElasticTabstopsLite = function(editor) {
+    this.$editor = editor;
+    var self = this;
+    var changedRows = [];
+    var recordChanges = false;
+    this.onAfterExec = function() {
+        recordChanges = false;
+        self.processRows(changedRows);
+        changedRows = [];
+    };
+    this.onExec = function() {
+        recordChanges = true;
+    };
+    this.onChange = function(e) {
+        var range = e.data.range
+        if (recordChanges) {
+            if (changedRows.indexOf(range.start.row) == -1)
+                changedRows.push(range.start.row);
+            if (range.end.row != range.start.row)
+                changedRows.push(range.end.row);
+        }
+    };
+};
+
+(function() {
+    this.processRows = function(rows) {
+        this.$inChange = true;
+        var checkedRows = [];
+
+        for (var r = 0, rowCount = rows.length; r < rowCount; r++) {
+            var row = rows[r];
+
+            if (checkedRows.indexOf(row) > -1)
+                continue;
+
+            var cellWidthObj = this.$findCellWidthsForBlock(row);
+            var cellWidths = this.$setBlockCellWidthsToMax(cellWidthObj.cellWidths);
+            var rowIndex = cellWidthObj.firstRow;
+
+            for (var w = 0, l = cellWidths.length; w < l; w++) {
+                var widths = cellWidths[w];
+                checkedRows.push(rowIndex);
+                this.$adjustRow(rowIndex, widths);
+                rowIndex++;
+            }
+        }
+        this.$inChange = false;
+    };
+
+    this.$findCellWidthsForBlock = function(row) {
+        var cellWidths = [], widths;
+
+        // starting row and backward
+        var rowIter = row;
+        while (rowIter >= 0) {
+            widths = this.$cellWidthsForRow(rowIter);
+            if (widths.length == 0)
+                break;
+
+            cellWidths.unshift(widths);
+            rowIter--;
+        }
+        var firstRow = rowIter + 1;
+
+        // forward (not including starting row)
+        rowIter = row;
+        var numRows = this.$editor.session.getLength();
+
+        while (rowIter < numRows - 1) {
+            rowIter++;
+
+            widths = this.$cellWidthsForRow(rowIter);
+            if (widths.length == 0)
+                break;
+
+            cellWidths.push(widths);
+        }
+
+        return { cellWidths: cellWidths, firstRow: firstRow };
+    };
+
+    this.$cellWidthsForRow = function(row) {
+        var selectionColumns = this.$selectionColumnsForRow(row);
+        // todo: support multicursor
+
+        var tabs = [-1].concat(this.$tabsForRow(row));
+        var widths = tabs.map(function(el) { return 0; } ).slice(1);
+        var line = this.$editor.session.getLine(row);
+
+        for (var i = 0, len = tabs.length - 1; i < len; i++) {
+            var leftEdge = tabs[i]+1;
+            var rightEdge = tabs[i+1];
+
+            var rightmostSelection = this.$rightmostSelectionInCell(selectionColumns, rightEdge);
+            var cell = line.substring(leftEdge, rightEdge);
+            widths[i] = Math.max(cell.replace(/\s+$/g,'').length, rightmostSelection - leftEdge);
+        }
+
+        return widths;
+    };
+
+    this.$selectionColumnsForRow = function(row) {
+        var selections = [], cursor = this.$editor.getCursorPosition();
+        if (this.$editor.session.getSelection().isEmpty()) {
+            // todo: support multicursor
+            if (row == cursor.row)
+                selections.push(cursor.column);
+        }
+
+        return selections;
+    };
+
+    this.$setBlockCellWidthsToMax = function(cellWidths) {
+        var startingNewBlock = true, blockStartRow, blockEndRow, maxWidth;
+        var columnInfo = this.$izip_longest(cellWidths);
+
+        for (var c = 0, l = columnInfo.length; c < l; c++) {
+            var column = columnInfo[c];
+            if (!column.push) {
+                console.error(column);
+                continue;
+            }
+            // add an extra None to the end so that the end of the column automatically
+            // finishes a block
+            column.push(NaN);
+
+            for (var r = 0, s = column.length; r < s; r++) {
+                var width = column[r];
+                if (startingNewBlock) {
+                    blockStartRow = r;
+                    maxWidth = 0;
+                    startingNewBlock = false;
+                }
+                if (isNaN(width)) {
+                    // block ended
+                    blockEndRow = r;
+
+                    for (var j = blockStartRow; j < blockEndRow; j++) {
+                        cellWidths[j][c] = maxWidth;
+                    }
+                    startingNewBlock = true;
+                }
+
+                maxWidth = Math.max(maxWidth, width);
+            }
+        }
+
+        return cellWidths;
+    };
+
+    this.$rightmostSelectionInCell = function(selectionColumns, cellRightEdge) {
+        var rightmost = 0;
+
+        if (selectionColumns.length) {
+            var lengths = [];
+            for (var s = 0, length = selectionColumns.length; s < length; s++) {
+                if (selectionColumns[s] <= cellRightEdge)
+                    lengths.push(s);
+                else
+                    lengths.push(0);
+            }
+            rightmost = Math.max.apply(Math, lengths);
+        }
+
+        return rightmost;
+    };
+
+    this.$tabsForRow = function(row) {
+        var rowTabs = [], line = this.$editor.session.getLine(row),
+            re = /\t/g, match;
+
+        while ((match = re.exec(line)) != null) {
+            rowTabs.push(match.index);
+        }
+
+        return rowTabs;
+    };
+
+    this.$adjustRow = function(row, widths) {
+        var rowTabs = this.$tabsForRow(row);
+
+        if (rowTabs.length == 0)
+            return;
+
+        var bias = 0, location = -1;
+
+        // this always only contains two elements, so we're safe in the loop below
+        var expandedSet = this.$izip(widths, rowTabs);
+
+        for (var i = 0, l = expandedSet.length; i < l; i++) {
+            var w = expandedSet[i][0], it = expandedSet[i][1];
+            location += 1 + w;
+            it += bias;
+            var difference = location - it;
+
+            if (difference == 0)
+                continue;
+
+            var partialLine = this.$editor.session.getLine(row).substr(0, it );
+            var strippedPartialLine = partialLine.replace(/\s*$/g, "");
+            var ispaces = partialLine.length - strippedPartialLine.length;
+
+            if (difference > 0) {
+                // put the spaces after the tab and then delete the tab, so any insertion
+                // points behave as expected
+                this.$editor.session.getDocument().insertInLine({row: row, column: it + 1}, Array(difference + 1).join(" ") + "\t");
+                this.$editor.session.getDocument().removeInLine(row, it, it + 1);
+
+                bias += difference;
+            }
+
+            if (difference < 0 && ispaces >= -difference) {
+                this.$editor.session.getDocument().removeInLine(row, it + difference, it);
+                bias += difference;
+            }
+        }
+    };
+
+    // the is a (naive) Python port--but works for these purposes
+    this.$izip_longest = function(iterables) {
+        if (!iterables[0])
+            return [];
+        var longest = iterables[0].length;
+        var iterablesLength = iterables.length;
+
+        for (var i = 1; i < iterablesLength; i++) {
+            var iLength = iterables[i].length;
+            if (iLength > longest)
+                longest = iLength;
+        }
+
+        var expandedSet = [];
+
+        for (var l = 0; l < longest; l++) {
+            var set = [];
+            for (var i = 0; i < iterablesLength; i++) {
+                if (iterables[i][l] === "")
+                    set.push(NaN);
+                else
+                    set.push(iterables[i][l]);
+            }
+
+            expandedSet.push(set);
+        }
+
+
+        return expandedSet;
+    };
+
+    // an even more (naive) Python port
+    this.$izip = function(widths, tabs) {
+        // grab the shorter size
+        var size = widths.length >= tabs.length ? tabs.length : widths.length;
+
+        var expandedSet = [];
+        for (var i = 0; i < size; i++) {
+            var set = [ widths[i], tabs[i] ];
+            expandedSet.push(set);
+        }
+        return expandedSet;
+    };
+
+}).call(ElasticTabstopsLite.prototype);
+
+exports.ElasticTabstopsLite = ElasticTabstopsLite;
+
+var Editor = require("../editor").Editor;
+require("../config").defineOptions(Editor.prototype, "editor", {
+    useElasticTabstops: {
+        set: function(val) {
+            if (val) {
+                if (!this.elasticTabstops)
+                    this.elasticTabstops = new ElasticTabstopsLite(this);
+                this.commands.on("afterExec", this.elasticTabstops.onAfterExec);
+                this.commands.on("exec", this.elasticTabstops.onExec);
+                this.on("change", this.elasticTabstops.onChange);
+            } else if (this.elasticTabstops) {
+                this.commands.removeListener("afterExec", this.elasticTabstops.onAfterExec);
+                this.commands.removeListener("exec", this.elasticTabstops.onExec);
+                this.removeListener("change", this.elasticTabstops.onChange);
+            }
+        }
+    }
+});
+
+});
\ No newline at end of file


[31/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_tcl.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_tcl.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_tcl.json
new file mode 100644
index 0000000..6a032dd
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_tcl.json
@@ -0,0 +1,385 @@
+[[
+   "commandItem"
+],[
+   "commandItem",
+  ["keyword","proc"],
+  ["text"," "],
+  ["identifier","dijkstra"],
+  ["text"," "],
+  ["paren.lparen","{"],
+  ["keyword","graph"],
+  ["text"," "],
+  ["identifier","origin"],
+  ["paren.rparen","}"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["comment","# Initialize"]
+],[
+   "commandItem",
+  ["text","    "],
+  ["keyword","dict"],
+  ["text"," "],
+  ["identifier","for"],
+  ["text"," "],
+  ["paren.lparen","{"],
+  ["keyword","vertex"],
+  ["text"," "],
+  ["identifier","distmap"],
+  ["paren.rparen","}"],
+  ["text"," "],
+  ["variable.instance","$graph"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword","dict"],
+  ["text"," "],
+  ["identifier","set"],
+  ["text"," "],
+  ["identifier","dist"],
+  ["text"," "],
+  ["variable.instance","$vertex"],
+  ["text"," "],
+  ["identifier","Inf"]
+],[
+   "commandItem",
+  ["text","\t"],
+  ["keyword","dict"],
+  ["text"," "],
+  ["identifier","set"],
+  ["text"," "],
+  ["identifier","path"],
+  ["text"," "],
+  ["variable.instance","$vertex"],
+  ["text"," "],
+  ["paren.lparen","{"],
+  ["paren.rparen","}"]
+],[
+   "commandItem",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","dict"],
+  ["text"," "],
+  ["identifier","set"],
+  ["text"," "],
+  ["identifier","dist"],
+  ["text"," "],
+  ["variable.instance","$origin"],
+  ["text"," 0"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","dict"],
+  ["text"," "],
+  ["identifier","set"],
+  ["text"," "],
+  ["identifier","path"],
+  ["text"," "],
+  ["variable.instance","$origin"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["keyword","list"],
+  ["text"," "],
+  ["variable.instance","$origin"],
+  ["paren.rparen","]"]
+],[
+   "commandItem",
+  ["text"," "]
+],[
+   "commandItem",
+  ["text","    "],
+  ["keyword","while"],
+  ["text"," "],
+  ["paren.lparen","{"],
+  ["text","["],
+  ["keyword","dict"],
+  ["text"," "],
+  ["identifier","size"],
+  ["text"," "],
+  ["variable.instance","$graph"],
+  ["paren.rparen","]}"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","\t"],
+  ["comment","# Find unhandled node with least weight"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword","set"],
+  ["text"," "],
+  ["identifier","d"],
+  ["text"," "],
+  ["identifier","Inf"]
+],[
+   "commandItem",
+  ["text","\t"],
+  ["keyword","dict"],
+  ["text"," "],
+  ["identifier","for"],
+  ["text"," "],
+  ["paren.lparen","{"],
+  ["keyword","uu"],
+  ["text"," "],
+  ["support.function","-"],
+  ["paren.rparen","}"],
+  ["text"," "],
+  ["variable.instance","$graph"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "commandItem",
+  ["text","\t    "],
+  ["keyword","if"],
+  ["text"," "],
+  ["paren.lparen","{"],
+  ["variable.instance","$d"],
+  ["text"," "],
+  ["support.function",">"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["keyword","set"],
+  ["text"," "],
+  ["identifier","dd"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["keyword","dict"],
+  ["text"," "],
+  ["identifier","get"],
+  ["text"," "],
+  ["variable.instance","$dist"],
+  ["text"," "],
+  ["variable.instance","$uu"],
+  ["paren.rparen","]]}"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["keyword","set"],
+  ["text"," "],
+  ["identifier","u"],
+  ["text"," "],
+  ["variable.instance","$uu"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["keyword","set"],
+  ["text"," "],
+  ["identifier","d"],
+  ["text"," "],
+  ["variable.instance","$dd"]
+],[
+   "commandItem",
+  ["text","\t    "],
+  ["paren.rparen","}"]
+],[
+   "commandItem",
+  ["text","\t"],
+  ["paren.rparen","}"]
+],[
+   "commandItem",
+  ["text"," "]
+],[
+   "start",
+  ["text","\t"],
+  ["comment","# No such node; graph must be disconnected"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword","if"],
+  ["text"," "],
+  ["paren.lparen","{"],
+  ["variable.instance","$d"],
+  ["text"," "],
+  ["support.function","=="],
+  ["text"," "],
+  ["identifier","Inf"],
+  ["paren.rparen","}"],
+  ["text"," "],
+  ["identifier","break"]
+],[
+   "commandItem",
+  ["text"," "]
+],[
+   "commentfollow",
+  ["text","\t"],
+  ["comment","# Update the weights for nodes\\"]
+],[
+   "start",
+  ["comment","\t lead to by the node we've picked"]
+],[
+   "commandItem",
+  ["text","\t"],
+  ["keyword","dict"],
+  ["text"," "],
+  ["identifier","for"],
+  ["text"," "],
+  ["paren.lparen","{"],
+  ["keyword","v"],
+  ["text"," "],
+  ["identifier","dd"],
+  ["paren.rparen","}"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["keyword","dict"],
+  ["text"," "],
+  ["identifier","get"],
+  ["text"," "],
+  ["variable.instance","$graph"],
+  ["text"," "],
+  ["variable.instance","$u"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "commandItem",
+  ["text","\t    "],
+  ["keyword","if"],
+  ["text"," "],
+  ["paren.lparen","{"],
+  ["text","["],
+  ["keyword","dict"],
+  ["text"," "],
+  ["identifier","exists"],
+  ["text"," "],
+  ["variable.instance","$graph"],
+  ["text"," "],
+  ["variable.instance","$v"],
+  ["paren.rparen","]}"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["keyword","set"],
+  ["text"," "],
+  ["identifier","alt"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["keyword","expr"],
+  ["text"," "],
+  ["paren.lparen","{"],
+  ["variable.instance","$d"],
+  ["text"," "],
+  ["support.function","+"],
+  ["text"," "],
+  ["variable.instance","$dd"],
+  ["paren.rparen","}]"]
+],[
+   "commandItem",
+  ["text","\t\t"],
+  ["keyword","if"],
+  ["text"," "],
+  ["paren.lparen","{"],
+  ["variable.instance","$alt"],
+  ["text"," "],
+  ["support.function","<"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["keyword","dict"],
+  ["text"," "],
+  ["identifier","get"],
+  ["text"," "],
+  ["variable.instance","$dist"],
+  ["text"," "],
+  ["variable.instance","$v"],
+  ["paren.rparen","]}"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","\t\t    "],
+  ["keyword","dict"],
+  ["text"," "],
+  ["identifier","set"],
+  ["text"," "],
+  ["identifier","dist"],
+  ["text"," "],
+  ["variable.instance","$v"],
+  ["text"," "],
+  ["variable.instance","$alt"]
+],[
+   "start",
+  ["text","\t\t    "],
+  ["keyword","dict"],
+  ["text"," "],
+  ["identifier","set"],
+  ["text"," "],
+  ["identifier","path"],
+  ["text"," "],
+  ["variable.instance","$v"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["keyword","list"],
+  ["text"," "],
+  ["support.function","{*}"],
+  ["paren.lparen","["],
+  ["keyword","dict"],
+  ["text"," "],
+  ["identifier","get"],
+  ["text"," "],
+  ["variable.instance","$path"],
+  ["text"," "],
+  ["variable.instance","$u"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["variable.instance","$v"],
+  ["paren.rparen","]"]
+],[
+   "commandItem",
+  ["text","\t\t"],
+  ["paren.rparen","}"]
+],[
+   "commandItem",
+  ["text","\t    "],
+  ["paren.rparen","}"]
+],[
+   "commandItem",
+  ["text","\t"],
+  ["paren.rparen","}"]
+],[
+   "commandItem",
+  ["text"," "]
+],[
+   "start",
+  ["text","\t"],
+  ["comment","# Remove chosen node from graph still to be handled"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword","dict"],
+  ["text"," "],
+  ["identifier","unset"],
+  ["text"," "],
+  ["identifier","graph"],
+  ["text"," "],
+  ["variable.instance","$u"]
+],[
+   "commandItem",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","return"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["keyword","list"],
+  ["text"," "],
+  ["variable.instance","$dist"],
+  ["text"," "],
+  ["variable.instance","$path"],
+  ["paren.rparen","]"]
+],[
+   "commandItem",
+  ["paren.rparen","}"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_tex.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_tex.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_tex.json
new file mode 100644
index 0000000..2d02367
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_tex.json
@@ -0,0 +1,130 @@
+[[
+   "start",
+  ["text","The quadratic formula is $$-b "],
+  ["keyword","\\pm"],
+  ["text"," "],
+  ["keyword","\\sqrt"],
+  ["paren.keyword.operator","{"],
+  ["text","b^2 - 4ac"],
+  ["paren.keyword.operator","}"],
+  ["text"," "],
+  ["keyword","\\over"],
+  ["text"," 2a$$"]
+],[
+   "start",
+  ["keyword","\\bye"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","\\makeatletter"]
+],[
+   "start",
+  ["text"," "],
+  ["keyword","\\newcommand"],
+  ["paren.keyword.operator","{"],
+  ["keyword","\\be"],
+  ["paren.keyword.operator","}{"],
+  ["comment","%"]
+],[
+   "start",
+  ["text"," "],
+  ["keyword","\\begingroup"]
+],[
+   "start",
+  ["text"," "],
+  ["comment","% \\setlength{\\arraycolsep}{2pt}"]
+],[
+   "start",
+  ["text"," "],
+  ["keyword","\\eqnarray"],
+  ["comment","%"]
+],[
+   "start",
+  ["text"," "],
+  ["keyword","\\@"],
+  ["text","ifstar"],
+  ["paren.keyword.operator","{"],
+  ["keyword","\\nonumber"],
+  ["paren.keyword.operator","}{}"],
+  ["comment","%"]
+],[
+   "start",
+  ["text","  "],
+  ["paren.keyword.operator","}"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","\\newcommand"],
+  ["paren.keyword.operator","{"],
+  ["keyword","\\ee"],
+  ["paren.keyword.operator","}{"],
+  ["keyword","\\endeqnarray\\endgroup"],
+  ["paren.keyword.operator","}"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","\\makeatother"]
+],[
+   "start"
+],[
+   "start",
+  ["text"," "],
+  ["keyword","\\begin"],
+  ["paren.keyword.operator","{"],
+  ["nospell.text","equation"],
+  ["paren.keyword.operator","}"]
+],[
+   "start",
+  ["text"," x="],
+  ["keyword","\\left\\"],
+  ["paren.keyword.operator","{"],
+  ["text"," "],
+  ["keyword","\\begin"],
+  ["paren.keyword.operator","{"],
+  ["nospell.text","array"],
+  ["paren.keyword.operator","}{"],
+  ["text","cl"],
+  ["paren.keyword.operator","}"]
+],[
+   "start",
+  ["text"," 0 & "],
+  ["keyword","\\textrm"],
+  ["paren.keyword.operator","{"],
+  ["text","if "],
+  ["paren.keyword.operator","}"],
+  ["text","A="],
+  ["keyword","\\ldots\\\\"]
+],[
+   "start",
+  ["text"," 1 & "],
+  ["keyword","\\textrm"],
+  ["paren.keyword.operator","{"],
+  ["text","if "],
+  ["paren.keyword.operator","}"],
+  ["text","B="],
+  ["keyword","\\ldots\\\\"]
+],[
+   "start",
+  ["text"," x & "],
+  ["keyword","\\textrm"],
+  ["paren.keyword.operator","{"],
+  ["text","this runs with as much text as you like, but without an raggeright text"]
+],[
+   "start",
+  ["text","."],
+  ["paren.keyword.operator","}"],
+  ["keyword","\\end"],
+  ["paren.keyword.operator","{"],
+  ["nospell.text","array"],
+  ["paren.keyword.operator","}"],
+  ["keyword","\\right"],
+  ["text","."]
+],[
+   "start",
+  ["text"," "],
+  ["keyword","\\end"],
+  ["paren.keyword.operator","{"],
+  ["nospell.text","equation"],
+  ["paren.keyword.operator","}"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_text.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_text.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_text.json
new file mode 100644
index 0000000..fff7ef4
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_text.json
@@ -0,0 +1,29 @@
+[[
+   "start",
+  ["text","Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."]
+],[
+   "start"
+],[
+   "start",
+  ["text","Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat."]
+],[
+   "start"
+],[
+   "start",
+  ["text","Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi."]
+],[
+   "start"
+],[
+   "start",
+  ["text","Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat."]
+],[
+   "start"
+],[
+   "start",
+  ["text","Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis."]
+],[
+   "start"
+],[
+   "start",
+  ["text","At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_textile.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_textile.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_textile.json
new file mode 100644
index 0000000..59000ce
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_textile.json
@@ -0,0 +1,113 @@
+[[
+   "start",
+  ["markup.heading.1","h1"],
+  ["keyword",". "],
+  ["text","Textile document"]
+],[
+   "start"
+],[
+   "start",
+  ["markup.heading.2","h2"],
+  ["keyword",". "],
+  ["text","Heading Two"]
+],[
+   "start"
+],[
+   "start",
+  ["markup.heading.3","h3"],
+  ["keyword",". "],
+  ["text","A two-line"]
+],[
+   "start",
+  ["text","    header"]
+],[
+   "start"
+],[
+   "start",
+  ["markup.heading.2","h2"],
+  ["keyword",". "],
+  ["text","Another two-line"]
+],[
+   "start",
+  ["text","header"]
+],[
+   "start"
+],[
+   "start",
+  ["text","Paragraph:"]
+],[
+   "start",
+  ["text","one, two,"]
+],[
+   "start",
+  ["text","thee lines!"]
+],[
+   "start"
+],[
+   "start",
+  ["markup.heading","p"],
+  ["keyword","("],
+  ["string","classone"],
+  ["text"," "],
+  ["string","two"],
+  ["text"," "],
+  ["string","three"],
+  ["keyword","). "],
+  ["text","This is a paragraph with classes"]
+],[
+   "start"
+],[
+   "start",
+  ["markup.heading","p"],
+  ["keyword","(#"],
+  ["string","id"],
+  ["keyword","). "],
+  ["text","(one with an id)"]
+],[
+   "start"
+],[
+   "start",
+  ["markup.heading","p"],
+  ["keyword","("],
+  ["string","one"],
+  ["text"," "],
+  ["string","two"],
+  ["text"," "],
+  ["string","three"],
+  ["keyword","#"],
+  ["string","my_id"],
+  ["keyword","). "],
+  ["text","..classes + id"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","*"],
+  ["text"," Unordered list"]
+],[
+   "start",
+  ["keyword","**"],
+  ["text"," sublist"]
+],[
+   "start",
+  ["keyword","*"],
+  ["text"," back again!"]
+],[
+   "start",
+  ["keyword","**"],
+  ["text"," sublist again.."]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","#"],
+  ["text"," ordered"]
+],[
+   "start"
+],[
+   "start",
+  ["text","bg. Blockquote!"]
+],[
+   "start",
+  ["text","    This is a two-list blockquote..!"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_toml.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_toml.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_toml.json
new file mode 100644
index 0000000..ec471f7
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_toml.json
@@ -0,0 +1,131 @@
+[[
+   "start",
+  ["comment.toml","# This is a TOML document. Boom."]
+],[
+   "start"
+],[
+   "start",
+  ["identifier","title"],
+  ["text"," = "],
+  ["string","\"TOML Example\""]
+],[
+   "start"
+],[
+   "start",
+  ["variable.keygroup.toml","[owner]"]
+],[
+   "start",
+  ["identifier","name"],
+  ["text"," = "],
+  ["string","\"Tom Preston-Werner\""]
+],[
+   "start",
+  ["identifier","organization"],
+  ["text"," = "],
+  ["string","\"GitHub\""]
+],[
+   "start",
+  ["identifier","bio"],
+  ["text"," = "],
+  ["string","\"GitHub Cofounder & CEO"],
+  ["constant.language.escape","\\n"],
+  ["string","Likes tater tots and beer.\""]
+],[
+   "start",
+  ["identifier","dob"],
+  ["text"," = "],
+  ["support.date.toml","1979-05-27T07:32:00Z"],
+  ["text"," "],
+  ["comment.toml","# First class dates? Why not?"]
+],[
+   "start"
+],[
+   "start",
+  ["variable.keygroup.toml","[database]"]
+],[
+   "start",
+  ["identifier","server"],
+  ["text"," = "],
+  ["string","\"192.168.1.1\""]
+],[
+   "start",
+  ["identifier","ports"],
+  ["text"," = [ "],
+  ["constant.numeric.toml","8001"],
+  ["text",", "],
+  ["constant.numeric.toml","8001"],
+  ["text",", "],
+  ["constant.numeric.toml","8002"],
+  ["text"," ]"]
+],[
+   "start",
+  ["identifier","connection_max"],
+  ["text"," = "],
+  ["constant.numeric.toml","5000"]
+],[
+   "start",
+  ["identifier","enabled"],
+  ["text"," = "],
+  ["constant.language.boolean","true"]
+],[
+   "start"
+],[
+   "start",
+  ["variable.keygroup.toml","[servers]"]
+],[
+   "start"
+],[
+   "start",
+  ["text","  "],
+  ["comment.toml","# You can indent as you please. Tabs or spaces. TOML don't care."]
+],[
+   "start",
+  ["variable.keygroup.toml","  [servers.alpha]"]
+],[
+   "start",
+  ["text","  "],
+  ["identifier","ip"],
+  ["text"," = "],
+  ["string","\"10.0.0.1\""]
+],[
+   "start",
+  ["text","  "],
+  ["identifier","dc"],
+  ["text"," = "],
+  ["string","\"eqdc10\""]
+],[
+   "start"
+],[
+   "start",
+  ["variable.keygroup.toml","  [servers.beta]"]
+],[
+   "start",
+  ["text","  "],
+  ["identifier","ip"],
+  ["text"," = "],
+  ["string","\"10.0.0.2\""]
+],[
+   "start",
+  ["text","  "],
+  ["identifier","dc"],
+  ["text"," = "],
+  ["string","\"eqdc10\""]
+],[
+   "start"
+],[
+   "start",
+  ["variable.keygroup.toml","[clients]"]
+],[
+   "start",
+  ["identifier","data"],
+  ["text"," = [ ["],
+  ["string","\"gamma\""],
+  ["text",", "],
+  ["string","\"delta\""],
+  ["text","], ["],
+  ["constant.numeric.toml","1"],
+  ["text",", "],
+  ["constant.numeric.toml","2"],
+  ["text","] ] "],
+  ["comment.toml","# just an update to make sure parsers support it"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_twig.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_twig.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_twig.json
new file mode 100644
index 0000000..c4101de
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_twig.json
@@ -0,0 +1,288 @@
+[[
+   "start",
+  ["punctuation.doctype.begin","<!"],
+  ["meta.tag.doctype","DOCTYPE"],
+  ["text"," "],
+  ["xml-pe","html"],
+  ["punctuation.doctype.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","html"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","head"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","title"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","My Webpage"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","title"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","head"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","body"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","ul"],
+  ["text"," "],
+  ["entity.other.attribute-name","id"],
+  ["keyword.operator.separator","="],
+  ["string","\"navigation\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.twig","{%"],
+  ["text"," "],
+  ["keyword.control.twig","for"],
+  ["text"," "],
+  ["identifier","item"],
+  ["text"," "],
+  ["keyword.operator.twig","in"],
+  ["text"," "],
+  ["identifier","navigation"],
+  ["text"," "],
+  ["meta.tag.twig","%}"]
+],[
+   "start",
+  ["text","            "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","li"],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.anchor","a"],
+  ["text"," "],
+  ["entity.other.attribute-name","href"],
+  ["keyword.operator.separator","="],
+  ["string","\""],
+  ["variable.other.readwrite.local.twig","{{"],
+  ["text"," "],
+  ["identifier","item"],
+  ["punctuation.operator","."],
+  ["identifier","href"],
+  ["keyword.operator.other","|"],
+  ["support.function.twig","escape"],
+  ["text"," "],
+  ["variable.other.readwrite.local.twig","}}"],
+  ["string","\""],
+  ["meta.tag.punctuation.end",">"],
+  ["variable.other.readwrite.local.twig","{{"],
+  ["text"," "],
+  ["identifier","item"],
+  ["punctuation.operator","."],
+  ["identifier","caption"],
+  ["text"," "],
+  ["variable.other.readwrite.local.twig","}}"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.anchor","a"],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","li"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.twig","{%"],
+  ["text"," "],
+  ["keyword.control.twig","endfor"],
+  ["text"," "],
+  ["meta.tag.twig","%}"]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","ul"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.twig","{%"],
+  ["text"," "],
+  ["keyword.control.twig","if"],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["text"," "],
+  ["keyword.operator.twig","not"],
+  ["text"," "],
+  ["keyword.operator.twig","in"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["constant.numeric","3"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["meta.tag.twig","%}"]
+],[
+   "start"
+],[
+   "start",
+  ["text","        "],
+  ["comment.block.twig","{# is equivalent to #}"]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.twig","{%"],
+  ["text"," "],
+  ["keyword.control.twig","if"],
+  ["text"," "],
+  ["keyword.operator.twig","not"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["constant.numeric","1"],
+  ["text"," "],
+  ["keyword.operator.twig","in"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["constant.numeric","3"],
+  ["paren.rparen","])"],
+  ["text"," "],
+  ["meta.tag.twig","%}"]
+],[
+   "start"
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.twig","{%"],
+  ["text"," "],
+  ["keyword.control.twig","autoescape"],
+  ["text"," "],
+  ["constant.language.boolean","true"],
+  ["text"," "],
+  ["meta.tag.twig","%}"]
+],[
+   "start",
+  ["text","            "],
+  ["variable.other.readwrite.local.twig","{{"],
+  ["text"," "],
+  ["identifier","var"],
+  ["text"," "],
+  ["variable.other.readwrite.local.twig","}}"]
+],[
+   "start",
+  ["text","            "],
+  ["variable.other.readwrite.local.twig","{{"],
+  ["text"," "],
+  ["identifier","var"],
+  ["keyword.operator.other","|"],
+  ["support.function.twig","raw"],
+  ["text"," "],
+  ["variable.other.readwrite.local.twig","}}"],
+  ["text","     "],
+  ["comment.block.twig","{# var won't be escaped #}"]
+],[
+   "start",
+  ["text","            "],
+  ["variable.other.readwrite.local.twig","{{"],
+  ["text"," "],
+  ["identifier","var"],
+  ["keyword.operator.other","|"],
+  ["support.function.twig","escape"],
+  ["text"," "],
+  ["variable.other.readwrite.local.twig","}}"],
+  ["text","  "],
+  ["comment.block.twig","{# var won't be doubled-escaped #}"]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.twig","{%"],
+  ["text"," "],
+  ["keyword.control.twig","endautoescape"],
+  ["text"," "],
+  ["meta.tag.twig","%}"]
+],[
+   "start"
+],[
+   "start",
+  ["text","        "],
+  ["variable.other.readwrite.local.twig","{{"],
+  ["text"," "],
+  ["keyword.control.twig","include"],
+  ["paren.lparen","("],
+  ["string","'twig.html'"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["identifier","sandboxed"],
+  ["text"," "],
+  ["keyword.operator.assignment","="],
+  ["text"," "],
+  ["constant.language.boolean","true"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["variable.other.readwrite.local.twig","}}"]
+],[
+   "start"
+],[
+   "start",
+  ["text","        "],
+  ["variable.other.readwrite.local.twig","{{"],
+  ["string","\"string "],
+  ["constant.language.escape","#{with}"],
+  ["string"," "],
+  ["constant.language.escape","\\\""],
+  ["string"," escapes\""],
+  ["text"," "],
+  ["string","'another#one'"],
+  ["text"," "],
+  ["variable.other.readwrite.local.twig","}}"]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","h1"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","My Webpage"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","h1"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        "],
+  ["variable.other.readwrite.local.twig","{{"],
+  ["text"," "],
+  ["identifier","a_variable"],
+  ["text"," "],
+  ["variable.other.readwrite.local.twig","}}"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","body"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","html"],
+  ["meta.tag.punctuation.end",">"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_typescript.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_typescript.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_typescript.json
new file mode 100644
index 0000000..18f2eea
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_typescript.json
@@ -0,0 +1,559 @@
+[[
+   "start",
+  ["keyword.operator.ts","class"],
+  ["text"," "],
+  ["identifier","Greeter"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","\t"],
+  ["variable.parameter.function.ts","greeting"],
+  ["text",": "],
+  ["variable.parameter.function.ts","string"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword.operator.ts","constructor"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter.function.ts","message"],
+  ["text",": "],
+  ["variable.parameter.function.ts","string"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["storage.type.variable.ts","this."],
+  ["identifier","greeting"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","message"],
+  ["punctuation.operator",";"]
+],[
+   "no_regex",
+  ["text","\t"],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","\t"],
+  ["identifier","greet"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["keyword","return"],
+  ["text"," "],
+  ["string","\"Hello, \""],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["storage.type.variable.ts","this."],
+  ["identifier","greeting"],
+  ["punctuation.operator",";"]
+],[
+   "no_regex",
+  ["text","\t"],
+  ["paren.rparen","}"]
+],[
+   "no_regex",
+  ["paren.rparen","}"],
+  ["text","   "]
+],[
+   "no_regex"
+],[
+   "start",
+  ["storage.type","var"],
+  ["text"," "],
+  ["identifier","greeter"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["keyword","new"],
+  ["text"," "],
+  ["identifier","Greeter"],
+  ["paren.lparen","("],
+  ["string","\"world\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "start"
+],[
+   "no_regex",
+  ["storage.type","var"],
+  ["text"," "],
+  ["identifier","button"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["variable.language","document"],
+  ["punctuation.operator","."],
+  ["support.function.dom","createElement"],
+  ["paren.lparen","("],
+  ["string","'button'"],
+  ["paren.rparen",")"]
+],[
+   "no_regex",
+  ["identifier","button"],
+  ["punctuation.operator","."],
+  ["identifier","innerText"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["string","\"Say Hello\""]
+],[
+   "start",
+  ["storage.type","button"],
+  ["punctuation.operator","."],
+  ["entity.name.function","onclick"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["storage.type","function"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "no_regex",
+  ["text","\t"],
+  ["support.function","alert"],
+  ["paren.lparen","("],
+  ["entity.name.function.ts","greeter.greet"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["paren.rparen",")"]
+],[
+   "no_regex",
+  ["paren.rparen","}"]
+],[
+   "no_regex"
+],[
+   "no_regex",
+  ["variable.language","document"],
+  ["punctuation.operator","."],
+  ["identifier","body"],
+  ["punctuation.operator","."],
+  ["support.function.dom","appendChild"],
+  ["paren.lparen","("],
+  ["identifier","button"],
+  ["paren.rparen",")"]
+],[
+   "no_regex"
+],[
+   "start",
+  ["keyword","class"],
+  ["text"," "],
+  ["identifier","Snake"],
+  ["text"," "],
+  ["keyword","extends"],
+  ["text"," "],
+  ["identifier","Animal"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","   "],
+  ["entity.name.function.ts","move"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","       "],
+  ["support.function","alert"],
+  ["paren.lparen","("],
+  ["string","\"Slithering...\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","       "],
+  ["storage.type.variable.ts","super"],
+  ["text","("],
+  ["keyword.other.ts","5"],
+  ["text",")"],
+  ["punctuation.operator",";"]
+],[
+   "no_regex",
+  ["text","   "],
+  ["paren.rparen","}"]
+],[
+   "no_regex",
+  ["paren.rparen","}"]
+],[
+   "no_regex"
+],[
+   "start",
+  ["keyword","class"],
+  ["text"," "],
+  ["identifier","Horse"],
+  ["text"," "],
+  ["keyword","extends"],
+  ["text"," "],
+  ["identifier","Animal"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","   "],
+  ["entity.name.function.ts","move"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","       "],
+  ["support.function","alert"],
+  ["paren.lparen","("],
+  ["string","\"Galloping...\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","       "],
+  ["keyword.operator.ts","super"],
+  ["punctuation.operator","."],
+  ["identifier","move"],
+  ["paren.lparen","("],
+  ["constant.numeric","45"],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "no_regex",
+  ["text","   "],
+  ["paren.rparen","}"]
+],[
+   "no_regex",
+  ["paren.rparen","}"]
+],[
+   "no_regex"
+],[
+   "start",
+  ["identifier","module"],
+  ["text"," "],
+  ["identifier","Sayings"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword.operator.ts","export"],
+  ["text"," "],
+  ["keyword.operator.ts","class"],
+  ["text"," "],
+  ["identifier","Greeter"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","        "],
+  ["variable.parameter.function.ts","greeting"],
+  ["text",": "],
+  ["variable.parameter.function.ts","string"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword.operator.ts","constructor"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter.function.ts","message"],
+  ["text",": "],
+  ["variable.parameter.function.ts","string"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","            "],
+  ["storage.type.variable.ts","this."],
+  ["identifier","greeting"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","message"],
+  ["punctuation.operator",";"]
+],[
+   "no_regex",
+  ["text","        "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","        "],
+  ["identifier","greet"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","            "],
+  ["keyword","return"],
+  ["text"," "],
+  ["string","\"Hello, \""],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["storage.type.variable.ts","this."],
+  ["identifier","greeting"],
+  ["punctuation.operator",";"]
+],[
+   "no_regex",
+  ["text","        "],
+  ["paren.rparen","}"]
+],[
+   "no_regex",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "no_regex",
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["identifier","module"],
+  ["text"," "],
+  ["identifier","Mankala"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","   "],
+  ["keyword.operator.ts","export"],
+  ["text"," "],
+  ["keyword.operator.ts","class"],
+  ["text"," "],
+  ["identifier","Features"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","       "],
+  ["keyword.operator.ts","public"],
+  ["text"," "],
+  ["identifier","turnContinues"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.language.boolean","false"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","       "],
+  ["keyword.operator.ts","public"],
+  ["text"," "],
+  ["identifier","seedStoredCount"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","       "],
+  ["keyword.operator.ts","public"],
+  ["text"," "],
+  ["identifier","capturedCount"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","       "],
+  ["keyword.operator.ts","public"],
+  ["text"," "],
+  ["identifier","spaceCaptured"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","NoSpace"],
+  ["punctuation.operator",";"]
+],[
+   "start"
+],[
+   "start",
+  ["text","       "],
+  ["keyword.operator.ts","public"],
+  ["text"," "],
+  ["entity.name.function.ts","clear"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","           "],
+  ["storage.type.variable.ts","this."],
+  ["identifier","turnContinues"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.language.boolean","false"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","           "],
+  ["storage.type.variable.ts","this."],
+  ["identifier","seedStoredCount"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","           "],
+  ["storage.type.variable.ts","this."],
+  ["identifier","capturedCount"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","           "],
+  ["storage.type.variable.ts","this."],
+  ["identifier","spaceCaptured"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","NoSpace"],
+  ["punctuation.operator",";"]
+],[
+   "no_regex",
+  ["text","       "],
+  ["paren.rparen","}"]
+],[
+   "no_regex"
+],[
+   "start",
+  ["text","       "],
+  ["keyword","public"],
+  ["text"," "],
+  ["identifier","toString"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","           "],
+  ["storage.type","var"],
+  ["text"," "],
+  ["identifier","stringBuilder"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["string","\"\""],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","           "],
+  ["keyword","if"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["storage.type.variable.ts","this."],
+  ["identifier","turnContinues"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","               "],
+  ["identifier","stringBuilder"],
+  ["text"," "],
+  ["keyword.operator","+="],
+  ["text"," "],
+  ["string","\" turn continues,\""],
+  ["punctuation.operator",";"]
+],[
+   "no_regex",
+  ["text","           "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","           "],
+  ["identifier","stringBuilder"],
+  ["text"," "],
+  ["keyword.operator","+="],
+  ["text"," "],
+  ["string","\" stores \""],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["storage.type.variable.ts","this."],
+  ["identifier","seedStoredCount"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","           "],
+  ["keyword","if"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["storage.type.variable.ts","this."],
+  ["identifier","capturedCount"],
+  ["text"," "],
+  ["keyword.operator",">"],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","               "],
+  ["identifier","stringBuilder"],
+  ["text"," "],
+  ["keyword.operator","+="],
+  ["text"," "],
+  ["string","\" captures \""],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["storage.type.variable.ts","this."],
+  ["identifier","capturedCount"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["string","\" from space \""],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["storage.type.variable.ts","this."],
+  ["identifier","spaceCaptured"],
+  ["punctuation.operator",";"]
+],[
+   "no_regex",
+  ["text","           "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","           "],
+  ["keyword","return"],
+  ["text"," "],
+  ["identifier","stringBuilder"],
+  ["punctuation.operator",";"]
+],[
+   "no_regex",
+  ["text","       "],
+  ["paren.rparen","}"]
+],[
+   "no_regex",
+  ["text","   "],
+  ["paren.rparen","}"]
+],[
+   "no_regex",
+  ["paren.rparen","}"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_vbscript.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_vbscript.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_vbscript.json
new file mode 100644
index 0000000..6a2346d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_vbscript.json
@@ -0,0 +1,249 @@
+[[
+   "start",
+  ["text","myfilename "],
+  ["keyword.operator.asp","="],
+  ["text"," "],
+  ["punctuation.definition.string.begin.asp","\""],
+  ["string.quoted.double.asp","C:\\Wikipedia - VBScript - Example - Hello World.txt\""]
+],[
+   "start"
+],[
+   "start",
+  ["text","MakeHelloWorldFile myfilename"]
+],[
+   "start"
+],[
+   "state_4",
+  ["meta.leading-space"," "]
+],[
+   "state_4"
+],[
+   "start",
+  ["storage.type.function.asp","Sub"],
+  ["text"," "],
+  ["entity.name.function.asp","MakeHelloWorldFile"],
+  ["text"," "],
+  ["punctuation.definition.parameters.asp","("],
+  ["variable.parameter.function.asp","FileName"],
+  ["punctuation.definition.parameters.asp",")"]
+],[
+   "start"
+],[
+   "start",
+  ["punctuation.definition.comment.asp","'"],
+  ["comment.line.apostrophe.asp","Create a new file in C: drive or overwrite existing file"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.odd-tab.spaces","  "],
+  ["meta.leading-space"," "],
+  ["storage.type.asp","Set"],
+  ["text"," FSO "],
+  ["keyword.operator.asp","="],
+  ["text"," "],
+  ["support.function.asp","CreateObject"],
+  ["text","("],
+  ["punctuation.definition.string.begin.asp","\""],
+  ["string.quoted.double.asp","Scripting.FileSystemObject\""],
+  ["text",")"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.odd-tab.spaces","  "],
+  ["meta.leading-space"," "],
+  ["keyword.control.asp","If"],
+  ["text"," FSO."],
+  ["entity.name.function.asp","FileExists"],
+  ["text","(FileName) "],
+  ["keyword.control.asp","Then"],
+  ["text"," "]
+],[
+   "start"
+],[
+   "start",
+  ["meta.odd-tab.spaces","  "],
+  ["meta.even-tab.spaces","  "],
+  ["meta.odd-tab.spaces","  "],
+  ["text","Answer "],
+  ["keyword.operator.asp","="],
+  ["text"," "],
+  ["support.function.vb.asp","MsgBox"],
+  ["text"," ("],
+  ["punctuation.definition.string.begin.asp","\""],
+  ["string.quoted.double.asp","File \""],
+  ["text"," "],
+  ["keyword.operator.asp","&"],
+  ["text"," FileName "],
+  ["keyword.operator.asp","&"],
+  ["text"," "],
+  ["punctuation.definition.string.begin.asp","\""],
+  ["string.quoted.double.asp"," exists ... OK to overwrite?\""],
+  ["text",", vbOKCancel)"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.odd-tab.spaces","  "],
+  ["meta.even-tab.spaces","  "],
+  ["meta.odd-tab.spaces","  "],
+  ["punctuation.definition.comment.asp","'"],
+  ["comment.line.apostrophe.asp","If button selected is not OK, then quit now"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.odd-tab.spaces","  "],
+  ["meta.even-tab.spaces","  "],
+  ["meta.odd-tab.spaces","  "],
+  ["punctuation.definition.comment.asp","'"],
+  ["comment.line.apostrophe.asp","vbOK is a language constant"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.odd-tab.spaces","  "],
+  ["meta.even-tab.spaces","  "],
+  ["meta.odd-tab.spaces","  "],
+  ["keyword.control.asp","If"],
+  ["text"," Answer "],
+  ["keyword.operator.asp","<>"],
+  ["text"," vbOK "],
+  ["keyword.control.asp","Then"],
+  ["text"," "],
+  ["keyword.control.asp","Exit Sub"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.odd-tab.spaces","  "],
+  ["meta.leading-space"," "],
+  ["keyword.control.asp","Else"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.odd-tab.spaces","  "],
+  ["meta.even-tab.spaces","  "],
+  ["meta.odd-tab.spaces","  "],
+  ["punctuation.definition.comment.asp","'"],
+  ["comment.line.apostrophe.asp","Confirm OK to create"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.odd-tab.spaces","  "],
+  ["meta.even-tab.spaces","  "],
+  ["meta.odd-tab.spaces","  "],
+  ["text","Answer "],
+  ["keyword.operator.asp","="],
+  ["text"," "],
+  ["support.function.vb.asp","MsgBox"],
+  ["text"," ("],
+  ["punctuation.definition.string.begin.asp","\""],
+  ["string.quoted.double.asp","File \""],
+  ["text"," "],
+  ["keyword.operator.asp","&"],
+  ["text"," FileName "],
+  ["keyword.operator.asp","&"],
+  ["text"," "],
+  ["punctuation.definition.string.begin.asp","\""],
+  ["string.quoted.double.asp"," ... OK to create?\""],
+  ["text",", vbOKCancel)"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.odd-tab.spaces","  "],
+  ["meta.even-tab.spaces","  "],
+  ["meta.odd-tab.spaces","  "],
+  ["keyword.control.asp","If"],
+  ["text"," Answer "],
+  ["keyword.operator.asp","<>"],
+  ["text"," vbOK "],
+  ["keyword.control.asp","Then"],
+  ["text"," "],
+  ["keyword.control.asp","Exit Sub"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.odd-tab.spaces","  "],
+  ["meta.leading-space"," "],
+  ["keyword.control.asp","End If"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.odd-tab.spaces","  "],
+  ["meta.leading-space"," "],
+  ["punctuation.definition.comment.asp","'"],
+  ["comment.line.apostrophe.asp","Create new file (or replace an existing file)"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.odd-tab.spaces","  "],
+  ["meta.leading-space"," "],
+  ["storage.type.asp","Set"],
+  ["text"," FileObject "],
+  ["keyword.operator.asp","="],
+  ["text"," FSO.CreateTextFile (FileName)"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.odd-tab.spaces","  "],
+  ["meta.leading-space"," "],
+  ["text","FileObject.WriteLine "],
+  ["punctuation.definition.string.begin.asp","\""],
+  ["string.quoted.double.asp","Time ... \""],
+  ["text"," "],
+  ["keyword.operator.asp","&"],
+  ["text"," "],
+  ["support.function.vb.asp","Now"],
+  ["text","()"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.odd-tab.spaces","  "],
+  ["meta.leading-space"," "],
+  ["text","FileObject.WriteLine "],
+  ["punctuation.definition.string.begin.asp","\""],
+  ["string.quoted.double.asp","Hello World\""]
+],[
+   "start"
+],[
+   "start",
+  ["meta.odd-tab.spaces","  "],
+  ["meta.leading-space"," "],
+  ["text","FileObject."],
+  ["entity.name.function.asp","Close"],
+  ["text","()"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.odd-tab.spaces","  "],
+  ["meta.leading-space"," "],
+  ["support.function.vb.asp","MsgBox"],
+  ["text"," "],
+  ["punctuation.definition.string.begin.asp","\""],
+  ["string.quoted.double.asp","File \""],
+  ["text"," "],
+  ["keyword.operator.asp","&"],
+  ["text"," FileName "],
+  ["keyword.operator.asp","&"],
+  ["text"," "],
+  ["punctuation.definition.string.begin.asp","\""],
+  ["string.quoted.double.asp"," ... updated.\""]
+],[
+   "start"
+],[
+   "start",
+  ["support.function.asp","End"],
+  ["text"," "],
+  ["storage.type.asp","Sub"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_velocity.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_velocity.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_velocity.json
new file mode 100644
index 0000000..3eb7a9a
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_velocity.json
@@ -0,0 +1,281 @@
+[[
+   "vm_comment",
+  ["comment.block","#*"]
+],[
+   "vm_comment",
+  ["comment","  This is a sample comment block that"]
+],[
+   "vm_comment",
+  ["comment","  spans multiple lines."]
+],[
+   "start",
+  ["comment","*#"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","#macro"],
+  ["text"," "],
+  ["lparen","("],
+  ["text"," "],
+  ["identifier","outputItem"],
+  ["text"," "],
+  ["variable","$item"],
+  ["text"," "],
+  ["rparen",")"]
+],[
+   "start",
+  ["text","  "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","li"],
+  ["meta.tag.punctuation.end",">"],
+  ["variable","${"],
+  ["identifier","item"],
+  ["variable","}"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","li"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["keyword","#end"]
+],[
+   "start"
+],[
+   "start",
+  ["comment","## Define the items to iterate"]
+],[
+   "start",
+  ["keyword","#set"],
+  ["text"," "],
+  ["lparen","("],
+  ["text"," "],
+  ["variable","$items"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["lparen","["],
+  ["constant.numeric","1"],
+  ["text",", "],
+  ["constant.numeric","2"],
+  ["text",", "],
+  ["constant.numeric","3"],
+  ["text",", "],
+  ["constant.numeric","4"],
+  ["rparen","]"],
+  ["text"," "],
+  ["rparen",")"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","ul"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","  "],
+  ["comment","## Iterate over the items and output the evens."]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","#foreach"],
+  ["text"," "],
+  ["lparen","("],
+  ["text"," "],
+  ["variable","$item"],
+  ["text"," "],
+  ["identifier","in"],
+  ["text"," "],
+  ["variable","$items"],
+  ["text"," "],
+  ["rparen",")"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","#if"],
+  ["text"," "],
+  ["lparen","("],
+  ["text"," "],
+  ["support.function","$_MathTool"],
+  ["text","."],
+  ["identifier","mod"],
+  ["lparen","("],
+  ["variable","$item"],
+  ["text",", "],
+  ["constant.numeric","2"],
+  ["rparen",")"],
+  ["text"," "],
+  ["keyword.operator","=="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["rparen",")"]
+],[
+   "start",
+  ["text","      "],
+  ["identifier","#outputItem"],
+  ["text"," "],
+  ["lparen","("],
+  ["variable","$item"],
+  ["rparen",")"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","#end"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","#end"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","ul"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "js-start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.script","script"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "js-comment_regex_allowed",
+  ["text","  "],
+  ["comment","/*"]
+],[
+   "js-comment_regex_allowed",
+  ["comment","    A sample function to decomstrate"]
+],[
+   "js-comment_regex_allowed",
+  ["comment","    JavaScript highlighting and folding."]
+],[
+   "js-start",
+  ["comment","  */"]
+],[
+   "js-start",
+  ["text","  "],
+  ["storage.type","function"],
+  ["text"," "],
+  ["entity.name.function","foo"],
+  ["paren.lparen","("],
+  ["variable.parameter","items"],
+  ["punctuation.operator",", "],
+  ["variable.parameter","nada"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "js-start",
+  ["text","    "],
+  ["keyword","for"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["storage.type","var"],
+  ["text"," "],
+  ["identifier","i"],
+  ["keyword.operator","="],
+  ["constant.numeric","0"],
+  ["punctuation.operator",";"],
+  ["text"," "],
+  ["identifier","i"],
+  ["keyword.operator","<"],
+  ["identifier","items"],
+  ["punctuation.operator","."],
+  ["support.constant","length"],
+  ["punctuation.operator",";"],
+  ["text"," "],
+  ["identifier","i"],
+  ["keyword.operator","++"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "js-start",
+  ["text","      "],
+  ["support.function","alert"],
+  ["paren.lparen","("],
+  ["identifier","items"],
+  ["paren.lparen","["],
+  ["identifier","i"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["string","\"juhu"],
+  ["constant.language.escape","\\n"],
+  ["string","\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "js-no_regex",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "js-no_regex",
+  ["text","  "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.script","script"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "css-start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.style","style"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   ["css-comment","css-start"],
+  ["text","  "],
+  ["comment","/*"]
+],[
+   ["css-comment","css-start"],
+  ["comment","    A sample style to decomstrate"]
+],[
+   ["css-comment","css-start"],
+  ["comment","    CSS highlighting and folding."]
+],[
+   "css-start",
+  ["comment","  */"]
+],[
+   ["css-ruleset","css-start"],
+  ["text","  "],
+  ["variable",".class"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   ["css-ruleset","css-start"],
+  ["text","    "],
+  ["support.type","font-family"],
+  ["text",": Monaco, "],
+  ["string","\"Courier New\""],
+  ["text",", "],
+  ["support.constant.fonts","monospace"],
+  ["text",";"]
+],[
+   ["css-ruleset","css-start"],
+  ["text","    "],
+  ["support.type","font-size"],
+  ["text",": "],
+  ["constant.numeric","12"],
+  ["keyword","px"],
+  ["text",";"]
+],[
+   ["css-ruleset","css-start"],
+  ["text","    "],
+  ["support.type","cursor"],
+  ["text",": "],
+  ["support.constant","text"],
+  ["text",";"]
+],[
+   "css-start",
+  ["text","  "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.style","style"],
+  ["meta.tag.punctuation.end",">"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_xml.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_xml.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_xml.json
new file mode 100644
index 0000000..70f7309
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_xml.json
@@ -0,0 +1,43 @@
+[[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","Juhu"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","//Juhu Kinners"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","Kinners"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","test: two tags in the same lines should be in separate tokens\""]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","Juhu"],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","Kinners"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","test: multiline attributes\""]
+],[
+   ["qqstring_inner","meta.tag.punctuation.begin"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","copy"],
+  ["text"," "],
+  ["entity.other.attribute-name","set"],
+  ["keyword.operator.separator","="],
+  ["string","\"{"]
+],[
+   ["qqstring_inner","meta.tag.punctuation.begin"],
+  ["string","}\""],
+  ["text"," "],
+  ["entity.other.attribute-name","undo"],
+  ["keyword.operator.separator","="],
+  ["string","\"{"]
+],[
+   "start",
+  ["string","}\""],
+  ["meta.tag.punctuation.end","/>"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_xquery.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_xquery.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_xquery.json
new file mode 100644
index 0000000..aaf9ab9
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_xquery.json
@@ -0,0 +1,44 @@
+[[
+   "[\"start\"]",
+  ["keyword","xquery"],
+  ["text"," "],
+  ["keyword","version"],
+  ["text"," "],
+  ["string","\""],
+  ["string","1.0"],
+  ["string","\""],
+  ["text",";"]
+],[
+   "[\"start\"]"
+],[
+   "[\"start\"]",
+  ["keyword","let"],
+  ["text"," "],
+  ["variable","$message"],
+  ["text"," "],
+  ["keyword.operator",":="],
+  ["text"," "],
+  ["string","\""],
+  ["string","Hello World!"],
+  ["string","\""]
+],[
+   "[\"start\",\"StartTag\",\"TagContent\"]",
+  ["keyword","return"],
+  ["text"," "],
+  ["meta.tag","<results"],
+  ["meta.tag",">"]
+],[
+   "[\"start\",\"StartTag\",\"TagContent\"]",
+  ["text","  "],
+  ["meta.tag","<message"],
+  ["meta.tag",">"],
+  ["text","{"],
+  ["variable","$message"],
+  ["text","}"],
+  ["meta.tag","</message>"]
+],[
+   "[\"start\"]",
+  ["meta.tag","</results>"]
+],[
+   "[\"start\"]"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_yaml.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_yaml.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_yaml.json
new file mode 100644
index 0000000..7c9b45f
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_yaml.json
@@ -0,0 +1,150 @@
+[[
+   "start",
+  ["comment","# This sample document was taken from wikipedia:"]
+],[
+   "start",
+  ["comment","# http://en.wikipedia.org/wiki/YAML#Sample_document"]
+],[
+   "start",
+  ["list.markup","---"]
+],[
+   "start",
+  ["meta.tag","receipt"],
+  ["keyword",":     "],
+  ["text","Oz-Ware Purchase Invoice"]
+],[
+   "start",
+  ["meta.tag","date"],
+  ["keyword",":        "],
+  ["constant.numeric","2007-08-06"]
+],[
+   "start",
+  ["meta.tag","customer"],
+  ["keyword",":"]
+],[
+   "start",
+  ["meta.tag","    given"],
+  ["keyword",":   "],
+  ["text","Dorothy"]
+],[
+   "start",
+  ["meta.tag","    family"],
+  ["keyword",":  "],
+  ["text","Gale"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag","items"],
+  ["keyword",":"]
+],[
+   "start",
+  ["list.markup","    - "],
+  ["meta.tag","part_no"],
+  ["keyword",":   "],
+  ["string","'A4786'"]
+],[
+   "start",
+  ["meta.tag","      descrip"],
+  ["keyword",":   "],
+  ["text","Water Bucket "],
+  ["paren.lparen","("],
+  ["text","Filled"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["meta.tag","      price"],
+  ["keyword",":     "],
+  ["constant.numeric","1.47"]
+],[
+   "start",
+  ["meta.tag","      quantity"],
+  ["keyword",":  "],
+  ["constant.numeric","4"]
+],[
+   "start"
+],[
+   "start",
+  ["list.markup","    - "],
+  ["meta.tag","part_no"],
+  ["keyword",":   "],
+  ["string","'E1628'"]
+],[
+   "start",
+  ["meta.tag","      descrip"],
+  ["keyword",":   "],
+  ["text","High Heeled "],
+  ["string","\"Ruby\""],
+  ["text"," Slippers"]
+],[
+   "start",
+  ["meta.tag","      size"],
+  ["keyword",":      "],
+  ["constant.numeric","8"]
+],[
+   "start",
+  ["meta.tag","      price"],
+  ["keyword",":     "],
+  ["constant.numeric","100.27"]
+],[
+   "start",
+  ["meta.tag","      quantity"],
+  ["keyword",":  "],
+  ["constant.numeric","1"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag","bill-to"],
+  ["keyword",":  "],
+  ["constant.language","&id001"]
+],[
+   "qqstring",
+  ["meta.tag","    street"],
+  ["keyword",": "],
+  ["string","|"]
+],[
+   "qqstring",
+  ["string","            123 Tornado Alley"]
+],[
+   "qqstring",
+  ["string","            Suite 16"]
+],[
+   "start",
+  ["meta.tag","    city"],
+  ["keyword",":   "],
+  ["text","East Centerville"]
+],[
+   "start",
+  ["meta.tag","    state"],
+  ["keyword",":  "],
+  ["text","KS"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag","ship-to"],
+  ["keyword",":  "],
+  ["constant.language","*id001"]
+],[
+   "start"
+],[
+   "qqstring",
+  ["meta.tag","specialDelivery"],
+  ["keyword",":  "],
+  ["string",">"]
+],[
+   "qqstring",
+  ["string","    Follow the Yellow Brick"]
+],[
+   "qqstring",
+  ["string","    Road to the Emerald City."]
+],[
+   "qqstring",
+  ["string","    Pay no attention to the"]
+],[
+   "qqstring",
+  ["string","    man behind the curtain."]
+],[
+   "qqstring"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/abap.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/abap.js b/src/fauxton/assets/js/libs/ace/mode/abap.js
new file mode 100644
index 0000000..6ec54c0
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/abap.js
@@ -0,0 +1,77 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var Tokenizer = require("../tokenizer").Tokenizer;
+var Rules = require("./abap_highlight_rules").AbapHighlightRules;
+var FoldMode = require("./folding/coffee").FoldMode;
+var Range = require("../range").Range;
+var TextMode = require("./text").Mode;
+var oop = require("../lib/oop");
+
+function Mode() {
+    this.HighlightRules = Rules;
+    this.foldingRules = new FoldMode();
+}
+
+oop.inherits(Mode, TextMode);
+
+(function() {
+    
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+        return indent;
+    };
+    
+    this.toggleCommentLines = function(state, doc, startRow, endRow){
+        var range = new Range(0, 0, 0, 0);
+        for (var i = startRow; i <= endRow; ++i) {
+            var line = doc.getLine(i);
+            if (hereComment.test(line))
+                continue;
+                
+            if (commentLine.test(line))
+                line = line.replace(commentLine, '$1');
+            else
+                line = line.replace(indentation, '$&#');
+    
+            range.end.row = range.start.row = i;
+            range.end.column = line.length + 1;
+            doc.replace(range, line);
+        }
+    };
+    
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/abap_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/abap_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/abap_highlight_rules.js
new file mode 100644
index 0000000..6b232c9
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/abap_highlight_rules.js
@@ -0,0 +1,134 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ * based on
+ * " Vim ABAP syntax file
+ * "    Language: SAP - ABAP/R4
+ * "    Revision: 2.1
+ * "  Maintainer: Marius Piedallu van Wyk <la...@gmail.com>
+ * " Last Change: 2012 Oct 23
+ */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var AbapHighlightRules = function() {
+
+    var keywordMapper = this.createKeywordMapper({
+        "variable.language": "this",
+        "keyword": 
+            "ADD ALIAS ALIASES ASSERT ASSIGN ASSIGNING AT BACK" +
+            " CALL CASE CATCH CHECK CLASS CLEAR CLOSE CNT COLLECT COMMIT COMMUNICATION COMPUTE CONCATENATE CONDENSE CONSTANTS CONTINUE CONTROLS CONVERT CREATE CURRENCY" +
+            " DATA DEFINE DEFINITION DEFERRED DELETE DESCRIBE DETAIL DIVIDE DO" +
+            " ELSE ELSEIF ENDAT ENDCASE ENDCLASS ENDDO ENDEXEC ENDFORM ENDFUNCTION ENDIF ENDIFEND ENDINTERFACE ENDLOOP ENDMETHOD ENDMODULE ENDON ENDPROVIDE ENDSELECT ENDTRY ENDWHILE EVENT EVENTS EXEC EXIT EXPORT EXPORTING EXTRACT" +
+            " FETCH FIELDS FORM FORMAT FREE FROM FUNCTION" +
+            " GENERATE GET" +
+            " HIDE" +
+            " IF IMPORT IMPORTING INDEX INFOTYPES INITIALIZATION INTERFACE INTERFACES INPUT INSERT IMPLEMENTATION" +
+            " LEAVE LIKE LINE LOAD LOCAL LOOP" +
+            " MESSAGE METHOD METHODS MODIFY MODULE MOVE MULTIPLY" +
+            " ON OVERLAY OPTIONAL OTHERS" +
+            " PACK PARAMETERS PERFORM POSITION PROGRAM PROVIDE PUT" +
+            " RAISE RANGES READ RECEIVE RECEIVING REDEFINITION REFERENCE REFRESH REJECT REPLACE REPORT RESERVE RESTORE RETURNING ROLLBACK" +
+            " SCAN SCROLL SEARCH SELECT SET SHIFT SKIP SORT SORTED SPLIT STANDARD STATICS STEP STOP SUBMIT SUBTRACT SUM SUMMARY SUPPRESS" +
+            " TABLES TIMES TRANSFER TRANSLATE TRY TYPE TYPES" +
+            " UNASSIGN ULINE UNPACK UPDATE" +
+            " WHEN WHILE WINDOW WRITE" +
+            " OCCURS STRUCTURE OBJECT PROPERTY" +
+            " CASTING APPEND RAISING VALUE COLOR" +
+            " CHANGING EXCEPTION EXCEPTIONS DEFAULT CHECKBOX COMMENT" +
+            " ID NUMBER FOR TITLE OUTPUT" +
+            " WITH EXIT USING" +
+            " INTO WHERE GROUP BY HAVING ORDER BY SINGLE" +
+            " APPENDING CORRESPONDING FIELDS OF TABLE" +
+            " LEFT RIGHT OUTER INNER JOIN AS CLIENT SPECIFIED BYPASSING BUFFER UP TO ROWS CONNECTING" +
+            " EQ NE LT LE GT GE NOT AND OR XOR IN LIKE BETWEEN",
+        "constant.language": 
+            "TRUE FALSE NULL SPACE",
+        "support.type": 
+            "c n i p f d t x string xstring decfloat16 decfloat34",
+        "keyword.operator":
+            "abs sign ceil floor trunc frac acos asin atan cos sin tan" +
+            " abapOperator cosh sinh tanh exp log log10 sqrt" +
+            " strlen xstrlen charlen numofchar dbmaxlen lines" 
+    }, "text", true, " ");
+
+    var compoundKeywords = "WITH\\W+(?:HEADER\\W+LINE|FRAME|KEY)|NO\\W+STANDARD\\W+PAGE\\W+HEADING|"+
+        "EXIT\\W+FROM\\W+STEP\\W+LOOP|BEGIN\\W+OF\\W+(?:BLOCK|LINE)|BEGIN\\W+OF|"+
+        "END\\W+OF\\W+(?:BLOCK|LINE)|END\\W+OF|NO\\W+INTERVALS|"+
+        "RESPECTING\\W+BLANKS|SEPARATED\\W+BY|USING\\W+(?:EDIT\\W+MASK)|"+
+        "WHERE\\W+(?:LINE)|RADIOBUTTON\\W+GROUP|REF\\W+TO|"+
+        "(?:PUBLIC|PRIVATE|PROTECTED)(?:\\W+SECTION)?|DELETING\\W+(?:TRAILING|LEADING)"+
+        "(?:ALL\\W+OCCURRENCES)|(?:FIRST|LAST)\\W+OCCURRENCE|INHERITING\\W+FROM|"+
+        "LINE-COUNT|ADD-CORRESPONDING|AUTHORITY-CHECK|BREAK-POINT|CLASS-DATA|CLASS-METHODS|"+
+        "CLASS-METHOD|DIVIDE-CORRESPONDING|EDITOR-CALL|END-OF-DEFINITION|END-OF-PAGE|END-OF-SELECTION|"+
+        "FIELD-GROUPS|FIELD-SYMBOLS|FUNCTION-POOL|MOVE-CORRESPONDING|MULTIPLY-CORRESPONDING|NEW-LINE|"+
+        "NEW-PAGE|NEW-SECTION|PRINT-CONTROL|RP-PROVIDE-FROM-LAST|SELECT-OPTIONS|SELECTION-SCREEN|"+
+        "START-OF-SELECTION|SUBTRACT-CORRESPONDING|SYNTAX-CHECK|SYNTAX-TRACE|TOP-OF-PAGE|TYPE-POOL|"+
+        "TYPE-POOLS|LINE-SIZE|LINE-COUNT|MESSAGE-ID|DISPLAY-MODE|READ(?:-ONLY)?|"+
+        "IS\\W+(?:NOT\\W+)?(?:ASSIGNED|BOUND|INITIAL|SUPPLIED)";
+     
+    this.$rules = {
+        "start" : [
+            {token : "string", regex : "`", next  : "string"},
+            {token : "string", regex : "'", next  : "qstring"},
+            {token : "doc.comment", regex : /^\*.+/},
+            {token : "comment",  regex : /".+$/},
+            {token : "invalid", regex: "\\.{2,}"},
+            {token : "keyword.operator", regex: /\W[\-+\%=<>*]\W|\*\*|[~:,\.&$]|->*?|=>/},
+            {token : "paren.lparen", regex : "[\\[({]"},
+            {token : "paren.rparen", regex : "[\\])}]"},
+            {token : "constant.numeric", regex: "[+-]?\\d+\\b"},
+            {token : "variable.parameter", regex : /sy|pa?\d\d\d\d\|t\d\d\d\.|innnn/}, 
+            {token : "keyword", regex : compoundKeywords}, 
+            {token : "variable.parameter", regex : /\w+-\w+(?:-\w+)*/}, 
+            {token : keywordMapper, regex : "\\b\\w+\\b"},
+            {caseInsensitive: true}
+        ],
+        "qstring" : [
+            {token : "constant.language.escape",   regex : "''"},
+            {token : "string", regex : "'",     next  : "start"},
+            {defaultToken : "string"}
+        ],
+        "string" : [
+            {token : "constant.language.escape",   regex : "``"},
+            {token : "string", regex : "`",     next  : "start"},
+            {defaultToken : "string"}
+        ]
+    }
+};
+oop.inherits(AbapHighlightRules, TextHighlightRules);
+
+exports.AbapHighlightRules = AbapHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/actionscript.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/actionscript.js b/src/fauxton/assets/js/libs/ace/mode/actionscript.js
new file mode 100644
index 0000000..47b9345
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/actionscript.js
@@ -0,0 +1,62 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ *
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var ActionScriptHighlightRules = require("./actionscript_highlight_rules").ActionScriptHighlightRules;
+// TODO: pick appropriate fold mode
+var FoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = ActionScriptHighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = "//";
+    this.blockComment = {start: "/*", end: "*/"};
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file


[50/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/autocomplete.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/autocomplete.js b/src/fauxton/assets/js/libs/ace/autocomplete.js
new file mode 100644
index 0000000..5b9312f
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/autocomplete.js
@@ -0,0 +1,350 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var HashHandler = require("./keyboard/hash_handler").HashHandler;
+var AcePopup = require("./autocomplete/popup").AcePopup;
+var util = require("./autocomplete/util");
+var event = require("./lib/event");
+var lang = require("./lib/lang");
+var snippetManager = require("./snippets").snippetManager;
+
+var Autocomplete = function() {
+    this.keyboardHandler = new HashHandler();
+    this.keyboardHandler.bindKeys(this.commands);
+
+    this.blurListener = this.blurListener.bind(this);
+    this.changeListener = this.changeListener.bind(this);
+    this.mousedownListener = this.mousedownListener.bind(this);
+    this.mousewheelListener = this.mousewheelListener.bind(this);
+    
+    this.changeTimer = lang.delayedCall(function() {
+        this.updateCompletions(true);
+    }.bind(this))
+};
+
+(function() {
+    this.$init = function() {
+        this.popup = new AcePopup(document.body || document.documentElement);
+        this.popup.on("click", function(e) {
+            this.insertMatch();
+            e.stop();
+        }.bind(this));
+    };
+
+    this.openPopup = function(editor, prefix, keepPopupPosition) {
+        if (!this.popup)
+            this.$init();
+
+        this.popup.setData(this.completions.filtered);
+
+        var renderer = editor.renderer;
+        if (!keepPopupPosition) {
+            this.popup.setFontSize(editor.getFontSize());
+
+            var lineHeight = renderer.layerConfig.lineHeight;
+            
+            var pos = renderer.$cursorLayer.getPixelPosition(this.base, true);            
+            pos.left -= this.popup.getTextLeftOffset();
+            
+            var rect = editor.container.getBoundingClientRect();
+            pos.top += rect.top - renderer.layerConfig.offset;
+            pos.left += rect.left;
+            pos.left += renderer.$gutterLayer.gutterWidth;
+
+            this.popup.show(pos, lineHeight);
+        }
+    };
+
+    this.detach = function() {
+        this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler);
+        this.editor.off("changeSelection", this.changeListener);
+        this.editor.off("blur", this.changeListener);
+        this.editor.off("mousedown", this.mousedownListener);
+        this.editor.off("mousewheel", this.mousewheelListener);
+        this.changeTimer.cancel();
+        
+        if (this.popup)
+            this.popup.hide();
+
+        this.activated = false;
+        this.completions = this.base = null;
+    };
+
+    this.changeListener = function(e) {
+        var cursor = this.editor.selection.lead;
+        if (cursor.row != this.base.row || cursor.column < this.base.column) {
+            this.detach();
+        }
+        if (this.activated)
+            this.changeTimer.schedule();
+        else
+            this.detach();
+    };
+
+    this.blurListener = function() {
+        if (document.activeElement != this.editor.textInput.getElement())
+            this.detach();
+    };
+
+    this.mousedownListener = function(e) {
+        this.detach();
+    };
+
+    this.mousewheelListener = function(e) {
+        this.detach();
+    };
+
+    this.goTo = function(where) {
+        var row = this.popup.getRow();
+        var max = this.popup.session.getLength() - 1;
+
+        switch(where) {
+            case "up": row = row < 0 ? max : row - 1; break;
+            case "down": row = row >= max ? -1 : row + 1; break;
+            case "start": row = 0; break;
+            case "end": row = max; break;
+        }
+
+        this.popup.setRow(row);
+    };
+
+    this.insertMatch = function(data) {
+        if (!data)
+            data = this.popup.getData(this.popup.getRow());
+        if (!data)
+            return false;
+        if (data.completer && data.completer.insertMatch) {
+            data.completer.insertMatch(this.editor);
+        } else {
+            if (this.completions.filterText) {
+                var ranges = this.editor.selection.getAllRanges();
+                for (var i = 0, range; range = ranges[i]; i++) {
+                    range.start.column -= this.completions.filterText.length;
+                    this.editor.session.remove(range);
+                }
+            }
+            if (data.snippet)
+                snippetManager.insertSnippet(this.editor, data.snippet);
+            else
+                this.editor.execCommand("insertstring", data.value || data);
+        }
+        this.detach();
+    };
+
+    this.commands = {
+        "Up": function(editor) { editor.completer.goTo("up"); },
+        "Down": function(editor) { editor.completer.goTo("down"); },
+        "Ctrl-Up|Ctrl-Home": function(editor) { editor.completer.goTo("start"); },
+        "Ctrl-Down|Ctrl-End": function(editor) { editor.completer.goTo("end"); },
+
+        "Esc": function(editor) { editor.completer.detach(); },
+        "Space": function(editor) { editor.completer.detach(); editor.insert(" ");},
+        "Return": function(editor) { editor.completer.insertMatch(); },
+        "Shift-Return": function(editor) { editor.completer.insertMatch(true); },
+        "Tab": function(editor) { editor.completer.insertMatch(); },
+
+        "PageUp": function(editor) { editor.completer.popup.gotoPageUp(); },
+        "PageDown": function(editor) { editor.completer.popup.gotoPageDown(); }
+    };
+
+    this.gatherCompletions = function(editor, callback) {
+        var session = editor.getSession();
+        var pos = editor.getCursorPosition();
+        
+        var line = session.getLine(pos.row);
+        var prefix = util.retrievePrecedingIdentifier(line, pos.column);
+        
+        this.base = editor.getCursorPosition();
+        this.base.column -= prefix.length;
+
+        var matches = [];
+        util.parForEach(editor.completers, function(completer, next) {
+            completer.getCompletions(editor, session, pos, prefix, function(err, results) {
+                if (!err)
+                    matches = matches.concat(results);
+                next();
+            });
+        }, function() {
+            callback(null, {
+                prefix: prefix,
+                matches: matches
+            });
+        });
+        return true;
+    };
+
+    this.showPopup = function(editor) {
+        if (this.editor)
+            this.detach();
+        
+        this.activated = true;
+
+        this.editor = editor;
+        if (editor.completer != this) {
+            if (editor.completer)
+                editor.completer.detach();
+            editor.completer = this;
+        }
+
+        editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
+        editor.on("changeSelection", this.changeListener);
+        editor.on("blur", this.blurListener);
+        editor.on("mousedown", this.mousedownListener);
+        editor.on("mousewheel", this.mousewheelListener);
+        
+        this.updateCompletions();
+    };
+    
+    this.updateCompletions = function(keepPopupPosition) {
+        if (keepPopupPosition && this.base && this.completions) {
+            var pos = this.editor.getCursorPosition();
+            var prefix = this.editor.session.getTextRange({start: this.base, end: pos});
+            if (prefix == this.completions.filterText)
+                return;
+            this.completions.setFilter(prefix);
+            if (!this.completions.filtered.length)
+                return this.detach();
+            this.openPopup(this.editor, prefix, keepPopupPosition);
+            return;
+        }
+        this.gatherCompletions(this.editor, function(err, results) {
+            var matches = results && results.matches;
+            if (!matches || !matches.length)
+                return this.detach();
+            // TODO reenable this when we have proper change tracking 
+            // if (matches.length == 1)
+            //     return this.insertMatch(matches[0]);
+
+            this.completions = new FilteredList(matches);
+            this.completions.setFilter(results.prefix);
+            if (!this.completions.filtered.length)
+                return this.detach();
+            this.openPopup(this.editor, results.prefix, keepPopupPosition);
+        }.bind(this));
+    };
+
+    this.cancelContextMenu = function() {
+        var stop = function(e) {
+            this.editor.off("nativecontextmenu", stop);
+            if (e && e.domEvent)
+                event.stopEvent(e.domEvent);
+        }.bind(this);
+        setTimeout(stop, 10);
+        this.editor.on("nativecontextmenu", stop);
+    };
+
+}).call(Autocomplete.prototype);
+
+Autocomplete.startCommand = {
+    name: "startAutocomplete",
+    exec: function(editor) {
+        if (!editor.completer)
+            editor.completer = new Autocomplete();
+        editor.completer.showPopup(editor);
+        // needed for firefox on mac
+        editor.completer.cancelContextMenu();
+    },
+    bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space"
+};
+
+var FilteredList = function(array, filterText, mutateData) {
+    this.all = array;
+    this.filtered = array;
+    this.filterText = filterText || "";
+};
+(function(){
+    this.setFilter = function(str) {
+        if (str.length > this.filterText && str.lastIndexOf(this.filterText, 0) === 0)
+            var matches = this.filtered;
+        else
+            var matches = this.all;
+
+        this.filterText = str;
+        matches = this.filterCompletions(matches, this.filterText);
+        matches = matches.sort(function(a, b) {
+            return b.exactMatch - a.exactMatch || b.score - a.score;
+        });
+        
+        // make unique
+        var prev = null;
+        matches = matches.filter(function(item){
+            var caption = item.value || item.caption || item.snippet; 
+            if (caption === prev) return false;
+            prev = caption;
+            return true;
+        });
+        
+        this.filtered = matches;
+    };
+    this.filterCompletions = function(items, needle) {
+        var results = [];
+        var upper = needle.toUpperCase();
+        var lower = needle.toLowerCase();
+        loop: for (var i = 0, item; item = items[i]; i++) {
+            var caption = item.value || item.caption || item.snippet;
+            if (!caption) continue;
+            var lastIndex = -1;
+            var matchMask = 0;
+            var penalty = 0;
+            var index, distance;
+            // caption char iteration is faster in Chrome but slower in Firefox, so lets use indexOf
+            for (var j = 0; j < needle.length; j++) {
+                // TODO add penalty on case mismatch
+                var i1 = caption.indexOf(lower[j], lastIndex + 1);
+                var i2 = caption.indexOf(upper[j], lastIndex + 1);
+                index = (i1 >= 0) ? ((i2 < 0 || i1 < i2) ? i1 : i2) : i2;
+                if (index < 0)
+                    continue loop;
+                distance = index - lastIndex - 1;
+                if (distance > 0) {
+                    // first char mismatch should be more sensitive
+                    if (lastIndex === -1)
+                        penalty += 10;
+                    penalty += distance;
+                }
+                matchMask = matchMask | (1 << index);
+                lastIndex = index;
+            }
+            item.matchMask = matchMask;
+            item.exactMatch = penalty ? 0 : 1;
+            item.score = (item.score || 0) - penalty;
+            results.push(item);
+        }
+        return results;
+    };
+}).call(FilteredList.prototype);
+
+exports.Autocomplete = Autocomplete;
+exports.FilteredList = FilteredList;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/autocomplete/popup.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/autocomplete/popup.js b/src/fauxton/assets/js/libs/ace/autocomplete/popup.js
new file mode 100644
index 0000000..891cf1e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/autocomplete/popup.js
@@ -0,0 +1,316 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("../edit_session").EditSession;
+var Renderer = require("../virtual_renderer").VirtualRenderer;
+var Editor = require("../editor").Editor;
+var Range = require("../range").Range;
+var event = require("../lib/event");
+var lang = require("../lib/lang");
+var dom = require("../lib/dom");
+
+var $singleLineEditor = function(el) {
+    var renderer = new Renderer(el);
+
+    renderer.$maxLines = 4;
+    
+    var editor = new Editor(renderer);
+
+    editor.setHighlightActiveLine(false);
+    editor.setShowPrintMargin(false);
+    editor.renderer.setShowGutter(false);
+    editor.renderer.setHighlightGutterLine(false);
+
+    editor.$mouseHandler.$focusWaitTimout = 0;
+
+    return editor;
+};
+
+var AcePopup = function(parentNode) {
+    var el = dom.createElement("div");
+    var popup = new $singleLineEditor(el);
+    
+    if (parentNode)
+        parentNode.appendChild(el);
+    el.style.display = "none";
+    popup.renderer.content.style.cursor = "default";
+    popup.renderer.setStyle("ace_autocomplete");
+    
+    popup.setOption("displayIndentGuides", false);
+
+    var noop = function(){};
+
+    popup.focus = noop;
+    popup.$isFocused = true;
+
+    popup.renderer.$cursorLayer.restartTimer = noop;
+    popup.renderer.$cursorLayer.element.style.opacity = 0;
+
+    popup.renderer.$maxLines = 8;
+    popup.renderer.$keepTextAreaAtCursor = false;
+
+    popup.setHighlightActiveLine(false);
+    // set default highlight color
+    popup.session.highlight("");
+    popup.session.$searchHighlight.clazz = "ace_highlight-marker";
+
+    popup.on("mousedown", function(e) {
+        var pos = e.getDocumentPosition();
+        popup.moveCursorToPosition(pos);
+        popup.selection.clearSelection();
+        selectionMarker.start.row = selectionMarker.end.row = pos.row;
+        e.stop();
+    });
+
+    var lastMouseEvent;
+    var hoverMarker = new Range(-1,0,-1,Infinity);
+    var selectionMarker = new Range(-1,0,-1,Infinity);
+    selectionMarker.id = popup.session.addMarker(selectionMarker, "ace_active-line", "fullLine");
+    popup.setSelectOnHover = function(val) {
+        if (!val) {
+            hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine");
+        } else if (hoverMarker.id) {
+            popup.session.removeMarker(hoverMarker.id);
+            hoverMarker.id = null;
+        }
+    }
+    popup.setSelectOnHover(false);
+    popup.on("mousemove", function(e) {
+        if (!lastMouseEvent) {
+            lastMouseEvent = e;
+            return;
+        }
+        if (lastMouseEvent.x == e.x && lastMouseEvent.y == e.y) {
+            return;
+        }
+        lastMouseEvent = e;
+        lastMouseEvent.scrollTop = popup.renderer.scrollTop;
+        var row = lastMouseEvent.getDocumentPosition().row;
+        if (hoverMarker.start.row != row) {
+            if (!hoverMarker.id)
+                popup.setRow(row);
+            setHoverMarker(row);
+        }
+    });
+    popup.renderer.on("beforeRender", function() {
+        if (lastMouseEvent && hoverMarker.start.row != -1) {
+            lastMouseEvent.$pos = null;
+            var row = lastMouseEvent.getDocumentPosition().row;
+            if (!hoverMarker.id)
+                popup.setRow(row);
+            setHoverMarker(row, true);
+        }
+    });
+    popup.renderer.on("afterRender", function() {
+        var row = popup.getRow();
+        var t = popup.renderer.$textLayer;
+        var selected = t.element.childNodes[row - t.config.firstRow];
+        if (selected == t.selectedNode)
+            return;
+        if (t.selectedNode)
+            dom.removeCssClass(t.selectedNode, "ace_selected");
+        t.selectedNode = selected;
+        if (selected)
+            dom.addCssClass(selected, "ace_selected");
+    });
+    var hideHoverMarker = function() { setHoverMarker(-1) };
+    var setHoverMarker = function(row, suppressRedraw) {
+        if (row !== hoverMarker.start.row) {
+            hoverMarker.start.row = hoverMarker.end.row = row;
+            if (!suppressRedraw)
+                popup.session._emit("changeBackMarker");
+            popup._emit("changeHoverMarker");
+        }
+    };
+    popup.getHoveredRow = function() {
+        return hoverMarker.start.row;
+    };
+    
+    event.addListener(popup.container, "mouseout", hideHoverMarker);
+    popup.on("hide", hideHoverMarker);
+    popup.on("changeSelection", hideHoverMarker);
+    
+    popup.session.doc.getLength = function() {
+        return popup.data.length;
+    };
+    popup.session.doc.getLine = function(i) {
+        var data = popup.data[i];
+        if (typeof data == "string")
+            return data;
+        return (data && data.value) || "";
+    };
+
+    var bgTokenizer = popup.session.bgTokenizer;
+    bgTokenizer.$tokenizeRow = function(i) {
+        var data = popup.data[i];
+        var tokens = [];
+        if (!data)
+            return tokens;
+        if (typeof data == "string")
+            data = {value: data};
+        if (!data.caption)
+            data.caption = data.value;
+
+        var last = -1;
+        var flag, c;
+        for (var i = 0; i < data.caption.length; i++) {
+            c = data.caption[i];
+            flag = data.matchMask & (1 << i) ? 1 : 0;
+            if (last !== flag) {
+                tokens.push({type: data.className || "" + ( flag ? "completion-highlight" : ""), value: c});
+                last = flag;
+            } else {
+                tokens[tokens.length - 1].value += c;
+            }
+        }
+
+        if (data.meta) {
+            var maxW = popup.renderer.$size.scrollerWidth / popup.renderer.layerConfig.characterWidth;
+            if (data.meta.length + data.caption.length < maxW - 2)
+                tokens.push({type: "rightAlignedText", value: data.meta});
+        }
+        return tokens;
+    };
+    bgTokenizer.$updateOnChange = noop;
+    bgTokenizer.start = noop;
+    
+    popup.session.$computeWidth = function() {
+        return this.screenWidth = 0;
+    }
+
+    // public
+    popup.data = [];
+    popup.setData = function(list) {
+        popup.data = list || [];
+        popup.setValue(lang.stringRepeat("\n", list.length), -1);
+        popup.setRow(0);
+    };
+    popup.getData = function(row) {
+        return popup.data[row];
+    };
+
+    popup.getRow = function() {
+        return selectionMarker.start.row;
+    };
+    popup.setRow = function(line) {
+        line = Math.max(-1, Math.min(this.data.length, line));
+        if (selectionMarker.start.row != line) {
+            popup.selection.clearSelection();
+            selectionMarker.start.row = selectionMarker.end.row = line || 0;
+            popup.session._emit("changeBackMarker");
+            popup.moveCursorTo(line || 0, 0);
+            if (popup.isOpen)
+                popup._signal("select");
+        }
+    };
+
+    popup.hide = function() {
+        this.container.style.display = "none";
+        this._signal("hide");
+        popup.isOpen = false;
+    };
+    popup.show = function(pos, lineHeight) {
+        var el = this.container;
+        var screenHeight = window.innerHeight;
+        var renderer = this.renderer;
+        // var maxLines = Math.min(renderer.$maxLines, this.session.getLength());
+        var maxH = renderer.$maxLines * lineHeight * 1.4;
+        var top = pos.top + this.$borderSize;
+        if (top + maxH > screenHeight - lineHeight) {
+            el.style.top = "";
+            el.style.bottom = screenHeight - top + "px";
+        } else {
+            top += lineHeight;
+            el.style.top = top + "px";
+            el.style.bottom = "";
+        }
+
+        el.style.left = pos.left + "px";
+        el.style.display = "";
+        this.renderer.$textLayer.checkForSizeChanges();
+
+        this._signal("show");
+        lastMouseEvent = null;
+        popup.isOpen = true;
+    };
+    
+    popup.getTextLeftOffset = function() {
+        return this.$borderSize + this.renderer.$padding + this.$imageSize;
+    };
+    
+    popup.$imageSize = 0;
+    popup.$borderSize = 1;
+
+    return popup;
+};
+
+dom.importCssString("\
+.ace_autocomplete.ace-tm .ace_marker-layer .ace_active-line {\
+    background-color: #CAD6FA;\
+    z-index: 1;\
+}\
+.ace_autocomplete.ace-tm .ace_line-hover {\
+    border: 1px solid #abbffe;\
+    margin-top: -1px;\
+    background: rgba(233,233,253,0.4);\
+}\
+.ace_autocomplete .ace_line-hover {\
+    position: absolute;\
+    z-index: 2;\
+}\
+.ace_rightAlignedText {\
+    color: gray;\
+    display: inline-block;\
+    position: absolute;\
+    right: 4px;\
+    text-align: right;\
+    z-index: -1;\
+}\
+.ace_autocomplete .ace_completion-highlight{\
+    color: #000;\
+    text-shadow: 0 0 0.01em;\
+}\
+.ace_autocomplete {\
+    width: 280px;\
+    z-index: 200000;\
+    background: #fbfbfb;\
+    color: #444;\
+    border: 1px lightgray solid;\
+    position: fixed;\
+    box-shadow: 2px 3px 5px rgba(0,0,0,.2);\
+    line-height: 1.4;\
+}");
+
+exports.AcePopup = AcePopup;
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/autocomplete/text_completer.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/autocomplete/text_completer.js b/src/fauxton/assets/js/libs/ace/autocomplete/text_completer.js
new file mode 100644
index 0000000..87a25fb
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/autocomplete/text_completer.js
@@ -0,0 +1,78 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+    var Range = require("ace/range").Range;
+    
+    var splitRegex = /[^a-zA-Z_0-9\$\-]+/;
+
+    function getWordIndex(doc, pos) {
+        var textBefore = doc.getTextRange(Range.fromPoints({row: 0, column:0}, pos));
+        return textBefore.split(splitRegex).length - 1;
+    }
+
+    /**
+     * Does a distance analysis of the word `prefix` at position `pos` in `doc`.
+     * @return Map
+     */
+    function wordDistance(doc, pos) {
+        var prefixPos = getWordIndex(doc, pos);
+        var words = doc.getValue().split(splitRegex);
+        var wordScores = Object.create(null);
+        
+        var currentWord = words[prefixPos];
+
+        words.forEach(function(word, idx) {
+            if (!word || word === currentWord) return;
+
+            var distance = Math.abs(prefixPos - idx);
+            var score = words.length - distance;
+            if (wordScores[word]) {
+                wordScores[word] = Math.max(score, wordScores[word]);
+            } else {
+                wordScores[word] = score;
+            }
+        });
+        return wordScores;
+    }
+
+    exports.getCompletions = function(editor, session, pos, prefix, callback) {
+        var wordScore = wordDistance(session, pos, prefix);
+        var wordList = Object.keys(wordScore);
+        callback(null, wordList.map(function(word) {
+            return {
+                name: word,
+                value: word,
+                score: wordScore[word],
+                meta: "local"
+            };
+        }));
+    };
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/autocomplete/util.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/autocomplete/util.js b/src/fauxton/assets/js/libs/ace/autocomplete/util.js
new file mode 100644
index 0000000..8b7c115
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/autocomplete/util.js
@@ -0,0 +1,74 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+exports.parForEach = function(array, fn, callback) {
+    var completed = 0;
+    var arLength = array.length;
+    if (arLength === 0)
+        callback();
+    for (var i = 0; i < arLength; i++) {
+        fn(array[i], function(result, err) {
+            completed++;
+            if (completed === arLength)
+                callback(result, err);
+        });
+    }
+}
+
+var ID_REGEX = /[a-zA-Z_0-9\$-]/;
+
+exports.retrievePrecedingIdentifier = function(text, pos, regex) {
+    regex = regex || ID_REGEX;
+    var buf = [];
+    for (var i = pos-1; i >= 0; i--) {
+        if (regex.test(text[i]))
+            buf.push(text[i]);
+        else
+            break;
+    }
+    return buf.reverse().join("");
+}
+
+exports.retrieveFollowingIdentifier = function(text, pos, regex) {
+    regex = regex || ID_REGEX;
+    var buf = [];
+    for (var i = pos; i < text.length; i++) {
+        if (regex.test(text[i]))
+            buf.push(text[i]);
+        else
+            break;
+    }
+    return buf;
+}
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/background_tokenizer.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/background_tokenizer.js b/src/fauxton/assets/js/libs/ace/background_tokenizer.js
new file mode 100644
index 0000000..217be1b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/background_tokenizer.js
@@ -0,0 +1,255 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("./lib/oop");
+var EventEmitter = require("./lib/event_emitter").EventEmitter;
+
+
+/**
+ * 
+ *
+ * Tokenizes the current [[Document `Document`]] in the background, and caches the tokenized rows for future use. 
+ * 
+ * If a certain row is changed, everything below that row is re-tokenized.
+ *
+ * @class BackgroundTokenizer
+ **/
+
+/**
+ * Creates a new `BackgroundTokenizer` object.
+ * @param {Tokenizer} tokenizer The tokenizer to use
+ * @param {Editor} editor The editor to associate with
+ *
+ * 
+ * 
+ * @constructor
+ **/
+
+var BackgroundTokenizer = function(tokenizer, editor) {
+    this.running = false;
+    this.lines = [];
+    this.states = [];
+    this.currentLine = 0;
+    this.tokenizer = tokenizer;
+
+    var self = this;
+
+    this.$worker = function() {
+        if (!self.running) { return; }
+
+        var workerStart = new Date();
+        var currentLine = self.currentLine;
+        var endLine = -1;
+        var doc = self.doc;
+
+        while (self.lines[currentLine])
+            currentLine++;
+
+        var startLine = currentLine;
+
+        var len = doc.getLength();
+        var processedLines = 0;
+        self.running = false;
+        while (currentLine < len) {
+            self.$tokenizeRow(currentLine);
+            endLine = currentLine;
+            do {
+                currentLine++;
+            } while (self.lines[currentLine]);
+
+            // only check every 5 lines
+            processedLines ++;
+            if ((processedLines % 5 == 0) && (new Date() - workerStart) > 20) {                
+                self.running = setTimeout(self.$worker, 20);
+                self.currentLine = currentLine;
+                return;
+            }
+        }
+        self.currentLine = currentLine;
+        
+        if (startLine <= endLine)
+            self.fireUpdateEvent(startLine, endLine);
+    };
+};
+
+(function(){
+
+    oop.implement(this, EventEmitter);
+
+    /**
+     * Sets a new tokenizer for this object.
+     *
+     * @param {Tokenizer} tokenizer The new tokenizer to use
+     *
+     **/
+    this.setTokenizer = function(tokenizer) {
+        this.tokenizer = tokenizer;
+        this.lines = [];
+        this.states = [];
+
+        this.start(0);
+    };
+
+    /**
+     * Sets a new document to associate with this object.
+     * @param {Document} doc The new document to associate with
+     **/
+    this.setDocument = function(doc) {
+        this.doc = doc;
+        this.lines = [];
+        this.states = [];
+
+        this.stop();
+    };
+
+     /**
+     * Fires whenever the background tokeniziers between a range of rows are going to be updated.
+     * 
+     * @event update
+     * @param {Object} e An object containing two properties, `first` and `last`, which indicate the rows of the region being updated.
+     *
+     **/
+    /**
+     * Emits the `'update'` event. `firstRow` and `lastRow` are used to define the boundaries of the region to be updated.
+     * @param {Number} firstRow The starting row region
+     * @param {Number} lastRow The final row region
+     *
+     **/
+    this.fireUpdateEvent = function(firstRow, lastRow) {
+        var data = {
+            first: firstRow,
+            last: lastRow
+        };
+        this._emit("update", {data: data});
+    };
+
+    /**
+     * Starts tokenizing at the row indicated.
+     *
+     * @param {Number} startRow The row to start at
+     *
+     **/
+    this.start = function(startRow) {
+        this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength());
+
+        // remove all cached items below this line
+        this.lines.splice(this.currentLine, this.lines.length);
+        this.states.splice(this.currentLine, this.states.length);
+
+        this.stop();
+        // pretty long delay to prevent the tokenizer from interfering with the user
+        this.running = setTimeout(this.$worker, 700);
+    };
+    
+    this.scheduleStart = function() {
+        if (!this.running)
+            this.running = setTimeout(this.$worker, 700);
+    }
+
+    this.$updateOnChange = function(delta) {
+        var range = delta.range;
+        var startRow = range.start.row;
+        var len = range.end.row - startRow;
+
+        if (len === 0) {
+            this.lines[startRow] = null;
+        } else if (delta.action == "removeText" || delta.action == "removeLines") {
+            this.lines.splice(startRow, len + 1, null);
+            this.states.splice(startRow, len + 1, null);
+        } else {
+            var args = Array(len + 1);
+            args.unshift(startRow, 1);
+            this.lines.splice.apply(this.lines, args);
+            this.states.splice.apply(this.states, args);
+        }
+
+        this.currentLine = Math.min(startRow, this.currentLine, this.doc.getLength());
+
+        this.stop();
+    };
+
+    /**
+     * Stops tokenizing.
+     *
+     **/
+    this.stop = function() {
+        if (this.running)
+            clearTimeout(this.running);
+        this.running = false;
+    };
+
+    /**
+     * Gives list of tokens of the row. (tokens are cached)
+     * 
+     * @param {Number} row The row to get tokens at
+     *
+     * 
+     *
+     **/
+    this.getTokens = function(row) {
+        return this.lines[row] || this.$tokenizeRow(row);
+    };
+
+    /**
+     * [Returns the state of tokenization at the end of a row.]{: #BackgroundTokenizer.getState}
+     *
+     * @param {Number} row The row to get state at
+     **/
+    this.getState = function(row) {
+        if (this.currentLine == row)
+            this.$tokenizeRow(row);
+        return this.states[row] || "start";
+    };
+
+    this.$tokenizeRow = function(row) {
+        var line = this.doc.getLine(row);
+        var state = this.states[row - 1];
+
+        var data = this.tokenizer.getLineTokens(line, state, row);
+
+        if (this.states[row] + "" !== data.state + "") {
+            this.states[row] = data.state;
+            this.lines[row + 1] = null;
+            if (this.currentLine > row + 1)
+                this.currentLine = row + 1;
+        } else if (this.currentLine == row) {
+            this.currentLine = row + 1;
+        }
+
+        return this.lines[row] = data.tokens;
+    };
+
+}).call(BackgroundTokenizer.prototype);
+
+exports.BackgroundTokenizer = BackgroundTokenizer;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/background_tokenizer_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/background_tokenizer_test.js b/src/fauxton/assets/js/libs/ace/background_tokenizer_test.js
new file mode 100644
index 0000000..7a4cc78
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/background_tokenizer_test.js
@@ -0,0 +1,85 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("./edit_session").EditSession;
+var JavaScriptMode = require("./mode/javascript").Mode;
+var Range = require("./range").Range;
+var assert = require("./test/assertions");
+
+function forceTokenize(session){
+    for (var i = 0, l = session.getLength(); i < l; i++)
+        session.getTokens(i)
+}
+
+function testStates(session, states) {
+    for (var i = 0, l = session.getLength(); i < l; i++)
+        assert.equal(session.bgTokenizer.states[i], states[i])
+    assert.ok(l == states.length)
+}
+
+module.exports = {
+
+    "test background tokenizer update on session change" : function() {
+        var doc = new EditSession([
+            "/*",
+            "*/",
+            "var juhu"
+        ]);
+        doc.setMode("./mode/javascript")  
+        
+        forceTokenize(doc)
+        testStates(doc, ["comment_regex_allowed", "start", "no_regex"])
+        
+        doc.remove(new Range(0,2,1,2))
+        testStates(doc, [null, "no_regex"])
+        
+        forceTokenize(doc)
+        testStates(doc, ["comment_regex_allowed", "comment_regex_allowed"])
+        
+        doc.insert({row:0, column:2}, "\n*/")
+        testStates(doc, [undefined, undefined, "comment_regex_allowed"])
+        
+        forceTokenize(doc)
+        testStates(doc, ["comment_regex_allowed", "start", "no_regex"])
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/commands/command_manager.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/commands/command_manager.js b/src/fauxton/assets/js/libs/ace/commands/command_manager.js
new file mode 100644
index 0000000..72a9942
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/commands/command_manager.js
@@ -0,0 +1,112 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var HashHandler = require("../keyboard/hash_handler").HashHandler;
+var EventEmitter = require("../lib/event_emitter").EventEmitter;
+
+/**
+ * @class CommandManager
+ *
+ *
+ **/
+
+/**
+ * new CommandManager(platform, commands)
+ * @param {String} platform Identifier for the platform; must be either `'mac'` or `'win'`
+ * @param {Array} commands A list of commands
+ *
+ **/
+
+var CommandManager = function(platform, commands) {
+    HashHandler.call(this, commands, platform);
+    this.byName = this.commands;
+    this.setDefaultHandler("exec", function(e) {
+        return e.command.exec(e.editor, e.args || {});
+    });
+};
+
+oop.inherits(CommandManager, HashHandler);
+
+(function() {
+
+    oop.implement(this, EventEmitter);
+
+    this.exec = function(command, editor, args) {
+        if (typeof command === 'string')
+            command = this.commands[command];
+
+        if (!command)
+            return false;
+
+        if (editor && editor.$readOnly && !command.readOnly)
+            return false;
+
+        var e = {editor: editor, command: command, args: args};
+        var retvalue = this._emit("exec", e);
+        this._signal("afterExec", e);
+
+        return retvalue === false ? false : true;
+    };
+
+    this.toggleRecording = function(editor) {
+        if (this.$inReplay)
+            return;
+
+        editor && editor._emit("changeStatus");
+        if (this.recording) {
+            this.macro.pop();
+            this.removeEventListener("exec", this.$addCommandToMacro);
+
+            if (!this.macro.length)
+                this.macro = this.oldMacro;
+
+            return this.recording = false;
+        }
+        if (!this.$addCommandToMacro) {
+            this.$addCommandToMacro = function(e) {
+                this.macro.push([e.command, e.args]);
+            }.bind(this);
+        }
+
+        this.oldMacro = this.macro;
+        this.macro = [];
+        this.on("exec", this.$addCommandToMacro);
+        return this.recording = true;
+    };
+
+    this.replay = function(editor) {
+        if (this.$inReplay || !this.macro)
+            return;
+
+        if (this.recording)
+            return this.toggleRecording(editor);
+
+        try {
+            this.$inReplay = true;
+            this.macro.forEach(function(x) {
+                if (typeof x == "string")
+                    this.exec(x, editor);
+                else
+                    this.exec(x[0], editor, x[1]);
+            }, this);
+        } finally {
+            this.$inReplay = false;
+        }
+    };
+
+    this.trimMacro = function(m) {
+        return m.map(function(x){
+            if (typeof x[0] != "string")
+                x[0] = x[0].name;
+            if (!x[1])
+                x = x[0];
+            return x;
+        });
+    };
+
+}).call(CommandManager.prototype);
+
+exports.CommandManager = CommandManager;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/commands/command_manager_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/commands/command_manager_test.js b/src/fauxton/assets/js/libs/ace/commands/command_manager_test.js
new file mode 100644
index 0000000..76d973b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/commands/command_manager_test.js
@@ -0,0 +1,199 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var CommandManager = require("./command_manager").CommandManager;
+var keys = require("../lib/keys");
+var assert = require("../test/assertions");
+
+module.exports = {
+
+    setUp: function() {
+        this.command = {
+            name: "gotoline",
+            bindKey: {
+                mac: "Command-L",
+                win: "Ctrl-L"
+            },
+            called: false,
+            exec: function(editor) { this.called = true; }
+        };
+
+        this.cm = new CommandManager("mac", [this.command]);
+    },
+
+    "test: register command": function() {
+        this.cm.exec("gotoline");
+        assert.ok(this.command.called);
+    },
+
+    "test: mac hotkeys": function() {
+        var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "l");
+        assert.equal(command, this.command);
+
+        var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "l");
+        assert.equal(command, undefined);
+    },
+
+    "test: win hotkeys": function() {
+        var cm = new CommandManager("win", [this.command]);
+
+        var command = cm.findKeyCommand(keys.KEY_MODS.command, "l");
+        assert.equal(command, undefined);
+
+        var command = cm.findKeyCommand(keys.KEY_MODS.ctrl, "l");
+        assert.equal(command, this.command);
+    },
+
+    "test: remove command by object": function() {
+        this.cm.removeCommand(this.command);
+
+        this.cm.exec("gotoline");
+        assert.ok(!this.command.called);
+
+        var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "l");
+        assert.equal(command, null);
+    },
+
+    "test: remove command by name": function() {
+        this.cm.removeCommand("gotoline");
+
+        this.cm.exec("gotoline");
+        assert.ok(!this.command.called);
+
+        var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "l");
+        assert.equal(command, null);
+    },
+
+    "test: adding a new command with the same name as an existing one should remove the old one first": function() {
+        var command = {
+            name: "gotoline",
+            bindKey: {
+                mac: "Command-L",
+                win: "Ctrl-L"
+            },
+            called: false,
+            exec: function(editor) { this.called = true; }
+        };
+        this.cm.addCommand(command);
+
+        this.cm.exec("gotoline");
+        assert.ok(command.called);
+        assert.ok(!this.command.called);
+
+        assert.equal(this.cm.findKeyCommand(keys.KEY_MODS.command, "l"), command);
+    },
+
+    "test: adding commands and recording a macro": function() {
+        var called = "";
+        this.cm.addCommands({
+            togglerecording: function(editor) {
+                editor.cm.toggleRecording(editor);
+            },
+            replay: function(editor) {
+                editor.cm.replay();
+            },
+            cm1: function(editor, arg) {
+                called += "1" + (arg || "");
+            },
+            cm2: function(editor) {
+                called += "2";
+            }
+        });
+        
+        
+        var statusUpdateEmitted = false;
+        this._emit = function() {statusUpdateEmitted = true};
+
+        this.cm.exec("togglerecording", this);
+        assert.ok(this.cm.recording);
+        assert.ok(statusUpdateEmitted);
+
+        this.cm.exec("cm1", this, "-");
+        this.cm.exec("cm2");
+        this.cm.exec("replay", this);
+        assert.ok(!this.cm.recording);
+        assert.equal(called, "1-2");
+
+        called = "";
+        this.cm.exec("replay", this);
+        assert.equal(called, "1-2");
+    },
+
+    "test: bindkeys": function() {
+        this.cm.bindKeys({
+            "Ctrl-L|Command-C": "cm1",
+            "Ctrl-R": "cm2"
+        });
+
+        var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "c");
+        assert.equal(command, "cm1");
+
+        var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "r");
+        assert.equal(command, "cm2");
+
+        this.cm.bindKeys({
+            "Ctrl-R": null
+        });
+
+        var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "r");
+        assert.equal(command, null);
+    },
+
+    "test: binding keys without modifiers": function() {
+        this.cm.bindKeys({
+            "R": "cm1",
+            "Shift-r": "cm2",
+            "Return": "cm4",
+            "Enter": "cm3"
+        });
+
+        var command = this.cm.findKeyCommand(-1, "r");
+        assert.equal(command, "cm1");
+
+        var command = this.cm.findKeyCommand(-1, "R");
+        assert.equal(command, "cm2");
+
+        var command = this.cm.findKeyCommand(0, "return");
+        assert.equal(command, "cm3");
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec();
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/commands/default_commands.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/commands/default_commands.js b/src/fauxton/assets/js/libs/ace/commands/default_commands.js
new file mode 100644
index 0000000..9c663d1
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/commands/default_commands.js
@@ -0,0 +1,490 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var lang = require("../lib/lang");
+var config = require("../config");
+
+function bindKey(win, mac) {
+    return {
+        win: win,
+        mac: mac
+    };
+}
+
+exports.commands = [{
+    name: "showSettingsMenu",
+    bindKey: bindKey("Ctrl-,", "Command-,"),
+    exec: function(editor) {
+        config.loadModule("ace/ext/settings_menu", function(module) {
+            module.init(editor);
+            editor.showSettingsMenu();
+        });
+    },
+    readOnly: true
+}, {
+    name: "selectall",
+    bindKey: bindKey("Ctrl-A", "Command-A"),
+    exec: function(editor) { editor.selectAll(); },
+    readOnly: true
+}, {
+    name: "centerselection",
+    bindKey: bindKey(null, "Ctrl-L"),
+    exec: function(editor) { editor.centerSelection(); },
+    readOnly: true
+}, {
+    name: "gotoline",
+    bindKey: bindKey("Ctrl-L", "Command-L"),
+    exec: function(editor) {
+        var line = parseInt(prompt("Enter line number:"), 10);
+        if (!isNaN(line)) {
+            editor.gotoLine(line);
+        }
+    },
+    readOnly: true
+}, {
+    name: "fold",
+    bindKey: bindKey("Alt-L|Ctrl-F1", "Command-Alt-L|Command-F1"),
+    exec: function(editor) { editor.session.toggleFold(false); },
+    readOnly: true
+}, {
+    name: "unfold",
+    bindKey: bindKey("Alt-Shift-L|Ctrl-Shift-F1", "Command-Alt-Shift-L|Command-Shift-F1"),
+    exec: function(editor) { editor.session.toggleFold(true); },
+    readOnly: true
+}, {
+    name: "foldall",
+    bindKey: bindKey("Alt-0", "Command-Option-0"),
+    exec: function(editor) { editor.session.foldAll(); },
+    readOnly: true
+}, {
+    name: "unfoldall",
+    bindKey: bindKey("Alt-Shift-0", "Command-Option-Shift-0"),
+    exec: function(editor) { editor.session.unfold(); },
+    readOnly: true
+}, {
+    name: "findnext",
+    bindKey: bindKey("Ctrl-K", "Command-G"),
+    exec: function(editor) { editor.findNext(); },
+    readOnly: true
+}, {
+    name: "findprevious",
+    bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
+    exec: function(editor) { editor.findPrevious(); },
+    readOnly: true
+}, {
+    name: "find",
+    bindKey: bindKey("Ctrl-F", "Command-F"),
+    exec: function(editor) {
+        config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor)});
+    },
+    readOnly: true
+}, {
+    name: "overwrite",
+    bindKey: "Insert",
+    exec: function(editor) { editor.toggleOverwrite(); },
+    readOnly: true
+}, {
+    name: "selecttostart",
+    bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Up"),
+    exec: function(editor) { editor.getSelection().selectFileStart(); },
+    multiSelectAction: "forEach",
+    readOnly: true,
+    group: "fileJump"
+}, {
+    name: "gotostart",
+    bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
+    exec: function(editor) { editor.navigateFileStart(); },
+    multiSelectAction: "forEach",
+    readOnly: true,
+    group: "fileJump"
+}, {
+    name: "selectup",
+    bindKey: bindKey("Shift-Up", "Shift-Up"),
+    exec: function(editor) { editor.getSelection().selectUp(); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "golineup",
+    bindKey: bindKey("Up", "Up|Ctrl-P"),
+    exec: function(editor, args) { editor.navigateUp(args.times); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "selecttoend",
+    bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-Down"),
+    exec: function(editor) { editor.getSelection().selectFileEnd(); },
+    multiSelectAction: "forEach",
+    readOnly: true,
+    group: "fileJump"
+}, {
+    name: "gotoend",
+    bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"),
+    exec: function(editor) { editor.navigateFileEnd(); },
+    multiSelectAction: "forEach",
+    readOnly: true,
+    group: "fileJump"
+}, {
+    name: "selectdown",
+    bindKey: bindKey("Shift-Down", "Shift-Down"),
+    exec: function(editor) { editor.getSelection().selectDown(); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "golinedown",
+    bindKey: bindKey("Down", "Down|Ctrl-N"),
+    exec: function(editor, args) { editor.navigateDown(args.times); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "selectwordleft",
+    bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
+    exec: function(editor) { editor.getSelection().selectWordLeft(); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "gotowordleft",
+    bindKey: bindKey("Ctrl-Left", "Option-Left"),
+    exec: function(editor) { editor.navigateWordLeft(); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "selecttolinestart",
+    bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"),
+    exec: function(editor) { editor.getSelection().selectLineStart(); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "gotolinestart",
+    bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
+    exec: function(editor) { editor.navigateLineStart(); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "selectleft",
+    bindKey: bindKey("Shift-Left", "Shift-Left"),
+    exec: function(editor) { editor.getSelection().selectLeft(); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "gotoleft",
+    bindKey: bindKey("Left", "Left|Ctrl-B"),
+    exec: function(editor, args) { editor.navigateLeft(args.times); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "selectwordright",
+    bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
+    exec: function(editor) { editor.getSelection().selectWordRight(); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "gotowordright",
+    bindKey: bindKey("Ctrl-Right", "Option-Right"),
+    exec: function(editor) { editor.navigateWordRight(); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "selecttolineend",
+    bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"),
+    exec: function(editor) { editor.getSelection().selectLineEnd(); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "gotolineend",
+    bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
+    exec: function(editor) { editor.navigateLineEnd(); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "selectright",
+    bindKey: bindKey("Shift-Right", "Shift-Right"),
+    exec: function(editor) { editor.getSelection().selectRight(); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "gotoright",
+    bindKey: bindKey("Right", "Right|Ctrl-F"),
+    exec: function(editor, args) { editor.navigateRight(args.times); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "selectpagedown",
+    bindKey: "Shift-PageDown",
+    exec: function(editor) { editor.selectPageDown(); },
+    readOnly: true
+}, {
+    name: "pagedown",
+    bindKey: bindKey(null, "Option-PageDown"),
+    exec: function(editor) { editor.scrollPageDown(); },
+    readOnly: true
+}, {
+    name: "gotopagedown",
+    bindKey: bindKey("PageDown", "PageDown|Ctrl-V"),
+    exec: function(editor) { editor.gotoPageDown(); },
+    readOnly: true
+}, {
+    name: "selectpageup",
+    bindKey: "Shift-PageUp",
+    exec: function(editor) { editor.selectPageUp(); },
+    readOnly: true
+}, {
+    name: "pageup",
+    bindKey: bindKey(null, "Option-PageUp"),
+    exec: function(editor) { editor.scrollPageUp(); },
+    readOnly: true
+}, {
+    name: "gotopageup",
+    bindKey: "PageUp",
+    exec: function(editor) { editor.gotoPageUp(); },
+    readOnly: true
+}, {
+    name: "scrollup",
+    bindKey: bindKey("Ctrl-Up", null),
+    exec: function(e) { e.renderer.scrollBy(0, -2 * e.renderer.layerConfig.lineHeight); },
+    readOnly: true
+}, {
+    name: "scrolldown",
+    bindKey: bindKey("Ctrl-Down", null),
+    exec: function(e) { e.renderer.scrollBy(0, 2 * e.renderer.layerConfig.lineHeight); },
+    readOnly: true
+}, {
+    name: "selectlinestart",
+    bindKey: "Shift-Home",
+    exec: function(editor) { editor.getSelection().selectLineStart(); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "selectlineend",
+    bindKey: "Shift-End",
+    exec: function(editor) { editor.getSelection().selectLineEnd(); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "togglerecording",
+    bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"),
+    exec: function(editor) { editor.commands.toggleRecording(editor); },
+    readOnly: true
+}, {
+    name: "replaymacro",
+    bindKey: bindKey("Ctrl-Shift-E", "Command-Shift-E"),
+    exec: function(editor) { editor.commands.replay(editor); },
+    readOnly: true
+}, {
+    name: "jumptomatching",
+    bindKey: bindKey("Ctrl-P", "Ctrl-Shift-P"),
+    exec: function(editor) { editor.jumpToMatching(); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, {
+    name: "selecttomatching",
+    bindKey: bindKey("Ctrl-Shift-P", null),
+    exec: function(editor) { editor.jumpToMatching(true); },
+    multiSelectAction: "forEach",
+    readOnly: true
+}, 
+
+// commands disabled in readOnly mode
+{
+    name: "cut",
+    exec: function(editor) {
+        var range = editor.getSelectionRange();
+        editor._emit("cut", range);
+
+        if (!editor.selection.isEmpty()) {
+            editor.session.remove(range);
+            editor.clearSelection();
+        }
+    },
+    multiSelectAction: "forEach"
+}, {
+    name: "removeline",
+    bindKey: bindKey("Ctrl-D", "Command-D"),
+    exec: function(editor) { editor.removeLines(); },
+    multiSelectAction: "forEachLine"
+}, {
+    name: "duplicateSelection",
+    bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"),
+    exec: function(editor) { editor.duplicateSelection(); },
+    multiSelectAction: "forEach"
+}, {
+    name: "sortlines",
+    bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"),
+    exec: function(editor) { editor.sortLines(); },
+    multiSelectAction: "forEachLine"
+}, {
+    name: "togglecomment",
+    bindKey: bindKey("Ctrl-/", "Command-/"),
+    exec: function(editor) { editor.toggleCommentLines(); },
+    multiSelectAction: "forEachLine"
+}, {
+    name: "toggleBlockComment",
+    bindKey: bindKey("Ctrl-Shift-/", "Command-Shift-/"),
+    exec: function(editor) { editor.toggleBlockComment(); },
+    multiSelectAction: "forEach"
+}, {
+    name: "modifyNumberUp",
+    bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"),
+    exec: function(editor) { editor.modifyNumber(1); },
+    multiSelectAction: "forEach"
+}, {
+    name: "modifyNumberDown",
+    bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"),
+    exec: function(editor) { editor.modifyNumber(-1); },
+    multiSelectAction: "forEach"
+}, {
+    name: "replace",
+    bindKey: bindKey("Ctrl-H", "Command-Option-F"),
+    exec: function(editor) {
+        config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor, true)});
+    }
+}, {
+    name: "undo",
+    bindKey: bindKey("Ctrl-Z", "Command-Z"),
+    exec: function(editor) { editor.undo(); }
+}, {
+    name: "redo",
+    bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"),
+    exec: function(editor) { editor.redo(); }
+}, {
+    name: "copylinesup",
+    bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"),
+    exec: function(editor) { editor.copyLinesUp(); }
+}, {
+    name: "movelinesup",
+    bindKey: bindKey("Alt-Up", "Option-Up"),
+    exec: function(editor) { editor.moveLinesUp(); }
+}, {
+    name: "copylinesdown",
+    bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"),
+    exec: function(editor) { editor.copyLinesDown(); }
+}, {
+    name: "movelinesdown",
+    bindKey: bindKey("Alt-Down", "Option-Down"),
+    exec: function(editor) { editor.moveLinesDown(); }
+}, {
+    name: "del",
+    bindKey: bindKey("Delete", "Delete|Ctrl-D|Shift-Delete"),
+    exec: function(editor) { editor.remove("right"); },
+    multiSelectAction: "forEach"
+}, {
+    name: "backspace",
+    bindKey: bindKey(
+        "Shift-Backspace|Backspace",
+        "Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"
+    ),
+    exec: function(editor) { editor.remove("left"); },
+    multiSelectAction: "forEach"
+}, {
+    name: "cut_or_delete",
+    bindKey: bindKey("Shift-Delete", null),
+    exec: function(editor) { 
+        if (editor.selection.isEmpty()) {
+            editor.remove("left");
+        } else {
+            return false;
+        }
+    },
+    multiSelectAction: "forEach"
+}, {
+    name: "removetolinestart",
+    bindKey: bindKey("Alt-Backspace", "Command-Backspace"),
+    exec: function(editor) { editor.removeToLineStart(); },
+    multiSelectAction: "forEach"
+}, {
+    name: "removetolineend",
+    bindKey: bindKey("Alt-Delete", "Ctrl-K"),
+    exec: function(editor) { editor.removeToLineEnd(); },
+    multiSelectAction: "forEach"
+}, {
+    name: "removewordleft",
+    bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
+    exec: function(editor) { editor.removeWordLeft(); },
+    multiSelectAction: "forEach"
+}, {
+    name: "removewordright",
+    bindKey: bindKey("Ctrl-Delete", "Alt-Delete"),
+    exec: function(editor) { editor.removeWordRight(); },
+    multiSelectAction: "forEach"
+}, {
+    name: "outdent",
+    bindKey: bindKey("Shift-Tab", "Shift-Tab"),
+    exec: function(editor) { editor.blockOutdent(); },
+    multiSelectAction: "forEach"
+}, {
+    name: "indent",
+    bindKey: bindKey("Tab", "Tab"),
+    exec: function(editor) { editor.indent(); },
+    multiSelectAction: "forEach"
+},{
+    name: "blockoutdent",
+    bindKey: bindKey("Ctrl-[", "Ctrl-["),
+    exec: function(editor) { editor.blockOutdent(); },
+    multiSelectAction: "forEachLine"
+},{
+    name: "blockindent",
+    bindKey: bindKey("Ctrl-]", "Ctrl-]"),
+    exec: function(editor) { editor.blockIndent(); },
+    multiSelectAction: "forEachLine"
+}, {
+    name: "insertstring",
+    exec: function(editor, str) { editor.insert(str); },
+    multiSelectAction: "forEach"
+}, {
+    name: "inserttext",
+    exec: function(editor, args) {
+        editor.insert(lang.stringRepeat(args.text  || "", args.times || 1));
+    },
+    multiSelectAction: "forEach"
+}, {
+    name: "splitline",
+    bindKey: bindKey(null, "Ctrl-O"),
+    exec: function(editor) { editor.splitLine(); },
+    multiSelectAction: "forEach"
+}, {
+    name: "transposeletters",
+    bindKey: bindKey("Ctrl-T", "Ctrl-T"),
+    exec: function(editor) { editor.transposeLetters(); },
+    multiSelectAction: function(editor) {editor.transposeSelections(1); }
+}, {
+    name: "touppercase",
+    bindKey: bindKey("Ctrl-U", "Ctrl-U"),
+    exec: function(editor) { editor.toUpperCase(); },
+    multiSelectAction: "forEach"
+}, {
+    name: "tolowercase",
+    bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"),
+    exec: function(editor) { editor.toLowerCase(); },
+    multiSelectAction: "forEach"
+}];
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/commands/incremental_search_commands.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/commands/incremental_search_commands.js b/src/fauxton/assets/js/libs/ace/commands/incremental_search_commands.js
new file mode 100644
index 0000000..ebe979c
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/commands/incremental_search_commands.js
@@ -0,0 +1,180 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+
+var config = require("../config");
+var oop = require("../lib/oop");
+var HashHandler = require("../keyboard/hash_handler").HashHandler;
+var occurStartCommand = require("./occur_commands").occurStartCommand;
+
+// These commands can be installed in a normal key handler to start iSearch:
+exports.iSearchStartCommands = [{
+    name: "iSearch",
+    bindKey: {win: "Ctrl-F", mac: "Command-F"},
+    exec: function(editor, options) {
+        config.loadModule(["core", "ace/incremental_search"], function(e) {
+            var iSearch = e.iSearch = e.iSearch || new e.IncrementalSearch();
+            iSearch.activate(editor, options.backwards);
+            if (options.jumpToFirstMatch) iSearch.next(options);
+        });
+    },
+    readOnly: true
+}, {
+    name: "iSearchBackwards",
+    exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {backwards: true}); },
+    readOnly: true
+}, {
+    name: "iSearchAndGo",
+    bindKey: {win: "Ctrl-K", mac: "Command-G"},
+    exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {jumpToFirstMatch: true, useCurrentOrPrevSearch: true}); },
+    readOnly: true
+}, {
+    name: "iSearchBackwardsAndGo",
+    bindKey: {win: "Ctrl-Shift-K", mac: "Command-Shift-G"},
+    exec: function(editor) { editor.execCommand('iSearch', {jumpToFirstMatch: true, backwards: true, useCurrentOrPrevSearch: true}); },
+    readOnly: true
+}];
+
+// These commands are only available when incremental search mode is active:
+exports.iSearchCommands = [{
+    name: "restartSearch",
+    bindKey: {win: "Ctrl-F", mac: "Command-F"},
+    exec: function(iSearch) {
+        iSearch.cancelSearch(true);
+    },
+    readOnly: true,
+    isIncrementalSearchCommand: true
+}, {
+    name: "searchForward",
+    bindKey: {win: "Ctrl-S|Ctrl-K", mac: "Ctrl-S|Command-G"},
+    exec: function(iSearch, options) {
+        options.useCurrentOrPrevSearch = true;
+        iSearch.next(options);
+    },
+    readOnly: true,
+    isIncrementalSearchCommand: true
+}, {
+    name: "searchBackward",
+    bindKey: {win: "Ctrl-R|Ctrl-Shift-K", mac: "Ctrl-R|Command-Shift-G"},
+    exec: function(iSearch, options) {
+        options.useCurrentOrPrevSearch = true;
+        options.backwards = true;
+        iSearch.next(options);
+    },
+    readOnly: true,
+    isIncrementalSearchCommand: true
+}, {
+    name: "extendSearchTerm",
+    exec: function(iSearch, string) {
+        iSearch.addChar(string);
+    },
+    readOnly: true,
+    isIncrementalSearchCommand: true
+}, {
+    name: "extendSearchTermSpace",
+    bindKey: "space",
+    exec: function(iSearch) { iSearch.addChar(' '); },
+    readOnly: true,
+    isIncrementalSearchCommand: true
+}, {
+    name: "shrinkSearchTerm",
+    bindKey: "backspace",
+    exec: function(iSearch) {
+        iSearch.removeChar();
+    },
+    readOnly: true,
+    isIncrementalSearchCommand: true
+}, {
+    name: 'confirmSearch',
+    bindKey: 'return',
+    exec: function(iSearch) { iSearch.deactivate(); },
+    readOnly: true,
+    isIncrementalSearchCommand: true
+}, {
+    name: 'cancelSearch',
+    bindKey: 'esc|Ctrl-G',
+    exec: function(iSearch) { iSearch.deactivate(true); },
+    readOnly: true,
+    isIncrementalSearchCommand: true
+}, {
+    name: 'occurisearch',
+    bindKey: 'Ctrl-O',
+    exec: function(iSearch) {
+        var options = oop.mixin({}, iSearch.$options);
+        iSearch.deactivate();
+        occurStartCommand.exec(iSearch.$editor, options);
+    },
+    readOnly: true,
+    isIncrementalSearchCommand: true
+}];
+
+function IncrementalSearchKeyboardHandler(iSearch) {
+    this.$iSearch = iSearch;
+}
+
+oop.inherits(IncrementalSearchKeyboardHandler, HashHandler);
+
+;(function() {
+
+    this.attach = function(editor) {
+        var iSearch = this.$iSearch;
+        HashHandler.call(this, exports.iSearchCommands, editor.commands.platform);
+        this.$commandExecHandler = editor.commands.addEventListener('exec', function(e) {
+            if (!e.command.isIncrementalSearchCommand) return undefined;
+            e.stopPropagation();
+            e.preventDefault();
+            return e.command.exec(iSearch, e.args || {});
+        });
+    }
+
+    this.detach = function(editor) {
+        if (!this.$commandExecHandler) return;
+        editor.commands.removeEventListener('exec', this.$commandExecHandler);
+        delete this.$commandExecHandler;
+    }
+
+    var handleKeyboard$super = this.handleKeyboard;
+    this.handleKeyboard = function(data, hashId, key, keyCode) {
+        var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode);
+        if (cmd.command) { return cmd; }
+        if (hashId == -1) {
+            var extendCmd = this.commands.extendSearchTerm;
+            if (extendCmd) { return {command: extendCmd, args: key}; }
+        }
+        return {command: "null", passEvent: hashId == 0 || hashId == 4};
+    }
+
+}).call(IncrementalSearchKeyboardHandler.prototype);
+
+
+exports.IncrementalSearchKeyboardHandler = IncrementalSearchKeyboardHandler;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/commands/multi_select_commands.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/commands/multi_select_commands.js b/src/fauxton/assets/js/libs/ace/commands/multi_select_commands.js
new file mode 100644
index 0000000..ff59f04
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/commands/multi_select_commands.js
@@ -0,0 +1,97 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+
+// commands to enter multiselect mode
+exports.defaultCommands = [{
+    name: "addCursorAbove",
+    exec: function(editor) { editor.selectMoreLines(-1); },
+    bindKey: {win: "Ctrl-Alt-Up", mac: "Ctrl-Alt-Up"},
+    readonly: true
+}, {
+    name: "addCursorBelow",
+    exec: function(editor) { editor.selectMoreLines(1); },
+    bindKey: {win: "Ctrl-Alt-Down", mac: "Ctrl-Alt-Down"},
+    readonly: true
+}, {
+    name: "addCursorAboveSkipCurrent",
+    exec: function(editor) { editor.selectMoreLines(-1, true); },
+    bindKey: {win: "Ctrl-Alt-Shift-Up", mac: "Ctrl-Alt-Shift-Up"},
+    readonly: true
+}, {
+    name: "addCursorBelowSkipCurrent",
+    exec: function(editor) { editor.selectMoreLines(1, true); },
+    bindKey: {win: "Ctrl-Alt-Shift-Down", mac: "Ctrl-Alt-Shift-Down"},
+    readonly: true
+}, {
+    name: "selectMoreBefore",
+    exec: function(editor) { editor.selectMore(-1); },
+    bindKey: {win: "Ctrl-Alt-Left", mac: "Ctrl-Alt-Left"},
+    readonly: true
+}, {
+    name: "selectMoreAfter",
+    exec: function(editor) { editor.selectMore(1); },
+    bindKey: {win: "Ctrl-Alt-Right", mac: "Ctrl-Alt-Right"},
+    readonly: true
+}, {
+    name: "selectNextBefore",
+    exec: function(editor) { editor.selectMore(-1, true); },
+    bindKey: {win: "Ctrl-Alt-Shift-Left", mac: "Ctrl-Alt-Shift-Left"},
+    readonly: true
+}, {
+    name: "selectNextAfter",
+    exec: function(editor) { editor.selectMore(1, true); },
+    bindKey: {win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right"},
+    readonly: true
+}, {
+    name: "splitIntoLines",
+    exec: function(editor) { editor.multiSelect.splitIntoLines(); },
+    bindKey: {win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L"},
+    readonly: true
+}, {
+    name: "alignCursors",
+    exec: function(editor) { editor.alignCursors(); },
+    bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"}
+}];
+
+// commands active only in multiselect mode
+exports.multiSelectCommands = [{
+    name: "singleSelection",
+    bindKey: "esc",
+    exec: function(editor) { editor.exitMultiSelectMode(); },
+    readonly: true,
+    isAvailable: function(editor) {return editor && editor.inMultiSelectMode}
+}];
+
+var HashHandler = require("../keyboard/hash_handler").HashHandler;
+exports.keyboardHandler = new HashHandler(exports.multiSelectCommands);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/commands/occur_commands.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/commands/occur_commands.js b/src/fauxton/assets/js/libs/ace/commands/occur_commands.js
new file mode 100644
index 0000000..b45fbf6
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/commands/occur_commands.js
@@ -0,0 +1,110 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+
+var config = require("../config"),
+    Occur = require("../occur").Occur;
+
+// These commands can be installed in a normal command handler to start occur:
+var occurStartCommand = {
+    name: "occur",
+    exec: function(editor, options) {
+        var alreadyInOccur = !!editor.session.$occur;
+        var occurSessionActive = new Occur().enter(editor, options);
+        if (occurSessionActive && !alreadyInOccur)
+            OccurKeyboardHandler.installIn(editor);
+    },
+    readOnly: true
+};
+
+var occurCommands = [{
+    name: "occurexit",
+    bindKey: 'esc|Ctrl-G',
+    exec: function(editor) {
+        var occur = editor.session.$occur;
+        if (!occur) return;
+        occur.exit(editor, {});
+        if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor);
+    },
+    readOnly: true
+}, {
+    name: "occuraccept",
+    bindKey: 'enter',
+    exec: function(editor) {
+        var occur = editor.session.$occur;
+        if (!occur) return;
+        occur.exit(editor, {translatePosition: true});
+        if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor);
+    },
+    readOnly: true
+}];
+
+var HashHandler = require("../keyboard/hash_handler").HashHandler;
+var oop = require("../lib/oop");
+
+
+function OccurKeyboardHandler() {}
+
+oop.inherits(OccurKeyboardHandler, HashHandler);
+
+;(function() {
+
+    this.isOccurHandler = true;
+
+    this.attach = function(editor) {
+        HashHandler.call(this, occurCommands, editor.commands.platform);
+        this.$editor = editor;
+    }
+
+    var handleKeyboard$super = this.handleKeyboard;
+    this.handleKeyboard = function(data, hashId, key, keyCode) {
+        var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode);
+        return (cmd && cmd.command) ? cmd : undefined;
+    }
+
+}).call(OccurKeyboardHandler.prototype);
+
+OccurKeyboardHandler.installIn = function(editor) {
+    var handler = new this();
+    editor.keyBinding.addKeyboardHandler(handler);
+    editor.commands.addCommands(occurCommands);
+}
+
+OccurKeyboardHandler.uninstallFrom = function(editor) {
+    editor.commands.removeCommands(occurCommands);
+    var handler = editor.getKeyboardHandler();
+    if (handler.isOccurHandler)
+        editor.keyBinding.removeKeyboardHandler(handler);
+}
+
+exports.occurStartCommand = occurStartCommand;
+
+});


[06/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/ruby.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/ruby.js b/src/fauxton/assets/js/libs/ace/mode/ruby.js
new file mode 100644
index 0000000..7d14bb5
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/ruby.js
@@ -0,0 +1,91 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var Range = require("../range").Range;
+var FoldMode = require("./folding/coffee").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = RubyHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+
+    this.lineCommentStart = "#";
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+
+        if (state == "start") {
+            var match = line.match(/^.*[\{\(\[]\s*$/);
+            var startingClassOrMethod = line.match(/^\s*(class|def)\s.*$/);
+            var startingDoBlock = line.match(/.*do(\s*|\s+\|.*\|\s*)$/);
+            var startingConditional = line.match(/^\s*(if|else)\s*/)
+            if (match || startingClassOrMethod || startingDoBlock || startingConditional) {
+                indent += tab;
+            }
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return /^\s+end$/.test(line + input) || /^\s+}$/.test(line + input) || /^\s+else$/.test(line + input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        var indent = this.$getIndent(doc.getLine(row));
+        var tab = doc.getTabString();
+        if (indent.slice(-tab.length) == tab)
+            doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/ruby_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/ruby_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/ruby_highlight_rules.js
new file mode 100644
index 0000000..44ff305
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/ruby_highlight_rules.js
@@ -0,0 +1,249 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+// exports is for Haml
+var constantOtherSymbol = exports.constantOtherSymbol = {
+    token : "constant.other.symbol.ruby", // symbol
+    regex : "[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?"
+};
+
+var qString = exports.qString = {
+    token : "string", // single line
+    regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+};
+
+var qqString = exports.qqString = {
+    token : "string", // single line
+    regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+};
+
+var tString = exports.tString = {
+    token : "string", // backtick string
+    regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
+};
+
+var constantNumericHex = exports.constantNumericHex = {
+    token : "constant.numeric", // hex
+    regex : "0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\b"
+};
+
+var constantNumericFloat = exports.constantNumericFloat = {
+    token : "constant.numeric", // float
+    regex : "[+-]?\\d(?:\\d|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b"
+};
+
+var RubyHighlightRules = function() {
+
+    var builtinFunctions = (
+        "abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|" +
+        "assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|" +
+        "assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|" +
+        "assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|" +
+        "assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|" +
+        "assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|" +
+        "attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|" +
+        "caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|" +
+        "exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|" +
+        "gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|" +
+        "link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|" +
+        "p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|" +
+        "raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|" +
+        "set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|" +
+        "throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|" +
+        "render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|" +
+        "content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|" +
+        "fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|" +
+        "time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|" +
+        "select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|" +
+        "file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|" +
+        "protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|" +
+        "send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|" +
+        "validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|" +
+        "validates_inclusion_of|validates_numericality_of|validates_with|validates_each|" +
+        "authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|" +
+        "filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|" +
+        "translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|" +
+        "cache|expire_fragment|expire_cache_for|observe|cache_sweeper|" +
+        "has_many|has_one|belongs_to|has_and_belongs_to_many"
+    );
+
+    var keywords = (
+        "alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|" +
+        "__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|" +
+        "redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield"
+    );
+
+    var buildinConstants = (
+        "true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|" +
+        "RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING"
+    );
+
+    var builtinVariables = (
+        "\$DEBUG|\$defout|\$FILENAME|\$LOAD_PATH|\$SAFE|\$stdin|\$stdout|\$stderr|\$VERBOSE|" +
+        "$!|root_url|flash|session|cookies|params|request|response|logger|self"
+    );
+
+    var keywordMapper = this.$keywords = this.createKeywordMapper({
+        "keyword": keywords,
+        "constant.language": buildinConstants,
+        "variable.language": builtinVariables,
+        "support.function": builtinFunctions,
+        "invalid.deprecated": "debugger" // TODO is this a remnant from js mode?
+    }, "identifier");
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "start" : [
+            {
+                token : "comment",
+                regex : "#.*$"
+            }, {
+                token : "comment", // multi line comment
+                regex : "^=begin(?:$|\\s.*$)",
+                next : "comment"
+            }, {
+                token : "string.regexp",
+                regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
+            },
+
+            qString,
+            qqString,
+            tString,
+
+            {
+                token : "text", // namespaces aren't symbols
+                regex : "::"
+            }, {
+                token : "variable.instance", // instance variable
+                regex : "@{1,2}[a-zA-Z_\\d]+"
+            }, {
+                token : "support.class", // class name
+                regex : "[A-Z][a-zA-Z_\\d]+"
+            },
+
+            constantOtherSymbol,
+            constantNumericHex,
+            constantNumericFloat,
+
+            {
+                token : "constant.language.boolean",
+                regex : "(?:true|false)\\b"
+            }, {
+                token : keywordMapper,
+                // TODO: Unicode escape sequences
+                // TODO: Unicode identifiers
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+            }, {
+                token : "punctuation.separator.key-value",
+                regex : "=>"
+            }, {
+                stateName: "heredoc",
+                onMatch : function(value, currentState, stack) {
+                    var next = value[2] == '-' ? "indentedHeredoc" : "heredoc";
+                    var tokens = value.split(this.splitRegex);
+                    stack.push(next, tokens[3]);
+                    return [
+                        {type:"constant", value: tokens[1]},
+                        {type:"string", value: tokens[2]},
+                        {type:"support.class", value: tokens[3]},
+                        {type:"string", value: tokens[4]}
+                    ];
+                },
+                regex : "(<<-?)(['\"`]?)([\\w]+)(['\"`]?)",
+                rules: {
+                    heredoc: [{
+                        onMatch:  function(value, currentState, stack) {
+                            if (value == stack[1]) {
+                                stack.shift();
+                                stack.shift();
+                                return "support.class";
+                            }
+                            return "string";
+                        },
+                        regex: ".*$",
+                        next: "start"
+                    }],
+                    indentedHeredoc: [{
+                        token: "string",
+                        regex: "^ +"
+                    }, {
+                        onMatch:  function(value, currentState, stack) {
+                            if (value == stack[1]) {
+                                stack.shift();
+                                stack.shift();
+                                return "support.class";
+                            }
+                            return "string";
+                        },
+                        regex: ".*$",
+                        next: "start"
+                    }]
+                }
+            }, {
+                token : "keyword.operator",
+                regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
+            }, {
+                token : "paren.lparen",
+                regex : "[[({]"
+            }, {
+                token : "paren.rparen",
+                regex : "[\\])}]"
+            }, {
+                token : "text",
+                regex : "\\s+"
+            }
+        ],
+        "comment" : [
+            {
+                token : "comment", // closing comment
+                regex : "^=end(?:$|\\s.*$)",
+                next : "start"
+            }, {
+                token : "comment", // comment spanning whole line
+                regex : ".+"
+            }
+        ]
+    };
+
+    this.normalizeRules();
+};
+
+oop.inherits(RubyHighlightRules, TextHighlightRules);
+
+exports.RubyHighlightRules = RubyHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/ruby_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/ruby_test.js b/src/fauxton/assets/js/libs/ace/mode/ruby_test.js
new file mode 100644
index 0000000..25548f0
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/ruby_test.js
@@ -0,0 +1,78 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("../edit_session").EditSession;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var Mode = require("./ruby").Mode;
+var assert = require("../test/assertions");
+
+module.exports = {
+    setUp : function() {
+        this.mode = new Mode();
+    },
+
+    "test getNextLineIndent": function() {
+        assert.equal(this.mode.getNextLineIndent("start", "class Foo", "  "), "  ");
+        assert.equal(this.mode.getNextLineIndent("start", "  def thing(wut)", "  "), "    ");
+        assert.equal(this.mode.getNextLineIndent("start", "  fork do", "  "), "    ");
+        assert.equal(this.mode.getNextLineIndent("start", "  fork do |wut| ", "  "), "    ");
+        assert.equal(this.mode.getNextLineIndent("start", "  something = :ruby", "  "), "  ");
+        assert.equal(this.mode.getNextLineIndent("start", "  if something == 3", "  "), "    ");
+        assert.equal(this.mode.getNextLineIndent("start", "  else", "  "), "    ");
+    },
+
+    "test: checkOutdent": function() {
+        assert.ok(this.mode.checkOutdent("start", "        en", "d"));
+        assert.ok(this.mode.checkOutdent("start", "        els", "e"));
+        assert.ok(this.mode.checkOutdent("start", "        ", "}"));
+        assert.equal(this.mode.checkOutdent("start", "  end", "\n"), false);
+        assert.equal(this.mode.checkOutdent("start", "foo = ba", "r"), false);
+    },
+
+    "test: auto outdent" : function() {
+        var session = new EditSession(["class Phil", "  Foo = 'bar'", "  end"]);
+        this.mode.autoOutdent("start", session, 2);
+        assert.equal("  end", session.getLine(2));
+    }
+
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/rust.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/rust.js b/src/fauxton/assets/js/libs/ace/mode/rust.js
new file mode 100644
index 0000000..2a46856
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/rust.js
@@ -0,0 +1,62 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ *
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var RustHighlightRules = require("./rust_highlight_rules").RustHighlightRules;
+// TODO: pick appropriate fold mode
+var FoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = RustHighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = "/\\*";
+    this.blockComment = {start: "/*", end: "*/"};
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/rust_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/rust_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/rust_highlight_rules.js
new file mode 100644
index 0000000..acb6c92
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/rust_highlight_rules.js
@@ -0,0 +1,129 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* This file was autogenerated from https://raw.github.com/dbp/sublime-rust/master/Rust.tmLanguage (uuid: ) */
+/****************************************************************************************
+ * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
+ * fileTypes                                                                            *
+ ****************************************************************************************/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var RustHighlightRules = function() {
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = { start: 
+       [ { token: 'variable.other.source.rust',
+           regex: '\'[a-zA-Z_][a-zA-Z0-9_]*[^\\\']' },
+         { token: 'string.quoted.single.source.rust',
+           regex: '\'',
+           push: 
+            [ { token: 'string.quoted.single.source.rust',
+                regex: '\'',
+                next: 'pop' },
+              { include: '#rust_escaped_character' },
+              { defaultToken: 'string.quoted.single.source.rust' } ] },
+         { token: 'string.quoted.double.source.rust',
+           regex: '"',
+           push: 
+            [ { token: 'string.quoted.double.source.rust',
+                regex: '"',
+                next: 'pop' },
+              { include: '#rust_escaped_character' },
+              { defaultToken: 'string.quoted.double.source.rust' } ] },
+         { token: [ 'keyword.source.rust', 'meta.function.source.rust',
+              'entity.name.function.source.rust', 'meta.function.source.rust' ],
+           regex: '\\b(fn)(\\s+)([a-zA-Z_][a-zA-Z0-9_][\\w\\:,+ \\\'<>]*)(\\s*\\()' },
+         { token: 'support.constant', regex: '\\b[a-zA-Z_][\\w\\d]*::' },
+         { token: 'keyword.source.rust',
+           regex: '\\b(?:as|assert|break|claim|const|copy|Copy|do|drop|else|extern|fail|for|if|impl|in|let|log|loop|match|mod|module|move|mut|Owned|priv|pub|pure|ref|return|unchecked|unsafe|use|while|mod|Send|static|trait|class|struct|enum|type)\\b' },
+         { token: 'storage.type.source.rust',
+           regex: '\\b(?:Self|m32|m64|m128|f80|f16|f128|int|uint|float|char|bool|u8|u16|u32|u64|f32|f64|i8|i16|i32|i64|str|option|either|c_float|c_double|c_void|FILE|fpos_t|DIR|dirent|c_char|c_schar|c_uchar|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|size_t|ptrdiff_t|clock_t|time_t|c_longlong|c_ulonglong|intptr_t|uintptr_t|off_t|dev_t|ino_t|pid_t|mode_t|ssize_t)\\b' },
+         { token: 'variable.language.source.rust', regex: '\\bself\\b' },
+         { token: 'keyword.operator',
+            regex: '!|\\$|\\*|\\-\\-|\\-|\\+\\+|\\+|-->|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|/=|%=|\\+=|\\-=|&=|\\^=|,|;' },
+         { token: 'constant.language.source.rust',
+           regex: '\\b(?:true|false|Some|None|Left|Right|Ok|Err)\\b' },
+         { token: 'support.constant.source.rust',
+           regex: '\\b(?:EXIT_FAILURE|EXIT_SUCCESS|RAND_MAX|EOF|SEEK_SET|SEEK_CUR|SEEK_END|_IOFBF|_IONBF|_IOLBF|BUFSIZ|FOPEN_MAX|FILENAME_MAX|L_tmpnam|TMP_MAX|O_RDONLY|O_WRONLY|O_RDWR|O_APPEND|O_CREAT|O_EXCL|O_TRUNC|S_IFIFO|S_IFCHR|S_IFBLK|S_IFDIR|S_IFREG|S_IFMT|S_IEXEC|S_IWRITE|S_IREAD|S_IRWXU|S_IXUSR|S_IWUSR|S_IRUSR|F_OK|R_OK|W_OK|X_OK|STDIN_FILENO|STDOUT_FILENO|STDERR_FILENO)\\b' },
+         { token: 'meta.preprocessor.source.rust',
+           regex: '\\b\\w\\(\\w\\)*!|#\\[[\\w=\\(\\)_]+\\]\\b' },
+         { token: 'constant.numeric.integer.source.rust',
+           regex: '\\b(?:[0-9][0-9_]*|[0-9][0-9_]*(?:u|u8|u16|u32|u64)|[0-9][0-9_]*(?:i|i8|i16|i32|i64))\\b' },
+         { token: 'constant.numeric.hex.source.rust',
+           regex: '\\b(?:0x[a-fA-F0-9_]+|0x[a-fA-F0-9_]+(?:u|u8|u16|u32|u64)|0x[a-fA-F0-9_]+(?:i|i8|i16|i32|i64))\\b' },
+         { token: 'constant.numeric.binary.source.rust',
+           regex: '\\b(?:0b[01_]+|0b[01_]+(?:u|u8|u16|u32|u64)|0b[01_]+(?:i|i8|i16|i32|i64))\\b' },
+         { token: 'constant.numeric.float.source.rust',
+           regex: '[0-9][0-9_]*(?:f32|f64|f)|[0-9][0-9_]*[eE][+-]=[0-9_]+|[0-9][0-9_]*[eE][+-]=[0-9_]+(?:f32|f64|f)|[0-9][0-9_]*\\.[0-9_]+|[0-9][0-9_]*\\.[0-9_]+(?:f32|f64|f)|[0-9][0-9_]*\\.[0-9_]+%[eE][+-]=[0-9_]+|[0-9][0-9_]*\\.[0-9_]+%[eE][+-]=[0-9_]+(?:f32|f64|f)' },
+         { token: 'comment.line.documentation.source.rust',
+           regex: '//!.*$',
+           push_: 
+            [ { token: 'comment.line.documentation.source.rust',
+                regex: '$',
+                next: 'pop' },
+              { defaultToken: 'comment.line.documentation.source.rust' } ] },
+         { token: 'comment.line.double-dash.source.rust',
+           regex: '//.*$',
+           push_: 
+            [ { token: 'comment.line.double-dash.source.rust',
+                regex: '$',
+                next: 'pop' },
+              { defaultToken: 'comment.line.double-dash.source.rust' } ] },
+         { token: 'comment.block.source.rust',
+           regex: '/\\*',
+           push: 
+            [ { token: 'comment.block.source.rust',
+                regex: '\\*/',
+                next: 'pop' },
+              { defaultToken: 'comment.block.source.rust' } ] } ],
+      '#rust_escaped_character': 
+       [ { token: 'constant.character.escape.source.rust',
+           regex: '\\\\(?:x[\\da-fA-F]{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)' } ] }
+    
+    this.normalizeRules();
+};
+
+RustHighlightRules.metaData = { fileTypes: [ 'rs', 'rc' ],
+      foldingStartMarker: '^.*\\bfn\\s*(\\w+\\s*)?\\([^\\)]*\\)(\\s*\\{[^\\}]*)?\\s*$',
+      foldingStopMarker: '^\\s*\\}',
+      name: 'Rust',
+      scopeName: 'source.rust' }
+
+
+oop.inherits(RustHighlightRules, TextHighlightRules);
+
+exports.RustHighlightRules = RustHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/sass.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/sass.js b/src/fauxton/assets/js/libs/ace/mode/sass.js
new file mode 100644
index 0000000..de78c71
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/sass.js
@@ -0,0 +1,52 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var SassHighlightRules = require("./sass_highlight_rules").SassHighlightRules;
+var FoldMode = require("./folding/coffee").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = SassHighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {   
+    this.lineCommentStart = "//";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/sass_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/sass_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/sass_highlight_rules.js
new file mode 100644
index 0000000..0183f73
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/sass_highlight_rules.js
@@ -0,0 +1,79 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var ScssHighlightRules = require("./scss_highlight_rules").ScssHighlightRules;
+
+var SassHighlightRules = function() {
+    ScssHighlightRules.call(this);
+    var start = this.$rules.start;
+    if (start[1].token == "comment") {
+        start.splice(1, 1, {
+            onMatch: function(value, currentState, stack) {
+                stack.unshift(this.next, -1, value.length - 2, currentState);
+                return "comment";
+            },
+            regex: /^\s*\/\*/,
+            next: "comment"
+        }, {
+            token: "error.invalid",
+            regex: "/\\*|[{;}]"
+        }, {
+            token: "support.type",
+            regex: /^\s*:[\w\-]+\s/
+        });
+        
+        this.$rules.comment = [
+            {regex: /^\s*/, onMatch: function(value, currentState, stack) {
+                if (stack[1] === -1)
+                    stack[1] = Math.max(stack[2], value.length - 1);
+                if (value.length <= stack[1]) {
+                    /*shift3x*/stack.shift();stack.shift();stack.shift();
+                    this.next = stack.shift();
+                    return "text";
+                } else {
+                    this.next = "";
+                    return "comment";
+                }
+            }, next: "start"},
+            {defaultToken: "comment"}
+        ]
+    }
+};
+
+oop.inherits(SassHighlightRules, ScssHighlightRules);
+
+exports.SassHighlightRules = SassHighlightRules;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/scad.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/scad.js b/src/fauxton/assets/js/libs/ace/mode/scad.js
new file mode 100644
index 0000000..ca8dc95
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/scad.js
@@ -0,0 +1,99 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var scadHighlightRules = require("./scad_highlight_rules").scadHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var Range = require("../range").Range;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = scadHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new CstyleBehaviour();
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = "//";
+    this.blockComment = {start: "/*", end: "*/"};
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+        var endState = tokenizedLine.state;
+
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+
+        if (state == "start") {
+            var match = line.match(/^.*[\{\(\[]\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        } else if (state == "doc-start") {
+            if (endState == "start") {
+                return "";
+            }
+            var match = line.match(/^\s*(\/?)\*/);
+            if (match) {
+                if (match[1]) {
+                    indent += " ";
+                }
+                indent += "* ";
+            }
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/scad_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/scad_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/scad_highlight_rules.js
new file mode 100644
index 0000000..20d7b64
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/scad_highlight_rules.js
@@ -0,0 +1,142 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var scadHighlightRules = function() {
+    var keywordMapper = this.createKeywordMapper({
+        "variable.language": "this",
+        "keyword": "module|if|else|for",
+        "constant.language": "NULL"
+    }, "identifier");
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "start" : [
+            {
+                token : "comment",
+                regex : "\\/\\/.*$"
+            },
+            DocCommentHighlightRules.getStartRule("start"),
+            {
+                token : "comment", // multi line comment
+                regex : "\\/\\*",
+                next : "comment"
+            }, {
+                token : "string", // single line
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+            }, {
+                token : "string", // multi line string start
+                regex : '["].*\\\\$',
+                next : "qqstring"
+            }, {
+                token : "string", // single line
+                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+            }, {
+                token : "string", // multi line string start
+                regex : "['].*\\\\$",
+                next : "qstring"
+            }, {
+                token : "constant.numeric", // hex
+                regex : "0[xX][0-9a-fA-F]+\\b"
+            }, {
+                token : "constant.numeric", // float
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+            }, {
+              token : "constant", // <CONSTANT>
+              regex : "<[a-zA-Z0-9.]+>"
+            }, {
+              token : "keyword", // pre-compiler directivs
+              regex : "(?:use|include)"
+            }, {
+                token : keywordMapper,
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+            }, {
+                token : "keyword.operator",
+                regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
+            }, {
+                token : "paren.lparen",
+                regex : "[[({]"
+            }, {
+                token : "paren.rparen",
+                regex : "[\\])}]"
+            }, {
+                token : "text",
+                regex : "\\s+"
+            }
+        ],
+        "comment" : [
+            {
+                token : "comment", // closing comment
+                regex : ".*?\\*\\/",
+                next : "start"
+            }, {
+                token : "comment", // comment spanning whole line
+                regex : ".+"
+            }
+        ],
+        "qqstring" : [
+            {
+                token : "string",
+                regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
+                next : "start"
+            }, {
+                token : "string",
+                regex : '.+'
+            }
+        ],
+        "qstring" : [
+            {
+                token : "string",
+                regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
+                next : "start"
+            }, {
+                token : "string",
+                regex : '.+'
+            }
+        ]
+    };
+    
+    this.embedRules(DocCommentHighlightRules, "doc-",
+        [ DocCommentHighlightRules.getEndRule("start") ]);
+};
+
+oop.inherits(scadHighlightRules, TextHighlightRules);
+
+exports.scadHighlightRules = scadHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/scala.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/scala.js b/src/fauxton/assets/js/libs/ace/mode/scala.js
new file mode 100644
index 0000000..5253cec
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/scala.js
@@ -0,0 +1,25 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var JavaScriptMode = require("./javascript").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var ScalaHighlightRules = require("./scala_highlight_rules").ScalaHighlightRules;
+
+var Mode = function() {
+    JavaScriptMode.call(this);
+    
+    this.HighlightRules = ScalaHighlightRules;
+};
+oop.inherits(Mode, JavaScriptMode);
+
+(function() {
+
+    this.createWorker = function(session) {
+        return null;
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/scala_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/scala_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/scala_highlight_rules.js
new file mode 100644
index 0000000..1d8ec8d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/scala_highlight_rules.js
@@ -0,0 +1,160 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var ScalaHighlightRules = function() {
+
+    // taken from http://download.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html
+    var keywords = (
+            "case|default|do|else|for|if|match|while|throw|return|try|catch|finally|yield|" +
+            "abstract|class|def|extends|final|forSome|implicit|implicits|import|lazy|new|object|" +
+            "override|package|private|protected|sealed|super|this|trait|type|val|var|with"
+    );
+
+    var buildinConstants = ("true|false");
+
+    var langClasses = (
+        "AbstractMethodError|AssertionError|ClassCircularityError|"+
+        "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+
+        "ExceptionInInitializerError|IllegalAccessError|"+
+        "IllegalThreadStateException|InstantiationError|InternalError|"+
+
+        "NegativeArraySizeException|NoSuchFieldError|Override|Process|"+
+        "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+
+        "SuppressWarnings|TypeNotPresentException|UnknownError|"+
+        "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+
+        "InstantiationException|IndexOutOfBoundsException|"+
+        "ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+
+        "NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+
+        "SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+
+        "InterruptedException|NoSuchMethodException|IllegalAccessException|"+
+        "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+
+        "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+
+        "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+
+        "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+
+        "Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+
+        "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+
+        "StackOverflowError|OutOfMemoryError|VirtualMachineError|"+
+        "ArrayStoreException|ClassCastException|LinkageError|"+
+        "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+
+        "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+
+        "Cloneable|Class|CharSequence|Comparable|String|Object|" +
+        "Unit|Any|AnyVal|AnyRef|Null|ScalaObject|Singleton|Seq|Iterable|List|" +
+        "Option|Array|Char|Byte|Short|Int|Long|Nothing"
+
+
+    );
+
+    var keywordMapper = this.createKeywordMapper({
+        "variable.language": "this",
+        "keyword": keywords,
+        "support.function": langClasses,
+        "constant.language": buildinConstants
+    }, "identifier");
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "start" : [
+            {
+                token : "comment",
+                regex : "\\/\\/.*$"
+            },
+            DocCommentHighlightRules.getStartRule("doc-start"),
+            {
+                token : "comment", // multi line comment
+                regex : "\\/\\*",
+                next : "comment"
+            }, {
+                token : "string.regexp",
+                regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
+            }, {
+                token : "string",
+                regex : '"""',
+                next : "tstring"
+            }, {
+                token : "string",
+                regex : '"(?=.)', // " strings can't span multiple lines
+                next : "string"
+            }, {
+                token : "symbol.constant", // single line
+                regex : "'[\\w\\d_]+"
+            }, {
+                token : "constant.numeric", // hex
+                regex : "0[xX][0-9a-fA-F]+\\b"
+            }, {
+                token : "constant.numeric", // float
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+            }, {
+                token : "constant.language.boolean",
+                regex : "(?:true|false)\\b"
+            }, {
+                token : keywordMapper,
+                // TODO: Unicode escape sequences
+                // TODO: Unicode identifiers
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+            }, {
+                token : "keyword.operator",
+                regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
+            }, {
+                token : "paren.lparen",
+                regex : "[[({]"
+            }, {
+                token : "paren.rparen",
+                regex : "[\\])}]"
+            }, {
+                token : "text",
+                regex : "\\s+"
+            }
+        ],
+        "comment" : [
+            {
+                token : "comment", // closing comment
+                regex : ".*?\\*\\/",
+                next : "start"
+            }, {
+                token : "comment", // comment spanning whole line
+                regex : ".+"
+            }
+        ],
+        "string" : [
+            {
+                token : "escape",
+                regex : '\\\\"'
+            }, {
+                token : "string",
+                regex : '"',
+                next : "start"
+            }, {
+                token : "string.invalid",
+                regex : '[^"\\\\]*$',
+                next : "start"
+            }, {
+                token : "string",
+                regex : '[^"\\\\]+'
+            }
+        ],
+        "tstring" : [
+            {
+                token : "string", // closing comment
+                regex : '"{3,5}',
+                next : "start"
+            }, {
+                token : "string", // comment spanning whole line
+                regex : ".+?"
+            }
+        ]
+    };
+
+    this.embedRules(DocCommentHighlightRules, "doc-",
+        [ DocCommentHighlightRules.getEndRule("start") ]);
+};
+
+oop.inherits(ScalaHighlightRules, TextHighlightRules);
+
+exports.ScalaHighlightRules = ScalaHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/scheme.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/scheme.js b/src/fauxton/assets/js/libs/ace/mode/scheme.js
new file mode 100644
index 0000000..4accf23
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/scheme.js
@@ -0,0 +1,56 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ * 
+ * NalaGinrut@gmail.com
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var SchemeHighlightRules = require("./scheme_highlight_rules").SchemeHighlightRules;
+
+var Mode = function() {
+    this.HighlightRules = SchemeHighlightRules;
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+       
+    this.lineCommentStart = ";";
+    
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/scheme_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/scheme_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/scheme_highlight_rules.js
new file mode 100644
index 0000000..bb628c1
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/scheme_highlight_rules.js
@@ -0,0 +1,123 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ * 
+ * NalaGinrut@gmail.com
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var SchemeHighlightRules = function() {
+    var keywordControl = "case|do|let|loop|if|else|when";
+    var keywordOperator = "eq?|eqv?|equal?|and|or|not|null?";
+    var constantLanguage = "#t|#f";
+    var supportFunctions = "cons|car|cdr|cond|lambda|lambda*|syntax-rules|format|set!|quote|eval|append|list|list?|member?|load";
+
+    var keywordMapper = this.createKeywordMapper({
+        "keyword.control": keywordControl,
+        "keyword.operator": keywordOperator,
+        "constant.language": constantLanguage,
+        "support.function": supportFunctions
+    }, "identifier", true);
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = 
+        {
+    "start": [
+        {
+            token : "comment",
+            regex : ";.*$"
+        },
+        {
+            "token": ["storage.type.function-type.scheme", "text", "entity.name.function.scheme"],
+            "regex": "(?:\\b(?:(define|define-syntax|define-macro))\\b)(\\s+)((?:\\w|\\-|\\!|\\?)*)"
+        },
+        {
+            "token": "punctuation.definition.constant.character.scheme",
+            "regex": "#:\\S+"
+        },
+        {
+            "token": ["punctuation.definition.variable.scheme", "variable.other.global.scheme", "punctuation.definition.variable.scheme"],
+            "regex": "(\\*)(\\S*)(\\*)"
+        },
+        {
+            "token" : "constant.numeric", // hex
+            "regex" : "#[xXoObB][0-9a-fA-F]+"
+        }, 
+        {
+            "token" : "constant.numeric", // float
+            "regex" : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?"
+        },
+        {
+                "token" : keywordMapper,
+                "regex" : "[a-zA-Z_#][a-zA-Z0-9_\\-\\?\\!\\*]*"
+        },
+        {
+            "token" : "string",
+            "regex" : '"(?=.)',
+            "next"  : "qqstring"
+        }
+    ],
+    "qqstring": [
+        {
+            "token": "constant.character.escape.scheme",
+            "regex": "\\\\."
+        },
+        {
+            "token" : "string",
+            "regex" : '[^"\\\\]+',
+            "merge" : true
+        }, {
+            "token" : "string",
+            "regex" : "\\\\$",
+            "next"  : "qqstring",
+            "merge" : true
+        }, {
+            "token" : "string",
+            "regex" : '"|$',
+            "next"  : "start",
+            "merge" : true
+        }
+    ]
+}
+
+};
+
+oop.inherits(SchemeHighlightRules, TextHighlightRules);
+
+exports.SchemeHighlightRules = SchemeHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/scss.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/scss.js b/src/fauxton/assets/js/libs/ace/mode/scss.js
new file mode 100644
index 0000000..111f71a
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/scss.js
@@ -0,0 +1,84 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var ScssHighlightRules = require("./scss_highlight_rules").ScssHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var CssBehaviour = require("./behaviour/css").CssBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = ScssHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new CssBehaviour();
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+   
+    this.lineCommentStart = "//";
+    this.blockComment = {start: "/*", end: "*/"};
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        // ignore braces in comments
+        var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+
+        var match = line.match(/^.*\{\s*$/);
+        if (match) {
+            indent += tab;
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/scss_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/scss_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/scss_highlight_rules.js
new file mode 100644
index 0000000..d63149d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/scss_highlight_rules.js
@@ -0,0 +1,296 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var ScssHighlightRules = function() {
+    
+    var properties = lang.arrayToMap( (function () {
+
+        var browserPrefix = ("-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-").split("|");
+        
+        var prefixProperties = ("appearance|background-clip|background-inline-policy|background-origin|" + 
+             "background-size|binding|border-bottom-colors|border-left-colors|" + 
+             "border-right-colors|border-top-colors|border-end|border-end-color|" + 
+             "border-end-style|border-end-width|border-image|border-start|" + 
+             "border-start-color|border-start-style|border-start-width|box-align|" + 
+             "box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|" + 
+             "box-pack|box-sizing|column-count|column-gap|column-width|column-rule|" + 
+             "column-rule-width|column-rule-style|column-rule-color|float-edge|" + 
+             "font-feature-settings|font-language-override|force-broken-image-icon|" + 
+             "image-region|margin-end|margin-start|opacity|outline|outline-color|" + 
+             "outline-offset|outline-radius|outline-radius-bottomleft|" + 
+             "outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|" + 
+             "outline-style|outline-width|padding-end|padding-start|stack-sizing|" + 
+             "tab-size|text-blink|text-decoration-color|text-decoration-line|" + 
+             "text-decoration-style|transform|transform-origin|transition|" + 
+             "transition-delay|transition-duration|transition-property|" + 
+             "transition-timing-function|user-focus|user-input|user-modify|user-select|" +
+             "window-shadow|border-radius").split("|");
+        
+        var properties = ("azimuth|background-attachment|background-color|background-image|" +
+            "background-position|background-repeat|background|border-bottom-color|" +
+            "border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
+            "border-color|border-left-color|border-left-style|border-left-width|" +
+            "border-left|border-right-color|border-right-style|border-right-width|" +
+            "border-right|border-spacing|border-style|border-top-color|" +
+            "border-top-style|border-top-width|border-top|border-width|border|bottom|" +
+            "box-shadow|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
+            "counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
+            "elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
+            "font-stretch|font-style|font-variant|font-weight|font|height|left|" +
+            "letter-spacing|line-height|list-style-image|list-style-position|" +
+            "list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
+            "margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
+            "min-width|opacity|orphans|outline-color|" +
+            "outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
+            "padding-left|padding-right|padding-top|padding|page-break-after|" +
+            "page-break-before|page-break-inside|page|pause-after|pause-before|" +
+            "pause|pitch-range|pitch|play-during|position|quotes|richness|right|" +
+            "size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
+            "stress|table-layout|text-align|text-decoration|text-indent|" +
+            "text-shadow|text-transform|top|unicode-bidi|vertical-align|" +
+            "visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
+            "z-index").split("|");
+          
+        //The return array     
+        var ret = [];
+        
+        //All prefixProperties will get the browserPrefix in
+        //the begning by join the prefixProperties array with the value of browserPrefix
+        for (var i=0, ln=browserPrefix.length; i<ln; i++) {
+            Array.prototype.push.apply(
+                ret,
+                (( browserPrefix[i] + prefixProperties.join("|" + browserPrefix[i]) ).split("|"))
+            );
+        }
+        
+        //Add also prefixProperties and properties without any browser prefix
+        Array.prototype.push.apply(ret, prefixProperties);
+        Array.prototype.push.apply(ret, properties);
+        
+        return ret;
+        
+    })() );
+    
+
+
+    var functions = lang.arrayToMap(
+        ("hsl|hsla|rgb|rgba|url|attr|counter|counters|abs|adjust_color|adjust_hue|" +
+         "alpha|join|blue|ceil|change_color|comparable|complement|darken|desaturate|" + 
+         "floor|grayscale|green|hue|if|invert|join|length|lighten|lightness|mix|" + 
+         "nth|opacify|opacity|percentage|quote|red|round|saturate|saturation|" +
+         "scale_color|transparentize|type_of|unit|unitless|unqoute").split("|")
+    );
+
+    var constants = lang.arrayToMap(
+        ("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
+        "block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
+        "char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
+        "decimal-leading-zero|decimal|default|disabled|disc|" +
+        "distribute-all-lines|distribute-letter|distribute-space|" +
+        "distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
+        "hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
+        "ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
+        "ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
+        "inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
+        "keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
+        "lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
+        "medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
+        "nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
+        "overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
+        "ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
+        "solid|square|static|strict|super|sw-resize|table-footer-group|" +
+        "table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
+        "transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
+        "vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
+        "zero").split("|")
+    );
+
+    var colors = lang.arrayToMap(
+        ("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
+        "purple|red|silver|teal|white|yellow").split("|")
+    );
+    
+    var keywords = lang.arrayToMap(
+        ("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|def|end|declare").split("|")
+    )
+    
+    var tags = lang.arrayToMap(
+        ("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" + 
+         "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" + 
+         "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" + 
+         "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" + 
+         "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" + 
+         "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" + 
+         "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" + 
+         "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" + 
+         "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
+    );
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "start" : [
+            {
+                token : "comment",
+                regex : "\\/\\/.*$"
+            },
+            {
+                token : "comment", // multi line comment
+                regex : "\\/\\*",
+                next : "comment"
+            }, {
+                token : "string", // single line
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+            }, {
+                token : "string", // multi line string start
+                regex : '["].*\\\\$',
+                next : "qqstring"
+            }, {
+                token : "string", // single line
+                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+            }, {
+                token : "string", // multi line string start
+                regex : "['].*\\\\$",
+                next : "qstring"
+            }, {
+                token : "constant.numeric",
+                regex : numRe + "(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)"
+            }, {
+                token : "constant.numeric", // hex6 color
+                regex : "#[a-f0-9]{6}"
+            }, {
+                token : "constant.numeric", // hex3 color
+                regex : "#[a-f0-9]{3}"
+            }, {
+                token : "constant.numeric",
+                regex : numRe
+            }, {
+                token : ["support.function", "string", "support.function"],
+                regex : "(url\\()(.*)(\\))"
+            }, {
+                token : function(value) {
+                    if (properties.hasOwnProperty(value.toLowerCase()))
+                        return "support.type";
+                    if (keywords.hasOwnProperty(value))
+                        return "keyword";
+                    else if (constants.hasOwnProperty(value))
+                        return "constant.language";
+                    else if (functions.hasOwnProperty(value))
+                        return "support.function";
+                    else if (colors.hasOwnProperty(value.toLowerCase()))
+                        return "support.constant.color";
+                    else if (tags.hasOwnProperty(value.toLowerCase()))
+                        return "variable.language";
+                    else
+                        return "text";
+                },
+                regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
+            }, {
+                token : "variable",
+                regex : "[a-z_\\-$][a-z0-9_\\-$]*\\b"
+            }, {
+                token: "variable.language",
+                regex: "#[a-z0-9-_]+"
+            }, {
+                token: "variable.language",
+                regex: "\\.[a-z0-9-_]+"
+            }, {
+                token: "variable.language",
+                regex: ":[a-z0-9-_]+"
+            }, {
+                token: "constant",
+                regex: "[a-z0-9-_]+"
+            }, {
+                token : "keyword.operator",
+                regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*"
+            }, {
+                token : "paren.lparen",
+                regex : "[[({]"
+            }, {
+                token : "paren.rparen",
+                regex : "[\\])}]"
+            }, {
+                token : "text",
+                regex : "\\s+"
+            }, {
+                caseInsensitive: true
+            }
+        ],
+        "comment" : [
+            {
+                token : "comment", // closing comment
+                regex : ".*?\\*\\/",
+                next : "start"
+            }, {
+                token : "comment", // comment spanning whole line
+                regex : ".+"
+            }
+        ],
+        "qqstring" : [
+            {
+                token : "string",
+                regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
+                next : "start"
+            }, {
+                token : "string",
+                regex : '.+'
+            }
+        ],
+        "qstring" : [
+            {
+                token : "string",
+                regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
+                next : "start"
+            }, {
+                token : "string",
+                regex : '.+'
+            }
+        ]
+    };
+};
+
+oop.inherits(ScssHighlightRules, TextHighlightRules);
+
+exports.ScssHighlightRules = ScssHighlightRules;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/sh.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/sh.js b/src/fauxton/assets/js/libs/ace/mode/sh.js
new file mode 100644
index 0000000..c66c261
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/sh.js
@@ -0,0 +1,112 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var ShHighlightRules = require("./sh_highlight_rules").ShHighlightRules;
+var Range = require("../range").Range;
+
+var Mode = function() {
+    this.HighlightRules = ShHighlightRules;
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+   
+    this.lineCommentStart = "#";
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+
+        if (state == "start") {
+            var match = line.match(/^.*[\{\(\[\:]\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        }
+
+        return indent;
+    };
+
+    var outdents = {
+        "pass": 1,
+        "return": 1,
+        "raise": 1,
+        "break": 1,
+        "continue": 1
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        if (input !== "\r\n" && input !== "\r" && input !== "\n")
+            return false;
+
+        var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
+
+        if (!tokens)
+            return false;
+
+        // ignore trailing comments
+        do {
+            var last = tokens.pop();
+        } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
+
+        if (!last)
+            return false;
+
+        return (last.type == "keyword" && outdents[last.value]);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        // outdenting in sh is slightly different because it always applies
+        // to the next line and only of a new line is inserted
+
+        row += 1;
+        var indent = this.$getIndent(doc.getLine(row));
+        var tab = doc.getTabString();
+        if (indent.slice(-tab.length) == tab)
+            doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});


[03/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/verilog_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/verilog_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/verilog_highlight_rules.js
new file mode 100644
index 0000000..83aa16a
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/verilog_highlight_rules.js
@@ -0,0 +1,101 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var VerilogHighlightRules = function() {
+var keywords = "always|and|assign|automatic|begin|buf|bufif0|bufif1|case|casex|casez|cell|cmos|config|" +
+    "deassign|default|defparam|design|disable|edge|else|end|endcase|endconfig|endfunction|endgenerate|endmodule|" +
+    "endprimitive|endspecify|endtable|endtask|event|for|force|forever|fork|function|generate|genvar|highz0|" +
+    "highz1|if|ifnone|incdir|include|initial|inout|input|instance|integer|join|large|liblist|library|localparam|" +
+    "macromodule|medium|module|nand|negedge|nmos|nor|noshowcancelled|not|notif0|notif1|or|output|parameter|pmos|" +
+    "posedge|primitive|pull0|pull1|pulldown|pullup|pulsestyle_onevent|pulsestyle_ondetect|rcmos|real|realtime|" +
+    "reg|release|repeat|rnmos|rpmos|rtran|rtranif0|rtranif1|scalared|showcancelled|signed|small|specify|specparam|" +
+    "strong0|strong1|supply0|supply1|table|task|time|tran|tranif0|tranif1|tri|tri0|tri1|triand|trior|trireg|" +
+    "unsigned|use|vectored|wait|wand|weak0|weak1|while|wire|wor|xnor|xor" +
+    "begin|bufif0|bufif1|case|casex|casez|config|else|end|endcase|endconfig|endfunction|" +
+    "endgenerate|endmodule|endprimitive|endspecify|endtable|endtask|for|forever|function|generate|if|ifnone|" +
+    "macromodule|module|primitive|repeat|specify|table|task|while";
+
+    var builtinConstants = (
+        "true|false|null"
+    );
+
+    var builtinFunctions = (
+        "count|min|max|avg|sum|rank|now|coalesce|main"
+    );
+
+    var keywordMapper = this.createKeywordMapper({
+        "support.function": builtinFunctions,
+        "keyword": keywords,
+        "constant.language": builtinConstants
+    }, "identifier", true);
+
+    this.$rules = {
+        "start" : [ {
+            token : "comment",
+            regex : "//.*$"
+        }, {
+            token : "string",           // " string
+            regex : '".*?"'
+        }, {
+            token : "string",           // ' string
+            regex : "'.*?'"
+        }, {
+            token : "constant.numeric", // float
+            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+        }, {
+            token : keywordMapper,
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        }, {
+            token : "keyword.operator",
+            regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
+        }, {
+            token : "paren.lparen",
+            regex : "[\\(]"
+        }, {
+            token : "paren.rparen",
+            regex : "[\\)]"
+        }, {
+            token : "text",
+            regex : "\\s+"
+        } ]
+    };
+};
+
+oop.inherits(VerilogHighlightRules, TextHighlightRules);
+
+exports.VerilogHighlightRules = VerilogHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/vhdl.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/vhdl.js b/src/fauxton/assets/js/libs/ace/mode/vhdl.js
new file mode 100644
index 0000000..13245e0
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/vhdl.js
@@ -0,0 +1,52 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2013, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var VHDLHighlightRules = require("./vhdl_highlight_rules").VHDLHighlightRules;
+var Range = require("../range").Range;
+
+var Mode = function() {
+    this.HighlightRules = VHDLHighlightRules;
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = "--";
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/vhdl_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/vhdl_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/vhdl_highlight_rules.js
new file mode 100644
index 0000000..671d0fe
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/vhdl_highlight_rules.js
@@ -0,0 +1,115 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2013, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var VHDLHighlightRules = function() {
+
+
+    
+    var keywords = "access|after|ailas|all|architecture|assert|attribute|"+
+                   "begin|block|buffer|bus|case|component|configuration|"+
+                   "disconnect|downto|else|elsif|end|entity|file|for|function|"+
+                   "generate|generic|guarded|if|impure|in|inertial|inout|is|"+
+                   "label|linkage|literal|loop|mapnew|next|of|on|open|"+
+                   "others|out|port|process|pure|range|record|reject|"+
+                   "report|return|select|shared|subtype|then|to|transport|"+
+                   "type|unaffected|united|until|wait|when|while|with";
+    
+    var storageType = "bit|bit_vector|boolean|character|integer|line|natural|"+
+                      "positive|real|register|severity|signal|signed|"+
+                      "std_logic|std_logic_vector|string||text|time|unsigned|"+
+                      "variable";
+    
+    var storageModifiers = "array|constant";
+    
+    var keywordOperators = "abs|and|mod|nand|nor|not|rem|rol|ror|sla|sll|sra"+
+                           "srl|xnor|xor";
+    
+    var builtinConstants = (
+        "true|false|null"
+    );
+
+
+    var keywordMapper = this.createKeywordMapper({
+        "keyword.operator": keywordOperators,
+        "keyword": keywords,
+        "constant.language": builtinConstants,
+        "storage.modifier": storageModifiers,
+        "storage.type": storageType
+    }, "identifier", true);
+
+    this.$rules = {
+        "start" : [ {
+            token : "comment",
+            regex : "--.*$"
+        }, {
+            token : "string",           // " string
+            regex : '".*?"'
+        }, {
+            token : "string",           // ' string
+            regex : "'.*?'"
+        }, {
+            token : "constant.numeric", // float
+            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+        }, {
+            token : "keyword", // pre-compiler directives
+            regex : "\\s*(?:library|package|use)\\b",
+        }, {
+            token : keywordMapper,
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        }, {
+            token : "keyword.operator",
+            regex : "&|\\*|\\+|\\-|\\/|<|=|>|\\||=>|\\*\\*|:=|\\/=|>=|<=|<>" 
+        }, {
+              token : "punctuation.operator",
+              regex : "\\'|\\:|\\,|\\;|\\."
+        },{
+            token : "paren.lparen",
+            regex : "[[(]"
+        }, {
+            token : "paren.rparen",
+            regex : "[\\])]"
+        }, {
+            token : "text",
+            regex : "\\s+"
+        } ],
+
+       
+    };
+};
+
+oop.inherits(VHDLHighlightRules, TextHighlightRules);
+
+exports.VHDLHighlightRules = VHDLHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/xml.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/xml.js b/src/fauxton/assets/js/libs/ace/mode/xml.js
new file mode 100644
index 0000000..c6e18fc
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/xml.js
@@ -0,0 +1,56 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
+var XmlBehaviour = require("./behaviour/xml").XmlBehaviour;
+var XmlFoldMode = require("./folding/xml").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = XmlHighlightRules;
+    this.$behaviour = new XmlBehaviour();
+    this.foldingRules = new XmlFoldMode();
+};
+
+oop.inherits(Mode, TextMode);
+
+(function() {
+    
+    this.blockComment = {start: "<!--", end: "-->"};
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/xml_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/xml_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/xml_highlight_rules.js
new file mode 100644
index 0000000..dd3d2a2
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/xml_highlight_rules.js
@@ -0,0 +1,216 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var xmlUtil = require("./xml_util");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var XmlHighlightRules = function(normalize) {
+    this.$rules = {
+        start : [
+            {token : "punctuation.string.begin", regex : "<\\!\\[CDATA\\[", next : "cdata"},
+            {
+                token : ["punctuation.instruction.begin", "keyword.instruction"],
+                regex : "(<\\?)(xml)(?=[\\s])", next : "xml_declaration"
+            },
+            {
+                token : ["punctuation.instruction.begin", "keyword.instruction"],
+                regex : "(<\\?)([-_a-zA-Z0-9]+)", next : "instruction"
+            },
+            {token : "comment", regex : "<\\!--", next : "comment"},
+            {
+                token : ["punctuation.doctype.begin", "meta.tag.doctype"],
+                regex : "(<\\!)(DOCTYPE)(?=[\\s])", next : "doctype"
+            },
+            {include : "tag"},
+            {include : "reference"}
+        ],
+
+        xml_declaration : [
+            {include : "attributes"},
+            {include : "instruction"}
+        ],
+
+        instruction : [
+            {token : "punctuation.instruction.end", regex : "\\?>", next : "start"}
+        ],
+
+        doctype : [
+            {include : "space"},
+            {include : "string"},
+            {token : "punctuation.doctype.end", regex : ">", next : "start"},
+            {token : "xml-pe", regex : "[-_a-zA-Z0-9:]+"},
+            {token : "punctuation.begin", regex : "\\[", push : "declarations"}
+        ],
+
+        declarations : [{
+            token : "text",
+            regex : "\\s+"
+        }, {
+            token: "punctuation.end",
+            regex: "]",
+            next: "pop"
+        }, {
+            token : ["punctuation.begin", "keyword"],
+            regex : "(<\\!)([-_a-zA-Z0-9]+)",
+            push : [{
+                token : "text",
+                regex : "\\s+"
+            },
+            {
+                token : "punctuation.end",
+                regex : ">",
+                next : "pop"
+            },
+            {include : "string"}]
+        }],
+
+        cdata : [
+            {token : "string.end", regex : "\\]\\]>", next : "start"},
+            {token : "text", regex : "\\s+"},
+            {token : "text", regex : "(?:[^\\]]|\\](?!\\]>))+"}
+        ],
+
+        comment : [
+            {token : "comment", regex : "-->", next : "start"},
+            {defaultToken : "comment"}
+        ],
+
+        tag : [{
+            token : ["meta.tag.punctuation.begin", "meta.tag.name"],
+            regex : "(<)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)",
+            next: [
+                {include : "attributes"},
+                {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"}
+            ]
+        }, {
+            token : ["meta.tag.punctuation.begin", "meta.tag.name"],
+            regex : "(</)((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)",
+            next: [
+                {include : "space"},
+                {token : "meta.tag.punctuation.end", regex : ">", next : "start"}
+            ]
+        }],
+
+        space : [
+            {token : "text", regex : "\\s+"}
+        ],
+
+        reference : [{
+            token : "constant.language.escape",
+            regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
+        }, {
+            token : "invalid.illegal", regex : "&"
+        }],
+
+        string: [{
+            token : "string",
+            regex : "'",
+            push : "qstring_inner"
+        }, {
+            token : "string",
+            regex : '"',
+            push : "qqstring_inner"
+        }],
+
+        qstring_inner: [
+            {token : "string", regex: "'", next: "pop"},
+            {include : "reference"},
+            {defaultToken : "string"}
+        ],
+
+        qqstring_inner: [
+            {token : "string", regex: '"', next: "pop"},
+            {include : "reference"},
+            {defaultToken : "string"}
+        ],
+
+        attributes: [{
+            token : "entity.other.attribute-name",
+            regex : "(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+"
+        }, {
+            token : "keyword.operator.separator",
+            regex : "="
+        }, {
+            include : "space"
+        }, {
+            include : "string"
+        }]
+    };
+
+    if (this.constructor === XmlHighlightRules)
+        this.normalizeRules();
+};
+
+
+(function() {
+
+    this.embedTagRules = function(HighlightRules, prefix, tag){
+        this.$rules.tag.unshift({
+            token : ["meta.tag.punctuation.begin", "meta.tag.name." + tag],
+            regex : "(<)(" + tag + ")",
+            next: [
+                {include : "space"},
+                {include : "attributes"},
+                {token : "meta.tag.punctuation.end", regex : "/?>", next : prefix + "start"}
+            ]
+        });
+
+        this.$rules[tag + "-end"] = [
+            {include : "space"},
+            {token : "meta.tag.punctuation.end", regex : ">",  next: "start",
+                onMatch : function(value, currentState, stack) {
+                    stack.splice(0);
+                    return this.token;
+            }}
+        ]
+
+        this.embedRules(HighlightRules, prefix, [{
+            token: ["meta.tag.punctuation.begin", "meta.tag.name." + tag],
+            regex : "(</)(" + tag + ")",
+            next: tag + "-end"
+        }, {
+            token: "string.begin",
+            regex : "<\\!\\[CDATA\\["
+        }, {
+            token: "string.end",
+            regex : "\\]\\]>"
+        }]);
+    };
+
+}).call(TextHighlightRules.prototype);
+
+oop.inherits(XmlHighlightRules, TextHighlightRules);
+
+exports.XmlHighlightRules = XmlHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/xml_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/xml_test.js b/src/fauxton/assets/js/libs/ace/mode/xml_test.js
new file mode 100644
index 0000000..39edf63
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/xml_test.js
@@ -0,0 +1,75 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("../edit_session").EditSession;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var XmlMode = require("./xml").Mode;
+var assert = require("../test/assertions");
+
+module.exports = {
+    setUp : function() {
+        this.mode = new XmlMode();
+    },
+
+    "test: getTokenizer() (smoke test)" : function() {
+        var tokenizer = this.mode.getTokenizer();
+
+        assert.ok(tokenizer instanceof Tokenizer);
+
+        var tokens = tokenizer.getLineTokens("<juhu>", "start").tokens;
+        assert.equal("meta.tag.punctuation.begin", tokens[0].type);
+    },
+
+    "test: toggle comment lines should not do anything" : function() {
+        var session = new EditSession(["    abc", "  cde", "fg"]);
+
+        this.mode.toggleCommentLines("start", session, 0, 1);
+        assert.equal(["  <!--  abc-->", "  <!--cde-->", "fg"].join("\n"), session.toString());
+    },
+
+    "test: next line indent should be the same as the current line indent" : function() {
+        assert.equal("     ", this.mode.getNextLineIndent("start", "     abc"));
+        assert.equal("", this.mode.getNextLineIndent("start", "abc"));
+        assert.equal("\t", this.mode.getNextLineIndent("start", "\tabc"));
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec();
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/xml_util.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/xml_util.js b/src/fauxton/assets/js/libs/ace/mode/xml_util.js
new file mode 100644
index 0000000..abae607
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/xml_util.js
@@ -0,0 +1,100 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+function string(state) {
+    return [{
+        token : "string",
+        regex : '"',
+        next : state + "_qqstring"
+    }, {
+        token : "string",
+        regex : "'",
+        next : state + "_qstring"
+    }];
+}
+
+function multiLineString(quote, state) {
+    return [
+        {token : "string", regex : quote, next : state},
+        {
+            token : "constant.language.escape",
+            regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" 
+        },
+        {defaultToken : "string"}
+    ];
+}
+
+exports.tag = function(states, name, nextState, tagMap) {
+    states[name] = [{
+        token : "text",
+        regex : "\\s+"
+    }, {
+        //token : "meta.tag",
+        
+    token : !tagMap ? "meta.tag.tag-name" : function(value) {
+            if (tagMap[value])
+                return "meta.tag.tag-name." + tagMap[value];
+            else
+                return "meta.tag.tag-name";
+        },
+        regex : "[-_a-zA-Z0-9:]+",
+        next : name + "_embed_attribute_list" 
+    }, {
+        token: "empty",
+        regex: "",
+        next : name + "_embed_attribute_list"
+    }];
+
+    states[name + "_qstring"] = multiLineString("'", name + "_embed_attribute_list");
+    states[name + "_qqstring"] = multiLineString("\"", name + "_embed_attribute_list");
+    
+    states[name + "_embed_attribute_list"] = [{
+        token : "meta.tag.r",
+        regex : "/?>",
+        next : nextState
+    }, {
+        token : "keyword.operator",
+        regex : "="
+    }, {
+        token : "entity.other.attribute-name",
+        regex : "[-_a-zA-Z0-9:]+"
+    }, {
+        token : "constant.numeric", // float
+        regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+    }, {
+        token : "text",
+        regex : "\\s+"
+    }].concat(string(name));
+};
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/xquery.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/xquery.js b/src/fauxton/assets/js/libs/ace/mode/xquery.js
new file mode 100644
index 0000000..f316b90
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/xquery.js
@@ -0,0 +1,139 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+define(function(require, exports, module) {
+"use strict";
+
+var WorkerClient = require("../worker/worker_client").WorkerClient;
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var XQueryLexer = require("./xquery/XQueryLexer").XQueryLexer;
+var Range = require("../range").Range;
+var XQueryBehaviour = require("./behaviour/xquery").XQueryBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+
+var Mode = function() {
+    this.$tokenizer   = new XQueryLexer();
+    this.$behaviour   = new XQueryBehaviour();
+    this.foldingRules = new CStyleFoldMode();
+};
+
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+        var match = line.match(/\s*(?:then|else|return|[{\(]|<\w+>)\s*$/);
+        if (match)
+            indent += tab;
+        return indent;
+    };
+    
+    this.checkOutdent = function(state, line, input) {
+        if (! /^\s+$/.test(line))
+            return false;
+
+        return /^\s*[\}\)]/.test(input);
+    };
+    
+    this.autoOutdent = function(state, doc, row) {
+        var line = doc.getLine(row);
+        var match = line.match(/^(\s*[\}\)])/);
+
+        if (!match) return 0;
+
+        var column = match[1].length;
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
+
+        if (!openBracePos || openBracePos.row == row) return 0;
+
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
+        doc.replace(new Range(row, 0, row, column-1), indent);
+    };
+
+    this.toggleCommentLines = function(state, doc, startRow, endRow) {
+        var i, line;
+        var outdent = true;
+        var re = /^\s*\(:(.*):\)/;
+
+        for (i=startRow; i<= endRow; i++) {
+            if (!re.test(doc.getLine(i))) {
+                outdent = false;
+                break;
+            }
+        }
+
+        var range = new Range(0, 0, 0, 0);
+        for (i=startRow; i<= endRow; i++) {
+            line = doc.getLine(i);
+            range.start.row  = i;
+            range.end.row    = i;
+            range.end.column = line.length;
+
+            doc.replace(range, outdent ? line.match(re)[1] : "(:" + line + ":)");
+        }
+    };
+    
+    this.createWorker = function(session) {
+        
+      var worker = new WorkerClient(["ace"], "ace/mode/xquery_worker", "XQueryWorker");
+        var that = this;
+
+        worker.attachToDocument(session.getDocument());
+        
+        worker.on("error", function(e) {
+          session.setAnnotations([e.data]);
+        });
+        
+        worker.on("ok", function(e) {
+          session.clearAnnotations();
+        });
+        
+        worker.on("highlight", function(tokens) {
+          that.$tokenizer.tokens = tokens.data.tokens;
+          that.$tokenizer.lines  = session.getDocument().getAllLines();
+          
+          var rows = Object.keys(that.$tokenizer.tokens);
+          for(var i=0; i < rows.length; i++) {
+            var row = parseInt(rows[i]);
+            delete session.bgTokenizer.lines[row];
+            delete session.bgTokenizer.states[row];
+            session.bgTokenizer.fireUpdateEvent(row, row);
+          }
+        });
+        
+        return worker;
+    };
+    
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/xquery/JSONParseTreeHandler.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/xquery/JSONParseTreeHandler.js b/src/fauxton/assets/js/libs/ace/mode/xquery/JSONParseTreeHandler.js
new file mode 100644
index 0000000..9b85076
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/xquery/JSONParseTreeHandler.js
@@ -0,0 +1,178 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+ 
+define(function(require, exports, module){
+
+  var JSONParseTreeHandler = exports.JSONParseTreeHandler = function(code) {
+
+    //List of nodes that are not targeted by the parse tree size optimization.
+    var list = [
+        "OrExpr", "AndExpr", "ComparisonExpr", "StringConcatExpr", "RangeExpr"
+        //, "AdditiveExpr", "MultiplicativeExpr"
+        , "UnionExpr", "IntersectExceptExpr", "InstanceofExpr", "TreatExpr", "CastableExpr"
+        , "CastExpr", "UnaryExpr", "ValueExpr", "FTContainsExpr", "SimpleMapExpr", "PathExpr", "RelativePathExpr"
+        , "PostfixExpr", "StepExpr"
+    ];
+    
+    var ast = null;
+    var ptr = null;
+    var remains = code;
+    var cursor = 0;
+    var lineCursor = 0;
+    var line = 0;
+    var col = 0;
+
+    function createNode(name){
+      return { name: name, children: [], getParent: null, pos: { sl: 0, sc: 0, el: 0, ec: 0 } };
+    }
+  
+    function pushNode(name, begin){
+      var node = createNode(name);
+      if(ast === null) {
+        ast = node;
+        ptr = node;
+      } else {
+        node.getParent = ptr;
+        ptr.children.push(node);
+        ptr = ptr.children[ptr.children.length - 1];
+      }
+    }
+    
+    function popNode(){
+     
+      if(ptr.children.length > 0) {
+        var s = ptr.children[0];
+        var e = null;
+        //We want to skip empty non terminals. For instance PredicateList:
+        // [108] AxisStep ::= (ReverseStep | ForwardStep) PredicateList
+        // [120] PredicateList ::= Predicate*
+        for(var i= ptr.children.length - 1; i >= 0;i--) {
+          e = ptr.children[i];
+          if(e.pos.el !== 0 || e.pos.ec !== 0) {
+            break;
+          }
+        }
+        ptr.pos.sl = s.pos.sl;
+        ptr.pos.sc = s.pos.sc;
+        ptr.pos.el = e.pos.el;
+        ptr.pos.ec = e.pos.ec;
+      }
+      
+      //Normalize EQName && FunctionName
+      if(ptr.name === "FunctionName") {
+        ptr.name = "EQName";  
+      }
+      if(ptr.name === "EQName" && ptr.value === undefined) {
+        ptr.value = ptr.children[0].value;
+        ptr.children.pop();
+      }
+      
+      if(ptr.getParent !== null) {
+        ptr = ptr.getParent;
+        //for(var i in ptr.children) {
+          //delete ptr.children[i].getParent;
+        //}
+      } else {
+        //delete ptr.getParent;
+      }
+
+      //Parse tree size optimization
+      if(ptr.children.length > 0) {
+        var lastChild = ptr.children[ptr.children.length - 1];
+        if(lastChild.children.length === 1 && list.indexOf(lastChild.name) !== -1) {
+          ptr.children[ptr.children.length - 1] = lastChild.children[0];
+        }
+      }
+    }
+    
+    this.closeParseTree = function() {
+      while(ptr.getParent !== null) {
+        popNode();
+      }
+      popNode();
+    };
+
+    this.peek = function() {
+      return ptr;    
+    };
+    
+    this.getParseTree = function() {
+      return ast;
+    };
+ 
+    this.reset = function(input) {};
+
+    this.startNonterminal = function(name, begin) {
+      pushNode(name, begin);
+    };
+
+    this.endNonterminal = function(name, end) {
+      popNode();
+    };
+
+    this.terminal = function(name, begin, end) {
+      name = (name.substring(0, 1) === "'" && name.substring(name.length - 1) === "'") ? "TOKEN" : name;
+      pushNode(name, begin); 
+      setValue(ptr, begin, end);
+      popNode();
+    };
+
+    this.whitespace = function(begin, end) {
+      var name = "WS";
+      pushNode(name, begin);
+      setValue(ptr, begin, end);
+      popNode();
+    };
+
+    function setValue(node, begin, end) {
+      
+      var e = end - cursor;
+      ptr.value = remains.substring(0, e); 
+      remains = remains.substring(e);
+      cursor = end;
+      
+      var sl = line;
+      var sc = lineCursor;
+      var el = sl + ptr.value.split("\n").length - 1;
+      var lastIdx = ptr.value.lastIndexOf("\n");
+      var ec = lastIdx === -1 ? sc + ptr.value.length : ptr.value.substring(lastIdx + 1).length;
+//      ec = ec === 0 ? 0 : ec - 1;
+      
+      line = el;
+      //lineCursor = ec === 0 ? 0 : ec;
+      lineCursor = ec;
+
+      ptr.pos.sl = sl; 
+      ptr.pos.sc = sc; 
+      ptr.pos.el = el; 
+      ptr.pos.ec = ec; 
+    } 
+  };
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/xquery/JSONiqLexer.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/xquery/JSONiqLexer.js b/src/fauxton/assets/js/libs/ace/mode/xquery/JSONiqLexer.js
new file mode 100644
index 0000000..d2a9b48
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/xquery/JSONiqLexer.js
@@ -0,0 +1,302 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+ 
+define(function(require, exports, module){
+  
+  var JSONiqTokenizer = require("./JSONiqTokenizer").JSONiqTokenizer;
+  
+  var TokenHandler = function(code) {
+      
+    var input = code;
+    
+    this.tokens = [];
+ 
+    this.reset = function(code) {
+      input = input;
+      this.tokens = [];
+    };
+    
+    this.startNonterminal = function(name, begin) {};
+
+    this.endNonterminal = function(name, end) {};
+
+    this.terminal = function(name, begin, end) {
+      this.tokens.push({
+        name: name,
+        value: input.substring(begin, end)
+      });
+    };
+
+    this.whitespace = function(begin, end) {
+      this.tokens.push({
+        name: "WS",
+        value: input.substring(begin, end)
+      });
+    };
+  };
+    var keys = "NaN|after|allowing|ancestor|ancestor-or-self|and|append|array|as|ascending|at|attribute|base-uri|before|boundary-space|break|by|case|cast|castable|catch|child|collation|comment|constraint|construction|contains|context|continue|copy|copy-namespaces|count|decimal-format|decimal-separator|declare|default|delete|descendant|descendant-or-self|descending|digit|div|document|document-node|element|else|empty|empty-sequence|encoding|end|eq|every|except|exit|external|false|first|following|following-sibling|for|from|ft-option|function|ge|greatest|group|grouping-separator|gt|idiv|if|import|in|index|infinity|insert|instance|integrity|intersect|into|is|item|json|json-item|jsoniq|last|lax|le|least|let|loop|lt|minus-sign|mod|modify|module|namespace|namespace-node|ne|next|node|nodes|not|null|object|of|only|option|or|order|ordered|ordering|paragraphs|parent|pattern-separator|per-mille|percent|preceding|preceding-sibling|previous|processing-instruction|rename|replace|return|returning|re
 validation|satisfies|schema|schema-attribute|schema-element|score|select|self|sentences|sliding|some|stable|start|strict|switch|text|then|times|to|treat|true|try|tumbling|type|typeswitch|union|unordered|updating|validate|value|variable|version|when|where|while|window|with|words|xquery|zero-digit".split("|");
+    var keywords = keys.map(
+      function(val) { return { name: "'" + val + "'", token: "keyword" }; }
+    );
+    
+    var ncnames = keys.map(
+      function(val) { return { name: "'" + val + "'", token: "text", next: function(stack){ stack.pop(); } }; }
+    );
+
+    var cdata = "constant.language";
+    var number = "constant";
+    var xmlcomment = "comment";
+    var pi = "xml-pe";
+    var pragma = "constant.buildin";
+    
+    var Rules = {
+      start: [
+        { name: "'(#'", token: pragma, next: function(stack){ stack.push("Pragma"); } },
+        { name: "'(:'", token: "comment", next: function(stack){ stack.push("Comment"); } },
+        { name: "'(:~'", token: "comment.doc", next: function(stack){ stack.push("CommentDoc"); } },
+        { name: "'<!--'", token: xmlcomment, next: function(stack){ stack.push("XMLComment"); } },
+        { name: "'<?'", token: pi, next: function(stack) { stack.push("PI"); } },
+        { name: "''''", token: "string", next: function(stack){ stack.push("AposString"); } },
+        { name: "'\"'", token: "string", next: function(stack){ stack.push("QuotString"); } },
+        { name: "Annotation", token: "support.function" },
+        { name: "ModuleDecl", token: "keyword", next: function(stack){ stack.push("Prefix"); } },
+        { name: "OptionDecl", token: "keyword", next: function(stack){ stack.push("_EQName"); } },
+        { name: "AttrTest", token: "support.type" },
+        { name: "Variable",  token: "variable" },
+        { name: "'<![CDATA['", token: cdata, next: function(stack){ stack.push("CData"); } },
+        { name: "IntegerLiteral", token: number },
+        { name: "DecimalLiteral", token: number },
+        { name: "DoubleLiteral", token: number },
+        { name: "Operator", token: "keyword.operator" },
+        { name: "EQName", token: function(val) { return keys.indexOf(val) !== -1 ? "keyword" : "support.function"; } },
+        { name: "'('", token:"lparen" },
+        { name: "')'", token:"rparen" },
+        { name: "Tag", token: "meta.tag", next: function(stack){ stack.push("StartTag"); } },
+        { name: "'}'", token: "text", next: function(stack){ if(stack.length > 1) stack.pop();  } },
+        { name: "'{'", token: "text", next: function(stack){ stack.push("start"); } } //, next: function(stack){ if(stack.length > 1) { stack.pop(); } } }
+      ].concat(keywords),
+      _EQName: [
+        { name: "EQName", token: "text", next: function(stack) { stack.pop(); } }
+      ].concat(ncnames),
+      Prefix: [
+        { name: "NCName", token: "text", next: function(stack) { stack.pop(); } }
+      ].concat(ncnames),
+      StartTag: [
+        { name: "'>'", token: "meta.tag", next: function(stack){ stack.push("TagContent"); } },
+        { name: "QName", token: "entity.other.attribute-name" },
+        { name: "'='", token: "text" },
+        { name: "''''", token: "string", next: function(stack){ stack.push("AposAttr"); } },
+        { name: "'\"'", token: "string", next: function(stack){ stack.push("QuotAttr"); } },
+        { name: "'/>'", token: "meta.tag.r", next: function(stack){ stack.pop(); } }
+      ],
+      TagContent: [
+        { name: "ElementContentChar", token: "text" },
+        { name: "'<![CDATA['", token: cdata, next: function(stack){ stack.push("CData"); } },
+        { name: "'<!--'", token: xmlcomment, next: function(stack){ stack.push("XMLComment"); } },
+        { name: "Tag", token: "meta.tag", next: function(stack){ stack.push("StartTag"); } },
+        { name: "PredefinedEntityRef", token: "constant.language.escape" },
+        { name: "CharRef", token: "constant.language.escape" },
+        { name: "'{{'", token: "text" },
+        { name: "'}}'", token: "text" },
+        { name: "'{'", token: "text", next: function(stack){ stack.push("start"); } },
+        { name: "EndTag", token: "meta.tag", next: function(stack){ stack.pop(); stack.pop(); } }
+      ],
+      AposAttr: [
+        { name: "''''", token: "string", next: function(stack){ stack.pop(); } },
+        { name: "EscapeApos", token: "constant.language.escape" },
+        { name: "AposAttrContentChar", token: "string" },
+        { name: "PredefinedEntityRef", token: "constant.language.escape" },
+        { name: "CharRef", token: "constant.language.escape" },
+        { name: "'{{'", token: "string" },
+        { name: "'}}'", token: "string" },
+        { name: "'{'", token: "text", next: function(stack){ stack.push("start"); } }
+      ],
+      QuotAttr: [
+        { name: "'\"'", token: "string", next: function(stack){ stack.pop(); } },
+        { name: "EscapeQuot", token: "constant.language.escape" },
+        { name: "QuotAttrContentChar", token: "string" },
+        { name: "PredefinedEntityRef", token: "constant.language.escape" },
+        { name: "CharRef", token: "constant.language.escape" },
+        { name: "'{{'", token: "string" },
+        { name: "'}}'", token: "string" },
+        { name: "'{'", token: "text", next: function(stack){ stack.push("start"); } }
+      ],
+      Pragma: [
+        { name: "PragmaContents", token: pragma },
+        { name: "'#'", token: pragma },
+        { name: "'#)'", token: pragma, next: function(stack){ stack.pop(); } }
+      ],
+      Comment: [
+        { name: "CommentContents", token: "comment" },
+        { name: "'(:'", token: "comment", next: function(stack){ stack.push("Comment"); } },
+        { name: "':)'", token: "comment", next: function(stack){ stack.pop(); } }
+      ],
+      CommentDoc: [
+        { name: "DocCommentContents", token: "comment.doc" },
+        { name: "DocTag", token: "comment.doc.tag" },
+        { name: "'(:'", token: "comment.doc", next: function(stack){ stack.push("CommentDoc"); } },
+        { name: "':)'", token: "comment.doc", next: function(stack){ stack.pop(); } }
+      ],
+      XMLComment: [
+        { name: "DirCommentContents", token: xmlcomment },
+        { name: "'-->'", token: xmlcomment, next: function(stack){ stack.pop(); } }
+      ],
+      CData: [
+        { name: "CDataSectionContents", token: cdata },
+        { name: "']]>'", token: cdata, next: function(stack){ stack.pop(); } }
+      ],
+      PI: [
+        { name: "DirPIContents", token: pi },
+        { name: "'?'", token: pi },
+        { name: "'?>'", token: pi, next: function(stack){ stack.pop(); } }
+      ],
+      AposString: [
+        { name: "''''", token: "string", next: function(stack){ stack.pop(); } },
+        { name: "PredefinedEntityRef", token: "constant.language.escape" },
+        { name: "CharRef", token: "constant.language.escape" },
+        { name: "EscapeApos", token: "constant.language.escape" },
+        { name: "AposChar", token: "string" }
+      ],
+      QuotString: [
+        { name: "'\"'", token: "string", next: function(stack){ stack.pop(); } },
+        { name: "PredefinedEntityRef", token: "constant.language.escape" },
+        { name: "CharRef", token: "constant.language.escape" },
+        { name: "EscapeQuot", token: "constant.language.escape" },
+        { name: "QuotChar", token: "string" }
+      ]
+    };
+    
+exports.JSONiqLexer = function() {
+  
+  this.tokens = [];
+  
+  this.getLineTokens = function(line, state, row) {
+    state = (state === "start" || !state) ? '["start"]' : state;
+    var stack = JSON.parse(state);
+    var h = new TokenHandler(line);
+    var tokenizer = new JSONiqTokenizer(line, h);
+    var tokens = [];
+    
+    while(true) {
+      var currentState = stack[stack.length - 1];
+      try {
+        
+        h.tokens = [];
+        tokenizer["parse_" + currentState]();
+        var info = null;
+        
+        if(h.tokens.length > 1 && h.tokens[0].name === "WS") {
+          tokens.push({
+            type: "text",
+            value: h.tokens[0].value
+          });
+          h.tokens.splice(0, 1);
+        }
+        
+        var token = h.tokens[0];
+        var rules  = Rules[currentState];
+        for(var k = 0; k < rules.length; k++) {
+          var rule = Rules[currentState][k];
+          if((typeof(rule.name) === "function" && rule.name(token)) || rule.name === token.name) {
+            info = rule;
+            break;
+          }
+        }
+        
+        if(token.name === "EOF") { break; }
+        if(token.value === "") { throw "Encountered empty string lexical rule."; }
+        
+        tokens.push({
+          type: info === null ? "text" : (typeof(info.token) === "function" ? info.token(token.value) : info.token),
+          value: token.value
+        });
+        
+        if(info && info.next) {
+          info.next(stack);    
+        }
+      
+      } catch(e) {
+        if(e instanceof tokenizer.ParseException) {
+          var index = 0;
+          for(var i=0; i < tokens.length; i++) {
+            index += tokens[i].value.length;
+          }
+          tokens.push({ type: "text", value: line.substring(index) });
+          return {
+            tokens: tokens,
+            state: JSON.stringify(["start"])
+          };
+        } else {
+          throw e;
+        }  
+      }
+    }
+   
+    
+    if(this.tokens[row] !== undefined) {
+      var cachedLine = this.lines[row];
+      var begin = sharedStart([line, cachedLine]);
+      var diff = cachedLine.length - line.length;
+      var idx = 0;
+      var col = 0;
+      for(var i = 0; i < tokens.length; i++) {
+        var token = tokens[i];
+        for(var j = 0; j < this.tokens[row].length; j++) {
+          var semanticToken = this.tokens[row][j];
+          if(
+             ((col + token.value.length) <= begin.length && semanticToken.sc === col && semanticToken.ec === (col + token.value.length)) ||
+             (semanticToken.sc === (col + diff) && semanticToken.ec === (col + token.value.length + diff))
+            ) {
+            idx = i;
+            tokens[i].type = semanticToken.type;
+          }
+        }
+        col += token.value.length;
+      }
+    }
+
+    return {
+      tokens: tokens,
+      state: JSON.stringify(stack)
+    };
+  };
+  
+  function sharedStart(A) {
+    var tem1, tem2, s, A = A.slice(0).sort();
+    tem1 = A[0];
+    s = tem1.length;
+    tem2 = A.pop();
+    while(s && tem2.indexOf(tem1) == -1) {
+        tem1 = tem1.substring(0, --s);
+    }
+    return tem1;
+  }
+};
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/xquery/JSONiqTokenizer.ebnf
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/xquery/JSONiqTokenizer.ebnf b/src/fauxton/assets/js/libs/ace/mode/xquery/JSONiqTokenizer.ebnf
new file mode 100644
index 0000000..b032948
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/xquery/JSONiqTokenizer.ebnf
@@ -0,0 +1,544 @@
+<?xqlint
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module){
+var JSONiqTokenizer = exports.JSONiqTokenizer = function JSONiqTokenizer(string, parsingEventHandler)
+{
+  init(string, parsingEventHandler);
+?>
+
+start   ::= '<![CDATA['
+          | '<!--'
+          | '<?'
+          | '(#'
+          | '(:~'
+          | '(:'
+          | '"'
+          | "'"
+          | "}"
+          | "{"
+          | "("
+          | ")"
+          | "/"
+          | "["
+          | "]"
+          | ","
+          | "."
+          | ";"
+          | ":"
+          | "!"
+          | "|"
+          | Annotation
+          | ModuleDecl
+          | OptionDecl
+          | AttrTest
+          | Wildcard
+          | IntegerLiteral
+          | DecimalLiteral
+          | DoubleLiteral
+          | Variable
+          | EQName
+          | Tag
+          | Operator
+          | EOF
+
+StartTag  ::= '>' | '/>' | QName | "=" | '"' | "'" | EOF
+
+
+TagContent
+         ::= ElementContentChar | Tag | EndTag | '<![CDATA[' | '<!--' | PredefinedEntityRef | CharRef | '{{' | '}}' | '{' | EOF
+          /* ws: explicit */
+
+AposAttr
+        ::= EscapeApos | AposAttrContentChar | PredefinedEntityRef | CharRef | '{{' | '}}' | '{' | "'" | EOF
+          /* ws: explicit */
+
+QuotAttr
+        ::= EscapeQuot | QuotAttrContentChar | PredefinedEntityRef | CharRef | '{{' | '}}' | '{' | '"' | EOF
+          /* ws: explicit */
+
+CData    ::= CDataSectionContents | ']]>' | EOF
+          /* ws: explicit */
+
+XMLComment
+         ::= DirCommentContents | '-->' | EOF
+          /* ws: explicit */
+
+PI       ::= DirPIContents | '?' | '?>' | EOF
+          /* ws: explicit */
+
+Pragma   ::= PragmaContents | '#' | '#)' | EOF
+          /* ws: explicit */
+
+Comment  ::= ':)' | '(:' | CommentContents | EOF
+          /* ws: explicit */
+
+CommentDoc
+         ::= DocTag | DocCommentContents | ':)' | '(:' | EOF
+          /* ws: explicit */
+
+QuotString
+         ::= PredefinedEntityRef | CharRef | EscapeQuot | QuotChar | '"' | EOF
+          /* ws: explicit */
+
+AposString
+         ::= PredefinedEntityRef | CharRef | EscapeApos | AposChar | "'" | EOF
+          /* ws: explicit */
+
+Prefix  ::= NCName
+
+_EQName ::= EQName
+
+Whitespace
+         ::= S^WS
+          /* ws: definition */
+
+EQName   ::= FunctionName
+           | 'attribute'
+           | 'comment'
+           | 'document-node'
+           | 'element'
+           | 'empty-sequence'
+           | 'function'
+           | 'if'
+           | 'item'
+           | 'namespace-node'
+           | 'node'
+           | 'processing-instruction'
+           | 'schema-attribute'
+           | 'schema-element'
+           | 'switch'
+           | 'text'
+           | 'typeswitch'
+FunctionName
+         ::= EQName^Token
+           | 'after'
+           | 'ancestor'
+           | 'ancestor-or-self'
+           | 'and'
+           | 'as'
+           | 'ascending'
+           | 'before'
+           | 'case'
+           | 'cast'
+           | 'castable'
+           | 'child'
+           | 'collation'
+           | 'copy'
+           | 'count'
+           | 'declare'
+           | 'default'
+           | 'delete'
+           | 'descendant'
+           | 'descendant-or-self'
+           | 'descending'
+           | 'div'
+           | 'document'
+           | 'else'
+           | 'empty'
+           | 'end'
+           | 'eq'
+           | 'every'
+           | 'except'
+           | 'first'
+           | 'following'
+           | 'following-sibling'
+           | 'for'
+           | 'ge'
+           | 'group'
+           | 'gt'
+           | 'idiv'
+           | 'import'
+           | 'insert'
+           | 'instance'
+           | 'intersect'
+           | 'into'
+           | 'is'
+           | 'last'
+           | 'le'
+           | 'let'
+           | 'lt'
+           | 'mod'
+           | 'modify'
+           | 'module'
+           | 'namespace'
+           | 'ne'
+           | 'only'
+           | 'or'
+           | 'order'
+           | 'ordered'
+           | 'parent'
+           | 'preceding'
+           | 'preceding-sibling'
+           | 'rename'
+           | 'replace'
+           | 'return'
+           | 'satisfies'
+           | 'self'
+           | 'some'
+           | 'stable'
+           | 'start'
+           | 'to'
+           | 'treat'
+           | 'try'
+           | 'union'
+           | 'unordered'
+           | 'validate'
+           | 'where'
+           | 'with'
+           | 'xquery'
+           | 'allowing'
+           | 'at'
+           | 'base-uri'
+           | 'boundary-space'
+           | 'break'
+           | 'catch'
+           | 'construction'
+           | 'context'
+           | 'continue'
+           | 'copy-namespaces'
+           | 'decimal-format'
+           | 'encoding'
+           | 'exit'
+           | 'external'
+           | 'ft-option'
+           | 'in'
+           | 'index'
+           | 'integrity'
+           | 'lax'
+           | 'nodes'
+           | 'option'
+           | 'ordering'
+           | 'revalidation'
+           | 'schema'
+           | 'score'
+           | 'sliding'
+           | 'strict'
+           | 'tumbling'
+           | 'type'
+           | 'updating'
+           | 'value'
+           | 'variable'
+           | 'version'
+           | 'while'
+           | 'constraint'
+           | 'loop'
+           | 'returning'
+NCName   ::= NCName^Token
+           | 'after'
+           | 'and'
+           | 'as'
+           | 'ascending'
+           | 'before'
+           | 'case'
+           | 'cast'
+           | 'castable'
+           | 'collation'
+           | 'count'
+           | 'default'
+           | 'descending'
+           | 'div'
+           | 'else'
+           | 'empty'
+           | 'end'
+           | 'eq'
+           | 'except'
+           | 'for'
+           | 'ge'
+           | 'group'
+           | 'gt'
+           | 'idiv'
+           | 'instance'
+           | 'intersect'
+           | 'into'
+           | 'is'
+           | 'le'
+           | 'let'
+           | 'lt'
+           | 'mod'
+           | 'modify'
+           | 'ne'
+           | 'only'
+           | 'or'
+           | 'order'
+           | 'return'
+           | 'satisfies'
+           | 'stable'
+           | 'start'
+           | 'to'
+           | 'treat'
+           | 'union'
+           | 'where'
+           | 'with'
+           | 'ancestor'
+           | 'ancestor-or-self'
+           | 'attribute'
+           | 'child'
+           | 'comment'
+           | 'copy'
+           | 'declare'
+           | 'delete'
+           | 'descendant'
+           | 'descendant-or-self'
+           | 'document'
+           | 'document-node'
+           | 'element'
+           | 'empty-sequence'
+           | 'every'
+           | 'first'
+           | 'following'
+           | 'following-sibling'
+           | 'function'
+           | 'if'
+           | 'import'
+           | 'insert'
+           | 'item'
+           | 'last'
+           | 'module'
+           | 'namespace'
+           | 'namespace-node'
+           | 'node'
+           | 'ordered'
+           | 'parent'
+           | 'preceding'
+           | 'preceding-sibling'
+           | 'processing-instruction'
+           | 'rename'
+           | 'replace'
+           | 'schema-attribute'
+           | 'schema-element'
+           | 'self'
+           | 'some'
+           | 'switch'
+           | 'text'
+           | 'try'
+           | 'typeswitch'
+           | 'unordered'
+           | 'validate'
+           | 'variable'
+           | 'xquery'
+           | 'allowing'
+           | 'at'
+           | 'base-uri'
+           | 'boundary-space'
+           | 'break'
+           | 'catch'
+           | 'construction'
+           | 'context'
+           | 'continue'
+           | 'copy-namespaces'
+           | 'decimal-format'
+           | 'encoding'
+           | 'exit'
+           | 'external'
+           | 'ft-option'
+           | 'in'
+           | 'index'
+           | 'integrity'
+           | 'lax'
+           | 'nodes'
+           | 'option'
+           | 'ordering'
+           | 'revalidation'
+           | 'schema'
+           | 'score'
+           | 'sliding'
+           | 'strict'
+           | 'tumbling'
+           | 'type'
+           | 'updating'
+           | 'value'
+           | 'version'
+           | 'while'
+           | 'constraint'
+           | 'loop'
+           | 'returning'
+<?TOKENS?>
+
+ModuleDecl
+         ::= ('import' S)? ('module' | 'schema') S 'namespace'
+
+Annotation
+         ::= '%' EQName ?
+
+OptionDecl
+         ::= 'declare' S ( ( 'decimal-format' | 'option' ) 
+           |  ('default' S 'decimal-format') ) 
+
+Operator ::= '!=' | ':=' | '>=' | '<=' | '=' | '<' | '>' | '-' | '+' | 'div' | '||' | '?'
+
+Variable ::= '$' EQName
+
+Tag      ::= '<' QName
+
+EndTag   ::= '</' QName S? '>'
+
+PragmaContents
+         ::= ( Char* - ( Char* '#' Char* ) )+
+DirCommentContents
+         ::= ( ( Char - '-' ) | '-' ( Char - '-' ) )+
+DirPIContents
+         ::= ( Char* - ( Char* '?' Char* ) )+ 
+CDataSectionContents
+         ::= ( Char+ - ( Char* ']]>' Char* ) ) & ']]'
+           | ( Char+ - ( Char* ']]>' Char* ) ) & $ 
+AttrTest  ::= "@" ( Wildcard | QName )
+Wildcard ::= "*"
+         | (NCName ":" "*")
+         | ("*" ":" NCName)
+         | (BracedURILiteral "*")
+EQName   ::= QName
+           | URIQualifiedName
+URIQualifiedName
+         ::= BracedURILiteral NCName
+BracedURILiteral
+         ::= 'Q' '{' (PredefinedEntityRef | CharRef  | [^&{}] )* '}'
+URILiteral
+         ::= StringLiteral
+IntegerLiteral
+         ::= Digits
+DecimalLiteral
+         ::= '.' Digits
+           | Digits '.' [0-9]*
+          /* ws: explicit */
+DoubleLiteral
+         ::= ( '.' Digits | Digits ( '.' [0-9]* )? ) [Ee] [+#x002D]? Digits
+          /* ws: explicit */
+PredefinedEntityRef
+         ::= '&' ( 'lt' | 'gt' | 'amp' | 'quot' | 'apos' ) ';'
+          /* ws: explicit */
+EscapeQuot
+         ::= '""'
+EscapeApos
+         ::= "''"
+QuotChar ::= (Char - ["&])+
+AposChar ::= (Char - [&'])+
+ElementContentChar
+         ::= (Char - [&<{}])+
+QuotAttrContentChar
+         ::= (Char - ["&<{}])+
+AposAttrContentChar
+         ::= (Char - [&'<{}])+
+PITarget ::= NCName - ( ( 'X' | 'x' ) ( 'M' | 'm' ) ( 'L' | 'l' ) )
+Name     ::= NameStartChar NameChar*
+NameStartChar
+         ::= [:A-Z_a-z#x00C0-#x00D6#x00D8-#x00F6#x00F8-#x02FF#x0370-#x037D#x037F-#x1FFF#x200C-#x200D#x2070-#x218F#x2C00-#x2FEF#x3001-#xD7FF#xF900-#xFDCF#xFDF0-#xFFFD#x10000-#xEFFFF]
+NameChar ::= NameStartChar
+           | [-.0-9#x00B7#x0300-#x036F#x203F-#x2040]
+NCName   ::= Name - ( Char* (':' | '.') Char* )
+Char     ::= [#x0009#x000A#x000D#x0020-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF]
+QName    ::= PrefixedName
+           | UnprefixedName
+PrefixedName
+         ::= Prefix ':' LocalPart
+UnprefixedName
+         ::= LocalPart
+Prefix   ::= NCName
+LocalPart
+         ::= NCName
+S        ::= [#x0009#x000A#x000D#x0020]+
+CharRef  ::= '&#' [0-9]+ ';'
+           | '&#x' [0-9A-Fa-f]+ ';'
+Digits   ::= [0-9]+
+CommentContents
+         ::= ( Char+ - ( Char* ( '(:' | ':)' ) Char* ) ) & '(:'
+           | ( Char+ - ( Char* ( '(:' | ':)' ) Char* ) ) & $
+           | ( ( Char+ - ( Char* ( '(:' | ':)' ) Char* ) ) - ( Char* '(' ) ) & ':'
+DocTag   ::= ' @' NCName?
+DocCommentContents
+         ::= ( ( Char+ - ( Char* ( '(:' | ':)' | ' @' ) Char* ) ) - ( Char* '(' ) ) & ':'
+           |   ( Char+ - ( Char* ( '(:' | ':)' | ' @' ) Char* ) )                   & '(:'
+           |   ( Char+ - ( Char* ( '(:' | ':)' | ' @' ) Char* ) )                   & ' @'
+           | ( Char+ - ( Char* ( '(:' | ':)' | ' @') Char* ) ) & $
+EOF      ::= $
+NonNCNameChar
+          ::= $
+            | ':'
+            | '.'
+            | ( Char - NameChar )
+DelimitingChar
+          ::= NonNCNameChar
+            | '-'
+            | '.'
+DelimitingChar
+           \\ IntegerLiteral DecimalLiteral DoubleLiteral 
+NonNCNameChar
+           \\ EQName^Token QName NCName^Token 'NaN' 'after' 'all'
+              'allowing' 'ancestor' 'ancestor-or-self' 'and' 'any' 
+              'append' 'array' 'as' 'ascending' 'at' 'attribute' 
+              'base-uri' 'before' 'boundary-space' 'break' 'by' 'case'
+              'cast' 'castable' 'catch' 'check' 'child' 'collation' 
+              'collection' 'comment' 'constraint' 'construction'
+              'contains' 'content' 'context' 'continue' 'copy' 
+              'copy-namespaces' 'count' 'decimal-format' 
+              'decimal-separator' 'declare' 'default' 'delete' 
+              'descendant' 'descendant-or-self' 'descending' 
+              'diacritics' 'different' 'digit' 'distance' 'div' 
+              'document' 'document-node' 'element' 'else' 'empty'
+              'empty-sequence' 'encoding' 'end' 'entire' 'eq' 'every'
+              'exactly' 'except' 'exit' 'external' 'first' 'following'
+              'following-sibling' 'for' 'foreach' 'foreign' 'from'
+              'ft-option' 'ftand' 'ftnot' 'ftor' 'function' 'ge'
+              'greatest' 'group' 'grouping-separator' 'gt' 'idiv' 'if'
+              'import' 'in' 'index' 'infinity' 'inherit' 'insensitive'
+              'insert' 'instance' 'integrity' 'intersect' 'into' 'is'
+              'item' 'json' 'json-item' 'key' 'language' 'last' 'lax'
+              'le' 'least' 'let' 'levels' 'loop' 'lowercase' 'lt'
+              'minus-sign' 'mod' 'modify' 'module' 'most' 'namespace'
+              'namespace-node' 'ne' 'next' 'no' 'no-inherit'
+              'no-preserve' 'node' 'nodes' 'not' 'object' 'occurs'
+              'of' 'on' 'only' 'option' 'or' 'order' 'ordered'
+              'ordering' 'paragraph' 'paragraphs' 'parent'
+              'pattern-separator' 'per-mille' 'percent' 'phrase'
+              'position' 'preceding' 'preceding-sibling' 'preserve'
+              'previous' 'processing-instruction' 'relationship'
+              'rename' 'replace' 'return' 'returning' 'revalidation'
+              'same' 'satisfies' 'schema' 'schema-attribute'
+              'schema-element' 'score' 'self' 'sensitive' 'sentence'
+              'sentences' 'skip' 'sliding' 'some' 'stable' 'start'
+              'stemming' 'stop' 'strict' 'strip' 'structured-item'
+              'switch' 'text' 'then' 'thesaurus' 'times' 'to'
+              'treat' 'try' 'tumbling' 'type' 'typeswitch' 'union'
+              'unique' 'unordered' 'updating' 'uppercase' 'using'
+              'validate' 'value' 'variable' 'version' 'weight'
+              'when' 'where' 'while' 'wildcards' 'window' 'with'
+              'without' 'word' 'words' 'xquery' 'zero-digit'
+'*'       << Wildcard '*'^OccurrenceIndicator
+EQName^Token
+          << 'after' 'ancestor' 'ancestor-or-self' 'and' 'as' 'ascending' 'attribute' 'before' 'case' 'cast' 'castable' 'child' 'collation' 'comment' 'copy' 'count' 'declare' 'default' 'delete' 'descendant' 'descendant-or-self' 'descending' 'div' 'document' 'document-node' 'element' 'else' 'empty' 'empty-sequence' 'end' 'eq' 'every' 'except' 'first' 'following' 'following-sibling' 'for' 'function' 'ge' 'group' 'gt' 'idiv' 'if' 'import' 'insert' 'instance' 'intersect' 'into' 'is' 'item' 'last' 'le' 'let' 'lt' 'mod' 'modify' 'module' 'namespace' 'namespace-node' 'ne' 'node' 'only' 'or' 'order' 'ordered' 'parent' 'preceding' 'preceding-sibling' 'processing-instruction' 'rename' 'replace' 'return' 'satisfies' 'schema-attribute' 'schema-element' 'self' 'some' 'stable' 'start' 'switch' 'text' 'to' 'treat' 'try' 'typeswitch' 'union' 'unordered' 'validate' 'where' 'with' 'xquery' 'contains' 'paragraphs' 'sentences' 'times' 'words' 'by' 'collection' 'allowing' 'at' 'base-uri' 'boundary-space
 ' 'break' 'catch' 'construction' 'context' 'continue' 'copy-namespaces' 'decimal-format' 'encoding' 'exit' 'external' 'ft-option' 'in' 'index' 'integrity' 'lax' 'nodes' 'option' 'ordering' 'revalidation' 'schema' 'score' 'sliding' 'strict' 'tumbling' 'type' 'updating' 'value' 'variable' 'version' 'while' 'constraint' 'loop' 'returning' 'append' 'array' 'json-item' 'object' 'structured-item'
+NCName^Token
+          << 'after' 'and' 'as' 'ascending' 'before' 'case' 'cast' 'castable' 'collation' 'count' 'default' 'descending' 'div' 'else' 'empty' 'end' 'eq' 'except' 'for' 'ge' 'group' 'gt' 'idiv' 'instance' 'intersect' 'into' 'is' 'le' 'let' 'lt' 'mod' 'modify' 'ne' 'only' 'or' 'order' 'return' 'satisfies' 'stable' 'start' 'to' 'treat' 'union' 'where' 'with' 'contains' 'paragraphs' 'sentences' 'times' 'words' 'by' 'ancestor' 'ancestor-or-self' 'attribute' 'child' 'comment' 'copy' 'declare' 'delete' 'descendant' 'descendant-or-self' 'document' 'document-node' 'element' 'empty-sequence' 'every' 'first' 'following' 'following-sibling' 'function' 'if' 'import' 'insert' 'item' 'last' 'module' 'namespace' 'namespace-node' 'node' 'ordered' 'parent' 'preceding' 'preceding-sibling' 'processing-instruction' 'rename' 'replace' 'schema-attribute' 'schema-element' 'self' 'some' 'switch' 'text' 'try' 'typeswitch' 'unordered' 'validate' 'variable' 'xquery' 'allowing' 'at' 'base-uri' 'boundary-space' 
 'break' 'catch' 'construction' 'context' 'continue' 'copy-namespaces' 'decimal-format' 'encoding' 'exit' 'external' 'ft-option' 'in' 'index' 'integrity' 'lax' 'nodes' 'option' 'ordering' 'revalidation' 'schema' 'score' 'sliding' 'strict' 'tumbling' 'type' 'updating' 'value' 'version' 'while' 'constraint' 'loop' 'returning'
+
+<?ENCORE?>
+
+<?xqlint
+});
+?>


[11/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/objectivec_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/objectivec_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/objectivec_highlight_rules.js
new file mode 100644
index 0000000..7a581c2
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/objectivec_highlight_rules.js
@@ -0,0 +1,331 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
+var C_Highlight_File = require("./c_cpp_highlight_rules");
+var CHighlightRules = C_Highlight_File.c_cppHighlightRules;
+
+var ObjectiveCHighlightRules = function() {
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    var escapedConstRe = "\\\\(?:[abefnrtv'\"?\\\\]|" + 
+                         "[0-3]\\d{1,2}|" +
+                         "[4-7]\\d?|" +
+                         "222|" +
+                         "x[a-zA-Z0-9]+)";
+
+    var specialVariables = [{
+            regex: "\\b_cmd\\b",
+            token: "variable.other.selector.objc"
+        }, {
+            regex: "\\b(?:self|super)\\b",
+            token: "variable.language.objc"
+        }
+    ];
+
+    var cObj = new CHighlightRules();
+    var cRules = cObj.getRules();
+
+    this.$rules = {
+    "start": [ 
+        {
+            token : "comment",
+            regex : "\\/\\/.*$"
+        },
+        DocCommentHighlightRules.getStartRule("doc-start"),
+        {
+            token : "comment", // multi line comment
+            regex : "\\/\\*",
+            next : "comment"
+        }, 
+        {
+            token: [ "storage.type.objc", "punctuation.definition.storage.type.objc", 
+                       "entity.name.type.objc", "text", "entity.other.inherited-class.objc"
+                     ],
+            regex: "(@)(interface|protocol)(?!.+;)(\\s+[A-Za-z_][A-Za-z0-9_]*)(\\s*:\\s*)([A-Za-z]+)"
+        },
+        {
+            token: [ "storage.type.objc" ],
+            regex: "(@end)"
+        },
+        {
+            token: [ "storage.type.objc", "entity.name.type.objc", 
+                        "entity.other.inherited-class.objc"
+                     ],
+            regex: "(@implementation)(\\s+[A-Za-z_][A-Za-z0-9_]*)(\\s*?::\\s*(?:[A-Za-z][A-Za-z0-9]*))?"
+        },
+        {
+            token: "string.begin.objc",
+            regex: '@"',
+            next: "constant_NSString"
+        },
+        {
+            token: "storage.type.objc",
+            regex: "\\bid\\s*<",
+            next: "protocol_list"
+        },
+        {
+            token: "keyword.control.macro.objc",
+            regex: "\\bNS_DURING|NS_HANDLER|NS_ENDHANDLER\\b"
+        },
+        {
+            token: ["punctuation.definition.keyword.objc", "keyword.control.exception.objc"],
+            regex: "(@)(try|catch|finally|throw)\\b"
+        },
+        {
+            token: ["punctuation.definition.keyword.objc", "keyword.other.objc"],
+            regex: "(@)(defs|encode)\\b"
+        },
+        {
+            token: ["storage.type.id.objc", "text"],
+            regex: "(\\bid\\b)(\\s|\\n)?"
+        },
+        {
+            token: "storage.type.objc",
+            regex: "\\bIBOutlet|IBAction|BOOL|SEL|id|unichar|IMP|Class\\b"
+        },
+        {
+            token: [ "punctuation.definition.storage.type.objc", "storage.type.objc"],
+            regex: "(@)(class|protocol)\\b"
+        },
+        {
+            token: [ "punctuation.definition.storage.type.objc", "punctuation"],
+            regex: "(@selector)(\\s*\\()",
+            next: "selectors"
+        },
+        {
+            token: [ "punctuation.definition.storage.modifier.objc", "storage.modifier.objc"],
+            regex: "(@)(synchronized|public|private|protected|package)\\b"
+        },
+        {
+            token: "constant.language.objc",
+            regex: "\\bYES|NO|Nil|nil\\b"
+        },
+        {
+            token:  "support.variable.foundation",
+            regex: "\\bNSApp\\b"
+        },
+        {
+            token: [ "support.function.cocoa.leopard"],
+            regex: "(?:\\b)(NS(?:Rect(?:ToCGRect|FromCGRect)|MakeCollectable|S(?:tringFromProtocol|ize(?:ToCGSize|FromCGSize))|Draw(?:NinePartImage|ThreePartImage)|P(?:oint(?:ToCGPoint|FromCGPoint)|rotocolFromString)|EventMaskFromType|Value))(?:\\b)"
+        },
+        {
+            token: ["support.function.cocoa"],
+            regex: "(?:\\b)(NS(?:R(?:ound(?:DownToMultipleOfPageSize|UpToMultipleOfPageSize)|un(?:CriticalAlertPanel(?:RelativeToWindow)?|InformationalAlertPanel(?:RelativeToWindow)?|AlertPanel(?:RelativeToWindow)?)|e(?:set(?:MapTable|HashTable)|c(?:ycleZone|t(?:Clip(?:List)?|F(?:ill(?:UsingOperation|List(?:UsingOperation|With(?:Grays|Colors(?:UsingOperation)?))?)?|romString))|ordAllocationEvent)|turnAddress|leaseAlertPanel|a(?:dPixel|l(?:MemoryAvailable|locateCollectable))|gisterServicesProvider)|angeFromString)|Get(?:SizeAndAlignment|CriticalAlertPanel|InformationalAlertPanel|UncaughtExceptionHandler|FileType(?:s)?|WindowServerMemory|AlertPanel)|M(?:i(?:n(?:X|Y)|d(?:X|Y))|ouseInRect|a(?:p(?:Remove|Get|Member|Insert(?:IfAbsent|KnownAbsent)?)|ke(?:R(?:ect|ange)|Size|Point)|x(?:Range|X|Y)))|B(?:itsPer(?:SampleFromDepth|PixelFromDepth)|e(?:stDepth|ep|gin(?:CriticalAlertSheet|InformationalAlertSheet|AlertSheet)))|S(?:ho(?:uldRetainWithZone|w(?:sServicesMenuItem|AnimationEffect))|tringF
 rom(?:R(?:ect|ange)|MapTable|S(?:ize|elector)|HashTable|Class|Point)|izeFromString|e(?:t(?:ShowsServicesMenuItem|ZoneName|UncaughtExceptionHandler|FocusRingStyle)|lectorFromString|archPathForDirectoriesInDomains)|wap(?:Big(?:ShortToHost|IntToHost|DoubleToHost|FloatToHost|Long(?:ToHost|LongToHost))|Short|Host(?:ShortTo(?:Big|Little)|IntTo(?:Big|Little)|DoubleTo(?:Big|Little)|FloatTo(?:Big|Little)|Long(?:To(?:Big|Little)|LongTo(?:Big|Little)))|Int|Double|Float|L(?:ittle(?:ShortToHost|IntToHost|DoubleToHost|FloatToHost|Long(?:ToHost|LongToHost))|ong(?:Long)?)))|H(?:ighlightRect|o(?:stByteOrder|meDirectory(?:ForUser)?)|eight|ash(?:Remove|Get|Insert(?:IfAbsent|KnownAbsent)?)|FSType(?:CodeFromFileType|OfFile))|N(?:umberOfColorComponents|ext(?:MapEnumeratorPair|HashEnumeratorItem))|C(?:o(?:n(?:tainsRect|vert(?:GlyphsToPackedGlyphs|Swapped(?:DoubleToHost|FloatToHost)|Host(?:DoubleToSwapped|FloatToSwapped)))|unt(?:MapTable|HashTable|Frames|Windows(?:ForContext)?)|py(?:M(?:emoryPages|apTableW
 ithZone)|Bits|HashTableWithZone|Object)|lorSpaceFromDepth|mpare(?:MapTables|HashTables))|lassFromString|reate(?:MapTable(?:WithZone)?|HashTable(?:WithZone)?|Zone|File(?:namePboardType|ContentsPboardType)))|TemporaryDirectory|I(?:s(?:ControllerMarker|EmptyRect|FreedObject)|n(?:setRect|crementExtraRefCount|te(?:r(?:sect(?:sRect|ionR(?:ect|ange))|faceStyleForKey)|gralRect)))|Zone(?:Realloc|Malloc|Name|Calloc|Fr(?:omPointer|ee))|O(?:penStepRootDirectory|ffsetRect)|D(?:i(?:sableScreenUpdates|videRect)|ottedFrameRect|e(?:c(?:imal(?:Round|Multiply|S(?:tring|ubtract)|Normalize|Co(?:py|mpa(?:ct|re))|IsNotANumber|Divide|Power|Add)|rementExtraRefCountWasZero)|faultMallocZone|allocate(?:MemoryPages|Object))|raw(?:Gr(?:oove|ayBezel)|B(?:itmap|utton)|ColorTiledRects|TiledRects|DarkBezel|W(?:hiteBezel|indowBackground)|LightBezel))|U(?:serName|n(?:ionR(?:ect|ange)|registerServicesProvider)|pdateDynamicServices)|Java(?:Bundle(?:Setup|Cleanup)|Setup(?:VirtualMachine)?|Needs(?:ToLoadClasses|VirtualMac
 hine)|ClassesF(?:orBundle|romPath)|ObjectNamedInPath|ProvidesClasses)|P(?:oint(?:InRect|FromString)|erformService|lanarFromDepth|ageSize)|E(?:n(?:d(?:MapTableEnumeration|HashTableEnumeration)|umerate(?:MapTable|HashTable)|ableScreenUpdates)|qual(?:R(?:ects|anges)|Sizes|Points)|raseRect|xtraRefCount)|F(?:ileTypeForHFSTypeCode|ullUserName|r(?:ee(?:MapTable|HashTable)|ame(?:Rect(?:WithWidth(?:UsingOperation)?)?|Address)))|Wi(?:ndowList(?:ForContext)?|dth)|Lo(?:cationInRange|g(?:v|PageSize)?)|A(?:ccessibility(?:R(?:oleDescription(?:ForUIElement)?|aiseBadArgumentException)|Unignored(?:Children(?:ForOnlyChild)?|Descendant|Ancestor)|PostNotification|ActionDescription)|pplication(?:Main|Load)|vailableWindowDepths|ll(?:MapTable(?:Values|Keys)|HashTableObjects|ocate(?:MemoryPages|Collectable|Object)))))(?:\\b)"
+        },
+        {
+            token: ["support.class.cocoa.leopard"],
+            regex: "(?:\\b)(NS(?:RuleEditor|G(?:arbageCollector|radient)|MapTable|HashTable|Co(?:ndition|llectionView(?:Item)?)|T(?:oolbarItemGroup|extInputClient|r(?:eeNode|ackingArea))|InvocationOperation|Operation(?:Queue)?|D(?:ictionaryController|ockTile)|P(?:ointer(?:Functions|Array)|athC(?:o(?:ntrol(?:Delegate)?|mponentCell)|ell(?:Delegate)?)|r(?:intPanelAccessorizing|edicateEditor(?:RowTemplate)?))|ViewController|FastEnumeration|Animat(?:ionContext|ablePropertyContainer)))(?:\\b)"
+        },
+        {
+            token: ["support.class.cocoa"],
+            regex: "(?:\\b)(NS(?:R(?:u(?:nLoop|ler(?:Marker|View))|e(?:sponder|cursiveLock|lativeSpecifier)|an(?:domSpecifier|geSpecifier))|G(?:etCommand|lyph(?:Generator|Storage|Info)|raphicsContext)|XML(?:Node|D(?:ocument|TD(?:Node)?)|Parser|Element)|M(?:iddleSpecifier|ov(?:ie(?:View)?|eCommand)|utable(?:S(?:tring|et)|C(?:haracterSet|opying)|IndexSet|D(?:ictionary|ata)|URLRequest|ParagraphStyle|A(?:ttributedString|rray))|e(?:ssagePort(?:NameServer)?|nu(?:Item(?:Cell)?|View)?|t(?:hodSignature|adata(?:Item|Query(?:ResultGroup|AttributeValueTuple)?)))|a(?:ch(?:BootstrapServer|Port)|trix))|B(?:itmapImageRep|ox|u(?:ndle|tton(?:Cell)?)|ezierPath|rowser(?:Cell)?)|S(?:hadow|c(?:anner|r(?:ipt(?:SuiteRegistry|C(?:o(?:ercionHandler|mmand(?:Description)?)|lassDescription)|ObjectSpecifier|ExecutionContext|WhoseTest)|oll(?:er|View)|een))|t(?:epper(?:Cell)?|atus(?:Bar|Item)|r(?:ing|eam))|imple(?:HorizontalTypesetter|CString)|o(?:cketPort(?:NameServer)?|und|rtDescriptor)|p(?:e(?:cifierTest|ech(?:
 Recognizer|Synthesizer)|ll(?:Server|Checker))|litView)|e(?:cureTextField(?:Cell)?|t(?:Command)?|archField(?:Cell)?|rializer|gmentedC(?:ontrol|ell))|lider(?:Cell)?|avePanel)|H(?:ost|TTP(?:Cookie(?:Storage)?|URLResponse)|elpManager)|N(?:ib(?:Con(?:nector|trolConnector)|OutletConnector)?|otification(?:Center|Queue)?|u(?:ll|mber(?:Formatter)?)|etService(?:Browser)?|ameSpecifier)|C(?:ha(?:ngeSpelling|racterSet)|o(?:n(?:stantString|nection|trol(?:ler)?|ditionLock)|d(?:ing|er)|unt(?:Command|edSet)|pying|lor(?:Space|P(?:ick(?:ing(?:Custom|Default)|er)|anel)|Well|List)?|m(?:p(?:oundPredicate|arisonPredicate)|boBox(?:Cell)?))|u(?:stomImageRep|rsor)|IImageRep|ell|l(?:ipView|o(?:seCommand|neCommand)|assDescription)|a(?:ched(?:ImageRep|URLResponse)|lendar(?:Date)?)|reateCommand)|T(?:hread|ypesetter|ime(?:Zone|r)|o(?:olbar(?:Item(?:Validations)?)?|kenField(?:Cell)?)|ext(?:Block|Storage|Container|Tab(?:le(?:Block)?)?|Input|View|Field(?:Cell)?|List|Attachment(?:Cell)?)?|a(?:sk|b(?:le(?:Header(?:Cel
 l|View)|Column|View)|View(?:Item)?))|reeController)|I(?:n(?:dex(?:S(?:pecifier|et)|Path)|put(?:Manager|S(?:tream|erv(?:iceProvider|er(?:MouseTracker)?)))|vocation)|gnoreMisspelledWords|mage(?:Rep|Cell|View)?)|O(?:ut(?:putStream|lineView)|pen(?:GL(?:Context|Pixel(?:Buffer|Format)|View)|Panel)|bj(?:CTypeSerializationCallBack|ect(?:Controller)?))|D(?:i(?:st(?:antObject(?:Request)?|ributed(?:NotificationCenter|Lock))|ctionary|rectoryEnumerator)|ocument(?:Controller)?|e(?:serializer|cimalNumber(?:Behaviors|Handler)?|leteCommand)|at(?:e(?:Components|Picker(?:Cell)?|Formatter)?|a)|ra(?:wer|ggingInfo))|U(?:ser(?:InterfaceValidations|Defaults(?:Controller)?)|RL(?:Re(?:sponse|quest)|Handle(?:Client)?|C(?:onnection|ache|redential(?:Storage)?)|Download(?:Delegate)?|Prot(?:ocol(?:Client)?|ectionSpace)|AuthenticationChallenge(?:Sender)?)?|n(?:iqueIDSpecifier|doManager|archiver))|P(?:ipe|o(?:sitionalSpecifier|pUpButton(?:Cell)?|rt(?:Message|NameServer|Coder)?)|ICTImageRep|ersistentDocument|DFImage
 Rep|a(?:steboard|nel|ragraphStyle|geLayout)|r(?:int(?:Info|er|Operation|Panel)|o(?:cessInfo|tocolChecker|perty(?:Specifier|ListSerialization)|gressIndicator|xy)|edicate))|E(?:numerator|vent|PSImageRep|rror|x(?:ception|istsCommand|pression))|V(?:iew(?:Animation)?|al(?:idated(?:ToobarItem|UserInterfaceItem)|ue(?:Transformer)?))|Keyed(?:Unarchiver|Archiver)|Qui(?:ckDrawView|tCommand)|F(?:ile(?:Manager|Handle|Wrapper)|o(?:nt(?:Manager|Descriptor|Panel)?|rm(?:Cell|atter)))|W(?:hoseSpecifier|indow(?:Controller)?|orkspace)|L(?:o(?:c(?:k(?:ing)?|ale)|gicalTest)|evelIndicator(?:Cell)?|ayoutManager)|A(?:ssertionHandler|nimation|ctionCell|ttributedString|utoreleasePool|TSTypesetter|ppl(?:ication|e(?:Script|Event(?:Manager|Descriptor)))|ffineTransform|lert|r(?:chiver|ray(?:Controller)?))))(?:\\b)"
+        },
+        {
+            token: ["support.type.cocoa.leopard"],
+            regex: "(?:\\b)(NS(?:R(?:u(?:nLoop|ler(?:Marker|View))|e(?:sponder|cursiveLock|lativeSpecifier)|an(?:domSpecifier|geSpecifier))|G(?:etCommand|lyph(?:Generator|Storage|Info)|raphicsContext)|XML(?:Node|D(?:ocument|TD(?:Node)?)|Parser|Element)|M(?:iddleSpecifier|ov(?:ie(?:View)?|eCommand)|utable(?:S(?:tring|et)|C(?:haracterSet|opying)|IndexSet|D(?:ictionary|ata)|URLRequest|ParagraphStyle|A(?:ttributedString|rray))|e(?:ssagePort(?:NameServer)?|nu(?:Item(?:Cell)?|View)?|t(?:hodSignature|adata(?:Item|Query(?:ResultGroup|AttributeValueTuple)?)))|a(?:ch(?:BootstrapServer|Port)|trix))|B(?:itmapImageRep|ox|u(?:ndle|tton(?:Cell)?)|ezierPath|rowser(?:Cell)?)|S(?:hadow|c(?:anner|r(?:ipt(?:SuiteRegistry|C(?:o(?:ercionHandler|mmand(?:Description)?)|lassDescription)|ObjectSpecifier|ExecutionContext|WhoseTest)|oll(?:er|View)|een))|t(?:epper(?:Cell)?|atus(?:Bar|Item)|r(?:ing|eam))|imple(?:HorizontalTypesetter|CString)|o(?:cketPort(?:NameServer)?|und|rtDescriptor)|p(?:e(?:cifierTest|ech(?:
 Recognizer|Synthesizer)|ll(?:Server|Checker))|litView)|e(?:cureTextField(?:Cell)?|t(?:Command)?|archField(?:Cell)?|rializer|gmentedC(?:ontrol|ell))|lider(?:Cell)?|avePanel)|H(?:ost|TTP(?:Cookie(?:Storage)?|URLResponse)|elpManager)|N(?:ib(?:Con(?:nector|trolConnector)|OutletConnector)?|otification(?:Center|Queue)?|u(?:ll|mber(?:Formatter)?)|etService(?:Browser)?|ameSpecifier)|C(?:ha(?:ngeSpelling|racterSet)|o(?:n(?:stantString|nection|trol(?:ler)?|ditionLock)|d(?:ing|er)|unt(?:Command|edSet)|pying|lor(?:Space|P(?:ick(?:ing(?:Custom|Default)|er)|anel)|Well|List)?|m(?:p(?:oundPredicate|arisonPredicate)|boBox(?:Cell)?))|u(?:stomImageRep|rsor)|IImageRep|ell|l(?:ipView|o(?:seCommand|neCommand)|assDescription)|a(?:ched(?:ImageRep|URLResponse)|lendar(?:Date)?)|reateCommand)|T(?:hread|ypesetter|ime(?:Zone|r)|o(?:olbar(?:Item(?:Validations)?)?|kenField(?:Cell)?)|ext(?:Block|Storage|Container|Tab(?:le(?:Block)?)?|Input|View|Field(?:Cell)?|List|Attachment(?:Cell)?)?|a(?:sk|b(?:le(?:Header(?:Cel
 l|View)|Column|View)|View(?:Item)?))|reeController)|I(?:n(?:dex(?:S(?:pecifier|et)|Path)|put(?:Manager|S(?:tream|erv(?:iceProvider|er(?:MouseTracker)?)))|vocation)|gnoreMisspelledWords|mage(?:Rep|Cell|View)?)|O(?:ut(?:putStream|lineView)|pen(?:GL(?:Context|Pixel(?:Buffer|Format)|View)|Panel)|bj(?:CTypeSerializationCallBack|ect(?:Controller)?))|D(?:i(?:st(?:antObject(?:Request)?|ributed(?:NotificationCenter|Lock))|ctionary|rectoryEnumerator)|ocument(?:Controller)?|e(?:serializer|cimalNumber(?:Behaviors|Handler)?|leteCommand)|at(?:e(?:Components|Picker(?:Cell)?|Formatter)?|a)|ra(?:wer|ggingInfo))|U(?:ser(?:InterfaceValidations|Defaults(?:Controller)?)|RL(?:Re(?:sponse|quest)|Handle(?:Client)?|C(?:onnection|ache|redential(?:Storage)?)|Download(?:Delegate)?|Prot(?:ocol(?:Client)?|ectionSpace)|AuthenticationChallenge(?:Sender)?)?|n(?:iqueIDSpecifier|doManager|archiver))|P(?:ipe|o(?:sitionalSpecifier|pUpButton(?:Cell)?|rt(?:Message|NameServer|Coder)?)|ICTImageRep|ersistentDocument|DFImage
 Rep|a(?:steboard|nel|ragraphStyle|geLayout)|r(?:int(?:Info|er|Operation|Panel)|o(?:cessInfo|tocolChecker|perty(?:Specifier|ListSerialization)|gressIndicator|xy)|edicate))|E(?:numerator|vent|PSImageRep|rror|x(?:ception|istsCommand|pression))|V(?:iew(?:Animation)?|al(?:idated(?:ToobarItem|UserInterfaceItem)|ue(?:Transformer)?))|Keyed(?:Unarchiver|Archiver)|Qui(?:ckDrawView|tCommand)|F(?:ile(?:Manager|Handle|Wrapper)|o(?:nt(?:Manager|Descriptor|Panel)?|rm(?:Cell|atter)))|W(?:hoseSpecifier|indow(?:Controller)?|orkspace)|L(?:o(?:c(?:k(?:ing)?|ale)|gicalTest)|evelIndicator(?:Cell)?|ayoutManager)|A(?:ssertionHandler|nimation|ctionCell|ttributedString|utoreleasePool|TSTypesetter|ppl(?:ication|e(?:Script|Event(?:Manager|Descriptor)))|ffineTransform|lert|r(?:chiver|ray(?:Controller)?))))(?:\\b)"
+        },
+        {
+            token: ["support.class.quartz"],
+            regex: "(?:\\b)(C(?:I(?:Sampler|Co(?:ntext|lor)|Image(?:Accumulator)?|PlugIn(?:Registration)?|Vector|Kernel|Filter(?:Generator|Shape)?)|A(?:Renderer|MediaTiming(?:Function)?|BasicAnimation|ScrollLayer|Constraint(?:LayoutManager)?|T(?:iledLayer|extLayer|rans(?:ition|action))|OpenGLLayer|PropertyAnimation|KeyframeAnimation|Layer|A(?:nimation(?:Group)?|ction))))(?:\\b)"
+        },
+        {
+            token: ["support.type.quartz"],
+            regex: "(?:\\b)(C(?:G(?:Float|Point|Size|Rect)|IFormat|AConstraintAttribute))(?:\\b)"
+        },
+        {
+            token: ["support.type.cocoa"],
+            regex: "(?:\\b)(NS(?:R(?:ect(?:Edge)?|ange)|G(?:lyph(?:Relation|LayoutMode)?|radientType)|M(?:odalSession|a(?:trixMode|p(?:Table|Enumerator)))|B(?:itmapImageFileType|orderType|uttonType|ezelStyle|ackingStoreType|rowserColumnResizingType)|S(?:cr(?:oll(?:er(?:Part|Arrow)|ArrowPosition)|eenAuxiliaryOpaque)|tringEncoding|ize|ocketNativeHandle|election(?:Granularity|Direction|Affinity)|wapped(?:Double|Float)|aveOperationType)|Ha(?:sh(?:Table|Enumerator)|ndler(?:2)?)|C(?:o(?:ntrol(?:Size|Tint)|mp(?:ositingOperation|arisonResult))|ell(?:State|Type|ImagePosition|Attribute))|T(?:hreadPrivate|ypesetterGlyphInfo|i(?:ckMarkPosition|tlePosition|meInterval)|o(?:ol(?:TipTag|bar(?:SizeMode|DisplayMode))|kenStyle)|IFFCompression|ext(?:TabType|Alignment)|ab(?:State|leViewDropOperation|ViewType)|rackingRectTag)|ImageInterpolation|Zone|OpenGL(?:ContextAuxiliary|PixelFormatAuxiliary)|D(?:ocumentChangeType|atePickerElementFlags|ra(?:werState|gOperation))|UsableScrollerParts|P(?:oint|r(?:intin
 gPageOrder|ogressIndicator(?:Style|Th(?:ickness|readInfo))))|EventType|KeyValueObservingOptions|Fo(?:nt(?:SymbolicTraits|TraitMask|Action)|cusRingType)|W(?:indow(?:OrderingMode|Depth)|orkspace(?:IconCreationOptions|LaunchOptions)|ritingDirection)|L(?:ineBreakMode|ayout(?:Status|Direction))|A(?:nimation(?:Progress|Effect)|ppl(?:ication(?:TerminateReply|DelegateReply|PrintReply)|eEventManagerSuspensionID)|ffineTransformStruct|lertStyle)))(?:\\b)"
+        },
+        {
+            token: ["support.constant.cocoa"],
+            regex: "(?:\\b)(NS(?:NotFound|Ordered(?:Ascending|Descending|Same)))(?:\\b)"
+        },
+        {
+            token: ["support.constant.notification.cocoa.leopard"],
+            regex: "(?:\\b)(NS(?:MenuDidBeginTracking|ViewDidUpdateTrackingAreas)?Notification)(?:\\b)"
+        },
+        {
+            token: ["support.constant.notification.cocoa"],
+            regex: "(?:\\b)(NS(?:Menu(?:Did(?:RemoveItem|SendAction|ChangeItem|EndTracking|AddItem)|WillSendAction)|S(?:ystemColorsDidChange|plitView(?:DidResizeSubviews|WillResizeSubviews))|C(?:o(?:nt(?:extHelpModeDid(?:Deactivate|Activate)|rolT(?:intDidChange|extDid(?:BeginEditing|Change|EndEditing)))|lor(?:PanelColorDidChange|ListDidChange)|mboBox(?:Selection(?:IsChanging|DidChange)|Will(?:Dismiss|PopUp)))|lassDescriptionNeededForClass)|T(?:oolbar(?:DidRemoveItem|WillAddItem)|ext(?:Storage(?:DidProcessEditing|WillProcessEditing)|Did(?:BeginEditing|Change|EndEditing)|View(?:DidChange(?:Selection|TypingAttributes)|WillChangeNotifyingTextView))|ableView(?:Selection(?:IsChanging|DidChange)|ColumnDid(?:Resize|Move)))|ImageRepRegistryDidChange|OutlineView(?:Selection(?:IsChanging|DidChange)|ColumnDid(?:Resize|Move)|Item(?:Did(?:Collapse|Expand)|Will(?:Collapse|Expand)))|Drawer(?:Did(?:Close|Open)|Will(?:Close|Open))|PopUpButton(?:CellWillPopUp|WillPopUp)|View(?:GlobalFrameDidChange|Bou
 ndsDidChange|F(?:ocusDidChange|rameDidChange))|FontSetChanged|W(?:indow(?:Did(?:Resi(?:ze|gn(?:Main|Key))|M(?:iniaturize|ove)|Become(?:Main|Key)|ChangeScreen(?:|Profile)|Deminiaturize|Update|E(?:ndSheet|xpose))|Will(?:M(?:iniaturize|ove)|BeginSheet|Close))|orkspace(?:SessionDid(?:ResignActive|BecomeActive)|Did(?:Mount|TerminateApplication|Unmount|PerformFileOperation|Wake|LaunchApplication)|Will(?:Sleep|Unmount|PowerOff|LaunchApplication)))|A(?:ntialiasThresholdChanged|ppl(?:ication(?:Did(?:ResignActive|BecomeActive|Hide|ChangeScreenParameters|U(?:nhide|pdate)|FinishLaunching)|Will(?:ResignActive|BecomeActive|Hide|Terminate|U(?:nhide|pdate)|FinishLaunching))|eEventManagerWillProcessFirstEvent)))Notification)(?:\\b)"
+        },
+        {
+            token: ["support.constant.cocoa.leopard"],
+            regex: "(?:\\b)(NS(?:RuleEditor(?:RowType(?:Simple|Compound)|NestingMode(?:Si(?:ngle|mple)|Compound|List))|GradientDraws(?:BeforeStartingLocation|AfterEndingLocation)|M(?:inusSetExpressionType|a(?:chPortDeallocate(?:ReceiveRight|SendRight|None)|pTable(?:StrongMemory|CopyIn|ZeroingWeakMemory|ObjectPointerPersonality)))|B(?:oxCustom|undleExecutableArchitecture(?:X86|I386|PPC(?:64)?)|etweenPredicateOperatorType|ackgroundStyle(?:Raised|Dark|L(?:ight|owered)))|S(?:tring(?:DrawingTruncatesLastVisibleLine|EncodingConversion(?:ExternalRepresentation|AllowLossy))|ubqueryExpressionType|p(?:e(?:ech(?:SentenceBoundary|ImmediateBoundary|WordBoundary)|llingState(?:GrammarFlag|SpellingFlag))|litViewDividerStyleThi(?:n|ck))|e(?:rvice(?:RequestTimedOutError|M(?:iscellaneousError|alformedServiceDictionaryError)|InvalidPasteboardDataError|ErrorM(?:inimum|aximum)|Application(?:NotFoundError|LaunchFailedError))|gmentStyle(?:Round(?:Rect|ed)|SmallSquare|Capsule|Textured(?:Rounded|Square)|Auto
 matic)))|H(?:UDWindowMask|ashTable(?:StrongMemory|CopyIn|ZeroingWeakMemory|ObjectPointerPersonality))|N(?:oModeColorPanel|etServiceNoAutoRename)|C(?:hangeRedone|o(?:ntainsPredicateOperatorType|l(?:orRenderingIntent(?:RelativeColorimetric|Saturation|Default|Perceptual|AbsoluteColorimetric)|lectorDisabledOption))|ellHit(?:None|ContentArea|TrackableArea|EditableTextArea))|T(?:imeZoneNameStyle(?:S(?:hort(?:Standard|DaylightSaving)|tandard)|DaylightSaving)|extFieldDatePickerStyle|ableViewSelectionHighlightStyle(?:Regular|SourceList)|racking(?:Mouse(?:Moved|EnteredAndExited)|CursorUpdate|InVisibleRect|EnabledDuringMouseDrag|A(?:ssumeInside|ctive(?:In(?:KeyWindow|ActiveApp)|WhenFirstResponder|Always))))|I(?:n(?:tersectSetExpressionType|dexedColorSpaceModel)|mageScale(?:None|Proportionally(?:Down|UpOrDown)|AxesIndependently))|Ope(?:nGLPFAAllowOfflineRenderers|rationQueue(?:DefaultMaxConcurrentOperationCount|Priority(?:High|Normal|Very(?:High|Low)|Low)))|D(?:iacriticInsensitiveSearch|ownload
 sDirectory)|U(?:nionSetExpressionType|TF(?:16(?:BigEndianStringEncoding|StringEncoding|LittleEndianStringEncoding)|32(?:BigEndianStringEncoding|StringEncoding|LittleEndianStringEncoding)))|P(?:ointerFunctions(?:Ma(?:chVirtualMemory|llocMemory)|Str(?:ongMemory|uctPersonality)|C(?:StringPersonality|opyIn)|IntegerPersonality|ZeroingWeakMemory|O(?:paque(?:Memory|Personality)|bjectP(?:ointerPersonality|ersonality)))|at(?:hStyle(?:Standard|NavigationBar|PopUp)|ternColorSpaceModel)|rintPanelShows(?:Scaling|Copies|Orientation|P(?:a(?:perSize|ge(?:Range|SetupAccessory))|review)))|Executable(?:RuntimeMismatchError|NotLoadableError|ErrorM(?:inimum|aximum)|L(?:inkError|oadError)|ArchitectureMismatchError)|KeyValueObservingOption(?:Initial|Prior)|F(?:i(?:ndPanelSubstringMatchType(?:StartsWith|Contains|EndsWith|FullWord)|leRead(?:TooLargeError|UnknownStringEncodingError))|orcedOrderingSearch)|Wi(?:ndow(?:BackingLocation(?:MainMemory|Default|VideoMemory)|Sharing(?:Read(?:Only|Write)|None)|Collecti
 onBehavior(?:MoveToActiveSpace|CanJoinAllSpaces|Default))|dthInsensitiveSearch)|AggregateExpressionType))(?:\\b)"
+        },
+        {
+            token: ["support.constant.cocoa"],
+            regex: "(?:\\b)(NS(?:R(?:GB(?:ModeColorPanel|ColorSpaceModel)|ight(?:Mouse(?:D(?:own(?:Mask)?|ragged(?:Mask)?)|Up(?:Mask)?)|T(?:ext(?:Movement|Alignment)|ab(?:sBezelBorder|StopType))|ArrowFunctionKey)|ound(?:RectBezelStyle|Bankers|ed(?:BezelStyle|TokenStyle|DisclosureBezelStyle)|Down|Up|Plain|Line(?:CapStyle|JoinStyle))|un(?:StoppedResponse|ContinuesResponse|AbortedResponse)|e(?:s(?:izableWindowMask|et(?:CursorRectsRunLoopOrdering|FunctionKey))|ce(?:ssedBezelStyle|iver(?:sCantHandleCommandScriptError|EvaluationScriptError))|turnTextMovement|doFunctionKey|quiredArgumentsMissingScriptError|l(?:evancyLevelIndicatorStyle|ative(?:Before|After))|gular(?:SquareBezelStyle|ControlSize)|moveTraitFontAction)|a(?:n(?:domSubelement|geDateMode)|tingLevelIndicatorStyle|dio(?:ModeMatrix|Button)))|G(?:IFFileType|lyph(?:Below|Inscribe(?:B(?:elow|ase)|Over(?:strike|Below)|Above)|Layout(?:WithPrevious|A(?:tAPoint|gainstAPoint))|A(?:ttribute(?:BidiLevel|Soft|Inscribe|Elastic)|bove))|r(?:oove
 Border|eaterThan(?:Comparison|OrEqualTo(?:Comparison|PredicateOperatorType)|PredicateOperatorType)|a(?:y(?:ModeColorPanel|ColorSpaceModel)|dient(?:None|Con(?:cave(?:Strong|Weak)|vex(?:Strong|Weak)))|phiteControlTint)))|XML(?:N(?:o(?:tationDeclarationKind|de(?:CompactEmptyElement|IsCDATA|OptionsNone|Use(?:SingleQuotes|DoubleQuotes)|Pre(?:serve(?:NamespaceOrder|C(?:haracterReferences|DATA)|DTD|Prefixes|E(?:ntities|mptyElements)|Quotes|Whitespace|A(?:ttributeOrder|ll))|ttyPrint)|ExpandEmptyElement))|amespaceKind)|CommentKind|TextKind|InvalidKind|D(?:ocument(?:X(?:MLKind|HTMLKind|Include)|HTMLKind|T(?:idy(?:XML|HTML)|extKind)|IncludeContentTypeDeclaration|Validate|Kind)|TDKind)|P(?:arser(?:GTRequiredError|XMLDeclNot(?:StartedError|FinishedError)|Mi(?:splaced(?:XMLDeclarationError|CDATAEndStringError)|xedContentDeclNot(?:StartedError|FinishedError))|S(?:t(?:andaloneValueError|ringNot(?:StartedError|ClosedError))|paceRequiredError|eparatorRequiredError)|N(?:MTOKENRequiredError|o(?:t(?:ati
 onNot(?:StartedError|FinishedError)|WellBalancedError)|DTDError)|amespaceDeclarationError|AMERequiredError)|C(?:haracterRef(?:In(?:DTDError|PrologError|EpilogError)|AtEOFError)|o(?:nditionalSectionNot(?:StartedError|FinishedError)|mment(?:NotFinishedError|ContainsDoubleHyphenError))|DATANotFinishedError)|TagNameMismatchError|In(?:ternalError|valid(?:HexCharacterRefError|C(?:haracter(?:RefError|InEntityError|Error)|onditionalSectionError)|DecimalCharacterRefError|URIError|Encoding(?:NameError|Error)))|OutOfMemoryError|D(?:ocumentStartError|elegateAbortedParseError|OCTYPEDeclNotFinishedError)|U(?:RI(?:RequiredError|FragmentError)|n(?:declaredEntityError|parsedEntityError|knownEncodingError|finishedTagError))|P(?:CDATARequiredError|ublicIdentifierRequiredError|arsedEntityRef(?:MissingSemiError|NoNameError|In(?:Internal(?:SubsetError|Error)|PrologError|EpilogError)|AtEOFError)|r(?:ocessingInstructionNot(?:StartedError|FinishedError)|ematureDocumentEndError))|E(?:n(?:codingNotSupportedEr
 ror|tity(?:Ref(?:In(?:DTDError|PrologError|EpilogError)|erence(?:MissingSemiError|WithoutNameError)|LoopError|AtEOFError)|BoundaryError|Not(?:StartedError|FinishedError)|Is(?:ParameterError|ExternalError)|ValueRequiredError))|qualExpectedError|lementContentDeclNot(?:StartedError|FinishedError)|xt(?:ernalS(?:tandaloneEntityError|ubsetNotFinishedError)|raContentError)|mptyDocumentError)|L(?:iteralNot(?:StartedError|FinishedError)|T(?:RequiredError|SlashRequiredError)|essThanSymbolInAttributeError)|Attribute(?:RedefinedError|HasNoValueError|Not(?:StartedError|FinishedError)|ListNot(?:StartedError|FinishedError)))|rocessingInstructionKind)|E(?:ntity(?:GeneralKind|DeclarationKind|UnparsedKind|P(?:ar(?:sedKind|ameterKind)|redefined))|lement(?:Declaration(?:MixedKind|UndefinedKind|E(?:lementKind|mptyKind)|Kind|AnyKind)|Kind))|Attribute(?:N(?:MToken(?:sKind|Kind)|otationKind)|CDATAKind|ID(?:Ref(?:sKind|Kind)|Kind)|DeclarationKind|En(?:tit(?:yKind|iesKind)|umerationKind)|Kind))|M(?:i(?:n(?:X
 Edge|iaturizableWindowMask|YEdge|uteCalendarUnit)|terLineJoinStyle|ddleSubelement|xedState)|o(?:nthCalendarUnit|deSwitchFunctionKey|use(?:Moved(?:Mask)?|E(?:ntered(?:Mask)?|ventSubtype|xited(?:Mask)?))|veToBezierPathElement|mentary(?:ChangeButton|Push(?:Button|InButton)|Light(?:Button)?))|enuFunctionKey|a(?:c(?:intoshInterfaceStyle|OSRomanStringEncoding)|tchesPredicateOperatorType|ppedRead|x(?:XEdge|YEdge))|ACHOperatingSystem)|B(?:MPFileType|o(?:ttomTabsBezelBorder|ldFontMask|rderlessWindowMask|x(?:Se(?:condary|parator)|OldStyle|Primary))|uttLineCapStyle|e(?:zelBorder|velLineJoinStyle|low(?:Bottom|Top)|gin(?:sWith(?:Comparison|PredicateOperatorType)|FunctionKey))|lueControlTint|ack(?:spaceCharacter|tabTextMovement|ingStore(?:Retained|Buffered|Nonretained)|TabCharacter|wardsSearch|groundTab)|r(?:owser(?:NoColumnResizing|UserColumnResizing|AutoColumnResizing)|eakFunctionKey))|S(?:h(?:ift(?:JISStringEncoding|KeyMask)|ow(?:ControlGlyphs|InvisibleGlyphs)|adowlessSquareBezelStyle)|y(?:s(?
 :ReqFunctionKey|tem(?:D(?:omainMask|efined(?:Mask)?)|FunctionKey))|mbolStringEncoding)|c(?:a(?:nnedOption|le(?:None|ToFit|Proportionally))|r(?:oll(?:er(?:NoPart|Increment(?:Page|Line|Arrow)|Decrement(?:Page|Line|Arrow)|Knob(?:Slot)?|Arrows(?:M(?:inEnd|axEnd)|None|DefaultSetting))|Wheel(?:Mask)?|LockFunctionKey)|eenChangedEventType))|t(?:opFunctionKey|r(?:ingDrawing(?:OneShot|DisableScreenFontSubstitution|Uses(?:DeviceMetrics|FontLeading|LineFragmentOrigin))|eam(?:Status(?:Reading|NotOpen|Closed|Open(?:ing)?|Error|Writing|AtEnd)|Event(?:Has(?:BytesAvailable|SpaceAvailable)|None|OpenCompleted|E(?:ndEncountered|rrorOccurred)))))|i(?:ngle(?:DateMode|UnderlineStyle)|ze(?:DownFontAction|UpFontAction))|olarisOperatingSystem|unOSOperatingSystem|pecialPageOrder|e(?:condCalendarUnit|lect(?:By(?:Character|Paragraph|Word)|i(?:ng(?:Next|Previous)|onAffinity(?:Downstream|Upstream))|edTab|FunctionKey)|gmentSwitchTracking(?:Momentary|Select(?:One|Any)))|quareLineCapStyle|witchButton|ave(?:ToOperati
 on|Op(?:tions(?:Yes|No|Ask)|eration)|AsOperation)|mall(?:SquareBezelStyle|C(?:ontrolSize|apsFontMask)|IconButtonBezelStyle))|H(?:ighlightModeMatrix|SBModeColorPanel|o(?:ur(?:Minute(?:SecondDatePickerElementFlag|DatePickerElementFlag)|CalendarUnit)|rizontalRuler|meFunctionKey)|TTPCookieAcceptPolicy(?:Never|OnlyFromMainDocumentDomain|Always)|e(?:lp(?:ButtonBezelStyle|KeyMask|FunctionKey)|avierFontAction)|PUXOperatingSystem)|Year(?:MonthDa(?:yDatePickerElementFlag|tePickerElementFlag)|CalendarUnit)|N(?:o(?:n(?:StandardCharacterSetFontMask|ZeroWindingRule|activatingPanelMask|LossyASCIIStringEncoding)|Border|t(?:ification(?:SuspensionBehavior(?:Hold|Coalesce|D(?:eliverImmediately|rop))|NoCoalescing|CoalescingOn(?:Sender|Name)|DeliverImmediately|PostToAllSessions)|PredicateType|EqualToPredicateOperatorType)|S(?:cr(?:iptError|ollerParts)|ubelement|pecifierError)|CellMask|T(?:itle|opLevelContainersSpecifierError|abs(?:BezelBorder|NoBorder|LineBorder))|I(?:nterfaceStyle|mage)|UnderlineStyle|
 FontChangeAction)|u(?:ll(?:Glyph|CellType)|m(?:eric(?:Search|PadKeyMask)|berFormatter(?:Round(?:Half(?:Down|Up|Even)|Ceiling|Down|Up|Floor)|Behavior(?:10|Default)|S(?:cientificStyle|pellOutStyle)|NoStyle|CurrencyStyle|DecimalStyle|P(?:ercentStyle|ad(?:Before(?:Suffix|Prefix)|After(?:Suffix|Prefix))))))|e(?:t(?:Services(?:BadArgumentError|NotFoundError|C(?:ollisionError|ancelledError)|TimeoutError|InvalidError|UnknownError|ActivityInProgress)|workDomainMask)|wlineCharacter|xt(?:StepInterfaceStyle|FunctionKey))|EXTSTEPStringEncoding|a(?:t(?:iveShortGlyphPacking|uralTextAlignment)|rrowFontMask))|C(?:hange(?:ReadOtherContents|GrayCell(?:Mask)?|BackgroundCell(?:Mask)?|Cleared|Done|Undone|Autosaved)|MYK(?:ModeColorPanel|ColorSpaceModel)|ircular(?:BezelStyle|Slider)|o(?:n(?:stantValueExpressionType|t(?:inuousCapacityLevelIndicatorStyle|entsCellMask|ain(?:sComparison|erSpecifierError)|rol(?:Glyph|KeyMask))|densedFontMask)|lor(?:Panel(?:RGBModeMask|GrayModeMask|HSBModeMask|C(?:MYKModeMask|ol
 orListModeMask|ustomPaletteModeMask|rayonModeMask)|WheelModeMask|AllModesMask)|ListModeColorPanel)|reServiceDirectory|m(?:p(?:osite(?:XOR|Source(?:In|O(?:ut|ver)|Atop)|Highlight|C(?:opy|lear)|Destination(?:In|O(?:ut|ver)|Atop)|Plus(?:Darker|Lighter))|ressedFontMask)|mandKeyMask))|u(?:stom(?:SelectorPredicateOperatorType|PaletteModeColorPanel)|r(?:sor(?:Update(?:Mask)?|PointingDevice)|veToBezierPathElement))|e(?:nterT(?:extAlignment|abStopType)|ll(?:State|H(?:ighlighted|as(?:Image(?:Horizontal|OnLeftOrBottom)|OverlappingImage))|ChangesContents|Is(?:Bordered|InsetButton)|Disabled|Editable|LightsBy(?:Gray|Background|Contents)|AllowsMixedState))|l(?:ipPagination|o(?:s(?:ePathBezierPathElement|ableWindowMask)|ckAndCalendarDatePickerStyle)|ear(?:ControlTint|DisplayFunctionKey|LineFunctionKey))|a(?:seInsensitive(?:Search|PredicateOption)|n(?:notCreateScriptCommandError|cel(?:Button|TextMovement))|chesDirectory|lculation(?:NoError|Overflow|DivideByZero|Underflow|LossOfPrecision)|rriageRetur
 nCharacter)|r(?:itical(?:Request|AlertStyle)|ayonModeColorPanel))|T(?:hick(?:SquareBezelStyle|erSquareBezelStyle)|ypesetter(?:Behavior|HorizontalTabAction|ContainerBreakAction|ZeroAdvancementAction|OriginalBehavior|ParagraphBreakAction|WhitespaceAction|L(?:ineBreakAction|atestBehavior))|i(?:ckMark(?:Right|Below|Left|Above)|tledWindowMask|meZoneDatePickerElementFlag)|o(?:olbarItemVisibilityPriority(?:Standard|High|User|Low)|pTabsBezelBorder|ggleButton)|IFF(?:Compression(?:N(?:one|EXT)|CCITTFAX(?:3|4)|OldJPEG|JPEG|PackBits|LZW)|FileType)|e(?:rminate(?:Now|Cancel|Later)|xt(?:Read(?:InapplicableDocumentTypeError|WriteErrorM(?:inimum|aximum))|Block(?:M(?:i(?:nimum(?:Height|Width)|ddleAlignment)|a(?:rgin|ximum(?:Height|Width)))|B(?:o(?:ttomAlignment|rder)|aselineAlignment)|Height|TopAlignment|P(?:ercentageValueType|adding)|Width|AbsoluteValueType)|StorageEdited(?:Characters|Attributes)|CellType|ured(?:RoundedBezelStyle|BackgroundWindowMask|SquareBezelStyle)|Table(?:FixedLayoutAlgorithm|Au
 tomaticLayoutAlgorithm)|Field(?:RoundedBezel|SquareBezel|AndStepperDatePickerStyle)|WriteInapplicableDocumentTypeError|ListPrependEnclosingMarker))|woByteGlyphPacking|ab(?:Character|TextMovement|le(?:tP(?:oint(?:Mask|EventSubtype)?|roximity(?:Mask|EventSubtype)?)|Column(?:NoResizing|UserResizingMask|AutoresizingMask)|View(?:ReverseSequentialColumnAutoresizingStyle|GridNone|S(?:olid(?:HorizontalGridLineMask|VerticalGridLineMask)|equentialColumnAutoresizingStyle)|NoColumnAutoresizing|UniformColumnAutoresizingStyle|FirstColumnOnlyAutoresizingStyle|LastColumnOnlyAutoresizingStyle)))|rackModeMatrix)|I(?:n(?:sert(?:CharFunctionKey|FunctionKey|LineFunctionKey)|t(?:Type|ernalS(?:criptError|pecifierError))|dexSubelement|validIndexSpecifierError|formational(?:Request|AlertStyle)|PredicateOperatorType)|talicFontMask|SO(?:2022JPStringEncoding|Latin(?:1StringEncoding|2StringEncoding))|dentityMappingCharacterCollection|llegalTextMovement|mage(?:R(?:ight|ep(?:MatchesDevice|LoadStatus(?:ReadingHead
 er|Completed|InvalidData|Un(?:expectedEOF|knownType)|WillNeedAllData)))|Below|C(?:ellType|ache(?:BySize|Never|Default|Always))|Interpolation(?:High|None|Default|Low)|O(?:nly|verlaps)|Frame(?:Gr(?:oove|ayBezel)|Button|None|Photo)|L(?:oadStatus(?:ReadError|C(?:ompleted|ancelled)|InvalidData|UnexpectedEOF)|eft)|A(?:lign(?:Right|Bottom(?:Right|Left)?|Center|Top(?:Right|Left)?|Left)|bove)))|O(?:n(?:State|eByteGlyphPacking|OffButton|lyScrollerArrows)|ther(?:Mouse(?:D(?:own(?:Mask)?|ragged(?:Mask)?)|Up(?:Mask)?)|TextMovement)|SF1OperatingSystem|pe(?:n(?:GL(?:GO(?:Re(?:setLibrary|tainRenderers)|ClearFormatCache|FormatCacheSize)|PFA(?:R(?:obust|endererID)|M(?:inimumPolicy|ulti(?:sample|Screen)|PSafe|aximumPolicy)|BackingStore|S(?:creenMask|te(?:ncilSize|reo)|ingleRenderer|upersample|ample(?:s|Buffers|Alpha))|NoRecovery|C(?:o(?:lor(?:Size|Float)|mpliant)|losestPolicy)|OffScreen|D(?:oubleBuffer|epthSize)|PixelBuffer|VirtualScreenCount|FullScreen|Window|A(?:cc(?:umSize|elerated)|ux(?:Buffers|De
 pthStencil)|l(?:phaSize|lRenderers))))|StepUnicodeReservedBase)|rationNotSupportedForKeyS(?:criptError|pecifierError))|ffState|KButton|rPredicateType|bjC(?:B(?:itfield|oolType)|S(?:hortType|tr(?:ingType|uctType)|electorType)|NoType|CharType|ObjectType|DoubleType|UnionType|PointerType|VoidType|FloatType|Long(?:Type|longType)|ArrayType))|D(?:i(?:s(?:c(?:losureBezelStyle|reteCapacityLevelIndicatorStyle)|playWindowRunLoopOrdering)|acriticInsensitivePredicateOption|rect(?:Selection|PredicateModifier))|o(?:c(?:ModalWindowMask|ument(?:Directory|ationDirectory))|ubleType|wn(?:TextMovement|ArrowFunctionKey))|e(?:s(?:cendingPageOrder|ktopDirectory)|cimalTabStopType|v(?:ice(?:NColorSpaceModel|IndependentModifierFlagsMask)|eloper(?:Directory|ApplicationDirectory))|fault(?:ControlTint|TokenStyle)|lete(?:Char(?:acter|FunctionKey)|FunctionKey|LineFunctionKey)|moApplicationDirectory)|a(?:yCalendarUnit|teFormatter(?:MediumStyle|Behavior(?:10|Default)|ShortStyle|NoStyle|FullStyle|LongStyle))|ra(?:wer
 (?:Clos(?:ingState|edState)|Open(?:ingState|State))|gOperation(?:Generic|Move|None|Copy|Delete|Private|Every|Link|All)))|U(?:ser(?:CancelledError|D(?:irectory|omainMask)|FunctionKey)|RL(?:Handle(?:NotLoaded|Load(?:Succeeded|InProgress|Failed))|CredentialPersistence(?:None|Permanent|ForSession))|n(?:scaledWindowMask|cachedRead|i(?:codeStringEncoding|talicFontMask|fiedTitleAndToolbarWindowMask)|d(?:o(?:CloseGroupingRunLoopOrdering|FunctionKey)|e(?:finedDateComponent|rline(?:Style(?:Single|None|Thick|Double)|Pattern(?:Solid|D(?:ot|ash(?:Dot(?:Dot)?)?)))))|known(?:ColorSpaceModel|P(?:ointingDevice|ageOrder)|KeyS(?:criptError|pecifierError))|boldFontMask)|tilityWindowMask|TF8StringEncoding|p(?:dateWindowsRunLoopOrdering|TextMovement|ArrowFunctionKey))|J(?:ustifiedTextAlignment|PEG(?:2000FileType|FileType)|apaneseEUC(?:GlyphPacking|StringEncoding))|P(?:o(?:s(?:t(?:Now|erFontMask|WhenIdle|ASAP)|iti(?:on(?:Replace|Be(?:fore|ginning)|End|After)|ve(?:IntType|DoubleType|FloatType)))|pUp(?:NoAr
 row|ArrowAt(?:Bottom|Center))|werOffEventType|rtraitOrientation)|NGFileType|ush(?:InCell(?:Mask)?|OnPushOffButton)|e(?:n(?:TipMask|UpperSideMask|PointingDevice|LowerSideMask)|riodic(?:Mask)?)|P(?:S(?:caleField|tatus(?:Title|Field)|aveButton)|N(?:ote(?:Title|Field)|ame(?:Title|Field))|CopiesField|TitleField|ImageButton|OptionsButton|P(?:a(?:perFeedButton|ge(?:Range(?:To|From)|ChoiceMatrix))|reviewButton)|LayoutButton)|lainTextTokenStyle|a(?:useFunctionKey|ragraphSeparatorCharacter|ge(?:DownFunctionKey|UpFunctionKey))|r(?:int(?:ing(?:ReplyLater|Success|Cancelled|Failure)|ScreenFunctionKey|erTable(?:NotFound|OK|Error)|FunctionKey)|o(?:p(?:ertyList(?:XMLFormat|MutableContainers(?:AndLeaves)?|BinaryFormat|Immutable|OpenStepFormat)|rietaryStringEncoding)|gressIndicator(?:BarStyle|SpinningStyle|Preferred(?:SmallThickness|Thickness|LargeThickness|AquaThickness)))|e(?:ssedTab|vFunctionKey))|L(?:HeightForm|CancelButton|TitleField|ImageButton|O(?:KButton|rientationMatrix)|UnitsButton|PaperName
 Button|WidthForm))|E(?:n(?:terCharacter|d(?:sWith(?:Comparison|PredicateOperatorType)|FunctionKey))|v(?:e(?:nOddWindingRule|rySubelement)|aluatedObjectExpressionType)|qualTo(?:Comparison|PredicateOperatorType)|ra(?:serPointingDevice|CalendarUnit|DatePickerElementFlag)|x(?:clude(?:10|QuickDrawElementsIconCreationOption)|pandedFontMask|ecuteFunctionKey))|V(?:i(?:ew(?:M(?:in(?:XMargin|YMargin)|ax(?:XMargin|YMargin))|HeightSizable|NotSizable|WidthSizable)|aPanelFontAction)|erticalRuler|a(?:lidationErrorM(?:inimum|aximum)|riableExpressionType))|Key(?:SpecifierEvaluationScriptError|Down(?:Mask)?|Up(?:Mask)?|PathExpressionType|Value(?:MinusSetMutation|SetSetMutation|Change(?:Re(?:placement|moval)|Setting|Insertion)|IntersectSetMutation|ObservingOption(?:New|Old)|UnionSetMutation|ValidationError))|QTMovie(?:NormalPlayback|Looping(?:BackAndForthPlayback|Playback))|F(?:1(?:1FunctionKey|7FunctionKey|2FunctionKey|8FunctionKey|3FunctionKey|9FunctionKey|4FunctionKey|5FunctionKey|FunctionKey|0Func
 tionKey|6FunctionKey)|7FunctionKey|i(?:nd(?:PanelAction(?:Replace(?:A(?:ndFind|ll(?:InSelection)?))?|S(?:howFindPanel|e(?:tFindString|lectAll(?:InSelection)?))|Next|Previous)|FunctionKey)|tPagination|le(?:Read(?:No(?:SuchFileError|PermissionError)|CorruptFileError|In(?:validFileNameError|applicableStringEncodingError)|Un(?:supportedSchemeError|knownError))|HandlingPanel(?:CancelButton|OKButton)|NoSuchFileError|ErrorM(?:inimum|aximum)|Write(?:NoPermissionError|In(?:validFileNameError|applicableStringEncodingError)|OutOfSpaceError|Un(?:supportedSchemeError|knownError))|LockingError)|xedPitchFontMask)|2(?:1FunctionKey|7FunctionKey|2FunctionKey|8FunctionKey|3FunctionKey|9FunctionKey|4FunctionKey|5FunctionKey|FunctionKey|0FunctionKey|6FunctionKey)|o(?:nt(?:Mo(?:noSpaceTrait|dernSerifsClass)|BoldTrait|S(?:ymbolicClass|criptsClass|labSerifsClass|ansSerifClass)|C(?:o(?:ndensedTrait|llectionApplicationOnlyMask)|larendonSerifsClass)|TransitionalSerifsClass|I(?:ntegerAdvancementsRenderingMode|
 talicTrait)|O(?:ldStyleSerifsClass|rnamentalsClass)|DefaultRenderingMode|U(?:nknownClass|IOptimizedTrait)|Panel(?:S(?:hadowEffectModeMask|t(?:andardModesMask|rikethroughEffectModeMask)|izeModeMask)|CollectionModeMask|TextColorEffectModeMask|DocumentColorEffectModeMask|UnderlineEffectModeMask|FaceModeMask|All(?:ModesMask|EffectsModeMask))|ExpandedTrait|VerticalTrait|F(?:amilyClassMask|reeformSerifsClass)|Antialiased(?:RenderingMode|IntegerAdvancementsRenderingMode))|cusRing(?:Below|Type(?:None|Default|Exterior)|Only|Above)|urByteGlyphPacking|rm(?:attingError(?:M(?:inimum|aximum))?|FeedCharacter))|8FunctionKey|unction(?:ExpressionType|KeyMask)|3(?:1FunctionKey|2FunctionKey|3FunctionKey|4FunctionKey|5FunctionKey|FunctionKey|0FunctionKey)|9FunctionKey|4FunctionKey|P(?:RevertButton|S(?:ize(?:Title|Field)|etButton)|CurrentField|Preview(?:Button|Field))|l(?:oat(?:ingPointSamplesBitmapFormat|Type)|agsChanged(?:Mask)?)|axButton|5FunctionKey|6FunctionKey)|W(?:heelModeColorPanel|indow(?:s(?:NT
 OperatingSystem|CP125(?:1StringEncoding|2StringEncoding|3StringEncoding|4StringEncoding|0StringEncoding)|95(?:InterfaceStyle|OperatingSystem))|M(?:iniaturizeButton|ovedEventType)|Below|CloseButton|ToolbarButton|ZoomButton|Out|DocumentIconButton|ExposedEventType|Above)|orkspaceLaunch(?:NewInstance|InhibitingBackgroundOnly|Default|PreferringClassic|WithoutA(?:ctivation|ddingToRecents)|A(?:sync|nd(?:Hide(?:Others)?|Print)|llowingClassicStartup))|eek(?:day(?:CalendarUnit|OrdinalCalendarUnit)|CalendarUnit)|a(?:ntsBidiLevels|rningAlertStyle)|r(?:itingDirection(?:RightToLeft|Natural|LeftToRight)|apCalendarComponents))|L(?:i(?:stModeMatrix|ne(?:Moves(?:Right|Down|Up|Left)|B(?:order|reakBy(?:C(?:harWrapping|lipping)|Truncating(?:Middle|Head|Tail)|WordWrapping))|S(?:eparatorCharacter|weep(?:Right|Down|Up|Left))|ToBezierPathElement|DoesntMove|arSlider)|teralSearch|kePredicateOperatorType|ghterFontAction|braryDirectory)|ocalDomainMask|e(?:ssThan(?:Comparison|OrEqualTo(?:Comparison|PredicateOper
 atorType)|PredicateOperatorType)|ft(?:Mouse(?:D(?:own(?:Mask)?|ragged(?:Mask)?)|Up(?:Mask)?)|T(?:ext(?:Movement|Alignment)|ab(?:sBezelBorder|StopType))|ArrowFunctionKey))|a(?:yout(?:RightToLeft|NotDone|CantFit|OutOfGlyphs|Done|LeftToRight)|ndscapeOrientation)|ABColorSpaceModel)|A(?:sc(?:iiWithDoubleByteEUCGlyphPacking|endingPageOrder)|n(?:y(?:Type|PredicateModifier|EventMask)|choredSearch|imation(?:Blocking|Nonblocking(?:Threaded)?|E(?:ffect(?:DisappearingItemDefault|Poof)|ase(?:In(?:Out)?|Out))|Linear)|dPredicateType)|t(?:Bottom|tachmentCharacter|omicWrite|Top)|SCIIStringEncoding|d(?:obe(?:GB1CharacterCollection|CNS1CharacterCollection|Japan(?:1CharacterCollection|2CharacterCollection)|Korea1CharacterCollection)|dTraitFontAction|minApplicationDirectory)|uto(?:saveOperation|Pagination)|pp(?:lication(?:SupportDirectory|D(?:irectory|e(?:fined(?:Mask)?|legateReply(?:Success|Cancel|Failure)|activatedEventType))|ActivatedEventType)|KitDefined(?:Mask)?)|l(?:ternateKeyMask|pha(?:ShiftKeyMa
 sk|NonpremultipliedBitmapFormat|FirstBitmapFormat)|ert(?:SecondButtonReturn|ThirdButtonReturn|OtherReturn|DefaultReturn|ErrorReturn|FirstButtonReturn|AlternateReturn)|l(?:ScrollerParts|DomainsMask|PredicateModifier|LibrariesDirectory|ApplicationsDirectory))|rgument(?:sWrongScriptError|EvaluationScriptError)|bove(?:Bottom|Top)|WTEventType)))(?:\\b)"
+        },
+        {
+        token: "support.function.C99.c",
+        regex: C_Highlight_File.cFunctions
+        },
+        {
+            token : cObj.getKeywords(),
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        },
+        {
+            token: "punctuation.section.scope.begin.objc",
+            regex: "\\[",
+            next: "bracketed_content"
+        },
+        {
+            token: "meta.function.objc",
+            regex: "^(?:-|\\+)\\s*"
+        }
+    ],
+    "constant_NSString": [
+        {
+            token: "constant.character.escape.objc",
+            regex: escapedConstRe
+        },
+        {
+            token: "invalid.illegal.unknown-escape.objc",
+            regex: "\\\\."
+        },
+        {
+            token: "string",
+            regex: '[^"\\\\]+'
+        },
+        {
+            token: "punctuation.definition.string.end",
+            regex: "\"",
+            next: "start"
+        }
+    ],
+    "protocol_list": [
+        {
+            token: "punctuation.section.scope.end.objc",
+            regex: ">",
+            next: "start"
+        },
+        {
+            token: "support.other.protocol.objc",
+            regex: "\bNS(?:GlyphStorage|M(?:utableCopying|enuItem)|C(?:hangeSpelling|o(?:ding|pying|lorPicking(?:Custom|Default)))|T(?:oolbarItemValidations|ext(?:Input|AttachmentCell))|I(?:nputServ(?:iceProvider|erMouseTracker)|gnoreMisspelledWords)|Obj(?:CTypeSerializationCallBack|ect)|D(?:ecimalNumberBehaviors|raggingInfo)|U(?:serInterfaceValidations|RL(?:HandleClient|DownloadDelegate|ProtocolClient|AuthenticationChallengeSender))|Validated(?:ToobarItem|UserInterfaceItem)|Locking)\b"
+        }
+    ],
+    "selectors": [
+        {
+            token: "support.function.any-method.name-of-parameter.objc",
+            regex: "\\b(?:[a-zA-Z_:][\\w]*)+"
+        },
+        {
+            token: "punctuation",
+            regex: "\\)",
+            next: "start"
+        }
+    ],
+    "bracketed_content": [
+        {
+            token: "punctuation.section.scope.end.objc",
+            regex: "\]",
+            next: "start"
+        },
+        {
+            token: ["support.function.any-method.objc"],
+            regex: "(?:predicateWithFormat:| NSPredicate predicateWithFormat:)",
+            next: "start"
+        },
+        {
+            token: "support.function.any-method.objc",
+            regex: "\\w+(?::|(?=\]))",
+            next: "start"
+        }
+    ],
+    "bracketed_strings": [
+        {
+            token: "punctuation.section.scope.end.objc",
+            regex: "\]",
+            next: "start"
+        },
+        {
+            token: "keyword.operator.logical.predicate.cocoa",
+            regex: "\\b(?:AND|OR|NOT|IN)\\b"
+        },
+        {
+            token: ["invalid.illegal.unknown-method.objc", "punctuation.separator.arguments.objc"],
+            regex: "\\b(\w+)(:)"
+        },
+        {
+            regex: "\\b(?:ALL|ANY|SOME|NONE)\\b",
+            token: "constant.language.predicate.cocoa"
+        },
+        {
+            regex: "\\b(?:NULL|NIL|SELF|TRUE|YES|FALSE|NO|FIRST|LAST|SIZE)\\b",
+            token: "constant.language.predicate.cocoa"
+        },
+        {
+            regex: "\\b(?:MATCHES|CONTAINS|BEGINSWITH|ENDSWITH|BETWEEN)\\b",
+            token: "keyword.operator.comparison.predicate.cocoa"
+        },
+        {
+            regex: "\\bC(?:ASEINSENSITIVE|I)\\b",
+            token: "keyword.other.modifier.predicate.cocoa"
+        },
+        {
+            regex: "\\b(?:ANYKEY|SUBQUERY|CAST|TRUEPREDICATE|FALSEPREDICATE)\\b",
+            token: "keyword.other.predicate.cocoa"
+        },
+        {
+            regex: escapedConstRe,
+            token: "constant.character.escape.objc"
+        },
+        {
+            regex: "\\\\.",
+            token: "invalid.illegal.unknown-escape.objc"
+        },
+        {
+            token: "string",
+            regex: '[^"\\\\]'
+        },
+        {
+            token: "punctuation.definition.string.end.objc",
+            regex: "\"",
+            next: "predicates"
+        }
+    ],
+    "comment" : [
+        {
+            token : "comment", // closing comment
+            regex : ".*?\\*\\/",
+            next : "start"
+        }, {
+            token : "comment", // comment spanning whole line
+            regex : ".+"
+        }
+    ],
+    "methods" : [
+        {
+            token : "meta.function.objc",
+            regex : "(?=\\{|#)|;",
+            next : "start"
+        }
+    ]
+}
+
+    // copy in C-Rules directly
+    for (var r in cRules) {
+        if (this.$rules[r]) {
+            if (this.$rules[r].push)
+                this.$rules[r].push.apply(this.$rules[r], cRules[r]);
+        } else {
+            this.$rules[r] = cRules[r];
+        }
+    }
+    
+    this.$rules.bracketed_content = this.$rules.bracketed_content.concat(
+        this.$rules.start, specialVariables
+    );
+
+    this.embedRules(DocCommentHighlightRules, "doc-",
+        [ DocCommentHighlightRules.getEndRule("start") ]);
+};
+
+oop.inherits(ObjectiveCHighlightRules, CHighlightRules);
+
+exports.ObjectiveCHighlightRules = ObjectiveCHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/ocaml.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/ocaml.js b/src/fauxton/assets/js/libs/ace/mode/ocaml.js
new file mode 100644
index 0000000..1f69977
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/ocaml.js
@@ -0,0 +1,97 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var OcamlHighlightRules = require("./ocaml_highlight_rules").OcamlHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var Range = require("../range").Range;
+
+var Mode = function() {
+    this.HighlightRules = OcamlHighlightRules;
+    
+    this.$outdent   = new MatchingBraceOutdent();
+};
+oop.inherits(Mode, TextMode);
+
+var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|with))\s*$/;
+
+(function() {
+
+    this.toggleCommentLines = function(state, doc, startRow, endRow) {
+        var i, line;
+        var outdent = true;
+        var re = /^\s*\(\*(.*)\*\)/;
+
+        for (i=startRow; i<= endRow; i++) {
+            if (!re.test(doc.getLine(i))) {
+                outdent = false;
+                break;
+            }
+        }
+
+        var range = new Range(0, 0, 0, 0);
+        for (i=startRow; i<= endRow; i++) {
+            line = doc.getLine(i);
+            range.start.row  = i;
+            range.end.row    = i;
+            range.end.column = line.length;
+
+            doc.replace(range, outdent ? line.match(re)[1] : "(*" + line + "*)");
+        }
+    };
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+        var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
+
+        if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
+            state === 'start' && indenter.test(line))
+            indent += tab;
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/ocaml_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/ocaml_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/ocaml_highlight_rules.js
new file mode 100644
index 0000000..a17f034
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/ocaml_highlight_rules.js
@@ -0,0 +1,337 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var OcamlHighlightRules = function() {
+
+    var keywords = (
+        "and|as|assert|begin|class|constraint|do|done|downto|else|end|"  +
+        "exception|external|for|fun|function|functor|if|in|include|"     +
+        "inherit|initializer|lazy|let|match|method|module|mutable|new|"  +
+        "object|of|open|or|private|rec|sig|struct|then|to|try|type|val|" +
+        "virtual|when|while|with"
+    );
+
+    var builtinConstants = ("true|false");
+
+    var builtinFunctions = (
+        "abs|abs_big_int|abs_float|abs_num|abstract_tag|accept|access|acos|add|" +
+        "add_available_units|add_big_int|add_buffer|add_channel|add_char|" +
+        "add_initializer|add_int_big_int|add_interfaces|add_num|add_string|" +
+        "add_substitute|add_substring|alarm|allocated_bytes|allow_only|" +
+        "allow_unsafe_modules|always|append|appname_get|appname_set|" +
+        "approx_num_exp|approx_num_fix|arg|argv|arith_status|array|" +
+        "array1_of_genarray|array2_of_genarray|array3_of_genarray|asin|asr|" +
+        "assoc|assq|at_exit|atan|atan2|auto_synchronize|background|basename|" +
+        "beginning_of_input|big_int_of_int|big_int_of_num|big_int_of_string|bind|" +
+        "bind_class|bind_tag|bits|bits_of_float|black|blit|blit_image|blue|bool|" +
+        "bool_of_string|bounded_full_split|bounded_split|bounded_split_delim|" +
+        "bprintf|break|broadcast|bscanf|button_down|c_layout|capitalize|cardinal|" +
+        "cardinal|catch|catch_break|ceil|ceiling_num|channel|char|char_of_int|" +
+        "chdir|check|check_suffix|chmod|choose|chop_extension|chop_suffix|chown|" +
+        "chown|chr|chroot|classify_float|clear|clear_available_units|" +
+        "clear_close_on_exec|clear_graph|clear_nonblock|clear_parser|" +
+        "close|close|closeTk|close_box|close_graph|close_in|close_in_noerr|" +
+        "close_out|close_out_noerr|close_process|close_process|" +
+        "close_process_full|close_process_in|close_process_out|close_subwindow|" +
+        "close_tag|close_tbox|closedir|closedir|closure_tag|code|combine|" +
+        "combine|combine|command|compact|compare|compare_big_int|compare_num|" +
+        "complex32|complex64|concat|conj|connect|contains|contains_from|contents|" +
+        "copy|cos|cosh|count|count|counters|create|create_alarm|create_image|" +
+        "create_matrix|create_matrix|create_matrix|create_object|" +
+        "create_object_and_run_initializers|create_object_opt|create_process|" +
+        "create_process|create_process_env|create_process_env|create_table|" +
+        "current|current_dir_name|current_point|current_x|current_y|curveto|" +
+        "custom_tag|cyan|data_size|decr|decr_num|default_available_units|delay|" +
+        "delete_alarm|descr_of_in_channel|descr_of_out_channel|destroy|diff|dim|" +
+        "dim1|dim2|dim3|dims|dirname|display_mode|div|div_big_int|div_num|" +
+        "double_array_tag|double_tag|draw_arc|draw_char|draw_circle|draw_ellipse|" +
+        "draw_image|draw_poly|draw_poly_line|draw_rect|draw_segments|draw_string|" +
+        "dummy_pos|dummy_table|dump_image|dup|dup2|elements|empty|end_of_input|" +
+        "environment|eprintf|epsilon_float|eq_big_int|eq_num|equal|err_formatter|" +
+        "error_message|escaped|establish_server|executable_name|execv|execve|execvp|" +
+        "execvpe|exists|exists2|exit|exp|failwith|fast_sort|fchmod|fchown|field|" +
+        "file|file_exists|fill|fill_arc|fill_circle|fill_ellipse|fill_poly|fill_rect|" +
+        "filter|final_tag|finalise|find|find_all|first_chars|firstkey|flatten|" +
+        "float|float32|float64|float_of_big_int|float_of_bits|float_of_int|" +
+        "float_of_num|float_of_string|floor|floor_num|flush|flush_all|flush_input|" +
+        "flush_str_formatter|fold|fold_left|fold_left2|fold_right|fold_right2|" +
+        "for_all|for_all2|force|force_newline|force_val|foreground|fork|" +
+        "format_of_string|formatter_of_buffer|formatter_of_out_channel|" +
+        "fortran_layout|forward_tag|fprintf|frexp|from|from_channel|from_file|" +
+        "from_file_bin|from_function|from_string|fscanf|fst|fstat|ftruncate|" +
+        "full_init|full_major|full_split|gcd_big_int|ge_big_int|ge_num|" +
+        "genarray_of_array1|genarray_of_array2|genarray_of_array3|get|" +
+        "get_all_formatter_output_functions|get_approx_printing|get_copy|" +
+        "get_ellipsis_text|get_error_when_null_denominator|get_floating_precision|" +
+        "get_formatter_output_functions|get_formatter_tag_functions|get_image|" +
+        "get_margin|get_mark_tags|get_max_boxes|get_max_indent|get_method|" +
+        "get_method_label|get_normalize_ratio|get_normalize_ratio_when_printing|" +
+        "get_print_tags|get_state|get_variable|getcwd|getegid|getegid|getenv|" +
+        "getenv|getenv|geteuid|geteuid|getgid|getgid|getgrgid|getgrgid|getgrnam|" +
+        "getgrnam|getgroups|gethostbyaddr|gethostbyname|gethostname|getitimer|" +
+        "getlogin|getpeername|getpid|getppid|getprotobyname|getprotobynumber|" +
+        "getpwnam|getpwuid|getservbyname|getservbyport|getsockname|getsockopt|" +
+        "getsockopt_float|getsockopt_int|getsockopt_optint|gettimeofday|getuid|" +
+        "global_replace|global_substitute|gmtime|green|grid|group_beginning|" +
+        "group_end|gt_big_int|gt_num|guard|handle_unix_error|hash|hash_param|" +
+        "hd|header_size|i|id|ignore|in_channel_length|in_channel_of_descr|incr|" +
+        "incr_num|index|index_from|inet_addr_any|inet_addr_of_string|infinity|" +
+        "infix_tag|init|init_class|input|input_binary_int|input_byte|input_char|" +
+        "input_line|input_value|int|int16_signed|int16_unsigned|int32|int64|" +
+        "int8_signed|int8_unsigned|int_of_big_int|int_of_char|int_of_float|" +
+        "int_of_num|int_of_string|integer_num|inter|interactive|inv|invalid_arg|" +
+        "is_block|is_empty|is_implicit|is_int|is_int_big_int|is_integer_num|" +
+        "is_relative|iter|iter2|iteri|join|junk|key_pressed|kill|kind|kprintf|" +
+        "kscanf|land|last_chars|layout|lazy_from_fun|lazy_from_val|lazy_is_val|" +
+        "lazy_tag|ldexp|le_big_int|le_num|length|lexeme|lexeme_char|lexeme_end|" +
+        "lexeme_end_p|lexeme_start|lexeme_start_p|lineto|link|list|listen|lnot|" +
+        "loadfile|loadfile_private|localtime|lock|lockf|log|log10|logand|lognot|" +
+        "logor|logxor|lor|lower_window|lowercase|lseek|lsl|lsr|lstat|lt_big_int|" +
+        "lt_num|lxor|magenta|magic|mainLoop|major|major_slice|make|make_formatter|" +
+        "make_image|make_lexer|make_matrix|make_self_init|map|map2|map_file|mapi|" +
+        "marshal|match_beginning|match_end|matched_group|matched_string|max|" +
+        "max_array_length|max_big_int|max_elt|max_float|max_int|max_num|" +
+        "max_string_length|mem|mem_assoc|mem_assq|memq|merge|min|min_big_int|" +
+        "min_elt|min_float|min_int|min_num|minor|minus_big_int|minus_num|" +
+        "minus_one|mkdir|mkfifo|mktime|mod|mod_big_int|mod_float|mod_num|modf|" +
+        "mouse_pos|moveto|mul|mult_big_int|mult_int_big_int|mult_num|nan|narrow|" +
+        "nat_of_num|nativeint|neg|neg_infinity|new_block|new_channel|new_method|" +
+        "new_variable|next|nextkey|nice|nice|no_scan_tag|norm|norm2|not|npeek|" +
+        "nth|nth_dim|num_digits_big_int|num_dims|num_of_big_int|num_of_int|" +
+        "num_of_nat|num_of_ratio|num_of_string|O|obj|object_tag|ocaml_version|" +
+        "of_array|of_channel|of_float|of_int|of_int32|of_list|of_nativeint|" +
+        "of_string|one|openTk|open_box|open_connection|open_graph|open_hbox|" +
+        "open_hovbox|open_hvbox|open_in|open_in_bin|open_in_gen|open_out|" +
+        "open_out_bin|open_out_gen|open_process|open_process_full|open_process_in|" +
+        "open_process_out|open_subwindow|open_tag|open_tbox|open_temp_file|" +
+        "open_vbox|opendbm|opendir|openfile|or|os_type|out_channel_length|" +
+        "out_channel_of_descr|output|output_binary_int|output_buffer|output_byte|" +
+        "output_char|output_string|output_value|over_max_boxes|pack|params|" +
+        "parent_dir_name|parse|parse_argv|partition|pause|peek|pipe|pixels|" +
+        "place|plot|plots|point_color|polar|poll|pop|pos_in|pos_out|pow|" +
+        "power_big_int_positive_big_int|power_big_int_positive_int|" +
+        "power_int_positive_big_int|power_int_positive_int|power_num|" +
+        "pp_close_box|pp_close_tag|pp_close_tbox|pp_force_newline|" +
+        "pp_get_all_formatter_output_functions|pp_get_ellipsis_text|" +
+        "pp_get_formatter_output_functions|pp_get_formatter_tag_functions|" +
+        "pp_get_margin|pp_get_mark_tags|pp_get_max_boxes|pp_get_max_indent|" +
+        "pp_get_print_tags|pp_open_box|pp_open_hbox|pp_open_hovbox|pp_open_hvbox|" +
+        "pp_open_tag|pp_open_tbox|pp_open_vbox|pp_over_max_boxes|pp_print_as|" +
+        "pp_print_bool|pp_print_break|pp_print_char|pp_print_cut|pp_print_float|" +
+        "pp_print_flush|pp_print_if_newline|pp_print_int|pp_print_newline|" +
+        "pp_print_space|pp_print_string|pp_print_tab|pp_print_tbreak|" +
+        "pp_set_all_formatter_output_functions|pp_set_ellipsis_text|" +
+        "pp_set_formatter_out_channel|pp_set_formatter_output_functions|" +
+        "pp_set_formatter_tag_functions|pp_set_margin|pp_set_mark_tags|" +
+        "pp_set_max_boxes|pp_set_max_indent|pp_set_print_tags|pp_set_tab|" +
+        "pp_set_tags|pred|pred_big_int|pred_num|prerr_char|prerr_endline|" +
+        "prerr_float|prerr_int|prerr_newline|prerr_string|print|print_as|" +
+        "print_bool|print_break|print_char|print_cut|print_endline|print_float|" +
+        "print_flush|print_if_newline|print_int|print_newline|print_space|" +
+        "print_stat|print_string|print_tab|print_tbreak|printf|prohibit|" +
+        "public_method_label|push|putenv|quo_num|quomod_big_int|quote|raise|" +
+        "raise_window|ratio_of_num|rcontains_from|read|read_float|read_int|" +
+        "read_key|read_line|readdir|readdir|readlink|really_input|receive|recv|" +
+        "recvfrom|red|ref|regexp|regexp_case_fold|regexp_string|" +
+        "regexp_string_case_fold|register|register_exception|rem|remember_mode|" +
+        "remove|remove_assoc|remove_assq|rename|replace|replace_first|" +
+        "replace_matched|repr|reset|reshape|reshape_1|reshape_2|reshape_3|rev|" +
+        "rev_append|rev_map|rev_map2|rewinddir|rgb|rhs_end|rhs_end_pos|rhs_start|" +
+        "rhs_start_pos|rindex|rindex_from|rlineto|rmdir|rmoveto|round_num|" +
+        "run_initializers|run_initializers_opt|scanf|search_backward|" +
+        "search_forward|seek_in|seek_out|select|self|self_init|send|sendto|set|" +
+        "set_all_formatter_output_functions|set_approx_printing|" +
+        "set_binary_mode_in|set_binary_mode_out|set_close_on_exec|" +
+        "set_close_on_exec|set_color|set_ellipsis_text|" +
+        "set_error_when_null_denominator|set_field|set_floating_precision|" +
+        "set_font|set_formatter_out_channel|set_formatter_output_functions|" +
+        "set_formatter_tag_functions|set_line_width|set_margin|set_mark_tags|" +
+        "set_max_boxes|set_max_indent|set_method|set_nonblock|set_nonblock|" +
+        "set_normalize_ratio|set_normalize_ratio_when_printing|set_print_tags|" +
+        "set_signal|set_state|set_tab|set_tag|set_tags|set_text_size|" +
+        "set_window_title|setgid|setgid|setitimer|setitimer|setsid|setsid|" +
+        "setsockopt|setsockopt|setsockopt_float|setsockopt_float|setsockopt_int|" +
+        "setsockopt_int|setsockopt_optint|setsockopt_optint|setuid|setuid|" +
+        "shift_left|shift_left|shift_left|shift_right|shift_right|shift_right|" +
+        "shift_right_logical|shift_right_logical|shift_right_logical|show_buckets|" +
+        "shutdown|shutdown|shutdown_connection|shutdown_connection|sigabrt|" +
+        "sigalrm|sigchld|sigcont|sigfpe|sighup|sigill|sigint|sigkill|sign_big_int|" +
+        "sign_num|signal|signal|sigpending|sigpending|sigpipe|sigprocmask|" +
+        "sigprocmask|sigprof|sigquit|sigsegv|sigstop|sigsuspend|sigsuspend|" +
+        "sigterm|sigtstp|sigttin|sigttou|sigusr1|sigusr2|sigvtalrm|sin|singleton|" +
+        "sinh|size|size|size_x|size_y|sleep|sleep|sleep|slice_left|slice_left|" +
+        "slice_left_1|slice_left_2|slice_right|slice_right|slice_right_1|" +
+        "slice_right_2|snd|socket|socket|socket|socketpair|socketpair|sort|sound|" +
+        "split|split_delim|sprintf|sprintf|sqrt|sqrt|sqrt_big_int|square_big_int|" +
+        "square_num|sscanf|stable_sort|stable_sort|stable_sort|stable_sort|stable_sort|" +
+        "stable_sort|stat|stat|stat|stat|stat|stats|stats|std_formatter|stdbuf|" +
+        "stderr|stderr|stderr|stdib|stdin|stdin|stdin|stdout|stdout|stdout|" +
+        "str_formatter|string|string_after|string_before|string_match|" +
+        "string_of_big_int|string_of_bool|string_of_float|string_of_format|" +
+        "string_of_inet_addr|string_of_inet_addr|string_of_int|string_of_num|" +
+        "string_partial_match|string_tag|sub|sub|sub_big_int|sub_left|sub_num|" +
+        "sub_right|subset|subset|substitute_first|substring|succ|succ|" +
+        "succ|succ|succ_big_int|succ_num|symbol_end|symbol_end_pos|symbol_start|" +
+        "symbol_start_pos|symlink|symlink|sync|synchronize|system|system|system|" +
+        "tag|take|tan|tanh|tcdrain|tcdrain|tcflow|tcflow|tcflush|tcflush|" +
+        "tcgetattr|tcgetattr|tcsendbreak|tcsendbreak|tcsetattr|tcsetattr|" +
+        "temp_file|text_size|time|time|time|timed_read|timed_write|times|times|" +
+        "tl|tl|tl|to_buffer|to_channel|to_float|to_hex|to_int|to_int32|to_list|" +
+        "to_list|to_list|to_nativeint|to_string|to_string|to_string|to_string|" +
+        "to_string|top|top|total_size|transfer|transp|truncate|truncate|truncate|" +
+        "truncate|truncate|truncate|try_lock|umask|umask|uncapitalize|uncapitalize|" +
+        "uncapitalize|union|union|unit_big_int|unlink|unlink|unlock|unmarshal|" +
+        "unsafe_blit|unsafe_fill|unsafe_get|unsafe_get|unsafe_set|unsafe_set|" +
+        "update|uppercase|uppercase|uppercase|uppercase|usage|utimes|utimes|wait|" +
+        "wait|wait|wait|wait_next_event|wait_pid|wait_read|wait_signal|" +
+        "wait_timed_read|wait_timed_write|wait_write|waitpid|white|" +
+        "widen|window_id|word_size|wrap|wrap_abort|write|yellow|yield|zero|zero_big_int|" +
+
+        "Arg|Arith_status|Array|Array1|Array2|Array3|ArrayLabels|Big_int|Bigarray|" +
+        "Buffer|Callback|CamlinternalOO|Char|Complex|Condition|Dbm|Digest|Dynlink|" +
+        "Event|Filename|Format|Gc|Genarray|Genlex|Graphics|GraphicsX11|Hashtbl|" +
+        "Int32|Int64|LargeFile|Lazy|Lexing|List|ListLabels|Make|Map|Marshal|" +
+        "MoreLabels|Mutex|Nativeint|Num|Obj|Oo|Parsing|Pervasives|Printexc|" +
+        "Printf|Queue|Random|Scanf|Scanning|Set|Sort|Stack|State|StdLabels|Str|" +
+        "Stream|String|StringLabels|Sys|Thread|ThreadUnix|Tk|Unix|UnixLabels|Weak"
+    );
+
+    var keywordMapper = this.createKeywordMapper({
+        "variable.language": "this",
+        "keyword": keywords,
+        "constant.language": builtinConstants,
+        "support.function": builtinFunctions
+    }, "identifier");
+
+    var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
+    var octInteger = "(?:0[oO]?[0-7]+)";
+    var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
+    var binInteger = "(?:0[bB][01]+)";
+    var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
+
+    var exponent = "(?:[eE][+-]?\\d+)";
+    var fraction = "(?:\\.\\d+)";
+    var intPart = "(?:\\d+)";
+    var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
+    var exponentFloat = "(?:(?:" + pointFloat + "|" +  intPart + ")" + exponent + ")";
+    var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
+
+    this.$rules = {
+        "start" : [
+            {
+                token : "comment",
+                regex : '\\(\\*.*?\\*\\)\\s*?$'
+            },
+            {
+                token : "comment",
+                regex : '\\(\\*.*',
+                next : "comment"
+            },
+            {
+                token : "string", // single line
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+            },
+            {
+                token : "string", // single char
+                regex : "'.'"
+            },
+            {
+                token : "string", // " string
+                regex : '"',
+                next  : "qstring"
+            },
+            {
+                token : "constant.numeric", // imaginary
+                regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
+            },
+            {
+                token : "constant.numeric", // float
+                regex : floatNumber
+            },
+            {
+                token : "constant.numeric", // integer
+                regex : integer + "\\b"
+            },
+            {
+                token : keywordMapper,
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+            },
+            {
+                token : "keyword.operator",
+                regex : "\\+\\.|\\-\\.|\\*\\.|\\/\\.|#|;;|\\+|\\-|\\*|\\*\\*\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|<-|="
+            },
+            {
+                token : "paren.lparen",
+                regex : "[[({]"
+            },
+            {
+                token : "paren.rparen",
+                regex : "[\\])}]"
+            },
+            {
+                token : "text",
+                regex : "\\s+"
+            }
+        ],
+        "comment" : [
+            {
+                token : "comment", // closing comment
+                regex : ".*?\\*\\)",
+                next : "start"
+            },
+            {
+                token : "comment", // comment spanning whole line
+                regex : ".+"
+            }
+        ],
+
+        "qstring" : [
+            {
+                token : "string",
+                regex : '"',
+                next : "start"
+            }, {
+                token : "string",
+                regex : '.+'
+            }
+        ]
+    };
+};
+
+oop.inherits(OcamlHighlightRules, TextHighlightRules);
+
+exports.OcamlHighlightRules = OcamlHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/pascal.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/pascal.js b/src/fauxton/assets/js/libs/ace/mode/pascal.js
new file mode 100644
index 0000000..cabdb0d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/pascal.js
@@ -0,0 +1,67 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ * 
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var PascalHighlightRules = require("./pascal_highlight_rules").PascalHighlightRules;
+// TODO: pick appropriate fold mode
+var FoldMode = require("./folding/coffee").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = PascalHighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+       
+    this.lineCommentStart = ["--", "//"];
+    this.blockComment = [
+        {start: "(*", end: "*)"},
+        {start: "{", end: "}"}
+    ];
+    
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/pascal_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/pascal_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/pascal_highlight_rules.js
new file mode 100644
index 0000000..ac8a418
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/pascal_highlight_rules.js
@@ -0,0 +1,127 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* THIS FILE WAS AUTOGENERATED FROM tool\tm bundles\pascal.tmbundle\Syntaxes\Pascal.plist (UUID: F42FA544-6B1C-11D9-9517-000D93589AF6) */
+/****************************************************************
+ * IT MIGHT NOT BE PERFECT, PARTICULARLY:                       *
+ * IN DECIDING STATES TO TRANSITION TO,                         *
+ * IGNORING WHITESPACE,                                         *
+ * IGNORING GROUPS WITH ?:,                                     *
+ * EXTENDING EXISTING MODES,                                    *
+ * GATHERING KEYWORDS, OR                                       *
+ * DECIDING WHEN TO USE PUSH.                                   *
+ * ...But it's a good start from an existing *.tmlanguage file. *
+ ****************************************************************/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var PascalHighlightRules = function() {
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = { start: 
+       [ { caseInsensitive: true,
+           token: 'keyword.control.pascal',
+           regex: '\\b(?:(absolute|abstract|all|and|and_then|array|as|asm|attribute|begin|bindable|case|class|const|constructor|destructor|div|do|do|else|end|except|export|exports|external|far|file|finalization|finally|for|forward|goto|if|implementation|import|in|inherited|initialization|interface|interrupt|is|label|library|mod|module|name|near|nil|not|object|of|only|operator|or|or_else|otherwise|packed|pow|private|program|property|protected|public|published|qualified|record|repeat|resident|restricted|segment|set|shl|shr|then|to|try|type|unit|until|uses|value|var|view|virtual|while|with|xor))\\b' },
+         { caseInsensitive: true,           
+           token: 
+            [ 'variable.pascal', "text",
+              'storage.type.prototype.pascal',
+              'entity.name.function.prototype.pascal' ],
+           regex: '\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?(?=(?:\\(.*?\\))?;\\s*(?:attribute|forward|external))' },
+         { caseInsensitive: true,
+           token: 
+            [ 'variable.pascal', "text",
+              'storage.type.function.pascal',
+              'entity.name.function.pascal' ],
+           regex: '\\b(function|procedure)(\\s+)(\\w+)(\\.\\w+)?' },
+         { token: 'constant.numeric.pascal',
+           regex: '\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b' },
+         { token: 'punctuation.definition.comment.pascal',
+           regex: '--.*$',
+           push_: 
+            [ { token: 'comment.line.double-dash.pascal.one',
+                regex: '$',
+                next: 'pop' },
+              { defaultToken: 'comment.line.double-dash.pascal.one' } ] },
+         { token: 'punctuation.definition.comment.pascal',
+           regex: '//.*$',
+           push_: 
+            [ { token: 'comment.line.double-slash.pascal.two',
+                regex: '$',
+                next: 'pop' },
+              { defaultToken: 'comment.line.double-slash.pascal.two' } ] },
+         { token: 'punctuation.definition.comment.pascal',
+           regex: '\\(\\*',
+           push: 
+            [ { token: 'punctuation.definition.comment.pascal',
+                regex: '\\*\\)',
+                next: 'pop' },
+              { defaultToken: 'comment.block.pascal.one' } ] },
+         { token: 'punctuation.definition.comment.pascal',
+           regex: '\\{',
+           push: 
+            [ { token: 'punctuation.definition.comment.pascal',
+                regex: '\\}',
+                next: 'pop' },
+              { defaultToken: 'comment.block.pascal.two' } ] },
+         { token: 'punctuation.definition.string.begin.pascal',
+           regex: '"',
+           push: 
+            [ { token: 'constant.character.escape.pascal', regex: '\\\\.' },
+              { token: 'punctuation.definition.string.end.pascal',
+                regex: '"',
+                next: 'pop' },
+              { defaultToken: 'string.quoted.double.pascal' } ],
+           //Double quoted strings are an extension and (generally) support C-style escape sequences.
+            },
+         { token: 'punctuation.definition.string.begin.pascal',
+           regex: '\'',
+           push: 
+            [ { token: 'constant.character.escape.apostrophe.pascal',
+                regex: '\'\'' },
+              { token: 'punctuation.definition.string.end.pascal',
+                regex: '\'',
+                next: 'pop' },
+              { defaultToken: 'string.quoted.single.pascal' } ] },
+          { token: 'keyword.operator',
+           regex: '[+\\-;,/*%]|:=|=' } ] }
+    
+    this.normalizeRules();
+};
+
+oop.inherits(PascalHighlightRules, TextHighlightRules);
+
+exports.PascalHighlightRules = PascalHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/perl.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/perl.js b/src/fauxton/assets/js/libs/ace/mode/perl.js
new file mode 100644
index 0000000..e8d930b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/perl.js
@@ -0,0 +1,90 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var PerlHighlightRules = require("./perl_highlight_rules").PerlHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var Range = require("../range").Range;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = PerlHighlightRules;
+    
+    this.$outdent = new MatchingBraceOutdent();
+    this.foldingRules = new CStyleFoldMode({start: "^=(begin|item)\\b", end: "^=(cut)\\b"});
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = "#";
+    this.blockComment = [
+        {start: "=begin", end: "=cut"},
+        {start: "=item", end: "=cut"}
+    ];
+
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+
+        if (state == "start") {
+            var match = line.match(/^.*[\{\(\[\:]\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});


[13/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/lua/luaparse.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/lua/luaparse.js b/src/fauxton/assets/js/libs/ace/mode/lua/luaparse.js
new file mode 100644
index 0000000..75efb15
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/lua/luaparse.js
@@ -0,0 +1,1989 @@
+define(function(require, exports, module) {
+/*global exports:true module:true require:true define:true global:true */
+
+(function (root, name, factory) {
+   factory(exports)
+}(this, 'luaparse', function (exports) {
+  'use strict';
+
+  exports.version = '0.1.4';
+
+  var input, options, length;
+
+  // Options can be set either globally on the parser object through
+  // defaultOptions, or during the parse call.
+  var defaultOptions = exports.defaultOptions = {
+    // Explicitly tell the parser when the input ends.
+      wait: false
+    // Store comments as an array in the chunk object.
+    , comments: true
+    // Track identifier scopes by adding an isLocal attribute to each
+    // identifier-node.
+    , scope: false
+    // Store location information on each syntax node as
+    // `loc: { start: { line, column }, end: { line, column } }`.
+    , locations: false
+    // Store the start and end character locations on each syntax node as
+    // `range: [start, end]`.
+    , ranges: false
+  };
+
+  // The available tokens expressed as enum flags so they can be checked with
+  // bitwise operations.
+
+  var EOF = 1, StringLiteral = 2, Keyword = 4, Identifier = 8
+    , NumericLiteral = 16, Punctuator = 32, BooleanLiteral = 64
+    , NilLiteral = 128, VarargLiteral = 256;
+
+  exports.tokenTypes = { EOF: EOF, StringLiteral: StringLiteral
+    , Keyword: Keyword, Identifier: Identifier, NumericLiteral: NumericLiteral
+    , Punctuator: Punctuator, BooleanLiteral: BooleanLiteral
+    , NilLiteral: NilLiteral, VarargLiteral: VarargLiteral
+  };
+
+  // As this parser is a bit different from luas own, the error messages
+  // will be different in some situations.
+
+  var errors = exports.errors = {
+      unexpected: 'Unexpected %1 \'%2\' near \'%3\''
+    , expected: '\'%1\' expected near \'%2\''
+    , expectedToken: '%1 expected near \'%2\''
+    , unfinishedString: 'unfinished string near \'%1\''
+    , malformedNumber: 'malformed number near \'%1\''
+  };
+
+  // ### Abstract Syntax Tree
+  //
+  // The default AST structure is inspired by the Mozilla Parser API but can
+  // easily be customized by overriding these functions.
+
+  var ast = exports.ast = {
+      labelStatement: function(label) {
+      return {
+          type: 'LabelStatement'
+        , label: label
+      };
+    }
+
+    , breakStatement: function() {
+      return {
+          type: 'BreakStatement'
+      };
+    }
+
+    , gotoStatement: function(label) {
+      return {
+          type: 'GotoStatement'
+        , label: label
+      };
+    }
+
+    , returnStatement: function(args) {
+      return {
+          type: 'ReturnStatement'
+        , 'arguments': args
+      };
+    }
+
+    , ifStatement: function(clauses) {
+      return {
+          type: 'IfStatement'
+        , clauses: clauses
+      };
+    }
+    , ifClause: function(condition, body) {
+      return {
+          type: 'IfClause'
+        , condition: condition
+        , body: body
+      };
+    }
+    , elseifClause: function(condition, body) {
+      return {
+          type: 'ElseifClause'
+        , condition: condition
+        , body: body
+      };
+    }
+    , elseClause: function(body) {
+      return {
+          type: 'ElseClause'
+        , body: body
+      };
+    }
+
+    , whileStatement: function(condition, body) {
+      return {
+          type: 'WhileStatement'
+        , condition: condition
+        , body: body
+      };
+    }
+
+    , doStatement: function(body) {
+      return {
+          type: 'DoStatement'
+        , body: body
+      };
+    }
+
+    , repeatStatement: function(condition, body) {
+      return {
+          type: 'RepeatStatement'
+        , condition: condition
+        , body: body
+      };
+    }
+
+    , localStatement: function(variables, init) {
+      return {
+          type: 'LocalStatement'
+        , variables: variables
+        , init: init
+      };
+    }
+
+    , assignmentStatement: function(variables, init) {
+      return {
+          type: 'AssignmentStatement'
+        , variables: variables
+        , init: init
+      };
+    }
+
+    , callStatement: function(expression) {
+      return {
+          type: 'CallStatement'
+        , expression: expression
+      };
+    }
+
+    , functionStatement: function(identifier, parameters, isLocal, body) {
+      return {
+          type: 'FunctionDeclaration'
+        , identifier: identifier
+        , isLocal: isLocal
+        , parameters: parameters
+        , body: body
+      };
+    }
+
+    , forNumericStatement: function(variable, start, end, step, body) {
+      return {
+          type: 'ForNumericStatement'
+        , variable: variable
+        , start: start
+        , end: end
+        , step: step
+        , body: body
+      };
+    }
+
+    , forGenericStatement: function(variables, iterators, body) {
+      return {
+          type: 'ForGenericStatement'
+        , variables: variables
+        , iterators: iterators
+        , body: body
+      };
+    }
+
+    , chunk: function(body) {
+      return {
+          type: 'Chunk'
+        , body: body
+      };
+    }
+
+    , identifier: function(name) {
+      return {
+          type: 'Identifier'
+        , name: name
+      };
+    }
+
+    , literal: function(type, value, raw) {
+      type = (type === StringLiteral) ? 'StringLiteral'
+        : (type === NumericLiteral) ? 'NumericLiteral'
+        : (type === BooleanLiteral) ? 'BooleanLiteral'
+        : (type === NilLiteral) ? 'NilLiteral'
+        : 'VarargLiteral';
+
+      return {
+          type: type
+        , value: value
+        , raw: raw
+      };
+    }
+
+    , tableKey: function(key, value) {
+      return {
+          type: 'TableKey'
+        , key: key
+        , value: value
+      };
+    }
+    , tableKeyString: function(key, value) {
+      return {
+          type: 'TableKeyString'
+        , key: key
+        , value: value
+      };
+    }
+    , tableValue: function(value) {
+      return {
+          type: 'TableValue'
+        , value: value
+      };
+    }
+
+
+    , tableConstructorExpression: function(fields) {
+      return {
+          type: 'TableConstructorExpression'
+        , fields: fields
+      };
+    }
+    , binaryExpression: function(operator, left, right) {
+      var type = ('and' === operator || 'or' === operator) ?
+        'LogicalExpression' :
+        'BinaryExpression';
+
+      return {
+          type: type
+        , operator: operator
+        , left: left
+        , right: right
+      };
+    }
+    , unaryExpression: function(operator, argument) {
+      return {
+          type: 'UnaryExpression'
+        , operator: operator
+        , argument: argument
+      };
+    }
+    , memberExpression: function(base, indexer, identifier) {
+      return {
+          type: 'MemberExpression'
+        , indexer: indexer
+        , identifier: identifier
+        , base: base
+      };
+    }
+
+    , indexExpression: function(base, index) {
+      return {
+          type: 'IndexExpression'
+        , base: base
+        , index: index
+      };
+    }
+
+    , callExpression: function(base, args) {
+      return {
+          type: 'CallExpression'
+        , base: base
+        , 'arguments': args
+      };
+    }
+
+    , tableCallExpression: function(base, args) {
+      return {
+          type: 'TableCallExpression'
+        , base: base
+        , 'arguments': args
+      };
+    }
+
+    , stringCallExpression: function(base, argument) {
+      return {
+          type: 'StringCallExpression'
+        , base: base
+        , argument: argument
+      };
+    }
+
+    , comment: function(value, raw) {
+      return {
+          type: 'Comment'
+        , value: value
+        , raw: raw
+      };
+    }
+  };
+
+  // Wrap up the node object.
+
+  function finishNode(node) {
+    // Pop a `Marker` off the location-array and attach its location data.
+    if (trackLocations) {
+      var location = locations.pop();
+      location.complete();
+      if (options.locations) node.loc = location.loc;
+      if (options.ranges) node.range = location.range;
+    }
+    return node;
+  }
+
+
+
+  // Helpers
+  // -------
+
+  var slice = Array.prototype.slice
+    , toString = Object.prototype.toString
+    , indexOf = function indexOf(array, element) {
+      for (var i = 0, length = array.length; i < length; i++) {
+        if (array[i] === element) return i;
+      }
+      return -1;
+    };
+
+  // Iterate through an array of objects and return the index of an object
+  // with a matching property.
+
+  function indexOfObject(array, property, element) {
+    for (var i = 0, length = array.length; i < length; i++) {
+      if (array[i][property] === element) return i;
+    }
+    return -1;
+  }
+
+  // A sprintf implementation using %index (beginning at 1) to input
+  // arguments in the format string.
+  //
+  // Example:
+  //
+  //     // Unexpected function in token
+  //     sprintf('Unexpected %2 in %1.', 'token', 'function');
+
+  function sprintf(format) {
+    var args = slice.call(arguments, 1);
+    format = format.replace(/%(\d)/g, function (match, index) {
+      return '' + args[index - 1] || '';
+    });
+    return format;
+  }
+
+  // Returns a new object with the properties from all objectes passed as
+  // arguments. Last argument takes precedence.
+  //
+  // Example:
+  //
+  //     this.options = extend(options, { output: false });
+
+  function extend() {
+    var args = slice.call(arguments)
+      , dest = {}
+      , src, prop;
+
+    for (var i = 0, length = args.length; i < length; i++) {
+      src = args[i];
+      for (prop in src) if (src.hasOwnProperty(prop)) {
+        dest[prop] = src[prop];
+      }
+    }
+    return dest;
+  }
+
+  // ### Error functions
+
+  // #### Raise an exception.
+  //
+  // Raise an exception by passing a token, a string format and its paramters.
+  //
+  // The passed tokens location will automatically be added to the error
+  // message if it exists, if not it will default to the lexers current
+  // position.
+  //
+  // Example:
+  //
+  //     // [1:0] expected [ near (
+  //     raise(token, "expected %1 near %2", '[', token.value);
+
+  function raise(token) {
+    var message = sprintf.apply(null, slice.call(arguments, 1))
+      , error, col;
+
+    if ('undefined' !== typeof token.line) {
+      col = token.range[0] - token.lineStart;
+      error = new SyntaxError(sprintf('[%1:%2] %3', token.line, col, message));
+      error.line = token.line;
+      error.index = token.range[0];
+      error.column = col;
+    } else {
+      col = index - lineStart + 1;
+      error = new SyntaxError(sprintf('[%1:%2] %3', line, col, message));
+      error.index = index;
+      error.line = line;
+      error.column = col;
+    }
+    throw error;
+  }
+
+  // #### Raise an unexpected token error.
+  //
+  // Example:
+  //
+  //     // expected <name> near '0'
+  //     raiseUnexpectedToken('<name>', token);
+
+  function raiseUnexpectedToken(type, token) {
+    raise(token, errors.expectedToken, type, token.value);
+  }
+
+  // #### Raise a general unexpected error
+  //
+  // Usage should pass either a token object or a symbol string which was
+  // expected. We can also specify a nearby token such as <eof>, this will
+  // default to the currently active token.
+  //
+  // Example:
+  //
+  //     // Unexpected symbol 'end' near '<eof>'
+  //     unexpected(token);
+  //
+  // If there's no token in the buffer it means we have reached <eof>.
+
+  function unexpected(found, near) {
+    if ('undefined' === typeof near) near = lookahead.value;
+    if ('undefined' !== typeof found.type) {
+      var type;
+      switch (found.type) {
+        case StringLiteral:   type = 'string';      break;
+        case Keyword:         type = 'keyword';     break;
+        case Identifier:      type = 'identifier';  break;
+        case NumericLiteral:  type = 'number';      break;
+        case Punctuator:      type = 'symbol';      break;
+        case BooleanLiteral:  type = 'boolean';     break;
+        case NilLiteral:
+          return raise(found, errors.unexpected, 'symbol', 'nil', near);
+      }
+      return raise(found, errors.unexpected, type, found.value, near);
+    }
+    return raise(found, errors.unexpected, 'symbol', found, near);
+  }
+
+  // Lexer
+  // -----
+  //
+  // The lexer, or the tokenizer reads the input string character by character
+  // and derives a token left-right. To be as efficient as possible the lexer
+  // prioritizes the common cases such as identifiers. It also works with
+  // character codes instead of characters as string comparisons was the
+  // biggest bottleneck of the parser.
+  //
+  // If `options.comments` is enabled, all comments encountered will be stored
+  // in an array which later will be appended to the chunk object. If disabled,
+  // they will simply be disregarded.
+  //
+  // When the lexer has derived a valid token, it will be returned as an object
+  // containing its value and as well as its position in the input string (this
+  // is always enabled to provide proper debug messages).
+  //
+  // `lex()` starts lexing and returns the following token in the stream.
+
+  var index
+    , token
+    , previousToken
+    , lookahead
+    , comments
+    , tokenStart
+    , line
+    , lineStart;
+
+  exports.lex = lex;
+
+  function lex() {
+    skipWhiteSpace();
+
+    // Skip comments beginning with --
+    while (45 === input.charCodeAt(index) &&
+           45 === input.charCodeAt(index + 1)) {
+      scanComment();
+      skipWhiteSpace();
+    }
+    if (index >= length) return {
+        type : EOF
+      , value: '<eof>'
+      , line: line
+      , lineStart: lineStart
+      , range: [index, index]
+    };
+
+    var charCode = input.charCodeAt(index)
+      , next = input.charCodeAt(index + 1);
+
+    // Memorize the range index where the token begins.
+    tokenStart = index;
+    if (isIdentifierStart(charCode)) return scanIdentifierOrKeyword();
+
+    switch (charCode) {
+      case 39: case 34: // '"
+        return scanStringLiteral();
+
+      // 0-9
+      case 48: case 49: case 50: case 51: case 52: case 53:
+      case 54: case 55: case 56: case 57:
+        return scanNumericLiteral();
+
+      case 46: // .
+        // If the dot is followed by a digit it's a float.
+        if (isDecDigit(next)) return scanNumericLiteral();
+        if (46 === next) {
+          if (46 === input.charCodeAt(index + 2)) return scanVarargLiteral();
+          return scanPunctuator('..');
+        }
+        return scanPunctuator('.');
+
+      case 61: // =
+        if (61 === next) return scanPunctuator('==');
+        return scanPunctuator('=');
+
+      case 62: // >
+        if (61 === next) return scanPunctuator('>=');
+        return scanPunctuator('>');
+
+      case 60: // <
+        if (61 === next) return scanPunctuator('<=');
+        return scanPunctuator('<');
+
+      case 126: // ~
+        if (61 === next) return scanPunctuator('~=');
+        return raise({}, errors.expected, '=', '~');
+
+      case 58: // :
+        if (58 === next) return scanPunctuator('::');
+        return scanPunctuator(':');
+
+      case 91: // [
+        // Check for a multiline string, they begin with [= or [[
+        if (91 === next || 61 === next) return scanLongStringLiteral();
+        return scanPunctuator('[');
+
+      // \* / ^ % , { } ] ( ) ; # - +
+      case 42: case 47: case 94: case 37: case 44: case 123: case 125:
+      case 93: case 40: case 41: case 59: case 35: case 45: case 43:
+        return scanPunctuator(input.charAt(index));
+    }
+
+    return unexpected(input.charAt(index));
+  }
+
+  // Whitespace has no semantic meaning in lua so simply skip ahead while
+  // tracking the encounted newlines. Newlines are also tracked in all
+  // token functions where multiline values are allowed.
+
+  function skipWhiteSpace() {
+    while (index < length) {
+      var charCode = input.charCodeAt(index);
+      if (isWhiteSpace(charCode)) {
+        index++;
+      } else if (isLineTerminator(charCode)) {
+        line++;
+        lineStart = ++index;
+      } else {
+        break;
+      }
+    }
+  }
+
+  // Identifiers, keywords, booleans and nil all look the same syntax wise. We
+  // simply go through them one by one and defaulting to an identifier if no
+  // previous case matched.
+
+  function scanIdentifierOrKeyword() {
+    var value, type;
+
+    // Slicing the input string is prefered before string concatenation in a
+    // loop for performance reasons.
+    while (isIdentifierPart(input.charCodeAt(++index)));
+    value = input.slice(tokenStart, index);
+
+    // Decide on the token type and possibly cast the value.
+    if (isKeyword(value)) {
+      type = Keyword;
+    } else if ('true' === value || 'false' === value) {
+      type = BooleanLiteral;
+      value = ('true' === value);
+    } else if ('nil' === value) {
+      type = NilLiteral;
+      value = null;
+    } else {
+      type = Identifier;
+    }
+
+    return {
+        type: type
+      , value: value
+      , line: line
+      , lineStart: lineStart
+      , range: [tokenStart, index]
+    };
+  }
+
+  // Once a punctuator reaches this function it should already have been
+  // validated so we simply return it as a token.
+
+  function scanPunctuator(value) {
+    index += value.length;
+    return {
+        type: Punctuator
+      , value: value
+      , line: line
+      , lineStart: lineStart
+      , range: [tokenStart, index]
+    };
+  }
+
+  // A vararg literal consists of three dots.
+
+  function scanVarargLiteral() {
+    index += 3;
+    return {
+        type: VarargLiteral
+      , value: '...'
+      , line: line
+      , lineStart: lineStart
+      , range: [tokenStart, index]
+    };
+  }
+
+  // Find the string literal by matching the delimiter marks used.
+
+  function scanStringLiteral() {
+    var delimiter = input.charCodeAt(index++)
+      , stringStart = index
+      , string = ''
+      , charCode;
+
+    while (index < length) {
+      charCode = input.charCodeAt(index++);
+      if (delimiter === charCode) break;
+      if (92 === charCode) { // \
+        string += input.slice(stringStart, index - 1) + readEscapeSequence();
+        stringStart = index;
+      }
+      // EOF or `\n` terminates a string literal. If we haven't found the
+      // ending delimiter by now, raise an exception.
+      else if (index >= length || isLineTerminator(charCode)) {
+        string += input.slice(stringStart, index - 1);
+        raise({}, errors.unfinishedString, string + String.fromCharCode(charCode));
+      }
+    }
+    string += input.slice(stringStart, index - 1);
+
+    return {
+        type: StringLiteral
+      , value: string
+      , line: line
+      , lineStart: lineStart
+      , range: [tokenStart, index]
+    };
+  }
+
+  // Expect a multiline string literal and return it as a regular string
+  // literal, if it doesn't validate into a valid multiline string, throw an
+  // exception.
+
+  function scanLongStringLiteral() {
+    var string = readLongString();
+    // Fail if it's not a multiline literal.
+    if (false === string) raise(token, errors.expected, '[', token.value);
+
+    return {
+        type: StringLiteral
+      , value: string
+      , line: line
+      , lineStart: lineStart
+      , range: [tokenStart, index]
+    };
+  }
+
+  // Numeric literals will be returned as floating-point numbers instead of
+  // strings. The raw value should be retrieved from slicing the input string
+  // later on in the process.
+  //
+  // If a hexadecimal number is encountered, it will be converted.
+
+  function scanNumericLiteral() {
+    var character = input.charAt(index)
+      , next = input.charAt(index + 1);
+
+    var value = ('0' === character && 'xX'.indexOf(next || null) >= 0) ?
+      readHexLiteral() : readDecLiteral();
+
+    return {
+        type: NumericLiteral
+      , value: value
+      , line: line
+      , lineStart: lineStart
+      , range: [tokenStart, index]
+    };
+  }
+
+  // Lua hexadecimals have an optional fraction part and an optional binary
+  // exoponent part. These are not included in JavaScript so we will compute
+  // all three parts separately and then sum them up at the end of the function
+  // with the following algorithm.
+  //
+  //     Digit := toDec(digit)
+  //     Fraction := toDec(fraction) / 16 ^ fractionCount
+  //     BinaryExp := 2 ^ binaryExp
+  //     Number := ( Digit + Fraction ) * BinaryExp
+
+  function readHexLiteral() {
+    var fraction = 0 // defaults to 0 as it gets summed
+      , binaryExponent = 1 // defaults to 1 as it gets multiplied
+      , binarySign = 1 // positive
+      , digit, fractionStart, exponentStart, digitStart;
+
+    digitStart = index += 2; // Skip 0x part
+
+    // A minimum of one hex digit is required.
+    if (!isHexDigit(input.charCodeAt(index)))
+      raise({}, errors.malformedNumber, input.slice(tokenStart, index));
+
+    while (isHexDigit(input.charCodeAt(index))) index++;
+    // Convert the hexadecimal digit to base 10.
+    digit = parseInt(input.slice(digitStart, index), 16);
+
+    // Fraction part i optional.
+    if ('.' === input.charAt(index)) {
+      fractionStart = ++index;
+
+      while (isHexDigit(input.charCodeAt(index))) index++;
+      fraction = input.slice(fractionStart, index);
+
+      // Empty fraction parts should default to 0, others should be converted
+      // 0.x form so we can use summation at the end.
+      fraction = (fractionStart === index) ? 0
+        : parseInt(fraction, 16) / Math.pow(16, index - fractionStart);
+    }
+
+    // Binary exponents are optional
+    if ('pP'.indexOf(input.charAt(index) || null) >= 0) {
+      index++;
+
+      // Sign part is optional and defaults to 1 (positive).
+      if ('+-'.indexOf(input.charAt(index) || null) >= 0)
+        binarySign = ('+' === input.charAt(index++)) ? 1 : -1;
+
+      exponentStart = index;
+
+      // The binary exponent sign requires a decimal digit.
+      if (!isDecDigit(input.charCodeAt(index)))
+        raise({}, errors.malformedNumber, input.slice(tokenStart, index));
+
+      while (isDecDigit(input.charCodeAt(index))) index++;
+      binaryExponent = input.slice(exponentStart, index);
+
+      // Calculate the binary exponent of the number.
+      binaryExponent = Math.pow(2, binaryExponent * binarySign);
+    }
+
+    return (digit + fraction) * binaryExponent;
+  }
+
+  // Decimal numbers are exactly the same in Lua and in JavaScript, because of
+  // this we check where the token ends and then parse it with native
+  // functions.
+
+  function readDecLiteral() {
+    while (isDecDigit(input.charCodeAt(index))) index++;
+    // Fraction part is optional
+    if ('.' === input.charAt(index)) {
+      index++;
+      // Fraction part defaults to 0
+      while (isDecDigit(input.charCodeAt(index))) index++;
+    }
+    // Exponent part is optional.
+    if ('eE'.indexOf(input.charAt(index) || null) >= 0) {
+      index++;
+      // Sign part is optional.
+      if ('+-'.indexOf(input.charAt(index) || null) >= 0) index++;
+      // An exponent is required to contain at least one decimal digit.
+      if (!isDecDigit(input.charCodeAt(index)))
+        raise({}, errors.malformedNumber, input.slice(tokenStart, index));
+
+      while (isDecDigit(input.charCodeAt(index))) index++;
+    }
+
+    return parseFloat(input.slice(tokenStart, index));
+  }
+
+
+  // Translate escape sequences to the actual characters.
+
+  function readEscapeSequence() {
+    var sequenceStart = index;
+    switch (input.charAt(index)) {
+      // Lua allow the following escape sequences.
+      // We don't escape the bell sequence.
+      case 'n': index++; return '\n';
+      case 'r': index++; return '\r';
+      case 't': index++; return '\t';
+      case 'v': index++; return '\x0B';
+      case 'b': index++; return '\b';
+      case 'f': index++; return '\f';
+      // Skips the following span of white-space.
+      case 'z': index++; skipWhiteSpace(); return '';
+      // Byte representation should for now be returned as is.
+      case 'x':
+        // \xXX, where XX is a sequence of exactly two hexadecimal digits
+        if (isHexDigit(input.charCodeAt(index + 1)) &&
+            isHexDigit(input.charCodeAt(index + 2))) {
+          index += 3;
+          // Return it as is, without translating the byte.
+          return '\\' + input.slice(sequenceStart, index);
+        }
+        return '\\' + input.charAt(index++);
+      default:
+        // \ddd, where ddd is a sequence of up to three decimal digits.
+        if (isDecDigit(input.charCodeAt(index))) {
+          while (isDecDigit(input.charCodeAt(++index)));
+          return '\\' + input.slice(sequenceStart, index);
+        }
+        // Simply return the \ as is, it's not escaping any sequence.
+        return input.charAt(index++);
+    }
+  }
+
+  // Comments begin with -- after which it will be decided if they are
+  // multiline comments or not.
+  //
+  // The multiline functionality works the exact same way as with string
+  // literals so we reuse the functionality.
+
+  function scanComment() {
+    tokenStart = index;
+    index += 2; // --
+
+    var character = input.charAt(index)
+      , content = ''
+      , isLong = false
+      , commentStart = index
+      , lineStartComment = lineStart
+      , lineComment = line;
+
+    if ('[' === character) {
+      content = readLongString();
+      // This wasn't a multiline comment after all.
+      if (false === content) content = character;
+      else isLong = true;
+    }
+    // Scan until next line as long as it's not a multiline comment.
+    if (!isLong) {
+      while (index < length) {
+        if (isLineTerminator(input.charCodeAt(index))) break;
+        index++;
+      }
+      if (options.comments) content = input.slice(commentStart, index);
+    }
+
+    if (options.comments) {
+      var node = ast.comment(content, input.slice(tokenStart, index));
+
+      // `Marker`s depend on tokens available in the parser and as comments are
+      // intercepted in the lexer all location data is set manually.
+      if (options.locations) {
+        node.loc = {
+            start: { line: lineComment, column: tokenStart - lineStartComment }
+          , end: { line: line, column: index - lineStart }
+        };
+      }
+      if (options.ranges) {
+        node.range = [tokenStart, index];
+      }
+      comments.push(node);
+    }
+  }
+
+  // Read a multiline string by calculating the depth of `=` characters and
+  // then appending until an equal depth is found.
+
+  function readLongString() {
+    var level = 0
+      , content = ''
+      , terminator = false
+      , character, stringStart;
+
+    index++; // [
+
+    // Calculate the depth of the comment.
+    while ('=' === input.charAt(index + level)) level++;
+    // Exit, this is not a long string afterall.
+    if ('[' !== input.charAt(index + level)) return false;
+
+    index += level + 1;
+
+    // If the first character is a newline, ignore it and begin on next line.
+    if (isLineTerminator(input.charCodeAt(index))) {
+      line++;
+      lineStart = index++;
+    }
+
+    stringStart = index;
+    while (index < length) {
+      character = input.charAt(index++);
+
+      // We have to keep track of newlines as `skipWhiteSpace()` does not get
+      // to scan this part.
+      if (isLineTerminator(character.charCodeAt(0))) {
+        line++;
+        lineStart = index;
+      }
+
+      // Once the delimiter is found, iterate through the depth count and see
+      // if it matches.
+      if (']' === character) {
+        terminator = true;
+        for (var i = 0; i < level; i++) {
+          if ('=' !== input.charAt(index + i)) terminator = false;
+        }
+        if (']' !== input.charAt(index + level)) terminator = false;
+      }
+
+      // We reached the end of the multiline string. Get out now.
+      if (terminator) break;
+    }
+    content += input.slice(stringStart, index - 1);
+    index += level + 1;
+
+    return content;
+  }
+
+  // ## Lex functions and helpers.
+
+  // Read the next token.
+  //
+  // This is actually done by setting the current token to the lookahead and
+  // reading in the new lookahead token.
+
+  function next() {
+    previousToken = token;
+    token = lookahead;
+    lookahead = lex();
+  }
+
+  // Consume a token if its value matches. Once consumed or not, return the
+  // success of the operation.
+
+  function consume(value) {
+    if (value === token.value) {
+      next();
+      return true;
+    }
+    return false;
+  }
+
+  // Expect the next token value to match. If not, throw an exception.
+
+  function expect(value) {
+    if (value === token.value) next();
+    else raise(token, errors.expected, value, token.value);
+  }
+
+  // ### Validation functions
+
+  function isWhiteSpace(charCode) {
+    return 9 === charCode || 32 === charCode || 0xB === charCode || 0xC === charCode;
+  }
+
+  function isLineTerminator(charCode) {
+    return 10 === charCode || 13 === charCode;
+  }
+
+  function isDecDigit(charCode) {
+    return charCode >= 48 && charCode <= 57;
+  }
+
+  function isHexDigit(charCode) {
+    return (charCode >= 48 && charCode <= 57) || (charCode >= 97 && charCode <= 102) || (charCode >= 65 && charCode <= 70);
+  }
+
+  // From [Lua 5.2](http://www.lua.org/manual/5.2/manual.html#8.1) onwards
+  // identifiers cannot use locale-dependet letters.
+
+  function isIdentifierStart(charCode) {
+    return (charCode >= 65 && charCode <= 90) || (charCode >= 97 && charCode <= 122) || 95 === charCode;
+  }
+
+  function isIdentifierPart(charCode) {
+    return (charCode >= 65 && charCode <= 90) || (charCode >= 97 && charCode <= 122) || 95 === charCode || (charCode >= 48 && charCode <= 57);
+  }
+
+  // [3.1 Lexical Conventions](http://www.lua.org/manual/5.2/manual.html#3.1)
+  //
+  // `true`, `false` and `nil` will not be considered keywords, but literals.
+
+  function isKeyword(id) {
+    switch (id.length) {
+      case 2:
+        return 'do' === id || 'if' === id || 'in' === id || 'or' === id;
+      case 3:
+        return 'and' === id || 'end' === id || 'for' === id || 'not' === id;
+      case 4:
+        return 'else' === id || 'goto' === id || 'then' === id;
+      case 5:
+        return 'break' === id || 'local' === id || 'until' === id || 'while' === id;
+      case 6:
+        return 'elseif' === id || 'repeat' === id || 'return' === id;
+      case 8:
+        return 'function' === id;
+    }
+    return false;
+  }
+
+  function isUnary(token) {
+    if (Punctuator === token.type) return '#-'.indexOf(token.value) >= 0;
+    if (Keyword === token.type) return 'not' === token.value;
+    return false;
+  }
+
+  // @TODO this needs to be rethought.
+  function isCallExpression(expression) {
+    switch (expression.type) {
+      case 'CallExpression':
+      case 'TableCallExpression':
+      case 'StringCallExpression':
+        return true;
+    }
+    return false;
+  }
+
+  // Check if the token syntactically closes a block.
+
+  function isBlockFollow(token) {
+    if (EOF === token.type) return true;
+    if (Keyword !== token.type) return false;
+    switch (token.value) {
+      case 'else': case 'elseif':
+      case 'end': case 'until':
+        return true;
+      default:
+        return false;
+    }
+  }
+
+  // Scope
+  // -----
+
+  // Store each block scope as a an array of identifier names. Each scope is
+  // stored in an FILO-array.
+  var scopes
+    // The current scope index
+    , scopeDepth
+    // A list of all global identifier nodes.
+    , globals;
+
+  // Create a new scope inheriting all declarations from the previous scope.
+  function createScope() {
+    scopes.push(Array.apply(null, scopes[scopeDepth++]));
+  }
+
+  // Exit and remove the current scope.
+  function exitScope() {
+    scopes.pop();
+    scopeDepth--;
+  }
+
+  // Add identifier name to the current scope if it doesnt already exist.
+  function scopeIdentifierName(name) {
+    if (-1 !== indexOf(scopes[scopeDepth], name)) return;
+    scopes[scopeDepth].push(name);
+  }
+
+  // Add identifier to the current scope
+  function scopeIdentifier(node) {
+    scopeIdentifierName(node.name);
+    attachScope(node, true);
+  }
+
+  // Attach scope information to node. If the node is global, store it in the
+  // globals array so we can return the information to the user.
+  function attachScope(node, isLocal) {
+    if (!isLocal && -1 === indexOfObject(globals, 'name', node.name))
+      globals.push(node);
+
+    node.isLocal = isLocal;
+  }
+
+  // Is the identifier name available in this scope.
+  function scopeHasName(name) {
+    return (-1 !== indexOf(scopes[scopeDepth], name));
+  }
+
+  // Location tracking
+  // -----------------
+  //
+  // Locations are stored in FILO-array as a `Marker` object consisting of both
+  // `loc` and `range` data. Once a `Marker` is popped off the list an end
+  // location is added and the data is attached to a syntax node.
+
+  var locations = []
+    , trackLocations;
+
+  function createLocationMarker() {
+    return new Marker(token);
+  }
+
+  function Marker(token) {
+    if (options.locations) {
+      this.loc = {
+          start: {
+            line: token.line
+          , column: token.range[0] - token.lineStart
+        }
+        , end: {
+            line: 0
+          , column: 0
+        }
+      };
+    }
+    if (options.ranges) this.range = [token.range[0], 0];
+  }
+
+  // Complete the location data stored in the `Marker` by adding the location
+  // of the *previous token* as an end location.
+  Marker.prototype.complete = function() {
+    if (options.locations) {
+      this.loc.end.line = previousToken.line;
+      this.loc.end.column = previousToken.range[1] - previousToken.lineStart;
+    }
+    if (options.ranges) {
+      this.range[1] = previousToken.range[1];
+    }
+  };
+
+  // Create a new `Marker` and add it to the FILO-array.
+  function markLocation() {
+    if (trackLocations) locations.push(createLocationMarker());
+  }
+
+  // Push an arbitrary `Marker` object onto the FILO-array.
+  function pushLocation(marker) {
+    if (trackLocations) locations.push(marker);
+  }
+
+  // Parse functions
+  // ---------------
+
+  // Chunk is the main program object. Syntactically it's the same as a block.
+  //
+  //     chunk ::= block
+
+  function parseChunk() {
+    next();
+    markLocation();
+    var body = parseBlock();
+    if (EOF !== token.type) unexpected(token);
+    // If the body is empty no previousToken exists when finishNode runs.
+    if (trackLocations && !body.length) previousToken = token;
+    return finishNode(ast.chunk(body));
+  }
+
+  // A block contains a list of statements with an optional return statement
+  // as its last statement.
+  //
+  //     block ::= {stat} [retstat]
+
+  function parseBlock(terminator) {
+    var block = []
+      , statement;
+
+    // Each block creates a new scope.
+    if (options.scope) createScope();
+
+    while (!isBlockFollow(token)) {
+      // Return has to be the last statement in a block.
+      if ('return' === token.value) {
+        block.push(parseStatement());
+        break;
+      }
+      statement = parseStatement();
+      // Statements are only added if they are returned, this allows us to
+      // ignore some statements, such as EmptyStatement.
+      if (statement) block.push(statement);
+    }
+
+    if (options.scope) exitScope();
+    // Doesn't really need an ast node
+    return block;
+  }
+
+  // There are two types of statements, simple and compound.
+  //
+  //     statement ::= break | goto | do | while | repeat | return
+  //          | if | for | function | local | label | assignment
+  //          | functioncall | ';'
+
+  function parseStatement() {
+    markLocation();
+    if (Keyword === token.type) {
+      switch (token.value) {
+        case 'local':    next(); return parseLocalStatement();
+        case 'if':       next(); return parseIfStatement();
+        case 'return':   next(); return parseReturnStatement();
+        case 'function': next();
+          var name = parseFunctionName();
+          return parseFunctionDeclaration(name);
+        case 'while':    next(); return parseWhileStatement();
+        case 'for':      next(); return parseForStatement();
+        case 'repeat':   next(); return parseRepeatStatement();
+        case 'break':    next(); return parseBreakStatement();
+        case 'do':       next(); return parseDoStatement();
+        case 'goto':     next(); return parseGotoStatement();
+      }
+    }
+
+    if (Punctuator === token.type) {
+      if (consume('::')) return parseLabelStatement();
+    }
+    // Assignments memorizes the location and pushes it manually for wrapper
+    // nodes. Additionally empty `;` statements should not mark a location.
+    if (trackLocations) locations.pop();
+
+    // When a `;` is encounted, simply eat it without storing it.
+    if (consume(';')) return;
+
+    return parseAssignmentOrCallStatement();
+  }
+
+  // ## Statements
+
+  //     label ::= '::' Name '::'
+
+  function parseLabelStatement() {
+    var name = token.value
+      , label = parseIdentifier();
+
+    if (options.scope) {
+      scopeIdentifierName('::' + name + '::');
+      attachScope(label, true);
+    }
+
+    expect('::');
+    return finishNode(ast.labelStatement(label));
+  }
+
+  //     break ::= 'break'
+
+  function parseBreakStatement() {
+    return finishNode(ast.breakStatement());
+  }
+
+  //     goto ::= 'goto' Name
+
+  function parseGotoStatement() {
+    var name = token.value
+      , label = parseIdentifier();
+
+    if (options.scope) label.isLabel = scopeHasName('::' + name + '::');
+    return finishNode(ast.gotoStatement(label));
+  }
+
+  //     do ::= 'do' block 'end'
+
+  function parseDoStatement() {
+    var body = parseBlock();
+    expect('end');
+    return finishNode(ast.doStatement(body));
+  }
+
+  //     while ::= 'while' exp 'do' block 'end'
+
+  function parseWhileStatement() {
+    var condition = parseExpectedExpression();
+    expect('do');
+    var body = parseBlock();
+    expect('end');
+    return finishNode(ast.whileStatement(condition, body));
+  }
+
+  //     repeat ::= 'repeat' block 'until' exp
+
+  function parseRepeatStatement() {
+    var body = parseBlock();
+    expect('until');
+    var condition = parseExpectedExpression();
+    return finishNode(ast.repeatStatement(condition, body));
+  }
+
+  //     retstat ::= 'return' [exp {',' exp}] [';']
+
+  function parseReturnStatement() {
+    var expressions = [];
+
+    if ('end' !== token.value) {
+      var expression = parseExpression();
+      if (null != expression) expressions.push(expression);
+      while (consume(',')) {
+        expression = parseExpectedExpression();
+        expressions.push(expression);
+      }
+      consume(';'); // grammar tells us ; is optional here.
+    }
+    return finishNode(ast.returnStatement(expressions));
+  }
+
+  //     if ::= 'if' exp 'then' block {elif} ['else' block] 'end'
+  //     elif ::= 'elseif' exp 'then' block
+
+  function parseIfStatement() {
+    var clauses = []
+      , condition
+      , body
+      , marker;
+
+    // IfClauses begin at the same location as the parent IfStatement.
+    // It ends at the start of `end`, `else`, or `elseif`.
+    if (trackLocations) {
+      marker = locations[locations.length - 1];
+      locations.push(marker);
+    }
+    condition = parseExpectedExpression();
+    expect('then');
+    body = parseBlock();
+    clauses.push(finishNode(ast.ifClause(condition, body)));
+
+    if (trackLocations) marker = createLocationMarker();
+    while (consume('elseif')) {
+      pushLocation(marker);
+      condition = parseExpectedExpression();
+      expect('then');
+      body = parseBlock();
+      clauses.push(finishNode(ast.elseifClause(condition, body)));
+      if (trackLocations) marker = createLocationMarker();
+    }
+
+    if (consume('else')) {
+      // Include the `else` in the location of ElseClause.
+      if (trackLocations) {
+        marker = new Marker(previousToken);
+        locations.push(marker);
+      }
+      body = parseBlock();
+      clauses.push(finishNode(ast.elseClause(body)));
+    }
+
+    expect('end');
+    return finishNode(ast.ifStatement(clauses));
+  }
+
+  // There are two types of for statements, generic and numeric.
+  //
+  //     for ::= Name '=' exp ',' exp [',' exp] 'do' block 'end'
+  //     for ::= namelist 'in' explist 'do' block 'end'
+  //     namelist ::= Name {',' Name}
+  //     explist ::= exp {',' exp}
+
+  function parseForStatement() {
+    var variable = parseIdentifier()
+      , body;
+
+    // The start-identifier is local.
+    if (options.scope) scopeIdentifier(variable);
+
+    // If the first expression is followed by a `=` punctuator, this is a
+    // Numeric For Statement.
+    if (consume('=')) {
+      // Start expression
+      var start = parseExpectedExpression();
+      expect(',');
+      // End expression
+      var end = parseExpectedExpression();
+      // Optional step expression
+      var step = consume(',') ? parseExpectedExpression() : null;
+
+      expect('do');
+      body = parseBlock();
+      expect('end');
+
+      return finishNode(ast.forNumericStatement(variable, start, end, step, body));
+    }
+    // If not, it's a Generic For Statement
+    else {
+      // The namelist can contain one or more identifiers.
+      var variables = [variable];
+      while (consume(',')) {
+        variable = parseIdentifier();
+        // Each variable in the namelist is locally scoped.
+        if (options.scope) scopeIdentifier(variable);
+        variables.push(variable);
+      }
+      expect('in');
+      var iterators = [];
+
+      // One or more expressions in the explist.
+      do {
+        var expression = parseExpectedExpression();
+        iterators.push(expression);
+      } while (consume(','));
+
+      expect('do');
+      body = parseBlock();
+      expect('end');
+
+      return finishNode(ast.forGenericStatement(variables, iterators, body));
+    }
+  }
+
+  // Local statements can either be variable assignments or function
+  // definitions. If a function definition is found, it will be delegated to
+  // `parseFunctionDeclaration()` with the isLocal flag.
+  //
+  // This AST structure might change into a local assignment with a function
+  // child.
+  //
+  //     local ::= 'local' 'function' Name funcdecl
+  //        | 'local' Name {',' Name} ['=' exp {',' exp}
+
+  function parseLocalStatement() {
+    var name;
+
+    if (Identifier === token.type) {
+      var variables = []
+        , init = [];
+
+      do {
+        name = parseIdentifier();
+
+        variables.push(name);
+      } while (consume(','));
+
+      if (consume('=')) {
+        do {
+          var expression = parseExpectedExpression();
+          init.push(expression);
+        } while (consume(','));
+      }
+
+      // Declarations doesn't exist before the statement has been evaluated.
+      // Therefore assignments can't use their declarator. And the identifiers
+      // shouldn't be added to the scope until the statement is complete.
+      if (options.scope) {
+        for (var i = 0, l = variables.length; i < l; i++) {
+          scopeIdentifier(variables[i]);
+        }
+      }
+
+      return finishNode(ast.localStatement(variables, init));
+    }
+    if (consume('function')) {
+      name = parseIdentifier();
+      if (options.scope) scopeIdentifier(name);
+
+      // MemberExpressions are not allowed in local function statements.
+      return parseFunctionDeclaration(name, true);
+    } else {
+      raiseUnexpectedToken('<name>', token);
+    }
+  }
+
+  //     assignment ::= varlist '=' explist
+  //     varlist ::= prefixexp {',' prefixexp}
+  //     explist ::= exp {',' exp}
+  //
+  //     call ::= callexp
+  //     callexp ::= prefixexp args | prefixexp ':' Name args
+
+  function parseAssignmentOrCallStatement() {
+    // Keep a reference to the previous token for better error messages in case
+    // of invalid statement
+    var previous = token
+      , expression, marker;
+
+    if (trackLocations) marker = createLocationMarker();
+    expression = parsePrefixExpression();
+
+    if (null == expression) return unexpected(token);
+    if (',='.indexOf(token.value) >= 0) {
+      var variables = [expression]
+        , init = []
+        , exp;
+
+      while (consume(',')) {
+        exp = parsePrefixExpression();
+        if (null == exp) raiseUnexpectedToken('<expression>', token);
+        variables.push(exp);
+      }
+      expect('=');
+      do {
+        exp = parseExpectedExpression();
+        init.push(exp);
+      } while (consume(','));
+
+      pushLocation(marker);
+      return finishNode(ast.assignmentStatement(variables, init));
+    }
+    if (isCallExpression(expression)) {
+      pushLocation(marker);
+      return finishNode(ast.callStatement(expression));
+    }
+    // The prefix expression was neither part of an assignment or a
+    // callstatement, however as it was valid it's been consumed, so raise
+    // the exception on the previous token to provide a helpful message.
+    return unexpected(previous);
+  }
+
+
+
+  // ### Non-statements
+
+  //     Identifier ::= Name
+
+  function parseIdentifier() {
+    markLocation();
+    var identifier = token.value;
+    if (Identifier !== token.type) raiseUnexpectedToken('<name>', token);
+    next();
+    return finishNode(ast.identifier(identifier));
+  }
+
+  // Parse the functions parameters and body block. The name should already
+  // have been parsed and passed to this declaration function. By separating
+  // this we allow for anonymous functions in expressions.
+  //
+  // For local functions there's a boolean parameter which needs to be set
+  // when parsing the declaration.
+  //
+  //     funcdecl ::= '(' [parlist] ')' block 'end'
+  //     parlist ::= Name {',' Name} | [',' '...'] | '...'
+
+  function parseFunctionDeclaration(name, isLocal) {
+    var parameters = [];
+    expect('(');
+
+    // The declaration has arguments
+    if (!consume(')')) {
+      // Arguments are a comma separated list of identifiers, optionally ending
+      // with a vararg.
+      while (true) {
+        if (Identifier === token.type) {
+          var parameter = parseIdentifier();
+          // Function parameters are local.
+          if (options.scope) scopeIdentifier(parameter);
+
+          parameters.push(parameter);
+
+          if (consume(',')) continue;
+          else if (consume(')')) break;
+        }
+        // No arguments are allowed after a vararg.
+        else if (VarargLiteral === token.type) {
+          parameters.push(parsePrimaryExpression());
+          expect(')');
+          break;
+        } else {
+          raiseUnexpectedToken('<name> or \'...\'', token);
+        }
+      }
+    }
+
+    var body = parseBlock();
+    expect('end');
+
+    isLocal = isLocal || false;
+    return finishNode(ast.functionStatement(name, parameters, isLocal, body));
+  }
+
+  // Parse the function name as identifiers and member expressions.
+  //
+  //     Name {'.' Name} [':' Name]
+
+  function parseFunctionName() {
+    var base, name, marker;
+
+    if (trackLocations) marker = createLocationMarker();
+    base = parseIdentifier();
+
+    if (options.scope) attachScope(base, false);
+
+    while (consume('.')) {
+      pushLocation(marker);
+      name = parseIdentifier();
+      if (options.scope) attachScope(name, false);
+      base = finishNode(ast.memberExpression(base, '.', name));
+    }
+
+    if (consume(':')) {
+      pushLocation(marker);
+      name = parseIdentifier();
+      if (options.scope) attachScope(name, false);
+      base = finishNode(ast.memberExpression(base, ':', name));
+    }
+
+    return base;
+  }
+
+  //     tableconstructor ::= '{' [fieldlist] '}'
+  //     fieldlist ::= field {fieldsep field} fieldsep
+  //     field ::= '[' exp ']' '=' exp | Name = 'exp' | exp
+  //
+  //     fieldsep ::= ',' | ';'
+
+  function parseTableConstructor() {
+    var fields = []
+      , key, value;
+
+    while (true) {
+      markLocation();
+      if (Punctuator === token.type && consume('[')) {
+        key = parseExpectedExpression();
+        expect(']');
+        expect('=');
+        value = parseExpectedExpression();
+        fields.push(finishNode(ast.tableKey(key, value)));
+      } else if (Identifier === token.type) {
+        key = parseExpectedExpression();
+        if (consume('=')) {
+          value = parseExpectedExpression();
+          fields.push(finishNode(ast.tableKeyString(key, value)));
+        } else {
+          fields.push(finishNode(ast.tableValue(key)));
+        }
+      } else {
+        if (null == (value = parseExpression())) {
+          locations.pop();
+          break;
+        }
+        fields.push(finishNode(ast.tableValue(value)));
+      }
+      if (',;'.indexOf(token.value) >= 0) {
+        next();
+        continue;
+      }
+      if ('}' === token.value) break;
+    }
+    expect('}');
+    return finishNode(ast.tableConstructorExpression(fields));
+  }
+
+  // Expression parser
+  // -----------------
+  //
+  // Expressions are evaluated and always return a value. If nothing is
+  // matched null will be returned.
+  //
+  //     exp ::= (unop exp | primary | prefixexp ) { binop exp }
+  //
+  //     primary ::= nil | false | true | Number | String | '...'
+  //          | functiondef | tableconstructor
+  //
+  //     prefixexp ::= (Name | '(' exp ')' ) { '[' exp ']'
+  //          | '.' Name | ':' Name args | args }
+  //
+
+  function parseExpression() {
+    var expression = parseSubExpression(0);
+    return expression;
+  }
+
+  // Parse an expression expecting it to be valid.
+
+  function parseExpectedExpression() {
+    var expression = parseExpression();
+    if (null == expression) raiseUnexpectedToken('<expression>', token);
+    else return expression;
+  }
+
+
+  // Return the precedence priority of the operator.
+  //
+  // As unary `-` can't be distinguished from binary `-`, unary precedence
+  // isn't described in this table but in `parseSubExpression()` itself.
+  //
+  // As this function gets hit on every expression it's been optimized due to
+  // the expensive CompareICStub which took ~8% of the parse time.
+
+  function binaryPrecedence(operator) {
+    var charCode = operator.charCodeAt(0)
+      , length = operator.length;
+
+    if (1 === length) {
+      switch (charCode) {
+        case 94: return 10; // ^
+        case 42: case 47: case 37: return 7; // * / %
+        case 43: case 45: return 6; // + -
+        case 60: case 62: return 3; // < >
+      }
+    } else if (2 === length) {
+      switch (charCode) {
+        case 46: return 5; // ..
+        case 60: case 62: case 61: case 126: return 3; // <= >= == ~=
+        case 111: return 1; // or
+      }
+    } else if (97 === charCode && 'and' === operator) return 2;
+    return 0;
+  }
+
+  // Implement an operator-precedence parser to handle binary operator
+  // precedence.
+  //
+  // We use this algorithm because it's compact, it's fast and Lua core uses
+  // the same so we can be sure our expressions are parsed in the same manner
+  // without excessive amounts of tests.
+  //
+  //     exp ::= (unop exp | primary | prefixexp ) { binop exp }
+
+  function parseSubExpression(minPrecedence) {
+    var operator = token.value
+    // The left-hand side in binary operations.
+      , expression, marker;
+
+    if (trackLocations) marker = createLocationMarker();
+
+    // UnaryExpression
+    if (isUnary(token)) {
+      markLocation();
+      next();
+      var argument = parseSubExpression(8);
+      if (argument == null) raiseUnexpectedToken('<expression>', token);
+      expression = finishNode(ast.unaryExpression(operator, argument));
+    }
+    if (null == expression) {
+      // PrimaryExpression
+      expression = parsePrimaryExpression();
+
+      // PrefixExpression
+      if (null == expression) {
+        expression = parsePrefixExpression();
+      }
+    }
+    // This is not a valid left hand expression.
+    if (null == expression) return null;
+
+    var precedence;
+    while (true) {
+      operator = token.value;
+
+      precedence = (Punctuator === token.type || Keyword === token.type) ?
+        binaryPrecedence(operator) : 0;
+
+      if (precedence === 0 || precedence <= minPrecedence) break;
+      // Right-hand precedence operators
+      if ('^' === operator || '..' === operator) precedence--;
+      next();
+      var right = parseSubExpression(precedence);
+      if (null == right) raiseUnexpectedToken('<expression>', token);
+      // Push in the marker created before the loop to wrap its entirety.
+      if (trackLocations) locations.push(marker);
+      expression = finishNode(ast.binaryExpression(operator, expression, right));
+
+    }
+    return expression;
+  }
+
+  //     prefixexp ::= prefix {suffix}
+  //     prefix ::= Name | '(' exp ')'
+  //     suffix ::= '[' exp ']' | '.' Name | ':' Name args | args
+  //
+  //     args ::= '(' [explist] ')' | tableconstructor | String
+
+  function parsePrefixExpression() {
+    var base, name, marker
+      // Keep track of the scope, if a parent is local so are the children.
+      , isLocal;
+
+    if (trackLocations) marker = createLocationMarker();
+
+    // The prefix
+    if (Identifier === token.type) {
+      name = token.value;
+      base = parseIdentifier();
+      // Set the parent scope.
+      if (options.scope) attachScope(base, isLocal = scopeHasName(name));
+    } else if (consume('(')) {
+      base = parseExpectedExpression();
+      expect(')');
+      if (options.scope) isLocal = base.isLocal;
+    } else {
+      return null;
+    }
+
+    // The suffix
+    var expression, identifier;
+    while (true) {
+      if (Punctuator === token.type) {
+        switch (token.value) {
+          case '[':
+            pushLocation(marker);
+            next();
+            expression = parseExpectedExpression();
+            base = finishNode(ast.indexExpression(base, expression));
+            expect(']');
+            break;
+          case '.':
+            pushLocation(marker);
+            next();
+            identifier = parseIdentifier();
+            // Inherit the scope
+            if (options.scope) attachScope(identifier, isLocal);
+            base = finishNode(ast.memberExpression(base, '.', identifier));
+            break;
+          case ':':
+            pushLocation(marker);
+            next();
+            identifier = parseIdentifier();
+            if (options.scope) attachScope(identifier, isLocal);
+            base = finishNode(ast.memberExpression(base, ':', identifier));
+            // Once a : is found, this has to be a CallExpression, otherwise
+            // throw an error.
+            pushLocation(marker);
+            base = parseCallExpression(base);
+            break;
+          case '(': case '{': // args
+            pushLocation(marker);
+            base = parseCallExpression(base);
+            break;
+          default:
+            return base;
+        }
+      } else if (StringLiteral === token.type) {
+        pushLocation(marker);
+        base = parseCallExpression(base);
+      } else {
+        break;
+      }
+    }
+
+    return base;
+  }
+
+  //     args ::= '(' [explist] ')' | tableconstructor | String
+
+  function parseCallExpression(base) {
+    if (Punctuator === token.type) {
+      switch (token.value) {
+        case '(':
+          next();
+
+          // List of expressions
+          var expressions = [];
+          var expression = parseExpression();
+          if (null != expression) expressions.push(expression);
+          while (consume(',')) {
+            expression = parseExpectedExpression();
+            expressions.push(expression);
+          }
+
+          expect(')');
+          return finishNode(ast.callExpression(base, expressions));
+
+        case '{':
+          markLocation();
+          next();
+          var table = parseTableConstructor();
+          return finishNode(ast.tableCallExpression(base, table));
+      }
+    } else if (StringLiteral === token.type) {
+      return finishNode(ast.stringCallExpression(base, parsePrimaryExpression()));
+    }
+
+    raiseUnexpectedToken('function arguments', token);
+  }
+
+  //     primary ::= String | Numeric | nil | true | false
+  //          | functiondef | tableconstructor | '...'
+
+  function parsePrimaryExpression() {
+    var literals = StringLiteral | NumericLiteral | BooleanLiteral | NilLiteral | VarargLiteral
+      , value = token.value
+      , type = token.type
+      , marker;
+
+    if (trackLocations) marker = createLocationMarker();
+
+    if (type & literals) {
+      pushLocation(marker);
+      var raw = input.slice(token.range[0], token.range[1]);
+      next();
+      return finishNode(ast.literal(type, value, raw));
+    } else if (Keyword === type && 'function' === value) {
+      pushLocation(marker);
+      next();
+      return parseFunctionDeclaration(null);
+    } else if (consume('{')) {
+      pushLocation(marker);
+      return parseTableConstructor();
+    }
+  }
+
+  // Parser
+  // ------
+
+  // Export the main parser.
+  //
+  //   - `wait` Hold parsing until end() is called. Defaults to false
+  //   - `comments` Store comments. Defaults to true.
+  //   - `scope` Track identifier scope. Defaults to false.
+  //
+  // Example:
+  //
+  //     var parser = require('luaparser');
+  //     parser.parse('i = 0');
+
+  exports.parse = parse;
+
+  function parse(_input, _options) {
+    if ('undefined' === typeof _options && 'object' === typeof _input) {
+      _options = _input;
+      _input = undefined;
+    }
+    if (!_options) _options = {};
+
+    input = _input || '';
+    options = extend(defaultOptions, _options);
+
+    // Rewind the lexer
+    index = 0;
+    line = 1;
+    lineStart = 0;
+    length = input.length;
+    // When tracking identifier scope, initialize with an empty scope.
+    scopes = [[]];
+    scopeDepth = 0;
+    globals = [];
+    locations = [];
+
+    if (options.comments) comments = [];
+    if (!options.wait) return end();
+    return exports;
+  }
+
+  // Write to the source code buffer without beginning the parse.
+  exports.write = write;
+
+  function write(_input) {
+    input += String(_input);
+    length = input.length;
+    return exports;
+  }
+
+  // Send an EOF and begin parsing.
+  exports.end = end;
+
+  function end(_input) {
+    if ('undefined' !== typeof _input) write(_input);
+
+    length = input.length;
+    trackLocations = options.locations || options.ranges;
+    // Initialize with a lookahead token.
+    lookahead = lex();
+
+    var chunk = parseChunk();
+    if (options.comments) chunk.comments = comments;
+    if (options.scope) chunk.globals = globals;
+
+    if (locations.length > 0)
+      throw new Error('Location tracking failed. This is most likely a bug in luaparse');
+
+    return chunk;
+  }
+
+}));
+/* vim: set sw=2 ts=2 et tw=79 : */
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/lua_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/lua_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/lua_highlight_rules.js
new file mode 100644
index 0000000..5eb969d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/lua_highlight_rules.js
@@ -0,0 +1,193 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var LuaHighlightRules = function() {
+
+    var keywords = (
+        "break|do|else|elseif|end|for|function|if|in|local|repeat|"+
+         "return|then|until|while|or|and|not"
+    );
+
+    var builtinConstants = ("true|false|nil|_G|_VERSION");
+
+    var functions = (
+      // builtinFunctions
+        "string|xpcall|package|tostring|print|os|unpack|require|"+
+        "getfenv|setmetatable|next|assert|tonumber|io|rawequal|"+
+        "collectgarbage|getmetatable|module|rawset|math|debug|"+
+        "pcall|table|newproxy|type|coroutine|_G|select|gcinfo|"+
+        "pairs|rawget|loadstring|ipairs|_VERSION|dofile|setfenv|"+
+        "load|error|loadfile|"+
+
+        "sub|upper|len|gfind|rep|find|match|char|dump|gmatch|"+
+        "reverse|byte|format|gsub|lower|preload|loadlib|loaded|"+
+        "loaders|cpath|config|path|seeall|exit|setlocale|date|"+
+        "getenv|difftime|remove|time|clock|tmpname|rename|execute|"+
+        "lines|write|close|flush|open|output|type|read|stderr|"+
+        "stdin|input|stdout|popen|tmpfile|log|max|acos|huge|"+
+        "ldexp|pi|cos|tanh|pow|deg|tan|cosh|sinh|random|randomseed|"+
+        "frexp|ceil|floor|rad|abs|sqrt|modf|asin|min|mod|fmod|log10|"+
+        "atan2|exp|sin|atan|getupvalue|debug|sethook|getmetatable|"+
+        "gethook|setmetatable|setlocal|traceback|setfenv|getinfo|"+
+        "setupvalue|getlocal|getregistry|getfenv|setn|insert|getn|"+
+        "foreachi|maxn|foreach|concat|sort|remove|resume|yield|"+
+        "status|wrap|create|running|"+
+      // metatableMethods
+        "__add|__sub|__mod|__unm|__concat|__lt|__index|__call|__gc|__metatable|"+
+         "__mul|__div|__pow|__len|__eq|__le|__newindex|__tostring|__mode|__tonumber"
+    );
+
+    var stdLibaries = ("string|package|os|io|math|debug|table|coroutine");
+
+    var futureReserved = "";
+
+    var deprecatedIn5152 = ("setn|foreach|foreachi|gcinfo|log10|maxn");
+
+    var keywordMapper = this.createKeywordMapper({
+        "keyword": keywords,
+        "support.function": functions,
+        "invalid.deprecated": deprecatedIn5152,
+        "constant.library": stdLibaries,
+        "constant.language": builtinConstants,
+        "invalid.illegal": futureReserved,
+        "variable.language": "this"
+    }, "identifier");
+
+    var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
+    var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
+    var integer = "(?:" + decimalInteger + "|" + hexInteger + ")";
+
+    var fraction = "(?:\\.\\d+)";
+    var intPart = "(?:\\d+)";
+    var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
+    var floatNumber = "(?:" + pointFloat + ")";
+
+    this.$rules = {
+        "start" : [{
+            stateName: "bracketedComment",
+            onMatch : function(value, currentState, stack){
+                stack.unshift(this.next, value.length - 2, currentState);
+                return "comment";
+            },
+            regex : /\-\-\[=*\[/,
+            next  : [
+                {
+                    onMatch : function(value, currentState, stack) {
+                        if (value.length == stack[1]) {
+                            stack.shift();
+                            stack.shift();
+                            this.next = stack.shift();
+                        } else {
+                            this.next = "";
+                        }
+                        return "comment";
+                    },
+                    regex : /\]=*\]/,
+                    next  : "start"
+                }, {
+                    defaultToken : "comment"
+                }
+            ]
+        },
+
+        {
+            token : "comment",
+            regex : "\\-\\-.*$"
+        },
+        {
+            stateName: "bracketedString",
+            onMatch : function(value, currentState, stack){
+                stack.unshift(this.next, value.length, currentState);
+                return "comment";
+            },
+            regex : /\[=*\[/,
+            next  : [
+                {
+                    onMatch : function(value, currentState, stack) {
+                        if (value.length == stack[1]) {
+                            stack.shift();
+                            stack.shift();
+                            this.next = stack.shift();
+                        } else {
+                            this.next = "";
+                        }
+                        return "comment";
+                    },
+                    
+                    regex : /\]=*\]/,
+                    next  : "start"
+                }, {
+                    defaultToken : "comment"
+                }
+            ]
+        },
+        {
+            token : "string",           // " string
+            regex : '"(?:[^\\\\]|\\\\.)*?"'
+        }, {
+            token : "string",           // ' string
+            regex : "'(?:[^\\\\]|\\\\.)*?'"
+        }, {
+            token : "constant.numeric", // float
+            regex : floatNumber
+        }, {
+            token : "constant.numeric", // integer
+            regex : integer + "\\b"
+        }, {
+            token : keywordMapper,
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        }, {
+            token : "keyword.operator",
+            regex : "\\+|\\-|\\*|\\/|%|\\#|\\^|~|<|>|<=|=>|==|~=|=|\\:|\\.\\.\\.|\\.\\."
+        }, {
+            token : "paren.lparen",
+            regex : "[\\[\\(\\{]"
+        }, {
+            token : "paren.rparen",
+            regex : "[\\]\\)\\}]"
+        }, {
+            token : "text",
+            regex : "\\s+|\\w+"
+        } ]
+    };
+    
+    this.normalizeRules();
+}
+
+oop.inherits(LuaHighlightRules, TextHighlightRules);
+
+exports.LuaHighlightRules = LuaHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/lua_worker.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/lua_worker.js b/src/fauxton/assets/js/libs/ace/mode/lua_worker.js
new file mode 100644
index 0000000..9c08f61
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/lua_worker.js
@@ -0,0 +1,71 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var Mirror = require("../worker/mirror").Mirror;
+var luaparse = require("../mode/lua/luaparse");
+
+var Worker = exports.Worker = function(sender) {
+    Mirror.call(this, sender);
+    this.setTimeout(500);
+};
+
+oop.inherits(Worker, Mirror);
+
+(function() {
+
+    this.onUpdate = function() {
+        var value = this.doc.getValue();
+
+		// var t=Date.now()
+        try {
+            luaparse.parse(value);
+        } catch(e) {
+            if (e instanceof SyntaxError) {
+                this.sender.emit("error", {
+					row: e.line - 1,
+					column: e.column,
+					text: e.message,
+					type: "error"
+				});
+            }
+			// console.log( t-Date.now())
+            return;
+        }
+		// console.log( t-Date.now())
+        this.sender.emit("ok");
+    };
+
+}).call(Worker.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/luapage.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/luapage.js b/src/fauxton/assets/js/libs/ace/mode/luapage.js
new file mode 100644
index 0000000..b6f6548
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/luapage.js
@@ -0,0 +1,21 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var HtmlMode = require("./html").Mode;
+var LuaMode = require("./lua").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var LuaPageHighlightRules = require("./luapage_highlight_rules").LuaPageHighlightRules;
+
+var Mode = function() {
+    this.HighlightRules = LuaPageHighlightRules;
+    
+    this.HighlightRules = LuaPageHighlightRules;
+    this.createModeDelegates({
+        "lua-": LuaMode
+    });
+};
+oop.inherits(Mode, HtmlMode);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/luapage_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/luapage_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/luapage_highlight_rules.js
new file mode 100644
index 0000000..5987899
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/luapage_highlight_rules.js
@@ -0,0 +1,49 @@
+// LuaPage implements the LuaPage markup as described by the Kepler Project's CGILua
+// documentation: http://keplerproject.github.com/cgilua/manual.html#templates
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules;
+
+var LuaPageHighlightRules = function() {
+    HtmlHighlightRules.call(this);
+
+    var startRules = [
+        {
+            token: "keyword",
+            regex: "<\\%\\=?",
+            push: "lua-start"
+        }, {
+            token: "keyword",
+            regex: "<\\?lua\\=?",
+            push: "lua-start"
+        }
+    ];
+
+    var endRules = [
+        {
+            token: "keyword",
+            regex: "\\%>",
+            next: "pop"
+        }, {
+            token: "keyword",
+            regex: "\\?>",
+            next: "pop"
+        }
+    ];
+
+    this.embedRules(LuaHighlightRules, "lua-", endRules, ["start"]);
+
+    for (var key in this.$rules)
+        this.$rules[key].unshift.apply(this.$rules[key], startRules);
+
+    this.normalizeRules();
+};
+
+oop.inherits(LuaPageHighlightRules, HtmlHighlightRules);
+
+exports.LuaPageHighlightRules = LuaPageHighlightRules;
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/lucene.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/lucene.js b/src/fauxton/assets/js/libs/ace/mode/lucene.js
new file mode 100644
index 0000000..9beed95
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/lucene.js
@@ -0,0 +1,16 @@
+define(function(require, exports, module) {
+'use strict';
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var LuceneHighlightRules = require("./lucene_highlight_rules").LuceneHighlightRules;
+
+var Mode = function() {
+    this.$tokenizer =  new Tokenizer(new LuceneHighlightRules().getRules());
+};
+
+oop.inherits(Mode, TextMode);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/lucene_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/lucene_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/lucene_highlight_rules.js
new file mode 100644
index 0000000..536aa1d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/lucene_highlight_rules.js
@@ -0,0 +1,49 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var LuceneHighlightRules = function() {
+    this.$rules = {
+        "start" : [
+            {
+                token : "constant.character.negation",
+                regex : "[\\-]"
+            }, {
+                token : "constant.character.interro",
+                regex : "[\\?]"
+            }, {
+                token : "constant.character.asterisk",
+                regex : "[\\*]"
+            }, {
+                token: 'constant.character.proximity',
+                regex: '~[0-9]+\\b'
+            }, {
+                token : 'keyword.operator',
+                regex: '(?:AND|OR|NOT)\\b'
+            }, {
+                token : "paren.lparen",
+                regex : "[\\(]"
+            }, {
+                token : "paren.rparen",
+                regex : "[\\)]"
+            }, {
+                token : "keyword",
+                regex : "[\\S]+:"
+            }, {
+                token : "string",           // " string
+                regex : '".*?"'
+            }, {
+                token : "text",
+                regex : "\\s+"
+            }
+        ]
+    };
+};
+
+oop.inherits(LuceneHighlightRules, TextHighlightRules);
+
+exports.LuceneHighlightRules = LuceneHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/makefile.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/makefile.js b/src/fauxton/assets/js/libs/ace/mode/makefile.js
new file mode 100644
index 0000000..bd53cc3
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/makefile.js
@@ -0,0 +1,63 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ * 
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var MakefileHighlightRules = require("./makefile_highlight_rules").MakefileHighlightRules;
+var FoldMode = require("./folding/coffee").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = MakefileHighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+       
+    this.lineCommentStart = "#";    
+    this.$indentWithTabs = true;
+    
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/makefile_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/makefile_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/makefile_highlight_rules.js
new file mode 100644
index 0000000..53ef1d0
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/makefile_highlight_rules.js
@@ -0,0 +1,75 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var ShHighlightFile = require("./sh_highlight_rules");
+
+var MakefileHighlightRules = function() {
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    var keywordMapper = this.createKeywordMapper({
+        "keyword": ShHighlightFile.reservedKeywords,
+        "support.function.builtin": ShHighlightFile.languageConstructs,
+        "invalid.deprecated": "debugger"
+    }, "string");
+
+    this.$rules = 
+        {
+    "start": [
+        {
+            token: "string.interpolated.backtick.makefile",
+            regex: "`",
+            next: "shell-start"
+        },
+        {
+            token: "punctuation.definition.comment.makefile",
+            regex: /#(?=.)/,
+            next: "comment"
+        },
+        {
+            token: [ "keyword.control.makefile"],
+            regex: "^(?:\\s*\\b)(\\-??include|ifeq|ifneq|ifdef|ifndef|else|endif|vpath|export|unexport|define|endef|override)(?:\\b)"
+        },
+        {// ^([^\t ]+(\s[^\t ]+)*:(?!\=))\s*.*
+            token: ["entity.name.function.makefile", "text"],
+            regex: "^([^\\t ]+(?:\\s[^\\t ]+)*:)(\\s*.*)"
+        }
+    ],
+    "comment": [
+        {
+            token : "punctuation.definition.comment.makefile",
+            regex : /.+\\/
+        },
+        {
+            token : "punctuation.definition.comment.makefile",
+            regex : ".+",
+            next  : "start"
+        }
+    ],
+    "shell-start": [
+        {
+            token: keywordMapper,
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        }, 
+        {
+            token: "string",
+            regex : "\\w+"
+        }, 
+        {
+            token : "string.interpolated.backtick.makefile",
+            regex : "`",
+            next  : "start"
+        }
+    ]
+}
+
+};
+
+oop.inherits(MakefileHighlightRules, TextHighlightRules);
+
+exports.MakefileHighlightRules = MakefileHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/markdown.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/markdown.js b/src/fauxton/assets/js/libs/ace/mode/markdown.js
new file mode 100644
index 0000000..f237122
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/markdown.js
@@ -0,0 +1,76 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var JavaScriptMode = require("./javascript").Mode;
+var XmlMode = require("./xml").Mode;
+var HtmlMode = require("./html").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
+var MarkdownFoldMode = require("./folding/markdown").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = MarkdownHighlightRules;
+    
+    this.createModeDelegates({
+        "js-": JavaScriptMode,
+        "xml-": XmlMode,
+        "html-": HtmlMode
+    });
+    
+    this.foldingRules = new MarkdownFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.type = "text";
+    this.lineCommentStart = ">";
+    
+    this.getNextLineIndent = function(state, line, tab) {
+        if (state == "listblock") {
+            var match = /^(\s*)(?:([-+*])|(\d+)\.)(\s+)/.exec(line);
+            if (!match)
+                return "";
+            var marker = match[2];
+            if (!marker)
+                marker = parseInt(match[3], 10) + 1 + ".";
+            return match[1] + marker + match[4];
+        } else {
+            return this.$getIndent(line);
+        }
+    };
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});


[51/51] [partial] git commit: updated refs/heads/1911-ace-editor to 9abd128

Posted by ga...@apache.org.
working replacement


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/9abd128c
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/9abd128c
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/9abd128c

Branch: refs/heads/1911-ace-editor
Commit: 9abd128cb548a43535ff5e3f32f6c588e9ab2d06
Parents: b7c5531
Author: Garren Smith <ga...@gmail.com>
Authored: Tue Oct 29 17:27:51 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue Oct 29 17:27:51 2013 +0200

----------------------------------------------------------------------
 src/fauxton/app/config.js                       |     3 +-
 src/fauxton/app/modules/documents/views.js      |    82 +-
 src/fauxton/app/modules/fauxton/components.js   |    68 +-
 src/fauxton/app/templates/documents/doc.html    |     2 +-
 .../app/templates/documents/view_editor.html    |     8 +-
 src/fauxton/assets/js/libs/ace/ace.js           |   117 +
 src/fauxton/assets/js/libs/ace/anchor.js        |   242 +
 src/fauxton/assets/js/libs/ace/anchor_test.js   |   188 +
 src/fauxton/assets/js/libs/ace/autocomplete.js  |   350 +
 .../assets/js/libs/ace/autocomplete/popup.js    |   316 +
 .../js/libs/ace/autocomplete/text_completer.js  |    78 +
 .../assets/js/libs/ace/autocomplete/util.js     |    74 +
 .../assets/js/libs/ace/background_tokenizer.js  |   255 +
 .../js/libs/ace/background_tokenizer_test.js    |    85 +
 .../js/libs/ace/commands/command_manager.js     |   112 +
 .../libs/ace/commands/command_manager_test.js   |   199 +
 .../js/libs/ace/commands/default_commands.js    |   490 +
 .../ace/commands/incremental_search_commands.js |   180 +
 .../libs/ace/commands/multi_select_commands.js  |    97 +
 .../js/libs/ace/commands/occur_commands.js      |   110 +
 src/fauxton/assets/js/libs/ace/config.js        |   295 +
 src/fauxton/assets/js/libs/ace/config_test.js   |   128 +
 .../ace/css/codefolding-fold-button-states.png  |   Bin 0 -> 759 bytes
 src/fauxton/assets/js/libs/ace/css/editor.css   |   447 +
 .../assets/js/libs/ace/css/expand-marker.png    |   Bin 0 -> 290 bytes
 src/fauxton/assets/js/libs/ace/document.js      |   642 +
 src/fauxton/assets/js/libs/ace/document_test.js |   306 +
 src/fauxton/assets/js/libs/ace/edit_session.js  |  2505 ++
 .../js/libs/ace/edit_session/bracket_match.js   |   219 +
 .../assets/js/libs/ace/edit_session/fold.js     |   140 +
 .../js/libs/ace/edit_session/fold_line.js       |   268 +
 .../assets/js/libs/ace/edit_session/folding.js  |   799 +
 .../assets/js/libs/ace/edit_session_test.js     |  1075 +
 src/fauxton/assets/js/libs/ace/editor.js        |  2423 ++
 .../js/libs/ace/editor_change_document_test.js  |   188 +
 .../ace/editor_highlight_selected_word_test.js  |   223 +
 .../js/libs/ace/editor_navigation_test.js       |   164 +
 .../assets/js/libs/ace/editor_text_edit_test.js |   557 +
 src/fauxton/assets/js/libs/ace/ext/chromevox.js |   980 +
 .../js/libs/ace/ext/elastic_tabstops_lite.js    |   319 +
 src/fauxton/assets/js/libs/ace/ext/emmet.js     |   415 +
 .../assets/js/libs/ace/ext/keybinding_menu.js   |    86 +
 .../assets/js/libs/ace/ext/language_tools.js    |   129 +
 .../ext/menu_tools/add_editor_menu_options.js   |   103 +
 .../ace/ext/menu_tools/element_generator.js     |   148 +
 .../ext/menu_tools/generate_settings_menu.js    |   258 +
 .../menu_tools/get_editor_keyboard_shortcuts.js |   100 +
 .../ace/ext/menu_tools/get_set_functions.js     |   141 +
 .../js/libs/ace/ext/menu_tools/overlay_page.js  |   116 +
 .../libs/ace/ext/menu_tools/settings_menu.css   |    48 +
 src/fauxton/assets/js/libs/ace/ext/modelist.js  |   174 +
 src/fauxton/assets/js/libs/ace/ext/old_ie.js    |   108 +
 .../assets/js/libs/ace/ext/old_ie_test.js       |    77 +
 .../assets/js/libs/ace/ext/searchbox.css        |   157 +
 src/fauxton/assets/js/libs/ace/ext/searchbox.js |   286 +
 .../assets/js/libs/ace/ext/settings_menu.js     |    76 +
 .../assets/js/libs/ace/ext/spellcheck.js        |    69 +
 src/fauxton/assets/js/libs/ace/ext/split.js     |    40 +
 src/fauxton/assets/js/libs/ace/ext/static.css   |    23 +
 .../assets/js/libs/ace/ext/static_highlight.js  |   180 +
 .../js/libs/ace/ext/static_highlight_test.js    |    89 +
 src/fauxton/assets/js/libs/ace/ext/statusbar.js |    49 +
 src/fauxton/assets/js/libs/ace/ext/textarea.js  |   547 +
 src/fauxton/assets/js/libs/ace/ext/themelist.js |    79 +
 .../js/libs/ace/ext/themelist_utils/themes.js   |    36 +
 .../assets/js/libs/ace/ext/whitespace.js        |   212 +
 .../assets/js/libs/ace/incremental_search.js    |   259 +
 .../js/libs/ace/incremental_search_test.js      |   208 +
 .../assets/js/libs/ace/keyboard/emacs.js        |   599 +
 .../assets/js/libs/ace/keyboard/emacs_test.js   |    73 +
 .../assets/js/libs/ace/keyboard/hash_handler.js |   195 +
 .../assets/js/libs/ace/keyboard/keybinding.js   |   136 +
 .../js/libs/ace/keyboard/keybinding_test.js     |    69 +
 .../js/libs/ace/keyboard/state_handler.js       |   249 +
 .../assets/js/libs/ace/keyboard/textinput.js    |   503 +
 src/fauxton/assets/js/libs/ace/keyboard/vim.js  |   195 +
 .../assets/js/libs/ace/keyboard/vim/commands.js |   613 +
 .../js/libs/ace/keyboard/vim/maps/aliases.js    |    94 +
 .../js/libs/ace/keyboard/vim/maps/motions.js    |   664 +
 .../js/libs/ace/keyboard/vim/maps/operators.js  |   195 +
 .../js/libs/ace/keyboard/vim/maps/util.js       |   134 +
 .../js/libs/ace/keyboard/vim/registers.js       |    42 +
 src/fauxton/assets/js/libs/ace/layer/cursor.js  |   217 +
 src/fauxton/assets/js/libs/ace/layer/gutter.js  |   265 +
 src/fauxton/assets/js/libs/ace/layer/marker.js  |   218 +
 src/fauxton/assets/js/libs/ace/layer/text.js    |   661 +
 .../assets/js/libs/ace/layer/text_test.js       |   126 +
 src/fauxton/assets/js/libs/ace/lib/dom.js       |   283 +
 src/fauxton/assets/js/libs/ace/lib/es5-shim.js  |  1062 +
 src/fauxton/assets/js/libs/ace/lib/event.js     |   353 +
 .../assets/js/libs/ace/lib/event_emitter.js     |   155 +
 .../js/libs/ace/lib/event_emitter_test.js       |    65 +
 .../assets/js/libs/ace/lib/fixoldbrowsers.js    |    19 +
 src/fauxton/assets/js/libs/ace/lib/keys.js      |   138 +
 src/fauxton/assets/js/libs/ace/lib/lang.js      |   212 +
 src/fauxton/assets/js/libs/ace/lib/net.js       |    41 +
 src/fauxton/assets/js/libs/ace/lib/oop.js       |    55 +
 src/fauxton/assets/js/libs/ace/lib/regexp.js    |   113 +
 src/fauxton/assets/js/libs/ace/lib/useragent.js |   103 +
 .../assets/js/libs/ace/mode/_test/Readme.md     |     9 +
 .../libs/ace/mode/_test/highlight_rules_test.js |   152 +
 .../assets/js/libs/ace/mode/_test/package.json  |     8 +
 .../js/libs/ace/mode/_test/text_asciidoc.txt    |   111 +
 .../js/libs/ace/mode/_test/text_coffee.txt      |    56 +
 .../js/libs/ace/mode/_test/text_curly.txt       |     9 +
 .../assets/js/libs/ace/mode/_test/text_html.txt |     8 +
 .../js/libs/ace/mode/_test/text_javascript.txt  |    86 +
 .../js/libs/ace/mode/_test/text_livescript.txt  |     1 +
 .../js/libs/ace/mode/_test/text_lucene.txt      |    16 +
 .../js/libs/ace/mode/_test/text_markdown.txt    |    22 +
 .../assets/js/libs/ace/mode/_test/text_ruby.txt |    34 +
 .../assets/js/libs/ace/mode/_test/text_xml.txt  |     7 +
 .../js/libs/ace/mode/_test/tokens_abap.json     |   189 +
 .../ace/mode/_test/tokens_actionscript.json     |   263 +
 .../js/libs/ace/mode/_test/tokens_asciidoc.json |   422 +
 .../ace/mode/_test/tokens_assembly_x86.json     |   114 +
 .../libs/ace/mode/_test/tokens_autohotkey.json  |   261 +
 .../libs/ace/mode/_test/tokens_batchfile.json   |    70 +
 .../js/libs/ace/mode/_test/tokens_c9search.json |   104 +
 .../js/libs/ace/mode/_test/tokens_c_cpp.json    |   185 +
 .../js/libs/ace/mode/_test/tokens_clojure.json  |   162 +
 .../js/libs/ace/mode/_test/tokens_coffee.json   |   528 +
 .../libs/ace/mode/_test/tokens_coldfusion.json  |    26 +
 .../js/libs/ace/mode/_test/tokens_csharp.json   |    31 +
 .../js/libs/ace/mode/_test/tokens_css.json      |   148 +
 .../js/libs/ace/mode/_test/tokens_curly.json    |    56 +
 .../js/libs/ace/mode/_test/tokens_dart.json     |   368 +
 .../js/libs/ace/mode/_test/tokens_diff.json     |   398 +
 .../js/libs/ace/mode/_test/tokens_dot.json      |  2254 ++
 .../js/libs/ace/mode/_test/tokens_erlang.json   |   166 +
 .../js/libs/ace/mode/_test/tokens_forth.json    |   219 +
 .../js/libs/ace/mode/_test/tokens_ftl.json      |   341 +
 .../js/libs/ace/mode/_test/tokens_glsl.json     |   127 +
 .../js/libs/ace/mode/_test/tokens_golang.json   |   256 +
 .../js/libs/ace/mode/_test/tokens_groovy.json   |   410 +
 .../js/libs/ace/mode/_test/tokens_haml.json     |   174 +
 .../js/libs/ace/mode/_test/tokens_haskell.json  |   156 +
 .../js/libs/ace/mode/_test/tokens_haxe.json     |   143 +
 .../js/libs/ace/mode/_test/tokens_html.json     |    51 +
 .../libs/ace/mode/_test/tokens_html_ruby.json   |   247 +
 .../js/libs/ace/mode/_test/tokens_jade.json     |   188 +
 .../js/libs/ace/mode/_test/tokens_java.json     |    95 +
 .../libs/ace/mode/_test/tokens_javascript.json  |   592 +
 .../js/libs/ace/mode/_test/tokens_json.json     |   412 +
 .../js/libs/ace/mode/_test/tokens_jsp.json      |   435 +
 .../js/libs/ace/mode/_test/tokens_jsx.json      |    51 +
 .../js/libs/ace/mode/_test/tokens_julia.json    |   105 +
 .../js/libs/ace/mode/_test/tokens_latex.json    |   127 +
 .../js/libs/ace/mode/_test/tokens_less.json     |   204 +
 .../js/libs/ace/mode/_test/tokens_liquid.json   |   551 +
 .../js/libs/ace/mode/_test/tokens_lisp.json     |   248 +
 .../libs/ace/mode/_test/tokens_livescript.json  |     6 +
 .../js/libs/ace/mode/_test/tokens_logiql.json   |   190 +
 .../js/libs/ace/mode/_test/tokens_lsl.json      |   495 +
 .../js/libs/ace/mode/_test/tokens_lua.json      |   348 +
 .../js/libs/ace/mode/_test/tokens_luapage.json  |   633 +
 .../js/libs/ace/mode/_test/tokens_lucene.json   |    92 +
 .../js/libs/ace/mode/_test/tokens_markdown.json |   114 +
 .../js/libs/ace/mode/_test/tokens_mushcode.json |   790 +
 .../libs/ace/mode/_test/tokens_objectivec.json  |   792 +
 .../js/libs/ace/mode/_test/tokens_ocaml.json    |   200 +
 .../js/libs/ace/mode/_test/tokens_pascal.json   |   297 +
 .../js/libs/ace/mode/_test/tokens_perl.json     |   227 +
 .../js/libs/ace/mode/_test/tokens_pgsql.json    |   735 +
 .../js/libs/ace/mode/_test/tokens_php.json      |   134 +
 .../libs/ace/mode/_test/tokens_powershell.json  |   184 +
 .../js/libs/ace/mode/_test/tokens_prolog.json   |   265 +
 .../libs/ace/mode/_test/tokens_properties.json  |    68 +
 .../js/libs/ace/mode/_test/tokens_python.json   |   152 +
 .../assets/js/libs/ace/mode/_test/tokens_r.json |   235 +
 .../js/libs/ace/mode/_test/tokens_rdoc.json     |   441 +
 .../js/libs/ace/mode/_test/tokens_rhtml.json    |   106 +
 .../js/libs/ace/mode/_test/tokens_ruby.json     |   232 +
 .../js/libs/ace/mode/_test/tokens_rust.json     |   136 +
 .../js/libs/ace/mode/_test/tokens_sass.json     |   229 +
 .../js/libs/ace/mode/_test/tokens_scad.json     |   194 +
 .../js/libs/ace/mode/_test/tokens_scala.json    |   542 +
 .../js/libs/ace/mode/_test/tokens_scheme.json   |   216 +
 .../js/libs/ace/mode/_test/tokens_scss.json     |   123 +
 .../js/libs/ace/mode/_test/tokens_sh.json       |   334 +
 .../js/libs/ace/mode/_test/tokens_snippets.json |   159 +
 .../js/libs/ace/mode/_test/tokens_sql.json      |    54 +
 .../js/libs/ace/mode/_test/tokens_stylus.json   |   271 +
 .../js/libs/ace/mode/_test/tokens_svg.json      |   684 +
 .../js/libs/ace/mode/_test/tokens_tcl.json      |   385 +
 .../js/libs/ace/mode/_test/tokens_tex.json      |   130 +
 .../js/libs/ace/mode/_test/tokens_text.json     |    29 +
 .../js/libs/ace/mode/_test/tokens_textile.json  |   113 +
 .../js/libs/ace/mode/_test/tokens_toml.json     |   131 +
 .../js/libs/ace/mode/_test/tokens_twig.json     |   288 +
 .../libs/ace/mode/_test/tokens_typescript.json  |   559 +
 .../js/libs/ace/mode/_test/tokens_vbscript.json |   249 +
 .../js/libs/ace/mode/_test/tokens_velocity.json |   281 +
 .../js/libs/ace/mode/_test/tokens_xml.json      |    43 +
 .../js/libs/ace/mode/_test/tokens_xquery.json   |    44 +
 .../js/libs/ace/mode/_test/tokens_yaml.json     |   150 +
 src/fauxton/assets/js/libs/ace/mode/abap.js     |    77 +
 .../js/libs/ace/mode/abap_highlight_rules.js    |   134 +
 .../assets/js/libs/ace/mode/actionscript.js     |    62 +
 .../ace/mode/actionscript_highlight_rules.js    |   141 +
 src/fauxton/assets/js/libs/ace/mode/ada.js      |    54 +
 .../js/libs/ace/mode/ada_highlight_rules.js     |    93 +
 src/fauxton/assets/js/libs/ace/mode/asciidoc.js |    64 +
 .../libs/ace/mode/asciidoc_highlight_rules.js   |   234 +
 .../assets/js/libs/ace/mode/assembly_x86.js     |    56 +
 .../ace/mode/assembly_x86_highlight_rules.js    |   114 +
 .../assets/js/libs/ace/mode/autohotkey.js       |    62 +
 .../libs/ace/mode/autohotkey_highlight_rules.js |   107 +
 .../assets/js/libs/ace/mode/batchfile.js        |    61 +
 .../libs/ace/mode/batchfile_highlight_rules.js  |    97 +
 .../assets/js/libs/ace/mode/behaviour.js        |    90 +
 .../assets/js/libs/ace/mode/behaviour/css.js    |   108 +
 .../assets/js/libs/ace/mode/behaviour/cstyle.js |   365 +
 .../assets/js/libs/ace/mode/behaviour/html.js   |    88 +
 .../assets/js/libs/ace/mode/behaviour/xml.js    |   103 +
 .../assets/js/libs/ace/mode/behaviour/xquery.js |    92 +
 src/fauxton/assets/js/libs/ace/mode/c9search.js |    67 +
 .../libs/ace/mode/c9search_highlight_rules.js   |    59 +
 src/fauxton/assets/js/libs/ace/mode/c_cpp.js    |   101 +
 .../js/libs/ace/mode/c_cpp_highlight_rules.js   |   183 +
 src/fauxton/assets/js/libs/ace/mode/clojure.js  |    86 +
 .../js/libs/ace/mode/clojure_highlight_rules.js |   200 +
 src/fauxton/assets/js/libs/ace/mode/cobol.js    |    53 +
 .../js/libs/ace/mode/cobol_highlight_rules.js   |   100 +
 src/fauxton/assets/js/libs/ace/mode/coffee.js   |   114 +
 .../js/libs/ace/mode/coffee/coffee-script.js    |    62 +
 .../assets/js/libs/ace/mode/coffee/helpers.js   |   271 +
 .../assets/js/libs/ace/mode/coffee/lexer.js     |   929 +
 .../assets/js/libs/ace/mode/coffee/nodes.js     |  3080 ++
 .../assets/js/libs/ace/mode/coffee/parser.js    |   724 +
 .../js/libs/ace/mode/coffee/parser_test.js      |    88 +
 .../assets/js/libs/ace/mode/coffee/rewriter.js  |   513 +
 .../assets/js/libs/ace/mode/coffee/scope.js     |   174 +
 .../js/libs/ace/mode/coffee_highlight_rules.js  |   233 +
 .../assets/js/libs/ace/mode/coffee_worker.js    |    74 +
 .../assets/js/libs/ace/mode/coldfusion.js       |    62 +
 .../libs/ace/mode/coldfusion_highlight_rules.js |    49 +
 .../assets/js/libs/ace/mode/coldfusion_test.js  |    67 +
 src/fauxton/assets/js/libs/ace/mode/csharp.js   |    61 +
 .../js/libs/ace/mode/csharp_highlight_rules.js  |    96 +
 src/fauxton/assets/js/libs/ace/mode/css.js      |   100 +
 .../assets/js/libs/ace/mode/css/csslint.js      |  9206 +++++
 .../js/libs/ace/mode/css_highlight_rules.js     |   179 +
 src/fauxton/assets/js/libs/ace/mode/css_test.js |    78 +
 .../assets/js/libs/ace/mode/css_worker.js       |    95 +
 .../assets/js/libs/ace/mode/css_worker_test.js  |    68 +
 src/fauxton/assets/js/libs/ace/mode/curly.js    |    63 +
 .../js/libs/ace/mode/curly_highlight_rules.js   |    66 +
 src/fauxton/assets/js/libs/ace/mode/d.js        |    56 +
 .../js/libs/ace/mode/d_highlight_rules.js       |   318 +
 src/fauxton/assets/js/libs/ace/mode/dart.js     |    62 +
 .../js/libs/ace/mode/dart_highlight_rules.js    |   182 +
 src/fauxton/assets/js/libs/ace/mode/diff.js     |    52 +
 .../js/libs/ace/mode/diff_highlight_rules.js    |   108 +
 src/fauxton/assets/js/libs/ace/mode/django.js   |   116 +
 .../ace/mode/doc_comment_highlight_rules.js     |    73 +
 src/fauxton/assets/js/libs/ace/mode/dot.js      |    55 +
 .../js/libs/ace/mode/dot_highlight_rules.js     |   126 +
 src/fauxton/assets/js/libs/ace/mode/ejs.js      |   109 +
 src/fauxton/assets/js/libs/ace/mode/erlang.js   |    57 +
 .../js/libs/ace/mode/erlang_highlight_rules.js  |   876 +
 .../assets/js/libs/ace/mode/folding/asciidoc.js |   142 +
 .../assets/js/libs/ace/mode/folding/c9search.js |    77 +
 .../assets/js/libs/ace/mode/folding/coffee.js   |   120 +
 .../js/libs/ace/mode/folding/coffee_test.js     |   101 +
 .../assets/js/libs/ace/mode/folding/csharp.js   |   138 +
 .../assets/js/libs/ace/mode/folding/cstyle.js   |    83 +
 .../js/libs/ace/mode/folding/cstyle_test.js     |    85 +
 .../assets/js/libs/ace/mode/folding/diff.js     |    69 +
 .../js/libs/ace/mode/folding/fold_mode.js       |   120 +
 .../assets/js/libs/ace/mode/folding/html.js     |    79 +
 .../js/libs/ace/mode/folding/html_test.js       |   162 +
 .../assets/js/libs/ace/mode/folding/ini.js      |    80 +
 .../assets/js/libs/ace/mode/folding/latex.js    |   162 +
 .../assets/js/libs/ace/mode/folding/lua.js      |   163 +
 .../assets/js/libs/ace/mode/folding/markdown.js |   125 +
 .../assets/js/libs/ace/mode/folding/mixed.js    |    83 +
 .../assets/js/libs/ace/mode/folding/pythonic.js |    58 +
 .../js/libs/ace/mode/folding/pythonic_test.js   |    98 +
 .../assets/js/libs/ace/mode/folding/velocity.js |   120 +
 .../assets/js/libs/ace/mode/folding/xml.js      |   254 +
 .../assets/js/libs/ace/mode/folding/xml_test.js |   110 +
 src/fauxton/assets/js/libs/ace/mode/forth.js    |    62 +
 .../js/libs/ace/mode/forth_highlight_rules.js   |   164 +
 src/fauxton/assets/js/libs/ace/mode/ftl.js      |    49 +
 .../js/libs/ace/mode/ftl_highlight_rules.js     |   195 +
 src/fauxton/assets/js/libs/ace/mode/glsl.js     |    53 +
 .../js/libs/ace/mode/glsl_highlight_rules.js    |    81 +
 src/fauxton/assets/js/libs/ace/mode/golang.js   |    55 +
 .../js/libs/ace/mode/golang_highlight_rules.js  |   111 +
 src/fauxton/assets/js/libs/ace/mode/groovy.js   |    24 +
 .../js/libs/ace/mode/groovy_highlight_rules.js  |   173 +
 src/fauxton/assets/js/libs/ace/mode/haml.js     |    61 +
 .../js/libs/ace/mode/haml_highlight_rules.js    |   132 +
 .../assets/js/libs/ace/mode/handlebars.js       |    29 +
 .../libs/ace/mode/handlebars_highlight_rules.js |    72 +
 src/fauxton/assets/js/libs/ace/mode/haskell.js  |    62 +
 .../js/libs/ace/mode/haskell_highlight_rules.js |   246 +
 src/fauxton/assets/js/libs/ace/mode/haxe.js     |    56 +
 .../js/libs/ace/mode/haxe_highlight_rules.js    |    98 +
 src/fauxton/assets/js/libs/ace/mode/html.js     |    77 +
 .../assets/js/libs/ace/mode/html_completions.js |   313 +
 .../js/libs/ace/mode/html_highlight_rules.js    |   123 +
 .../assets/js/libs/ace/mode/html_ruby.js        |    59 +
 .../libs/ace/mode/html_ruby_highlight_rules.js  |    84 +
 .../assets/js/libs/ace/mode/html_test.js        |    67 +
 src/fauxton/assets/js/libs/ace/mode/ini.js      |    53 +
 .../js/libs/ace/mode/ini_highlight_rules.js     |   112 +
 src/fauxton/assets/js/libs/ace/mode/jack.js     |    79 +
 .../js/libs/ace/mode/jack_highlight_rules.js    |   142 +
 src/fauxton/assets/js/libs/ace/mode/jade.js     |    57 +
 .../js/libs/ace/mode/jade_highlight_rules.js    |   341 +
 src/fauxton/assets/js/libs/ace/mode/java.js     |    24 +
 .../js/libs/ace/mode/java_highlight_rules.js    |   131 +
 .../assets/js/libs/ace/mode/javascript.js       |   116 +
 .../js/libs/ace/mode/javascript/jshint.js       |  9072 +++++
 .../libs/ace/mode/javascript_highlight_rules.js |   362 +
 .../assets/js/libs/ace/mode/javascript_test.js  |   213 +
 .../js/libs/ace/mode/javascript_worker.js       |   187 +
 .../js/libs/ace/mode/javascript_worker_test.js  |   106 +
 .../libs/ace/mode/js_regex_highlight_rules.js   |    94 +
 src/fauxton/assets/js/libs/ace/mode/json.js     |    93 +
 .../assets/js/libs/ace/mode/json/json_parse.js  |   346 +
 .../js/libs/ace/mode/json_highlight_rules.js    |   100 +
 .../assets/js/libs/ace/mode/json_worker.js      |    67 +
 .../assets/js/libs/ace/mode/json_worker_test.js |   101 +
 src/fauxton/assets/js/libs/ace/mode/jsoniq.js   |   106 +
 src/fauxton/assets/js/libs/ace/mode/jsp.js      |    55 +
 .../js/libs/ace/mode/jsp_highlight_rules.js     |    91 +
 src/fauxton/assets/js/libs/ace/mode/jsx.js      |    56 +
 .../js/libs/ace/mode/jsx_highlight_rules.js     |   120 +
 src/fauxton/assets/js/libs/ace/mode/julia.js    |    62 +
 .../js/libs/ace/mode/julia_highlight_rules.js   |   170 +
 src/fauxton/assets/js/libs/ace/mode/latex.js    |    24 +
 .../js/libs/ace/mode/latex_highlight_rules.js   |    38 +
 src/fauxton/assets/js/libs/ace/mode/less.js     |    84 +
 .../js/libs/ace/mode/less_highlight_rules.js    |   271 +
 src/fauxton/assets/js/libs/ace/mode/liquid.js   |    82 +
 .../js/libs/ace/mode/liquid_highlight_rules.js  |   131 +
 src/fauxton/assets/js/libs/ace/mode/lisp.js     |    56 +
 .../js/libs/ace/mode/lisp_highlight_rules.js    |   124 +
 .../assets/js/libs/ace/mode/livescript.js       |   248 +
 src/fauxton/assets/js/libs/ace/mode/logiql.js   |   139 +
 .../js/libs/ace/mode/logiql_highlight_rules.js  |   119 +
 .../assets/js/libs/ace/mode/logiql_test.js      |    99 +
 src/fauxton/assets/js/libs/ace/mode/lsl.js      |    92 +
 .../js/libs/ace/mode/lsl_highlight_rules.js     |   363 +
 src/fauxton/assets/js/libs/ace/mode/lua.js      |   168 +
 .../assets/js/libs/ace/mode/lua/luaparse.js     |  1989 +
 .../js/libs/ace/mode/lua_highlight_rules.js     |   193 +
 .../assets/js/libs/ace/mode/lua_worker.js       |    71 +
 src/fauxton/assets/js/libs/ace/mode/luapage.js  |    21 +
 .../js/libs/ace/mode/luapage_highlight_rules.js |    49 +
 src/fauxton/assets/js/libs/ace/mode/lucene.js   |    16 +
 .../js/libs/ace/mode/lucene_highlight_rules.js  |    49 +
 src/fauxton/assets/js/libs/ace/mode/makefile.js |    63 +
 .../libs/ace/mode/makefile_highlight_rules.js   |    75 +
 src/fauxton/assets/js/libs/ace/mode/markdown.js |    76 +
 .../libs/ace/mode/markdown_highlight_rules.js   |   219 +
 .../js/libs/ace/mode/matching_brace_outdent.js  |    69 +
 .../js/libs/ace/mode/matching_parens_outdent.js |    74 +
 src/fauxton/assets/js/libs/ace/mode/matlab.js   |    55 +
 .../js/libs/ace/mode/matlab_highlight_rules.js  |   204 +
 src/fauxton/assets/js/libs/ace/mode/mushcode.js |   116 +
 .../js/libs/ace/mode/mushcode_high_rules.js     |   569 +
 src/fauxton/assets/js/libs/ace/mode/mysql.js    |    51 +
 .../js/libs/ace/mode/mysql_highlight_rules.js   |   122 +
 src/fauxton/assets/js/libs/ace/mode/nix.js      |    62 +
 .../js/libs/ace/mode/nix_highlight_rules.js     |   119 +
 .../assets/js/libs/ace/mode/objectivec.js       |    61 +
 .../libs/ace/mode/objectivec_highlight_rules.js |   331 +
 src/fauxton/assets/js/libs/ace/mode/ocaml.js    |    97 +
 .../js/libs/ace/mode/ocaml_highlight_rules.js   |   337 +
 src/fauxton/assets/js/libs/ace/mode/pascal.js   |    67 +
 .../js/libs/ace/mode/pascal_highlight_rules.js  |   127 +
 src/fauxton/assets/js/libs/ace/mode/perl.js     |    90 +
 .../js/libs/ace/mode/perl_highlight_rules.js    |   165 +
 src/fauxton/assets/js/libs/ace/mode/pgsql.js    |    59 +
 .../js/libs/ace/mode/pgsql_highlight_rules.js   |   570 +
 src/fauxton/assets/js/libs/ace/mode/php.js      |   135 +
 src/fauxton/assets/js/libs/ace/mode/php/php.js  |  5003 +++
 .../js/libs/ace/mode/php_highlight_rules.js     |  1088 +
 .../assets/js/libs/ace/mode/php_worker.js       |    76 +
 .../assets/js/libs/ace/mode/plain_text.js       |    55 +
 .../assets/js/libs/ace/mode/plain_text_test.js  |    56 +
 .../assets/js/libs/ace/mode/powershell.js       |    61 +
 .../libs/ace/mode/powershell_highlight_rules.js |   145 +
 src/fauxton/assets/js/libs/ace/mode/prolog.js   |    62 +
 .../js/libs/ace/mode/prolog_highlight_rules.js  |   238 +
 .../assets/js/libs/ace/mode/properties.js       |    45 +
 .../libs/ace/mode/properties_highlight_rules.js |    86 +
 src/fauxton/assets/js/libs/ace/mode/protobuf.js |    66 +
 .../libs/ace/mode/protobuf_highlight_rules.js   |    66 +
 src/fauxton/assets/js/libs/ace/mode/python.js   |   113 +
 .../js/libs/ace/mode/python_highlight_rules.js  |   191 +
 .../assets/js/libs/ace/mode/python_test.js      |    79 +
 src/fauxton/assets/js/libs/ace/mode/r.js        |   154 +
 .../js/libs/ace/mode/r_highlight_rules.js       |   188 +
 src/fauxton/assets/js/libs/ace/mode/rdoc.js     |    61 +
 .../js/libs/ace/mode/rdoc_highlight_rules.js    |    99 +
 src/fauxton/assets/js/libs/ace/mode/rhtml.js    |    86 +
 .../js/libs/ace/mode/rhtml_highlight_rules.js   |    46 +
 src/fauxton/assets/js/libs/ace/mode/ruby.js     |    91 +
 .../js/libs/ace/mode/ruby_highlight_rules.js    |   249 +
 .../assets/js/libs/ace/mode/ruby_test.js        |    78 +
 src/fauxton/assets/js/libs/ace/mode/rust.js     |    62 +
 .../js/libs/ace/mode/rust_highlight_rules.js    |   129 +
 src/fauxton/assets/js/libs/ace/mode/sass.js     |    52 +
 .../js/libs/ace/mode/sass_highlight_rules.js    |    79 +
 src/fauxton/assets/js/libs/ace/mode/scad.js     |    99 +
 .../js/libs/ace/mode/scad_highlight_rules.js    |   142 +
 src/fauxton/assets/js/libs/ace/mode/scala.js    |    25 +
 .../js/libs/ace/mode/scala_highlight_rules.js   |   160 +
 src/fauxton/assets/js/libs/ace/mode/scheme.js   |    56 +
 .../js/libs/ace/mode/scheme_highlight_rules.js  |   123 +
 src/fauxton/assets/js/libs/ace/mode/scss.js     |    84 +
 .../js/libs/ace/mode/scss_highlight_rules.js    |   296 +
 src/fauxton/assets/js/libs/ace/mode/sh.js       |   112 +
 .../js/libs/ace/mode/sh_highlight_rules.js      |   144 +
 src/fauxton/assets/js/libs/ace/mode/sjs.js      |    59 +
 .../js/libs/ace/mode/sjs_highlight_rules.js     |   233 +
 src/fauxton/assets/js/libs/ace/mode/snippets.js |   112 +
 .../assets/js/libs/ace/mode/soy_template.js     |    60 +
 .../ace/mode/soy_template_highlight_rules.js    |   356 +
 src/fauxton/assets/js/libs/ace/mode/space.js    |    21 +
 .../js/libs/ace/mode/space_highlight_rules.js   |    56 +
 src/fauxton/assets/js/libs/ace/mode/sql.js      |    53 +
 .../js/libs/ace/mode/sql_highlight_rules.js     |    94 +
 src/fauxton/assets/js/libs/ace/mode/stylus.js   |    59 +
 .../js/libs/ace/mode/stylus_highlight_rules.js  |   165 +
 src/fauxton/assets/js/libs/ace/mode/svg.js      |    69 +
 .../js/libs/ace/mode/svg_highlight_rules.js     |    49 +
 src/fauxton/assets/js/libs/ace/mode/tcl.js      |    84 +
 .../js/libs/ace/mode/tcl_highlight_rules.js     |   172 +
 src/fauxton/assets/js/libs/ace/mode/tex.js      |    68 +
 .../js/libs/ace/mode/tex_highlight_rules.js     |   107 +
 src/fauxton/assets/js/libs/ace/mode/text.js     |   384 +
 .../js/libs/ace/mode/text_highlight_rules.js    |   234 +
 .../assets/js/libs/ace/mode/text_test.js        |    64 +
 src/fauxton/assets/js/libs/ace/mode/textile.js  |    66 +
 .../js/libs/ace/mode/textile_highlight_rules.js |    93 +
 src/fauxton/assets/js/libs/ace/mode/toml.js     |    56 +
 .../js/libs/ace/mode/toml_highlight_rules.js    |   103 +
 src/fauxton/assets/js/libs/ace/mode/twig.js     |    92 +
 .../js/libs/ace/mode/twig_highlight_rules.js    |   166 +
 .../assets/js/libs/ace/mode/typescript.js       |    62 +
 .../libs/ace/mode/typescript_highlight_rules.js |    98 +
 src/fauxton/assets/js/libs/ace/mode/vbscript.js |    60 +
 .../libs/ace/mode/vbscript_highlight_rules.js   |   276 +
 src/fauxton/assets/js/libs/ace/mode/velocity.js |    59 +
 .../libs/ace/mode/velocity_highlight_rules.js   |   177 +
 src/fauxton/assets/js/libs/ace/mode/verilog.js  |    54 +
 .../js/libs/ace/mode/verilog_highlight_rules.js |   101 +
 src/fauxton/assets/js/libs/ace/mode/vhdl.js     |    52 +
 .../js/libs/ace/mode/vhdl_highlight_rules.js    |   115 +
 src/fauxton/assets/js/libs/ace/mode/xml.js      |    56 +
 .../js/libs/ace/mode/xml_highlight_rules.js     |   216 +
 src/fauxton/assets/js/libs/ace/mode/xml_test.js |    75 +
 src/fauxton/assets/js/libs/ace/mode/xml_util.js |   100 +
 src/fauxton/assets/js/libs/ace/mode/xquery.js   |   139 +
 .../ace/mode/xquery/JSONParseTreeHandler.js     |   178 +
 .../js/libs/ace/mode/xquery/JSONiqLexer.js      |   302 +
 .../libs/ace/mode/xquery/JSONiqTokenizer.ebnf   |   544 +
 .../js/libs/ace/mode/xquery/JSONiqTokenizer.js  |  4205 +++
 .../assets/js/libs/ace/mode/xquery/Readme.md    |     6 +
 .../js/libs/ace/mode/xquery/XQueryLexer.js      |   303 +
 .../js/libs/ace/mode/xquery/XQueryParser.ebnf   |  1180 +
 .../js/libs/ace/mode/xquery/XQueryParser.js     | 33487 +++++++++++++++++
 .../libs/ace/mode/xquery/XQueryTokenizer.ebnf   |   543 +
 .../js/libs/ace/mode/xquery/XQueryTokenizer.js  |  4205 +++
 .../mode/xquery/visitors/SemanticHighlighter.js |    76 +
 .../assets/js/libs/ace/mode/xquery_worker.js    |    81 +
 src/fauxton/assets/js/libs/ace/mode/yaml.js     |    78 +
 .../js/libs/ace/mode/yaml_highlight_rules.js    |   116 +
 src/fauxton/assets/js/libs/ace/model/editor.js  |    62 +
 .../js/libs/ace/mouse/default_gutter_handler.js |   161 +
 .../js/libs/ace/mouse/default_handlers.js       |   274 +
 .../js/libs/ace/mouse/dragdrop_handler.js       |   417 +
 .../assets/js/libs/ace/mouse/fold_handler.js    |    93 +
 .../assets/js/libs/ace/mouse/mouse_event.js     |   129 +
 .../assets/js/libs/ace/mouse/mouse_handler.js   |   155 +
 .../js/libs/ace/mouse/multi_select_handler.js   |   160 +
 src/fauxton/assets/js/libs/ace/multi_select.js  |   934 +
 .../assets/js/libs/ace/multi_select_test.js     |   205 +
 src/fauxton/assets/js/libs/ace/occur.js         |   190 +
 src/fauxton/assets/js/libs/ace/occur_test.js    |   154 +
 src/fauxton/assets/js/libs/ace/placeholder.js   |   269 +
 .../assets/js/libs/ace/placeholder_test.js      |   156 +
 src/fauxton/assets/js/libs/ace/range.js         |   549 +
 src/fauxton/assets/js/libs/ace/range_list.js    |   240 +
 .../assets/js/libs/ace/range_list_test.js       |   182 +
 src/fauxton/assets/js/libs/ace/range_test.js    |   191 +
 src/fauxton/assets/js/libs/ace/renderloop.js    |    75 +
 .../assets/js/libs/ace/requirejs/text.js        |    51 +
 src/fauxton/assets/js/libs/ace/scrollbar.js     |   204 +
 src/fauxton/assets/js/libs/ace/search.js        |   389 +
 .../assets/js/libs/ace/search_highlight.js      |    82 +
 src/fauxton/assets/js/libs/ace/search_test.js   |   461 +
 src/fauxton/assets/js/libs/ace/selection.js     |   915 +
 .../assets/js/libs/ace/selection_test.js        |   480 +
 src/fauxton/assets/js/libs/ace/snippets.js      |   844 +
 .../assets/js/libs/ace/snippets/_.snippets      |   240 +
 src/fauxton/assets/js/libs/ace/snippets/abap.js |     7 +
 .../assets/js/libs/ace/snippets/abap.snippets   |     0
 .../assets/js/libs/ace/snippets/actionscript.js |     7 +
 .../js/libs/ace/snippets/actionscript.snippets  |   157 +
 src/fauxton/assets/js/libs/ace/snippets/ada.js  |     7 +
 .../assets/js/libs/ace/snippets/ada.snippets    |     0
 .../assets/js/libs/ace/snippets/apache.snippets |    35 +
 .../assets/js/libs/ace/snippets/asciidoc.js     |     7 +
 .../js/libs/ace/snippets/asciidoc.snippets      |     0
 .../assets/js/libs/ace/snippets/assembly_x86.js |     7 +
 .../js/libs/ace/snippets/assembly_x86.snippets  |     0
 .../assets/js/libs/ace/snippets/autohotkey.js   |     7 +
 .../js/libs/ace/snippets/autohotkey.snippets    |     0
 .../assets/js/libs/ace/snippets/autoit.snippets |    66 +
 .../assets/js/libs/ace/snippets/batchfile.js    |     7 +
 .../js/libs/ace/snippets/batchfile.snippets     |     0
 .../assets/js/libs/ace/snippets/c.snippets      |   235 +
 .../assets/js/libs/ace/snippets/c9search.js     |     7 +
 .../js/libs/ace/snippets/c9search.snippets      |     0
 .../assets/js/libs/ace/snippets/c_cpp.js        |     7 +
 .../assets/js/libs/ace/snippets/c_cpp.snippets  |   131 +
 .../assets/js/libs/ace/snippets/chef.snippets   |   204 +
 .../assets/js/libs/ace/snippets/clojure.js      |     7 +
 .../js/libs/ace/snippets/clojure.snippets       |    90 +
 .../assets/js/libs/ace/snippets/cmake.snippets  |    58 +
 .../assets/js/libs/ace/snippets/cobol.js        |     7 +
 .../assets/js/libs/ace/snippets/cobol.snippets  |     0
 .../assets/js/libs/ace/snippets/coffee.js       |     7 +
 .../assets/js/libs/ace/snippets/coffee.snippets |    95 +
 .../assets/js/libs/ace/snippets/coldfusion.js   |     7 +
 .../js/libs/ace/snippets/coldfusion.snippets    |     0
 .../assets/js/libs/ace/snippets/cs.snippets     |   374 +
 .../assets/js/libs/ace/snippets/csharp.js       |     7 +
 .../assets/js/libs/ace/snippets/csharp.snippets |     0
 src/fauxton/assets/js/libs/ace/snippets/css.js  |     7 +
 .../assets/js/libs/ace/snippets/css.snippets    |   967 +
 .../assets/js/libs/ace/snippets/curly.js        |     7 +
 .../assets/js/libs/ace/snippets/curly.snippets  |     0
 src/fauxton/assets/js/libs/ace/snippets/d.js    |     7 +
 .../assets/js/libs/ace/snippets/d.snippets      |     0
 src/fauxton/assets/js/libs/ace/snippets/dart.js |     7 +
 .../assets/js/libs/ace/snippets/dart.snippets   |    83 +
 src/fauxton/assets/js/libs/ace/snippets/diff.js |     7 +
 .../assets/js/libs/ace/snippets/diff.snippets   |    11 +
 .../assets/js/libs/ace/snippets/django.js       |     7 +
 .../assets/js/libs/ace/snippets/django.snippets |   108 +
 src/fauxton/assets/js/libs/ace/snippets/dot.js  |     7 +
 .../assets/js/libs/ace/snippets/dot.snippets    |     0
 src/fauxton/assets/js/libs/ace/snippets/ejs.js  |     7 +
 .../assets/js/libs/ace/snippets/ejs.snippets    |     0
 .../assets/js/libs/ace/snippets/erlang.js       |     7 +
 .../assets/js/libs/ace/snippets/erlang.snippets |   160 +
 .../assets/js/libs/ace/snippets/eruby.snippets  |   113 +
 .../assets/js/libs/ace/snippets/falcon.snippets |    71 +
 .../assets/js/libs/ace/snippets/forth.js        |     7 +
 .../assets/js/libs/ace/snippets/forth.snippets  |     0
 src/fauxton/assets/js/libs/ace/snippets/ftl.js  |     7 +
 .../assets/js/libs/ace/snippets/ftl.snippets    |     0
 src/fauxton/assets/js/libs/ace/snippets/glsl.js |     7 +
 .../assets/js/libs/ace/snippets/glsl.snippets   |     0
 .../assets/js/libs/ace/snippets/go.snippets     |   201 +
 .../assets/js/libs/ace/snippets/golang.js       |     7 +
 .../assets/js/libs/ace/snippets/golang.snippets |     0
 .../assets/js/libs/ace/snippets/groovy.js       |     7 +
 .../assets/js/libs/ace/snippets/groovy.snippets |     0
 src/fauxton/assets/js/libs/ace/snippets/haml.js |     7 +
 .../assets/js/libs/ace/snippets/haml.snippets   |    20 +
 .../assets/js/libs/ace/snippets/handlebars.js   |     7 +
 .../js/libs/ace/snippets/handlebars.snippets    |     0
 .../assets/js/libs/ace/snippets/haskell.js      |     7 +
 .../js/libs/ace/snippets/haskell.snippets       |    82 +
 src/fauxton/assets/js/libs/ace/snippets/haxe.js |     7 +
 .../assets/js/libs/ace/snippets/haxe.snippets   |     0
 src/fauxton/assets/js/libs/ace/snippets/html.js |     7 +
 .../assets/js/libs/ace/snippets/html.snippets   |   828 +
 .../assets/js/libs/ace/snippets/html_ruby.js    |     7 +
 .../js/libs/ace/snippets/html_ruby.snippets     |     0
 .../js/libs/ace/snippets/htmldjango.snippets    |   136 +
 .../js/libs/ace/snippets/htmltornado.snippets   |    55 +
 src/fauxton/assets/js/libs/ace/snippets/ini.js  |     7 +
 .../assets/js/libs/ace/snippets/ini.snippets    |     0
 src/fauxton/assets/js/libs/ace/snippets/jade.js |     7 +
 .../assets/js/libs/ace/snippets/jade.snippets   |     0
 src/fauxton/assets/js/libs/ace/snippets/java.js |     7 +
 .../assets/js/libs/ace/snippets/java.snippets   |   240 +
 .../ace/snippets/javascript-jquery.snippets     |   589 +
 .../assets/js/libs/ace/snippets/javascript.js   |     7 +
 .../js/libs/ace/snippets/javascript.snippets    |   195 +
 src/fauxton/assets/js/libs/ace/snippets/json.js |     7 +
 .../assets/js/libs/ace/snippets/json.snippets   |     0
 .../assets/js/libs/ace/snippets/jsoniq.js       |     7 +
 .../assets/js/libs/ace/snippets/jsoniq.snippets |     0
 src/fauxton/assets/js/libs/ace/snippets/jsp.js  |     7 +
 .../assets/js/libs/ace/snippets/jsp.snippets    |    99 +
 src/fauxton/assets/js/libs/ace/snippets/jsx.js  |     7 +
 .../assets/js/libs/ace/snippets/jsx.snippets    |     0
 .../assets/js/libs/ace/snippets/julia.js        |     7 +
 .../assets/js/libs/ace/snippets/julia.snippets  |     0
 .../assets/js/libs/ace/snippets/latex.js        |     7 +
 .../assets/js/libs/ace/snippets/latex.snippets  |     0
 .../assets/js/libs/ace/snippets/ledger.snippets |     5 +
 src/fauxton/assets/js/libs/ace/snippets/less.js |     7 +
 .../assets/js/libs/ace/snippets/less.snippets   |     0
 .../assets/js/libs/ace/snippets/liquid.js       |     7 +
 .../assets/js/libs/ace/snippets/liquid.snippets |     0
 src/fauxton/assets/js/libs/ace/snippets/lisp.js |     7 +
 .../assets/js/libs/ace/snippets/lisp.snippets   |     0
 .../assets/js/libs/ace/snippets/livescript.js   |     7 +
 .../js/libs/ace/snippets/livescript.snippets    |     0
 .../assets/js/libs/ace/snippets/logiql.js       |     7 +
 .../assets/js/libs/ace/snippets/logiql.snippets |     0
 src/fauxton/assets/js/libs/ace/snippets/lsl.js  |     7 +
 .../assets/js/libs/ace/snippets/lsl.snippets    |   887 +
 src/fauxton/assets/js/libs/ace/snippets/lua.js  |     7 +
 .../assets/js/libs/ace/snippets/lua.snippets    |    21 +
 .../assets/js/libs/ace/snippets/luapage.js      |     7 +
 .../js/libs/ace/snippets/luapage.snippets       |     0
 .../assets/js/libs/ace/snippets/lucene.js       |     7 +
 .../assets/js/libs/ace/snippets/lucene.snippets |     0
 .../assets/js/libs/ace/snippets/makefile.js     |     7 +
 .../js/libs/ace/snippets/makefile.snippets      |     4 +
 .../assets/js/libs/ace/snippets/mako.snippets   |    54 +
 .../assets/js/libs/ace/snippets/markdown.js     |     7 +
 .../js/libs/ace/snippets/markdown.snippets      |    88 +
 .../assets/js/libs/ace/snippets/matlab.js       |     7 +
 .../assets/js/libs/ace/snippets/matlab.snippets |     0
 .../assets/js/libs/ace/snippets/mushcode.js     |     7 +
 .../js/libs/ace/snippets/mushcode.snippets      |     0
 .../js/libs/ace/snippets/mushcode_high_rules.js |     7 +
 .../ace/snippets/mushcode_high_rules.snippets   |     0
 .../assets/js/libs/ace/snippets/mysql.js        |     7 +
 .../assets/js/libs/ace/snippets/mysql.snippets  |     0
 src/fauxton/assets/js/libs/ace/snippets/nix.js  |     7 +
 .../assets/js/libs/ace/snippets/nix.snippets    |     0
 .../assets/js/libs/ace/snippets/objc.snippets   |   247 +
 .../assets/js/libs/ace/snippets/objectivec.js   |     7 +
 .../js/libs/ace/snippets/objectivec.snippets    |     0
 .../assets/js/libs/ace/snippets/ocaml.js        |     7 +
 .../assets/js/libs/ace/snippets/ocaml.snippets  |     0
 .../assets/js/libs/ace/snippets/pascal.js       |     7 +
 .../assets/js/libs/ace/snippets/pascal.snippets |     0
 src/fauxton/assets/js/libs/ace/snippets/perl.js |     7 +
 .../assets/js/libs/ace/snippets/perl.snippets   |   347 +
 .../assets/js/libs/ace/snippets/pgsql.js        |     7 +
 .../assets/js/libs/ace/snippets/pgsql.snippets  |     0
 src/fauxton/assets/js/libs/ace/snippets/php.js  |     7 +
 .../assets/js/libs/ace/snippets/php.snippets    |   377 +
 .../assets/js/libs/ace/snippets/powershell.js   |     7 +
 .../js/libs/ace/snippets/powershell.snippets    |     0
 .../assets/js/libs/ace/snippets/prolog.js       |     7 +
 .../assets/js/libs/ace/snippets/prolog.snippets |     0
 .../assets/js/libs/ace/snippets/properties.js   |     7 +
 .../js/libs/ace/snippets/properties.snippets    |     0
 .../assets/js/libs/ace/snippets/protobuf.js     |     7 +
 .../assets/js/libs/ace/snippets/python.js       |     7 +
 .../assets/js/libs/ace/snippets/python.snippets |   158 +
 src/fauxton/assets/js/libs/ace/snippets/r.js    |     7 +
 .../assets/js/libs/ace/snippets/r.snippets      |   121 +
 src/fauxton/assets/js/libs/ace/snippets/rdoc.js |     7 +
 .../assets/js/libs/ace/snippets/rdoc.snippets   |     0
 .../assets/js/libs/ace/snippets/rhtml.js        |     7 +
 .../assets/js/libs/ace/snippets/rhtml.snippets  |     0
 .../assets/js/libs/ace/snippets/rst.snippets    |    22 +
 src/fauxton/assets/js/libs/ace/snippets/ruby.js |     7 +
 .../assets/js/libs/ace/snippets/ruby.snippets   |   928 +
 src/fauxton/assets/js/libs/ace/snippets/rust.js |     7 +
 .../assets/js/libs/ace/snippets/rust.snippets   |     0
 src/fauxton/assets/js/libs/ace/snippets/sass.js |     7 +
 .../assets/js/libs/ace/snippets/sass.snippets   |     0
 src/fauxton/assets/js/libs/ace/snippets/scad.js |     7 +
 .../assets/js/libs/ace/snippets/scad.snippets   |     0
 .../assets/js/libs/ace/snippets/scala.js        |     7 +
 .../assets/js/libs/ace/snippets/scala.snippets  |     0
 .../assets/js/libs/ace/snippets/scheme.js       |     7 +
 .../assets/js/libs/ace/snippets/scheme.snippets |     0
 src/fauxton/assets/js/libs/ace/snippets/scss.js |     7 +
 .../assets/js/libs/ace/snippets/scss.snippets   |     0
 src/fauxton/assets/js/libs/ace/snippets/sh.js   |     7 +
 .../assets/js/libs/ace/snippets/sh.snippets     |    83 +
 .../assets/js/libs/ace/snippets/snippets.js     |     7 +
 .../js/libs/ace/snippets/snippets.snippets      |     9 +
 .../assets/js/libs/ace/snippets/soy_template.js |     7 +
 .../js/libs/ace/snippets/soy_template.snippets  |     0
 src/fauxton/assets/js/libs/ace/snippets/sql.js  |     7 +
 .../assets/js/libs/ace/snippets/sql.snippets    |    26 +
 .../assets/js/libs/ace/snippets/stylus.js       |     7 +
 .../assets/js/libs/ace/snippets/stylus.snippets |     0
 src/fauxton/assets/js/libs/ace/snippets/svg.js  |     7 +
 .../assets/js/libs/ace/snippets/svg.snippets    |     0
 src/fauxton/assets/js/libs/ace/snippets/tcl.js  |     7 +
 .../assets/js/libs/ace/snippets/tcl.snippets    |    92 +
 src/fauxton/assets/js/libs/ace/snippets/tex.js  |     7 +
 .../assets/js/libs/ace/snippets/tex.snippets    |   191 +
 src/fauxton/assets/js/libs/ace/snippets/text.js |     7 +
 .../assets/js/libs/ace/snippets/text.snippets   |     0
 .../assets/js/libs/ace/snippets/textile.js      |     7 +
 .../js/libs/ace/snippets/textile.snippets       |    30 +
 .../js/libs/ace/snippets/tmsnippet.snippets     |     0
 src/fauxton/assets/js/libs/ace/snippets/toml.js |     7 +
 .../assets/js/libs/ace/snippets/toml.snippets   |     0
 src/fauxton/assets/js/libs/ace/snippets/twig.js |     7 +
 .../assets/js/libs/ace/snippets/twig.snippets   |     0
 .../assets/js/libs/ace/snippets/typescript.js   |     7 +
 .../js/libs/ace/snippets/typescript.snippets    |     0
 .../assets/js/libs/ace/snippets/vbscript.js     |     7 +
 .../js/libs/ace/snippets/vbscript.snippets      |     0
 .../assets/js/libs/ace/snippets/velocity.js     |     7 +
 .../js/libs/ace/snippets/velocity.snippets      |     0
 .../assets/js/libs/ace/snippets/verilog.js      |     7 +
 .../js/libs/ace/snippets/verilog.snippets       |     0
 src/fauxton/assets/js/libs/ace/snippets/vhdl.js |     7 +
 .../assets/js/libs/ace/snippets/vhdl.snippets   |     0
 src/fauxton/assets/js/libs/ace/snippets/xml.js  |     7 +
 .../assets/js/libs/ace/snippets/xml.snippets    |     0
 .../assets/js/libs/ace/snippets/xquery.js       |     7 +
 .../assets/js/libs/ace/snippets/xquery.snippets |     0
 .../assets/js/libs/ace/snippets/xslt.snippets   |    97 +
 src/fauxton/assets/js/libs/ace/snippets/yaml.js |     7 +
 .../assets/js/libs/ace/snippets/yaml.snippets   |     0
 src/fauxton/assets/js/libs/ace/snippets_test.js |   131 +
 src/fauxton/assets/js/libs/ace/split.js         |   373 +
 src/fauxton/assets/js/libs/ace/test/all.js      |    35 +
 .../assets/js/libs/ace/test/all_browser.js      |   138 +
 .../assets/js/libs/ace/test/assertions.js       |    56 +
 .../assets/js/libs/ace/test/asyncjs/assert.js   |   313 +
 .../assets/js/libs/ace/test/asyncjs/async.js    |   529 +
 .../assets/js/libs/ace/test/asyncjs/index.js    |    13 +
 .../assets/js/libs/ace/test/asyncjs/test.js     |   195 +
 .../assets/js/libs/ace/test/asyncjs/utils.js    |    65 +
 .../assets/js/libs/ace/test/benchmark.js        |    78 +
 src/fauxton/assets/js/libs/ace/test/mockdom.js  |    10 +
 .../assets/js/libs/ace/test/mockrenderer.js     |   201 +
 src/fauxton/assets/js/libs/ace/test/tests.html  |    46 +
 .../assets/js/libs/ace/theme/ambiance.css       |   217 +
 .../assets/js/libs/ace/theme/ambiance.js        |    33 +
 src/fauxton/assets/js/libs/ace/theme/chaos.css  |   154 +
 src/fauxton/assets/js/libs/ace/theme/chaos.js   |    33 +
 src/fauxton/assets/js/libs/ace/theme/chrome.css |   153 +
 src/fauxton/assets/js/libs/ace/theme/chrome.js  |    39 +
 src/fauxton/assets/js/libs/ace/theme/clouds.css |   112 +
 src/fauxton/assets/js/libs/ace/theme/clouds.js  |    39 +
 .../js/libs/ace/theme/clouds_midnight.css       |   113 +
 .../assets/js/libs/ace/theme/clouds_midnight.js |    39 +
 src/fauxton/assets/js/libs/ace/theme/cobalt.css |   132 +
 src/fauxton/assets/js/libs/ace/theme/cobalt.js  |    39 +
 .../assets/js/libs/ace/theme/crimson_editor.css |   143 +
 .../assets/js/libs/ace/theme/crimson_editor.js  |    39 +
 src/fauxton/assets/js/libs/ace/theme/dawn.css   |   125 +
 src/fauxton/assets/js/libs/ace/theme/dawn.js    |    39 +
 .../assets/js/libs/ace/theme/dreamweaver.css    |   171 +
 .../assets/js/libs/ace/theme/dreamweaver.js     |    38 +
 .../assets/js/libs/ace/theme/eclipse.css        |   108 +
 src/fauxton/assets/js/libs/ace/theme/eclipse.js |    41 +
 src/fauxton/assets/js/libs/ace/theme/github.css |   119 +
 src/fauxton/assets/js/libs/ace/theme/github.js  |    39 +
 .../assets/js/libs/ace/theme/idle_fingers.css   |   113 +
 .../assets/js/libs/ace/theme/idle_fingers.js    |    39 +
 .../assets/js/libs/ace/theme/kr_theme.css       |   123 +
 .../assets/js/libs/ace/theme/kr_theme.js        |    39 +
 .../assets/js/libs/ace/theme/merbivore.css      |   110 +
 .../assets/js/libs/ace/theme/merbivore.js       |    39 +
 .../assets/js/libs/ace/theme/merbivore_soft.css |   111 +
 .../assets/js/libs/ace/theme/merbivore_soft.js  |    39 +
 .../js/libs/ace/theme/mono_industrial.css       |   126 +
 .../assets/js/libs/ace/theme/mono_industrial.js |    39 +
 .../assets/js/libs/ace/theme/monokai.css        |   122 +
 src/fauxton/assets/js/libs/ace/theme/monokai.js |    39 +
 .../assets/js/libs/ace/theme/pastel_on_dark.css |   129 +
 .../assets/js/libs/ace/theme/pastel_on_dark.js  |    39 +
 .../assets/js/libs/ace/theme/solarized_dark.css |   104 +
 .../assets/js/libs/ace/theme/solarized_dark.js  |    39 +
 .../js/libs/ace/theme/solarized_light.css       |   106 +
 .../assets/js/libs/ace/theme/solarized_light.js |    39 +
 .../assets/js/libs/ace/theme/terminal.css       |   132 +
 .../assets/js/libs/ace/theme/terminal.js        |    39 +
 .../assets/js/libs/ace/theme/textmate.css       |   154 +
 .../assets/js/libs/ace/theme/textmate.js        |    40 +
 .../assets/js/libs/ace/theme/tomorrow.css       |   124 +
 .../assets/js/libs/ace/theme/tomorrow.js        |    39 +
 .../assets/js/libs/ace/theme/tomorrow_night.css |   124 +
 .../assets/js/libs/ace/theme/tomorrow_night.js  |    39 +
 .../js/libs/ace/theme/tomorrow_night_blue.css   |   124 +
 .../js/libs/ace/theme/tomorrow_night_blue.js    |    39 +
 .../js/libs/ace/theme/tomorrow_night_bright.css |   128 +
 .../js/libs/ace/theme/tomorrow_night_bright.js  |    39 +
 .../libs/ace/theme/tomorrow_night_eighties.css  |   127 +
 .../libs/ace/theme/tomorrow_night_eighties.js   |    39 +
 .../assets/js/libs/ace/theme/twilight.css       |   126 +
 .../assets/js/libs/ace/theme/twilight.js        |    39 +
 .../assets/js/libs/ace/theme/vibrant_ink.css    |   110 +
 .../assets/js/libs/ace/theme/vibrant_ink.js     |    39 +
 src/fauxton/assets/js/libs/ace/theme/xcode.css  |   103 +
 src/fauxton/assets/js/libs/ace/theme/xcode.js   |    39 +
 .../assets/js/libs/ace/token_iterator.js        |   150 +
 .../assets/js/libs/ace/token_iterator_test.js   |   212 +
 src/fauxton/assets/js/libs/ace/tokenizer.js     |   333 +
 src/fauxton/assets/js/libs/ace/tokenizer_dev.js |   183 +
 .../assets/js/libs/ace/tokenizer_test.js        |    69 +
 src/fauxton/assets/js/libs/ace/undomanager.js   |   167 +
 src/fauxton/assets/js/libs/ace/unicode.js       |   107 +
 .../assets/js/libs/ace/virtual_renderer.js      |  1678 +
 .../assets/js/libs/ace/virtual_renderer_test.js |    86 +
 src/fauxton/assets/js/libs/ace/worker/mirror.js |    43 +
 src/fauxton/assets/js/libs/ace/worker/worker.js |   178 +
 .../assets/js/libs/ace/worker/worker_client.js  |   226 +
 .../assets/js/libs/ace/worker/worker_test.js    |   125 +
 src/fauxton/assets/less/fauxton.less            |    14 +
 809 files changed, 186579 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/app/config.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/config.js b/src/fauxton/app/config.js
index 4edeba0..631308f 100644
--- a/src/fauxton/app/config.js
+++ b/src/fauxton/app/config.js
@@ -31,7 +31,8 @@ require.config({
     jshint: "../assets/js/libs/jshint",
     spin: "../assets/js/libs/spin.min",
     d3: "../assets/js/libs/d3",
-    "nv.d3": "../assets/js/libs/nv.d3"
+    "nv.d3": "../assets/js/libs/nv.d3",
+    "ace":"../assets/js/libs/ace"
   },
 
   baseUrl: '/',

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/app/modules/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/views.js b/src/fauxton/app/modules/documents/views.js
index f822544..08825f8 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -708,6 +708,7 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, Codemirror, JSHint, re
     disableLoader: true,
     initialize: function (options) {
       this.database = options.database;
+      _.bindAll(this);
     },
     goback: function(){
       window.history.back();
@@ -849,6 +850,7 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, Codemirror, JSHint, re
       }
 
       json = JSON.parse(this.editor.getValue());
+
       this.model.set(json, {validate: true});
       if (this.model.validationError) {
         return false;
@@ -858,10 +860,11 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, Codemirror, JSHint, re
     },
 
     hasValidCode: function() {
-      return JSHINT(this.editor.getValue()) !== false;
+      var errors = this.editor.getAnnotations();
+      return errors.length === 0;
     },
 
-    runJSHint: function() {
+    /*runJSHint: function() {
       var json = this.editor.getValue();
       var output = JSHint(json);
 
@@ -884,7 +887,7 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, Codemirror, JSHint, re
           }, 0);
         }, this);
       }
-    },
+    },*/
 
     serialize: function() {
       return {
@@ -909,11 +912,24 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, Codemirror, JSHint, re
     },
 
     afterRender: function() {
+      var saveDoc = this.saveDoc;
+
+      this.editor = new Components.Editor({
+        editorId: "editor-container",
+        commands: [{
+          name: 'save',
+          bindKey: {win: 'Ctrl-S',  mac: 'Ctrl-S'},
+          exec: function(editor) {
+            saveDoc();
+          },
+          readOnly: true // false if this command should not apply in readOnly mode
+        }]
+      });
+      this.editor.render();
       this.model.on("sync", this.updateValues, this);
-      var that = this;
-      if ($('.CodeMirror').length > 0){
-        $('.CodeMirror').remove();
-      }
+
+      /*var that = this;
+
       this.editor = Codemirror.fromTextArea(this.$el.find("textarea.doc-code").get()[0], {
         mode: "application/json",
         json: false,
@@ -932,7 +948,7 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, Codemirror, JSHint, re
           "Ctrl-/": "undo"
         }
       });
-      setTimeout(function(){that.editor.setSize(null,$('#dashboard').outerHeight()-295);},200);
+      */
     }
   });
 
@@ -1334,7 +1350,8 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, Codemirror, JSHint, re
       }
     },
 
-    updateView: function(event, paramInfo) {
+    // not sure where this is used
+    /*updateView: function(event, paramInfo) {
       event.preventDefault();
 
       if (this.newView) { return alert('Please save this new view before querying it.'); }
@@ -1368,7 +1385,7 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, Codemirror, JSHint, re
       FauxtonAPI.navigate(fragment, {trigger: false});
 
       FauxtonAPI.triggerRouteEvent('updateAllDocs', {ddoc: this.ddocID, view: this.viewName});
-    },
+    },*/
 
     previewView: function(event, paramsInfo) {
       var that = this,
@@ -1433,20 +1450,20 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, Codemirror, JSHint, re
     hasValidCode: function() {
       return _.every(["mapEditor", "reduceEditor"], function(editorName) {
         var editor = this[editorName];
-        if (editorName == "reduceEditor" && ! this.isCustomReduceEnabled()) {
+        if (editorName === "reduceEditor" && ! this.isCustomReduceEnabled()) {
           return true;
-        } else if (JSHINT(editor.getValue()) !== false) {
-          return true;
-        } else {
-          // By default CouchDB view functions don't pass lint
-          return _.every(JSHINT.errors, function(error) {
-            return FauxtonAPI.isIgnorableError(error.raw);
-          });
-        }
+        } 
+        
+       var errors = editor.getAnnotations();
+       // By default CouchDB view functions don't pass lint
+       return _.every(errors, function(error) {
+         console.log('err', error);
+        return FauxtonAPI.isIgnorableError(error.raw);
+        },this);
       }, this);
     },
 
-    runJSHint: function(editorName) {
+    /*runJSHint: function(editorName) {
       var editor = this[editorName];
       var json = editor.getValue();
       var output = JSHint(json);
@@ -1472,7 +1489,7 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, Codemirror, JSHint, re
           }, 0);
         }, this);
       }
-    },
+    },*/
     toggleIndexNav: function (event) {
       var $index = this.$('#index'),
           $targetId = this.$(event.target).attr('id');
@@ -1543,7 +1560,7 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, Codemirror, JSHint, re
         mapFun.val(this.langTemplates[this.defaultLang].map);
         reduceFun.val(this.langTemplates[this.defaultLang].reduce);
       } else {
-        setTimeout(function(){this.$('#index').hide();}, 300);
+        this.$('#index').hide();
         this.$('#index-nav').parent().removeClass('active');
       }
 
@@ -1552,7 +1569,24 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, Codemirror, JSHint, re
       // When in grunt dev mode we load templates asynchronously
       // and this can cause a double render which then gives us two 
       // mapeditors
-      if (this.mapViewSet) { return;}
+
+      this.mapEditor = new Components.Editor({
+        editorId: "map-function",
+        mode: "javascript"
+      });
+      this.mapEditor.render();
+      // We can make this better
+      if (this.hasCustomReduce()) {
+        this.reduceEditor = new Components.Editor({
+          editorId: "reduce-function",
+          mode: "javascript"
+        });
+        this.reduceEditor.render();
+      } else {
+        $(".control-group.reduce-function").hide();
+      }
+
+      /*if (this.mapViewSet) { return;}
       this.mapViewSet = true;
 
       this.mapEditor = Codemirror.fromTextArea(mapFun.get()[0], {
@@ -1594,7 +1628,7 @@ function(app, FauxtonAPI, Components, Documents, pouchdb, Codemirror, JSHint, re
       // So render it first, set the editor, then hide.
       if ( ! this.hasCustomReduce()) {
         $(".control-group.reduce-function").hide();
-      }
+      }*/
 
       if (this.params) {
         this.advancedOptions.updateFromParams(this.params);

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/app/modules/fauxton/components.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/fauxton/components.js b/src/fauxton/app/modules/fauxton/components.js
index 30a57d8..afed6c7 100644
--- a/src/fauxton/app/modules/fauxton/components.js
+++ b/src/fauxton/app/modules/fauxton/components.js
@@ -11,12 +11,13 @@
 // the License.
 
 define([
-       "app",
-       // Libs
-       "api"
+  "app",
+  // Libs
+  "api",
+  "ace/ace"
 ],
 
-function(app, FauxtonAPI) {
+function(app, FauxtonAPI, ace) {
   var Components = app.module();
 
   Components.Pagination = FauxtonAPI.View.extend({
@@ -175,6 +176,65 @@ function(app, FauxtonAPI) {
     }
   });
 
+  Components.Editor = FauxtonAPI.View.extend({
+    initialize: function (options) {
+      this.editorId = options.editorId;
+      this.mode = options.mode || "json";
+      this.commands = options.commands;
+    },
+
+    afterRender: function () {
+      this.editor = ace.edit(this.editorId);
+      this.editor.setTheme("ace/theme/crimson_editor");
+      this.editor.getSession().setMode("ace/mode/" + this.mode);
+      this.editor.setShowPrintMargin(false);
+      this.editor.gotoLine(2);
+      this.addCommands();
+      this.removeIncorrectAnnotations();
+    },
+
+    addCommands: function () {
+      _.each(this.commands, function (command) {
+        var out = this.editor.commands.addCommand(command);
+        console.log(out, 'ou');
+      }, this);
+    },
+
+    removeIncorrectAnnotations: function () {
+      var editor = this.editor;
+
+      this.editor.getSession().on("changeAnnotation", function(){
+        var annotations = editor.getSession().getAnnotations();
+
+        var newAnnotations = _.reduce(annotations, function (annotations, error) {
+          console.log(error);
+          if (!FauxtonAPI.isIgnorableError(error.raw)) {
+            annotations.push(error);
+          }
+          return annotations;
+        }, []);
+
+        if (annotations.length !== newAnnotations.length) {
+          editor.getSession().setAnnotations(newAnnotations);
+        }
+      });
+    },
+
+    setValue: function (data, lineNumber) {
+      lineNumber = lineNumber ? lineNumber : -1;
+      this.editor.setValue(data, lineNumber);
+    },
+
+    getValue: function () {
+      return this.editor.getValue();
+    },
+
+    getAnnotations: function () {
+      return this.editor.getSession().getAnnotations();
+    }
+
+  });
+
   return Components;
 });
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/app/templates/documents/doc.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/doc.html b/src/fauxton/app/templates/documents/doc.html
index 8c8fc7b..f83a1a9 100644
--- a/src/fauxton/app/templates/documents/doc.html
+++ b/src/fauxton/app/templates/documents/doc.html
@@ -41,7 +41,7 @@ the License.
 <div id="duplicate-modal"> </div> 
 </div>
 
-  <textarea class="doc-code"><%- JSON.stringify(doc.attributes, null, "  ") %></textarea>
+  <div id="editor-container" class="doc-code"><%- JSON.stringify(doc.attributes, null, "  ") %></div>
   <br />
   <p>
        <button class="save-doc button green btn-success btn-large save fonticon-circle-check" type="button">Save</button>

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/app/templates/documents/view_editor.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/view_editor.html b/src/fauxton/app/templates/documents/view_editor.html
index 76265e0..8fcd07a 100644
--- a/src/fauxton/app/templates/documents/view_editor.html
+++ b/src/fauxton/app/templates/documents/view_editor.html
@@ -36,9 +36,9 @@ the License.
           <div class="control-group">
             <label for="map-function">Map function <a href="<%=getDocUrl('map_functions')%>" target="_blank"><i class="icon-question-sign"></i></a></label>
             <% if (newView) { %>
-            <textarea class="js-editor" id="map-function"><%= langTemplates.map %></textarea>
+            <div class="js-editor" id="map-function"><%= langTemplates.map %></div>
             <% } else { %>
-            <textarea class="js-editor" id="map-function"><%= ddoc.get('views')[viewName].map %></textarea>
+            <div class="js-editor" id="map-function"><%= ddoc.get('views')[viewName].map %></div>
             <% } %>
           </div>
 
@@ -60,9 +60,9 @@ the License.
           <div class="control-group reduce-function">
             <label for="reduce-function">Custom Reduce</label>
             <% if (newView) { %>
-            <textarea class="js-editor" id="reduce-function"><%= langTemplates.reduce %></textarea>
+            <div class="js-editor" id="reduce-function"><%= langTemplates.reduce %></div>
             <% } else { %>
-            <textarea class="js-editor" id="reduce-function"><%= ddoc.get('views')[viewName].reduce %></textarea>
+            <div class="js-editor" id="reduce-function"><%= ddoc.get('views')[viewName].reduce %></div>
             <% } %>
           </div>
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ace.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ace.js b/src/fauxton/assets/js/libs/ace/ace.js
new file mode 100644
index 0000000..773f227
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ace.js
@@ -0,0 +1,117 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/**
+ * The main class required to set up an Ace instance in the browser.
+ *
+ * @class Ace
+ **/
+
+define(function(require, exports, module) {
+"use strict";
+
+require("./lib/fixoldbrowsers");
+
+var dom = require("./lib/dom");
+var event = require("./lib/event");
+
+var Editor = require("./editor").Editor;
+var EditSession = require("./edit_session").EditSession;
+var UndoManager = require("./undomanager").UndoManager;
+var Renderer = require("./virtual_renderer").VirtualRenderer;
+var MultiSelect = require("./multi_select").MultiSelect;
+
+// The following require()s are for inclusion in the built ace file
+require("./worker/worker_client");
+require("./keyboard/hash_handler");
+require("./placeholder");
+require("./mode/folding/fold_mode");
+require("./theme/textmate");
+
+exports.config = require("./config");
+
+/**
+ * Provides access to require in packed noconflict mode
+ * @param {String} moduleName
+ * @returns {Object}
+ *
+ **/
+exports.require = require;
+
+/**
+ * Embeds the Ace editor into the DOM, at the element provided by `el`.
+ * @param {String | DOMElement} el Either the id of an element, or the element itself
+ *
+ **/
+exports.edit = function(el) {
+    if (typeof(el) == "string") {
+        var _id = el;
+        var el = document.getElementById(_id);
+        if (!el)
+            throw new Error("ace.edit can't find div #" + _id);
+    }
+
+    if (el.env && el.env.editor instanceof Editor)
+        return el.env.editor;
+
+    var doc = exports.createEditSession(dom.getInnerText(el));
+    el.innerHTML = '';
+
+    var editor = new Editor(new Renderer(el));
+    new MultiSelect(editor);
+    editor.setSession(doc);
+
+    var env = {
+        document: doc,
+        editor: editor,
+        onResize: editor.resize.bind(editor, null)
+    };
+    event.addListener(window, "resize", env.onResize);
+    editor.on("destroy", function() {
+        event.removeListener(window, "resize", env.onResize);
+    });
+    el.env = editor.env = env;
+    return editor;
+};
+
+/**
+ * Creates a new [[EditSession]], and returns the associated [[Document]].
+ * @param {Document | String} text {:textParam}
+ * @param {TextMode} mode {:modeParam}
+ * 
+ **/
+exports.createEditSession = function(text, mode) {
+    var doc = new EditSession(text, mode);
+    doc.setUndoManager(new UndoManager());
+    return doc;
+}
+exports.EditSession = EditSession;
+exports.UndoManager = UndoManager;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/anchor.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/anchor.js b/src/fauxton/assets/js/libs/ace/anchor.js
new file mode 100644
index 0000000..3a62e63
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/anchor.js
@@ -0,0 +1,242 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("./lib/oop");
+var EventEmitter = require("./lib/event_emitter").EventEmitter;
+
+/**
+ *
+ * Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated.
+ *
+ * @class Anchor
+ **/
+
+/**
+ * Creates a new `Anchor` and associates it with a document.
+ *
+ * @param {Document} doc The document to associate with the anchor
+ * @param {Number} row The starting row position
+ * @param {Number} column The starting column position
+ *
+ * @constructor
+ **/
+
+var Anchor = exports.Anchor = function(doc, row, column) {
+    this.$onChange = this.onChange.bind(this);
+    this.attach(doc);
+    
+    if (typeof column == "undefined")
+        this.setPosition(row.row, row.column);
+    else
+        this.setPosition(row, column);
+};
+
+(function() {
+
+    oop.implement(this, EventEmitter);
+
+    /**
+     * Returns an object identifying the `row` and `column` position of the current anchor.
+     * @returns {Object}
+     **/
+    this.getPosition = function() {
+        return this.$clipPositionToDocument(this.row, this.column);
+    };
+
+    /**
+     *
+     * Returns the current document.
+     * @returns {Document}
+     **/
+    this.getDocument = function() {
+        return this.document;
+    };
+
+    /**
+     * experimental: allows anchor to stick to the next on the left
+     */
+    this.$insertRight = false;
+    /**
+     * Fires whenever the anchor position changes.
+     *
+     * Both of these objects have a `row` and `column` property corresponding to the position.
+     *
+     * Events that can trigger this function include [[Anchor.setPosition `setPosition()`]].
+     *
+     * @event change
+     * @param {Object} e  An object containing information about the anchor position. It has two properties:
+     *  - `old`: An object describing the old Anchor position
+     *  - `value`: An object describing the new Anchor position
+     *
+     **/
+    this.onChange = function(e) {
+        var delta = e.data;
+        var range = delta.range;
+
+        if (range.start.row == range.end.row && range.start.row != this.row)
+            return;
+
+        if (range.start.row > this.row)
+            return;
+
+        if (range.start.row == this.row && range.start.column > this.column)
+            return;
+
+        var row = this.row;
+        var column = this.column;
+        var start = range.start;
+        var end = range.end;
+
+        if (delta.action === "insertText") {
+            if (start.row === row && start.column <= column) {
+                if (start.column === column && this.$insertRight) {
+                    // do nothing
+                } else if (start.row === end.row) {
+                    column += end.column - start.column;
+                } else {
+                    column -= start.column;
+                    row += end.row - start.row;
+                }
+            } else if (start.row !== end.row && start.row < row) {
+                row += end.row - start.row;
+            }
+        } else if (delta.action === "insertLines") {
+            if (start.row <= row) {
+                row += end.row - start.row;
+            }
+        } else if (delta.action === "removeText") {
+            if (start.row === row && start.column < column) {
+                if (end.column >= column)
+                    column = start.column;
+                else
+                    column = Math.max(0, column - (end.column - start.column));
+
+            } else if (start.row !== end.row && start.row < row) {
+                if (end.row === row)
+                    column = Math.max(0, column - end.column) + start.column;
+                row -= (end.row - start.row);
+            } else if (end.row === row) {
+                row -= end.row - start.row;
+                column = Math.max(0, column - end.column) + start.column;
+            }
+        } else if (delta.action == "removeLines") {
+            if (start.row <= row) {
+                if (end.row <= row)
+                    row -= end.row - start.row;
+                else {
+                    row = start.row;
+                    column = 0;
+                }
+            }
+        }
+
+        this.setPosition(row, column, true);
+    };
+
+    /**
+     * Sets the anchor position to the specified row and column. If `noClip` is `true`, the position is not clipped.
+     * @param {Number} row The row index to move the anchor to
+     * @param {Number} column The column index to move the anchor to
+     * @param {Boolean} noClip Identifies if you want the position to be clipped
+     *
+     **/
+    this.setPosition = function(row, column, noClip) {
+        var pos;
+        if (noClip) {
+            pos = {
+                row: row,
+                column: column
+            };
+        } else {
+            pos = this.$clipPositionToDocument(row, column);
+        }
+
+        if (this.row == pos.row && this.column == pos.column)
+            return;
+
+        var old = {
+            row: this.row,
+            column: this.column
+        };
+
+        this.row = pos.row;
+        this.column = pos.column;
+        this._emit("change", {
+            old: old,
+            value: pos
+        });
+    };
+
+    /**
+     * When called, the `'change'` event listener is removed.
+     *
+     **/
+    this.detach = function() {
+        this.document.removeEventListener("change", this.$onChange);
+    };
+    this.attach = function(doc) {
+        this.document = doc || this.document;
+        this.document.on("change", this.$onChange);
+    };
+
+    /**
+     * Clips the anchor position to the specified row and column.
+     * @param {Number} row The row index to clip the anchor to
+     * @param {Number} column The column index to clip the anchor to
+     *
+     **/
+    this.$clipPositionToDocument = function(row, column) {
+        var pos = {};
+
+        if (row >= this.document.getLength()) {
+            pos.row = Math.max(0, this.document.getLength() - 1);
+            pos.column = this.document.getLine(pos.row).length;
+        }
+        else if (row < 0) {
+            pos.row = 0;
+            pos.column = 0;
+        }
+        else {
+            pos.row = row;
+            pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
+        }
+
+        if (column < 0)
+            pos.column = 0;
+
+        return pos;
+    };
+
+}).call(Anchor.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/anchor_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/anchor_test.js b/src/fauxton/assets/js/libs/ace/anchor_test.js
new file mode 100644
index 0000000..2d7fcb6
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/anchor_test.js
@@ -0,0 +1,188 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var Document = require("./document").Document;
+var Anchor = require("./anchor").Anchor;
+var Range = require("./range").Range;
+var assert = require("./test/assertions");
+
+module.exports = {
+
+    "test create anchor" : function() {
+        var doc = new Document("juhu");
+        var anchor = new Anchor(doc, 0, 0);
+        
+        assert.position(anchor.getPosition(), 0, 0);
+        assert.equal(anchor.getDocument(), doc);
+    },
+    
+    "test insert text in same row before cursor should move anchor column": function() {
+        var doc = new Document("juhu\nkinners");
+        var anchor = new Anchor(doc, 1, 4);
+        
+        doc.insert({row: 1, column: 1}, "123");
+        assert.position(anchor.getPosition(), 1, 7);
+    },
+    
+    "test insert lines before cursor should move anchor row": function() {
+        var doc = new Document("juhu\nkinners");
+        var anchor = new Anchor(doc, 1, 4);
+        
+        doc.insertLines(1, ["123", "456"]);
+        assert.position(anchor.getPosition(), 3, 4);    
+    },
+    
+    "test insert new line before cursor should move anchor column": function() {
+        var doc = new Document("juhu\nkinners");
+        var anchor = new Anchor(doc, 1, 4);
+        
+        doc.insertNewLine({row: 0, column: 0});
+        assert.position(anchor.getPosition(), 2, 4);    
+    },
+    
+    "test insert new line in anchor line before anchor should move anchor column and row": function() {
+        var doc = new Document("juhu\nkinners");
+        var anchor = new Anchor(doc, 1, 4);
+        
+        doc.insertNewLine({row: 1, column: 2});
+        assert.position(anchor.getPosition(), 2, 2);
+    },
+    
+    "test delete text in anchor line before anchor should move anchor column": function() {
+        var doc = new Document("juhu\nkinners");
+        var anchor = new Anchor(doc, 1, 4);
+        
+        doc.remove(new Range(1, 1, 1, 3));
+        assert.position(anchor.getPosition(), 1, 2);
+    },
+    
+    "test remove range which contains the anchor should move the anchor to the start of the range": function() {
+        var doc = new Document("juhu\nkinners");
+        var anchor = new Anchor(doc, 0, 3);
+        
+        doc.remove(new Range(0, 1, 1, 3));
+        assert.position(anchor.getPosition(), 0, 1);
+    },
+    
+    "test delete character before the anchor should have no effect": function() {
+        var doc = new Document("juhu\nkinners");
+        var anchor = new Anchor(doc, 1, 4);
+        
+        doc.remove(new Range(1, 4, 1, 5));
+        assert.position(anchor.getPosition(), 1, 4);
+    },
+    
+    "test delete lines in anchor line before anchor should move anchor row": function() {
+        var doc = new Document("juhu\n1\n2\nkinners");
+        var anchor = new Anchor(doc, 3, 4);
+        
+        doc.removeLines(1, 2);
+        assert.position(anchor.getPosition(), 1, 4);
+    },
+    
+    "test remove new line before the cursor": function() {
+        var doc = new Document("juhu\nkinners");
+        var anchor = new Anchor(doc, 1, 4);
+        
+        doc.removeNewLine(0);
+        assert.position(anchor.getPosition(), 0, 8);
+    },
+    
+    "test delete range which contains the anchor should move anchor to the end of the range": function() {
+        var doc = new Document("juhu\nkinners");
+        var anchor = new Anchor(doc, 1, 4);
+        
+        doc.remove(new Range(0, 2, 1, 2));
+        assert.position(anchor.getPosition(), 0, 4);
+    },
+    
+    "test delete line which contains the anchor should move anchor to the end of the range": function() {
+        var doc = new Document("juhu\nkinners\n123");
+        var anchor = new Anchor(doc, 1, 5);
+        
+        doc.removeLines(1, 1);
+        assert.position(anchor.getPosition(), 1, 0);
+    },
+    
+    "test remove after the anchor should have no effect": function() {
+        var doc = new Document("juhu\nkinners\n123");
+        var anchor = new Anchor(doc, 1, 2);
+        
+        doc.remove(new Range(1, 4, 2, 2));
+        assert.position(anchor.getPosition(), 1, 2);
+    },
+    
+    "test anchor changes triggered by document changes should emit change event": function(next) {
+        var doc = new Document("juhu\nkinners\n123");
+        var anchor = new Anchor(doc, 1, 5);
+        
+        anchor.on("change", function(e) {
+            assert.position(anchor.getPosition(), 0, 0);
+            next();
+        });
+        
+        doc.remove(new Range(0, 0, 2, 1));
+    },
+    
+    "test only fire change event if position changes": function() {
+        var doc = new Document("juhu\nkinners\n123");
+        var anchor = new Anchor(doc, 1, 5);
+        
+        anchor.on("change", function(e) {
+            assert.fail();
+        });
+        
+        doc.remove(new Range(2, 0, 2, 1));
+    },
+    
+    "test insert/remove lines at the end of the document": function() {
+        var doc = new Document("juhu\nkinners\n123");
+        var anchor = new Anchor(doc, 2, 4);
+        
+        doc.removeLines(0, 3);
+        assert.position(anchor.getPosition(), 0, 0);
+        doc.insertLines(0, ["a", "b", "c"]);        
+        assert.position(anchor.getPosition(), 3, 0);
+        assert.equal(doc.getValue(), "a\nb\nc\n");
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}


[41/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/keyboard/emacs.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/keyboard/emacs.js b/src/fauxton/assets/js/libs/ace/keyboard/emacs.js
new file mode 100644
index 0000000..166c685
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/keyboard/emacs.js
@@ -0,0 +1,599 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var dom = require("../lib/dom");
+require("../incremental_search");
+var iSearchCommandModule = require("../commands/incremental_search_commands");
+
+
+var screenToTextBlockCoordinates = function(x, y) {
+    var canvasPos = this.scroller.getBoundingClientRect();
+
+    var col = Math.floor(
+        (x + this.scrollLeft - canvasPos.left - this.$padding) / this.characterWidth
+    );
+    var row = Math.floor(
+        (y + this.scrollTop - canvasPos.top) / this.lineHeight
+    );
+
+    return this.session.screenToDocumentPosition(row, col);
+};
+
+var HashHandler = require("./hash_handler").HashHandler;
+exports.handler = new HashHandler();
+
+exports.handler.isEmacs = true;
+exports.handler.$id = "ace/keyboard/emacs";
+
+var initialized = false;
+var $formerLongWords;
+var $formerLineStart;
+
+exports.handler.attach = function(editor) {
+    if (!initialized) {
+        initialized = true;
+        dom.importCssString('\
+            .emacs-mode .ace_cursor{\
+                border: 2px rgba(50,250,50,0.8) solid!important;\
+                -moz-box-sizing: border-box!important;\
+                -webkit-box-sizing: border-box!important;\
+                box-sizing: border-box!important;\
+                background-color: rgba(0,250,0,0.9);\
+                opacity: 0.5;\
+            }\
+            .emacs-mode .ace_hidden-cursors .ace_cursor{\
+                opacity: 1;\
+                background-color: transparent;\
+            }\
+            .emacs-mode .ace_overwrite-cursors .ace_cursor {\
+                opacity: 1;\
+                background-color: transparent;\
+                border-width: 0 0 2px 2px !important;\
+            }\
+            .emacs-mode .ace_text-layer {\
+                z-index: 4\
+            }\
+            .emacs-mode .ace_cursor-layer {\
+                z-index: 2\
+            }', 'emacsMode'
+        );
+    }
+    // in emacs, gotowordleft/right should not count a space as a word..
+    $formerLongWords = editor.session.$selectLongWords;
+    editor.session.$selectLongWords = true;
+    // CTRL-A should go to actual beginning of line
+    $formerLineStart = editor.session.$useEmacsStyleLineStart;
+    editor.session.$useEmacsStyleLineStart = true;
+
+    editor.session.$emacsMark = null; // the active mark
+    editor.session.$emacsMarkRing = editor.session.$emacsMarkRing || [];
+
+    editor.emacsMark = function() {
+        return this.session.$emacsMark;
+    }
+
+    editor.setEmacsMark = function(p) {
+        // to deactivate pass in a falsy value
+        this.session.$emacsMark = p;
+    }
+
+    editor.pushEmacsMark = function(p, activate) {
+        var prevMark = this.session.$emacsMark;
+        if (prevMark)
+            this.session.$emacsMarkRing.push(prevMark);
+        if (!p || activate) this.setEmacsMark(p)
+        else this.session.$emacsMarkRing.push(p);
+    }
+
+    editor.popEmacsMark = function() {
+        var mark = this.emacsMark();
+        if (mark) { this.setEmacsMark(null); return mark; }
+        return this.session.$emacsMarkRing.pop();
+    }
+
+    editor.getLastEmacsMark = function(p) {
+        return this.session.$emacsMark || this.session.$emacsMarkRing.slice(-1)[0];
+    }
+
+    editor.on("click", $resetMarkMode);
+    editor.on("changeSession", $kbSessionChange);
+    editor.renderer.screenToTextCoordinates = screenToTextBlockCoordinates;
+    editor.setStyle("emacs-mode");
+    editor.commands.addCommands(commands);
+    exports.handler.platform = editor.commands.platform;
+    editor.$emacsModeHandler = this;
+    editor.addEventListener('copy', this.onCopy);
+    editor.addEventListener('paste', this.onPaste);
+};
+
+exports.handler.detach = function(editor) {
+    delete editor.renderer.screenToTextCoordinates;
+    editor.session.$selectLongWords = $formerLongWords;
+    editor.session.$useEmacsStyleLineStart = $formerLineStart;
+    editor.removeEventListener("click", $resetMarkMode);
+    editor.removeEventListener("changeSession", $kbSessionChange);
+    editor.unsetStyle("emacs-mode");
+    editor.commands.removeCommands(commands);
+    editor.removeEventListener('copy', this.onCopy);
+    editor.removeEventListener('paste', this.onPaste);
+};
+
+var $kbSessionChange = function(e) {
+    if (e.oldSession) {
+        e.oldSession.$selectLongWords = $formerLongWords;
+        e.oldSession.$useEmacsStyleLineStart = $formerLineStart;
+    }
+
+    $formerLongWords = e.session.$selectLongWords;
+    e.session.$selectLongWords = true;
+    $formerLineStart = e.session.$useEmacsStyleLineStart;
+    e.session.$useEmacsStyleLineStart = true;
+
+    if (!e.session.hasOwnProperty('$emacsMark'))
+        e.session.$emacsMark = null;
+    if (!e.session.hasOwnProperty('$emacsMarkRing'))
+        e.session.$emacsMarkRing = [];
+}
+
+var $resetMarkMode = function(e) {
+    e.editor.session.$emacsMark = null;
+}
+
+var keys = require("../lib/keys").KEY_MODS,
+    eMods = {C: "ctrl", S: "shift", M: "alt", CMD: "command"},
+    combinations = ["C-S-M-CMD",
+                    "S-M-CMD", "C-M-CMD", "C-S-CMD", "C-S-M",
+                    "M-CMD", "S-CMD", "S-M", "C-CMD", "C-M", "C-S",
+                    "CMD", "M", "S", "C"];
+combinations.forEach(function(c) {
+    var hashId = 0;
+    c.split("-").forEach(function(c) {
+        hashId = hashId | keys[eMods[c]];
+    });
+    eMods[hashId] = c.toLowerCase() + "-";
+});
+
+exports.handler.onCopy = function(e, editor) {
+    if (editor.$handlesEmacsOnCopy) return;
+    editor.$handlesEmacsOnCopy = true;
+    exports.handler.commands.killRingSave.exec(editor);
+    delete editor.$handlesEmacsOnCopy;
+}
+
+exports.handler.onPaste = function(e, editor) {
+    editor.pushEmacsMark(editor.getCursorPosition());
+}
+
+exports.handler.bindKey = function(key, command) {
+    if (!key)
+        return;
+
+    var ckb = this.commandKeyBinding;
+    key.split("|").forEach(function(keyPart) {
+        keyPart = keyPart.toLowerCase();
+        ckb[keyPart] = command;
+        // register all partial key combos as null commands
+        // to be able to activate key combos with arbitrary length
+        // Example: if keyPart is "C-c C-l t" then "C-c C-l t" will
+        // get command assigned and "C-c" and "C-c C-l" will get
+        // a null command assigned in this.commandKeyBinding. For
+        // the lookup logic see handleKeyboard()
+        var keyParts = keyPart.split(" ").slice(0,-1);
+        keyParts.reduce(function(keyMapKeys, keyPart, i) {
+            var prefix = keyMapKeys[i-1] ? keyMapKeys[i-1] + ' ' : '';
+            return keyMapKeys.concat([prefix + keyPart]);
+        }, []).forEach(function(keyPart) {
+            if (!ckb[keyPart]) ckb[keyPart] = "null";
+        });
+    }, this);
+}
+
+exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
+    var editor = data.editor;
+    // insertstring data.count times
+    if (hashId == -1) {
+        editor.pushEmacsMark();
+        if (data.count) {
+            var str = Array(data.count + 1).join(key);
+            data.count = null;
+            return {command: "insertstring", args: str};
+        }
+    }
+
+    if (key == "\x00") return undefined;
+
+    var modifier = eMods[hashId];
+
+    // CTRL + number / universalArgument for setting data.count
+    if (modifier == "c-" || data.universalArgument) {
+        var prevCount = String(data.count || 0);
+        var count = parseInt(key[key.length - 1]);
+        if (typeof count === 'number' && !isNaN(count)) {
+            data.count = parseInt(prevCount + count);
+            return {command: "null"};
+        } else if (data.universalArgument) {
+            // if no number pressed use emacs defaults for universalArgument
+            // which is 4
+            data.count = 4;
+        }
+    }
+    data.universalArgument = false;
+
+    // this.commandKeyBinding maps key specs like "c-p" (for CTRL + P) to
+    // command objects, for lookup key needs to include the modifier
+    if (modifier) key = modifier + key;
+
+    // Key combos like CTRL+X H build up the data.keyChain
+    if (data.keyChain) key = data.keyChain += " " + key;
+
+    // Key combo prefixes get stored as "null" (String!) in this
+    // this.commandKeyBinding. When encountered no command is invoked but we
+    // buld up data.keyChain
+    var command = this.commandKeyBinding[key];
+    data.keyChain = command == "null" ? key : "";
+
+    // there really is no command
+    if (!command) return undefined;
+
+    // we pass b/c of key combo or universalArgument
+    if (command === "null") return {command: "null"};
+
+    if (command === "universalArgument") {
+        data.universalArgument = true;
+        return {command: "null"};
+    }
+
+    // lookup command
+    // TODO extract special handling of markmode
+    // TODO special case command.command is really unnecessary, remove
+    var args;
+    if (typeof command !== "string") {
+        args = command.args;
+        if (command.command) command = command.command;
+        if (command === "goorselect") {
+            command = editor.emacsMark() ? args[1] : args[0];
+            args = null;
+        }
+    }
+
+    if (typeof command === "string") {
+        if (command === "insertstring" ||
+            command === "splitline" ||
+            command === "togglecomment") {
+            editor.pushEmacsMark();
+        }
+        command = this.commands[command] || editor.commands.commands[command];
+        if (!command) return undefined;
+    }
+
+    if (!command.readonly && !command.isYank)
+        data.lastCommand = null;
+
+    if (data.count) {
+        var count = data.count;
+        data.count = 0;
+        if (!command || !command.handlesCount) {
+            return {
+                args: args,
+                command: {
+                    exec: function(editor, args) {
+                        for (var i = 0; i < count; i++)
+                            command.exec(editor, args);
+                    }
+                }
+            };
+        } else {
+            if (!args) args = {}
+            if (typeof args === 'object') args.count = count;
+        }
+    }
+
+    return {command: command, args: args};
+};
+
+exports.emacsKeys = {
+    // movement
+    "Up|C-p"      : {command: "goorselect", args: ["golineup","selectup"]},
+    "Down|C-n"    : {command: "goorselect", args: ["golinedown","selectdown"]},
+    "Left|C-b"    : {command: "goorselect", args: ["gotoleft","selectleft"]},
+    "Right|C-f"   : {command: "goorselect", args: ["gotoright","selectright"]},
+    "C-Left|M-b"  : {command: "goorselect", args: ["gotowordleft","selectwordleft"]},
+    "C-Right|M-f" : {command: "goorselect", args: ["gotowordright","selectwordright"]},
+    "Home|C-a"    : {command: "goorselect", args: ["gotolinestart","selecttolinestart"]},
+    "End|C-e"     : {command: "goorselect", args: ["gotolineend","selecttolineend"]},
+    "C-Home|S-M-,": {command: "goorselect", args: ["gotostart","selecttostart"]},
+    "C-End|S-M-." : {command: "goorselect", args: ["gotoend","selecttoend"]},
+
+    // selection
+    "S-Up|S-C-p"      : "selectup",
+    "S-Down|S-C-n"    : "selectdown",
+    "S-Left|S-C-b"    : "selectleft",
+    "S-Right|S-C-f"   : "selectright",
+    "S-C-Left|S-M-b"  : "selectwordleft",
+    "S-C-Right|S-M-f" : "selectwordright",
+    "S-Home|S-C-a"    : "selecttolinestart",
+    "S-End|S-C-e"     : "selecttolineend",
+    "S-C-Home"        : "selecttostart",
+    "S-C-End"         : "selecttoend",
+
+    "C-l" : "recenterTopBottom",
+    "M-s" : "centerselection",
+    "M-g": "gotoline",
+    "C-x C-p": "selectall",
+
+    // todo fix these
+    "C-Down": {command: "goorselect", args: ["gotopagedown","selectpagedown"]},
+    "C-Up": {command: "goorselect", args: ["gotopageup","selectpageup"]},
+    "PageDown|C-v": {command: "goorselect", args: ["gotopagedown","selectpagedown"]},
+    "PageUp|M-v": {command: "goorselect", args: ["gotopageup","selectpageup"]},
+    "S-C-Down": "selectpagedown",
+    "S-C-Up": "selectpageup",
+
+    "C-s": "iSearch",
+    "C-r": "iSearchBackwards",
+
+    "M-C-s": "findnext",
+    "M-C-r": "findprevious",
+    "S-M-5": "replace",
+
+    // basic editing
+    "Backspace": "backspace",
+    "Delete|C-d": "del",
+    "Return|C-m": {command: "insertstring", args: "\n"}, // "newline"
+    "C-o": "splitline",
+
+    "M-d|C-Delete": {command: "killWord", args: "right"},
+    "C-Backspace|M-Backspace|M-Delete": {command: "killWord", args: "left"},
+    "C-k": "killLine",
+
+    "C-y|S-Delete": "yank",
+    "M-y": "yankRotate",
+    "C-g": "keyboardQuit",
+
+    "C-w": "killRegion",
+    "M-w": "killRingSave",
+    "C-Space": "setMark",
+    "C-x C-x": "exchangePointAndMark",
+
+    "C-t": "transposeletters",
+    "M-u": "touppercase",    // Doesn't work
+    "M-l": "tolowercase",
+    "M-/": "autocomplete",   // Doesn't work
+    "C-u": "universalArgument",
+
+    "M-;": "togglecomment",
+
+    "C-/|C-x u|S-C--|C-z": "undo",
+    "S-C-/|S-C-x u|C--|S-C-z": "redo", //infinite undo?
+    // vertical editing
+    "C-x r":  "selectRectangularRegion",
+    "M-x": {command: "focusCommandLine", args: "M-x "}
+    // todo
+    // "C-x C-t" "M-t" "M-c" "F11" "C-M- "M-q"
+};
+
+
+exports.handler.bindKeys(exports.emacsKeys);
+
+exports.handler.addCommands({
+    recenterTopBottom: function(editor) {
+        var renderer = editor.renderer;
+        var pos = renderer.$cursorLayer.getPixelPosition();
+        var h = renderer.$size.scrollerHeight - renderer.lineHeight;
+        var scrollTop = renderer.scrollTop;
+        if (Math.abs(pos.top - scrollTop) < 2) {
+            scrollTop = pos.top - h;
+        } else if (Math.abs(pos.top - scrollTop - h * 0.5) < 2) {
+            scrollTop = pos.top;
+        } else {
+            scrollTop = pos.top - h * 0.5;
+        }
+        editor.session.setScrollTop(scrollTop);
+    },
+    selectRectangularRegion:  function(editor) {
+        editor.multiSelect.toggleBlockSelection();
+    },
+    setMark:  {
+        exec: function(editor, args) {
+            // Sets mark-mode and clears current selection.
+            // When mark is set, keyboard cursor movement commands become
+            // selection modification commands. That is,
+            // "goto" commands become "select" commands.
+            // Any insertion or mouse click resets mark-mode.
+            // setMark twice in a row at the same place resets markmode
+            if (args && args.count) {
+                var mark = editor.popEmacsMark();
+                mark && editor.selection.moveCursorToPosition(mark);
+                return;
+            }
+
+            var mark = editor.emacsMark(),
+                transientMarkModeActive = true;
+
+            // if transientMarkModeActive then mark behavior is a little
+            // different. Deactivate the mark when setMark is run with active
+            // mark
+            if (transientMarkModeActive && (mark || !editor.selection.isEmpty())) {
+                editor.pushEmacsMark();
+                editor.clearSelection();
+                return;
+            }
+
+            if (mark) {
+                var cp = editor.getCursorPosition();
+                if (editor.selection.isEmpty() &&
+                    mark.row == cp.row && mark.column == cp.column) {
+                    editor.pushEmacsMark();
+                    return;
+                }
+            }
+            // turn on mark mode
+            mark = editor.getCursorPosition();
+            editor.setEmacsMark(mark);
+            editor.selection.setSelectionAnchor(mark.row, mark.column);
+        },
+        readonly: true,
+        handlesCount: true,
+        multiSelectAction: "forEach"
+    },
+    exchangePointAndMark: {
+        exec: function(editor, args) {
+            var sel = editor.selection;
+            if (args.count) {
+                var pos = editor.getCursorPosition();
+                sel.clearSelection();
+                sel.moveCursorToPosition(editor.popEmacsMark());
+                editor.pushEmacsMark(pos);
+                return;
+            }
+            var lastMark = editor.getLastEmacsMark();
+            var range = sel.getRange();
+            if (range.isEmpty()) {
+                sel.selectToPosition(lastMark);
+                return;
+            }
+            sel.setSelectionRange(range, !sel.isBackwards());
+        },
+        readonly: true,
+        handlesCount: true,
+        multiSelectAction: "forEach"
+    },
+    killWord: {
+        exec: function(editor, dir) {
+            editor.clearSelection();
+            if (dir == "left")
+                editor.selection.selectWordLeft();
+            else
+                editor.selection.selectWordRight();
+
+            var range = editor.getSelectionRange();
+            var text = editor.session.getTextRange(range);
+            exports.killRing.add(text);
+
+            editor.session.remove(range);
+            editor.clearSelection();
+        },
+        multiSelectAction: "forEach"
+    },
+    killLine: function(editor) {
+        editor.pushEmacsMark(null);
+        var pos = editor.getCursorPosition();
+        if (pos.column == 0 &&
+            editor.session.doc.getLine(pos.row).length == 0) {
+            // If an already empty line is killed, remove
+            // the line entirely
+            editor.selection.selectLine();
+        } else {
+            // otherwise just remove from the current cursor position
+            // to the end (but don't delete the selection if it's before
+            // the cursor)
+            editor.clearSelection();
+            editor.selection.selectLineEnd();
+        }
+        var range = editor.getSelectionRange();
+        var text = editor.session.getTextRange(range);
+        exports.killRing.add(text);
+
+        editor.session.remove(range);
+        editor.clearSelection();
+    },
+    yank: function(editor) {
+        editor.onPaste(exports.killRing.get() || '');
+        editor.keyBinding.$data.lastCommand = "yank";
+    },
+    yankRotate: function(editor) {
+        if (editor.keyBinding.$data.lastCommand != "yank")
+            return;
+        editor.undo();
+        editor.onPaste(exports.killRing.rotate());
+        editor.keyBinding.$data.lastCommand = "yank";
+    },
+    killRegion: {
+        exec: function(editor) {
+            exports.killRing.add(editor.getCopyText());
+            editor.commands.byName.cut.exec(editor);
+        },
+        readonly: true,
+        multiSelectAction: "forEach"
+    },
+    killRingSave: {
+        exec: function(editor) {
+            exports.killRing.add(editor.getCopyText());
+            setTimeout(function() {
+                var sel = editor.selection,
+                    range = sel.getRange();
+                editor.pushEmacsMark(sel.isBackwards() ? range.end : range.start);
+                sel.clearSelection();
+            }, 0);
+        },
+        readonly: true
+    },
+    keyboardQuit: function(editor) {
+        editor.selection.clearSelection();
+        editor.setEmacsMark(null);
+    },
+    focusCommandLine: function(editor, arg) {
+        if (editor.showCommandLine)
+            editor.showCommandLine(arg);
+    }
+});
+
+exports.handler.addCommands(iSearchCommandModule.iSearchStartCommands);
+
+var commands = exports.handler.commands;
+commands.yank.isYank = true;
+commands.yankRotate.isYank = true;
+
+exports.killRing = {
+    $data: [],
+    add: function(str) {
+        str && this.$data.push(str);
+        if (this.$data.length > 30)
+            this.$data.shift();
+    },
+    get: function(n) {
+        n = n || 1;
+        return this.$data.slice(this.$data.length-n, this.$data.length).reverse().join('\n');
+    },
+    pop: function() {
+        if (this.$data.length > 1)
+            this.$data.pop();
+        return this.get();
+    },
+    rotate: function() {
+        this.$data.unshift(this.$data.pop());
+        return this.get();
+    }
+};
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/keyboard/emacs_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/keyboard/emacs_test.js b/src/fauxton/assets/js/libs/ace/keyboard/emacs_test.js
new file mode 100644
index 0000000..d1aba56
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/keyboard/emacs_test.js
@@ -0,0 +1,73 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("./../edit_session").EditSession,
+    Editor = require("./../editor").Editor,
+    MockRenderer = require("./../test/mockrenderer").MockRenderer,
+    emacs = require('./emacs'),
+    assert = require("./../test/assertions"),
+    editor;
+
+function initEditor(docString) {
+    var doc = new EditSession(docString.split("\n"));
+    editor = new Editor(new MockRenderer(), doc);
+    editor.setKeyboardHandler(emacs.handler);
+}
+
+module.exports = {
+
+    "test: detach removes emacs commands from command manager": function() {
+        initEditor('');
+        assert.ok(!!editor.commands.byName["keyboardQuit"], 'setup error: emacs commands not installed');
+        editor.keyBinding.removeKeyboardHandler(editor.getKeyboardHandler());
+        assert.ok(!editor.commands.byName["keyboardQuit"], 'emacs commands not removed');
+    },
+
+    "test: keyboardQuit clears selection": function() {
+        initEditor('foo');
+        editor.selectAll();
+        editor.execCommand('keyboardQuit');
+        assert.ok(editor.selection.isEmpty(), 'selection non-empty');
+    }
+
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/keyboard/hash_handler.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/keyboard/hash_handler.js b/src/fauxton/assets/js/libs/ace/keyboard/hash_handler.js
new file mode 100644
index 0000000..baa8815
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/keyboard/hash_handler.js
@@ -0,0 +1,195 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var keyUtil = require("../lib/keys");
+var useragent = require("../lib/useragent");
+
+function HashHandler(config, platform) {
+    this.platform = platform || (useragent.isMac ? "mac" : "win");
+    this.commands = {};
+    this.commandKeyBinding = {};
+    
+    // todo remove this after a while
+    if (this.__defineGetter__ && this.__defineSetter__ && typeof console != "undefined" && console.error) {
+        var warned = false;
+        var warn = function() {
+            if (!warned) {
+                warned = true;
+                console.error("commmandKeyBinding has too many m's. use commandKeyBinding");
+            }
+        };
+        this.__defineGetter__("commmandKeyBinding", function() {
+            warn();
+            return this.commandKeyBinding;
+        });
+        this.__defineSetter__("commmandKeyBinding", function(val) {
+            warn();
+            return this.commandKeyBinding = val;
+        });
+    } else {
+        this.commmandKeyBinding = this.commandKeyBinding;
+    }
+
+    this.addCommands(config);
+};
+
+(function() {
+
+    this.addCommand = function(command) {
+        if (this.commands[command.name])
+            this.removeCommand(command);
+
+        this.commands[command.name] = command;
+
+        if (command.bindKey)
+            this._buildKeyHash(command);
+    };
+
+    this.removeCommand = function(command) {
+        var name = (typeof command === 'string' ? command : command.name);
+        command = this.commands[name];
+        delete this.commands[name];
+
+        // exhaustive search is brute force but since removeCommand is
+        // not a performance critical operation this should be OK
+        var ckb = this.commandKeyBinding;
+        for (var hashId in ckb) {
+            for (var key in ckb[hashId]) {
+                if (ckb[hashId][key] == command)
+                    delete ckb[hashId][key];
+            }
+        }
+    };
+
+    this.bindKey = function(key, command) {
+        if(!key)
+            return;
+        if (typeof command == "function") {
+            this.addCommand({exec: command, bindKey: key, name: command.name || key});
+            return;
+        }
+
+        var ckb = this.commandKeyBinding;
+        key.split("|").forEach(function(keyPart) {
+            var binding = this.parseKeys(keyPart, command);
+            var hashId = binding.hashId;
+            (ckb[hashId] || (ckb[hashId] = {}))[binding.key] = command;
+        }, this);
+    };
+
+    this.addCommands = function(commands) {
+        commands && Object.keys(commands).forEach(function(name) {
+            var command = commands[name];
+            if (!command)
+                return;
+            
+            if (typeof command === "string")
+                return this.bindKey(command, name);
+
+            if (typeof command === "function")
+                command = { exec: command };
+
+            if (!command.name)
+                command.name = name;
+
+            this.addCommand(command);
+        }, this);
+    };
+
+    this.removeCommands = function(commands) {
+        Object.keys(commands).forEach(function(name) {
+            this.removeCommand(commands[name]);
+        }, this);
+    };
+
+    this.bindKeys = function(keyList) {
+        Object.keys(keyList).forEach(function(key) {
+            this.bindKey(key, keyList[key]);
+        }, this);
+    };
+
+    this._buildKeyHash = function(command) {
+        var binding = command.bindKey;
+        if (!binding)
+            return;
+
+        var key = typeof binding == "string" ? binding: binding[this.platform];
+        this.bindKey(key, command);
+    };
+
+    // accepts keys in the form ctrl+Enter or ctrl-Enter
+    // keys without modifiers or shift only 
+    this.parseKeys = function(keys) {
+        // todo support keychains 
+        if (keys.indexOf(" ") != -1)
+            keys = keys.split(/\s+/).pop();
+
+        var parts = keys.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(x){return x});
+        var key = parts.pop();
+
+        var keyCode = keyUtil[key];
+        if (keyUtil.FUNCTION_KEYS[keyCode])
+            key = keyUtil.FUNCTION_KEYS[keyCode].toLowerCase();
+        else if (!parts.length)
+            return {key: key, hashId: -1};
+        else if (parts.length == 1 && parts[0] == "shift")
+            return {key: key.toUpperCase(), hashId: -1};
+
+        var hashId = 0;
+        for (var i = parts.length; i--;) {
+            var modifier = keyUtil.KEY_MODS[parts[i]];
+            if (modifier == null) {
+                if (typeof console != "undefined")
+                console.error("invalid modifier " + parts[i] + " in " + keys);
+                return false;
+            }
+            hashId |= modifier;
+        }
+        return {key: key, hashId: hashId};
+    };
+
+    this.findKeyCommand = function findKeyCommand(hashId, keyString) {
+        var ckbr = this.commandKeyBinding;
+        return ckbr[hashId] && ckbr[hashId][keyString];
+    };
+
+    this.handleKeyboard = function(data, hashId, keyString, keyCode) {
+        return {
+            command: this.findKeyCommand(hashId, keyString)
+        };
+    };
+
+}).call(HashHandler.prototype)
+
+exports.HashHandler = HashHandler;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/keyboard/keybinding.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/keyboard/keybinding.js b/src/fauxton/assets/js/libs/ace/keyboard/keybinding.js
new file mode 100644
index 0000000..2a1a223
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/keyboard/keybinding.js
@@ -0,0 +1,136 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var keyUtil  = require("../lib/keys");
+var event = require("../lib/event");
+
+var KeyBinding = function(editor) {
+    this.$editor = editor;
+    this.$data = { };
+    this.$handlers = [];
+    this.setDefaultHandler(editor.commands);
+};
+
+(function() {
+    this.setDefaultHandler = function(kb) {
+        this.removeKeyboardHandler(this.$defaultHandler);
+        this.$defaultHandler = kb;
+        this.addKeyboardHandler(kb, 0);
+        this.$data = {editor: this.$editor};
+    };
+
+    this.setKeyboardHandler = function(kb) {
+        var h = this.$handlers;
+        if (h[h.length - 1] == kb)
+            return;
+
+        while (h[h.length - 1] && h[h.length - 1] != this.$defaultHandler)
+            this.removeKeyboardHandler(h[h.length - 1]);
+
+        this.addKeyboardHandler(kb, 1);
+    };
+
+    this.addKeyboardHandler = function(kb, pos) {
+        if (!kb)
+            return;
+        var i = this.$handlers.indexOf(kb);
+        if (i != -1)
+            this.$handlers.splice(i, 1);
+
+        if (pos == undefined)
+            this.$handlers.push(kb);
+        else
+            this.$handlers.splice(pos, 0, kb);
+
+        if (i == -1 && kb.attach)
+            kb.attach(this.$editor);
+    };
+
+    this.removeKeyboardHandler = function(kb) {
+        var i = this.$handlers.indexOf(kb);
+        if (i == -1)
+            return false;
+        this.$handlers.splice(i, 1);
+        kb.detach && kb.detach(this.$editor);
+        return true;
+    };
+
+    this.getKeyboardHandler = function() {
+        return this.$handlers[this.$handlers.length - 1];
+    };
+
+    this.$callKeyboardHandlers = function (hashId, keyString, keyCode, e) {
+        var toExecute;
+        var success = false;
+        var commands = this.$editor.commands;
+
+        for (var i = this.$handlers.length; i--;) {
+            toExecute = this.$handlers[i].handleKeyboard(
+                this.$data, hashId, keyString, keyCode, e
+            );
+            if (!toExecute || !toExecute.command)
+                continue;
+            
+            // allow keyboardHandler to consume keys
+            if (toExecute.command == "null") {
+                success = true;
+            } else {
+                success = commands.exec(toExecute.command, this.$editor, toExecute.args, e);                
+            }
+            // do not stop input events to not break repeating
+            if (success && e && hashId != -1 && 
+                toExecute.passEvent != true && toExecute.command.passEvent != true
+            ) {
+                event.stopEvent(e);
+            }
+            if (success)
+                break;
+        }
+        return success;
+    };
+
+    this.onCommandKey = function(e, hashId, keyCode) {
+        var keyString = keyUtil.keyCodeToString(keyCode);
+        this.$callKeyboardHandlers(hashId, keyString, keyCode, e);
+    };
+
+    this.onTextInput = function(text) {
+        var success = this.$callKeyboardHandlers(-1, text);
+        if (!success)
+            this.$editor.commands.exec("insertstring", this.$editor, text);
+    };
+
+}).call(KeyBinding.prototype);
+
+exports.KeyBinding = KeyBinding;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/keyboard/keybinding_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/keyboard/keybinding_test.js b/src/fauxton/assets/js/libs/ace/keyboard/keybinding_test.js
new file mode 100644
index 0000000..617d99c
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/keyboard/keybinding_test.js
@@ -0,0 +1,69 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("./../edit_session").EditSession,
+    Editor = require("./../editor").Editor,
+    MockRenderer = require("./../test/mockrenderer").MockRenderer,
+    assert = require("./../test/assertions"),
+    HashHandler = require('./hash_handler').HashHandler,
+    keys = require('../lib/keys'),
+    editor;
+
+function initEditor(docString) {
+    var doc = new EditSession(docString.split("\n"));
+    editor = new Editor(new MockRenderer(), doc);
+}
+
+module.exports = {
+
+    "test: adding a new keyboard handler does not remove the default handler": function() {
+        initEditor('abc');
+        var handler = new HashHandler({'del': 'f1'});
+        editor.keyBinding.setKeyboardHandler(handler);
+        editor.onCommandKey({}, 0, keys['f1']);
+        assert.equal('bc', editor.getValue(), "binding of new handler");
+        editor.onCommandKey({}, 0, keys['delete']);
+        assert.equal('c', editor.getValue(), "bindings of the old handler should still work");
+    }
+
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/keyboard/state_handler.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/keyboard/state_handler.js b/src/fauxton/assets/js/libs/ace/keyboard/state_handler.js
new file mode 100644
index 0000000..8265bbe
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/keyboard/state_handler.js
@@ -0,0 +1,249 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+// If you're developing a new keymapping and want to get an idea what's going
+// on, then enable debugging.
+var DEBUG = false;
+
+function StateHandler(keymapping) {
+    this.keymapping = this.$buildKeymappingRegex(keymapping);
+}
+
+StateHandler.prototype = {
+    /*
+     * Build the RegExp from the keymapping as RegExp can't stored directly
+     * in the metadata JSON and as the RegExp used to match the keys/buffer
+     * need to be adapted.
+     */
+    $buildKeymappingRegex: function(keymapping) {
+        for (var state in keymapping) {
+            this.$buildBindingsRegex(keymapping[state]);
+        }
+        return keymapping;
+    },
+
+    $buildBindingsRegex: function(bindings) {
+        // Escape a given Regex string.
+        bindings.forEach(function(binding) {
+            if (binding.key) {
+                binding.key = new RegExp('^' + binding.key + '$');
+            } else if (Array.isArray(binding.regex)) {
+                if (!('key' in binding))
+                  binding.key = new RegExp('^' + binding.regex[1] + '$');
+                binding.regex = new RegExp(binding.regex.join('') + '$');
+            } else if (binding.regex) {
+                binding.regex = new RegExp(binding.regex + '$');
+            }
+        });
+    },
+
+    $composeBuffer: function(data, hashId, key, e) {
+        // Initialize the data object.
+        if (data.state == null || data.buffer == null) {
+            data.state = "start";
+            data.buffer = "";
+        }
+
+        var keyArray = [];
+        if (hashId & 1) keyArray.push("ctrl");
+        if (hashId & 8) keyArray.push("command");
+        if (hashId & 2) keyArray.push("option");
+        if (hashId & 4) keyArray.push("shift");
+        if (key)        keyArray.push(key);
+
+        var symbolicName = keyArray.join("-");
+        var bufferToUse = data.buffer + symbolicName;
+
+        // Don't add the symbolic name to the key buffer if the alt_ key is
+        // part of the symbolic name. If it starts with alt_, this means
+        // that the user hit an alt keycombo and there will be a single,
+        // new character detected after this event, which then will be
+        // added to the buffer (e.g. alt_j will result in ∆).
+        //
+        // We test for 2 and not for & 2 as we only want to exclude the case where
+        // the option key is pressed alone.
+        if (hashId != 2) {
+            data.buffer = bufferToUse;
+        }
+
+        var bufferObj = {
+            bufferToUse: bufferToUse,
+            symbolicName: symbolicName
+        };
+
+        if (e) {
+            bufferObj.keyIdentifier = e.keyIdentifier;
+        }
+
+        return bufferObj;
+    },
+
+    $find: function(data, buffer, symbolicName, hashId, key, keyIdentifier) {
+        // Holds the command to execute and the args if a command matched.
+        var result = {};
+
+        // Loop over all the bindings of the keymap until a match is found.
+        this.keymapping[data.state].some(function(binding) {
+            var match;
+
+            // Check if the key matches.
+            if (binding.key && !binding.key.test(symbolicName)) {
+                return false;
+            }
+
+            // Check if the regex matches.
+            if (binding.regex && !(match = binding.regex.exec(buffer))) {
+                return false;
+            }
+
+            // Check if the match function matches.
+            if (binding.match && !binding.match(buffer, hashId, key, symbolicName, keyIdentifier)) {
+                return false;
+            }
+
+            // Check for disallowed matches.
+            if (binding.disallowMatches) {
+                for (var i = 0; i < binding.disallowMatches.length; i++) {
+                    if (!!match[binding.disallowMatches[i]]) {
+                        return false;
+                    }
+                }
+            }
+
+            // If there is a command to execute, then figure out the
+            // command and the arguments.
+            if (binding.exec) {
+                result.command = binding.exec;
+
+                // Build the arguments.
+                if (binding.params) {
+                    var value;
+                    result.args = {};
+                    binding.params.forEach(function(param) {
+                        if (param.match != null && match != null) {
+                            value = match[param.match] || param.defaultValue;
+                        } else {
+                            value = param.defaultValue;
+                        }
+
+                        if (param.type === 'number') {
+                            value = parseInt(value);
+                        }
+
+                        result.args[param.name] = value;
+                    });
+                }
+                data.buffer = "";
+            }
+
+            // Handle the 'then' property.
+            if (binding.then) {
+                data.state = binding.then;
+                data.buffer = "";
+            }
+
+            // If no command is set, then execute the "null" fake command.
+            if (result.command == null) {
+                result.command = "null";
+            }
+
+            if (DEBUG) {
+                console.log("KeyboardStateMapper#find", binding);
+            }
+            return true;
+        });
+
+        if (result.command) {
+            return result;
+        } else {
+            data.buffer = "";
+            return false;
+        }
+    },
+
+    /*
+     * This function is called by keyBinding.
+     */
+    handleKeyboard: function(data, hashId, key, keyCode, e) {
+        if (hashId == -1)
+            hashId = 0
+        // If we pressed any command key but no other key, then ignore the input.
+        // Otherwise "shift-" is added to the buffer, and later on "shift-g"
+        // which results in "shift-shift-g" which doesn't make sense.
+        if (hashId != 0 && (key == "" || key == String.fromCharCode(0))) {
+            return null;
+        }
+
+        // Compute the current value of the keyboard input buffer.
+        var r = this.$composeBuffer(data, hashId, key, e);
+        var buffer = r.bufferToUse;
+        var symbolicName = r.symbolicName;
+        var keyId = r.keyIdentifier;
+
+        r = this.$find(data, buffer, symbolicName, hashId, key, keyId);
+        if (DEBUG) {
+            console.log("KeyboardStateMapper#match", buffer, symbolicName, r);
+        }
+
+        return r;
+    }
+}
+
+/*
+ * This is a useful matching function and therefore is defined here so that
+ * users of KeyboardStateMapper can use it.
+ *
+ * @return {Boolean} If no command key (Command|Option|Shift|Ctrl) is pressed, it
+ *          returns true. If the only the Shift key is pressed + a character
+ *          true is returned as well. Otherwise, false is returned.
+ *          Summing up, the function returns true whenever the user typed
+ *          a normal character on the keyboard and no shortcut.
+ */
+exports.matchCharacterOnly = function(buffer, hashId, key, symbolicName) {
+    // If no command keys are pressed, then catch the input.
+    if (hashId == 0) {
+        return true;
+    }
+    // If only the shift key is pressed and a character key, then
+    // catch that input as well.
+    else if ((hashId == 4) && key.length == 1) {
+        return true;
+    }
+    // Otherwise, we let the input got through.
+    else {
+        return false;
+    }
+};
+
+exports.StateHandler = StateHandler;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/keyboard/textinput.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/keyboard/textinput.js b/src/fauxton/assets/js/libs/ace/keyboard/textinput.js
new file mode 100644
index 0000000..ee09b20
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/keyboard/textinput.js
@@ -0,0 +1,503 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var event = require("../lib/event");
+var useragent = require("../lib/useragent");
+var dom = require("../lib/dom");
+var lang = require("../lib/lang");
+var BROKEN_SETDATA = useragent.isChrome < 18;
+
+var TextInput = function(parentNode, host) {
+    var text = dom.createElement("textarea");
+    text.className = "ace_text-input";
+
+    if (useragent.isTouchPad)
+        text.setAttribute("x-palm-disable-auto-cap", true);
+
+    text.wrap = "off";
+    text.autocorrect = "off";
+    text.autocapitalize = "off";
+    text.spellcheck = false;
+
+    text.style.opacity = "0";
+    parentNode.insertBefore(text, parentNode.firstChild);
+
+    var PLACEHOLDER = "\x01\x01";
+
+    var cut = false;
+    var copied = false;
+    var pasted = false;
+    var inComposition = false;
+    var tempStyle = '';
+    var isSelectionEmpty = true;
+
+    // FOCUS
+    // ie9 throws error if document.activeElement is accessed too soon
+    try { var isFocused = document.activeElement === text; } catch(e) {}
+    
+    event.addListener(text, "blur", function() {
+        host.onBlur();
+        isFocused = false;
+    });
+    event.addListener(text, "focus", function() {
+        isFocused = true;
+        host.onFocus();
+        resetSelection();
+    });
+    this.focus = function() { text.focus(); };
+    this.blur = function() { text.blur(); };
+    this.isFocused = function() {
+        return isFocused;
+    };
+
+    // modifying selection of blured textarea can focus it (chrome mac/linux)
+    var syncSelection = lang.delayedCall(function() {
+        isFocused && resetSelection(isSelectionEmpty);
+    });
+    var syncValue = lang.delayedCall(function() {
+         if (!inComposition) {
+            text.value = PLACEHOLDER;
+            isFocused && resetSelection();
+         }
+    });
+
+    function resetSelection(isEmpty) {
+        if (inComposition)
+            return;
+        if (inputHandler) {
+            selectionStart = 0;
+            selectionEnd = isEmpty ? 0 : text.value.length - 1;
+        } else {
+            var selectionStart = isEmpty ? 2 : 1;
+            var selectionEnd = 2;
+        }
+        // on firefox this throws if textarea is hidden
+        try {
+            text.setSelectionRange(selectionStart, selectionEnd);
+        } catch(e){}
+    }
+
+    function resetValue() {
+        if (inComposition)
+            return;
+        text.value = PLACEHOLDER;
+        //http://code.google.com/p/chromium/issues/detail?id=76516
+        if (useragent.isWebKit)
+            syncValue.schedule();
+    }
+
+    useragent.isWebKit || host.addEventListener('changeSelection', function() {
+        if (host.selection.isEmpty() != isSelectionEmpty) {
+            isSelectionEmpty = !isSelectionEmpty;
+            syncSelection.schedule();
+        }
+    });
+
+    resetValue();
+    if (isFocused)
+        host.onFocus();
+
+
+    var isAllSelected = function(text) {
+        return text.selectionStart === 0 && text.selectionEnd === text.value.length;
+    };
+    // IE8 does not support setSelectionRange
+    if (!text.setSelectionRange && text.createTextRange) {
+        text.setSelectionRange = function(selectionStart, selectionEnd) {
+            var range = this.createTextRange();
+            range.collapse(true);
+            range.moveStart('character', selectionStart);
+            range.moveEnd('character', selectionEnd);
+            range.select();
+        };
+        isAllSelected = function(text) {
+            try {
+                var range = text.ownerDocument.selection.createRange();
+            }catch(e) {}
+            if (!range || range.parentElement() != text) return false;
+                return range.text == text.value;
+        }
+    }
+    if (useragent.isOldIE) {
+        var inPropertyChange = false;
+        var onPropertyChange = function(e){
+            if (inPropertyChange)
+                return;
+            var data = text.value;
+            if (inComposition || !data || data == PLACEHOLDER)
+                return;
+            // can happen either after delete or during insert operation
+            if (e && data == PLACEHOLDER[0])
+                return syncProperty.schedule();
+
+            sendText(data);
+            // ie8 calls propertychange handlers synchronously!
+            inPropertyChange = true;
+            resetValue();
+            inPropertyChange = false;
+        };
+        var syncProperty = lang.delayedCall(onPropertyChange);
+        event.addListener(text, "propertychange", onPropertyChange);
+
+        var keytable = { 13:1, 27:1 };
+        event.addListener(text, "keyup", function (e) {
+            if (inComposition && (!text.value || keytable[e.keyCode]))
+                setTimeout(onCompositionEnd, 0);
+            if ((text.value.charCodeAt(0)||0) < 129) {
+                return syncProperty.call();
+            }
+            inComposition ? onCompositionUpdate() : onCompositionStart();
+        });
+        // when user presses backspace after focusing the editor 
+        // propertychange isn't called for the next character
+        event.addListener(text, "keydown", function (e) {
+            syncProperty.schedule(50);
+        });
+    }
+
+    var onSelect = function(e) {
+        if (cut) {
+            cut = false;
+        } else if (copied) {
+            copied = false;
+        } else if (isAllSelected(text)) {
+            host.selectAll();
+            resetSelection();
+        } else if (inputHandler) {
+            resetSelection(host.selection.isEmpty());
+        }
+    };
+
+    var inputHandler = null;
+    this.setInputHandler = function(cb) {inputHandler = cb};
+    this.getInputHandler = function() {return inputHandler};
+    var afterContextMenu = false;
+    
+    var sendText = function(data) {
+        if (inputHandler) {
+            data = inputHandler(data);
+            inputHandler = null;
+        }
+        if (pasted) {
+            resetSelection();
+            if (data)
+                host.onPaste(data);
+            pasted = false;
+        } else if (data == PLACEHOLDER.charAt(0)) {
+            if (afterContextMenu)
+                host.execCommand("del", {source: "ace"});
+        } else {
+            if (data.substring(0, 2) == PLACEHOLDER)
+                data = data.substr(2);
+            else if (data.charAt(0) == PLACEHOLDER.charAt(0))
+                data = data.substr(1);
+            else if (data.charAt(data.length - 1) == PLACEHOLDER.charAt(0))
+                data = data.slice(0, -1);
+            // can happen if undo in textarea isn't stopped
+            if (data.charAt(data.length - 1) == PLACEHOLDER.charAt(0))
+                data = data.slice(0, -1);
+            
+            if (data)
+                host.onTextInput(data);
+        }
+        if (afterContextMenu)
+            afterContextMenu = false;
+    };
+    var onInput = function(e) {
+        // console.log("onInput", inComposition)
+        if (inComposition)
+            return;
+        var data = text.value;
+        sendText(data);
+        resetValue();
+    };
+
+    var onCut = function(e) {
+        var data = host.getCopyText();
+        if (!data) {
+            event.preventDefault(e);
+            return;
+        }
+
+        var clipboardData = e.clipboardData || window.clipboardData;
+
+        if (clipboardData && !BROKEN_SETDATA) {
+            // Safari 5 has clipboardData object, but does not handle setData()
+            var supported = clipboardData.setData("Text", data);
+            if (supported) {
+                host.onCut();
+                event.preventDefault(e);
+            }
+        }
+
+        if (!supported) {
+            cut = true;
+            text.value = data;
+            text.select();
+            setTimeout(function(){
+                cut = false;
+                resetValue();
+                resetSelection();
+                host.onCut();
+            });
+        }
+    };
+
+    var onCopy = function(e) {
+        var data = host.getCopyText();
+        if (!data) {
+            event.preventDefault(e);
+            return;
+        }
+
+        var clipboardData = e.clipboardData || window.clipboardData;
+        if (clipboardData && !BROKEN_SETDATA) {
+            // Safari 5 has clipboardData object, but does not handle setData()
+            var supported = clipboardData.setData("Text", data);
+            if (supported) {
+                host.onCopy();
+                event.preventDefault(e);
+            }
+        }
+        if (!supported) {
+            copied = true;
+            text.value = data;
+            text.select();
+            setTimeout(function(){
+                copied = false;
+                resetValue();
+                resetSelection();
+                host.onCopy();
+            });
+        }
+    };
+
+    var onPaste = function(e) {
+        var clipboardData = e.clipboardData || window.clipboardData;
+
+        if (clipboardData) {
+            var data = clipboardData.getData("Text");
+            if (data)
+                host.onPaste(data);
+            if (useragent.isIE)
+                setTimeout(resetSelection);
+            event.preventDefault(e);
+        }
+        else {
+            text.value = "";
+            pasted = true;
+        }
+    };
+
+    event.addCommandKeyListener(text, host.onCommandKey.bind(host));
+
+    event.addListener(text, "select", onSelect);
+
+    event.addListener(text, "input", onInput);
+
+    event.addListener(text, "cut", onCut);
+    event.addListener(text, "copy", onCopy);
+    event.addListener(text, "paste", onPaste);
+
+
+    // Opera has no clipboard events
+    if (!('oncut' in text) || !('oncopy' in text) || !('onpaste' in text)){
+        event.addListener(parentNode, "keydown", function(e) {
+            if ((useragent.isMac && !e.metaKey) || !e.ctrlKey)
+            return;
+
+            switch (e.keyCode) {
+                case 67:
+                    onCopy(e);
+                    break;
+                case 86:
+                    onPaste(e);
+                    break;
+                case 88:
+                    onCut(e);
+                    break;
+            }
+        });
+    }
+
+
+    // COMPOSITION
+    var onCompositionStart = function(e) {
+        if (inComposition) return;
+        // console.log("onCompositionStart", inComposition)
+        inComposition = {};
+        host.onCompositionStart();
+        setTimeout(onCompositionUpdate, 0);
+        host.on("mousedown", onCompositionEnd);
+        if (!host.selection.isEmpty()) {
+            host.insert("");
+            host.session.markUndoGroup();
+            host.selection.clearSelection();
+        }
+        host.session.markUndoGroup();
+    };
+
+    var onCompositionUpdate = function() {
+        // console.log("onCompositionUpdate", inComposition && JSON.stringify(text.value))
+        if (!inComposition) return;
+        var val = text.value.replace(/\x01/g, "");
+        if (inComposition.lastValue === val) return;
+        
+        host.onCompositionUpdate(val);
+        if (inComposition.lastValue)
+            host.undo();
+        inComposition.lastValue = val;
+        if (inComposition.lastValue) {
+            var r = host.selection.getRange();
+            host.insert(inComposition.lastValue);
+            host.session.markUndoGroup();
+            inComposition.range = host.selection.getRange();
+            host.selection.setRange(r);
+            host.selection.clearSelection();
+        }
+    };
+
+    var onCompositionEnd = function(e) {
+        // console.log("onCompositionEnd", inComposition &&inComposition.lastValue)
+        var c = inComposition;
+        inComposition = false;
+        var timer = setTimeout(function() {
+            timer = null;
+            var str = text.value.replace(/\x01/g, "");
+            // console.log(str, c.lastValue)
+            if (inComposition)
+                return
+            else if (str == c.lastValue)
+                resetValue();
+            else if (!c.lastValue && str) {
+                resetValue();
+                sendText(str);
+            }
+        });
+        inputHandler = function compositionInputHandler(str) {
+            // console.log("onCompositionEnd", str, c.lastValue)
+            if (timer)
+                clearTimeout(timer);
+            str = str.replace(/\x01/g, "");
+            if (str == c.lastValue)
+                return "";
+            if (c.lastValue && timer)
+                host.undo();
+            return str;
+        };
+        host.onCompositionEnd();
+        host.removeListener("mousedown", onCompositionEnd);
+        if (e.type == "compositionend" && c.range) {
+            host.selection.setRange(c.range);
+        }
+    };
+    
+    
+
+    var syncComposition = lang.delayedCall(onCompositionUpdate, 50);
+
+    event.addListener(text, "compositionstart", onCompositionStart);
+    if (useragent.isGecko) {
+        event.addListener(text, "text", function(){syncComposition.schedule()});
+    } else {
+        event.addListener(text, "keyup", function(){syncComposition.schedule()});
+        event.addListener(text, "keydown", function(){syncComposition.schedule()});
+    }
+    event.addListener(text, "compositionend", onCompositionEnd);
+
+    this.getElement = function() {
+        return text;
+    };
+
+    this.setReadOnly = function(readOnly) {
+       text.readOnly = readOnly;
+    };
+
+    this.onContextMenu = function(e) {
+        afterContextMenu = true;
+        if (!tempStyle)
+            tempStyle = text.style.cssText;
+
+        text.style.cssText = "z-index:100000;" + (useragent.isIE ? "opacity:0.1;" : "");
+
+        resetSelection(host.selection.isEmpty());
+        host._emit("nativecontextmenu", {target: host, domEvent: e});
+        var rect = host.container.getBoundingClientRect();
+        var style = dom.computedStyle(host.container);
+        var top = rect.top + (parseInt(style.borderTopWidth) || 0);
+        var left = rect.left + (parseInt(rect.borderLeftWidth) || 0);
+        var maxTop = rect.bottom - top - text.clientHeight;
+        var move = function(e) {
+            text.style.left = e.clientX - left - 2 + "px";
+            text.style.top = Math.min(e.clientY - top - 2, maxTop) + "px";
+        }; 
+        move(e);
+
+        if (e.type != "mousedown")
+            return;
+
+        if (host.renderer.$keepTextAreaAtCursor)
+            host.renderer.$keepTextAreaAtCursor = null;
+
+        // on windows context menu is opened after mouseup
+        if (useragent.isWin)
+            event.capture(host.container, move, onContextMenuClose);
+    };
+
+    this.onContextMenuClose = onContextMenuClose;
+    function onContextMenuClose() {
+        setTimeout(function () {
+            if (tempStyle) {
+                text.style.cssText = tempStyle;
+                tempStyle = '';
+            }
+            if (host.renderer.$keepTextAreaAtCursor == null) {
+                host.renderer.$keepTextAreaAtCursor = true;
+                host.renderer.$moveTextAreaToCursor();
+            }
+        }, 0);
+    }
+
+    // firefox fires contextmenu event after opening it
+    if (!useragent.isGecko || useragent.isMac) {
+        var onContextMenu = function(e) {
+            host.textInput.onContextMenu(e);
+            onContextMenuClose();
+        };
+        event.addListener(host.renderer.scroller, "contextmenu", onContextMenu);
+        event.addListener(text, "contextmenu", onContextMenu);
+    }
+};
+
+exports.TextInput = TextInput;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/keyboard/vim.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/keyboard/vim.js b/src/fauxton/assets/js/libs/ace/keyboard/vim.js
new file mode 100644
index 0000000..7af83b0
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/keyboard/vim.js
@@ -0,0 +1,195 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var cmds = require("./vim/commands");
+var coreCommands = cmds.coreCommands;
+var util = require("./vim/maps/util");
+var useragent = require("../lib/useragent");
+
+var startCommands = {
+    "i": {
+        command: coreCommands.start
+    },
+    "I": {
+        command: coreCommands.startBeginning
+    },
+    "a": {
+        command: coreCommands.append
+    },
+    "A": {
+        command: coreCommands.appendEnd
+    },
+    "ctrl-f": {
+        command: "gotopagedown"
+    },
+    "ctrl-b": {
+        command: "gotopageup"
+    }
+};
+
+exports.handler = {
+	$id: "ace/keyboard/vim",
+    // workaround for j not repeating with `defaults write -g ApplePressAndHoldEnabled -bool true`
+    handleMacRepeat: function(data, hashId, key) {
+        if (hashId == -1) {
+            // record key
+            data.inputChar = key;
+            data.lastEvent = "input";
+        } else if (data.inputChar && data.$lastHash == hashId && data.$lastKey == key) {
+            // check for repeated keypress 
+            if (data.lastEvent == "input") {
+                data.lastEvent = "input1";
+            } else if (data.lastEvent == "input1") {
+                // simulate textinput
+                return true;
+            }
+        } else {
+            // reset
+            data.$lastHash = hashId;
+            data.$lastKey = key;
+            data.lastEvent = "keypress";
+        }
+    },
+    // on mac, with some keyboard layouts (e.g swedish) ^ starts composition, we don't need it in normal mode
+    updateMacCompositionHandlers: function(editor, enable) {
+        var onCompositionUpdateOverride = function(text) {
+            if (util.currentMode !== "insert") {
+                var el = this.textInput.getElement();
+                el.blur();
+                el.focus();
+                el.value = text;
+            } else {
+                this.onCompositionUpdateOrig(text);
+            }
+        };
+        var onCompositionStartOverride = function(text) {
+            if (util.currentMode === "insert") {            
+                this.onCompositionStartOrig(text);
+            }
+        }
+        if (enable) {
+            if (!editor.onCompositionUpdateOrig) {
+                editor.onCompositionUpdateOrig = editor.onCompositionUpdate;
+                editor.onCompositionUpdate = onCompositionUpdateOverride;
+                editor.onCompositionStartOrig = editor.onCompositionStart;
+                editor.onCompositionStart = onCompositionStartOverride;
+            }
+        } else {
+            if (editor.onCompositionUpdateOrig) {
+                editor.onCompositionUpdate = editor.onCompositionUpdateOrig;
+                editor.onCompositionUpdateOrig = null;
+                editor.onCompositionStart = editor.onCompositionStartOrig;
+                editor.onCompositionStartOrig = null;
+            }
+        }
+    },
+
+    handleKeyboard: function(data, hashId, key, keyCode, e) {
+        // ignore command keys (shift, ctrl etc.)
+        if (hashId != 0 && (key == "" || key == "\x00"))
+            return null;
+        
+        var editor = data.editor;
+        
+        if (hashId == 1)
+            key = "ctrl-" + key;
+        if (key == "ctrl-c") {
+            if (!useragent.isMac && editor.getCopyText()) {
+                editor.once("copy", function() {
+                    if (data.state == "start")
+                        coreCommands.stop.exec(editor);
+                    else
+                        editor.selection.clearSelection();
+                });
+                return {command: "null", passEvent: true};
+            }
+            return {command: coreCommands.stop};            
+        } else if ((key == "esc" && hashId == 0) || key == "ctrl-[") {
+            return {command: coreCommands.stop};
+        } else if (data.state == "start") {
+            if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) {
+                hashId = -1;
+                key = data.inputChar;
+            }
+            
+            if (hashId == -1 || hashId == 1 || hashId == 0 && key.length > 1) {
+                if (cmds.inputBuffer.idle && startCommands[key])
+                    return startCommands[key];
+                cmds.inputBuffer.push(editor, key);
+                return {command: "null", passEvent: false}; 
+            } // if no modifier || shift: wait for input.
+            else if (key.length == 1 && (hashId == 0 || hashId == 4)) {
+                return {command: "null", passEvent: true};
+            } else if (key == "esc" && hashId == 0) {
+                return {command: coreCommands.stop};
+            }
+        } else {
+            if (key == "ctrl-w") {
+                return {command: "removewordleft"};
+            }
+        }
+    },
+
+    attach: function(editor) {
+        editor.on("click", exports.onCursorMove);
+        if (util.currentMode !== "insert")
+            cmds.coreCommands.stop.exec(editor);
+        editor.$vimModeHandler = this;
+        
+        this.updateMacCompositionHandlers(editor, true);
+    },
+
+    detach: function(editor) {
+        editor.removeListener("click", exports.onCursorMove);
+        util.noMode(editor);
+        util.currentMode = "normal";
+        this.updateMacCompositionHandlers(editor, false);
+    },
+
+    actions: cmds.actions,
+    getStatusText: function() {
+        if (util.currentMode == "insert")
+            return "INSERT";
+        if (util.onVisualMode)
+            return (util.onVisualLineMode ? "VISUAL LINE " : "VISUAL ") + cmds.inputBuffer.status;
+        return cmds.inputBuffer.status;
+    }
+};
+
+
+exports.onCursorMove = function(e) {
+    cmds.onCursorMove(e.editor, e);
+    exports.onCursorMove.scheduled = false;
+};
+
+});


[33/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_objectivec.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_objectivec.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_objectivec.json
new file mode 100644
index 0000000..c6582d2
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_objectivec.json
@@ -0,0 +1,792 @@
+[[
+   "start",
+  ["storage.type.objc","@"],
+  ["punctuation.definition.storage.type.objc","protocol"],
+  ["entity.name.type.objc"," Printing"],
+  ["text",": "],
+  ["entity.other.inherited-class.objc","someParent"]
+],[
+   "start",
+  ["meta.function.objc","-"],
+  ["paren.lparen","("],
+  ["storage.type","void"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["identifier","print"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["storage.type.objc","@end"]
+],[
+   "start"
+],[
+   "start",
+  ["storage.type.objc","@"],
+  ["punctuation.definition.storage.type.objc","interface"],
+  ["entity.name.type.objc"," Fraction"],
+  ["text",": "],
+  ["entity.other.inherited-class.objc","NSObject"],
+  ["text"," "],
+  ["keyword.operator","<"],
+  ["identifier","Printing"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["support.class.cocoa","NSCopying"],
+  ["keyword.operator",">"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["storage.type","int"],
+  ["text"," "],
+  ["identifier","numerator"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","    "],
+  ["storage.type","int"],
+  ["text"," "],
+  ["identifier","denominator"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["storage.type.objc","@end"]
+],[
+   "start"
+],[
+   "start",
+  ["string.begin.objc","@\""],
+  ["string","blah"],
+  ["invalid.illegal.unknown-escape.objc","\\8"],
+  ["punctuation.definition.string.end","\""],
+  ["text"," "],
+  ["string.begin.objc","@\""],
+  ["string","a"],
+  ["constant.character.escape.objc","\\222"],
+  ["string","sd"],
+  ["invalid.illegal.unknown-escape.objc","\\d"],
+  ["punctuation.definition.string.end","\""],
+  ["text"," "],
+  ["string.begin.objc","@\""],
+  ["constant.character.escape.objc","\\f"],
+  ["string","aw"],
+  ["constant.character.escape.objc","\\\"\\?"],
+  ["string"," "],
+  ["constant.character.escape.objc","\\'"],
+  ["string"," "],
+  ["constant.character.escape.objc","\\4"],
+  ["string"," n"],
+  ["constant.character.escape.objc","\\\\"],
+  ["punctuation.definition.string.end","\""],
+  ["text"," "],
+  ["string.begin.objc","@\""],
+  ["constant.character.escape.objc","\\56"],
+  ["punctuation.definition.string.end","\""]
+],[
+   "start",
+  ["string.begin.objc","@\""],
+  ["constant.character.escape.objc","\\xSF42"],
+  ["punctuation.definition.string.end","\""]
+],[
+   "start"
+],[
+   "start",
+  ["meta.function.objc","-"],
+  ["paren.lparen","("],
+  ["support.class.cocoa","NSDecimalNumber"],
+  ["keyword.operator","*"],
+  ["paren.rparen",")"],
+  ["identifier","addCount"],
+  ["punctuation.operator",":"],
+  ["paren.lparen","("],
+  ["storage.type.id.objc","id"],
+  ["paren.rparen",")"],
+  ["identifier","addObject"],
+  ["paren.lparen","{"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword.control","return"],
+  ["text"," "],
+  ["punctuation.section.scope.begin.objc","["],
+  ["identifier","count"],
+  ["text"," "],
+  ["support.function.any-method.objc","decimalNumberByAdding:"],
+  ["identifier","addObject"],
+  ["punctuation.operator","."],
+  ["identifier","count"],
+  ["paren.rparen","]"],
+  ["punctuation.operator",";"]
+],[
+   "start"
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["text","  "],
+  ["keyword.control.macro.objc","NS_DURING"],
+  ["text","  "],
+  ["keyword.control.macro.objc","NS_HANDLER"],
+  ["text"," "],
+  ["keyword.control.macro.objc","NS_ENDHANDLER"]
+],[
+   "start"
+],[
+   "start",
+  ["punctuation.definition.keyword.objc","@"],
+  ["keyword.control.exception.objc","try"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","   "],
+  ["keyword.control","if"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["identifier","argc"],
+  ["text"," "],
+  ["keyword.operator",">"],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["paren.rparen",")"],
+  ["text","    "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["punctuation.definition.keyword.objc","@"],
+  ["keyword.control.exception.objc","throw"],
+  ["text"," "],
+  ["punctuation.section.scope.begin.objc","["],
+  ["support.class.cocoa","NSException"],
+  ["text"," "],
+  ["support.function.any-method.objc","exceptionWithName:"],
+  ["string.begin.objc","@\""],
+  ["string","Throwing a test exception"],
+  ["punctuation.definition.string.end","\""],
+  ["text"," "],
+  ["identifier","reason"],
+  ["punctuation.operator",":"],
+  ["string.begin.objc","@\""],
+  ["string","Testing the @throw directive."],
+  ["punctuation.definition.string.end","\""],
+  ["text"," "],
+  ["identifier","userInfo"],
+  ["punctuation.operator",":"],
+  ["constant.language.objc","nil"],
+  ["paren.rparen","]"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","   "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["paren.rparen","}"],
+  ["text"," "]
+],[
+   "start",
+  ["punctuation.definition.keyword.objc","@"],
+  ["keyword.control.exception.objc","catch"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["storage.type.id.objc","id"],
+  ["text"," "],
+  ["identifier","theException"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["support.function.cocoa","NSLog"],
+  ["paren.lparen","("],
+  ["string.begin.objc","@\""],
+  ["string","%@"],
+  ["punctuation.definition.string.end","\""],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["identifier","theException"],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","result"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["text","  "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["paren.rparen","}"],
+  ["text"," "]
+],[
+   "start",
+  ["punctuation.definition.keyword.objc","@"],
+  ["keyword.control.exception.objc","finally"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["support.function.cocoa","NSLog"],
+  ["paren.lparen","("],
+  ["string.begin.objc","@\""],
+  ["string","This always happens."],
+  ["punctuation.definition.string.end","\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","result"],
+  ["text"," "],
+  ["keyword.operator","+="],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    "],
+  ["punctuation.definition.storage.modifier.objc","@"],
+  ["storage.modifier.objc","synchronized"],
+  ["paren.lparen","("],
+  ["identifier","lock"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","        "],
+  ["support.function.cocoa","NSLog"],
+  ["paren.lparen","("],
+  ["string.begin.objc","@\""],
+  ["string","Hello World"],
+  ["punctuation.definition.string.end","\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["storage.type","struct"],
+  ["text"," "],
+  ["paren.lparen","{"],
+  ["text"," "],
+  ["punctuation.definition.keyword.objc","@"],
+  ["keyword.other.objc","defs"],
+  ["paren.lparen","("],
+  ["text"," "],
+  ["support.class.cocoa","NSObject"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["storage.type","char"],
+  ["text"," "],
+  ["keyword.operator","*"],
+  ["identifier","enc1"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["punctuation.definition.keyword.objc","@"],
+  ["keyword.other.objc","encode"],
+  ["paren.lparen","("],
+  ["storage.type","int"],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "start"
+],[
+   "start",
+  ["text","         "],
+  ["storage.type.objc","IBOutlet"],
+  ["text","|"],
+  ["storage.type.objc","IBAction"],
+  ["text","|"],
+  ["storage.type.objc","BOOL"],
+  ["text","|"],
+  ["storage.type.objc","SEL"],
+  ["text","|"],
+  ["storage.type.id.objc","id"],
+  ["text","|"],
+  ["storage.type.objc","unichar"],
+  ["text","|"],
+  ["storage.type.objc","IMP"],
+  ["text","|"],
+  ["storage.type.objc","Class"],
+  ["text"," "]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["text"," "],
+  ["punctuation.definition.storage.type.objc","@"],
+  ["storage.type.objc","class"],
+  ["text"," "],
+  ["punctuation.definition.storage.type.objc","@"],
+  ["storage.type.objc","protocol"]
+],[
+   "start"
+],[
+   "start",
+  ["punctuation.definition.storage.modifier.objc","@"],
+  ["storage.modifier.objc","public"]
+],[
+   "start",
+  ["text","  "],
+  ["comment","// instance variables"]
+],[
+   "start",
+  ["punctuation.definition.storage.modifier.objc","@"],
+  ["storage.modifier.objc","package"]
+],[
+   "start",
+  ["text","  "],
+  ["comment","// instance variables"]
+],[
+   "start",
+  ["punctuation.definition.storage.modifier.objc","@"],
+  ["storage.modifier.objc","protected"]
+],[
+   "start",
+  ["text","  "],
+  ["comment","// instance variables"]
+],[
+   "start",
+  ["punctuation.definition.storage.modifier.objc","@"],
+  ["storage.modifier.objc","private"]
+],[
+   "start",
+  ["text","  "],
+  ["comment","// instance variables"]
+],[
+   "start"
+],[
+   "start",
+  ["text","  "],
+  ["constant.language.objc","YES"],
+  ["text"," "],
+  ["constant.language.objc","NO"],
+  ["text"," "],
+  ["constant.language.objc","Nil"],
+  ["text"," "],
+  ["constant.language.objc","nil"]
+],[
+   "start",
+  ["support.variable.foundation","NSApp"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["support.function.cocoa.leopard","NSRectToCGRect"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["identifier","Protocol"],
+  ["text"," "],
+  ["identifier","ProtocolFromString"],
+  ["punctuation.operator",":"],
+  ["string","\"NSTableViewDelegate\""],
+  ["paren.rparen","))"]
+],[
+   "start"
+],[
+   "start",
+  ["punctuation.section.scope.begin.objc","["],
+  ["identifier","SPPoint"],
+  ["text"," "],
+  ["support.function.any-method.objc","pointFromCGPoint:"],
+  ["identifier","self"],
+  ["punctuation.operator","."],
+  ["identifier","position"],
+  ["paren.rparen","]"]
+],[
+   "start"
+],[
+   "start",
+  ["support.function.cocoa","NSRoundDownToMultipleOfPageSize"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","#import"],
+  ["constant.other"," <stdio.h>"]
+],[
+   "start"
+],[
+   "start",
+  ["storage.type","int"],
+  ["text"," "],
+  ["identifier","main"],
+  ["paren.lparen","("],
+  ["text"," "],
+  ["storage.type","int"],
+  ["text"," "],
+  ["identifier","argc"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["storage.modifier","const"],
+  ["text"," "],
+  ["storage.type","char"],
+  ["text"," "],
+  ["keyword.operator","*"],
+  ["identifier","argv"],
+  ["punctuation.section.scope.begin.objc","["],
+  ["punctuation.section.scope.end.objc","]"],
+  ["text"," "],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["support.function.C99.c","printf"],
+  ["paren.lparen","("],
+  ["text"," "],
+  ["string","\"hello world\\n\""],
+  ["text"," "],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword.control","return"],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["support.class.cocoa","NSChangeSpelling"]
+],[
+   "start"
+],[
+   "start",
+  ["string.begin.objc","@\""],
+  ["string","0 != SUBQUERY(image, $x, 0 != SUBQUERY($x.bookmarkItems, $y, $y.@count == 0).@count).@count"],
+  ["punctuation.definition.string.end","\""]
+],[
+   "start"
+],[
+   "start",
+  ["punctuation.definition.storage.type.objc","@selector"],
+  ["punctuation","("],
+  ["support.function.any-method.name-of-parameter.objc","lowercaseString"],
+  ["punctuation",")"],
+  ["text"," "],
+  ["punctuation.definition.storage.type.objc","@selector"],
+  ["punctuation","("],
+  ["support.function.any-method.name-of-parameter.objc","uppercaseString:"],
+  ["punctuation",")"]
+],[
+   "start"
+],[
+   "start",
+  ["identifier","NSFetchRequest"],
+  ["text"," "],
+  ["keyword.operator","*"],
+  ["identifier","localRequest"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["punctuation.section.scope.begin.objc","[["],
+  ["identifier","NSFetchRequest"],
+  ["text"," "],
+  ["support.function.any-method.objc","alloc"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["identifier","init"],
+  ["paren.rparen","]"],
+  ["punctuation.operator",";"],
+  ["text","  "]
+],[
+   "start",
+  ["identifier","localRequest"],
+  ["punctuation.operator","."],
+  ["identifier","entity"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["punctuation.section.scope.begin.objc","["],
+  ["identifier","NSEntityDescription"],
+  ["text"," "],
+  ["support.function.any-method.objc","entityForName:"],
+  ["string.begin.objc","@\""],
+  ["string","VNSource"],
+  ["punctuation.definition.string.end","\""],
+  ["text"," "],
+  ["identifier","inManagedObjectContext"],
+  ["punctuation.operator",":"],
+  ["identifier","context"],
+  ["paren.rparen","]"],
+  ["punctuation.operator",";"],
+  ["text","  "]
+],[
+   "start",
+  ["identifier","localRequest"],
+  ["punctuation.operator","."],
+  ["identifier","sortDescriptors"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["punctuation.section.scope.begin.objc","["],
+  ["support.class.cocoa","NSArray"],
+  ["text"," "],
+  ["support.function.any-method.objc","arrayWithObject:"],
+  ["punctuation.section.scope.begin.objc","["],
+  ["support.class.cocoa","NSSortDescriptor"],
+  ["text"," "],
+  ["support.function.any-method.objc","sortDescriptorWithKey:"],
+  ["string.begin.objc","@\""],
+  ["string","resolution"],
+  ["punctuation.definition.string.end","\""],
+  ["text"," "],
+  ["identifier","ascending"],
+  ["punctuation.operator",":"],
+  ["constant.language.objc","YES"],
+  ["paren.rparen","]]"],
+  ["punctuation.operator",";"],
+  ["text","  "]
+],[
+   "start",
+  ["support.class.cocoa","NSPredicate"],
+  ["text"," "],
+  ["keyword.operator","*"],
+  ["identifier","predicate"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["punctuation.section.scope.begin.objc","["],
+  ["support.class.cocoa","NSPredicate"],
+  ["text"," "],
+  ["support.function.any-method.objc","predicateWithFormat:"],
+  ["string.begin.objc","@\""],
+  ["string","0 != SUBQUERY(image, $x, 0 != SUBQUERY($x.bookmarkItems, $y, $y.@count == 0).@count).@count"],
+  ["punctuation.definition.string.end","\""],
+  ["paren.rparen","]"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["punctuation.section.scope.begin.objc","["],
+  ["support.class.cocoa","NSPredicate"],
+  ["text"," "],
+  ["support.function.any-method.objc","predicateWithFormat:"],
+  ["paren.rparen","]"]
+],[
+   "start",
+  ["support.class.cocoa","NSString"],
+  ["text"," "],
+  ["keyword.operator","*"],
+  ["identifier","predicateString"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["punctuation.section.scope.begin.objc","["],
+  ["support.class.cocoa","NSString"],
+  ["text"," "],
+  ["support.function.any-method.objc","stringWithFormat:"],
+  ["string.begin.objc","@\""],
+  ["string","SELF beginsWith[cd] %@"],
+  ["punctuation.definition.string.end","\""],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["identifier","searchString"],
+  ["paren.rparen","]"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["support.class.cocoa","NSPredicate"],
+  ["text"," "],
+  ["keyword.operator","*"],
+  ["identifier","pred"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["punctuation.section.scope.begin.objc","["],
+  ["support.class.cocoa","NSPredicate"],
+  ["text"," "],
+  ["support.function.any-method.objc","predicateWithFormat:"],
+  ["identifier","predicateString"],
+  ["paren.rparen","]"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["support.class.cocoa","NSArray"],
+  ["text"," "],
+  ["keyword.operator","*"],
+  ["identifier","filteredKeys"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["punctuation.section.scope.begin.objc","[["],
+  ["identifier","myMutableDictionary"],
+  ["text"," "],
+  ["support.function.any-method.objc","allKeys"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["identifier","filteredArrayUsingPredicate"],
+  ["punctuation.operator",":"],
+  ["identifier","pred"],
+  ["paren.rparen","]"],
+  ["punctuation.operator",";"],
+  ["text"," "]
+],[
+   "start"
+],[
+   "start",
+  ["identifier","localRequest"],
+  ["punctuation.operator","."],
+  ["identifier","predicate"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["punctuation.section.scope.begin.objc","["],
+  ["support.class.cocoa","NSPredicate"],
+  ["text"," "],
+  ["support.function.any-method.objc","predicateWithFormat:"],
+  ["string.begin.objc","@\""],
+  ["string","whichChart = %@"],
+  ["punctuation.definition.string.end","\""],
+  ["text"," "],
+  ["identifier","argumentArray"],
+  ["punctuation.operator",":"],
+  ["text"," "],
+  ["identifier","listChartToDownload"],
+  ["paren.rparen","]"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["identifier","localRequest"],
+  ["punctuation.operator","."],
+  ["identifier","fetchBatchSize"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","100"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["identifier","arrayRequest"],
+  ["text","    "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["punctuation.section.scope.begin.objc","["],
+  ["identifier","context"],
+  ["text","  "],
+  ["support.function.any-method.objc","executeFetchRequest:"],
+  ["identifier","localRequest"],
+  ["text"," "],
+  ["identifier","error"],
+  ["punctuation.operator",":"],
+  ["keyword.operator","&"],
+  ["identifier","error1"],
+  ["paren.rparen","]"],
+  ["punctuation.operator",";"]
+],[
+   "start"
+],[
+   "start",
+  ["punctuation.section.scope.begin.objc","["],
+  ["identifier","localRequest"],
+  ["text","   "],
+  ["support.function.any-method.objc","release"],
+  ["paren.rparen","]"],
+  ["punctuation.operator",";"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","#ifndef"],
+  ["constant.other"," Nil"]
+],[
+   "start",
+  ["keyword","#define"],
+  ["constant.other"," Nil __DARWIN_NULL   "],
+  ["comment","/* id of Nil class */"]
+],[
+   "start",
+  ["keyword","#endif"]
+],[
+   "start"
+],[
+   "start",
+  ["storage.type.objc","@implementation"],
+  ["entity.name.type.objc"," MyObject"]
+],[
+   "start",
+  ["meta.function.objc","- "],
+  ["paren.lparen","("],
+  ["storage.type","unsigned"],
+  ["text"," "],
+  ["storage.type","int"],
+  ["paren.rparen",")"],
+  ["identifier","areaOfWidth"],
+  ["punctuation.operator",":"],
+  ["paren.lparen","("],
+  ["storage.type","unsigned"],
+  ["text"," "],
+  ["storage.type","int"],
+  ["paren.rparen",")"],
+  ["identifier","width"]
+],[
+   "start",
+  ["text","                "],
+  ["identifier","height"],
+  ["punctuation.operator",":"],
+  ["paren.lparen","("],
+  ["storage.type","unsigned"],
+  ["text"," "],
+  ["storage.type","int"],
+  ["paren.rparen",")"],
+  ["identifier","height"]
+],[
+   "start",
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword.control","return"],
+  ["text"," "],
+  ["identifier","width"],
+  ["keyword.operator","*"],
+  ["identifier","height"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["storage.type.objc","@end"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_ocaml.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_ocaml.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_ocaml.json
new file mode 100644
index 0000000..73e3cfc
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_ocaml.json
@@ -0,0 +1,200 @@
+[[
+   "comment",
+  ["comment","(*"]
+],[
+   "comment",
+  ["comment"," * Example of early return implementation taken from"]
+],[
+   "comment",
+  ["comment"," * http://ocaml.janestreet.com/?q=node/91"]
+],[
+   "start",
+  ["comment"," *)"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","let"],
+  ["text"," "],
+  ["identifier","with_return"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["keyword","type"],
+  ["text"," "],
+  ["identifier","t"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["identifier","f"],
+  ["text"," : "],
+  ["identifier","_"],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["identifier","t"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["keyword.operator","="]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","let"],
+  ["text"," "],
+  ["keyword","module"],
+  ["text"," "],
+  ["identifier","M"],
+  ["text"," "],
+  ["keyword.operator","="]
+],[
+   "start",
+  ["text","     "],
+  ["keyword","struct"],
+  ["text"," "],
+  ["keyword","exception"],
+  ["text"," "],
+  ["identifier","Return"],
+  ["text"," "],
+  ["keyword","of"],
+  ["text"," "],
+  ["identifier","t"],
+  ["text"," "],
+  ["keyword","end"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","in"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","let"],
+  ["text"," "],
+  ["identifier","return"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","{"],
+  ["text"," "],
+  ["identifier","return"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["keyword","fun"],
+  ["text"," "],
+  ["identifier","x"],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["support.function","raise"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["identifier","M"],
+  ["text","."],
+  ["identifier","Return"],
+  ["text"," "],
+  ["identifier","x"],
+  ["paren.rparen","))"],
+  ["text","; "],
+  ["paren.rparen","}"],
+  ["text"," "],
+  ["keyword","in"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","try"],
+  ["text"," "],
+  ["identifier","f"],
+  ["text"," "],
+  ["identifier","return"],
+  ["text"," "],
+  ["keyword","with"],
+  ["text"," "],
+  ["identifier","M"],
+  ["text","."],
+  ["identifier","Return"],
+  ["text"," "],
+  ["identifier","x"],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["identifier","x"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["comment","(* Function that uses the 'early return' functionality provided by `with_return` *)"]
+],[
+   "start",
+  ["keyword","let"],
+  ["text"," "],
+  ["identifier","sum_until_first_negative"],
+  ["text"," "],
+  ["support.function","list"],
+  ["text"," "],
+  ["keyword.operator","="]
+],[
+   "start",
+  ["text","  "],
+  ["identifier","with_return"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["keyword","fun"],
+  ["text"," "],
+  ["identifier","r"],
+  ["text"," "],
+  ["keyword.operator","->"]
+],[
+   "start",
+  ["text","    "],
+  ["support.function","List"],
+  ["text","."],
+  ["support.function","fold"],
+  ["text"," "],
+  ["support.function","list"],
+  ["text"," "],
+  ["keyword.operator","~"],
+  ["support.function","init"],
+  ["text",":"],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["keyword.operator","~"],
+  ["identifier","f"],
+  ["text",":"],
+  ["paren.lparen","("],
+  ["keyword","fun"],
+  ["text"," "],
+  ["identifier","acc"],
+  ["text"," "],
+  ["identifier","x"],
+  ["text"," "],
+  ["keyword.operator","->"]
+],[
+   "start",
+  ["text","      "],
+  ["keyword","if"],
+  ["text"," "],
+  ["identifier","x"],
+  ["text"," "],
+  ["keyword.operator",">="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["keyword","then"],
+  ["text"," "],
+  ["identifier","acc"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["identifier","x"],
+  ["text"," "],
+  ["keyword","else"],
+  ["text"," "],
+  ["identifier","r"],
+  ["text","."],
+  ["identifier","return"],
+  ["text"," "],
+  ["identifier","acc"],
+  ["paren.rparen","))"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_pascal.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_pascal.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_pascal.json
new file mode 100644
index 0000000..22c1f0c
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_pascal.json
@@ -0,0 +1,297 @@
+[[
+   "punctuation.definition.comment.pascal",
+  ["punctuation.definition.comment.pascal","(*"],
+  ["comment.block.pascal.one","****************************************************************************"]
+],[
+   "punctuation.definition.comment.pascal",
+  ["comment.block.pascal.one"," * A simple bubble sort program.  Reads integers, one per line, and prints   *"]
+],[
+   "punctuation.definition.comment.pascal",
+  ["comment.block.pascal.one"," * them out in sorted order.  Blows up if there are more than 49.            *"]
+],[
+   "start",
+  ["comment.block.pascal.one"," ****************************************************************************"],
+  ["punctuation.definition.comment.pascal","*)"]
+],[
+   "start",
+  ["keyword.control.pascal","PROGRAM"],
+  ["text"," Sort(input"],
+  ["keyword.operator",","],
+  ["text"," output)"],
+  ["keyword.operator",";"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword.control.pascal","CONST"]
+],[
+   "start",
+  ["text","        "],
+  ["punctuation.definition.comment.pascal","(*"],
+  ["comment.block.pascal.one"," Max array size. "],
+  ["punctuation.definition.comment.pascal","*)"]
+],[
+   "start",
+  ["text","        MaxElts "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric.pascal","50"],
+  ["keyword.operator",";"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword.control.pascal","TYPE"],
+  ["text"," "]
+],[
+   "start",
+  ["text","        "],
+  ["punctuation.definition.comment.pascal","(*"],
+  ["comment.block.pascal.one"," Type of the element array. "],
+  ["punctuation.definition.comment.pascal","*)"]
+],[
+   "start",
+  ["text","        IntArrType "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["keyword.control.pascal","ARRAY"],
+  ["text"," ["],
+  ["constant.numeric.pascal","1"],
+  ["text","..MaxElts] "],
+  ["keyword.control.pascal","OF"],
+  ["text"," Integer"],
+  ["keyword.operator",";"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    "],
+  ["keyword.control.pascal","VAR"]
+],[
+   "start",
+  ["text","        "],
+  ["punctuation.definition.comment.pascal","(*"],
+  ["comment.block.pascal.one"," Indexes, exchange temp, array size. "],
+  ["punctuation.definition.comment.pascal","*)"]
+],[
+   "start",
+  ["text","        i"],
+  ["keyword.operator",","],
+  ["text"," j"],
+  ["keyword.operator",","],
+  ["text"," tmp"],
+  ["keyword.operator",","],
+  ["text"," size: integer"],
+  ["keyword.operator",";"]
+],[
+   "start"
+],[
+   "start",
+  ["text","        "],
+  ["punctuation.definition.comment.pascal","(*"],
+  ["comment.block.pascal.one"," Array of ints "],
+  ["punctuation.definition.comment.pascal","*)"]
+],[
+   "start",
+  ["text","        arr: IntArrType"],
+  ["keyword.operator",";"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    "],
+  ["punctuation.definition.comment.pascal","(*"],
+  ["comment.block.pascal.one"," Read in the integers. "],
+  ["punctuation.definition.comment.pascal","*)"]
+],[
+   "start",
+  ["text","    "],
+  ["variable.pascal","PROCEDURE"],
+  ["text"," "],
+  ["storage.type.function.pascal","ReadArr"],
+  ["text","("],
+  ["keyword.control.pascal","VAR"],
+  ["text"," size: Integer"],
+  ["keyword.operator",";"],
+  ["text"," "],
+  ["keyword.control.pascal","VAR"],
+  ["text"," a: IntArrType)"],
+  ["keyword.operator",";"],
+  ["text"," "]
+],[
+   "start",
+  ["text","        "],
+  ["keyword.control.pascal","BEGIN"]
+],[
+   "start",
+  ["text","            size "],
+  ["keyword.operator",":="],
+  ["text"," "],
+  ["constant.numeric.pascal","1"],
+  ["keyword.operator",";"]
+],[
+   "start",
+  ["text","            "],
+  ["keyword.control.pascal","WHILE"],
+  ["text"," "],
+  ["keyword.control.pascal","NOT"],
+  ["text"," eof "],
+  ["keyword.control.pascal","DO"],
+  ["text"," "],
+  ["keyword.control.pascal","BEGIN"]
+],[
+   "start",
+  ["text","                readln(a[size])"],
+  ["keyword.operator",";"]
+],[
+   "start",
+  ["text","                "],
+  ["keyword.control.pascal","IF"],
+  ["text"," "],
+  ["keyword.control.pascal","NOT"],
+  ["text"," eof "],
+  ["keyword.control.pascal","THEN"],
+  ["text"," "]
+],[
+   "start",
+  ["text","                    size "],
+  ["keyword.operator",":="],
+  ["text"," size "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["constant.numeric.pascal","1"]
+],[
+   "start",
+  ["text","            "],
+  ["keyword.control.pascal","END"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword.control.pascal","END"],
+  ["keyword.operator",";"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    "],
+  ["keyword.control.pascal","BEGIN"]
+],[
+   "start",
+  ["text","        "],
+  ["punctuation.definition.comment.pascal","(*"],
+  ["comment.block.pascal.one"," Read "],
+  ["punctuation.definition.comment.pascal","*)"]
+],[
+   "start",
+  ["text","        ReadArr(size"],
+  ["keyword.operator",","],
+  ["text"," arr)"],
+  ["keyword.operator",";"]
+],[
+   "start"
+],[
+   "start",
+  ["text","        "],
+  ["punctuation.definition.comment.pascal","(*"],
+  ["comment.block.pascal.one"," Sort using bubble sort. "],
+  ["punctuation.definition.comment.pascal","*)"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword.control.pascal","FOR"],
+  ["text"," i "],
+  ["keyword.operator",":="],
+  ["text"," size "],
+  ["keyword.operator","-"],
+  ["text"," "],
+  ["constant.numeric.pascal","1"],
+  ["text"," DOWNTO "],
+  ["constant.numeric.pascal","1"],
+  ["text"," "],
+  ["keyword.control.pascal","DO"]
+],[
+   "start",
+  ["text","            "],
+  ["keyword.control.pascal","FOR"],
+  ["text"," j "],
+  ["keyword.operator",":="],
+  ["text"," "],
+  ["constant.numeric.pascal","1"],
+  ["text"," "],
+  ["keyword.control.pascal","TO"],
+  ["text"," i "],
+  ["keyword.control.pascal","DO"],
+  ["text"," "]
+],[
+   "start",
+  ["text","                "],
+  ["keyword.control.pascal","IF"],
+  ["text"," arr[j] > arr[j "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["constant.numeric.pascal","1"],
+  ["text","] "],
+  ["keyword.control.pascal","THEN"],
+  ["text"," "],
+  ["keyword.control.pascal","BEGIN"]
+],[
+   "start",
+  ["text","                    tmp "],
+  ["keyword.operator",":="],
+  ["text"," arr[j]"],
+  ["keyword.operator",";"]
+],[
+   "start",
+  ["text","                    arr[j] "],
+  ["keyword.operator",":="],
+  ["text"," arr[j "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["constant.numeric.pascal","1"],
+  ["text","]"],
+  ["keyword.operator",";"]
+],[
+   "start",
+  ["text","                    arr[j "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["constant.numeric.pascal","1"],
+  ["text","] "],
+  ["keyword.operator",":="],
+  ["text"," tmp"],
+  ["keyword.operator",";"]
+],[
+   "start",
+  ["text","                "],
+  ["keyword.control.pascal","END"],
+  ["keyword.operator",";"]
+],[
+   "start"
+],[
+   "start",
+  ["text","        "],
+  ["punctuation.definition.comment.pascal","(*"],
+  ["comment.block.pascal.one"," Print. "],
+  ["punctuation.definition.comment.pascal","*)"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword.control.pascal","FOR"],
+  ["text"," i "],
+  ["keyword.operator",":="],
+  ["text"," "],
+  ["constant.numeric.pascal","1"],
+  ["text"," "],
+  ["keyword.control.pascal","TO"],
+  ["text"," size "],
+  ["keyword.control.pascal","DO"]
+],[
+   "start",
+  ["text","            writeln(arr[i])"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword.control.pascal","END"],
+  ["text","."]
+],[
+   "start",
+  ["text","            "]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_perl.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_perl.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_perl.json
new file mode 100644
index 0000000..30bb39c
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_perl.json
@@ -0,0 +1,227 @@
+[[
+   "start",
+  ["comment","#!/usr/bin/perl"]
+],[
+   "block_comment",
+  ["comment.doc","=begin"]
+],[
+   "block_comment",
+  ["comment.doc"," perl example code for Ace"]
+],[
+   "start",
+  ["comment.doc","=cut"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","use"],
+  ["text"," "],
+  ["identifier","strict"],
+  ["text",";"]
+],[
+   "start",
+  ["keyword","use"],
+  ["text"," "],
+  ["identifier","warnings"],
+  ["text",";"]
+],[
+   "start",
+  ["keyword","my"],
+  ["text"," "],
+  ["identifier","$num_primes"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["text",";"]
+],[
+   "start",
+  ["keyword","my"],
+  ["text"," @"],
+  ["identifier","primes"],
+  ["text",";"]
+],[
+   "start"
+],[
+   "start",
+  ["comment","# Put 2 as the first prime so we won't have an empty array"]
+],[
+   "start",
+  ["identifier","$primes"],
+  ["lparen","["],
+  ["identifier","$num_primes"],
+  ["rparen","]"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["text",";"]
+],[
+   "start",
+  ["identifier","$num_primes"],
+  ["keyword.operator","++"],
+  ["text",";"]
+],[
+   "start"
+],[
+   "start",
+  ["identifier","MAIN_LOOP"],
+  ["text",":"]
+],[
+   "start",
+  ["keyword","for"],
+  ["text"," "],
+  ["keyword","my"],
+  ["text"," "],
+  ["identifier","$number_to_check"],
+  ["text"," "],
+  ["lparen","("],
+  ["constant.numeric","3"],
+  ["text"," "],
+  ["keyword.operator",".."],
+  ["text"," "],
+  ["constant.numeric","200"],
+  ["rparen",")"]
+],[
+   "start",
+  ["lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","for"],
+  ["text"," "],
+  ["keyword","my"],
+  ["text"," "],
+  ["identifier","$p"],
+  ["text"," "],
+  ["lparen","("],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["keyword.operator",".."],
+  ["text"," "],
+  ["lparen","("],
+  ["identifier","$num_primes"],
+  ["constant.numeric","-1"],
+  ["rparen","))"]
+],[
+   "start",
+  ["text","    "],
+  ["lparen","{"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","if"],
+  ["text"," "],
+  ["lparen","("],
+  ["identifier","$number_to_check"],
+  ["text"," "],
+  ["keyword.operator","%"],
+  ["text"," "],
+  ["identifier","$primes"],
+  ["lparen","["],
+  ["identifier","$p"],
+  ["rparen","]"],
+  ["text"," "],
+  ["keyword.operator","=="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["rparen",")"]
+],[
+   "start",
+  ["text","        "],
+  ["lparen","{"]
+],[
+   "start",
+  ["text","            "],
+  ["keyword","next"],
+  ["text"," "],
+  ["identifier","MAIN_LOOP"],
+  ["text",";"]
+],[
+   "start",
+  ["text","        "],
+  ["rparen","}"]
+],[
+   "start",
+  ["text","    "],
+  ["rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    "],
+  ["comment","# If we reached this point it means $number_to_check is not"]
+],[
+   "start",
+  ["text","    "],
+  ["comment","# divisable by any prime number that came before it."]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","$primes"],
+  ["lparen","["],
+  ["identifier","$num_primes"],
+  ["rparen","]"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","$number_to_check"],
+  ["text",";"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","$num_primes"],
+  ["keyword.operator","++"],
+  ["text",";"]
+],[
+   "start",
+  ["rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","for"],
+  ["text"," "],
+  ["keyword","my"],
+  ["text"," "],
+  ["identifier","$p"],
+  ["text"," "],
+  ["lparen","("],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["keyword.operator",".."],
+  ["text"," "],
+  ["lparen","("],
+  ["identifier","$num_primes"],
+  ["constant.numeric","-1"],
+  ["rparen","))"]
+],[
+   "start",
+  ["lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["support.function","print"],
+  ["text"," "],
+  ["identifier","$primes"],
+  ["lparen","["],
+  ["identifier","$p"],
+  ["rparen","]"],
+  ["keyword.operator",","],
+  ["text"," "],
+  ["string","\", \""],
+  ["text",";"]
+],[
+   "start",
+  ["rparen","}"]
+],[
+   "start",
+  ["support.function","print"],
+  ["text"," "],
+  ["string","\"\\n\""],
+  ["text",";"]
+],[
+   "start"
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_pgsql.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_pgsql.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_pgsql.json
new file mode 100644
index 0000000..ded4bb8
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_pgsql.json
@@ -0,0 +1,735 @@
+[[
+   "start"
+],[
+   "start",
+  ["keyword.statementBegin","BEGIN"],
+  ["statementEnd",";"]
+],[
+   "start"
+],[
+   "doc-start",
+  ["comment.doc","/**"]
+],[
+   "doc-start",
+  ["comment.doc","* Samples from PostgreSQL src/tutorial/basics.source"]
+],[
+   "start",
+  ["comment.doc","*/"]
+],[
+   "statement",
+  ["keyword.statementBegin","CREATE"],
+  ["text"," "],
+  ["keyword","TABLE"],
+  ["text"," "],
+  ["identifier","weather"],
+  ["text"," "],
+  ["paren.lparen","("]
+],[
+   "statement",
+  ["text","\t"],
+  ["identifier","city"],
+  ["text","\t\t"],
+  ["keyword","varchar"],
+  ["paren.lparen","("],
+  ["constant.numeric","80"],
+  ["paren.rparen",")"],
+  ["text",","]
+],[
+   "statement",
+  ["text","\t"],
+  ["identifier","temp_lo"],
+  ["text","\t\t"],
+  ["keyword","int"],
+  ["text",",\t\t"],
+  ["comment","-- low temperature"]
+],[
+   "statement",
+  ["text","\t"],
+  ["identifier","temp_hi"],
+  ["text","\t\t"],
+  ["keyword","int"],
+  ["text",",\t\t"],
+  ["comment","-- high temperature"]
+],[
+   "statement",
+  ["text","\t"],
+  ["identifier","prcp"],
+  ["text","\t\t"],
+  ["keyword","real"],
+  ["text",",\t\t"],
+  ["comment","-- precipitation"]
+],[
+   "statement",
+  ["text","\t"],
+  ["variable.language","\"date\""],
+  ["text","\t\t"],
+  ["keyword","date"]
+],[
+   "start",
+  ["paren.rparen",")"],
+  ["statementEnd",";"]
+],[
+   "start"
+],[
+   "statement",
+  ["keyword.statementBegin","CREATE"],
+  ["text"," "],
+  ["keyword","TABLE"],
+  ["text"," "],
+  ["identifier","cities"],
+  ["text"," "],
+  ["paren.lparen","("]
+],[
+   "statement",
+  ["text","\t"],
+  ["keyword","name"],
+  ["text","\t\t"],
+  ["keyword","varchar"],
+  ["paren.lparen","("],
+  ["constant.numeric","80"],
+  ["paren.rparen",")"],
+  ["text",","]
+],[
+   "statement",
+  ["text","\t"],
+  ["keyword","location"],
+  ["text","\t"],
+  ["keyword","point"]
+],[
+   "start",
+  ["paren.rparen",")"],
+  ["statementEnd",";"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "statement",
+  ["keyword.statementBegin","INSERT"],
+  ["text"," "],
+  ["keyword","INTO"],
+  ["text"," "],
+  ["identifier","weather"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","VALUES"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["string","'San Francisco'"],
+  ["text",", "],
+  ["constant.numeric","46"],
+  ["text",", "],
+  ["constant.numeric","50"],
+  ["text",", "],
+  ["constant.numeric","0.25"],
+  ["text",", "],
+  ["string","'1994-11-27'"],
+  ["paren.rparen",")"],
+  ["statementEnd",";"]
+],[
+   "start"
+],[
+   "statement",
+  ["keyword.statementBegin","INSERT"],
+  ["text"," "],
+  ["keyword","INTO"],
+  ["text"," "],
+  ["identifier","cities"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","VALUES"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["string","'San Francisco'"],
+  ["text",", "],
+  ["string","'(-194.0, 53.0)'"],
+  ["paren.rparen",")"],
+  ["statementEnd",";"]
+],[
+   "start"
+],[
+   "statement",
+  ["keyword.statementBegin","INSERT"],
+  ["text"," "],
+  ["keyword","INTO"],
+  ["text"," "],
+  ["identifier","weather"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["identifier","city"],
+  ["text",", "],
+  ["identifier","temp_lo"],
+  ["text",", "],
+  ["identifier","temp_hi"],
+  ["text",", "],
+  ["identifier","prcp"],
+  ["text",", "],
+  ["variable.language","\"date\""],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","VALUES"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["string","'San Francisco'"],
+  ["text",", "],
+  ["constant.numeric","43"],
+  ["text",", "],
+  ["constant.numeric","57"],
+  ["text",", "],
+  ["constant.numeric","0.0"],
+  ["text",", "],
+  ["string","'1994-11-29'"],
+  ["paren.rparen",")"],
+  ["statementEnd",";"]
+],[
+   "start"
+],[
+   "statement",
+  ["keyword.statementBegin","INSERT"],
+  ["text"," "],
+  ["keyword","INTO"],
+  ["text"," "],
+  ["identifier","weather"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["keyword","date"],
+  ["text",", "],
+  ["identifier","city"],
+  ["text",", "],
+  ["identifier","temp_hi"],
+  ["text",", "],
+  ["identifier","temp_lo"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","VALUES"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["string","'1994-11-29'"],
+  ["text",", "],
+  ["string","'Hayward'"],
+  ["text",", "],
+  ["constant.numeric","54"],
+  ["text",", "],
+  ["constant.numeric","37"],
+  ["paren.rparen",")"],
+  ["statementEnd",";"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["keyword.statementBegin","SELECT"],
+  ["text"," "],
+  ["identifier","city"],
+  ["text",", "],
+  ["paren.lparen","("],
+  ["identifier","temp_hi"],
+  ["keyword.operator","+"],
+  ["identifier","temp_lo"],
+  ["paren.rparen",")"],
+  ["keyword.operator","/"],
+  ["constant.numeric","2"],
+  ["text"," "],
+  ["keyword","AS"],
+  ["text"," "],
+  ["identifier","temp_avg"],
+  ["text",", "],
+  ["variable.language","\"date\""],
+  ["text"," "],
+  ["keyword","FROM"],
+  ["text"," "],
+  ["identifier","weather"],
+  ["statementEnd",";"]
+],[
+   "start"
+],[
+   "statement",
+  ["keyword.statementBegin","SELECT"],
+  ["text"," "],
+  ["identifier","city"],
+  ["text",", "],
+  ["identifier","temp_lo"],
+  ["text",", "],
+  ["identifier","temp_hi"],
+  ["text",", "],
+  ["identifier","prcp"],
+  ["text",", "],
+  ["variable.language","\"date\""],
+  ["text",", "],
+  ["keyword","location"]
+],[
+   "statement",
+  ["text","    "],
+  ["keyword","FROM"],
+  ["text"," "],
+  ["identifier","weather"],
+  ["text",", "],
+  ["identifier","cities"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","WHERE"],
+  ["text"," "],
+  ["identifier","city"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["keyword","name"],
+  ["statementEnd",";"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start"
+],[
+   "doc-start",
+  ["comment.doc","/**"]
+],[
+   "doc-start",
+  ["comment.doc","* Dollar quotes starting at the end of the line are colored as SQL unless"]
+],[
+   "doc-start",
+  ["comment.doc","* a special language tag is used. Pearl and Python are currently implemented"]
+],[
+   "doc-start",
+  ["comment.doc","* but lots of others are possible."]
+],[
+   "start",
+  ["comment.doc","*/"]
+],[
+   "statement",
+  ["keyword.statementBegin","create"],
+  ["text"," "],
+  ["keyword","or"],
+  ["text"," "],
+  ["keyword","replace"],
+  ["text"," "],
+  ["keyword","function"],
+  ["text"," "],
+  ["identifier","blob_content_chunked"],
+  ["paren.lparen","("]
+],[
+   "statement",
+  ["text","    "],
+  ["keyword","in"],
+  ["text"," "],
+  ["identifier","p_data"],
+  ["text"," "],
+  ["keyword","bytea"],
+  ["text",", "]
+],[
+   "statement",
+  ["text","    "],
+  ["keyword","in"],
+  ["text"," "],
+  ["identifier","p_chunk"],
+  ["text"," "],
+  ["keyword","integer"],
+  ["paren.rparen",")"]
+],[
+   "dollarSql",
+  ["keyword","returns"],
+  ["text"," "],
+  ["keyword","setof"],
+  ["text"," "],
+  ["keyword","bytea"],
+  ["text"," "],
+  ["keyword","as"],
+  ["text"," "],
+  ["string","$$"]
+],[
+   "dollarSql",
+  ["comment","-- Still SQL comments"]
+],[
+   "dollarSql",
+  ["keyword","declare"]
+],[
+   "dollarSql",
+  ["text","\t"],
+  ["identifier","v_size"],
+  ["text"," "],
+  ["keyword","integer"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["support.function","octet_length"],
+  ["paren.lparen","("],
+  ["identifier","p_data"],
+  ["paren.rparen",")"],
+  ["text",";"]
+],[
+   "dollarSql",
+  ["keyword","begin"]
+],[
+   "dollarSql",
+  ["text","\t"],
+  ["keyword","for"],
+  ["text"," "],
+  ["identifier","i"],
+  ["text"," "],
+  ["keyword","in"],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["text",".."],
+  ["identifier","v_size"],
+  ["text"," "],
+  ["keyword","by"],
+  ["text"," "],
+  ["identifier","p_chunk"],
+  ["text"," "],
+  ["identifier","loop"]
+],[
+   "dollarSql",
+  ["text","\t\t"],
+  ["identifier","return"],
+  ["text"," "],
+  ["keyword","next"],
+  ["text"," "],
+  ["keyword","substring"],
+  ["paren.lparen","("],
+  ["identifier","p_data"],
+  ["text"," "],
+  ["keyword","from"],
+  ["text"," "],
+  ["identifier","i"],
+  ["text"," "],
+  ["keyword","for"],
+  ["text"," "],
+  ["identifier","p_chunk"],
+  ["paren.rparen",")"],
+  ["text",";"]
+],[
+   "dollarSql",
+  ["text","\t"],
+  ["keyword","end"],
+  ["text"," "],
+  ["identifier","loop"],
+  ["text",";"]
+],[
+   "dollarSql",
+  ["keyword","end"],
+  ["text",";"]
+],[
+   "start",
+  ["string","$$"],
+  ["text"," "],
+  ["keyword","language"],
+  ["text"," "],
+  ["identifier","plpgsql"],
+  ["text"," "],
+  ["keyword","stable"],
+  ["statementEnd",";"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["comment","-- pl/perl"]
+],[
+   "perl-start",
+  ["keyword.statementBegin","CREATE"],
+  ["text"," "],
+  ["keyword","FUNCTION"],
+  ["text"," "],
+  ["identifier","perl_max"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["keyword","integer"],
+  ["text",", "],
+  ["keyword","integer"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["keyword","RETURNS"],
+  ["text"," "],
+  ["keyword","integer"],
+  ["text"," "],
+  ["keyword","AS"],
+  ["text"," "],
+  ["string","$perl$"]
+],[
+   "perl-start",
+  ["text","    "],
+  ["comment","# perl comment..."]
+],[
+   "perl-start",
+  ["text","    "],
+  ["keyword","my"],
+  ["text"," "],
+  ["lparen","("],
+  ["identifier","$x"],
+  ["keyword.operator",","],
+  ["identifier","$y"],
+  ["rparen",")"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," @"],
+  ["identifier","_"],
+  ["text",";"]
+],[
+   "perl-start",
+  ["text","    "],
+  ["keyword","if"],
+  ["text"," "],
+  ["lparen","("],
+  ["keyword.operator","!"],
+  ["text"," "],
+  ["support.function","defined"],
+  ["text"," "],
+  ["identifier","$x"],
+  ["rparen",")"],
+  ["text"," "],
+  ["lparen","{"]
+],[
+   "perl-start",
+  ["text","        "],
+  ["keyword","if"],
+  ["text"," "],
+  ["lparen","("],
+  ["keyword.operator","!"],
+  ["text"," "],
+  ["support.function","defined"],
+  ["text"," "],
+  ["identifier","$y"],
+  ["rparen",")"],
+  ["text"," "],
+  ["lparen","{"],
+  ["text"," "],
+  ["support.function","return"],
+  ["text"," "],
+  ["support.function","undef"],
+  ["text","; "],
+  ["rparen","}"]
+],[
+   "perl-start",
+  ["text","        "],
+  ["support.function","return"],
+  ["text"," "],
+  ["identifier","$y"],
+  ["text",";"]
+],[
+   "perl-start",
+  ["text","    "],
+  ["rparen","}"]
+],[
+   "perl-start",
+  ["text","    "],
+  ["keyword","if"],
+  ["text"," "],
+  ["lparen","("],
+  ["keyword.operator","!"],
+  ["text"," "],
+  ["support.function","defined"],
+  ["text"," "],
+  ["identifier","$y"],
+  ["rparen",")"],
+  ["text"," "],
+  ["lparen","{"],
+  ["text"," "],
+  ["support.function","return"],
+  ["text"," "],
+  ["identifier","$x"],
+  ["text","; "],
+  ["rparen","}"]
+],[
+   "perl-start",
+  ["text","    "],
+  ["keyword","if"],
+  ["text"," "],
+  ["lparen","("],
+  ["identifier","$x"],
+  ["text"," "],
+  ["keyword.operator",">"],
+  ["text"," "],
+  ["identifier","$y"],
+  ["rparen",")"],
+  ["text"," "],
+  ["lparen","{"],
+  ["text"," "],
+  ["support.function","return"],
+  ["text"," "],
+  ["identifier","$x"],
+  ["text","; "],
+  ["rparen","}"]
+],[
+   "perl-start",
+  ["text","    "],
+  ["support.function","return"],
+  ["text"," "],
+  ["identifier","$y"],
+  ["text",";"]
+],[
+   "start",
+  ["string","$perl$"],
+  ["text"," "],
+  ["keyword","LANGUAGE"],
+  ["text"," "],
+  ["identifier","plperl"],
+  ["statementEnd",";"]
+],[
+   "start"
+],[
+   "start",
+  ["comment","-- pl/python"]
+],[
+   "python-start",
+  ["keyword.statementBegin","CREATE"],
+  ["text"," "],
+  ["keyword","FUNCTION"],
+  ["text"," "],
+  ["identifier","usesavedplan"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["keyword","RETURNS"],
+  ["text"," "],
+  ["keyword","trigger"],
+  ["text"," "],
+  ["keyword","AS"],
+  ["text"," "],
+  ["string","$python$"]
+],[
+   "python-start",
+  ["text","    "],
+  ["comment","# python comment..."]
+],[
+   "python-start",
+  ["text","    "],
+  ["keyword","if"],
+  ["text"," "],
+  ["identifier","SD"],
+  ["text","."],
+  ["identifier","has_key"],
+  ["paren.lparen","("],
+  ["string","\"plan\""],
+  ["paren.rparen",")"],
+  ["text",":"]
+],[
+   "python-start",
+  ["text","        "],
+  ["identifier","plan"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","SD"],
+  ["paren.lparen","["],
+  ["string","\"plan\""],
+  ["paren.rparen","]"]
+],[
+   "python-start",
+  ["text","    "],
+  ["keyword","else"],
+  ["text",":"]
+],[
+   "python-start",
+  ["text","        "],
+  ["identifier","plan"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","plpy"],
+  ["text","."],
+  ["identifier","prepare"],
+  ["paren.lparen","("],
+  ["string","\"SELECT 1\""],
+  ["paren.rparen",")"]
+],[
+   "python-start",
+  ["text","        "],
+  ["identifier","SD"],
+  ["paren.lparen","["],
+  ["string","\"plan\""],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","plan"]
+],[
+   "start",
+  ["string","$python$"],
+  ["text"," "],
+  ["keyword","LANGUAGE"],
+  ["text"," "],
+  ["identifier","plpythonu"],
+  ["statementEnd",";"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["comment","-- psql commands"]
+],[
+   "start",
+  ["support.buildin","\\df cash*"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["comment","-- Some string samples."]
+],[
+   "start",
+  ["keyword.statementBegin","select"],
+  ["text"," "],
+  ["string","'don''t do it now;'"],
+  ["text"," "],
+  ["keyword.operator","||"],
+  ["text"," "],
+  ["string","'maybe later'"],
+  ["statementEnd",";"]
+],[
+   "start",
+  ["keyword.statementBegin","select"],
+  ["text"," "],
+  ["identifier","E"],
+  ["string","'dont\\'t do it'"],
+  ["statementEnd",";"]
+],[
+   "start",
+  ["keyword.statementBegin","select"],
+  ["text"," "],
+  ["support.function","length"],
+  ["paren.lparen","("],
+  ["string","'some other''s stuff'"],
+  ["text"," "],
+  ["keyword.operator","||"],
+  ["text"," "],
+  ["string","$$cat in hat's stuff $$"],
+  ["paren.rparen",")"],
+  ["statementEnd",";"]
+],[
+   "start"
+],[
+   "dollarStatementString",
+  ["keyword.statementBegin","select"],
+  ["text"," "],
+  ["string","$$ strings"]
+],[
+   "dollarStatementString",
+  ["string","over multiple "]
+],[
+   "dollarStatementString",
+  ["string","lines - use dollar quotes"]
+],[
+   "start",
+  ["string","$$"],
+  ["statementEnd",";"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword.statementBegin","END"],
+  ["statementEnd",";"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_php.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_php.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_php.json
new file mode 100644
index 0000000..d8a41ee
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_php.json
@@ -0,0 +1,134 @@
+[[
+   "php-start",
+  ["support.php_tag","<?php"]
+],[
+   "php-start"
+],[
+   "php-start",
+  ["keyword","function"],
+  ["text"," "],
+  ["identifier","nfact"],
+  ["paren.lparen","("],
+  ["variable","$n"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "php-start",
+  ["text","    "],
+  ["keyword","if"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable","$n"],
+  ["text"," "],
+  ["keyword.operator","=="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "php-start",
+  ["text","        "],
+  ["support.function","return"],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["text",";"]
+],[
+   "php-start",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "php-start",
+  ["text","    "],
+  ["keyword","else"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "php-start",
+  ["text","        "],
+  ["support.function","return"],
+  ["text"," "],
+  ["variable","$n"],
+  ["text"," "],
+  ["keyword.operator","*"],
+  ["text"," "],
+  ["identifier","nfact"],
+  ["paren.lparen","("],
+  ["variable","$n"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["paren.rparen",")"],
+  ["text",";"]
+],[
+   "php-start",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "php-start",
+  ["paren.rparen","}"]
+],[
+   "php-start"
+],[
+   "php-start",
+  ["support.function","echo"],
+  ["text"," "],
+  ["string","\""],
+  ["constant.language.escape","\\n\\n"],
+  ["string","Please enter a whole number ... \""],
+  ["text",";"]
+],[
+   "php-start",
+  ["variable","$num"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["support.function","trim"],
+  ["paren.lparen","("],
+  ["support.function","fgets"],
+  ["paren.lparen","("],
+  ["constant.language","STDIN"],
+  ["paren.rparen","))"],
+  ["text",";"]
+],[
+   "php-start"
+],[
+   "php-start",
+  ["comment","// ===== PROCESS - Determing the factorial of the input number ====="]
+],[
+   "php-start",
+  ["variable","$output"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["string","\""],
+  ["constant.language.escape","\\n\\n"],
+  ["string","Factorial \""],
+  ["text"," . "],
+  ["variable","$num"],
+  ["text"," . "],
+  ["string","\" = \""],
+  ["text"," . "],
+  ["identifier","nfact"],
+  ["paren.lparen","("],
+  ["variable","$num"],
+  ["paren.rparen",")"],
+  ["text"," . "],
+  ["string","\""],
+  ["constant.language.escape","\\n\\n"],
+  ["string","\""],
+  ["text",";"]
+],[
+   "php-start",
+  ["support.function","echo"],
+  ["text"," "],
+  ["variable","$output"],
+  ["text",";"]
+],[
+   "php-start"
+],[
+   "start",
+  ["support.php_tag","?>"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_powershell.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_powershell.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_powershell.json
new file mode 100644
index 0000000..43b77db
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_powershell.json
@@ -0,0 +1,184 @@
+[[
+   "start",
+  ["comment","# This is a simple comment"]
+],[
+   "start",
+  ["keyword","function"],
+  ["text"," "],
+  ["identifier","Hello"],
+  ["lparen","("],
+  ["variable.instance","$name"],
+  ["rparen",")"],
+  ["text"," "],
+  ["lparen","{"]
+],[
+   "start",
+  ["text","  "],
+  ["identifier","Write-host"],
+  ["text"," "],
+  ["string","\"Hello $name\""]
+],[
+   "start",
+  ["rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","function"],
+  ["text"," "],
+  ["identifier","add"],
+  ["lparen","("],
+  ["variable.instance","$left"],
+  ["text",", "],
+  ["variable.instance","$right"],
+  ["keyword.operator","="],
+  ["constant.numeric","4"],
+  ["rparen",")"],
+  ["text"," "],
+  ["lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","if"],
+  ["text"," "],
+  ["lparen","("],
+  ["variable.instance","$right"],
+  ["text"," "],
+  ["keyword.operator","-ne"],
+  ["text"," "],
+  ["constant.numeric","4"],
+  ["rparen",")"],
+  ["text"," "],
+  ["lparen","{"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","return"],
+  ["text"," "],
+  ["variable.instance","$left"]
+],[
+   "start",
+  ["text","    "],
+  ["rparen","}"],
+  ["text"," "],
+  ["keyword","elseif"],
+  ["text"," "],
+  ["lparen","("],
+  ["variable.instance","$left"],
+  ["text"," "],
+  ["keyword.operator","-eq"],
+  ["text"," "],
+  ["constant.language","$null"],
+  ["text"," "],
+  ["keyword.operator","-and"],
+  ["text"," "],
+  ["variable.instance","$right"],
+  ["text"," "],
+  ["keyword.operator","-eq"],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["rparen",")"],
+  ["text"," "],
+  ["lparen","{"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","return"],
+  ["text"," "],
+  ["constant.numeric","3"]
+],[
+   "start",
+  ["text","    "],
+  ["rparen","}"],
+  ["text"," "],
+  ["keyword","else"],
+  ["text"," "],
+  ["lparen","{"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","return"],
+  ["text"," "],
+  ["constant.numeric","2"]
+],[
+   "start",
+  ["text","    "],
+  ["rparen","}"]
+],[
+   "start",
+  ["rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["variable.instance","$number"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["text",";"]
+],[
+   "start",
+  ["variable.instance","$number"],
+  ["text"," "],
+  ["keyword.operator","+="],
+  ["text"," "],
+  ["constant.numeric","3"]
+],[
+   "start"
+],[
+   "start",
+  ["support.function","Write-Host"],
+  ["text"," "],
+  ["identifier","Hello"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["identifier","name"],
+  ["text"," "],
+  ["string","\"World\""]
+],[
+   "start"
+],[
+   "start",
+  ["variable.instance","$an_array"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," @"],
+  ["lparen","("],
+  ["constant.numeric","1"],
+  ["text",", "],
+  ["constant.numeric","2"],
+  ["text",", "],
+  ["constant.numeric","3"],
+  ["rparen",")"]
+],[
+   "start",
+  ["variable.instance","$a_hash"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," @"],
+  ["lparen","{"],
+  ["string","\"something\""],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["string","\"something else\""],
+  ["rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword.operator","&"],
+  ["text"," "],
+  ["identifier","notepad"],
+  ["text"," .\\"],
+  ["identifier","readme"],
+  ["text","."],
+  ["identifier","md"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_prolog.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_prolog.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_prolog.json
new file mode 100644
index 0000000..e42b65b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_prolog.json
@@ -0,0 +1,265 @@
+[[
+   "start",
+  ["entity.name.function.fact.prolog","partition"],
+  ["punctuation.begin.fact.parameters.prolog","("],
+  ["punctuation.begin.list.prolog","["],
+  ["punctuation.end.list.prolog","]"],
+  ["punctuation.separator.parameters.prolog",","],
+  ["meta.fact.prolog"," "],
+  ["variable.language.anonymous.prolog","_"],
+  ["punctuation.separator.parameters.prolog",","],
+  ["meta.fact.prolog"," "],
+  ["punctuation.begin.list.prolog","["],
+  ["punctuation.end.list.prolog","]"],
+  ["punctuation.separator.parameters.prolog",","],
+  ["meta.fact.prolog"," "],
+  ["punctuation.begin.list.prolog","["],
+  ["punctuation.end.list.prolog","]"],
+  ["punctuation.end.fact.parameters.prolog",")"],
+  ["punctuation.end.fact.prolog","."]
+],[
+   ["keyword.operator.definition.prolog","meta.rule.prolog"],
+  ["entity.name.function.rule.prolog","partition"],
+  ["punctuation.rule.parameters.begin.prolog","("],
+  ["punctuation.begin.list.prolog","["],
+  ["variable.other.prolog","X"],
+  ["punctuation.concat.list.prolog","|"],
+  ["variable.other.prolog","Xs"],
+  ["punctuation.end.list.prolog","]"],
+  ["punctuation.separator.parameters.prolog",","],
+  ["meta.rule.parameters.prolog"," "],
+  ["variable.parameter.prolog","Pivot"],
+  ["punctuation.separator.parameters.prolog",","],
+  ["meta.rule.parameters.prolog"," "],
+  ["variable.parameter.prolog","Smalls"],
+  ["punctuation.separator.parameters.prolog",","],
+  ["meta.rule.parameters.prolog"," "],
+  ["variable.parameter.prolog","Bigs"],
+  ["punctuation.rule.parameters.end.prolog",")"],
+  ["meta.rule.signature.prolog"," "],
+  ["keyword.operator.definition.prolog",":-"]
+],[
+   ["meta.expression.prolog","keyword.operator.definition.prolog","keyword.operator.definition.prolog","meta.rule.prolog"],
+  ["meta.rule.definition.prolog","    "],
+  ["meta.expression.prolog","(   "],
+  ["variable.other.prolog","X"],
+  ["meta.expression.prolog"," @"],
+  ["keyword.operator.prolog","<"],
+  ["meta.expression.prolog"," "],
+  ["variable.other.prolog","Pivot"],
+  ["meta.expression.prolog"," "],
+  ["keyword.operator.prolog","->"]
+],[
+   ["meta.expression.prolog","keyword.operator.definition.prolog","keyword.operator.definition.prolog","meta.rule.prolog"],
+  ["meta.expression.prolog","        "],
+  ["variable.other.prolog","Smalls"],
+  ["meta.expression.prolog"," "],
+  ["keyword.operator.prolog","="],
+  ["meta.expression.prolog"," "],
+  ["punctuation.begin.list.prolog","["],
+  ["variable.other.prolog","X"],
+  ["punctuation.concat.list.prolog","|"],
+  ["variable.other.prolog","Rest"],
+  ["punctuation.end.list.prolog","]"],
+  ["punctuation.control.and.prolog",","]
+],[
+   ["meta.expression.prolog","keyword.operator.definition.prolog","keyword.operator.definition.prolog","meta.rule.prolog"],
+  ["meta.expression.prolog","        "],
+  ["constant.other.atom.prolog","partition"],
+  ["punctuation.begin.statement.parameters.prolog","("],
+  ["variable.other.prolog","Xs"],
+  ["punctuation.separator.statement.prolog",","],
+  ["meta.statement.parameters.prolog"," "],
+  ["variable.other.prolog","Pivot"],
+  ["punctuation.separator.statement.prolog",","],
+  ["meta.statement.parameters.prolog"," "],
+  ["variable.other.prolog","Rest"],
+  ["punctuation.separator.statement.prolog",","],
+  ["meta.statement.parameters.prolog"," "],
+  ["variable.other.prolog","Bigs"],
+  ["punctuation.end.statement.parameters.prolog",")"]
+],[
+   ["meta.expression.prolog","keyword.operator.definition.prolog","keyword.operator.definition.prolog","meta.rule.prolog"],
+  ["meta.expression.prolog","    "],
+  ["punctuation.control.or.prolog",";"],
+  ["meta.expression.prolog","   "],
+  ["variable.other.prolog","Bigs"],
+  ["meta.expression.prolog"," "],
+  ["keyword.operator.prolog","="],
+  ["meta.expression.prolog"," "],
+  ["punctuation.begin.list.prolog","["],
+  ["variable.other.prolog","X"],
+  ["punctuation.concat.list.prolog","|"],
+  ["variable.other.prolog","Rest"],
+  ["punctuation.end.list.prolog","]"],
+  ["punctuation.control.and.prolog",","]
+],[
+   ["meta.expression.prolog","keyword.operator.definition.prolog","keyword.operator.definition.prolog","meta.rule.prolog"],
+  ["meta.expression.prolog","        "],
+  ["constant.other.atom.prolog","partition"],
+  ["punctuation.begin.statement.parameters.prolog","("],
+  ["variable.other.prolog","Xs"],
+  ["punctuation.separator.statement.prolog",","],
+  ["meta.statement.parameters.prolog"," "],
+  ["variable.other.prolog","Pivot"],
+  ["punctuation.separator.statement.prolog",","],
+  ["meta.statement.parameters.prolog"," "],
+  ["variable.other.prolog","Smalls"],
+  ["punctuation.separator.statement.prolog",","],
+  ["meta.statement.parameters.prolog"," "],
+  ["variable.other.prolog","Rest"],
+  ["punctuation.end.statement.parameters.prolog",")"]
+],[
+   "start",
+  ["meta.expression.prolog","    )"],
+  ["punctuation.rule.end.prolog","."]
+],[
+   "start",
+  ["text"," "]
+],[
+   "entity.name.function.fact.prolog",
+  ["entity.name.function.fact.prolog","quicksort"],
+  ["punctuation.begin.fact.parameters.prolog","("],
+  ["punctuation.begin.list.prolog","["],
+  ["punctuation.end.list.prolog","]"],
+  ["invalid.illegal.invalidchar.prolog",")"],
+  ["meta.fact.prolog","     "],
+  ["invalid.illegal.invalidchar.prolog","-"],
+  ["keyword.operator.prolog","->"],
+  ["meta.fact.prolog"," "],
+  ["punctuation.begin.list.prolog","["],
+  ["punctuation.end.list.prolog","]"],
+  ["invalid.illegal.invalidchar.prolog","."]
+],[
+   "entity.name.function.fact.prolog",
+  ["constant.other.atom.prolog","quicksort"],
+  ["punctuation.begin.statement.parameters.prolog","("],
+  ["punctuation.begin.list.prolog","["],
+  ["variable.other.prolog","X"],
+  ["punctuation.concat.list.prolog","|"],
+  ["variable.other.prolog","Xs"],
+  ["punctuation.end.list.prolog","]"],
+  ["punctuation.end.statement.parameters.prolog",")"],
+  ["meta.fact.prolog"," "],
+  ["invalid.illegal.invalidchar.prolog","-"],
+  ["keyword.operator.prolog","->"]
+],[
+   "entity.name.function.fact.prolog",
+  ["meta.fact.prolog","    "],
+  ["invalid.illegal.invalidchar.prolog","{"],
+  ["meta.fact.prolog"," "],
+  ["constant.other.atom.prolog","partition"],
+  ["punctuation.begin.statement.parameters.prolog","("],
+  ["variable.other.prolog","Xs"],
+  ["punctuation.separator.statement.prolog",","],
+  ["meta.statement.parameters.prolog"," "],
+  ["variable.other.prolog","X"],
+  ["punctuation.separator.statement.prolog",","],
+  ["meta.statement.parameters.prolog"," "],
+  ["variable.other.prolog","Smaller"],
+  ["punctuation.separator.statement.prolog",","],
+  ["meta.statement.parameters.prolog"," "],
+  ["variable.other.prolog","Bigger"],
+  ["punctuation.end.statement.parameters.prolog",")"],
+  ["meta.fact.prolog"," "],
+  ["invalid.illegal.invalidchar.prolog","}"],
+  ["punctuation.separator.parameters.prolog",","]
+],[
+   "entity.name.function.fact.prolog",
+  ["meta.fact.prolog","    "],
+  ["constant.other.atom.prolog","quicksort"],
+  ["punctuation.begin.statement.parameters.prolog","("],
+  ["variable.other.prolog","Smaller"],
+  ["punctuation.end.statement.parameters.prolog",")"],
+  ["punctuation.separator.parameters.prolog",","],
+  ["meta.fact.prolog"," "],
+  ["punctuation.begin.list.prolog","["],
+  ["variable.other.prolog","X"],
+  ["punctuation.end.list.prolog","]"],
+  ["punctuation.separator.parameters.prolog",","],
+  ["meta.fact.prolog"," "],
+  ["constant.other.atom.prolog","quicksort"],
+  ["punctuation.begin.statement.parameters.prolog","("],
+  ["variable.other.prolog","Bigger"],
+  ["punctuation.end.statement.parameters.prolog",")"],
+  ["invalid.illegal.invalidchar.prolog","."]
+],[
+   "entity.name.function.fact.prolog"
+],[
+   "entity.name.function.fact.prolog",
+  ["constant.other.atom.prolog","perfect"],
+  ["punctuation.begin.statement.parameters.prolog","("],
+  ["variable.other.prolog","N"],
+  ["punctuation.end.statement.parameters.prolog",")"],
+  ["meta.fact.prolog"," "],
+  ["invalid.illegal.invalidchar.prolog",":-"]
+],[
+   "entity.name.function.fact.prolog",
+  ["meta.fact.prolog","    "],
+  ["constant.other.atom.prolog","between"],
+  ["punctuation.begin.statement.parameters.prolog","("],
+  ["constant.numeric.prolog","1"],
+  ["punctuation.separator.statement.prolog",","],
+  ["meta.statement.parameters.prolog"," "],
+  ["constant.other.atom.prolog","inf"],
+  ["punctuation.separator.statement.prolog",","],
+  ["meta.statement.parameters.prolog"," "],
+  ["variable.other.prolog","N"],
+  ["punctuation.end.statement.parameters.prolog",")"],
+  ["punctuation.separator.parameters.prolog",","],
+  ["meta.fact.prolog"," "],
+  ["variable.parameter.prolog","U"],
+  ["meta.fact.prolog"," "],
+  ["keyword.operator.prolog","is"],
+  ["meta.fact.prolog"," "],
+  ["variable.parameter.prolog","N"],
+  ["meta.fact.prolog"," "],
+  ["invalid.illegal.invalidchar.prolog","//"],
+  ["meta.fact.prolog"," "],
+  ["constant.numeric.prolog","2"],
+  ["punctuation.separator.parameters.prolog",","]
+],[
+   "entity.name.function.fact.prolog",
+  ["meta.fact.prolog","    "],
+  ["constant.other.atom.prolog","findall"],
+  ["punctuation.begin.statement.parameters.prolog","("],
+  ["variable.other.prolog","D"],
+  ["punctuation.separator.statement.prolog",","],
+  ["meta.statement.parameters.prolog"," ("],
+  ["constant.other.atom.prolog","between"],
+  ["punctuation.begin.statement.parameters.prolog","("],
+  ["constant.numeric.prolog","1"],
+  ["punctuation.separator.statement.prolog",","],
+  ["variable.other.prolog","U"],
+  ["punctuation.separator.statement.prolog",","],
+  ["variable.other.prolog","D"],
+  ["punctuation.end.statement.parameters.prolog",")"],
+  ["punctuation.separator.statement.prolog",","],
+  ["meta.statement.parameters.prolog"," "],
+  ["variable.other.prolog","N"],
+  ["meta.statement.parameters.prolog"," "],
+  ["constant.other.atom.prolog","mod"],
+  ["meta.statement.parameters.prolog"," "],
+  ["variable.other.prolog","D"],
+  ["meta.statement.parameters.prolog"," "],
+  ["keyword.operator.prolog","=:="],
+  ["meta.statement.parameters.prolog"," "],
+  ["constant.numeric.prolog","0"],
+  ["punctuation.end.statement.parameters.prolog",")"],
+  ["punctuation.separator.parameters.prolog",","],
+  ["meta.fact.prolog"," "],
+  ["variable.parameter.prolog","Ds"],
+  ["invalid.illegal.invalidchar.prolog",")"],
+  ["punctuation.separator.parameters.prolog",","]
+],[
+   "entity.name.function.fact.prolog",
+  ["meta.fact.prolog","    "],
+  ["constant.other.atom.prolog","sumlist"],
+  ["punctuation.begin.statement.parameters.prolog","("],
+  ["variable.other.prolog","Ds"],
+  ["punctuation.separator.statement.prolog",","],
+  ["meta.statement.parameters.prolog"," "],
+  ["variable.other.prolog","N"],
+  ["punctuation.end.statement.parameters.prolog",")"],
+  ["invalid.illegal.invalidchar.prolog","."]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_properties.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_properties.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_properties.json
new file mode 100644
index 0000000..8831045
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_properties.json
@@ -0,0 +1,68 @@
+[[
+   "start",
+  ["comment","# You are reading the \".properties\" entry."]
+],[
+   "start",
+  ["comment","! The exclamation mark can also mark text as comments."]
+],[
+   "start",
+  ["comment","# The key and element characters #, !, =, and : are written with a preceding backslash to ensure that they are properly loaded."]
+],[
+   "start",
+  ["variable","website "],
+  ["keyword","="],
+  ["string"," http"],
+  ["constant.language.escape","\\"],
+  ["string","://en.wikipedia.org/"]
+],[
+   "start",
+  ["variable","language "],
+  ["keyword","="],
+  ["string"," English"]
+],[
+   "start",
+  ["comment","# The backslash below tells the application to continue reading"]
+],[
+   "start",
+  ["comment","# the value onto the next line."]
+],[
+   "value",
+  ["variable","message "],
+  ["keyword","="],
+  ["string"," Welcome to \\"]
+],[
+   "start",
+  ["string","          Wikipedia!"]
+],[
+   "start",
+  ["comment","# Add spaces to the key"]
+],[
+   "start",
+  ["variable","key"],
+  ["constant.language.escape","\\"],
+  ["variable"," with"],
+  ["constant.language.escape","\\"],
+  ["variable"," spaces "],
+  ["keyword","="],
+  ["string"," This is the value that could be looked up with the key \"key with spaces\"."]
+],[
+   "start",
+  ["comment","# Unicode"]
+],[
+   "start",
+  ["variable","tab "],
+  ["keyword",":"],
+  ["string"," "],
+  ["constant.language.escape","\\u0009"]
+],[
+   "start",
+  ["variable","empty-key"],
+  ["keyword","="]
+],[
+   "start",
+  ["variable","last.line"],
+  ["keyword","="],
+  ["string","value"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_python.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_python.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_python.json
new file mode 100644
index 0000000..293c8ff
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_python.json
@@ -0,0 +1,152 @@
+[[
+   "start",
+  ["comment","#!/usr/local/bin/python"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","import"],
+  ["text"," "],
+  ["identifier","string"],
+  ["text",", "],
+  ["identifier","sys"]
+],[
+   "start"
+],[
+   "start",
+  ["comment","# If no arguments were given, print a helpful message"]
+],[
+   "start",
+  ["keyword","if"],
+  ["text"," "],
+  ["support.function","len"],
+  ["paren.lparen","("],
+  ["identifier","sys"],
+  ["text","."],
+  ["identifier","argv"],
+  ["paren.rparen",")"],
+  ["keyword.operator","=="],
+  ["constant.numeric","1"],
+  ["text",":"]
+],[
+   "qstring3",
+  ["text","    "],
+  ["keyword","print"],
+  ["text"," "],
+  ["string","'''Usage:"]
+],[
+   "start",
+  ["string","celsius temp1 temp2 ...'''"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","sys"],
+  ["text","."],
+  ["identifier","exit"],
+  ["paren.lparen","("],
+  ["constant.numeric","0"],
+  ["paren.rparen",")"]
+],[
+   "start"
+],[
+   "start",
+  ["comment","# Loop over the arguments"]
+],[
+   "start",
+  ["keyword","for"],
+  ["text"," "],
+  ["identifier","i"],
+  ["text"," "],
+  ["keyword","in"],
+  ["text"," "],
+  ["identifier","sys"],
+  ["text","."],
+  ["identifier","argv"],
+  ["paren.lparen","["],
+  ["constant.numeric","1"],
+  ["text",":"],
+  ["paren.rparen","]"],
+  ["text",":"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","try"],
+  ["text",":"]
+],[
+   "start",
+  ["text","        "],
+  ["identifier","fahrenheit"],
+  ["keyword.operator","="],
+  ["support.function","float"],
+  ["paren.lparen","("],
+  ["identifier","string"],
+  ["text","."],
+  ["identifier","atoi"],
+  ["paren.lparen","("],
+  ["identifier","i"],
+  ["paren.rparen","))"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","except"],
+  ["text"," "],
+  ["identifier","string"],
+  ["text","."],
+  ["identifier","atoi_error"],
+  ["text",":"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","print"],
+  ["text"," "],
+  ["support.function","repr"],
+  ["paren.lparen","("],
+  ["identifier","i"],
+  ["paren.rparen",")"],
+  ["text",", "],
+  ["string","\"not a numeric value\""]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","else"],
+  ["text",":"]
+],[
+   "start",
+  ["text","        "],
+  ["identifier","celsius"],
+  ["keyword.operator","="],
+  ["paren.lparen","("],
+  ["identifier","fahrenheit"],
+  ["keyword.operator","-"],
+  ["constant.numeric","32"],
+  ["paren.rparen",")"],
+  ["keyword.operator","*"],
+  ["constant.numeric","5.0"],
+  ["keyword.operator","/"],
+  ["constant.numeric","9.0"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","print"],
+  ["text"," "],
+  ["string","'%i"],
+  ["constant.language.escape","\\260"],
+  ["string","F = %i"],
+  ["constant.language.escape","\\260"],
+  ["string","C'"],
+  ["text"," "],
+  ["keyword.operator","%"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["support.function","int"],
+  ["paren.lparen","("],
+  ["identifier","fahrenheit"],
+  ["paren.rparen",")"],
+  ["text",", "],
+  ["support.function","int"],
+  ["paren.lparen","("],
+  ["identifier","celsius"],
+  ["keyword.operator","+"],
+  ["constant.numeric",".5"],
+  ["paren.rparen","))"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_r.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_r.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_r.json
new file mode 100644
index 0000000..2d446bc
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_r.json
@@ -0,0 +1,235 @@
+[[
+   "start",
+  ["identifier","Call"],
+  ["keyword.operator",":"]
+],[
+   "start",
+  ["identifier","lm"],
+  ["paren.keyword.operator","("],
+  ["identifier","formula"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","y"],
+  ["text"," "],
+  ["keyword.operator","~"],
+  ["text"," "],
+  ["identifier","x"],
+  ["paren.keyword.operator",")"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["identifier","Residuals"],
+  ["keyword.operator",":"]
+],[
+   "start",
+  ["constant.numeric","1"],
+  ["text","       "],
+  ["constant.numeric","2"],
+  ["text","       "],
+  ["constant.numeric","3"],
+  ["text","       "],
+  ["constant.numeric","4"],
+  ["text","       "],
+  ["constant.numeric","5"],
+  ["text","       "],
+  ["constant.numeric","6"]
+],[
+   "start",
+  ["constant.numeric","3.3333"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["constant.numeric","0.6667"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["constant.numeric","2.6667"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["constant.numeric","2.6667"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["constant.numeric","0.6667"],
+  ["text","  "],
+  ["constant.numeric","3.3333"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["identifier","Coefficients"],
+  ["keyword.operator",":"]
+],[
+   "start",
+  ["text","            "],
+  ["identifier","Estimate"],
+  ["text"," "],
+  ["identifier","Std"],
+  ["text",". "],
+  ["identifier","Error"],
+  ["text"," "],
+  ["identifier","t"],
+  ["text"," "],
+  ["identifier","value"],
+  ["text"," "],
+  ["identifier","Pr"],
+  ["paren.keyword.operator","("],
+  ["keyword.operator",">|"],
+  ["identifier","t"],
+  ["keyword.operator","|"],
+  ["paren.keyword.operator",")"]
+],[
+   "start",
+  ["paren.keyword.operator","("],
+  ["identifier","Intercept"],
+  ["paren.keyword.operator",")"],
+  ["text","  "],
+  ["keyword.operator","-"],
+  ["constant.numeric","9.3333"],
+  ["text","     "],
+  ["constant.numeric","2.8441"],
+  ["text","  "],
+  ["keyword.operator","-"],
+  ["constant.numeric","3.282"],
+  ["text"," "],
+  ["constant.numeric","0.030453"],
+  ["text"," "],
+  ["keyword.operator","*"]
+],[
+   "start",
+  ["identifier","x"],
+  ["text","             "],
+  ["constant.numeric","7.0000"],
+  ["text","     "],
+  ["constant.numeric","0.7303"],
+  ["text","   "],
+  ["constant.numeric","9.585"],
+  ["text"," "],
+  ["constant.numeric","0.000662"],
+  ["text"," "],
+  ["keyword.operator","***"]
+],[
+   "start",
+  ["keyword.operator","---"]
+],[
+   "start",
+  ["identifier","Signif"],
+  ["text",". "],
+  ["identifier","codes"],
+  ["keyword.operator",":"],
+  ["text","  "],
+  ["constant.numeric","0"],
+  ["text"," ‘"],
+  ["keyword.operator","***"],
+  ["text","’ "],
+  ["constant.numeric","0.001"],
+  ["text"," ‘"],
+  ["keyword.operator","**"],
+  ["text","’ "],
+  ["constant.numeric","0.01"],
+  ["text"," ‘"],
+  ["keyword.operator","*"],
+  ["text","’ "],
+  ["constant.numeric","0.05"],
+  ["text"," ‘.’ "],
+  ["constant.numeric","0.1"],
+  ["text"," ‘ ’ "],
+  ["constant.numeric","1"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["identifier","Residual"],
+  ["text"," "],
+  ["identifier","standard"],
+  ["text"," "],
+  ["identifier","error"],
+  ["keyword.operator",":"],
+  ["text"," "],
+  ["constant.numeric","3.055"],
+  ["text"," "],
+  ["identifier","on"],
+  ["text"," "],
+  ["constant.numeric","4"],
+  ["text"," "],
+  ["identifier","degrees"],
+  ["text"," "],
+  ["identifier","of"],
+  ["text"," "],
+  ["identifier","freedom"]
+],[
+   "start",
+  ["identifier","Multiple"],
+  ["text"," "],
+  ["identifier","R"],
+  ["keyword.operator","-"],
+  ["identifier","squared"],
+  ["keyword.operator",":"],
+  ["text"," "],
+  ["constant.numeric","0.9583"],
+  ["text",",     "],
+  ["identifier","Adjusted"],
+  ["text"," "],
+  ["identifier","R"],
+  ["keyword.operator","-"],
+  ["identifier","squared"],
+  ["keyword.operator",":"],
+  ["text"," "],
+  ["constant.numeric","0.9478"]
+],[
+   "start",
+  ["constant.language.boolean","F"],
+  ["keyword.operator","-"],
+  ["identifier","statistic"],
+  ["keyword.operator",":"],
+  ["text"," "],
+  ["constant.numeric","91.88"],
+  ["text"," "],
+  ["identifier","on"],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["text"," "],
+  ["identifier","and"],
+  ["text"," "],
+  ["constant.numeric","4"],
+  ["text"," "],
+  ["identifier","DF"],
+  ["text",",  "],
+  ["identifier","p"],
+  ["keyword.operator","-"],
+  ["identifier","value"],
+  ["keyword.operator",":"],
+  ["text"," "],
+  ["constant.numeric","0.000662"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["keyword.operator",">"],
+  ["text"," "],
+  ["identifier","par"],
+  ["paren.keyword.operator","("],
+  ["identifier","mfrow"],
+  ["keyword.operator","="],
+  ["identifier","c"],
+  ["paren.keyword.operator","("],
+  ["constant.numeric","2"],
+  ["text",", "],
+  ["constant.numeric","2"],
+  ["paren.keyword.operator","))"],
+  ["text","     "],
+  ["comment","# Request 2x2 plot layout"]
+],[
+   "start",
+  ["keyword.operator",">"],
+  ["text"," "],
+  ["identifier","plot"],
+  ["paren.keyword.operator","("],
+  ["identifier","lm_1"],
+  ["paren.keyword.operator",")"],
+  ["text","             "],
+  ["comment","# Diagnostic plot of regression model"]
+]]
\ No newline at end of file


[46/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/edit_session_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/edit_session_test.js b/src/fauxton/assets/js/libs/ace/edit_session_test.js
new file mode 100644
index 0000000..87cc956
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/edit_session_test.js
@@ -0,0 +1,1075 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+    require("./test/mockdom");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var lang = require("./lib/lang");
+var EditSession = require("./edit_session").EditSession;
+var Editor = require("./editor").Editor;
+var UndoManager = require("./undomanager").UndoManager;
+var MockRenderer = require("./test/mockrenderer").MockRenderer;
+var Range = require("./range").Range;
+var assert = require("./test/assertions");
+var JavaScriptMode = require("./mode/javascript").Mode;
+
+function createFoldTestSession() {
+    var lines = [
+        "function foo(items) {",
+        "    for (var i=0; i<items.length; i++) {",
+        "        alert(items[i] + \"juhu\");",
+        "    }    // Real Tab.",
+        "}"
+    ];
+    var session = new EditSession(lines.join("\n"));
+    session.setUndoManager(new UndoManager());
+    session.addFold("args...", new Range(0, 13, 0, 18));
+    session.addFold("foo...", new Range(1, 10, 2, 10));
+    session.addFold("bar...", new Range(2, 20, 2, 25));
+    return session;
+}
+
+function assertArray(a, b) {
+    assert.equal(a+"", b+"");
+    assert.ok(a.length == b.length);
+    for (var i = 0; i < a.length; i++) {
+        assert.equal(a[i], b[i]);
+    }
+}
+
+module.exports = {
+
+   "test: find matching opening bracket in Text mode" : function() {
+        var session = new EditSession(["(()(", "())))"]);
+
+        assert.position(session.findMatchingBracket({row: 0, column: 3}), 0, 1);
+        assert.position(session.findMatchingBracket({row: 1, column: 2}), 1, 0);
+        assert.position(session.findMatchingBracket({row: 1, column: 3}), 0, 3);
+        assert.position(session.findMatchingBracket({row: 1, column: 4}), 0, 0);
+        assert.equal(session.findMatchingBracket({row: 1, column: 5}), null);
+    },
+
+    "test: find matching closing bracket in Text mode" : function() {
+        var session = new EditSession(["(()(", "())))"]);
+
+        assert.position(session.findMatchingBracket({row: 1, column: 1}), 1, 1);
+        assert.position(session.findMatchingBracket({row: 1, column: 1}), 1, 1);
+        assert.position(session.findMatchingBracket({row: 0, column: 4}), 1, 2);
+        assert.position(session.findMatchingBracket({row: 0, column: 2}), 0, 2);
+        assert.position(session.findMatchingBracket({row: 0, column: 1}), 1, 3);
+        assert.equal(session.findMatchingBracket({row: 0, column: 0}), null);
+    },
+
+    "test: find matching opening bracket in JavaScript mode" : function() {
+        var lines = [
+            "function foo() {",
+            "    var str = \"{ foo()\";",
+            "    if (debug) {",
+            "        // write str (a string) to the console",
+            "        console.log(str);",
+            "    }",
+            "    str += \" bar() }\";",
+            "}"
+        ];
+        var session = new EditSession(lines.join("\n"), new JavaScriptMode());
+
+        assert.position(session.findMatchingBracket({row: 0, column: 14}), 0, 12);
+        assert.position(session.findMatchingBracket({row: 7, column: 1}), 0, 15);
+        assert.position(session.findMatchingBracket({row: 6, column: 20}), 1, 15);
+        assert.position(session.findMatchingBracket({row: 1, column: 22}), 1, 20);
+        assert.position(session.findMatchingBracket({row: 3, column: 31}), 3, 21);
+        assert.position(session.findMatchingBracket({row: 4, column: 24}), 4, 19);
+        assert.equal(session.findMatchingBracket({row: 0, column: 1}), null);
+    },
+
+    "test: find matching closing bracket in JavaScript mode" : function() {
+        var lines = [
+            "function foo() {",
+            "    var str = \"{ foo()\";",
+            "    if (debug) {",
+            "        // write str (a string) to the console",
+            "        console.log(str);",
+            "    }",
+            "    str += \" bar() }\";",
+            "}"
+        ];
+        var session = new EditSession(lines.join("\n"), new JavaScriptMode());
+
+        assert.position(session.findMatchingBracket({row: 0, column: 13}), 0, 13);
+        assert.position(session.findMatchingBracket({row: 0, column: 16}), 7, 0);
+        assert.position(session.findMatchingBracket({row: 1, column: 16}), 6, 19);
+        assert.position(session.findMatchingBracket({row: 1, column: 21}), 1, 21);
+        assert.position(session.findMatchingBracket({row: 3, column: 22}), 3, 30);
+        assert.position(session.findMatchingBracket({row: 4, column: 20}), 4, 23);
+    },
+
+    "test: handle unbalanced brackets in JavaScript mode" : function() {
+        var lines = [
+            "function foo() {",
+            "    var str = \"{ foo()\";",
+            "    if (debug) {",
+            "        // write str a string) to the console",
+            "        console.log(str);",
+            "    ",
+            "    str += \" bar() \";",
+            "}"
+        ];
+        var session = new EditSession(lines.join("\n"), new JavaScriptMode());
+
+        assert.equal(session.findMatchingBracket({row: 0, column: 16}), null);
+        assert.equal(session.findMatchingBracket({row: 3, column: 30}), null);
+        assert.equal(session.findMatchingBracket({row: 1, column: 16}), null);
+    },
+
+    "test: match different bracket types" : function() {
+        var session = new EditSession(["({[", ")]}"]);
+
+        assert.position(session.findMatchingBracket({row: 0, column: 1}), 1, 0);
+        assert.position(session.findMatchingBracket({row: 0, column: 2}), 1, 2);
+        assert.position(session.findMatchingBracket({row: 0, column: 3}), 1, 1);
+
+        assert.position(session.findMatchingBracket({row: 1, column: 1}), 0, 0);
+        assert.position(session.findMatchingBracket({row: 1, column: 2}), 0, 2);
+        assert.position(session.findMatchingBracket({row: 1, column: 3}), 0, 1);
+    },
+
+    "test: move lines down" : function() {
+        var session = new EditSession(["a1", "a2", "a3", "a4"]);
+
+        session.moveLinesDown(0, 1);
+        assert.equal(session.getValue(), ["a3", "a1", "a2", "a4"].join("\n"));
+
+        session.moveLinesDown(1, 2);
+        assert.equal(session.getValue(), ["a3", "a4", "a1", "a2"].join("\n"));
+
+        session.moveLinesDown(2, 3);
+        assert.equal(session.getValue(), ["a3", "a4", "a1", "a2"].join("\n"));
+
+        session.moveLinesDown(2, 2);
+        assert.equal(session.getValue(), ["a3", "a4", "a2", "a1"].join("\n"));
+    },
+
+    "test: move lines up" : function() {
+        var session = new EditSession(["a1", "a2", "a3", "a4"]);
+
+        session.moveLinesUp(2, 3);
+        assert.equal(session.getValue(), ["a1", "a3", "a4", "a2"].join("\n"));
+
+        session.moveLinesUp(1, 2);
+        assert.equal(session.getValue(), ["a3", "a4", "a1", "a2"].join("\n"));
+
+        session.moveLinesUp(0, 1);
+        assert.equal(session.getValue(), ["a3", "a4", "a1", "a2"].join("\n"));
+
+        session.moveLinesUp(2, 2);
+        assert.equal(session.getValue(), ["a3", "a1", "a4", "a2"].join("\n"));
+    },
+
+    "test: duplicate lines" : function() {
+        var session = new EditSession(["1", "2", "3", "4"]);
+
+        session.duplicateLines(1, 2);
+        assert.equal(session.getValue(), ["1", "2", "3", "2", "3", "4"].join("\n"));
+    },
+
+    "test: duplicate last line" : function() {
+        var session = new EditSession(["1", "2", "3"]);
+
+        session.duplicateLines(2, 2);
+        assert.equal(session.getValue(), ["1", "2", "3", "3"].join("\n"));
+    },
+
+    "test: duplicate first line" : function() {
+        var session = new EditSession(["1", "2", "3"]);
+
+        session.duplicateLines(0, 0);
+        assert.equal(session.getValue(), ["1", "1", "2", "3"].join("\n"));
+    },
+
+    "test: getScreenLastRowColumn": function() {
+        var session = new EditSession([
+            "juhu",
+            "12\t\t34",
+            "ぁぁa"
+        ]);
+
+        assert.equal(session.getScreenLastRowColumn(0), 4);
+        assert.equal(session.getScreenLastRowColumn(1), 10);
+        assert.equal(session.getScreenLastRowColumn(2), 5);
+    },
+
+    "test: convert document to screen coordinates" : function() {
+        var session = new EditSession("01234\t567890\t1234");
+        session.setTabSize(4);
+
+        assert.equal(session.documentToScreenColumn(0, 0), 0);
+        assert.equal(session.documentToScreenColumn(0, 4), 4);
+        assert.equal(session.documentToScreenColumn(0, 5), 5);
+        assert.equal(session.documentToScreenColumn(0, 6), 8);
+        assert.equal(session.documentToScreenColumn(0, 12), 14);
+        assert.equal(session.documentToScreenColumn(0, 13), 16);
+
+        session.setTabSize(2);
+
+        assert.equal(session.documentToScreenColumn(0, 0), 0);
+        assert.equal(session.documentToScreenColumn(0, 4), 4);
+        assert.equal(session.documentToScreenColumn(0, 5), 5);
+        assert.equal(session.documentToScreenColumn(0, 6), 6);
+        assert.equal(session.documentToScreenColumn(0, 7), 7);
+        assert.equal(session.documentToScreenColumn(0, 12), 12);
+        assert.equal(session.documentToScreenColumn(0, 13), 14);
+    },
+
+    "test: convert document to screen coordinates with leading tabs": function() {
+        var session = new EditSession("\t\t123");
+        session.setTabSize(4);
+
+        assert.equal(session.documentToScreenColumn(0, 0), 0);
+        assert.equal(session.documentToScreenColumn(0, 1), 4);
+        assert.equal(session.documentToScreenColumn(0, 2), 8);
+        assert.equal(session.documentToScreenColumn(0, 3), 9);
+    },
+
+    "test: documentToScreen without soft wrap": function() {
+        var session = new EditSession([
+            "juhu",
+            "12\t\t34",
+            "ぁぁa"
+        ]);
+
+        assert.position(session.documentToScreenPosition(0, 3), 0, 3);
+        assert.position(session.documentToScreenPosition(1, 3), 1, 4);
+        assert.position(session.documentToScreenPosition(1, 4), 1, 8);
+        assert.position(session.documentToScreenPosition(2, 2), 2, 4);
+    },
+
+    "test: documentToScreen with soft wrap": function() {
+        var session = new EditSession(["foo bar foo bar"]);
+        session.setUseWrapMode(true);
+        session.setWrapLimitRange(12, 12);
+        session.adjustWrapLimit(80);
+
+        assert.position(session.documentToScreenPosition(0, 11), 0, 11);
+        assert.position(session.documentToScreenPosition(0, 12), 1, 0);
+    },
+
+    "test: documentToScreen with soft wrap and multibyte characters": function() {
+        var session = new EditSession(["ぁぁa"]);
+        session.setUseWrapMode(true);
+        session.setWrapLimitRange(2, 2);
+        session.adjustWrapLimit(80);
+
+        assert.position(session.documentToScreenPosition(0, 1), 1, 0);
+        assert.position(session.documentToScreenPosition(0, 2), 2, 0);
+        assert.position(session.documentToScreenPosition(0, 4), 2, 1);
+    },
+
+    "test: documentToScreen should clip position to the document boundaries": function() {
+        var session = new EditSession("foo bar\njuhu kinners");
+
+        assert.position(session.documentToScreenPosition(-1, 4), 0, 0);
+        assert.position(session.documentToScreenPosition(3, 0), 1, 12);
+    },
+
+    "test: convert screen to document coordinates" : function() {
+        var session = new EditSession("01234\t567890\t1234");
+        session.setTabSize(4);
+
+        assert.equal(session.screenToDocumentColumn(0, 0), 0);
+        assert.equal(session.screenToDocumentColumn(0, 4), 4);
+        assert.equal(session.screenToDocumentColumn(0, 5), 5);
+        assert.equal(session.screenToDocumentColumn(0, 6), 5);
+        assert.equal(session.screenToDocumentColumn(0, 7), 5);
+        assert.equal(session.screenToDocumentColumn(0, 8), 6);
+        assert.equal(session.screenToDocumentColumn(0, 9), 7);
+        assert.equal(session.screenToDocumentColumn(0, 15), 12);
+        assert.equal(session.screenToDocumentColumn(0, 19), 16);
+
+        session.setTabSize(2);
+
+        assert.equal(session.screenToDocumentColumn(0, 0), 0);
+        assert.equal(session.screenToDocumentColumn(0, 4), 4);
+        assert.equal(session.screenToDocumentColumn(0, 5), 5);
+        assert.equal(session.screenToDocumentColumn(0, 6), 6);
+        assert.equal(session.screenToDocumentColumn(0, 12), 12);
+        assert.equal(session.screenToDocumentColumn(0, 13), 12);
+        assert.equal(session.screenToDocumentColumn(0, 14), 13);
+    },
+
+    "test: screenToDocument with soft wrap": function() {
+        var session = new EditSession(["foo bar foo bar"]);
+        session.setUseWrapMode(true);
+        session.setWrapLimitRange(12, 12);
+        session.adjustWrapLimit(80);
+
+        assert.position(session.screenToDocumentPosition(1, 0), 0, 12);
+        assert.position(session.screenToDocumentPosition(0, 11), 0, 11);
+        // Check if the position is clamped the right way.
+        assert.position(session.screenToDocumentPosition(0, 12), 0, 11);
+        assert.position(session.screenToDocumentPosition(0, 20), 0, 11);
+    },
+
+    "test: screenToDocument with soft wrap and multi byte characters": function() {
+        var session = new EditSession(["ぁ a"]);
+        session.setUseWrapMode(true);
+        session.adjustWrapLimit(80);
+
+        assert.position(session.screenToDocumentPosition(0, 1), 0, 0);
+        assert.position(session.screenToDocumentPosition(0, 2), 0, 1);
+        assert.position(session.screenToDocumentPosition(0, 3), 0, 2);
+        assert.position(session.screenToDocumentPosition(0, 4), 0, 3);
+        assert.position(session.screenToDocumentPosition(0, 5), 0, 3);
+    },
+
+    "test: screenToDocument should clip position to the document boundaries": function() {
+        var session = new EditSession("foo bar\njuhu kinners");
+
+        assert.position(session.screenToDocumentPosition(-1, 4), 0, 0);
+        assert.position(session.screenToDocumentPosition(0, -1), 0, 0);
+        assert.position(session.screenToDocumentPosition(0, 30), 0, 7);
+        assert.position(session.screenToDocumentPosition(2, 4), 1, 12);
+        assert.position(session.screenToDocumentPosition(1, 30), 1, 12);
+        assert.position(session.screenToDocumentPosition(20, 50), 1, 12);
+        assert.position(session.screenToDocumentPosition(20, 5), 1, 12);
+
+        // and the same for folded rows
+        session.addFold("...", new Range(0,1,1,3));
+        assert.position(session.screenToDocumentPosition(1, 2), 1, 12);
+        // for wrapped rows
+        session.setUseWrapMode(true);
+        session.setWrapLimitRange(5,5);
+        assert.position(session.screenToDocumentPosition(4, 1), 1, 12);
+    },
+
+    "test: wrapLine split function" : function() {
+        function computeAndAssert(line, assertEqual, wrapLimit, tabSize) {
+            wrapLimit = wrapLimit || 12;
+            tabSize = tabSize || 4;
+            line = lang.stringTrimRight(line);
+            var tokens = EditSession.prototype.$getDisplayTokens(line);
+            var splits = EditSession.prototype.$computeWrapSplits(tokens, wrapLimit, tabSize);
+            // console.log("String:", line, "Result:", splits, "Expected:", assertEqual);
+            assert.ok(splits.length == assertEqual.length);
+            for (var i = 0; i < splits.length; i++) {
+                assert.ok(splits[i] == assertEqual[i]);
+            }
+        }
+        
+        EditSession.prototype.$wrapAsCode = true;
+        // Basic splitting.
+        computeAndAssert("foo bar foo bar", [ 12 ]);
+        computeAndAssert("foo bar f   bar", [ 12 ]);
+        computeAndAssert("foo bar f     r", [ 12 ]); // 14 if we enable 
+        computeAndAssert("foo bar foo bar foo bara foo", [12, 25]);
+
+        // Don't split if there is only whitespaces/tabs at the end of the line.
+        computeAndAssert("foo foo foo \t \t", [ ]);
+
+        // If there is no space to split, force split.
+        computeAndAssert("foooooooooooooo", [ 12 ]);
+        computeAndAssert("fooooooooooooooooooooooooooo", [12, 24]);
+        computeAndAssert("foo bar fooooooooooobooooooo", [8,  20]);
+
+        // Basic splitting + tabs.
+        computeAndAssert("foo \t\tbar", [ 6 ]);
+        computeAndAssert("foo \t \tbar", [ 7 ]);
+
+        // Ignore spaces/tabs at beginning of split.
+        computeAndAssert("foo \t \t   \t \t bar", [ 7 ]); // 14
+
+        // Test wrapping for asian characters.
+        computeAndAssert("ぁぁ", [1], 2);
+        computeAndAssert(" ぁぁ", [1, 2], 2);
+        computeAndAssert(" ぁ\tぁ", [1, 3], 2);
+        computeAndAssert(" ぁぁ\tぁ", [1, 4], 4);
+
+        // Test wrapping for punctuation.
+        computeAndAssert(" ab.c;ef++", [1, 3, 5, 7, 8], 2);
+        computeAndAssert(" a.b", [1, 2, 3], 1);
+        computeAndAssert("#>>", [1, 2], 1);
+        
+        // Test wrapping for punctuation in
+        EditSession.prototype.$wrapAsCode = false;
+        computeAndAssert("ab cde, Juhu kinners", [3, 8, 13, 19], 6);
+    },
+
+    "test get longest line" : function() {
+        var session = new EditSession(["12"]);
+        session.setTabSize(4);
+        assert.equal(session.getScreenWidth(), 2);
+
+        session.doc.insertNewLine({row: 0, column: Infinity});
+        session.doc.insertLines(1, ["123"]);
+        assert.equal(session.getScreenWidth(), 3);
+
+        session.doc.insertNewLine({row: 0, column: Infinity});
+        session.doc.insertLines(1, ["\t\t"]);
+
+        assert.equal(session.getScreenWidth(), 8);
+
+        session.setTabSize(2);
+        assert.equal(session.getScreenWidth(), 4);
+    },
+
+    "test getDisplayString": function() {
+        var session = new EditSession(["12"]);
+        session.setTabSize(4);
+
+        assert.equal(session.$getDisplayTokens("\t").length, 4);
+        assert.equal(session.$getDisplayTokens("abc").length, 3);
+        assert.equal(session.$getDisplayTokens("abc\t").length, 4);
+    },
+
+    "test issue 83": function() {
+        var session = new EditSession("");
+        var editor = new Editor(new MockRenderer(), session);
+        var document = session.getDocument();
+
+        session.setUseWrapMode(true);
+
+        document.insertLines(0, ["a", "b"]);
+        document.insertLines(2, ["c", "d"]);
+        document.removeLines(1, 2);
+    },
+
+    "test wrapMode init has to create wrapData array": function() {
+        var session = new EditSession("foo bar\nfoo bar");
+        var editor = new Editor(new MockRenderer(), session);
+        var document = session.getDocument();
+
+        session.setUseWrapMode(true);
+        session.setWrapLimitRange(3, 3);
+        session.adjustWrapLimit(80);
+
+        // Test if wrapData is there and was computed.
+        assert.equal(session.$wrapData.length, 2);
+        assert.equal(session.$wrapData[0].length, 1);
+        assert.equal(session.$wrapData[1].length, 1);
+    },
+
+    "test first line blank with wrap": function() {
+        var session = new EditSession("\nfoo");
+        session.setUseWrapMode(true);
+        assert.equal(session.doc.getValue(), ["", "foo"].join("\n"));
+    },
+
+    "test first line blank with wrap 2" : function() {
+        var session = new EditSession("");
+        session.setUseWrapMode(true);
+        session.setValue("\nfoo");
+
+        assert.equal(session.doc.getValue(), ["", "foo"].join("\n"));
+    },
+
+    "test fold getFoldDisplayLine": function() {
+        var session = createFoldTestSession();
+        function assertDisplayLine(foldLine, str) {
+            var line = session.getLine(foldLine.end.row);
+            var displayLine =
+                session.getFoldDisplayLine(foldLine, foldLine.end.row, line.length);
+            assert.equal(displayLine, str);
+        }
+
+        assertDisplayLine(session.$foldData[0], "function foo(args...) {")
+        assertDisplayLine(session.$foldData[1], "    for (vfoo...ert(items[bar...\"juhu\");");
+    },
+
+    "test foldLine idxToPosition": function() {
+        var session = createFoldTestSession();
+
+        function assertIdx2Pos(foldLineIdx, idx, row, column) {
+            var foldLine = session.$foldData[foldLineIdx];
+            assert.position(foldLine.idxToPosition(idx), row, column);
+        }
+
+//        "function foo(items) {",
+//        "    for (var i=0; i<items.length; i++) {",
+//        "        alert(items[i] + \"juhu\");",
+//        "    }    // Real Tab.",
+//        "}"
+
+        assertIdx2Pos(0, 12, 0, 12);
+        assertIdx2Pos(0, 13, 0, 13);
+        assertIdx2Pos(0, 14, 0, 13);
+        assertIdx2Pos(0, 19, 0, 13);
+        assertIdx2Pos(0, 20, 0, 18);
+
+        assertIdx2Pos(1, 10, 1, 10);
+        assertIdx2Pos(1, 11, 1, 10);
+        assertIdx2Pos(1, 15, 1, 10);
+        assertIdx2Pos(1, 16, 2, 10);
+        assertIdx2Pos(1, 26, 2, 20);
+        assertIdx2Pos(1, 27, 2, 20);
+        assertIdx2Pos(1, 32, 2, 25);
+    },
+
+    "test fold documentToScreen": function() {
+        var session = createFoldTestSession();
+        function assertDoc2Screen(docRow, docCol, screenRow, screenCol) {
+            assert.position(
+                session.documentToScreenPosition(docRow, docCol),
+                screenRow, screenCol
+            );
+        }
+
+        // One fold ending in the same row.
+        assertDoc2Screen(0,  0, 0, 0);
+        assertDoc2Screen(0, 13, 0, 13);
+        assertDoc2Screen(0, 14, 0, 13);
+        assertDoc2Screen(0, 17, 0, 13);
+        assertDoc2Screen(0, 18, 0, 20);
+
+        // Fold ending on some other row.
+        assertDoc2Screen(1,  0, 1, 0);
+        assertDoc2Screen(1, 10, 1, 10);
+        assertDoc2Screen(1, 11, 1, 10);
+        assertDoc2Screen(1, 99, 1, 10);
+
+        assertDoc2Screen(2,  0, 1, 10);
+        assertDoc2Screen(2,  9, 1, 10);
+        assertDoc2Screen(2, 10, 1, 16);
+        assertDoc2Screen(2, 11, 1, 17);
+
+        // Fold in the same row with fold over more then one row in the same row.
+        assertDoc2Screen(2, 19, 1, 25);
+        assertDoc2Screen(2, 20, 1, 26);
+        assertDoc2Screen(2, 21, 1, 26);
+
+        assertDoc2Screen(2, 24, 1, 26);
+        assertDoc2Screen(2, 25, 1, 32);
+        assertDoc2Screen(2, 26, 1, 33);
+        assertDoc2Screen(2, 99, 1, 40);
+
+        // Test one position after the folds. Should be all like normal.
+        assertDoc2Screen(3,  0, 2,  0);
+    },
+
+    "test fold screenToDocument": function() {
+        var session = createFoldTestSession();
+        function assertScreen2Doc(docRow, docCol, screenRow, screenCol) {
+            assert.position(
+                session.screenToDocumentPosition(screenRow, screenCol),
+                docRow, docCol
+            );
+        }
+
+        // One fold ending in the same row.
+        assertScreen2Doc(0,  0, 0, 0);
+        assertScreen2Doc(0, 13, 0, 13);
+        assertScreen2Doc(0, 13, 0, 14);
+        assertScreen2Doc(0, 18, 0, 20);
+        assertScreen2Doc(0, 19, 0, 21);
+
+        // Fold ending on some other row.
+        assertScreen2Doc(1,  0, 1, 0);
+        assertScreen2Doc(1, 10, 1, 10);
+        assertScreen2Doc(1, 10, 1, 11);
+
+        assertScreen2Doc(1, 10, 1, 15);
+        assertScreen2Doc(2, 10, 1, 16);
+        assertScreen2Doc(2, 11, 1, 17);
+
+        // Fold in the same row with fold over more then one row in the same row.
+        assertScreen2Doc(2, 19, 1, 25);
+        assertScreen2Doc(2, 20, 1, 26);
+        assertScreen2Doc(2, 20, 1, 27);
+
+        assertScreen2Doc(2, 20, 1, 31);
+        assertScreen2Doc(2, 25, 1, 32);
+        assertScreen2Doc(2, 26, 1, 33);
+        assertScreen2Doc(2, 33, 1, 99);
+
+        // Test one position after the folds. Should be all like normal.
+        assertScreen2Doc(3,  0, 2,  0);
+    },
+
+    "test getFoldsInRange()": function() {
+        var session = createFoldTestSession();
+        var foldLines = session.$foldData;
+        var folds = foldLines[0].folds.concat(foldLines[1].folds);
+
+        function test(startRow, startColumn, endColumn, endRow, folds) {
+            var r = new Range(startRow, startColumn, endColumn, endRow);
+            var retFolds = session.getFoldsInRange(r);
+
+            assert.ok(retFolds.length == folds.length);
+            for (var i = 0; i < retFolds.length; i++) {
+                assert.equal(retFolds[i].range + "", folds[i].range + "");
+            }
+        }
+
+        test(0, 0, 0, 13,  [ ]);
+        test(0, 0, 0, 14,  [ folds[0] ]);
+        test(0, 0, 0, 18,  [ folds[0] ]);
+        test(0, 0, 1, 10,  [ folds[0] ]);
+        test(0, 0, 1, 11,  [ folds[0], folds[1] ]);
+        test(0, 18, 1, 11, [ folds[1] ]);
+        test(2, 0,  2, 13, [ folds[1] ]);
+        test(2, 10, 2, 20, [ ]);
+        test(2, 10, 2, 11, [ ]);
+        test(2, 19, 2, 20, [ ]);
+    },
+
+    "test fold one-line text insert": function() {
+        // These are mostly test for the FoldLine.addRemoveChars function.
+        var session = createFoldTestSession();
+        var undoManager = session.getUndoManager();
+        var foldLines = session.$foldData;
+
+        function insert(row, column, text) {
+            session.insert({row: row, column: column}, text);
+
+            // Force the session to store all changes made to the document NOW
+            // on the undoManager's queue. Otherwise we can't undo in separate
+            // steps later.
+            session.$syncInformUndoManager();
+        }
+
+        var foldLine, fold, folds;
+        // First line.
+        foldLine = session.$foldData[0];
+        fold = foldLine.folds[0];
+
+        insert(0, 0, "0");
+        assert.range(foldLine.range, 0, 14, 0, 19);
+        assert.range(fold.range,     0, 14, 0, 19);
+        insert(0, 14, "1");
+        assert.range(foldLine.range, 0, 15, 0, 20);
+        assert.range(fold.range,     0, 15, 0, 20);
+        insert(0, 20, "2");
+        assert.range(foldLine.range, 0, 15, 0, 20);
+        assert.range(fold.range,     0, 15, 0, 20);
+
+        // Second line.
+        foldLine = session.$foldData[1];
+        folds = foldLine.folds;
+
+        insert(1, 0, "3");
+        assert.range(foldLine.range, 1, 11, 2, 25);
+        assert.range(folds[0].range, 1, 11, 2, 10);
+        assert.range(folds[1].range, 2, 20, 2, 25);
+
+        insert(1, 11, "4");
+        assert.range(foldLine.range, 1, 12, 2, 25);
+        assert.range(folds[0].range, 1, 12, 2, 10);
+        assert.range(folds[1].range, 2, 20, 2, 25);
+
+        insert(2, 10, "5");
+        assert.range(foldLine.range, 1, 12, 2, 26);
+        assert.range(folds[0].range, 1, 12, 2, 10);
+        assert.range(folds[1].range, 2, 21, 2, 26);
+
+        insert(2, 21, "6");
+        assert.range(foldLine.range, 1, 12, 2, 27);
+        assert.range(folds[0].range, 1, 12, 2, 10);
+        assert.range(folds[1].range, 2, 22, 2, 27);
+
+        insert(2, 27, "7");
+        assert.range(foldLine.range, 1, 12, 2, 27);
+        assert.range(folds[0].range, 1, 12, 2, 10);
+        assert.range(folds[1].range, 2, 22, 2, 27);
+
+        // UNDO = REMOVE
+        undoManager.undo(); // 6
+        assert.range(foldLine.range, 1, 12, 2, 27);
+        assert.range(folds[0].range, 1, 12, 2, 10);
+        assert.range(folds[1].range, 2, 22, 2, 27);
+
+        undoManager.undo(); // 5
+        assert.range(foldLine.range, 1, 12, 2, 26);
+        assert.range(folds[0].range, 1, 12, 2, 10);
+        assert.range(folds[1].range, 2, 21, 2, 26);
+
+        undoManager.undo(); // 4
+        assert.range(foldLine.range, 1, 12, 2, 25);
+        assert.range(folds[0].range, 1, 12, 2, 10);
+        assert.range(folds[1].range, 2, 20, 2, 25);
+
+        undoManager.undo(); // 3
+        assert.range(foldLine.range, 1, 11, 2, 25);
+        assert.range(folds[0].range, 1, 11, 2, 10);
+        assert.range(folds[1].range, 2, 20, 2, 25);
+
+        undoManager.undo(); // Beginning first line.
+        assert.equal(foldLines.length, 2);
+        assert.range(foldLines[0].range, 0, 15, 0, 20);
+        assert.range(foldLines[1].range, 1, 10, 2, 25);
+
+        foldLine = session.$foldData[0];
+        fold = foldLine.folds[0];
+
+        undoManager.undo(); // 2
+        assert.range(foldLine.range, 0, 15, 0, 20);
+        assert.range(fold.range,     0, 15, 0, 20);
+
+        undoManager.undo(); // 1
+        assert.range(foldLine.range, 0, 14, 0, 19);
+        assert.range(fold.range,     0, 14, 0, 19);
+
+        undoManager.undo(); // 0
+        assert.range(foldLine.range, 0, 13, 0, 18);
+        assert.range(fold.range,     0, 13, 0, 18);
+    },
+
+    "test fold multi-line insert/remove": function() {
+        var session = createFoldTestSession(),
+            undoManager = session.getUndoManager(),
+            foldLines = session.$foldData;
+        function insert(row, column, text) {
+            session.insert({row: row, column: column}, text);
+            // Force the session to store all changes made to the document NOW
+            // on the undoManager's queue. Otherwise we can't undo in separate
+            // steps later.
+            session.$syncInformUndoManager();
+        }
+
+        var foldLines = session.$foldData, foldLine, fold, folds;
+
+        insert(0, 0, "\nfo0");
+        assert.equal(foldLines.length, 2);
+        assert.range(foldLines[0].range, 1, 16, 1, 21);
+        assert.range(foldLines[1].range, 2, 10, 3, 25);
+
+        insert(2, 0, "\nba1");
+        assert.equal(foldLines.length, 2);
+        assert.range(foldLines[0].range, 1, 16, 1, 21);
+        assert.range(foldLines[1].range, 3, 13, 4, 25);
+
+        insert(3, 10, "\nfo2");
+        assert.equal(foldLines.length, 2);
+        assert.range(foldLines[0].range, 1, 16, 1, 21);
+        assert.range(foldLines[1].range, 4,  6, 5, 25);
+
+        insert(5, 10, "\nba3");
+        assert.equal(foldLines.length, 3);
+        assert.range(foldLines[0].range, 1, 16, 1, 21);
+        assert.range(foldLines[1].range, 4,  6, 5, 10);
+        assert.range(foldLines[2].range, 6, 13, 6, 18);
+
+        insert(6, 18, "\nfo4");
+        assert.equal(foldLines.length, 3);
+        assert.range(foldLines[0].range, 1, 16, 1, 21);
+        assert.range(foldLines[1].range, 4,  6, 5, 10);
+        assert.range(foldLines[2].range, 6, 13, 6, 18);
+
+        undoManager.undo(); // 3
+        assert.equal(foldLines.length, 3);
+        assert.range(foldLines[0].range, 1, 16, 1, 21);
+        assert.range(foldLines[1].range, 4,  6, 5, 10);
+        assert.range(foldLines[2].range, 6, 13, 6, 18);
+
+        undoManager.undo(); // 2
+        assert.equal(foldLines.length, 2);
+        assert.range(foldLines[0].range, 1, 16, 1, 21);
+        assert.range(foldLines[1].range, 4,  6, 5, 25);
+
+        undoManager.undo(); // 1
+        assert.equal(foldLines.length, 2);
+        assert.range(foldLines[0].range, 1, 16, 1, 21);
+        assert.range(foldLines[1].range, 3, 13, 4, 25);
+
+        undoManager.undo(); // 0
+        assert.equal(foldLines.length, 2);
+        assert.range(foldLines[0].range, 1, 16, 1, 21);
+        assert.range(foldLines[1].range, 2, 10, 3, 25);
+
+        undoManager.undo(); // Beginning
+        assert.equal(foldLines.length, 2);
+        assert.range(foldLines[0].range, 0, 13, 0, 18);
+        assert.range(foldLines[1].range, 1, 10, 2, 25);
+        // TODO: Add test for inseration inside of folds.
+    },
+
+    "test fold wrap data compution": function() {
+        function assertWrap(line0, line1, line2) {
+            line0 && assertArray(wrapData[0], line0);
+            line1 && assertArray(wrapData[1], line1);
+            line2 && assertArray(wrapData[2], line2);
+        }
+
+        function removeFoldAssertWrap(docRow, docColumn, line0, line1, line2) {
+            session.removeFold(session.getFoldAt(docRow, docColumn));
+            assertWrap(line0, line1, line2);
+        }
+
+        var lines = [
+            "foo bar foo bar",
+            "foo bar foo bar",
+            "foo bar foo bar"
+        ];
+
+        var session = new EditSession(lines.join("\n"));
+        session.setUseWrapMode(true);
+        session.$wrapLimit = 7;
+        session.$updateWrapData(0, 2);
+        var wrapData = session.$wrapData;
+
+        // Do a simple assertion without folds to check basic functionallity.
+        assertWrap([8], [8], [8]);
+
+        // --- Do in line folding ---
+
+        // Adding a fold. The split position is inside of the fold. As placeholder
+        // are not splitable, the split should be before the split.
+        session.addFold("woot", new Range(0, 4, 0, 15));
+        assertWrap([4], [8], [8]);
+
+        // Remove the fold again which should reset the wrapData.
+        removeFoldAssertWrap(0, 4, [8], [8], [8]);
+
+        session.addFold("woot", new Range(0, 6, 0, 9));
+        assertWrap([6, 13], [8], [8]);
+        removeFoldAssertWrap(0, 6, [8], [8], [8]);
+
+        // The fold fits into the wrap limit - no split expected.
+        session.addFold("woot", new Range(0, 3, 0, 15));
+        assertWrap([], [8], [8]);
+        removeFoldAssertWrap(0, 4, [8], [8], [8]);
+
+        // Fold after split position should be all fine.
+        session.addFold("woot", new Range(0, 8, 0, 15));
+        assertWrap([8], [8], [8]);
+        removeFoldAssertWrap(0, 8, [8], [8], [8]);
+
+        // Fold's placeholder is far too long for wrapSplit.
+        session.addFold("woot0123456789", new Range(0, 8, 0, 15));
+        assertWrap([8], [8], [8]);
+        removeFoldAssertWrap(0, 8, [8], [8], [8]);
+
+        // Fold's placeholder is far too long for wrapSplit
+        // + content at the end of the line
+        session.addFold("woot0123456789", new Range(0, 6, 0, 8));
+        assertWrap([6, 20], [8], [8]);
+        removeFoldAssertWrap(0, 8, [8], [8], [8]);
+
+        session.addFold("woot0123456789", new Range(0, 6, 0, 8));
+        session.addFold("woot0123456789", new Range(0, 8, 0, 10));
+        assertWrap([6, 20, 34], [8], [8]);
+        session.removeFold(session.getFoldAt(0, 7));
+        removeFoldAssertWrap(0, 8, [8], [8], [8]);
+
+        session.addFold("woot0123456789", new Range(0, 7, 0, 9));
+        session.addFold("woot0123456789", new Range(0, 13, 0, 15));
+        assertWrap([7, 21, 25], [8], [8]);
+        session.removeFold(session.getFoldAt(0, 7));
+        removeFoldAssertWrap(0, 14, [8], [8], [8]);
+
+        // --- Do some multiline folding ---
+
+        // Add a fold over two lines. Note, that the wrapData[1] stays the
+        // same. This is an implementation detail and expected behavior.
+        session.addFold("woot", new Range(0, 8, 1, 15));
+        assertWrap([8], [8 /* See comments */], [8]);
+        removeFoldAssertWrap(0, 8, [8], [8], [8]);
+
+        session.addFold("woot", new Range(0, 9, 1, 11));
+        assertWrap([8, 14], [8 /* See comments */], [8]);
+        removeFoldAssertWrap(0, 9, [8], [8], [8]);
+
+        session.addFold("woot", new Range(0, 9, 1, 15));
+        assertWrap([8], [8 /* See comments */], [8]);
+        removeFoldAssertWrap(0, 9, [8], [8], [8]);
+
+        return session;
+    },
+    
+    "test delete fold with wrap enabled": function() {
+        var session = new EditSession("");
+        session.setValue([
+            "This is some placeholder text that will be folded inline.",
+            "This is some placeholder text that will be folded inline.",
+            "More text.",
+            "<p>The cursor in this paragraph text will be offset by 1 row.<p>",
+            "<p>Everything after this will be offset as well due to the folds in the row before too.</p>"
+        ].join("\n"));
+        session.addFold('...', new Range(0, 8, 0, 42));
+        session.addFold('...', new Range(1, 8, 1, 42));
+        session.addFold('...', new Range(3, 7, 3, 51));
+        session.setOption("wrap", 40);
+        session.remove(new Range(0,0, 2, 5));
+        // needed because adjustWrapLimit is called async from renderer
+        session.adjustWrapLimit(80);
+        
+        assert.equal(session.$wrapData + "", [[], [], [40, 76]] + "");
+    },
+        
+    "test add fold": function() {
+        var session = createFoldTestSession();
+        var fold;
+
+        function tryAddFold(placeholder, range, shouldFail) {
+            var fail = false;
+            try {
+                fold = session.addFold(placeholder, range);
+            } catch (e) {
+                fail = true;
+            }
+            if (fail != shouldFail) {
+                throw new Error("Expected to get an exception");
+            }
+        }
+
+        tryAddFold("foo", new Range(0, 13, 0, 17), false);
+        tryAddFold("foo", new Range(0, 14, 0, 18), true);
+        tryAddFold("foo", new Range(0, 13, 0, 18), false);
+        assert.equal(session.$foldData[0].folds.length, 1);
+
+        tryAddFold("f", new Range(0, 13, 0, 18), false);
+        tryAddFold("foo", new Range(0, 18, 0, 21), false);
+        assert.equal(session.$foldData[0].folds.length, 2);
+        session.removeFold(fold);
+
+        tryAddFold("foo", new Range(0, 18, 0, 22), false);
+        tryAddFold("foo", new Range(0, 18, 0, 19), true);
+        tryAddFold("foo", new Range(0, 22, 1, 10), false);
+    },
+
+    "test add subfolds": function() {
+        var session = createFoldTestSession();
+        var fold, oldFold;
+        var foldData = session.$foldData;
+
+        oldFold = foldData[0].folds[0];
+
+        fold = session.addFold("fold0", new Range(0, 10, 0, 21));
+        assert.equal(foldData[0].folds.length, 1);
+        assert.equal(fold.subFolds.length, 1);
+        assert.equal(fold.subFolds[0], oldFold);
+
+        session.expandFold(fold);
+        assert.equal(foldData[0].folds.length, 1);
+        assert.equal(foldData[0].folds[0], oldFold);
+        assert.equal(fold.subFolds.length, 0);
+
+        fold = session.addFold("fold0", new Range(0, 13, 2, 10));
+        assert.equal(foldData.length, 1);
+        assert.equal(fold.subFolds.length, 2);
+        assert.equal(fold.subFolds[0], oldFold);
+
+        session.expandFold(fold);
+        assert.equal(foldData.length, 2);
+        assert.equal(foldData[0].folds.length, 1);
+        assert.equal(foldData[0].folds[0], oldFold);
+        assert.equal(fold.subFolds.length, 0);
+
+        session.unfold(null, true);
+        fold = session.addFold("fold0", new Range(0, 0, 0, 21));
+        session.addFold("fold0", new Range(0, 1, 0, 5));
+        session.addFold("fold0", new Range(0, 6, 0, 8));
+        assert.equal(fold.subFolds.length, 2);
+    },
+
+    "test row cache": function() {
+        var session = createFoldTestSession();
+
+        session.screenToDocumentPosition(2,3);
+        assertArray(session.$docRowCache, [1,3]);
+        assertArray(session.$screenRowCache, [1,2]);
+
+        session.screenToDocumentPosition(5,3);
+        assertArray(session.$docRowCache, [1,3,4]);
+        assertArray(session.$screenRowCache, [1,2,3]);
+
+        session.screenToDocumentPosition(0,3);
+        assertArray(session.$docRowCache, [1,3,4]);
+        assertArray(session.$screenRowCache, [1,2,3]);
+
+        var pos = session.screenToDocumentPosition(0,0);
+        assert.equal(pos.row, 0);
+        assertArray(session.$docRowCache, [1,3,4]);
+        assertArray(session.$screenRowCache, [1,2,3]);
+        
+        session.screenToDocumentPosition(1,0);
+        assertArray(session.$docRowCache, [1,3,4]);
+        assertArray(session.$screenRowCache, [1,2,3]);
+
+        session.$resetRowCache();
+        assertArray(session.$docRowCache, []);
+        assertArray(session.$screenRowCache, []);
+        
+        session.screenToDocumentPosition(1,3);
+        assertArray(session.$docRowCache, [1]);
+        assertArray(session.$screenRowCache, [1]);
+       
+        session.screenToDocumentPosition(5,3);
+        assertArray(session.$docRowCache, [1,3,4]);
+        assertArray(session.$screenRowCache, [1,2,3]);
+        
+        session = new EditSession(new Array(30).join("\n"));
+        session.documentToScreenPosition(2,0);
+        session.documentToScreenPosition(2,0);
+        assertArray(session.$docRowCache, [1,2]);
+        assertArray(session.$screenRowCache, [1,2]);
+    },
+
+    "test annotations": function() {
+        var session = new EditSession([]),
+            annotation = {row: 0, type: 'info', text: "This is a test."};
+
+        session.clearAnnotations();
+        assertArray(session.getAnnotations(), []);
+        session.setAnnotations([annotation]);
+        assertArray(session.getAnnotations(), [annotation]);
+    },
+    
+    "test: mode loading" : function(next) {
+        if (!require.undef) {
+            console.log("Skipping test: This test only runs in the browser");
+            next();
+            return;
+        }
+        var session = new EditSession([]);
+        session.setMode("ace/mode/javascript");
+        assert.equal(session.$modeid, "ace/mode/javascript");
+        session.on("changeMode", function() {
+            assert.equal(session.$modeid, "ace/mode/javascript");
+        });
+        session.setMode("ace/mode/sh", function(mode) {
+            assert.ok(!mode);
+        });
+        setTimeout(function() {
+            session.setMode("ace/mode/javascript", function(mode) {
+                session.setMode("ace/mode/javascript");
+                assert.equal(session.$modeid, "ace/mode/javascript");
+                next();
+            });
+        }, 0);
+    }
+};
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec();
+}


[08/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/php_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/php_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/php_highlight_rules.js
new file mode 100644
index 0000000..033671e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/php_highlight_rules.js
@@ -0,0 +1,1088 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+
+var PhpLangHighlightRules = function() {
+    var docComment = DocCommentHighlightRules;
+    // http://php.net/quickref.php
+    var builtinFunctions = lang.arrayToMap(
+        ('abs|acos|acosh|addcslashes|addslashes|aggregate|aggregate_info|aggregate_methods|aggregate_methods_by_list|aggregate_methods_by_regexp|' +
+        'aggregate_properties|aggregate_properties_by_list|aggregate_properties_by_regexp|aggregation_info|amqpconnection|amqpexchange|amqpqueue|' +
+        'apache_child_terminate|apache_get_modules|apache_get_version|apache_getenv|apache_lookup_uri|apache_note|apache_request_headers|' +
+        'apache_reset_timeout|apache_response_headers|apache_setenv|apc_add|apc_bin_dump|apc_bin_dumpfile|apc_bin_load|apc_bin_loadfile|' +
+        'apc_cache_info|apc_cas|apc_clear_cache|apc_compile_file|apc_dec|apc_define_constants|apc_delete|apc_delete_file|apc_exists|apc_fetch|' +
+        'apc_inc|apc_load_constants|apc_sma_info|apc_store|apciterator|apd_breakpoint|apd_callstack|apd_clunk|apd_continue|apd_croak|' +
+        'apd_dump_function_table|apd_dump_persistent_resources|apd_dump_regular_resources|apd_echo|apd_get_active_symbols|apd_set_pprof_trace|' +
+        'apd_set_session|apd_set_session_trace|apd_set_session_trace_socket|appenditerator|array|array_change_key_case|array_chunk|array_combine|' +
+        'array_count_values|array_diff|array_diff_assoc|array_diff_key|array_diff_uassoc|array_diff_ukey|array_fill|array_fill_keys|array_filter|' +
+        'array_flip|array_intersect|array_intersect_assoc|array_intersect_key|array_intersect_uassoc|array_intersect_ukey|array_key_exists|' +
+        'array_keys|array_map|array_merge|array_merge_recursive|array_multisort|array_pad|array_pop|array_product|array_push|array_rand|' +
+        'array_reduce|array_replace|array_replace_recursive|array_reverse|array_search|array_shift|array_slice|array_splice|array_sum|array_udiff|' +
+        'array_udiff_assoc|array_udiff_uassoc|array_uintersect|array_uintersect_assoc|array_uintersect_uassoc|array_unique|array_unshift|' +
+        'array_values|array_walk|array_walk_recursive|arrayaccess|arrayiterator|arrayobject|arsort|asin|asinh|asort|assert|assert_options|atan|' +
+        'atan2|atanh|audioproperties|badfunctioncallexception|badmethodcallexception|base64_decode|base64_encode|base_convert|basename|' +
+        'bbcode_add_element|bbcode_add_smiley|bbcode_create|bbcode_destroy|bbcode_parse|bbcode_set_arg_parser|bbcode_set_flags|bcadd|bccomp|bcdiv|' +
+        'bcmod|bcmul|bcompiler_load|bcompiler_load_exe|bcompiler_parse_class|bcompiler_read|bcompiler_write_class|bcompiler_write_constant|' +
+        'bcompiler_write_exe_footer|bcompiler_write_file|bcompiler_write_footer|bcompiler_write_function|bcompiler_write_functions_from_file|' +
+        'bcompiler_write_header|bcompiler_write_included_filename|bcpow|bcpowmod|bcscale|bcsqrt|bcsub|bin2hex|bind_textdomain_codeset|bindec|' +
+        'bindtextdomain|bson_decode|bson_encode|bumpValue|bzclose|bzcompress|bzdecompress|bzerrno|bzerror|bzerrstr|bzflush|bzopen|bzread|bzwrite|' +
+        'cachingiterator|cairo|cairo_create|cairo_font_face_get_type|cairo_font_face_status|cairo_font_options_create|cairo_font_options_equal|' +
+        'cairo_font_options_get_antialias|cairo_font_options_get_hint_metrics|cairo_font_options_get_hint_style|' +
+        'cairo_font_options_get_subpixel_order|cairo_font_options_hash|cairo_font_options_merge|cairo_font_options_set_antialias|' +
+        'cairo_font_options_set_hint_metrics|cairo_font_options_set_hint_style|cairo_font_options_set_subpixel_order|cairo_font_options_status|' +
+        'cairo_format_stride_for_width|cairo_image_surface_create|cairo_image_surface_create_for_data|cairo_image_surface_create_from_png|' +
+        'cairo_image_surface_get_data|cairo_image_surface_get_format|cairo_image_surface_get_height|cairo_image_surface_get_stride|' +
+        'cairo_image_surface_get_width|cairo_matrix_create_scale|cairo_matrix_create_translate|cairo_matrix_invert|cairo_matrix_multiply|' +
+        'cairo_matrix_rotate|cairo_matrix_transform_distance|cairo_matrix_transform_point|cairo_matrix_translate|cairo_pattern_add_color_stop_rgb|' +
+        'cairo_pattern_add_color_stop_rgba|cairo_pattern_create_for_surface|cairo_pattern_create_linear|cairo_pattern_create_radial|' +
+        'cairo_pattern_create_rgb|cairo_pattern_create_rgba|cairo_pattern_get_color_stop_count|cairo_pattern_get_color_stop_rgba|' +
+        'cairo_pattern_get_extend|cairo_pattern_get_filter|cairo_pattern_get_linear_points|cairo_pattern_get_matrix|' +
+        'cairo_pattern_get_radial_circles|cairo_pattern_get_rgba|cairo_pattern_get_surface|cairo_pattern_get_type|cairo_pattern_set_extend|' +
+        'cairo_pattern_set_filter|cairo_pattern_set_matrix|cairo_pattern_status|cairo_pdf_surface_create|cairo_pdf_surface_set_size|' +
+        'cairo_ps_get_levels|cairo_ps_level_to_string|cairo_ps_surface_create|cairo_ps_surface_dsc_begin_page_setup|' +
+        'cairo_ps_surface_dsc_begin_setup|cairo_ps_surface_dsc_comment|cairo_ps_surface_get_eps|cairo_ps_surface_restrict_to_level|' +
+        'cairo_ps_surface_set_eps|cairo_ps_surface_set_size|cairo_scaled_font_create|cairo_scaled_font_extents|cairo_scaled_font_get_ctm|' +
+        'cairo_scaled_font_get_font_face|cairo_scaled_font_get_font_matrix|cairo_scaled_font_get_font_options|cairo_scaled_font_get_scale_matrix|' +
+        'cairo_scaled_font_get_type|cairo_scaled_font_glyph_extents|cairo_scaled_font_status|cairo_scaled_font_text_extents|' +
+        'cairo_surface_copy_page|cairo_surface_create_similar|cairo_surface_finish|cairo_surface_flush|cairo_surface_get_content|' +
+        'cairo_surface_get_device_offset|cairo_surface_get_font_options|cairo_surface_get_type|cairo_surface_mark_dirty|' +
+        'cairo_surface_mark_dirty_rectangle|cairo_surface_set_device_offset|cairo_surface_set_fallback_resolution|cairo_surface_show_page|' +
+        'cairo_surface_status|cairo_surface_write_to_png|cairo_svg_surface_create|cairo_svg_surface_restrict_to_version|' +
+        'cairo_svg_version_to_string|cairoantialias|cairocontent|cairocontext|cairoexception|cairoextend|cairofillrule|cairofilter|cairofontface|' +
+        'cairofontoptions|cairofontslant|cairofonttype|cairofontweight|cairoformat|cairogradientpattern|cairohintmetrics|cairohintstyle|' +
+        'cairoimagesurface|cairolineargradient|cairolinecap|cairolinejoin|cairomatrix|cairooperator|cairopath|cairopattern|cairopatterntype|' +
+        'cairopdfsurface|cairopslevel|cairopssurface|cairoradialgradient|cairoscaledfont|cairosolidpattern|cairostatus|cairosubpixelorder|' +
+        'cairosurface|cairosurfacepattern|cairosurfacetype|cairosvgsurface|cairosvgversion|cairotoyfontface|cal_days_in_month|cal_from_jd|cal_info|' +
+        'cal_to_jd|calcul_hmac|calculhmac|call_user_func|call_user_func_array|call_user_method|call_user_method_array|callbackfilteriterator|ceil|' +
+        'chdb|chdb_create|chdir|checkdate|checkdnsrr|chgrp|chmod|chop|chown|chr|chroot|chunk_split|class_alias|class_exists|class_implements|' +
+        'class_parents|classkit_import|classkit_method_add|classkit_method_copy|classkit_method_redefine|classkit_method_remove|' +
+        'classkit_method_rename|clearstatcache|clone|closedir|closelog|collator|com|com_addref|com_create_guid|com_event_sink|com_get|' +
+        'com_get_active_object|com_invoke|com_isenum|com_load|com_load_typelib|com_message_pump|com_print_typeinfo|com_propget|com_propput|' +
+        'com_propset|com_release|com_set|compact|connection_aborted|connection_status|connection_timeout|constant|construct|construct|construct|' +
+        'convert_cyr_string|convert_uudecode|convert_uuencode|copy|cos|cosh|count|count_chars|countable|counter_bump|counter_bump_value|' +
+        'counter_create|counter_get|counter_get_meta|counter_get_named|counter_get_value|counter_reset|counter_reset_value|crack_check|' +
+        'crack_closedict|crack_getlastmessage|crack_opendict|crc32|create_function|crypt|ctype_alnum|ctype_alpha|ctype_cntrl|ctype_digit|' +
+        'ctype_graph|ctype_lower|ctype_print|ctype_punct|ctype_space|ctype_upper|ctype_xdigit|cubrid_affected_rows|cubrid_bind|' +
+        'cubrid_client_encoding|cubrid_close|cubrid_close_prepare|cubrid_close_request|cubrid_col_get|cubrid_col_size|cubrid_column_names|' +
+        'cubrid_column_types|cubrid_commit|cubrid_connect|cubrid_connect_with_url|cubrid_current_oid|cubrid_data_seek|cubrid_db_name|' +
+        'cubrid_disconnect|cubrid_drop|cubrid_errno|cubrid_error|cubrid_error_code|cubrid_error_code_facility|cubrid_error_msg|cubrid_execute|' +
+        'cubrid_fetch|cubrid_fetch_array|cubrid_fetch_assoc|cubrid_fetch_field|cubrid_fetch_lengths|cubrid_fetch_object|cubrid_fetch_row|' +
+        'cubrid_field_flags|cubrid_field_len|cubrid_field_name|cubrid_field_seek|cubrid_field_table|cubrid_field_type|cubrid_free_result|' +
+        'cubrid_get|cubrid_get_autocommit|cubrid_get_charset|cubrid_get_class_name|cubrid_get_client_info|cubrid_get_db_parameter|' +
+        'cubrid_get_server_info|cubrid_insert_id|cubrid_is_instance|cubrid_list_dbs|cubrid_load_from_glo|cubrid_lob_close|cubrid_lob_export|' +
+        'cubrid_lob_get|cubrid_lob_send|cubrid_lob_size|cubrid_lock_read|cubrid_lock_write|cubrid_move_cursor|cubrid_new_glo|cubrid_next_result|' +
+        'cubrid_num_cols|cubrid_num_fields|cubrid_num_rows|cubrid_ping|cubrid_prepare|cubrid_put|cubrid_query|cubrid_real_escape_string|' +
+        'cubrid_result|cubrid_rollback|cubrid_save_to_glo|cubrid_schema|cubrid_send_glo|cubrid_seq_drop|cubrid_seq_insert|cubrid_seq_put|' +
+        'cubrid_set_add|cubrid_set_autocommit|cubrid_set_db_parameter|cubrid_set_drop|cubrid_unbuffered_query|cubrid_version|curl_close|' +
+        'curl_copy_handle|curl_errno|curl_error|curl_exec|curl_getinfo|curl_init|curl_multi_add_handle|curl_multi_close|curl_multi_exec|' +
+        'curl_multi_getcontent|curl_multi_info_read|curl_multi_init|curl_multi_remove_handle|curl_multi_select|curl_setopt|curl_setopt_array|' +
+        'curl_version|current|cyrus_authenticate|cyrus_bind|cyrus_close|cyrus_connect|cyrus_query|cyrus_unbind|date|date_add|date_create|' +
+        'date_create_from_format|date_date_set|date_default_timezone_get|date_default_timezone_set|date_diff|date_format|date_get_last_errors|' +
+        'date_interval_create_from_date_string|date_interval_format|date_isodate_set|date_modify|date_offset_get|date_parse|date_parse_from_format|' +
+        'date_sub|date_sun_info|date_sunrise|date_sunset|date_time_set|date_timestamp_get|date_timestamp_set|date_timezone_get|date_timezone_set|' +
+        'dateinterval|dateperiod|datetime|datetimezone|db2_autocommit|db2_bind_param|db2_client_info|db2_close|db2_column_privileges|db2_columns|' +
+        'db2_commit|db2_conn_error|db2_conn_errormsg|db2_connect|db2_cursor_type|db2_escape_string|db2_exec|db2_execute|db2_fetch_array|' +
+        'db2_fetch_assoc|db2_fetch_both|db2_fetch_object|db2_fetch_row|db2_field_display_size|db2_field_name|db2_field_num|db2_field_precision|' +
+        'db2_field_scale|db2_field_type|db2_field_width|db2_foreign_keys|db2_free_result|db2_free_stmt|db2_get_option|db2_last_insert_id|' +
+        'db2_lob_read|db2_next_result|db2_num_fields|db2_num_rows|db2_pclose|db2_pconnect|db2_prepare|db2_primary_keys|db2_procedure_columns|' +
+        'db2_procedures|db2_result|db2_rollback|db2_server_info|db2_set_option|db2_special_columns|db2_statistics|db2_stmt_error|db2_stmt_errormsg|' +
+        'db2_table_privileges|db2_tables|dba_close|dba_delete|dba_exists|dba_fetch|dba_firstkey|dba_handlers|dba_insert|dba_key_split|dba_list|' +
+        'dba_nextkey|dba_open|dba_optimize|dba_popen|dba_replace|dba_sync|dbase_add_record|dbase_close|dbase_create|dbase_delete_record|' +
+        'dbase_get_header_info|dbase_get_record|dbase_get_record_with_names|dbase_numfields|dbase_numrecords|dbase_open|dbase_pack|' +
+        'dbase_replace_record|dbplus_add|dbplus_aql|dbplus_chdir|dbplus_close|dbplus_curr|dbplus_errcode|dbplus_errno|dbplus_find|dbplus_first|' +
+        'dbplus_flush|dbplus_freealllocks|dbplus_freelock|dbplus_freerlocks|dbplus_getlock|dbplus_getunique|dbplus_info|dbplus_last|dbplus_lockrel|' +
+        'dbplus_next|dbplus_open|dbplus_prev|dbplus_rchperm|dbplus_rcreate|dbplus_rcrtexact|dbplus_rcrtlike|dbplus_resolve|dbplus_restorepos|' +
+        'dbplus_rkeys|dbplus_ropen|dbplus_rquery|dbplus_rrename|dbplus_rsecindex|dbplus_runlink|dbplus_rzap|dbplus_savepos|dbplus_setindex|' +
+        'dbplus_setindexbynumber|dbplus_sql|dbplus_tcl|dbplus_tremove|dbplus_undo|dbplus_undoprepare|dbplus_unlockrel|dbplus_unselect|' +
+        'dbplus_update|dbplus_xlockrel|dbplus_xunlockrel|dbx_close|dbx_compare|dbx_connect|dbx_error|dbx_escape_string|dbx_fetch_row|dbx_query|' +
+        'dbx_sort|dcgettext|dcngettext|deaggregate|debug_backtrace|debug_print_backtrace|debug_zval_dump|decbin|dechex|decoct|define|' +
+        'define_syslog_variables|defined|deg2rad|delete|dgettext|die|dio_close|dio_fcntl|dio_open|dio_read|dio_seek|dio_stat|dio_tcsetattr|' +
+        'dio_truncate|dio_write|dir|directoryiterator|dirname|disk_free_space|disk_total_space|diskfreespace|dl|dngettext|dns_check_record|' +
+        'dns_get_mx|dns_get_record|dom_import_simplexml|domainexception|domattr|domattribute_name|domattribute_set_value|domattribute_specified|' +
+        'domattribute_value|domcharacterdata|domcomment|domdocument|domdocument_add_root|domdocument_create_attribute|' +
+        'domdocument_create_cdata_section|domdocument_create_comment|domdocument_create_element|domdocument_create_element_ns|' +
+        'domdocument_create_entity_reference|domdocument_create_processing_instruction|domdocument_create_text_node|domdocument_doctype|' +
+        'domdocument_document_element|domdocument_dump_file|domdocument_dump_mem|domdocument_get_element_by_id|domdocument_get_elements_by_tagname|' +
+        'domdocument_html_dump_mem|domdocument_xinclude|domdocumentfragment|domdocumenttype|domdocumenttype_entities|' +
+        'domdocumenttype_internal_subset|domdocumenttype_name|domdocumenttype_notations|domdocumenttype_public_id|domdocumenttype_system_id|' +
+        'domelement|domelement_get_attribute|domelement_get_attribute_node|domelement_get_elements_by_tagname|domelement_has_attribute|' +
+        'domelement_remove_attribute|domelement_set_attribute|domelement_set_attribute_node|domelement_tagname|domentity|domentityreference|' +
+        'domexception|domimplementation|domnamednodemap|domnode|domnode_add_namespace|domnode_append_child|domnode_append_sibling|' +
+        'domnode_attributes|domnode_child_nodes|domnode_clone_node|domnode_dump_node|domnode_first_child|domnode_get_content|' +
+        'domnode_has_attributes|domnode_has_child_nodes|domnode_insert_before|domnode_is_blank_node|domnode_last_child|domnode_next_sibling|' +
+        'domnode_node_name|domnode_node_type|domnode_node_value|domnode_owner_document|domnode_parent_node|domnode_prefix|domnode_previous_sibling|' +
+        'domnode_remove_child|domnode_replace_child|domnode_replace_node|domnode_set_content|domnode_set_name|domnode_set_namespace|' +
+        'domnode_unlink_node|domnodelist|domnotation|domprocessinginstruction|domprocessinginstruction_data|domprocessinginstruction_target|' +
+        'domtext|domxml_new_doc|domxml_open_file|domxml_open_mem|domxml_version|domxml_xmltree|domxml_xslt_stylesheet|domxml_xslt_stylesheet_doc|' +
+        'domxml_xslt_stylesheet_file|domxml_xslt_version|domxpath|domxsltstylesheet_process|domxsltstylesheet_result_dump_file|' +
+        'domxsltstylesheet_result_dump_mem|dotnet|dotnet_load|doubleval|each|easter_date|easter_days|echo|empty|emptyiterator|' +
+        'enchant_broker_describe|enchant_broker_dict_exists|enchant_broker_free|enchant_broker_free_dict|enchant_broker_get_error|' +
+        'enchant_broker_init|enchant_broker_list_dicts|enchant_broker_request_dict|enchant_broker_request_pwl_dict|enchant_broker_set_ordering|' +
+        'enchant_dict_add_to_personal|enchant_dict_add_to_session|enchant_dict_check|enchant_dict_describe|enchant_dict_get_error|' +
+        'enchant_dict_is_in_session|enchant_dict_quick_check|enchant_dict_store_replacement|enchant_dict_suggest|end|ereg|ereg_replace|eregi|' +
+        'eregi_replace|error_get_last|error_log|error_reporting|errorexception|escapeshellarg|escapeshellcmd|eval|event_add|event_base_free|' +
+        'event_base_loop|event_base_loopbreak|event_base_loopexit|event_base_new|event_base_priority_init|event_base_set|event_buffer_base_set|' +
+        'event_buffer_disable|event_buffer_enable|event_buffer_fd_set|event_buffer_free|event_buffer_new|event_buffer_priority_set|' +
+        'event_buffer_read|event_buffer_set_callback|event_buffer_timeout_set|event_buffer_watermark_set|event_buffer_write|event_del|event_free|' +
+        'event_new|event_set|exception|exec|exif_imagetype|exif_read_data|exif_tagname|exif_thumbnail|exit|exp|expect_expectl|expect_popen|explode|' +
+        'expm1|export|export|extension_loaded|extract|ezmlm_hash|fam_cancel_monitor|fam_close|fam_monitor_collection|fam_monitor_directory|' +
+        'fam_monitor_file|fam_next_event|fam_open|fam_pending|fam_resume_monitor|fam_suspend_monitor|fbsql_affected_rows|fbsql_autocommit|' +
+        'fbsql_blob_size|fbsql_change_user|fbsql_clob_size|fbsql_close|fbsql_commit|fbsql_connect|fbsql_create_blob|fbsql_create_clob|' +
+        'fbsql_create_db|fbsql_data_seek|fbsql_database|fbsql_database_password|fbsql_db_query|fbsql_db_status|fbsql_drop_db|fbsql_errno|' +
+        'fbsql_error|fbsql_fetch_array|fbsql_fetch_assoc|fbsql_fetch_field|fbsql_fetch_lengths|fbsql_fetch_object|fbsql_fetch_row|' +
+        'fbsql_field_flags|fbsql_field_len|fbsql_field_name|fbsql_field_seek|fbsql_field_table|fbsql_field_type|fbsql_free_result|' +
+        'fbsql_get_autostart_info|fbsql_hostname|fbsql_insert_id|fbsql_list_dbs|fbsql_list_fields|fbsql_list_tables|fbsql_next_result|' +
+        'fbsql_num_fields|fbsql_num_rows|fbsql_password|fbsql_pconnect|fbsql_query|fbsql_read_blob|fbsql_read_clob|fbsql_result|fbsql_rollback|' +
+        'fbsql_rows_fetched|fbsql_select_db|fbsql_set_characterset|fbsql_set_lob_mode|fbsql_set_password|fbsql_set_transaction|fbsql_start_db|' +
+        'fbsql_stop_db|fbsql_table_name|fbsql_tablename|fbsql_username|fbsql_warnings|fclose|fdf_add_doc_javascript|fdf_add_template|fdf_close|' +
+        'fdf_create|fdf_enum_values|fdf_errno|fdf_error|fdf_get_ap|fdf_get_attachment|fdf_get_encoding|fdf_get_file|fdf_get_flags|fdf_get_opt|' +
+        'fdf_get_status|fdf_get_value|fdf_get_version|fdf_header|fdf_next_field_name|fdf_open|fdf_open_string|fdf_remove_item|fdf_save|' +
+        'fdf_save_string|fdf_set_ap|fdf_set_encoding|fdf_set_file|fdf_set_flags|fdf_set_javascript_action|fdf_set_on_import_javascript|fdf_set_opt|' +
+        'fdf_set_status|fdf_set_submit_form_action|fdf_set_target_frame|fdf_set_value|fdf_set_version|feof|fflush|fgetc|fgetcsv|fgets|fgetss|file|' +
+        'file_exists|file_get_contents|file_put_contents|fileatime|filectime|filegroup|fileinode|filemtime|fileowner|fileperms|filepro|' +
+        'filepro_fieldcount|filepro_fieldname|filepro_fieldtype|filepro_fieldwidth|filepro_retrieve|filepro_rowcount|filesize|filesystemiterator|' +
+        'filetype|filter_has_var|filter_id|filter_input|filter_input_array|filter_list|filter_var|filter_var_array|filteriterator|finfo_buffer|' +
+        'finfo_close|finfo_file|finfo_open|finfo_set_flags|floatval|flock|floor|flush|fmod|fnmatch|fopen|forward_static_call|' +
+        'forward_static_call_array|fpassthru|fprintf|fputcsv|fputs|fread|frenchtojd|fribidi_log2vis|fscanf|fseek|fsockopen|fstat|ftell|ftok|' +
+        'ftp_alloc|ftp_cdup|ftp_chdir|ftp_chmod|ftp_close|ftp_connect|ftp_delete|ftp_exec|ftp_fget|ftp_fput|ftp_get|ftp_get_option|ftp_login|' +
+        'ftp_mdtm|ftp_mkdir|ftp_nb_continue|ftp_nb_fget|ftp_nb_fput|ftp_nb_get|ftp_nb_put|ftp_nlist|ftp_pasv|ftp_put|ftp_pwd|ftp_quit|ftp_raw|' +
+        'ftp_rawlist|ftp_rename|ftp_rmdir|ftp_set_option|ftp_site|ftp_size|ftp_ssl_connect|ftp_systype|ftruncate|func_get_arg|func_get_args|' +
+        'func_num_args|function_exists|fwrite|gc_collect_cycles|gc_disable|gc_enable|gc_enabled|gd_info|gearmanclient|gearmanjob|gearmantask|' +
+        'gearmanworker|geoip_continent_code_by_name|geoip_country_code3_by_name|geoip_country_code_by_name|geoip_country_name_by_name|' +
+        'geoip_database_info|geoip_db_avail|geoip_db_filename|geoip_db_get_all_info|geoip_id_by_name|geoip_isp_by_name|geoip_org_by_name|' +
+        'geoip_record_by_name|geoip_region_by_name|geoip_region_name_by_code|geoip_time_zone_by_country_and_region|getMeta|getNamed|getValue|' +
+        'get_browser|get_called_class|get_cfg_var|get_class|get_class_methods|get_class_vars|get_current_user|get_declared_classes|' +
+        'get_declared_interfaces|get_defined_constants|get_defined_functions|get_defined_vars|get_extension_funcs|get_headers|' +
+        'get_html_translation_table|get_include_path|get_included_files|get_loaded_extensions|get_magic_quotes_gpc|get_magic_quotes_runtime|' +
+        'get_meta_tags|get_object_vars|get_parent_class|get_required_files|get_resource_type|getallheaders|getconstant|getconstants|getconstructor|' +
+        'getcwd|getdate|getdefaultproperties|getdoccomment|getendline|getenv|getextension|getextensionname|getfilename|gethostbyaddr|gethostbyname|' +
+        'gethostbynamel|gethostname|getimagesize|getinterfacenames|getinterfaces|getlastmod|getmethod|getmethods|getmodifiers|getmxrr|getmygid|' +
+        'getmyinode|getmypid|getmyuid|getname|getnamespacename|getopt|getparentclass|getproperties|getproperty|getprotobyname|getprotobynumber|' +
+        'getrandmax|getrusage|getservbyname|getservbyport|getshortname|getstartline|getstaticproperties|getstaticpropertyvalue|gettext|' +
+        'gettimeofday|gettype|glob|globiterator|gmagick|gmagickdraw|gmagickpixel|gmdate|gmmktime|gmp_abs|gmp_add|gmp_and|gmp_clrbit|gmp_cmp|' +
+        'gmp_com|gmp_div|gmp_div_q|gmp_div_qr|gmp_div_r|gmp_divexact|gmp_fact|gmp_gcd|gmp_gcdext|gmp_hamdist|gmp_init|gmp_intval|gmp_invert|' +
+        'gmp_jacobi|gmp_legendre|gmp_mod|gmp_mul|gmp_neg|gmp_nextprime|gmp_or|gmp_perfect_square|gmp_popcount|gmp_pow|gmp_powm|gmp_prob_prime|' +
+        'gmp_random|gmp_scan0|gmp_scan1|gmp_setbit|gmp_sign|gmp_sqrt|gmp_sqrtrem|gmp_strval|gmp_sub|gmp_testbit|gmp_xor|gmstrftime|' +
+        'gnupg_adddecryptkey|gnupg_addencryptkey|gnupg_addsignkey|gnupg_cleardecryptkeys|gnupg_clearencryptkeys|gnupg_clearsignkeys|gnupg_decrypt|' +
+        'gnupg_decryptverify|gnupg_encrypt|gnupg_encryptsign|gnupg_export|gnupg_geterror|gnupg_getprotocol|gnupg_import|gnupg_init|gnupg_keyinfo|' +
+        'gnupg_setarmor|gnupg_seterrormode|gnupg_setsignmode|gnupg_sign|gnupg_verify|gopher_parsedir|grapheme_extract|grapheme_stripos|' +
+        'grapheme_stristr|grapheme_strlen|grapheme_strpos|grapheme_strripos|grapheme_strrpos|grapheme_strstr|grapheme_substr|gregoriantojd|' +
+        'gupnp_context_get_host_ip|gupnp_context_get_port|gupnp_context_get_subscription_timeout|gupnp_context_host_path|gupnp_context_new|' +
+        'gupnp_context_set_subscription_timeout|gupnp_context_timeout_add|gupnp_context_unhost_path|gupnp_control_point_browse_start|' +
+        'gupnp_control_point_browse_stop|gupnp_control_point_callback_set|gupnp_control_point_new|gupnp_device_action_callback_set|' +
+        'gupnp_device_info_get|gupnp_device_info_get_service|gupnp_root_device_get_available|gupnp_root_device_get_relative_location|' +
+        'gupnp_root_device_new|gupnp_root_device_set_available|gupnp_root_device_start|gupnp_root_device_stop|gupnp_service_action_get|' +
+        'gupnp_service_action_return|gupnp_service_action_return_error|gupnp_service_action_set|gupnp_service_freeze_notify|gupnp_service_info_get|' +
+        'gupnp_service_info_get_introspection|gupnp_service_introspection_get_state_variable|gupnp_service_notify|gupnp_service_proxy_action_get|' +
+        'gupnp_service_proxy_action_set|gupnp_service_proxy_add_notify|gupnp_service_proxy_callback_set|gupnp_service_proxy_get_subscribed|' +
+        'gupnp_service_proxy_remove_notify|gupnp_service_proxy_set_subscribed|gupnp_service_thaw_notify|gzclose|gzcompress|gzdecode|gzdeflate|' +
+        'gzencode|gzeof|gzfile|gzgetc|gzgets|gzgetss|gzinflate|gzopen|gzpassthru|gzputs|gzread|gzrewind|gzseek|gztell|gzuncompress|gzwrite|' +
+        'halt_compiler|haruannotation|haruannotation_setborderstyle|haruannotation_sethighlightmode|haruannotation_seticon|' +
+        'haruannotation_setopened|harudestination|harudestination_setfit|harudestination_setfitb|harudestination_setfitbh|harudestination_setfitbv|' +
+        'harudestination_setfith|harudestination_setfitr|harudestination_setfitv|harudestination_setxyz|harudoc|harudoc_addpage|' +
+        'harudoc_addpagelabel|harudoc_construct|harudoc_createoutline|harudoc_getcurrentencoder|harudoc_getcurrentpage|harudoc_getencoder|' +
+        'harudoc_getfont|harudoc_getinfoattr|harudoc_getpagelayout|harudoc_getpagemode|harudoc_getstreamsize|harudoc_insertpage|harudoc_loadjpeg|' +
+        'harudoc_loadpng|harudoc_loadraw|harudoc_loadttc|harudoc_loadttf|harudoc_loadtype1|harudoc_output|harudoc_readfromstream|' +
+        'harudoc_reseterror|harudoc_resetstream|harudoc_save|harudoc_savetostream|harudoc_setcompressionmode|harudoc_setcurrentencoder|' +
+        'harudoc_setencryptionmode|harudoc_setinfoattr|harudoc_setinfodateattr|harudoc_setopenaction|harudoc_setpagelayout|harudoc_setpagemode|' +
+        'harudoc_setpagesconfiguration|harudoc_setpassword|harudoc_setpermission|harudoc_usecnsencodings|harudoc_usecnsfonts|' +
+        'harudoc_usecntencodings|harudoc_usecntfonts|harudoc_usejpencodings|harudoc_usejpfonts|harudoc_usekrencodings|harudoc_usekrfonts|' +
+        'haruencoder|haruencoder_getbytetype|haruencoder_gettype|haruencoder_getunicode|haruencoder_getwritingmode|haruexception|harufont|' +
+        'harufont_getascent|harufont_getcapheight|harufont_getdescent|harufont_getencodingname|harufont_getfontname|harufont_gettextwidth|' +
+        'harufont_getunicodewidth|harufont_getxheight|harufont_measuretext|haruimage|haruimage_getbitspercomponent|haruimage_getcolorspace|' +
+        'haruimage_getheight|haruimage_getsize|haruimage_getwidth|haruimage_setcolormask|haruimage_setmaskimage|haruoutline|' +
+        'haruoutline_setdestination|haruoutline_setopened|harupage|harupage_arc|harupage_begintext|harupage_circle|harupage_closepath|' +
+        'harupage_concat|harupage_createdestination|harupage_createlinkannotation|harupage_createtextannotation|harupage_createurlannotation|' +
+        'harupage_curveto|harupage_curveto2|harupage_curveto3|harupage_drawimage|harupage_ellipse|harupage_endpath|harupage_endtext|' +
+        'harupage_eofill|harupage_eofillstroke|harupage_fill|harupage_fillstroke|harupage_getcharspace|harupage_getcmykfill|harupage_getcmykstroke|' +
+        'harupage_getcurrentfont|harupage_getcurrentfontsize|harupage_getcurrentpos|harupage_getcurrenttextpos|harupage_getdash|' +
+        'harupage_getfillingcolorspace|harupage_getflatness|harupage_getgmode|harupage_getgrayfill|harupage_getgraystroke|harupage_getheight|' +
+        'harupage_gethorizontalscaling|harupage_getlinecap|harupage_getlinejoin|harupage_getlinewidth|harupage_getmiterlimit|harupage_getrgbfill|' +
+        'harupage_getrgbstroke|harupage_getstrokingcolorspace|harupage_gettextleading|harupage_gettextmatrix|harupage_gettextrenderingmode|' +
+        'harupage_gettextrise|harupage_gettextwidth|harupage_gettransmatrix|harupage_getwidth|harupage_getwordspace|harupage_lineto|' +
+        'harupage_measuretext|harupage_movetextpos|harupage_moveto|harupage_movetonextline|harupage_rectangle|harupage_setcharspace|' +
+        'harupage_setcmykfill|harupage_setcmykstroke|harupage_setdash|harupage_setflatness|harupage_setfontandsize|harupage_setgrayfill|' +
+        'harupage_setgraystroke|harupage_setheight|harupage_sethorizontalscaling|harupage_setlinecap|harupage_setlinejoin|harupage_setlinewidth|' +
+        'harupage_setmiterlimit|harupage_setrgbfill|harupage_setrgbstroke|harupage_setrotate|harupage_setsize|harupage_setslideshow|' +
+        'harupage_settextleading|harupage_settextmatrix|harupage_settextrenderingmode|harupage_settextrise|harupage_setwidth|harupage_setwordspace|' +
+        'harupage_showtext|harupage_showtextnextline|harupage_stroke|harupage_textout|harupage_textrect|hasconstant|hash|hash_algos|hash_copy|' +
+        'hash_file|hash_final|hash_hmac|hash_hmac_file|hash_init|hash_update|hash_update_file|hash_update_stream|hasmethod|hasproperty|header|' +
+        'header_register_callback|header_remove|headers_list|headers_sent|hebrev|hebrevc|hex2bin|hexdec|highlight_file|highlight_string|' +
+        'html_entity_decode|htmlentities|htmlspecialchars|htmlspecialchars_decode|http_build_cookie|http_build_query|http_build_str|http_build_url|' +
+        'http_cache_etag|http_cache_last_modified|http_chunked_decode|http_date|http_deflate|http_get|http_get_request_body|' +
+        'http_get_request_body_stream|http_get_request_headers|http_head|http_inflate|http_match_etag|http_match_modified|' +
+        'http_match_request_header|http_negotiate_charset|http_negotiate_content_type|http_negotiate_language|http_parse_cookie|http_parse_headers|' +
+        'http_parse_message|http_parse_params|http_persistent_handles_clean|http_persistent_handles_count|http_persistent_handles_ident|' +
+        'http_post_data|http_post_fields|http_put_data|http_put_file|http_put_stream|http_redirect|http_request|http_request_body_encode|' +
+        'http_request_method_exists|http_request_method_name|http_request_method_register|http_request_method_unregister|http_response_code|' +
+        'http_send_content_disposition|http_send_content_type|http_send_data|http_send_file|http_send_last_modified|http_send_status|' +
+        'http_send_stream|http_support|http_throttle|httpdeflatestream|httpdeflatestream_construct|httpdeflatestream_factory|' +
+        'httpdeflatestream_finish|httpdeflatestream_flush|httpdeflatestream_update|httpinflatestream|httpinflatestream_construct|' +
+        'httpinflatestream_factory|httpinflatestream_finish|httpinflatestream_flush|httpinflatestream_update|httpmessage|httpmessage_addheaders|' +
+        'httpmessage_construct|httpmessage_detach|httpmessage_factory|httpmessage_fromenv|httpmessage_fromstring|httpmessage_getbody|' +
+        'httpmessage_getheader|httpmessage_getheaders|httpmessage_gethttpversion|httpmessage_getparentmessage|httpmessage_getrequestmethod|' +
+        'httpmessage_getrequesturl|httpmessage_getresponsecode|httpmessage_getresponsestatus|httpmessage_gettype|httpmessage_guesscontenttype|' +
+        'httpmessage_prepend|httpmessage_reverse|httpmessage_send|httpmessage_setbody|httpmessage_setheaders|httpmessage_sethttpversion|' +
+        'httpmessage_setrequestmethod|httpmessage_setrequesturl|httpmessage_setresponsecode|httpmessage_setresponsestatus|httpmessage_settype|' +
+        'httpmessage_tomessagetypeobject|httpmessage_tostring|httpquerystring|httpquerystring_construct|httpquerystring_get|httpquerystring_mod|' +
+        'httpquerystring_set|httpquerystring_singleton|httpquerystring_toarray|httpquerystring_tostring|httpquerystring_xlate|httprequest|' +
+        'httprequest_addcookies|httprequest_addheaders|httprequest_addpostfields|httprequest_addpostfile|httprequest_addputdata|' +
+        'httprequest_addquerydata|httprequest_addrawpostdata|httprequest_addssloptions|httprequest_clearhistory|httprequest_construct|' +
+        'httprequest_enablecookies|httprequest_getcontenttype|httprequest_getcookies|httprequest_getheaders|httprequest_gethistory|' +
+        'httprequest_getmethod|httprequest_getoptions|httprequest_getpostfields|httprequest_getpostfiles|httprequest_getputdata|' +
+        'httprequest_getputfile|httprequest_getquerydata|httprequest_getrawpostdata|httprequest_getrawrequestmessage|' +
+        'httprequest_getrawresponsemessage|httprequest_getrequestmessage|httprequest_getresponsebody|httprequest_getresponsecode|' +
+        'httprequest_getresponsecookies|httprequest_getresponsedata|httprequest_getresponseheader|httprequest_getresponseinfo|' +
+        'httprequest_getresponsemessage|httprequest_getresponsestatus|httprequest_getssloptions|httprequest_geturl|httprequest_resetcookies|' +
+        'httprequest_send|httprequest_setcontenttype|httprequest_setcookies|httprequest_setheaders|httprequest_setmethod|httprequest_setoptions|' +
+        'httprequest_setpostfields|httprequest_setpostfiles|httprequest_setputdata|httprequest_setputfile|httprequest_setquerydata|' +
+        'httprequest_setrawpostdata|httprequest_setssloptions|httprequest_seturl|httprequestpool|httprequestpool_attach|httprequestpool_construct|' +
+        'httprequestpool_destruct|httprequestpool_detach|httprequestpool_getattachedrequests|httprequestpool_getfinishedrequests|' +
+        'httprequestpool_reset|httprequestpool_send|httprequestpool_socketperform|httprequestpool_socketselect|httpresponse|httpresponse_capture|' +
+        'httpresponse_getbuffersize|httpresponse_getcache|httpresponse_getcachecontrol|httpresponse_getcontentdisposition|' +
+        'httpresponse_getcontenttype|httpresponse_getdata|httpresponse_getetag|httpresponse_getfile|httpresponse_getgzip|httpresponse_getheader|' +
+        'httpresponse_getlastmodified|httpresponse_getrequestbody|httpresponse_getrequestbodystream|httpresponse_getrequestheaders|' +
+        'httpresponse_getstream|httpresponse_getthrottledelay|httpresponse_guesscontenttype|httpresponse_redirect|httpresponse_send|' +
+        'httpresponse_setbuffersize|httpresponse_setcache|httpresponse_setcachecontrol|httpresponse_setcontentdisposition|' +
+        'httpresponse_setcontenttype|httpresponse_setdata|httpresponse_setetag|httpresponse_setfile|httpresponse_setgzip|httpresponse_setheader|' +
+        'httpresponse_setlastmodified|httpresponse_setstream|httpresponse_setthrottledelay|httpresponse_status|hw_array2objrec|hw_changeobject|' +
+        'hw_children|hw_childrenobj|hw_close|hw_connect|hw_connection_info|hw_cp|hw_deleteobject|hw_docbyanchor|hw_docbyanchorobj|' +
+        'hw_document_attributes|hw_document_bodytag|hw_document_content|hw_document_setcontent|hw_document_size|hw_dummy|hw_edittext|hw_error|' +
+        'hw_errormsg|hw_free_document|hw_getanchors|hw_getanchorsobj|hw_getandlock|hw_getchildcoll|hw_getchildcollobj|hw_getchilddoccoll|' +
+        'hw_getchilddoccollobj|hw_getobject|hw_getobjectbyquery|hw_getobjectbyquerycoll|hw_getobjectbyquerycollobj|hw_getobjectbyqueryobj|' +
+        'hw_getparents|hw_getparentsobj|hw_getrellink|hw_getremote|hw_getremotechildren|hw_getsrcbydestobj|hw_gettext|hw_getusername|hw_identify|' +
+        'hw_incollections|hw_info|hw_inscoll|hw_insdoc|hw_insertanchors|hw_insertdocument|hw_insertobject|hw_mapid|hw_modifyobject|hw_mv|' +
+        'hw_new_document|hw_objrec2array|hw_output_document|hw_pconnect|hw_pipedocument|hw_root|hw_setlinkroot|hw_stat|hw_unlock|hw_who|' +
+        'hwapi_attribute|hwapi_attribute_key|hwapi_attribute_langdepvalue|hwapi_attribute_value|hwapi_attribute_values|hwapi_checkin|' +
+        'hwapi_checkout|hwapi_children|hwapi_content|hwapi_content_mimetype|hwapi_content_read|hwapi_copy|hwapi_dbstat|hwapi_dcstat|' +
+        'hwapi_dstanchors|hwapi_dstofsrcanchor|hwapi_error_count|hwapi_error_reason|hwapi_find|hwapi_ftstat|hwapi_hgcsp|hwapi_hwstat|' +
+        'hwapi_identify|hwapi_info|hwapi_insert|hwapi_insertanchor|hwapi_insertcollection|hwapi_insertdocument|hwapi_link|hwapi_lock|hwapi_move|' +
+        'hwapi_new_content|hwapi_object|hwapi_object_assign|hwapi_object_attreditable|hwapi_object_count|hwapi_object_insert|hwapi_object_new|' +
+        'hwapi_object_remove|hwapi_object_title|hwapi_object_value|hwapi_objectbyanchor|hwapi_parents|hwapi_reason_description|hwapi_reason_type|' +
+        'hwapi_remove|hwapi_replace|hwapi_setcommittedversion|hwapi_srcanchors|hwapi_srcsofdst|hwapi_unlock|hwapi_user|hwapi_userlist|hypot|' +
+        'ibase_add_user|ibase_affected_rows|ibase_backup|ibase_blob_add|ibase_blob_cancel|ibase_blob_close|ibase_blob_create|ibase_blob_echo|' +
+        'ibase_blob_get|ibase_blob_import|ibase_blob_info|ibase_blob_open|ibase_close|ibase_commit|ibase_commit_ret|ibase_connect|ibase_db_info|' +
+        'ibase_delete_user|ibase_drop_db|ibase_errcode|ibase_errmsg|ibase_execute|ibase_fetch_assoc|ibase_fetch_object|ibase_fetch_row|' +
+        'ibase_field_info|ibase_free_event_handler|ibase_free_query|ibase_free_result|ibase_gen_id|ibase_maintain_db|ibase_modify_user|' +
+        'ibase_name_result|ibase_num_fields|ibase_num_params|ibase_param_info|ibase_pconnect|ibase_prepare|ibase_query|ibase_restore|' +
+        'ibase_rollback|ibase_rollback_ret|ibase_server_info|ibase_service_attach|ibase_service_detach|ibase_set_event_handler|ibase_timefmt|' +
+        'ibase_trans|ibase_wait_event|iconv|iconv_get_encoding|iconv_mime_decode|iconv_mime_decode_headers|iconv_mime_encode|iconv_set_encoding|' +
+        'iconv_strlen|iconv_strpos|iconv_strrpos|iconv_substr|id3_get_frame_long_name|id3_get_frame_short_name|id3_get_genre_id|id3_get_genre_list|' +
+        'id3_get_genre_name|id3_get_tag|id3_get_version|id3_remove_tag|id3_set_tag|id3v2attachedpictureframe|id3v2frame|id3v2tag|idate|' +
+        'idn_to_ascii|idn_to_unicode|idn_to_utf8|ifx_affected_rows|ifx_blobinfile_mode|ifx_byteasvarchar|ifx_close|ifx_connect|ifx_copy_blob|' +
+        'ifx_create_blob|ifx_create_char|ifx_do|ifx_error|ifx_errormsg|ifx_fetch_row|ifx_fieldproperties|ifx_fieldtypes|ifx_free_blob|' +
+        'ifx_free_char|ifx_free_result|ifx_get_blob|ifx_get_char|ifx_getsqlca|ifx_htmltbl_result|ifx_nullformat|ifx_num_fields|ifx_num_rows|' +
+        'ifx_pconnect|ifx_prepare|ifx_query|ifx_textasvarchar|ifx_update_blob|ifx_update_char|ifxus_close_slob|ifxus_create_slob|ifxus_free_slob|' +
+        'ifxus_open_slob|ifxus_read_slob|ifxus_seek_slob|ifxus_tell_slob|ifxus_write_slob|ignore_user_abort|iis_add_server|iis_get_dir_security|' +
+        'iis_get_script_map|iis_get_server_by_comment|iis_get_server_by_path|iis_get_server_rights|iis_get_service_state|iis_remove_server|' +
+        'iis_set_app_settings|iis_set_dir_security|iis_set_script_map|iis_set_server_rights|iis_start_server|iis_start_service|iis_stop_server|' +
+        'iis_stop_service|image2wbmp|image_type_to_extension|image_type_to_mime_type|imagealphablending|imageantialias|imagearc|imagechar|' +
+        'imagecharup|imagecolorallocate|imagecolorallocatealpha|imagecolorat|imagecolorclosest|imagecolorclosestalpha|imagecolorclosesthwb|' +
+        'imagecolordeallocate|imagecolorexact|imagecolorexactalpha|imagecolormatch|imagecolorresolve|imagecolorresolvealpha|imagecolorset|' +
+        'imagecolorsforindex|imagecolorstotal|imagecolortransparent|imageconvolution|imagecopy|imagecopymerge|imagecopymergegray|' +
+        'imagecopyresampled|imagecopyresized|imagecreate|imagecreatefromgd|imagecreatefromgd2|imagecreatefromgd2part|imagecreatefromgif|' +
+        'imagecreatefromjpeg|imagecreatefrompng|imagecreatefromstring|imagecreatefromwbmp|imagecreatefromxbm|imagecreatefromxpm|' +
+        'imagecreatetruecolor|imagedashedline|imagedestroy|imageellipse|imagefill|imagefilledarc|imagefilledellipse|imagefilledpolygon|' +
+        'imagefilledrectangle|imagefilltoborder|imagefilter|imagefontheight|imagefontwidth|imageftbbox|imagefttext|imagegammacorrect|imagegd|' +
+        'imagegd2|imagegif|imagegrabscreen|imagegrabwindow|imageinterlace|imageistruecolor|imagejpeg|imagelayereffect|imageline|imageloadfont|' +
+        'imagepalettecopy|imagepng|imagepolygon|imagepsbbox|imagepsencodefont|imagepsextendfont|imagepsfreefont|imagepsloadfont|imagepsslantfont|' +
+        'imagepstext|imagerectangle|imagerotate|imagesavealpha|imagesetbrush|imagesetpixel|imagesetstyle|imagesetthickness|imagesettile|' +
+        'imagestring|imagestringup|imagesx|imagesy|imagetruecolortopalette|imagettfbbox|imagettftext|imagetypes|imagewbmp|imagexbm|imagick|' +
+        'imagick_adaptiveblurimage|imagick_adaptiveresizeimage|imagick_adaptivesharpenimage|imagick_adaptivethresholdimage|imagick_addimage|' +
+        'imagick_addnoiseimage|imagick_affinetransformimage|imagick_animateimages|imagick_annotateimage|imagick_appendimages|imagick_averageimages|' +
+        'imagick_blackthresholdimage|imagick_blurimage|imagick_borderimage|imagick_charcoalimage|imagick_chopimage|imagick_clear|imagick_clipimage|' +
+        'imagick_clippathimage|imagick_clone|imagick_clutimage|imagick_coalesceimages|imagick_colorfloodfillimage|imagick_colorizeimage|' +
+        'imagick_combineimages|imagick_commentimage|imagick_compareimagechannels|imagick_compareimagelayers|imagick_compareimages|' +
+        'imagick_compositeimage|imagick_construct|imagick_contrastimage|imagick_contraststretchimage|imagick_convolveimage|imagick_cropimage|' +
+        'imagick_cropthumbnailimage|imagick_current|imagick_cyclecolormapimage|imagick_decipherimage|imagick_deconstructimages|' +
+        'imagick_deleteimageartifact|imagick_despeckleimage|imagick_destroy|imagick_displayimage|imagick_displayimages|imagick_distortimage|' +
+        'imagick_drawimage|imagick_edgeimage|imagick_embossimage|imagick_encipherimage|imagick_enhanceimage|imagick_equalizeimage|' +
+        'imagick_evaluateimage|imagick_extentimage|imagick_flattenimages|imagick_flipimage|imagick_floodfillpaintimage|imagick_flopimage|' +
+        'imagick_frameimage|imagick_fximage|imagick_gammaimage|imagick_gaussianblurimage|imagick_getcolorspace|imagick_getcompression|' +
+        'imagick_getcompressionquality|imagick_getcopyright|imagick_getfilename|imagick_getfont|imagick_getformat|imagick_getgravity|' +
+        'imagick_gethomeurl|imagick_getimage|imagick_getimagealphachannel|imagick_getimageartifact|imagick_getimagebackgroundcolor|' +
+        'imagick_getimageblob|imagick_getimageblueprimary|imagick_getimagebordercolor|imagick_getimagechanneldepth|' +
+        'imagick_getimagechanneldistortion|imagick_getimagechanneldistortions|imagick_getimagechannelextrema|imagick_getimagechannelmean|' +
+        'imagick_getimagechannelrange|imagick_getimagechannelstatistics|imagick_getimageclipmask|imagick_getimagecolormapcolor|' +
+        'imagick_getimagecolors|imagick_getimagecolorspace|imagick_getimagecompose|imagick_getimagecompression|imagick_getimagecompressionquality|' +
+        'imagick_getimagedelay|imagick_getimagedepth|imagick_getimagedispose|imagick_getimagedistortion|imagick_getimageextrema|' +
+        'imagick_getimagefilename|imagick_getimageformat|imagick_getimagegamma|imagick_getimagegeometry|imagick_getimagegravity|' +
+        'imagick_getimagegreenprimary|imagick_getimageheight|imagick_getimagehistogram|imagick_getimageindex|imagick_getimageinterlacescheme|' +
+        'imagick_getimageinterpolatemethod|imagick_getimageiterations|imagick_getimagelength|imagick_getimagemagicklicense|imagick_getimagematte|' +
+        'imagick_getimagemattecolor|imagick_getimageorientation|imagick_getimagepage|imagick_getimagepixelcolor|imagick_getimageprofile|' +
+        'imagick_getimageprofiles|imagick_getimageproperties|imagick_getimageproperty|imagick_getimageredprimary|imagick_getimageregion|' +
+        'imagick_getimagerenderingintent|imagick_getimageresolution|imagick_getimagesblob|imagick_getimagescene|imagick_getimagesignature|' +
+        'imagick_getimagesize|imagick_getimagetickspersecond|imagick_getimagetotalinkdensity|imagick_getimagetype|imagick_getimageunits|' +
+        'imagick_getimagevirtualpixelmethod|imagick_getimagewhitepoint|imagick_getimagewidth|imagick_getinterlacescheme|imagick_getiteratorindex|' +
+        'imagick_getnumberimages|imagick_getoption|imagick_getpackagename|imagick_getpage|imagick_getpixeliterator|imagick_getpixelregioniterator|' +
+        'imagick_getpointsize|imagick_getquantumdepth|imagick_getquantumrange|imagick_getreleasedate|imagick_getresource|imagick_getresourcelimit|' +
+        'imagick_getsamplingfactors|imagick_getsize|imagick_getsizeoffset|imagick_getversion|imagick_hasnextimage|imagick_haspreviousimage|' +
+        'imagick_identifyimage|imagick_implodeimage|imagick_labelimage|imagick_levelimage|imagick_linearstretchimage|imagick_liquidrescaleimage|' +
+        'imagick_magnifyimage|imagick_mapimage|imagick_mattefloodfillimage|imagick_medianfilterimage|imagick_mergeimagelayers|imagick_minifyimage|' +
+        'imagick_modulateimage|imagick_montageimage|imagick_morphimages|imagick_mosaicimages|imagick_motionblurimage|imagick_negateimage|' +
+        'imagick_newimage|imagick_newpseudoimage|imagick_nextimage|imagick_normalizeimage|imagick_oilpaintimage|imagick_opaquepaintimage|' +
+        'imagick_optimizeimagelayers|imagick_orderedposterizeimage|imagick_paintfloodfillimage|imagick_paintopaqueimage|' +
+        'imagick_painttransparentimage|imagick_pingimage|imagick_pingimageblob|imagick_pingimagefile|imagick_polaroidimage|imagick_posterizeimage|' +
+        'imagick_previewimages|imagick_previousimage|imagick_profileimage|imagick_quantizeimage|imagick_quantizeimages|imagick_queryfontmetrics|' +
+        'imagick_queryfonts|imagick_queryformats|imagick_radialblurimage|imagick_raiseimage|imagick_randomthresholdimage|imagick_readimage|' +
+        'imagick_readimageblob|imagick_readimagefile|imagick_recolorimage|imagick_reducenoiseimage|imagick_removeimage|imagick_removeimageprofile|' +
+        'imagick_render|imagick_resampleimage|imagick_resetimagepage|imagick_resizeimage|imagick_rollimage|imagick_rotateimage|' +
+        'imagick_roundcorners|imagick_sampleimage|imagick_scaleimage|imagick_separateimagechannel|imagick_sepiatoneimage|' +
+        'imagick_setbackgroundcolor|imagick_setcolorspace|imagick_setcompression|imagick_setcompressionquality|imagick_setfilename|' +
+        'imagick_setfirstiterator|imagick_setfont|imagick_setformat|imagick_setgravity|imagick_setimage|imagick_setimagealphachannel|' +
+        'imagick_setimageartifact|imagick_setimagebackgroundcolor|imagick_setimagebias|imagick_setimageblueprimary|imagick_setimagebordercolor|' +
+        'imagick_setimagechanneldepth|imagick_setimageclipmask|imagick_setimagecolormapcolor|imagick_setimagecolorspace|imagick_setimagecompose|' +
+        'imagick_setimagecompression|imagick_setimagecompressionquality|imagick_setimagedelay|imagick_setimagedepth|imagick_setimagedispose|' +
+        'imagick_setimageextent|imagick_setimagefilename|imagick_setimageformat|imagick_setimagegamma|imagick_setimagegravity|' +
+        'imagick_setimagegreenprimary|imagick_setimageindex|imagick_setimageinterlacescheme|imagick_setimageinterpolatemethod|' +
+        'imagick_setimageiterations|imagick_setimagematte|imagick_setimagemattecolor|imagick_setimageopacity|imagick_setimageorientation|' +
+        'imagick_setimagepage|imagick_setimageprofile|imagick_setimageproperty|imagick_setimageredprimary|imagick_setimagerenderingintent|' +
+        'imagick_setimageresolution|imagick_setimagescene|imagick_setimagetickspersecond|imagick_setimagetype|imagick_setimageunits|' +
+        'imagick_setimagevirtualpixelmethod|imagick_setimagewhitepoint|imagick_setinterlacescheme|imagick_setiteratorindex|imagick_setlastiterator|' +
+        'imagick_setoption|imagick_setpage|imagick_setpointsize|imagick_setresolution|imagick_setresourcelimit|imagick_setsamplingfactors|' +
+        'imagick_setsize|imagick_setsizeoffset|imagick_settype|imagick_shadeimage|imagick_shadowimage|imagick_sharpenimage|imagick_shaveimage|' +
+        'imagick_shearimage|imagick_sigmoidalcontrastimage|imagick_sketchimage|imagick_solarizeimage|imagick_spliceimage|imagick_spreadimage|' +
+        'imagick_steganoimage|imagick_stereoimage|imagick_stripimage|imagick_swirlimage|imagick_textureimage|imagick_thresholdimage|' +
+        'imagick_thumbnailimage|imagick_tintimage|imagick_transformimage|imagick_transparentpaintimage|imagick_transposeimage|' +
+        'imagick_transverseimage|imagick_trimimage|imagick_uniqueimagecolors|imagick_unsharpmaskimage|imagick_valid|imagick_vignetteimage|' +
+        'imagick_waveimage|imagick_whitethresholdimage|imagick_writeimage|imagick_writeimagefile|imagick_writeimages|imagick_writeimagesfile|' +
+        'imagickdraw|imagickdraw_affine|imagickdraw_annotation|imagickdraw_arc|imagickdraw_bezier|imagickdraw_circle|imagickdraw_clear|' +
+        'imagickdraw_clone|imagickdraw_color|imagickdraw_comment|imagickdraw_composite|imagickdraw_construct|imagickdraw_destroy|' +
+        'imagickdraw_ellipse|imagickdraw_getclippath|imagickdraw_getcliprule|imagickdraw_getclipunits|imagickdraw_getfillcolor|' +
+        'imagickdraw_getfillopacity|imagickdraw_getfillrule|imagickdraw_getfont|imagickdraw_getfontfamily|imagickdraw_getfontsize|' +
+        'imagickdraw_getfontstyle|imagickdraw_getfontweight|imagickdraw_getgravity|imagickdraw_getstrokeantialias|imagickdraw_getstrokecolor|' +
+        'imagickdraw_getstrokedasharray|imagickdraw_getstrokedashoffset|imagickdraw_getstrokelinecap|imagickdraw_getstrokelinejoin|' +
+        'imagickdraw_getstrokemiterlimit|imagickdraw_getstrokeopacity|imagickdraw_getstrokewidth|imagickdraw_gettextalignment|' +
+        'imagickdraw_gettextantialias|imagickdraw_gettextdecoration|imagickdraw_gettextencoding|imagickdraw_gettextundercolor|' +
+        'imagickdraw_getvectorgraphics|imagickdraw_line|imagickdraw_matte|imagickdraw_pathclose|imagickdraw_pathcurvetoabsolute|' +
+        'imagickdraw_pathcurvetoquadraticbezierabsolute|imagickdraw_pathcurvetoquadraticbezierrelative|' +
+        'imagickdraw_pathcurvetoquadraticbeziersmoothabsolute|imagickdraw_pathcurvetoquadraticbeziersmoothrelative|imagickdraw_pathcurvetorelative|' +
+        'imagickdraw_pathcurvetosmoothabsolute|imagickdraw_pathcurvetosmoothrelative|imagickdraw_pathellipticarcabsolute|' +
+        'imagickdraw_pathellipticarcrelative|imagickdraw_pathfinish|imagickdraw_pathlinetoabsolute|imagickdraw_pathlinetohorizontalabsolute|' +
+        'imagickdraw_pathlinetohorizontalrelative|imagickdraw_pathlinetorelative|imagickdraw_pathlinetoverticalabsolute|' +
+        'imagickdraw_pathlinetoverticalrelative|imagickdraw_pathmovetoabsolute|imagickdraw_pathmovetorelative|imagickdraw_pathstart|' +
+        'imagickdraw_point|imagickdraw_polygon|imagickdraw_polyline|imagickdraw_pop|imagickdraw_popclippath|imagickdraw_popdefs|' +
+        'imagickdraw_poppattern|imagickdraw_push|imagickdraw_pushclippath|imagickdraw_pushdefs|imagickdraw_pushpattern|imagickdraw_rectangle|' +
+        'imagickdraw_render|imagickdraw_rotate|imagickdraw_roundrectangle|imagickdraw_scale|imagickdraw_setclippath|imagickdraw_setcliprule|' +
+        'imagickdraw_setclipunits|imagickdraw_setfillalpha|imagickdraw_setfillcolor|imagickdraw_setfillopacity|imagickdraw_setfillpatternurl|' +
+        'imagickdraw_setfillrule|imagickdraw_setfont|imagickdraw_setfontfamily|imagickdraw_setfontsize|imagickdraw_setfontstretch|' +
+        'imagickdraw_setfontstyle|imagickdraw_setfontweight|imagickdraw_setgravity|imagickdraw_setstrokealpha|imagickdraw_setstrokeantialias|' +
+        'imagickdraw_setstrokecolor|imagickdraw_setstrokedasharray|imagickdraw_setstrokedashoffset|imagickdraw_setstrokelinecap|' +
+        'imagickdraw_setstrokelinejoin|imagickdraw_setstrokemiterlimit|imagickdraw_setstrokeopacity|imagickdraw_setstrokepatternurl|' +
+        'imagickdraw_setstrokewidth|imagickdraw_settextalignment|imagickdraw_settextantialias|imagickdraw_settextdecoration|' +
+        'imagickdraw_settextencoding|imagickdraw_settextundercolor|imagickdraw_setvectorgraphics|imagickdraw_setviewbox|imagickdraw_skewx|' +
+        'imagickdraw_skewy|imagickdraw_translate|imagickpixel|imagickpixel_clear|imagickpixel_construct|imagickpixel_destroy|imagickpixel_getcolor|' +
+        'imagickpixel_getcolorasstring|imagickpixel_getcolorcount|imagickpixel_getcolorvalue|imagickpixel_gethsl|imagickpixel_issimilar|' +
+        'imagickpixel_setcolor|imagickpixel_setcolorvalue|imagickpixel_sethsl|imagickpixeliterator|imagickpixeliterator_clear|' +
+        'imagickpixeliterator_construct|imagickpixeliterator_destroy|imagickpixeliterator_getcurrentiteratorrow|' +
+        'imagickpixeliterator_getiteratorrow|imagickpixeliterator_getnextiteratorrow|imagickpixeliterator_getpreviousiteratorrow|' +
+        'imagickpixeliterator_newpixeliterator|imagickpixeliterator_newpixelregioniterator|imagickpixeliterator_resetiterator|' +
+        'imagickpixeliterator_setiteratorfirstrow|imagickpixeliterator_setiteratorlastrow|imagickpixeliterator_setiteratorrow|' +
+        'imagickpixeliterator_synciterator|imap_8bit|imap_alerts|imap_append|imap_base64|imap_binary|imap_body|imap_bodystruct|imap_check|' +
+        'imap_clearflag_full|imap_close|imap_create|imap_createmailbox|imap_delete|imap_deletemailbox|imap_errors|imap_expunge|imap_fetch_overview|' +
+        'imap_fetchbody|imap_fetchheader|imap_fetchmime|imap_fetchstructure|imap_fetchtext|imap_gc|imap_get_quota|imap_get_quotaroot|imap_getacl|' +
+        'imap_getmailboxes|imap_getsubscribed|imap_header|imap_headerinfo|imap_headers|imap_last_error|imap_list|imap_listmailbox|imap_listscan|' +
+        'imap_listsubscribed|imap_lsub|imap_mail|imap_mail_compose|imap_mail_copy|imap_mail_move|imap_mailboxmsginfo|imap_mime_header_decode|' +
+        'imap_msgno|imap_num_msg|imap_num_recent|imap_open|imap_ping|imap_qprint|imap_rename|imap_renamemailbox|imap_reopen|' +
+        'imap_rfc822_parse_adrlist|imap_rfc822_parse_headers|imap_rfc822_write_address|imap_savebody|imap_scan|imap_scanmailbox|imap_search|' +
+        'imap_set_quota|imap_setacl|imap_setflag_full|imap_sort|imap_status|imap_subscribe|imap_thread|imap_timeout|imap_uid|imap_undelete|' +
+        'imap_unsubscribe|imap_utf7_decode|imap_utf7_encode|imap_utf8|implementsinterface|implode|import_request_variables|in_array|include|' +
+        'include_once|inclued_get_data|inet_ntop|inet_pton|infiniteiterator|ingres_autocommit|ingres_autocommit_state|ingres_charset|ingres_close|' +
+        'ingres_commit|ingres_connect|ingres_cursor|ingres_errno|ingres_error|ingres_errsqlstate|ingres_escape_string|ingres_execute|' +
+        'ingres_fetch_array|ingres_fetch_assoc|ingres_fetch_object|ingres_fetch_proc_return|ingres_fetch_row|ingres_field_length|ingres_field_name|' +
+        'ingres_field_nullable|ingres_field_precision|ingres_field_scale|ingres_field_type|ingres_free_result|ingres_next_error|ingres_num_fields|' +
+        'ingres_num_rows|ingres_pconnect|ingres_prepare|ingres_query|ingres_result_seek|ingres_rollback|ingres_set_environment|' +
+        'ingres_unbuffered_query|ini_alter|ini_get|ini_get_all|ini_restore|ini_set|innamespace|inotify_add_watch|inotify_init|inotify_queue_len|' +
+        'inotify_read|inotify_rm_watch|interface_exists|intl_error_name|intl_get_error_code|intl_get_error_message|intl_is_failure|' +
+        'intldateformatter|intval|invalidargumentexception|invoke|invokeargs|ip2long|iptcembed|iptcparse|is_a|is_array|is_bool|is_callable|is_dir|' +
+        'is_double|is_executable|is_file|is_finite|is_float|is_infinite|is_int|is_integer|is_link|is_long|is_nan|is_null|is_numeric|is_object|' +
+        'is_readable|is_real|is_resource|is_scalar|is_soap_fault|is_string|is_subclass_of|is_uploaded_file|is_writable|is_writeable|isabstract|' +
+        'iscloneable|isdisabled|isfinal|isinstance|isinstantiable|isinterface|isinternal|isiterateable|isset|issubclassof|isuserdefined|iterator|' +
+        'iterator_apply|iterator_count|iterator_to_array|iteratoraggregate|iteratoriterator|java_last_exception_clear|java_last_exception_get|' +
+        'jddayofweek|jdmonthname|jdtofrench|jdtogregorian|jdtojewish|jdtojulian|jdtounix|jewishtojd|join|jpeg2wbmp|json_decode|json_encode|' +
+        'json_last_error|jsonserializable|judy|judy_type|judy_version|juliantojd|kadm5_chpass_principal|kadm5_create_principal|' +
+        'kadm5_delete_principal|kadm5_destroy|kadm5_flush|kadm5_get_policies|kadm5_get_principal|kadm5_get_principals|kadm5_init_with_password|' +
+        'kadm5_modify_principal|key|krsort|ksort|lcfirst|lcg_value|lchgrp|lchown|ldap_8859_to_t61|ldap_add|ldap_bind|ldap_close|ldap_compare|' +
+        'ldap_connect|ldap_count_entries|ldap_delete|ldap_dn2ufn|ldap_err2str|ldap_errno|ldap_error|ldap_explode_dn|ldap_first_attribute|' +
+        'ldap_first_entry|ldap_first_reference|ldap_free_result|ldap_get_attributes|ldap_get_dn|ldap_get_entries|ldap_get_option|ldap_get_values|' +
+        'ldap_get_values_len|ldap_list|ldap_mod_add|ldap_mod_del|ldap_mod_replace|ldap_modify|ldap_next_attribute|ldap_next_entry|' +
+        'ldap_next_reference|ldap_parse_reference|ldap_parse_result|ldap_read|ldap_rename|ldap_sasl_bind|ldap_search|ldap_set_option|' +
+        'ldap_set_rebind_proc|ldap_sort|ldap_start_tls|ldap_t61_to_8859|ldap_unbind|lengthexception|levenshtein|libxml_clear_errors|' +
+        'libxml_disable_entity_loader|libxml_get_errors|libxml_get_last_error|libxml_set_streams_context|libxml_use_internal_errors|libxmlerror|' +
+        'limititerator|link|linkinfo|list|locale|localeconv|localtime|log|log10|log1p|logicexception|long2ip|lstat|ltrim|lzf_compress|' +
+        'lzf_decompress|lzf_optimized_for|m_checkstatus|m_completeauthorizations|m_connect|m_connectionerror|m_deletetrans|m_destroyconn|' +
+        'm_destroyengine|m_getcell|m_getcellbynum|m_getcommadelimited|m_getheader|m_initconn|m_initengine|m_iscommadelimited|m_maxconntimeout|' +
+        'm_monitor|m_numcolumns|m_numrows|m_parsecommadelimited|m_responsekeys|m_responseparam|m_returnstatus|m_setblocking|m_setdropfile|m_setip|' +
+        'm_setssl|m_setssl_cafile|m_setssl_files|m_settimeout|m_sslcert_gen_hash|m_transactionssent|m_transinqueue|m_transkeyval|m_transnew|' +
+        'm_transsend|m_uwait|m_validateidentifier|m_verifyconnection|m_verifysslcert|magic_quotes_runtime|mail|' +
+        'mailparse_determine_best_xfer_encoding|mailparse_msg_create|mailparse_msg_extract_part|mailparse_msg_extract_part_file|' +
+        'mailparse_msg_extract_whole_part_file|mailparse_msg_free|mailparse_msg_get_part|mailparse_msg_get_part_data|mailparse_msg_get_structure|' +
+        'mailparse_msg_parse|mailparse_msg_parse_file|mailparse_rfc822_parse_addresses|mailparse_stream_encode|mailparse_uudecode_all|main|max|' +
+        'maxdb_affected_rows|maxdb_autocommit|maxdb_bind_param|maxdb_bind_result|maxdb_change_user|maxdb_character_set_name|maxdb_client_encoding|' +
+        'maxdb_close|maxdb_close_long_data|maxdb_commit|maxdb_connect|maxdb_connect_errno|maxdb_connect_error|maxdb_data_seek|maxdb_debug|' +
+        'maxdb_disable_reads_from_master|maxdb_disable_rpl_parse|maxdb_dump_debug_info|maxdb_embedded_connect|maxdb_enable_reads_from_master|' +
+        'maxdb_enable_rpl_parse|maxdb_errno|maxdb_error|maxdb_escape_string|maxdb_execute|maxdb_fetch|maxdb_fetch_array|maxdb_fetch_assoc|' +
+        'maxdb_fetch_field|maxdb_fetch_field_direct|maxdb_fetch_fields|maxdb_fetch_lengths|maxdb_fetch_object|maxdb_fetch_row|maxdb_field_count|' +
+        'maxdb_field_seek|maxdb_field_tell|maxdb_free_result|maxdb_get_client_info|maxdb_get_client_version|maxdb_get_host_info|maxdb_get_metadata|' +
+        'maxdb_get_proto_info|maxdb_get_server_info|maxdb_get_server_version|maxdb_info|maxdb_init|maxdb_insert_id|maxdb_kill|maxdb_master_query|' +
+        'maxdb_more_results|maxdb_multi_query|maxdb_next_result|maxdb_num_fields|maxdb_num_rows|maxdb_options|maxdb_param_count|maxdb_ping|' +
+        'maxdb_prepare|maxdb_query|maxdb_real_connect|maxdb_real_escape_string|maxdb_real_query|maxdb_report|maxdb_rollback|' +
+        'maxdb_rpl_parse_enabled|maxdb_rpl_probe|maxdb_rpl_query_type|maxdb_select_db|maxdb_send_long_data|maxdb_send_query|maxdb_server_end|' +
+        'maxdb_server_init|maxdb_set_opt|maxdb_sqlstate|maxdb_ssl_set|maxdb_stat|maxdb_stmt_affected_rows|maxdb_stmt_bind_param|' +
+        'maxdb_stmt_bind_result|maxdb_stmt_close|maxdb_stmt_close_long_data|maxdb_stmt_data_seek|maxdb_stmt_errno|maxdb_stmt_error|' +
+        'maxdb_stmt_execute|maxdb_stmt_fetch|maxdb_stmt_free_result|maxdb_stmt_init|maxdb_stmt_num_rows|maxdb_stmt_param_count|maxdb_stmt_prepare|' +
+        'maxdb_stmt_reset|maxdb_stmt_result_metadata|maxdb_stmt_send_long_data|maxdb_stmt_sqlstate|maxdb_stmt_store_result|maxdb_store_result|' +
+        'maxdb_thread_id|maxdb_thread_safe|maxdb_use_result|maxdb_warning_count|mb_check_encoding|mb_convert_case|mb_convert_encoding|' +
+        'mb_convert_kana|mb_convert_variables|mb_decode_mimeheader|mb_decode_numericentity|mb_detect_encoding|mb_detect_order|mb_encode_mimeheader|' +
+        'mb_encode_numericentity|mb_encoding_aliases|mb_ereg|mb_ereg_match|mb_ereg_replace|mb_ereg_search|mb_ereg_search_getpos|' +
+        'mb_ereg_search_getregs|mb_ereg_search_init|mb_ereg_search_pos|mb_ereg_search_regs|mb_ereg_search_setpos|mb_eregi|mb_eregi_replace|' +
+        'mb_get_info|mb_http_input|mb_http_output|mb_internal_encoding|mb_language|mb_list_encodings|mb_output_handler|mb_parse_str|' +
+        'mb_preferred_mime_name|mb_regex_encoding|mb_regex_set_options|mb_send_mail|mb_split|mb_strcut|mb_strimwidth|mb_stripos|mb_stristr|' +
+        'mb_strlen|mb_strpos|mb_strrchr|mb_strrichr|mb_strripos|mb_strrpos|mb_strstr|mb_strtolower|mb_strtoupper|mb_strwidth|' +
+        'mb_substitute_character|mb_substr|mb_substr_count|mcrypt_cbc|mcrypt_cfb|mcrypt_create_iv|mcrypt_decrypt|mcrypt_ecb|' +
+        'mcrypt_enc_get_algorithms_name|mcrypt_enc_get_block_size|mcrypt_enc_get_iv_size|mcrypt_enc_get_key_size|mcrypt_enc_get_modes_name|' +
+        'mcrypt_enc_get_supported_key_sizes|mcrypt_enc_is_block_algorithm|mcrypt_enc_is_block_algorithm_mode|mcrypt_enc_is_block_mode|' +
+        'mcrypt_enc_self_test|mcrypt_encrypt|mcrypt_generic|mcrypt_generic_deinit|mcrypt_generic_end|mcrypt_generic_init|mcrypt_get_block_size|' +
+        'mcrypt_get_cipher_name|mcrypt_get_iv_size|mcrypt_get_key_size|mcrypt_list_algorithms|mcrypt_list_modes|mcrypt_module_close|' +
+        'mcrypt_module_get_algo_block_size|mcrypt_module_get_algo_key_size|mcrypt_module_get_supported_key_sizes|mcrypt_module_is_block_algorithm|' +
+        'mcrypt_module_is_block_algorithm_mode|mcrypt_module_is_block_mode|mcrypt_module_open|mcrypt_module_self_test|mcrypt_ofb|md5|md5_file|' +
+        'mdecrypt_generic|memcache|memcache_debug|memcached|memory_get_peak_usage|memory_get_usage|messageformatter|metaphone|method_exists|mhash|' +
+        'mhash_count|mhash_get_block_size|mhash_get_hash_name|mhash_keygen_s2k|microtime|mime_content_type|min|ming_keypress|' +
+        'ming_setcubicthreshold|ming_setscale|ming_setswfcompression|ming_useconstants|ming_useswfversion|mkdir|mktime|money_format|mongo|' +
+        'mongobindata|mongocode|mongocollection|mongoconnectionexception|mongocursor|mongocursorexception|mongocursortimeoutexception|mongodate|' +
+        'mongodb|mongodbref|mongoexception|mongogridfs|mongogridfscursor|mongogridfsexception|mongogridfsfile|mongoid|mongoint32|mongoint64|' +
+        'mongomaxkey|mongominkey|mongoregex|mongotimestamp|move_uploaded_file|mpegfile|mqseries_back|mqseries_begin|mqseries_close|mqseries_cmit|' +
+        'mqseries_conn|mqseries_connx|mqseries_disc|mqseries_get|mqseries_inq|mqseries_open|mqseries_put|mqseries_put1|mqseries_set|' +
+        'mqseries_strerror|msession_connect|msession_count|msession_create|msession_destroy|msession_disconnect|msession_find|msession_get|' +
+        'msession_get_array|msession_get_data|msession_inc|msession_list|msession_listvar|msession_lock|msession_plugin|msession_randstr|' +
+        'msession_set|msession_set_array|msession_set_data|msession_timeout|msession_uniq|msession_unlock|msg_get_queue|msg_queue_exists|' +
+        'msg_receive|msg_remove_queue|msg_send|msg_set_queue|msg_stat_queue|msql|msql_affected_rows|msql_close|msql_connect|msql_create_db|' +
+        'msql_createdb|msql_data_seek|msql_db_query|msql_dbname|msql_drop_db|msql_error|msql_fetch_array|msql_fetch_field|msql_fetch_object|' +
+        'msql_fetch_row|msql_field_flags|msql_field_len|msql_field_name|msql_field_seek|msql_field_table|msql_field_type|msql_fieldflags|' +
+        'msql_fieldlen|msql_fieldname|msql_fieldtable|msql_fieldtype|msql_free_result|msql_list_dbs|msql_list_fields|msql_list_tables|' +
+        'msql_num_fields|msql_num_rows|msql_numfields|msql_numrows|msql_pconnect|msql_query|msql_regcase|msql_result|msql_select_db|msql_tablename|' +
+        'mssql_bind|mssql_close|mssql_connect|mssql_data_seek|mssql_execute|mssql_fetch_array|mssql_fetch_assoc|mssql_fetch_batch|' +
+        'mssql_fetch_field|mssql_fetch_object|mssql_fetch_row|mssql_field_length|mssql_field_name|mssql_field_seek|mssql_field_type|' +
+        'mssql_free_result|mssql_free_statement|mssql_get_last_message|mssql_guid_string|mssql_init|mssql_min_error_severity|' +
+        'mssql_min_message_severity|mssql_next_result|mssql_num_fields|mssql_num_rows|mssql_pconnect|mssql_query|mssql_result|mssql_rows_affected|' +
+        'mssql_select_db|mt_getrandmax|mt_rand|mt_srand|multipleiterator|mysql_affected_rows|mysql_client_encoding|mysql_close|mysql_connect|' +
+        'mysql_create_db|mysql_data_seek|mysql_db_name|mysql_db_query|mysql_drop_db|mysql_errno|mysql_error|mysql_escape_string|mysql_fetch_array|' +
+        'mysql_fetch_assoc|mysql_fetch_field|mysql_fetch_lengths|mysql_fetch_object|mysql_fetch_row|mysql_field_flags|mysql_field_len|' +
+        'mysql_field_name|mysql_field_seek|mysql_field_table|mysql_field_type|mysql_free_result|mysql_get_client_info|mysql_get_host_info|' +
+        'mysql_get_proto_info|mysql_get_server_info|mysql_info|mysql_insert_id|mysql_list_dbs|mysql_list_fields|mysql_list_processes|' +
+        'mysql_list_tables|mysql_num_fields|mysql_num_rows|mysql_pconnect|mysql_ping|mysql_query|mysql_real_escape_string|mysql_result|' +
+        'mysql_select_db|mysql_set_charset|mysql_stat|mysql_tablename|mysql_thread_id|mysql_unbuffered_query|mysqli|mysqli_bind_param|' +
+        'mysqli_bind_result|mysqli_client_encoding|mysqli_connect|mysqli_disable_reads_from_master|mysqli_disable_rpl_parse|mysqli_driver|' +
+        'mysqli_enable_reads_from_master|mysqli_enable_rpl_parse|mysqli_escape_string|mysqli_execute|mysqli_fetch|mysqli_get_metadata|' +
+        'mysqli_master_query|mysqli_param_count|mysqli_report|mysqli_result|mysqli_rpl_parse_enabled|mysqli_rpl_probe|mysqli_rpl_query_type|' +
+        'mysqli_send_long_data|mysqli_send_query|mysqli_set_opt|mysqli_slave_query|mysqli_stmt|mysqli_warning|mysqlnd_ms_get_stats|' +
+        'mysqlnd_ms_query_is_select|mysqlnd_ms_set_user_pick_server|mysqlnd_qc_change_handler|mysqlnd_qc_clear_cache|mysqlnd_qc_get_cache_info|' +
+        'mysqlnd_qc_get_core_stats|mysqlnd_qc_get_handler|mysqlnd_qc_get_query_trace_log|mysqlnd_qc_set_user_handlers|natcasesort|natsort|' +
+        'ncurses_addch|ncurses_addchnstr|ncurses_addchstr|ncurses_addnstr|ncurses_addstr|ncurses_assume_default_colors|ncurses_attroff|' +
+        'ncurses_attron|ncurses_attrset|ncurses_baudrate|ncurses_beep|ncurses_bkgd|ncurses_bkgdset|ncurses_border|ncurses_bottom_panel|' +
+        'ncurses_can_change_color|ncurses_cbreak|ncurses_clear|ncurses_clrtobot|ncurses_clrtoeol|ncurses_color_content|ncurses_color_set|' +
+        'ncurses_curs_set|ncurses_def_prog_mode|ncurses_def_shell_mode|ncurses_define_key|ncurses_del_panel|ncurses_delay_output|ncurses_delch|' +
+        'ncurses_deleteln|ncurses_delwin|ncurses_doupdate|ncurses_echo|ncurses_echochar|ncurses_end|ncurses_erase|ncurses_erasechar|ncurses_filter|' +
+        'ncurses_flash|ncurses_flushinp|ncurses_getch|ncurses_getmaxyx|ncurses_getmouse|ncurses_getyx|ncurses_halfdelay|ncurses_has_colors|' +
+        'ncurses_has_ic|ncurses_has_il|ncurses_has_key|ncurses_hide_panel|ncurses_hline|ncurses_inch|ncurses_init|ncurses_init_color|' +
+        'ncurses_init_pair|ncurses_insch|ncurses_insdelln|ncurses_insertln|ncurses_insstr|ncurses_instr|ncurses_isendwin|ncurses_keyok|' +
+        'ncurses_keypad|ncurses_killchar|ncurses_longname|ncurses_meta|ncurses_mouse_trafo|ncurses_mouseinterval|ncurses_mousemask|ncurses_move|' +
+        'ncurses_move_panel|ncurses_mvaddch|ncurses_mvaddchnstr|ncurses_mvaddchstr|ncurses_mvaddnstr|ncurses_mvaddstr|ncurses_mvcur|' +
+        'ncurses_mvdelch|ncurses_mvgetch|ncurses_mvhline|ncurses_mvinch|ncurses_mvvline|ncurses_mvwaddstr|ncurses_napms|ncurses_new_panel|' +
+        'ncurses_newpad|ncurses_newwin|ncurses_nl|ncurses_nocbreak|ncurses_noecho|ncurses_nonl|ncurses_noqiflush|ncurses_noraw|' +
+        'ncurses_pair_content|ncurses_panel_above|ncurses_panel_below|ncurses_panel_window|ncurses_pnoutrefresh|ncurses_prefresh|ncurses_putp|' +
+        'ncurses_qiflush|ncurses_raw|ncurses_refresh|ncurses_replace_panel|ncurses_reset_prog_mode|ncurses_reset_shell_mode|ncurses_resetty|' +
+        'ncurses_savetty|ncurses_scr_dump|ncurses_scr_init|ncurses_scr_restore|ncurses_scr_set|ncurses_scrl|ncurses_show_panel|ncurses_slk_attr|' +
+        'ncurses_slk_attroff|ncurses_slk_attron|ncurses_slk_attrset|ncurses_slk_clear|ncurses_slk_color|ncurses_slk_init|ncurses_slk_noutrefresh|' +
+        'ncurses_slk_refresh|ncurses_slk_restore|ncurses_slk_set|ncurses_slk_touch|ncurses_standend|ncurses_standout|ncurses_start_color|' +
+        'ncurses_termattrs|ncurses_termname|ncurses_timeout|ncurses_top_panel|ncurses_typeahead|ncurses_ungetch|ncurses_ungetmouse|' +
+        'ncurses_update_panels|ncurses_use_default_colors|ncurses_use_env|ncurses_use_extended_names|ncurses_vidattr|ncurses_vline|ncurses_waddch|' +
+        'ncurses_waddstr|ncurses_wattroff|ncurses_wattron|ncurses_wattrset|ncurses_wborder|ncurses_wclear|ncurses_wcolor_set|ncurses_werase|' +
+        'ncurses_wgetch|ncurses_whline|ncurses_wmouse_trafo|ncurses_wmove|ncurses_wnoutrefresh|ncurses_wrefresh|ncurses_wstandend|' +
+        'ncurses_wstandout|ncurses_wvline|newinstance|newinstanceargs|newt_bell|newt_button|newt_button_bar|newt_centered_window|newt_checkbox|' +
+        'newt_checkbox_get_value|newt_checkbox_set_flags|newt_checkbox_set_value|newt_checkbox_tree|newt_checkbox_tree_add_item|' +
+        'newt_checkbox_tree_find_item|newt_checkbox_tree_get_current|newt_checkbox_tree_get_entry_value|newt_checkbox_tree_get_multi_selection|' +
+        'newt_checkbox_tree_get_selection|newt_checkbox_tree_multi|newt_checkbox_tree_set_current|newt_checkbox_tree_set_entry|' +
+        'newt_checkbox_tree_set_entry_value|newt_checkbox_tree_set_width|newt_clear_key_buffer|newt_cls|newt_compact_button|' +
+        'newt_component_add_callback|newt_component_takes_focus|newt_create_grid|newt_cursor_off|newt_cursor_on|newt_delay|newt_draw_form|' +
+        'newt_draw_root_text|newt_entry|newt_entry_get_value|newt_entry_set|newt_entry_set_filter|newt_entry_set_flags|newt_finished|newt_form|' +
+        'newt_form_add_component|newt_form_add_components|newt_form_add_hot_key|newt_form_destroy|newt_form_get_current|newt_form_run|' +
+        'newt_form_set_background|newt_form_set_height|newt_form_set_size|newt_form_set_timer|newt_form_set_width|newt_form_watch_fd|' +
+        'newt_get_screen_size|newt_grid_add_components_to_form|newt_grid_basic_window|newt_grid_free|newt_grid_get_size|newt_grid_h_close_stacked|' +
+        'newt_grid_h_stacked|newt_grid_place|newt_grid_set_field|newt_grid_simple_window|newt_grid_v_close_stacked|newt_grid_v_stacked|' +
+        'newt_grid_wrapped_window|newt_grid_wrapped_window_at|newt_init|newt_label|newt_label_set_text|newt_listbox|newt_listbox_append_entry|' +
+        'newt_listbox_clear|newt_listbox_clear_selection|newt_listbox_delete_entry|newt_listbox_get_current|newt_listbox_get_selection|' +
+        'newt_listbox_insert_entry|newt_listbox_item_count|newt_listbox_select_item|newt_listbox_set_current|newt_listbox_set_current_by_key|' +
+        'newt_listbox_set_data|newt_listbox_set_entry|newt_listbox_set_width|newt_listitem|newt_listitem_get_data|newt_listitem_set|' +
+        'newt_open_window|newt_pop_help_line|newt_pop_window|newt_push_help_line|newt_radio_get_current|newt_radiobutton|newt_redraw_help_line|' +
+        'newt_reflow_text|newt_refresh|newt_resize_screen|newt_resume|newt_run_form|newt_scale|newt_scale_set|newt_scrollbar_set|' +
+        'newt_set_help_callback|newt_set_suspend_callback|newt_suspend|newt_textbox|newt_textbox_get_num_lines|newt_textbox_reflowed|' +
+        'newt_textbox_set_height|newt_textbox_set_text|newt_vertical_scrollbar|newt_wait_for_key|newt_win_choice|newt_win_entries|newt_win_menu|' +
+        'newt_win_message|newt_win_messagev|newt_win_ternary|next|ngettext|nl2br|nl_langinfo|norewinditerator|normalizer|notes_body|notes_copy_db|' +
+        'notes_create_db|notes_create_note|notes_drop_db|notes_find_note|notes_header_info|notes_list_msgs|notes_mark_read|notes_mark_unread|' +
+        'notes_nav_create|notes_search|notes_unread|notes_version|nsapi_request_headers|nsapi_response_headers|nsapi_virtual|nthmac|number_format|' +
+        'numberformatter|oauth|oauth_get_sbs|oauth_urlencode|oauthexception|oauthprovider|ob_clean|ob_deflatehandler|ob_end_clean|ob_end_flush|' +
+        'ob_etaghandler|ob_flush|ob_get_clean|ob_get_contents|ob_get_flush|ob_get_length|ob_get_level|ob_get_status|ob_gzhandler|ob_iconv_handler|' +
+        'ob_implicit_flush|ob_inflatehandler|ob_list_handlers|ob_start|ob_tidyhandler|oci_bind_array_by_name|oci_bind_by_name|oci_cancel|' +
+        'oci_client_version|oci_close|oci_collection_append|oci_collection_assign|oci_collection_element_assign|oci_collection_element_get|' +
+        'oci_collection_free|oci_collection_max|oci_collection_size|oci_collection_trim|oci_commit|oci_connect|oci_define_by_name|oci_error|' +
+        'oci_execute|oci_fetch|oci_fetch_all|oci_fetch_array|oci_fetch_assoc|oci_fetch_object|oci_fetch_row|oci_field_is_null|oci_field_name|' +
+        'oci_field_precision|oci_field_scale|oci_field_size|oci_field_type|oci_field_type_raw|oci_free_statement|oci_internal_debug|oci_lob_append|' +
+        'oci_lob_close|oci_lob_copy|oci_lob_eof|oci_lob_erase|oci_lob_export|oci_lob_flush|oci_lob_free|oci_lob_getbuffering|oci_lob_import|' +
+        'oci_lob_is_equal|oci_lob_load|oci_lob_read|oci_lob_rewind|oci_lob_save|oci_lob_savefile|oci_lob_seek|oci_lob_setbuffering|oci_lob_size|' +
+        'oci_lob_tell|oci_lob_truncate|oci_lob_write|oci_lob_writetemporary|oci_lob_writetofile|oci_new_collection|oci_new_connect|oci_new_cursor|' +
+        'oci_new_descriptor|oci_num_fields|oci_num_rows|oci_parse|oci_password_change|oci_pconnect|oci_result|oci_rollback|oci_server_version|' +
+        'oci_set_action|oci_set_client_identifier|oci_set_client_info|oci_set_edition|oci_set_module_name|oci_set_prefetch|oci_statement_type|' +
+        'ocibindbyname|ocicancel|ocicloselob|ocicollappend|ocicollassign|ocicollassignelem|ocicollgetelem|ocicollmax|ocicollsize|ocicolltrim|' +
+        'ocicolumnisnull|ocicolumnname|ocicolumnprecision|ocicolumnscale|ocicolumnsize|ocicolumntype|ocicolumntyperaw|ocicommit|ocidefinebyname|' +
+        'ocierror|ociexecute|ocifetch|ocifetchinto|ocifetchstatement|ocifreecollection|ocifreecursor|ocifreedesc|ocifreestatement|ociinternaldebug|' +
+        'ociloadlob|ocilogoff|ocilogon|ocinewcollection|ocinewcursor|ocinewdescriptor|ocinlogon|ocinumcols|ociparse|ociplogon|ociresult|' +
+        'ocirollback|ocirowcount|ocisavelob|ocisavelobfile|ociserverversion|ocisetprefetch|ocistatementtype|ociwritelobtofile|ociwritetemporarylob|' +
+        'octdec|odbc_autocommit|odbc_binmode|odbc_close|odbc_close_all|odbc_columnprivileges|odbc_columns|odbc_commit|odbc_connect|odbc_cursor|' +
+        'odbc_data_source|odbc_do|odbc_error|odbc_errormsg|odbc_exec|odbc_execute|odbc_fetch_array|odbc_fetch_into|odbc_fetch_object|' +
+        'odbc_fetch_row|odbc_field_len|odbc_field_name|odbc_field_num|odbc_field_precision|odbc_field_scale|odbc_field_type|odbc_foreignkeys|' +
+        'odbc_free_result|odbc_gettypeinfo|odbc_longreadlen|odbc_next_result|odbc_num_fields|odbc_num_rows|odbc_pconnect|odbc_prepare|' +
+        'odbc_primarykeys|odbc_procedurecolumns|odbc_procedures|odbc_result|odbc_result_all|odbc_rollback|odbc_setoption|odbc_specialcolumns|' +
+        'odbc_statistics|odbc_tableprivileges|odbc_tables|openal_buffer_create|openal_buffer_data|openal_buffer_destroy|openal_buffer_get|' +
+        'openal_buffer_loadwav|openal_context_create|openal_context_current|openal_context_destroy|openal_context_process|openal_context_suspend|' +
+        'openal_device_close|openal_device_open|openal_listener_get|openal_listener_set|openal_source_create|openal_source_destroy|' +
+        'openal_source_get|openal_source_pause|openal_source_play|openal_source_rewind|openal_source_set|openal_source_stop|openal_stream|opendir|' +
+        'openlog|openssl_cipher_iv_length|openssl_csr_export|openssl_csr_export_to_file|openssl_csr_get_public_key|openssl_csr_get_subject|' +
+        'openssl_csr_new|openssl_csr_sign|openssl_decrypt|openssl_dh_compute_key|openssl_digest|openssl_encrypt|openssl_error_string|' +
+        'openssl_free_key|openssl_get_cipher_methods|openssl_get_md_methods|openssl_get_privatekey|openssl_get_publickey|openssl_open|' +
+        'openssl_pkcs12_export|openssl_pkcs12_export_to_file|openssl_pkcs12_read|openssl_pkcs7_decrypt|openssl_pkcs7_encrypt|openssl_pkcs7_sign|' +
+        'openssl_pkcs7_verify|openssl_pkey_export|openssl_pkey_export_to_file|openssl_pkey_free|openssl_pkey_get_details|openssl_pkey_get_private|' +
+        'openssl_pkey_get_public|openssl_pkey_new|openssl_private_decrypt|openssl_private_encrypt|openssl_public_decrypt|openssl_public_encrypt|' +
+        'openssl_random_pseudo_bytes|openssl_seal|openssl_sign|openssl_verify|openssl_x509_check_private_key|openssl_x509_checkpurpose|' +
+        'openssl_x509_export|openssl_x509_export_to_file|openssl_x509_free|openssl_x509_parse|openssl_x509_read|ord|outeriterator|' +
+        'outofboundsexception|outofrangeexception|output_add_rewrite_var|output_reset_rewrite_vars|overflowexception|overload|override_function|' +
+        'ovrimos_close|ovrimos_commit|ovrimos_connect|ovrimos_cursor|ovrimos_exec|ovrimos_execute|ovrimos_fetch_into|ovrimos_fetch_row|' +
+        'ovrimos_field_len|ovrimos_field_name|ovrimos_field_num|ovrimos_field_type|ovrimos_free_result|ovrimos_longreadlen|ovrimos_num_fields|' +
+        'ovrimos_num_rows|ovrimos_prepare|ovrimos_result|ovrimos_result_all|ovrimos_rollback|pack|parentiterator|parse_ini_file|parse_ini_string|' +
+        'parse_str|parse_url|parsekit_compile_file|parsekit_compile_string|parsekit_func_arginfo|passthru|pathinfo|pclose|pcntl_alarm|pcntl_exec|' +
+        'pcntl_fork|pcntl_getpriority|pcntl_setpriority|pcntl_signal|pcntl_signal_dispatch|pcntl_sigprocmask|pcntl_sigtimedwait|pcntl_sigwaitinfo|' +
+        'pcntl_wait|pcntl_waitpid|pcntl_wexitstatus|pcntl_wifexited|pcntl_wifsignaled|pcntl_wifstopped|pcntl_wstopsig|pcntl_wtermsig|' +
+        'pdf_activate_item|pdf_add_annotation|pdf_add_bookmark|pdf_add_launchlink|pdf_add_locallink|pdf_add_nameddest|pdf_add_note|pdf_add_outline|' +
+        'pdf_add_pdflink|pdf_add_table_cell|pdf_add_textflow|pdf_add_thumbnail|pdf_add_weblink|pdf_arc|pdf_arcn|pdf_attach_file|pdf_begin_document|' +
+        'pdf_begin_font|pdf_begin_glyph|pdf_begin_item|pdf_begin_layer|pdf_begin_page|pdf_begin_page_ext|pdf_begin_pattern|pdf_begin_template|' +
+        'pdf_begin_template_ext|pdf_circle|pdf_clip|pdf_close|pdf_close_image|pdf_close_pdi|pdf_close_pdi_page|pdf_closepath|' +
+        'pdf_closepath_fill_stroke|pdf_closepath_stroke|pdf_concat|pdf_continue_text|pdf_create_3dview|pdf_create_action|pdf_create_annotation|' +
+        'pdf_create_bookmark|pdf_create_field|pdf_create_fieldgroup|pdf_create_gstate|pdf_create_pvf|pdf_create_textflow|pdf_curveto|' +
+        'pdf_define_layer|pdf_delete|pdf_delete_pvf|pdf_delete_table|pdf_delete_textflow|pdf_encoding_set_char|pdf_end_document|pdf_end_font|' +
+        'pdf_end_glyph|pdf_end_item|pdf_end_layer|pdf_end_page|pdf_end_page_ext|pdf_end_pattern|pdf_end_template|pdf_endpath|pdf_fill|' +
+        'pdf_fill_imageblock|pdf_fill_pdfblock|pdf_fill_stroke|pdf_fill_textblock|pdf_findfont|pdf_fit_image|pdf_fit_pdi_page|pdf_fit_table|' +
+        'pdf_fit_textflow|pdf_fit_textline|pdf_get_apiname|pdf_get_buffer|pdf_get_errmsg|pdf_get_errnum|pdf_get_font|pdf_get_fontname|' +
+        'pdf_get_fontsize|pdf_get_image_height|pdf_get_image_width|pdf_get_majorversion|pdf_get_minorversion|pdf_get_parameter|' +
+        'pdf_get_pdi_parameter|pdf_get_pdi_value|pdf_get_value|pdf_info_font|pdf_info_matchbox|pdf_info_table|pdf_info_textflow|pdf_info_textline|' +
+        'pdf_initgraphics|pdf_lineto|pdf_load_3ddata|pdf_load_font|pdf_load_iccprofile|pdf_load_image|pdf_makespotcolor|pdf_moveto|pdf_new|' +
+        'pdf_open_ccitt|pdf_open_file|pdf_open_gif|pdf_open_image|pdf_open_image_file|pdf_open_jpeg|pdf_open_memory_image|pdf_open_pdi|' +
+        'pdf_open_pdi_document|pdf_open_pdi_page|pdf_open_tiff|pdf_pcos_get_number|pdf_pcos_get_stream|pdf_pcos_get_string|pdf_place_image|' +
+        'pdf_place_pdi_page|pdf_process_pdi|pdf_rect|pdf_restore|pdf_resume_page|pdf_rotate|pdf_save|pdf_scale|pdf_set_border_color|' +
+        'pdf_set_border_dash|pdf_set_border_style|pdf_set_char_spacing|pdf_set_duration|pdf_set_gstate|pdf_set_horiz_scaling|pdf_set_info|' +
+        'pdf_set_info_author|pdf_set_info_creator|pdf_set_info_keywords|pdf_set_info_subject|pdf_set_info_title|pdf_set_layer_dependency|' +
+        'pdf_set_leading|pdf_set_parameter|pdf_set_text_matrix|pdf_set_text_pos|pdf_set_text_rendering|pdf_set_text_rise|pdf_set_value|' +
+        'pdf_set_word_spacing|pdf_setcolor|pdf_setdash|pdf_setdashpattern|pdf_setflat|pdf_setfont|pdf_setgray|pdf_setgray_fill|pdf_setgray_stroke|' +
+        'pdf_setlinecap|pdf_setlinejoin|pdf_setlinewidth|pdf_setmatrix|pdf_setmiterlimit|pdf_setpolydash|pdf_setrgbcolor|pdf_setrgbcolor_fill|' +
+        'pdf_setrgbcolor_stroke|pdf_shading|pdf_shading_pattern|pdf_shfill|pdf_show|pdf_show_boxed|pdf_show_xy|pdf_skew|pdf_stringwidth|pdf_stroke|' +
+        'pdf_suspend_page|pdf_translate|pdf_utf16_to_utf8|pdf_utf32_to_utf16|pdf_utf8_to_utf16|pdo|pdo_cubrid_schema|pdo_pgsqllobcreate|' +
+        'pdo_pgsqllobopen|pdo_pgsqllobunlink|pdo_sqlitecreateaggregate|pdo_sqlitecreatefunction|pdoexception|pdostatement|pfsockopen|' +
+        'pg_affected_rows|pg_cancel_query|pg_client_encoding|pg_close|pg_connect|pg_connection_busy|pg_connection_reset|pg_connection_status|' +
+        'pg_convert|pg_copy_from|pg_copy_to|pg_dbname|pg_delete|pg_end_copy|pg_escape_bytea|pg_escape_string|pg_execute|pg_fetch_all|' +
+        'pg_fetch_all_columns|pg_fetch_array|pg_fetch_assoc|pg_fetch_object|pg_fetch_result|pg_fetch_row|pg_field_is_null|pg_field_name|' +
+        'pg_field_num|pg_field_prtlen|pg_field_size|pg_field_table|pg_field_type|pg_field_type_oid|pg_free_result|pg_get_notify|pg_get_pid|' +
+        'pg_get_result|pg_host|pg_insert|pg_last_error|pg_last_notice|pg_last_oid|pg_lo_close|pg_lo_create|pg_lo_export|pg_lo_import|pg_lo_open|' +
+        'pg_lo_read|pg_lo_read_all|pg_lo_seek|pg_lo_tell|pg_lo_unlink|pg_lo_write|pg_meta_data|pg_num_fields|pg_num_rows|pg_options|' +
+        'pg_parameter_status|pg_pconnect|pg_ping|pg_port|pg_prepare|pg_put_line|pg_query|pg_query_params|pg_result_error|pg_result_error_field|' +
+        'pg_result_seek|pg_result_status|pg_select|pg_send_execute|pg_send_prepare|pg_send_query|pg_send_query_params|pg_set_client_encoding|' +
+        'pg_set_error_verbosity|pg_trace|pg_transaction_status|pg_tty|pg_unescape_bytea|pg_untrace|pg_update|pg_version|php_check_syntax|' +
+        'php_ini_loaded_file|php_ini_scanned_files|php_logo_guid|php_sapi_name|php_strip_whitespace|php_uname|phpcredits|phpinfo|phpversion|pi|' +
+        'png2wbmp|popen|pos|posix_access|posix_ctermid|posix_errno|posix_get_last_error|posix_getcwd|posix_getegid|posix_geteuid|posix_getgid|' +
+        'posix_getgrgid|posix_getgrnam|posix_getgroups|posix_getlogin|posix_getpgid|posix_getpgrp|posix_getpid|posix_getppid|posix_getpwnam|' +
+        'posix_getpwuid|posix_getrlimit|posix_getsid|posix_getuid|posix_initgroups|posix_isatty|posix_kill|posix_mkfifo|posix_mknod|posix_setegid|' +
+        'posix_seteuid|posix_setgid|posix_setpgid|posix_setsid|posix_setuid|posix_strerror|posix_times|posix_ttyname|posix_uname|pow|preg_filter|' +
+        'preg_grep|preg_last_error|preg_match|preg_match_all|preg_quote|preg_replace|preg_replace_callback|preg_split|prev|print|print_r|' +
+        'printer_abort|printer_close|printer_create_brush|printer_create_dc|printer_create_font|printer_create_pen|printer_delete_brush|' +
+        'printer_delete_dc|printer_delete_font|printer_delete_pen|printer_draw_bmp|printer_draw_chord|printer_draw_elipse|printer_draw_line|' +
+        'printer_draw_pie|printer_draw_rectangle|printer_draw_roundrect|printer_draw_text|printer_end_doc|printer_end_page|printer_get_option|' +
+        'printer_list|printer_logical_fontheight|printer_open|printer_select_brush|printer_select_font|printer_select_pen|printer_set_option|' +
+        'printer_start_doc|printer_start_page|printer_write|printf|proc_close|proc_get_status|proc_nice|proc_open|proc_terminate|property_exists|' +
+        'ps_add_bookmark|ps_add_launchlink|ps_add_locallink|ps_add_note|ps_add_pdflink|ps_add_weblink|ps_arc|ps_arcn|ps_begin_page|' +
+        'ps_begin_pattern|ps_begin_template|ps_circle|ps_clip|ps_close|ps_close_image|ps_closepath|ps_closepath_stroke|ps_continue_text|ps_curveto|' +
+        'ps_delete|ps_end_page|ps_end_pattern|ps_end_template|ps_fill|ps_fill_stroke|ps_findfont|ps_get_buffer|ps_get_parameter|ps_get_value|' +
+        'ps_hyphenate|ps_include_file|ps_lineto|ps_makespotcolor|ps_moveto|ps_new|ps_open_file|ps_open_image|ps_open_image_file|' +
+        'ps_open_memory_image|ps_place_image|ps_rect|ps_restore|ps_rotate|ps_save|ps_scale|ps_set_border_color|ps_set_border_dash|' +
+        'ps_set_border_style|ps_set_info|ps_set_parameter|ps_set_text_pos|ps_set_value|ps_setcolor|ps_setdash|ps_setflat|ps_setfont|ps_setgray|' +
+        'ps_setlinecap|ps_setlinejoin|ps_setlinewidth|ps_setmiterlimit|ps_setoverprintmode|ps_setpolydash|ps_shading|ps_shading_pattern|ps_shfill|' +
+        'ps_show|ps_show2|ps_show_boxed|ps_show_xy|ps_show_xy2|ps_string_geometry|ps_stringwidth|ps_stroke|ps_symbol|ps_symbol_name|' +
+        'ps_symbol_width|ps_translate|pspell_add_to_personal|pspell_add_to_session|pspell_check|pspell_clear_session|pspell_config_create|' +
+        'pspell_config_data_dir

<TRUNCATED>

[24/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/coffee/parser_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/coffee/parser_test.js b/src/fauxton/assets/js/libs/ace/mode/coffee/parser_test.js
new file mode 100644
index 0000000..001262b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/coffee/parser_test.js
@@ -0,0 +1,88 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var assert = require("../../test/assertions");
+var coffee = require("../coffee/coffee-script");
+
+function assertLocation(e, sl, sc, el, ec) {
+    assert.equal(e.location.first_line, sl);
+    assert.equal(e.location.first_column, sc);
+    assert.equal(e.location.last_line, el);
+    assert.equal(e.location.last_column, ec);
+}
+
+function parse(str) {
+    try {
+        coffee.parse(str).compile();
+    } catch (e) {
+        return e;
+    }
+}
+
+module.exports = {
+    "test parse valid coffee script": function() {
+        coffee.parse("square = (x) -> x * x");
+    },
+    
+    "test parse invalid coffee script": function() {
+        var e = parse("a = 12 f");
+        assert.equal(e.message, "Unexpected 'IDENTIFIER'");
+        assertLocation(e, 0, 4, 0, 5);
+    },
+    
+    "test parse missing bracket": function() {
+        var e = parse("a = 12 f {\n\n");
+        assert.equal(e.message, "missing }");
+        assertLocation(e, 0, 10, 0, 10);
+    },
+    "test unexpected indent": function() {
+        var e = parse("a\n  a\n");
+        assert.equal(e.message, "Unexpected 'INDENT'");
+        assertLocation(e, 1, 0, 1, 1);
+    },
+    "test invalid destructuring": function() {
+        var e = parse("\n{b: 5} = {}");
+        assert.equal(e.message, '"5" cannot be assigned');
+        assertLocation(e, 1, 4, 1, 4);
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec();
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/coffee/rewriter.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/coffee/rewriter.js b/src/fauxton/assets/js/libs/ace/mode/coffee/rewriter.js
new file mode 100644
index 0000000..009d17d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/coffee/rewriter.js
@@ -0,0 +1,513 @@
+/**
+ * Copyright (c) 2009-2013 Jeremy Ashkenas
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ */
+
+define(function(require, exports, module) {
+// Generated by CoffeeScript 1.6.3
+
+  var BALANCED_PAIRS, EXPRESSION_CLOSE, EXPRESSION_END, EXPRESSION_START, IMPLICIT_CALL, IMPLICIT_END, IMPLICIT_FUNC, IMPLICIT_UNSPACED_CALL, INVERSES, LINEBREAKS, SINGLE_CLOSERS, SINGLE_LINERS, generate, left, rite, _i, _len, _ref,
+    __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
+    __slice = [].slice;
+
+  generate = function(tag, value) {
+    var tok;
+    tok = [tag, value];
+    tok.generated = true;
+    return tok;
+  };
+
+  exports.Rewriter = (function() {
+    function Rewriter() {}
+
+    Rewriter.prototype.rewrite = function(tokens) {
+      this.tokens = tokens;
+      this.removeLeadingNewlines();
+      this.removeMidExpressionNewlines();
+      this.closeOpenCalls();
+      this.closeOpenIndexes();
+      this.addImplicitIndentation();
+      this.tagPostfixConditionals();
+      this.addImplicitBracesAndParens();
+      this.addLocationDataToGeneratedTokens();
+      return this.tokens;
+    };
+
+    Rewriter.prototype.scanTokens = function(block) {
+      var i, token, tokens;
+      tokens = this.tokens;
+      i = 0;
+      while (token = tokens[i]) {
+        i += block.call(this, token, i, tokens);
+      }
+      return true;
+    };
+
+    Rewriter.prototype.detectEnd = function(i, condition, action) {
+      var levels, token, tokens, _ref, _ref1;
+      tokens = this.tokens;
+      levels = 0;
+      while (token = tokens[i]) {
+        if (levels === 0 && condition.call(this, token, i)) {
+          return action.call(this, token, i);
+        }
+        if (!token || levels < 0) {
+          return action.call(this, token, i - 1);
+        }
+        if (_ref = token[0], __indexOf.call(EXPRESSION_START, _ref) >= 0) {
+          levels += 1;
+        } else if (_ref1 = token[0], __indexOf.call(EXPRESSION_END, _ref1) >= 0) {
+          levels -= 1;
+        }
+        i += 1;
+      }
+      return i - 1;
+    };
+
+    Rewriter.prototype.removeLeadingNewlines = function() {
+      var i, tag, _i, _len, _ref;
+      _ref = this.tokens;
+      for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
+        tag = _ref[i][0];
+        if (tag !== 'TERMINATOR') {
+          break;
+        }
+      }
+      if (i) {
+        return this.tokens.splice(0, i);
+      }
+    };
+
+    Rewriter.prototype.removeMidExpressionNewlines = function() {
+      return this.scanTokens(function(token, i, tokens) {
+        var _ref;
+        if (!(token[0] === 'TERMINATOR' && (_ref = this.tag(i + 1), __indexOf.call(EXPRESSION_CLOSE, _ref) >= 0))) {
+          return 1;
+        }
+        tokens.splice(i, 1);
+        return 0;
+      });
+    };
+
+    Rewriter.prototype.closeOpenCalls = function() {
+      var action, condition;
+      condition = function(token, i) {
+        var _ref;
+        return ((_ref = token[0]) === ')' || _ref === 'CALL_END') || token[0] === 'OUTDENT' && this.tag(i - 1) === ')';
+      };
+      action = function(token, i) {
+        return this.tokens[token[0] === 'OUTDENT' ? i - 1 : i][0] = 'CALL_END';
+      };
+      return this.scanTokens(function(token, i) {
+        if (token[0] === 'CALL_START') {
+          this.detectEnd(i + 1, condition, action);
+        }
+        return 1;
+      });
+    };
+
+    Rewriter.prototype.closeOpenIndexes = function() {
+      var action, condition;
+      condition = function(token, i) {
+        var _ref;
+        return (_ref = token[0]) === ']' || _ref === 'INDEX_END';
+      };
+      action = function(token, i) {
+        return token[0] = 'INDEX_END';
+      };
+      return this.scanTokens(function(token, i) {
+        if (token[0] === 'INDEX_START') {
+          this.detectEnd(i + 1, condition, action);
+        }
+        return 1;
+      });
+    };
+
+    Rewriter.prototype.matchTags = function() {
+      var fuzz, i, j, pattern, _i, _ref, _ref1;
+      i = arguments[0], pattern = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+      fuzz = 0;
+      for (j = _i = 0, _ref = pattern.length; 0 <= _ref ? _i < _ref : _i > _ref; j = 0 <= _ref ? ++_i : --_i) {
+        while (this.tag(i + j + fuzz) === 'HERECOMMENT') {
+          fuzz += 2;
+        }
+        if (pattern[j] == null) {
+          continue;
+        }
+        if (typeof pattern[j] === 'string') {
+          pattern[j] = [pattern[j]];
+        }
+        if (_ref1 = this.tag(i + j + fuzz), __indexOf.call(pattern[j], _ref1) < 0) {
+          return false;
+        }
+      }
+      return true;
+    };
+
+    Rewriter.prototype.looksObjectish = function(j) {
+      return this.matchTags(j, '@', null, ':') || this.matchTags(j, null, ':');
+    };
+
+    Rewriter.prototype.findTagsBackwards = function(i, tags) {
+      var backStack, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
+      backStack = [];
+      while (i >= 0 && (backStack.length || (_ref2 = this.tag(i), __indexOf.call(tags, _ref2) < 0) && ((_ref3 = this.tag(i), __indexOf.call(EXPRESSION_START, _ref3) < 0) || this.tokens[i].generated) && (_ref4 = this.tag(i), __indexOf.call(LINEBREAKS, _ref4) < 0))) {
+        if (_ref = this.tag(i), __indexOf.call(EXPRESSION_END, _ref) >= 0) {
+          backStack.push(this.tag(i));
+        }
+        if ((_ref1 = this.tag(i), __indexOf.call(EXPRESSION_START, _ref1) >= 0) && backStack.length) {
+          backStack.pop();
+        }
+        i -= 1;
+      }
+      return _ref5 = this.tag(i), __indexOf.call(tags, _ref5) >= 0;
+    };
+
+    Rewriter.prototype.addImplicitBracesAndParens = function() {
+      var stack;
+      stack = [];
+      return this.scanTokens(function(token, i, tokens) {
+        var endImplicitCall, endImplicitObject, forward, inImplicit, inImplicitCall, inImplicitControl, inImplicitObject, nextTag, offset, prevTag, s, sameLine, stackIdx, stackTag, stackTop, startIdx, startImplicitCall, startImplicitObject, startsLine, tag, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
+        tag = token[0];
+        prevTag = (i > 0 ? tokens[i - 1] : [])[0];
+        nextTag = (i < tokens.length - 1 ? tokens[i + 1] : [])[0];
+        stackTop = function() {
+          return stack[stack.length - 1];
+        };
+        startIdx = i;
+        forward = function(n) {
+          return i - startIdx + n;
+        };
+        inImplicit = function() {
+          var _ref, _ref1;
+          return (_ref = stackTop()) != null ? (_ref1 = _ref[2]) != null ? _ref1.ours : void 0 : void 0;
+        };
+        inImplicitCall = function() {
+          var _ref;
+          return inImplicit() && ((_ref = stackTop()) != null ? _ref[0] : void 0) === '(';
+        };
+        inImplicitObject = function() {
+          var _ref;
+          return inImplicit() && ((_ref = stackTop()) != null ? _ref[0] : void 0) === '{';
+        };
+        inImplicitControl = function() {
+          var _ref;
+          return inImplicit && ((_ref = stackTop()) != null ? _ref[0] : void 0) === 'CONTROL';
+        };
+        startImplicitCall = function(j) {
+          var idx;
+          idx = j != null ? j : i;
+          stack.push([
+            '(', idx, {
+              ours: true
+            }
+          ]);
+          tokens.splice(idx, 0, generate('CALL_START', '('));
+          if (j == null) {
+            return i += 1;
+          }
+        };
+        endImplicitCall = function() {
+          stack.pop();
+          tokens.splice(i, 0, generate('CALL_END', ')'));
+          return i += 1;
+        };
+        startImplicitObject = function(j, startsLine) {
+          var idx;
+          if (startsLine == null) {
+            startsLine = true;
+          }
+          idx = j != null ? j : i;
+          stack.push([
+            '{', idx, {
+              sameLine: true,
+              startsLine: startsLine,
+              ours: true
+            }
+          ]);
+          tokens.splice(idx, 0, generate('{', generate(new String('{'))));
+          if (j == null) {
+            return i += 1;
+          }
+        };
+        endImplicitObject = function(j) {
+          j = j != null ? j : i;
+          stack.pop();
+          tokens.splice(j, 0, generate('}', '}'));
+          return i += 1;
+        };
+        if (inImplicitCall() && (tag === 'IF' || tag === 'TRY' || tag === 'FINALLY' || tag === 'CATCH' || tag === 'CLASS' || tag === 'SWITCH')) {
+          stack.push([
+            'CONTROL', i, {
+              ours: true
+            }
+          ]);
+          return forward(1);
+        }
+        if (tag === 'INDENT' && inImplicit()) {
+          if (prevTag !== '=>' && prevTag !== '->' && prevTag !== '[' && prevTag !== '(' && prevTag !== ',' && prevTag !== '{' && prevTag !== 'TRY' && prevTag !== 'ELSE' && prevTag !== '=') {
+            while (inImplicitCall()) {
+              endImplicitCall();
+            }
+          }
+          if (inImplicitControl()) {
+            stack.pop();
+          }
+          stack.push([tag, i]);
+          return forward(1);
+        }
+        if (__indexOf.call(EXPRESSION_START, tag) >= 0) {
+          stack.push([tag, i]);
+          return forward(1);
+        }
+        if (__indexOf.call(EXPRESSION_END, tag) >= 0) {
+          while (inImplicit()) {
+            if (inImplicitCall()) {
+              endImplicitCall();
+            } else if (inImplicitObject()) {
+              endImplicitObject();
+            } else {
+              stack.pop();
+            }
+          }
+          stack.pop();
+        }
+        if ((__indexOf.call(IMPLICIT_FUNC, tag) >= 0 && token.spaced && !token.stringEnd || tag === '?' && i > 0 && !tokens[i - 1].spaced) && (__indexOf.call(IMPLICIT_CALL, nextTag) >= 0 || __indexOf.call(IMPLICIT_UNSPACED_CALL, nextTag) >= 0 && !((_ref = tokens[i + 1]) != null ? _ref.spaced : void 0) && !((_ref1 = tokens[i + 1]) != null ? _ref1.newLine : void 0))) {
+          if (tag === '?') {
+            tag = token[0] = 'FUNC_EXIST';
+          }
+          startImplicitCall(i + 1);
+          return forward(2);
+        }
+        if (__indexOf.call(IMPLICIT_FUNC, tag) >= 0 && this.matchTags(i + 1, 'INDENT', null, ':') && !this.findTagsBackwards(i, ['CLASS', 'EXTENDS', 'IF', 'CATCH', 'SWITCH', 'LEADING_WHEN', 'FOR', 'WHILE', 'UNTIL'])) {
+          startImplicitCall(i + 1);
+          stack.push(['INDENT', i + 2]);
+          return forward(3);
+        }
+        if (tag === ':') {
+          if (this.tag(i - 2) === '@') {
+            s = i - 2;
+          } else {
+            s = i - 1;
+          }
+          while (this.tag(s - 2) === 'HERECOMMENT') {
+            s -= 2;
+          }
+          startsLine = s === 0 || (_ref2 = this.tag(s - 1), __indexOf.call(LINEBREAKS, _ref2) >= 0) || tokens[s - 1].newLine;
+          if (stackTop()) {
+            _ref3 = stackTop(), stackTag = _ref3[0], stackIdx = _ref3[1];
+            if ((stackTag === '{' || stackTag === 'INDENT' && this.tag(stackIdx - 1) === '{') && (startsLine || this.tag(s - 1) === ',' || this.tag(s - 1) === '{')) {
+              return forward(1);
+            }
+          }
+          startImplicitObject(s, !!startsLine);
+          return forward(2);
+        }
+        if (prevTag === 'OUTDENT' && inImplicitCall() && (tag === '.' || tag === '?.' || tag === '::' || tag === '?::')) {
+          endImplicitCall();
+          return forward(1);
+        }
+        if (inImplicitObject() && __indexOf.call(LINEBREAKS, tag) >= 0) {
+          stackTop()[2].sameLine = false;
+        }
+        if (__indexOf.call(IMPLICIT_END, tag) >= 0) {
+          while (inImplicit()) {
+            _ref4 = stackTop(), stackTag = _ref4[0], stackIdx = _ref4[1], (_ref5 = _ref4[2], sameLine = _ref5.sameLine, startsLine = _ref5.startsLine);
+            if (inImplicitCall() && prevTag !== ',') {
+              endImplicitCall();
+            } else if (inImplicitObject() && sameLine && !startsLine) {
+              endImplicitObject();
+            } else if (inImplicitObject() && tag === 'TERMINATOR' && prevTag !== ',' && !(startsLine && this.looksObjectish(i + 1))) {
+              endImplicitObject();
+            } else {
+              break;
+            }
+          }
+        }
+        if (tag === ',' && !this.looksObjectish(i + 1) && inImplicitObject() && (nextTag !== 'TERMINATOR' || !this.looksObjectish(i + 2))) {
+          offset = nextTag === 'OUTDENT' ? 1 : 0;
+          while (inImplicitObject()) {
+            endImplicitObject(i + offset);
+          }
+        }
+        return forward(1);
+      });
+    };
+
+    Rewriter.prototype.addLocationDataToGeneratedTokens = function() {
+      return this.scanTokens(function(token, i, tokens) {
+        var column, line, nextLocation, prevLocation, _ref, _ref1;
+        if (token[2]) {
+          return 1;
+        }
+        if (!(token.generated || token.explicit)) {
+          return 1;
+        }
+        if (token[0] === '{' && (nextLocation = (_ref = tokens[i + 1]) != null ? _ref[2] : void 0)) {
+          line = nextLocation.first_line, column = nextLocation.first_column;
+        } else if (prevLocation = (_ref1 = tokens[i - 1]) != null ? _ref1[2] : void 0) {
+          line = prevLocation.last_line, column = prevLocation.last_column;
+        } else {
+          line = column = 0;
+        }
+        token[2] = {
+          first_line: line,
+          first_column: column,
+          last_line: line,
+          last_column: column
+        };
+        return 1;
+      });
+    };
+
+    Rewriter.prototype.addImplicitIndentation = function() {
+      var action, condition, indent, outdent, starter;
+      starter = indent = outdent = null;
+      condition = function(token, i) {
+        var _ref, _ref1;
+        return token[1] !== ';' && (_ref = token[0], __indexOf.call(SINGLE_CLOSERS, _ref) >= 0) && !(token[0] === 'ELSE' && starter !== 'THEN') && !(((_ref1 = token[0]) === 'CATCH' || _ref1 === 'FINALLY') && (starter === '->' || starter === '=>'));
+      };
+      action = function(token, i) {
+        return this.tokens.splice((this.tag(i - 1) === ',' ? i - 1 : i), 0, outdent);
+      };
+      return this.scanTokens(function(token, i, tokens) {
+        var j, tag, _i, _ref, _ref1;
+        tag = token[0];
+        if (tag === 'TERMINATOR' && this.tag(i + 1) === 'THEN') {
+          tokens.splice(i, 1);
+          return 0;
+        }
+        if (tag === 'ELSE' && this.tag(i - 1) !== 'OUTDENT') {
+          tokens.splice.apply(tokens, [i, 0].concat(__slice.call(this.indentation())));
+          return 2;
+        }
+        if (tag === 'CATCH') {
+          for (j = _i = 1; _i <= 2; j = ++_i) {
+            if (!((_ref = this.tag(i + j)) === 'OUTDENT' || _ref === 'TERMINATOR' || _ref === 'FINALLY')) {
+              continue;
+            }
+            tokens.splice.apply(tokens, [i + j, 0].concat(__slice.call(this.indentation())));
+            return 2 + j;
+          }
+        }
+        if (__indexOf.call(SINGLE_LINERS, tag) >= 0 && this.tag(i + 1) !== 'INDENT' && !(tag === 'ELSE' && this.tag(i + 1) === 'IF')) {
+          starter = tag;
+          _ref1 = this.indentation(true), indent = _ref1[0], outdent = _ref1[1];
+          if (starter === 'THEN') {
+            indent.fromThen = true;
+          }
+          tokens.splice(i + 1, 0, indent);
+          this.detectEnd(i + 2, condition, action);
+          if (tag === 'THEN') {
+            tokens.splice(i, 1);
+          }
+          return 1;
+        }
+        return 1;
+      });
+    };
+
+    Rewriter.prototype.tagPostfixConditionals = function() {
+      var action, condition, original;
+      original = null;
+      condition = function(token, i) {
+        var prevTag, tag;
+        tag = token[0];
+        prevTag = this.tokens[i - 1][0];
+        return tag === 'TERMINATOR' || (tag === 'INDENT' && __indexOf.call(SINGLE_LINERS, prevTag) < 0);
+      };
+      action = function(token, i) {
+        if (token[0] !== 'INDENT' || (token.generated && !token.fromThen)) {
+          return original[0] = 'POST_' + original[0];
+        }
+      };
+      return this.scanTokens(function(token, i) {
+        if (token[0] !== 'IF') {
+          return 1;
+        }
+        original = token;
+        this.detectEnd(i + 1, condition, action);
+        return 1;
+      });
+    };
+
+    Rewriter.prototype.indentation = function(implicit) {
+      var indent, outdent;
+      if (implicit == null) {
+        implicit = false;
+      }
+      indent = ['INDENT', 2];
+      outdent = ['OUTDENT', 2];
+      if (implicit) {
+        indent.generated = outdent.generated = true;
+      }
+      if (!implicit) {
+        indent.explicit = outdent.explicit = true;
+      }
+      return [indent, outdent];
+    };
+
+    Rewriter.prototype.generate = generate;
+
+    Rewriter.prototype.tag = function(i) {
+      var _ref;
+      return (_ref = this.tokens[i]) != null ? _ref[0] : void 0;
+    };
+
+    return Rewriter;
+
+  })();
+
+  BALANCED_PAIRS = [['(', ')'], ['[', ']'], ['{', '}'], ['INDENT', 'OUTDENT'], ['CALL_START', 'CALL_END'], ['PARAM_START', 'PARAM_END'], ['INDEX_START', 'INDEX_END']];
+
+  exports.INVERSES = INVERSES = {};
+
+  EXPRESSION_START = [];
+
+  EXPRESSION_END = [];
+
+  for (_i = 0, _len = BALANCED_PAIRS.length; _i < _len; _i++) {
+    _ref = BALANCED_PAIRS[_i], left = _ref[0], rite = _ref[1];
+    EXPRESSION_START.push(INVERSES[rite] = left);
+    EXPRESSION_END.push(INVERSES[left] = rite);
+  }
+
+  EXPRESSION_CLOSE = ['CATCH', 'WHEN', 'ELSE', 'FINALLY'].concat(EXPRESSION_END);
+
+  IMPLICIT_FUNC = ['IDENTIFIER', 'SUPER', ')', 'CALL_END', ']', 'INDEX_END', '@', 'THIS'];
+
+  IMPLICIT_CALL = ['IDENTIFIER', 'NUMBER', 'STRING', 'JS', 'REGEX', 'NEW', 'PARAM_START', 'CLASS', 'IF', 'TRY', 'SWITCH', 'THIS', 'BOOL', 'NULL', 'UNDEFINED', 'UNARY', 'SUPER', 'THROW', '@', '->', '=>', '[', '(', '{', '--', '++'];
+
+  IMPLICIT_UNSPACED_CALL = ['+', '-'];
+
+  IMPLICIT_END = ['POST_IF', 'FOR', 'WHILE', 'UNTIL', 'WHEN', 'BY', 'LOOP', 'TERMINATOR'];
+
+  SINGLE_LINERS = ['ELSE', '->', '=>', 'TRY', 'FINALLY', 'THEN'];
+
+  SINGLE_CLOSERS = ['TERMINATOR', 'CATCH', 'FINALLY', 'ELSE', 'OUTDENT', 'LEADING_WHEN'];
+
+  LINEBREAKS = ['TERMINATOR', 'INDENT', 'OUTDENT'];
+
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/coffee/scope.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/coffee/scope.js b/src/fauxton/assets/js/libs/ace/mode/coffee/scope.js
new file mode 100644
index 0000000..5834963
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/coffee/scope.js
@@ -0,0 +1,174 @@
+/**
+ * Copyright (c) 2009-2013 Jeremy Ashkenas
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ */
+
+define(function(require, exports, module) {
+// Generated by CoffeeScript 1.6.3
+
+  var Scope, extend, last, _ref;
+
+  _ref = require('./helpers'), extend = _ref.extend, last = _ref.last;
+
+  exports.Scope = Scope = (function() {
+    Scope.root = null;
+
+    function Scope(parent, expressions, method) {
+      this.parent = parent;
+      this.expressions = expressions;
+      this.method = method;
+      this.variables = [
+        {
+          name: 'arguments',
+          type: 'arguments'
+        }
+      ];
+      this.positions = {};
+      if (!this.parent) {
+        Scope.root = this;
+      }
+    }
+
+    Scope.prototype.add = function(name, type, immediate) {
+      if (this.shared && !immediate) {
+        return this.parent.add(name, type, immediate);
+      }
+      if (Object.prototype.hasOwnProperty.call(this.positions, name)) {
+        return this.variables[this.positions[name]].type = type;
+      } else {
+        return this.positions[name] = this.variables.push({
+          name: name,
+          type: type
+        }) - 1;
+      }
+    };
+
+    Scope.prototype.namedMethod = function() {
+      var _ref1;
+      if (((_ref1 = this.method) != null ? _ref1.name : void 0) || !this.parent) {
+        return this.method;
+      }
+      return this.parent.namedMethod();
+    };
+
+    Scope.prototype.find = function(name) {
+      if (this.check(name)) {
+        return true;
+      }
+      this.add(name, 'var');
+      return false;
+    };
+
+    Scope.prototype.parameter = function(name) {
+      if (this.shared && this.parent.check(name, true)) {
+        return;
+      }
+      return this.add(name, 'param');
+    };
+
+    Scope.prototype.check = function(name) {
+      var _ref1;
+      return !!(this.type(name) || ((_ref1 = this.parent) != null ? _ref1.check(name) : void 0));
+    };
+
+    Scope.prototype.temporary = function(name, index) {
+      if (name.length > 1) {
+        return '_' + name + (index > 1 ? index - 1 : '');
+      } else {
+        return '_' + (index + parseInt(name, 36)).toString(36).replace(/\d/g, 'a');
+      }
+    };
+
+    Scope.prototype.type = function(name) {
+      var v, _i, _len, _ref1;
+      _ref1 = this.variables;
+      for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+        v = _ref1[_i];
+        if (v.name === name) {
+          return v.type;
+        }
+      }
+      return null;
+    };
+
+    Scope.prototype.freeVariable = function(name, reserve) {
+      var index, temp;
+      if (reserve == null) {
+        reserve = true;
+      }
+      index = 0;
+      while (this.check((temp = this.temporary(name, index)))) {
+        index++;
+      }
+      if (reserve) {
+        this.add(temp, 'var', true);
+      }
+      return temp;
+    };
+
+    Scope.prototype.assign = function(name, value) {
+      this.add(name, {
+        value: value,
+        assigned: true
+      }, true);
+      return this.hasAssignments = true;
+    };
+
+    Scope.prototype.hasDeclarations = function() {
+      return !!this.declaredVariables().length;
+    };
+
+    Scope.prototype.declaredVariables = function() {
+      var realVars, tempVars, v, _i, _len, _ref1;
+      realVars = [];
+      tempVars = [];
+      _ref1 = this.variables;
+      for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+        v = _ref1[_i];
+        if (v.type === 'var') {
+          (v.name.charAt(0) === '_' ? tempVars : realVars).push(v.name);
+        }
+      }
+      return realVars.sort().concat(tempVars.sort());
+    };
+
+    Scope.prototype.assignedVariables = function() {
+      var v, _i, _len, _ref1, _results;
+      _ref1 = this.variables;
+      _results = [];
+      for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+        v = _ref1[_i];
+        if (v.type.assigned) {
+          _results.push("" + v.name + " = " + v.type.value);
+        }
+      }
+      return _results;
+    };
+
+    return Scope;
+
+  })();
+
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/coffee_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/coffee_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/coffee_highlight_rules.js
new file mode 100644
index 0000000..a6d33ab
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/coffee_highlight_rules.js
@@ -0,0 +1,233 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+    var oop = require("../lib/oop");
+    var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+    oop.inherits(CoffeeHighlightRules, TextHighlightRules);
+
+    function CoffeeHighlightRules() {
+        var identifier = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*";
+
+        var keywords = (
+            "this|throw|then|try|typeof|super|switch|return|break|by|continue|" +
+            "catch|class|in|instanceof|is|isnt|if|else|extends|for|own|" +
+            "finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" +
+            "or|on|unless|until|and|yes"
+        );
+
+        var langConstant = (
+            "true|false|null|undefined|NaN|Infinity"
+        );
+
+        var illegal = (
+            "case|const|default|function|var|void|with|enum|export|implements|" +
+            "interface|let|package|private|protected|public|static|yield|" +
+            "__hasProp|slice|bind|indexOf"
+        );
+
+        var supportClass = (
+            "Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|String|" +
+            "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" +
+            "SyntaxError|TypeError|URIError|"  +
+            "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
+            "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray"
+        );
+
+        var supportFunction = (
+            "Math|JSON|isNaN|isFinite|parseInt|parseFloat|encodeURI|" +
+            "encodeURIComponent|decodeURI|decodeURIComponent|String|"
+        );
+
+        var variableLanguage = (
+            "window|arguments|prototype|document"
+        );
+
+        var keywordMapper = this.createKeywordMapper({
+            "keyword": keywords,
+            "constant.language": langConstant,
+            "invalid.illegal": illegal,
+            "language.support.class": supportClass,
+            "language.support.function": supportFunction,
+            "variable.language": variableLanguage
+        }, "identifier");
+
+        var functionRule = {
+            token: ["paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"],
+            regex: /(?:(\()((?:"[^")]*?"|'[^')]*?'|\/[^\/)]*?\/|[^()\"'\/])*?)(\))(\s*))?([\-=]>)/.source
+        };
+
+        var stringEscape = /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)/;
+
+        this.$rules = {
+            start : [
+                {
+                    token : "constant.numeric",
+                    regex : "(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"
+                }, {
+                    stateName: "qdoc",
+                    token : "string", regex : "'''", next : [
+                        {token : "string", regex : "'''", next : "start"},
+                        {token : "constant.language.escape", regex : stringEscape},
+                        {defaultToken: "string"}
+                    ]
+                }, {
+                    stateName: "qqdoc",
+                    token : "string",
+                    regex : '"""',
+                    next : [
+                        {token : "string", regex : '"""', next : "start"},
+                        {token : "paren.string", regex : '#{', push : "start"},
+                        {token : "constant.language.escape", regex : stringEscape},
+                        {defaultToken: "string"}
+                    ]
+                }, {
+                    stateName: "qstring",
+                    token : "string", regex : "'", next : [
+                        {token : "string", regex : "'", next : "start"},
+                        {token : "constant.language.escape", regex : stringEscape},
+                        {defaultToken: "string"}
+                    ]
+                }, {
+                    stateName: "qqstring",
+                    token : "string.start", regex : '"', next : [
+                        {token : "string.end", regex : '"', next : "start"},
+                        {token : "paren.string", regex : '#{', push : "start"},
+                        {token : "constant.language.escape", regex : stringEscape},
+                        {defaultToken: "string"}
+                    ]
+                }, {
+                    stateName: "js",
+                    token : "string", regex : "`", next : [
+                        {token : "string", regex : "`", next : "start"},
+                        {token : "constant.language.escape", regex : stringEscape},
+                        {defaultToken: "string"}
+                    ]
+                }, {
+                    regex: "[{}]", onMatch: function(val, state, stack) {
+                        this.next = "";
+                        if (val == "{" && stack.length) {
+                            stack.unshift("start", state);
+                            return "paren";
+                        }
+                        if (val == "}" && stack.length) {
+                            stack.shift();
+                            this.next = stack.shift();
+                            if (this.next.indexOf("string") != -1)
+                                return "paren.string";
+                        }
+                        return "paren";
+                    }
+                }, {
+                    token : "string.regex",
+                    regex : "///",
+                    next : "heregex"
+                }, {
+                    token : "string.regex",
+                    regex : /(?:\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)(?:[imgy]{0,4})(?!\w)/
+                }, {
+                    token : "comment",
+                    regex : "###(?!#)",
+                    next : "comment"
+                }, {
+                    token : "comment",
+                    regex : "#.*"
+                }, {
+                    token : ["punctuation.operator", "text", "identifier"],
+                    regex : "(\\.)(\\s*)(" + illegal + ")"
+                }, {
+                    token : "punctuation.operator",
+                    regex : "\\."
+                }, {
+                    //class A extends B
+                    token : ["keyword", "text", "language.support.class",
+                     "text", "keyword", "text", "language.support.class"],
+                    regex : "(class)(\\s+)(" + identifier + ")(?:(\\s+)(extends)(\\s+)(" + identifier + "))?"
+                }, {
+                    //play = (...) ->
+                    token : ["entity.name.function", "text", "keyword.operator", "text"].concat(functionRule.token),
+                    regex : "(" + identifier + ")(\\s*)([=:])(\\s*)" + functionRule.regex
+                }, 
+                functionRule, 
+                {
+                    token : "variable",
+                    regex : "@(?:" + identifier + ")?"
+                }, {
+                    token: keywordMapper,
+                    regex : identifier
+                }, {
+                    token : "punctuation.operator",
+                    regex : "\\,|\\."
+                }, {
+                    token : "storage.type",
+                    regex : "[\\-=]>"
+                }, {
+                    token : "keyword.operator",
+                    regex : "(?:[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|[!*+-=><])"
+                }, {
+                    token : "paren.lparen",
+                    regex : "[({[]"
+                }, {
+                    token : "paren.rparen",
+                    regex : "[\\]})]"
+                }, {
+                    token : "text",
+                    regex : "\\s+"
+                }],
+
+
+            heregex : [{
+                token : "string.regex",
+                regex : '.*?///[imgy]{0,4}',
+                next : "start"
+            }, {
+                token : "comment.regex",
+                regex : "\\s+(?:#.*)?"
+            }, {
+                token : "string.regex",
+                regex : "\\S+"
+            }],
+
+            comment : [{
+                token : "comment",
+                regex : '###',
+                next : "start"
+            }, {
+                defaultToken : "comment"
+            }]
+        };
+        this.normalizeRules();
+    }
+
+    exports.CoffeeHighlightRules = CoffeeHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/coffee_worker.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/coffee_worker.js b/src/fauxton/assets/js/libs/ace/mode/coffee_worker.js
new file mode 100644
index 0000000..a5f700f
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/coffee_worker.js
@@ -0,0 +1,74 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var Mirror = require("../worker/mirror").Mirror;
+var coffee = require("../mode/coffee/coffee-script");
+
+window.addEventListener = function() {};
+
+
+var Worker = exports.Worker = function(sender) {
+    Mirror.call(this, sender);
+    this.setTimeout(250);
+};
+
+oop.inherits(Worker, Mirror);
+
+(function() {
+
+    this.onUpdate = function() {
+        var value = this.doc.getValue();
+
+        try {
+            coffee.parse(value).compile();
+        } catch(e) {
+            var loc = e.location;
+            if (loc) {
+                this.sender.emit("error", {
+                    row: loc.first_line,
+                    column: loc.first_column,
+                    endRow: loc.last_line,
+                    endColumn: loc.last_column,
+                    text: e.message,
+                    type: "error"
+                });
+            }
+            return;
+        }
+        this.sender.emit("ok");
+    };
+
+}).call(Worker.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/coldfusion.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/coldfusion.js b/src/fauxton/assets/js/libs/ace/mode/coldfusion.js
new file mode 100644
index 0000000..25a2b17
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/coldfusion.js
@@ -0,0 +1,62 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var XmlMode = require("./xml").Mode;
+var JavaScriptMode = require("./javascript").Mode;
+var CssMode = require("./css").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var ColdfusionHighlightRules = require("./coldfusion_highlight_rules").ColdfusionHighlightRules;
+
+var Mode = function() {
+    XmlMode.call(this);
+    
+    this.HighlightRules = ColdfusionHighlightRules;
+    
+    this.createModeDelegates({
+      "js-": JavaScriptMode,
+      "css-": CssMode
+    });
+};
+oop.inherits(Mode, XmlMode);
+
+(function() {
+
+    this.getNextLineIndent = function(state, line, tab) {
+        return this.$getIndent(line);
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/coldfusion_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/coldfusion_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/coldfusion_highlight_rules.js
new file mode 100644
index 0000000..5feff6d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/coldfusion_highlight_rules.js
@@ -0,0 +1,49 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+
+var ColdfusionHighlightRules = function() {
+    HtmlHighlightRules.call(this);
+
+    this.embedTagRules(JavaScriptHighlightRules, "cfjs-", "cfscript");
+
+    this.normalizeRules();
+};
+
+oop.inherits(ColdfusionHighlightRules, HtmlHighlightRules);
+
+exports.ColdfusionHighlightRules = ColdfusionHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/coldfusion_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/coldfusion_test.js b/src/fauxton/assets/js/libs/ace/mode/coldfusion_test.js
new file mode 100644
index 0000000..b55fb1c
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/coldfusion_test.js
@@ -0,0 +1,67 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("../edit_session").EditSession;
+var Range = require("../range").Range;
+var ColdfusionMode = require("./coldfusion").Mode;
+var assert = require("../test/assertions");
+
+module.exports = {
+    setUp : function() {    
+        this.mode = new ColdfusionMode();
+    },
+
+    "test: toggle comment lines" : function() {
+        var session = new EditSession(["  abc", "  cde", "fg"]);
+
+        var range = new Range(0, 3, 1, 1);
+        var comment = this.mode.toggleCommentLines("start", session, 0, 1);
+        assert.equal(["  <!--abc-->", "  <!--cde-->", "fg"].join("\n"), session.toString());
+    },
+
+    "test: next line indent should be the same as the current line indent" : function() {
+        assert.equal("     ", this.mode.getNextLineIndent("start", "     abc"));
+        assert.equal("", this.mode.getNextLineIndent("start", "abc"));
+        assert.equal("\t", this.mode.getNextLineIndent("start", "\tabc"));
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/csharp.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/csharp.js b/src/fauxton/assets/js/libs/ace/mode/csharp.js
new file mode 100644
index 0000000..95846a4
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/csharp.js
@@ -0,0 +1,61 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var CSharpHighlightRules = require("./csharp_highlight_rules").CSharpHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/csharp").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = CSharpHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new CstyleBehaviour();
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    
+    this.lineCommentStart = "//";
+    this.blockComment = {start: "/*", end: "*/"};
+    
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+  
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+  
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+    
+        if (state == "start") {
+            var match = line.match(/^.*[\{\(\[]\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        }
+  
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+  
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+
+    this.createWorker = function(session) {
+        return null;
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/csharp_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/csharp_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/csharp_highlight_rules.js
new file mode 100644
index 0000000..89cbc2d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/csharp_highlight_rules.js
@@ -0,0 +1,96 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var CSharpHighlightRules = function() {
+    var keywordMapper = this.createKeywordMapper({
+        "variable.language": "this",
+        "keyword": "abstract|event|new|struct|as|explicit|null|switch|base|extern|object|this|bool|false|operator|throw|break|finally|out|true|byte|fixed|override|try|case|float|params|typeof|catch|for|private|uint|char|foreach|protected|ulong|checked|goto|public|unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort|continue|in|return|using|decimal|int|sbyte|virtual|default|interface|sealed|volatile|delegate|internal|short|void|do|is|sizeof|while|double|lock|stackalloc|else|long|static|enum|namespace|string|var|dynamic",
+        "constant.language": "null|true|false"
+    }, "identifier");
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "start" : [
+            {
+                token : "comment",
+                regex : "\\/\\/.*$"
+            },
+            DocCommentHighlightRules.getStartRule("doc-start"),
+            {
+                token : "comment", // multi line comment
+                regex : "\\/\\*",
+                next : "comment"
+            }, {
+                token : "string.regexp",
+                regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
+            }, {
+                token : "string", // character
+                regex : /'(?:.|\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n]))'/
+            }, {
+                token : "string", start : '"', end : '"|$', next: [
+                    {token: "constant.language.escape", regex: /\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n])/},
+                    {token: "invalid", regex: /\\./}
+                ]
+            }, {
+                token : "string", start : '@"', end : '"', next:[
+                    {token: "constant.language.escape", regex: '""'}
+                ]
+            }, {
+                token : "constant.numeric", // hex
+                regex : "0[xX][0-9a-fA-F]+\\b"
+            }, {
+                token : "constant.numeric", // float
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+            }, {
+                token : "constant.language.boolean",
+                regex : "(?:true|false)\\b"
+            }, {
+                token : keywordMapper,
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+            }, {
+                token : "keyword.operator",
+                regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
+            }, {
+                token : "keyword",
+                regex : "^\\s*#(if|else|elif|endif|define|undef|warning|error|line|region|endregion|pragma)"
+            }, {
+                token : "punctuation.operator",
+                regex : "\\?|\\:|\\,|\\;|\\."
+            }, {
+                token : "paren.lparen",
+                regex : "[[({]"
+            }, {
+                token : "paren.rparen",
+                regex : "[\\])}]"
+            }, {
+                token : "text",
+                regex : "\\s+"
+            }
+        ],
+        "comment" : [
+            {
+                token : "comment", // closing comment
+                regex : ".*?\\*\\/",
+                next : "start"
+            }, {
+                token : "comment", // comment spanning whole line
+                regex : ".+"
+            }
+        ]
+    };
+
+    this.embedRules(DocCommentHighlightRules, "doc-",
+        [ DocCommentHighlightRules.getEndRule("start") ]);
+    this.normalizeRules();
+};
+
+oop.inherits(CSharpHighlightRules, TextHighlightRules);
+
+exports.CSharpHighlightRules = CSharpHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/css.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/css.js b/src/fauxton/assets/js/libs/ace/mode/css.js
new file mode 100644
index 0000000..9a4234c
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/css.js
@@ -0,0 +1,100 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var WorkerClient = require("../worker/worker_client").WorkerClient;
+var CssBehaviour = require("./behaviour/css").CssBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = CssHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new CssBehaviour();
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.foldingRules = "cStyle";
+    this.blockComment = {start: "/*", end: "*/"};
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        // ignore braces in comments
+        var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+
+        var match = line.match(/^.*\{\s*$/);
+        if (match) {
+            indent += tab;
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+    this.createWorker = function(session) {
+        var worker = new WorkerClient(["ace"], "ace/mode/css_worker", "Worker");
+        worker.attachToDocument(session.getDocument());
+
+        worker.on("csslint", function(e) {
+            session.setAnnotations(e.data);
+        });
+
+        worker.on("terminate", function() {
+            session.clearAnnotations();
+        });
+
+        return worker;
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+
+});


[48/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/edit_session.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/edit_session.js b/src/fauxton/assets/js/libs/ace/edit_session.js
new file mode 100644
index 0000000..98c1e94
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/edit_session.js
@@ -0,0 +1,2505 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("./lib/oop");
+var lang = require("./lib/lang");
+var config = require("./config");
+var EventEmitter = require("./lib/event_emitter").EventEmitter;
+var Selection = require("./selection").Selection;
+var TextMode = require("./mode/text").Mode;
+var Range = require("./range").Range;
+var Document = require("./document").Document;
+var BackgroundTokenizer = require("./background_tokenizer").BackgroundTokenizer;
+var SearchHighlight = require("./search_highlight").SearchHighlight;
+
+/**
+ * Stores all the data about [[Editor `Editor`]] state providing easy way to change editors state.
+ *
+ * `EditSession` can be attached to only one [[Document `Document`]]. Same `Document` can be attached to several `EditSession`s.
+ * @class EditSession
+ **/
+
+//{ events
+/**
+ *
+ * Emitted when the document changes.
+ * @event change
+ * @param {Object} e An object containing a `delta` of information about the change.
+ **/
+/**
+ * Emitted when the tab size changes, via [[EditSession.setTabSize]].
+ *
+ * @event changeTabSize
+ **/
+/**
+ * Emitted when the ability to overwrite text changes, via [[EditSession.setOverwrite]].
+ *
+ * @event changeOverwrite
+ **/
+/**
+ * Emitted when the gutter changes, either by setting or removing breakpoints, or when the gutter decorations change.
+ *
+ * @event changeBreakpoint
+ **/
+/**
+ * Emitted when a front marker changes.
+ *
+ * @event changeFrontMarker
+ **/
+/**
+ * Emitted when a back marker changes.
+ *
+ * @event changeBackMarker
+ **/
+/**
+ * Emitted when an annotation changes, like through [[EditSession.setAnnotations]].
+ *
+ * @event changeAnnotation
+ **/
+/**
+ * Emitted when a background tokenizer asynchronously processes new rows.
+ * @event tokenizerUpdate
+ *
+ * @param {Object} e An object containing one property, `"data"`, that contains information about the changing rows
+ *
+ **/
+/**
+ * Emitted when the current mode changes.
+ *
+ * @event changeMode
+ *
+ **/
+/**
+ * Emitted when the wrap mode changes.
+ *
+ * @event changeWrapMode
+ *
+ **/
+/**
+ * Emitted when the wrapping limit changes.
+ *
+ * @event changeWrapLimit
+ *
+ **/
+/**
+ * Emitted when a code fold is added or removed.
+ *
+ * @event changeFold
+ *
+ **/
+ /**
+ * Emitted when the scroll top changes.
+ * @event changeScrollTop
+ *
+ * @param {Number} scrollTop The new scroll top value
+ **/
+/**
+ * Emitted when the scroll left changes.
+ * @event changeScrollLeft
+ *
+ * @param {Number} scrollLeft The new scroll left value
+ **/
+//}
+
+/**
+ *
+ * Sets up a new `EditSession` and associates it with the given `Document` and `TextMode`.
+ * @param {Document | String} text [If `text` is a `Document`, it associates the `EditSession` with it. Otherwise, a new `Document` is created, with the initial text]{: #textParam}
+ * @param {TextMode} mode [The inital language mode to use for the document]{: #modeParam}
+ *
+ * @constructor
+ **/
+
+var EditSession = function(text, mode) {
+    this.$breakpoints = [];
+    this.$decorations = [];
+    this.$frontMarkers = {};
+    this.$backMarkers = {};
+    this.$markerId = 1;
+    this.$undoSelect = true;
+
+    this.$foldData = [];
+    this.$foldData.toString = function() {
+        return this.join("\n");
+    }
+    this.on("changeFold", this.onChangeFold.bind(this));
+    this.$onChange = this.onChange.bind(this);
+
+    if (typeof text != "object" || !text.getLine)
+        text = new Document(text);
+
+    this.setDocument(text);
+    this.selection = new Selection(this);
+
+    config.resetOptions(this);
+    this.setMode(mode);
+    config._emit("session", this);
+};
+
+
+(function() {
+
+    oop.implement(this, EventEmitter);
+
+    /**
+     * Sets the `EditSession` to point to a new `Document`. If a `BackgroundTokenizer` exists, it also points to `doc`.
+     *
+     * @param {Document} doc The new `Document` to use
+     *
+     **/
+    this.setDocument = function(doc) {
+        if (this.doc)
+            this.doc.removeListener("change", this.$onChange);
+
+        this.doc = doc;
+        doc.on("change", this.$onChange);
+
+        if (this.bgTokenizer)
+            this.bgTokenizer.setDocument(this.getDocument());
+
+        this.resetCaches();
+    };
+
+    /**
+     * Returns the `Document` associated with this session.
+     * @return {Document}
+     **/
+    this.getDocument = function() {
+        return this.doc;
+    };
+
+    /**
+     * @param {Number} row The row to work with
+     *
+     **/
+    this.$resetRowCache = function(docRow) {
+        if (!docRow) {
+            this.$docRowCache = [];
+            this.$screenRowCache = [];
+            return;
+        }
+        var l = this.$docRowCache.length;
+        var i = this.$getRowCacheIndex(this.$docRowCache, docRow) + 1;
+        if (l > i) {
+            this.$docRowCache.splice(i, l);
+            this.$screenRowCache.splice(i, l);
+        }
+    };
+
+    this.$getRowCacheIndex = function(cacheArray, val) {
+        var low = 0;
+        var hi = cacheArray.length - 1;
+
+        while (low <= hi) {
+            var mid = (low + hi) >> 1;
+            var c = cacheArray[mid];
+
+            if (val > c)
+                low = mid + 1;
+            else if (val < c)
+                hi = mid - 1;
+            else
+                return mid;
+        }
+
+        return low -1;
+    };
+
+    this.resetCaches = function() {
+        this.$modified = true;
+        this.$wrapData = [];
+        this.$rowLengthCache = [];
+        this.$resetRowCache(0);
+        if (this.bgTokenizer)
+            this.bgTokenizer.start(0);
+    };
+
+    this.onChangeFold = function(e) {
+        var fold = e.data;
+        this.$resetRowCache(fold.start.row);
+    };
+
+    this.onChange = function(e) {
+        var delta = e.data;
+        this.$modified = true;
+
+        this.$resetRowCache(delta.range.start.row);
+
+        var removedFolds = this.$updateInternalDataOnChange(e);
+        if (!this.$fromUndo && this.$undoManager && !delta.ignore) {
+            this.$deltasDoc.push(delta);
+            if (removedFolds && removedFolds.length != 0) {
+                this.$deltasFold.push({
+                    action: "removeFolds",
+                    folds:  removedFolds
+                });
+            }
+
+            this.$informUndoManager.schedule();
+        }
+
+        this.bgTokenizer.$updateOnChange(delta);
+        this._emit("change", e);
+    };
+
+    /**
+    * Sets the session text.
+    * @param {String} text The new text to place
+    *
+    *
+    *
+    **/
+    this.setValue = function(text) {
+        this.doc.setValue(text);
+        this.selection.moveCursorTo(0, 0);
+        this.selection.clearSelection();
+
+        this.$resetRowCache(0);
+        this.$deltas = [];
+        this.$deltasDoc = [];
+        this.$deltasFold = [];
+        this.getUndoManager().reset();
+    };
+
+    /**
+    * Returns the current [[Document `Document`]] as a string.
+    * @method toString
+    * @returns {String}
+    * @alias EditSession.getValue
+    *
+    **/
+
+    /**
+    * Returns the current [[Document `Document`]] as a string.
+    * @method getValue
+    * @returns {String}
+    * @alias EditSession.toString
+    **/
+    this.getValue =
+    this.toString = function() {
+        return this.doc.getValue();
+    };
+
+    /**
+    * Returns the string of the current selection.
+    **/
+    this.getSelection = function() {
+        return this.selection;
+    };
+
+    /**
+     * {:BackgroundTokenizer.getState}
+     * @param {Number} row The row to start at
+     *
+     * @related BackgroundTokenizer.getState
+     **/
+    this.getState = function(row) {
+        return this.bgTokenizer.getState(row);
+    };
+
+    /**
+     * Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows.
+     * @param {Number} row The row to start at
+     *
+     *
+     *
+     **/
+    this.getTokens = function(row) {
+        return this.bgTokenizer.getTokens(row);
+    };
+
+    /**
+    * Returns an object indicating the token at the current row. The object has two properties: `index` and `start`.
+    * @param {Number} row The row number to retrieve from
+    * @param {Number} column The column number to retrieve from
+    *
+    *
+    **/
+    this.getTokenAt = function(row, column) {
+        var tokens = this.bgTokenizer.getTokens(row);
+        var token, c = 0;
+        if (column == null) {
+            i = tokens.length - 1;
+            c = this.getLine(row).length;
+        } else {
+            for (var i = 0; i < tokens.length; i++) {
+                c += tokens[i].value.length;
+                if (c >= column)
+                    break;
+            }
+        }
+        token = tokens[i];
+        if (!token)
+            return null;
+        token.index = i;
+        token.start = c - token.value.length;
+        return token;
+    };
+
+    /**
+    * Sets the undo manager.
+    * @param {UndoManager} undoManager The new undo manager
+    *
+    *
+    **/
+    this.setUndoManager = function(undoManager) {
+        this.$undoManager = undoManager;
+        this.$deltas = [];
+        this.$deltasDoc = [];
+        this.$deltasFold = [];
+
+        if (this.$informUndoManager)
+            this.$informUndoManager.cancel();
+
+        if (undoManager) {
+            var self = this;
+
+            this.$syncInformUndoManager = function() {
+                self.$informUndoManager.cancel();
+
+                if (self.$deltasFold.length) {
+                    self.$deltas.push({
+                        group: "fold",
+                        deltas: self.$deltasFold
+                    });
+                    self.$deltasFold = [];
+                }
+
+                if (self.$deltasDoc.length) {
+                    self.$deltas.push({
+                        group: "doc",
+                        deltas: self.$deltasDoc
+                    });
+                    self.$deltasDoc = [];
+                }
+
+                if (self.$deltas.length > 0) {
+                    undoManager.execute({
+                        action: "aceupdate",
+                        args: [self.$deltas, self],
+                        merge: self.mergeUndoDeltas
+                    });
+                }
+                self.mergeUndoDeltas = false;
+                self.$deltas = [];
+            }
+            this.$informUndoManager = lang.delayedCall(this.$syncInformUndoManager);
+        }
+    };
+
+    /**
+     * starts a new group in undo history
+     **/
+    this.markUndoGroup = function() {
+        if (this.$syncInformUndoManager)
+            this.$syncInformUndoManager();
+    };
+    
+    this.$defaultUndoManager = {
+        undo: function() {},
+        redo: function() {},
+        reset: function() {}
+    };
+
+    /**
+    * Returns the current undo manager.
+    **/
+    this.getUndoManager = function() {
+        return this.$undoManager || this.$defaultUndoManager;
+    };
+
+    /**
+    * Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by [[EditSession.getTabSize `getTabSize()`]]); otherwise it's simply `'\t'`.
+    **/
+    this.getTabString = function() {
+        if (this.getUseSoftTabs()) {
+            return lang.stringRepeat(" ", this.getTabSize());
+        } else {
+            return "\t";
+        }
+    };
+
+    /**
+    /**
+    * Pass `true` to enable the use of soft tabs. Soft tabs means you're using spaces instead of the tab character (`'\t'`).
+    * @param {Boolean} useSoftTabs Value indicating whether or not to use soft tabs
+    **/
+    this.setUseSoftTabs = function(val) {
+        this.setOption("useSoftTabs", val);
+    };
+    /**
+    * Returns `true` if soft tabs are being used, `false` otherwise.
+    * @returns {Boolean}
+    **/
+    this.getUseSoftTabs = function() {
+        // todo might need more general way for changing settings from mode, but this is ok for now
+        return this.$useSoftTabs && !this.$mode.$indentWithTabs;
+    };
+    /**
+    * Set the number of spaces that define a soft tab; for example, passing in `4` transforms the soft tabs to be equivalent to four spaces. This function also emits the `changeTabSize` event.
+    * @param {Number} tabSize The new tab size
+    **/
+    this.setTabSize = function(tabSize) {
+        this.setOption("tabSize", tabSize)
+    };
+    /**
+    * Returns the current tab size.
+    **/
+    this.getTabSize = function() {
+        return this.$tabSize;
+    };
+
+    /**
+    * Returns `true` if the character at the position is a soft tab.
+    * @param {Object} position The position to check
+    *
+    *
+    **/
+    this.isTabStop = function(position) {
+        return this.$useSoftTabs && (position.column % this.$tabSize == 0);
+    };
+
+    this.$overwrite = false;
+    /**
+    * Pass in `true` to enable overwrites in your session, or `false` to disable.
+    *
+    * If overwrites is enabled, any text you enter will type over any text after it. If the value of `overwrite` changes, this function also emites the `changeOverwrite` event.
+    *
+    * @param {Boolean} overwrite Defines wheter or not to set overwrites
+    *
+    *
+    **/
+    this.setOverwrite = function(overwrite) {
+        this.setOption("overwrite", overwrite)
+    };
+
+    /**
+    * Returns `true` if overwrites are enabled; `false` otherwise.
+    **/
+    this.getOverwrite = function() {
+        return this.$overwrite;
+    };
+
+    /**
+    * Sets the value of overwrite to the opposite of whatever it currently is.
+    **/
+    this.toggleOverwrite = function() {
+        this.setOverwrite(!this.$overwrite);
+    };
+
+    /**
+    * Adds `className` to the `row`, to be used for CSS stylings and whatnot.
+    * @param {Number} row The row number
+    * @param {String} className The class to add
+    *
+    *
+    **/
+    this.addGutterDecoration = function(row, className) {
+        if (!this.$decorations[row])
+            this.$decorations[row] = "";
+        this.$decorations[row] += " " + className;
+        this._emit("changeBreakpoint", {});
+    };
+
+    /**
+    * Removes `className` from the `row`.
+    * @param {Number} row The row number
+    * @param {String} className The class to add
+    *
+    *
+    **/
+    this.removeGutterDecoration = function(row, className) {
+        this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, "");
+        this._emit("changeBreakpoint", {});
+    };
+
+    /**
+    * Returns an array of numbers, indicating which rows have breakpoints.
+    * @returns {[Number]}
+    **/
+    this.getBreakpoints = function() {
+        return this.$breakpoints;
+    };
+
+    /**
+    * Sets a breakpoint on every row number given by `rows`. This function also emites the `'changeBreakpoint'` event.
+    * @param {Array} rows An array of row indices
+    *
+    *
+    *
+    **/
+    this.setBreakpoints = function(rows) {
+        this.$breakpoints = [];
+        for (var i=0; i<rows.length; i++) {
+            this.$breakpoints[rows[i]] = "ace_breakpoint";
+        }
+        this._emit("changeBreakpoint", {});
+    };
+
+    /**
+    * Removes all breakpoints on the rows. This function also emites the `'changeBreakpoint'` event.
+    **/
+    this.clearBreakpoints = function() {
+        this.$breakpoints = [];
+        this._emit("changeBreakpoint", {});
+    };
+
+    /**
+    * Sets a breakpoint on the row number given by `rows`. This function also emites the `'changeBreakpoint'` event.
+    * @param {Number} row A row index
+    * @param {String} className Class of the breakpoint
+    *
+    *
+    **/
+    this.setBreakpoint = function(row, className) {
+        if (className === undefined)
+            className = "ace_breakpoint";
+        if (className)
+            this.$breakpoints[row] = className;
+        else
+            delete this.$breakpoints[row];
+        this._emit("changeBreakpoint", {});
+    };
+
+    /**
+    * Removes a breakpoint on the row number given by `rows`. This function also emites the `'changeBreakpoint'` event.
+    * @param {Number} row A row index
+    *
+    *
+    **/
+    this.clearBreakpoint = function(row) {
+        delete this.$breakpoints[row];
+        this._emit("changeBreakpoint", {});
+    };
+
+    /**
+    * Adds a new marker to the given `Range`. If `inFront` is `true`, a front marker is defined, and the `'changeFrontMarker'` event fires; otherwise, the `'changeBackMarker'` event fires.
+    * @param {Range} range Define the range of the marker
+    * @param {String} clazz Set the CSS class for the marker
+    * @param {Function | String} type Identify the type of the marker
+    * @param {Boolean} inFront Set to `true` to establish a front marker
+    *
+    *
+    * @return {Number} The new marker id
+    **/
+    this.addMarker = function(range, clazz, type, inFront) {
+        var id = this.$markerId++;
+
+        var marker = {
+            range : range,
+            type : type || "line",
+            renderer: typeof type == "function" ? type : null,
+            clazz : clazz,
+            inFront: !!inFront,
+            id: id
+        }
+
+        if (inFront) {
+            this.$frontMarkers[id] = marker;
+            this._emit("changeFrontMarker")
+        } else {
+            this.$backMarkers[id] = marker;
+            this._emit("changeBackMarker")
+        }
+
+        return id;
+    };
+
+    /**
+     * Adds a dynamic marker to the session.
+     * @param {Object} marker object with update method
+     * @param {Boolean} inFront Set to `true` to establish a front marker
+     *
+     *
+     * @return {Object} The added marker
+     **/
+    this.addDynamicMarker = function(marker, inFront) {
+        if (!marker.update)
+            return;
+        var id = this.$markerId++;
+        marker.id = id;
+        marker.inFront = !!inFront;
+
+        if (inFront) {
+            this.$frontMarkers[id] = marker;
+            this._emit("changeFrontMarker")
+        } else {
+            this.$backMarkers[id] = marker;
+            this._emit("changeBackMarker")
+        }
+
+        return marker;
+    };
+
+    /**
+    * Removes the marker with the specified ID. If this marker was in front, the `'changeFrontMarker'` event is emitted. If the marker was in the back, the `'changeBackMarker'` event is emitted.
+    * @param {Number} markerId A number representing a marker
+    *
+    *
+    *
+    **/
+    this.removeMarker = function(markerId) {
+        var marker = this.$frontMarkers[markerId] || this.$backMarkers[markerId];
+        if (!marker)
+            return;
+
+        var markers = marker.inFront ? this.$frontMarkers : this.$backMarkers;
+        if (marker) {
+            delete (markers[markerId]);
+            this._emit(marker.inFront ? "changeFrontMarker" : "changeBackMarker");
+        }
+    };
+
+    /**
+    * Returns an array containing the IDs of all the markers, either front or back.
+    * @param {Boolean} inFront If `true`, indicates you only want front markers; `false` indicates only back markers
+    *
+    * @returns {Array}
+    **/
+    this.getMarkers = function(inFront) {
+        return inFront ? this.$frontMarkers : this.$backMarkers;
+    };
+
+    this.highlight = function(re) {
+        if (!this.$searchHighlight) {
+            var highlight = new SearchHighlight(null, "ace_selected-word", "text");
+            this.$searchHighlight = this.addDynamicMarker(highlight);
+        }
+        this.$searchHighlight.setRegexp(re);
+    }
+
+    // experimental
+    this.highlightLines = function(startRow, endRow, clazz, inFront) {
+        if (typeof endRow != "number") {
+            clazz = endRow;
+            endRow = startRow;
+        }
+        if (!clazz)
+            clazz = "ace_step";
+
+        var range = new Range(startRow, 0, endRow, Infinity);
+        range.id = this.addMarker(range, clazz, "fullLine", inFront);
+        return range;
+    };
+
+    /*
+     * Error:
+     *  {
+     *    row: 12,
+     *    column: 2, //can be undefined
+     *    text: "Missing argument",
+     *    type: "error" // or "warning" or "info"
+     *  }
+     */
+    /**
+    * Sets annotations for the `EditSession`. This functions emits the `'changeAnnotation'` event.
+    * @param {Array} annotations A list of annotations
+    *
+    **/
+    this.setAnnotations = function(annotations) {
+        this.$annotations = annotations;
+        this._emit("changeAnnotation", {});
+    };
+
+    /**
+    * Returns the annotations for the `EditSession`.
+    * @returns {Array}
+    **/
+    this.getAnnotations = function() {
+        return this.$annotations || [];
+    };
+
+    /**
+    * Clears all the annotations for this session. This function also triggers the `'changeAnnotation'` event.
+    **/
+    this.clearAnnotations = function() {
+        this.setAnnotations([]);
+    };
+
+    /**
+    * If `text` contains either the newline (`\n`) or carriage-return ('\r') characters, `$autoNewLine` stores that value.
+    * @param {String} text A block of text
+    *
+    *
+    **/
+    this.$detectNewLine = function(text) {
+        var match = text.match(/^.*?(\r?\n)/m);
+        if (match) {
+            this.$autoNewLine = match[1];
+        } else {
+            this.$autoNewLine = "\n";
+        }
+    };
+
+    /**
+    * Given a starting row and column, this method returns the `Range` of the first word boundary it finds.
+    * @param {Number} row The row to start at
+    * @param {Number} column The column to start at
+    *
+    * @returns {Range}
+    **/
+    this.getWordRange = function(row, column) {
+        var line = this.getLine(row);
+
+        var inToken = false;
+        if (column > 0)
+            inToken = !!line.charAt(column - 1).match(this.tokenRe);
+
+        if (!inToken)
+            inToken = !!line.charAt(column).match(this.tokenRe);
+
+        if (inToken)
+            var re = this.tokenRe;
+        else if (/^\s+$/.test(line.slice(column-1, column+1)))
+            var re = /\s/;
+        else
+            var re = this.nonTokenRe;
+
+        var start = column;
+        if (start > 0) {
+            do {
+                start--;
+            }
+            while (start >= 0 && line.charAt(start).match(re));
+            start++;
+        }
+
+        var end = column;
+        while (end < line.length && line.charAt(end).match(re)) {
+            end++;
+        }
+
+        return new Range(row, start, row, end);
+    };
+
+    /**
+    * Gets the range of a word, including its right whitespace.
+    * @param {Number} row The row number to start from
+    * @param {Number} column The column number to start from
+    *
+    * @return {Range}
+    **/
+    this.getAWordRange = function(row, column) {
+        var wordRange = this.getWordRange(row, column);
+        var line = this.getLine(wordRange.end.row);
+
+        while (line.charAt(wordRange.end.column).match(/[ \t]/)) {
+            wordRange.end.column += 1;
+        }
+        return wordRange;
+    };
+
+    /**
+    * {:Document.setNewLineMode.desc}
+    * @param {String} newLineMode {:Document.setNewLineMode.param}
+    *
+    *
+    * @related Document.setNewLineMode
+    **/
+    this.setNewLineMode = function(newLineMode) {
+        this.doc.setNewLineMode(newLineMode);
+    };
+
+    /**
+    *
+    * Returns the current new line mode.
+    * @returns {String}
+    * @related Document.getNewLineMode
+    **/
+    this.getNewLineMode = function() {
+        return this.doc.getNewLineMode();
+    };
+
+    /**
+    * Identifies if you want to use a worker for the `EditSession`.
+    * @param {Boolean} useWorker Set to `true` to use a worker
+    *
+    **/
+    this.setUseWorker = function(useWorker) { this.setOption("useWorker", useWorker); };
+
+    /**
+    * Returns `true` if workers are being used.
+    **/
+    this.getUseWorker = function() { return this.$useWorker; };
+
+    /**
+    * Reloads all the tokens on the current session. This function calls [[BackgroundTokenizer.start `BackgroundTokenizer.start ()`]] to all the rows; it also emits the `'tokenizerUpdate'` event.
+    **/
+    this.onReloadTokenizer = function(e) {
+        var rows = e.data;
+        this.bgTokenizer.start(rows.first);
+        this._emit("tokenizerUpdate", e);
+    };
+
+    this.$modes = {};
+
+    /**
+    * Sets a new text mode for the `EditSession`. This method also emits the `'changeMode'` event. If a [[BackgroundTokenizer `BackgroundTokenizer`]] is set, the `'tokenizerUpdate'` event is also emitted.
+    * @param {TextMode} mode Set a new text mode
+    * @param {cb} optional callback
+    *
+    **/
+    this.$mode = null;
+    this.$modeId = null;
+    this.setMode = function(mode, cb) {
+        if (mode && typeof mode === "object") {
+            if (mode.getTokenizer)
+                return this.$onChangeMode(mode);
+            var options = mode;
+            var path = options.path;
+        } else {
+            path = mode || "ace/mode/text";
+        }
+
+        // this is needed if ace isn't on require path (e.g tests in node)
+        if (!this.$modes["ace/mode/text"])
+            this.$modes["ace/mode/text"] = new TextMode();
+
+        if (this.$modes[path] && !options) {
+            this.$onChangeMode(this.$modes[path]);
+            cb && cb();
+            return;
+        }
+        // load on demand
+        this.$modeId = path;
+        config.loadModule(["mode", path], function(m) {
+            if (this.$modeId !== path)
+                return cb && cb();
+            if (this.$modes[path] && !options)
+                return this.$onChangeMode(this.$modes[path]);
+            if (m && m.Mode) {
+                m = new m.Mode(options);
+                if (!options) {
+                    this.$modes[path] = m;
+                    m.$id = path;
+                }
+                this.$onChangeMode(m);
+                cb && cb();
+            }
+        }.bind(this));
+
+        // set mode to text until loading is finished
+        if (!this.$mode)
+            this.$onChangeMode(this.$modes["ace/mode/text"], true);
+    };
+
+    this.$onChangeMode = function(mode, $isPlaceholder) {
+        if (!$isPlaceholder)
+            this.$modeId = mode.$id;
+        if (this.$mode === mode) 
+            return;
+
+        this.$mode = mode;
+
+        this.$stopWorker();
+
+        if (this.$useWorker)
+            this.$startWorker();
+
+        var tokenizer = mode.getTokenizer();
+
+        if(tokenizer.addEventListener !== undefined) {
+            var onReloadTokenizer = this.onReloadTokenizer.bind(this);
+            tokenizer.addEventListener("update", onReloadTokenizer);
+        }
+
+        if (!this.bgTokenizer) {
+            this.bgTokenizer = new BackgroundTokenizer(tokenizer);
+            var _self = this;
+            this.bgTokenizer.addEventListener("update", function(e) {
+                _self._emit("tokenizerUpdate", e);
+            });
+        } else {
+            this.bgTokenizer.setTokenizer(tokenizer);
+        }
+
+        this.bgTokenizer.setDocument(this.getDocument());
+
+        this.tokenRe = mode.tokenRe;
+        this.nonTokenRe = mode.nonTokenRe;
+
+        this.$options.wrapMethod.set.call(this, this.$wrapMethod);
+        
+        if (!$isPlaceholder) {
+            this.$setFolding(mode.foldingRules);
+            this._emit("changeMode");
+            this.bgTokenizer.start(0);
+        }
+    };
+
+
+    this.$stopWorker = function() {
+        if (this.$worker)
+            this.$worker.terminate();
+
+        this.$worker = null;
+    };
+
+    this.$startWorker = function() {
+        if (typeof Worker !== "undefined" && !require.noWorker) {
+            try {
+                this.$worker = this.$mode.createWorker(this);
+            } catch (e) {
+                console.log("Could not load worker");
+                console.log(e);
+                this.$worker = null;
+            }
+        }
+        else
+            this.$worker = null;
+    };
+
+    /**
+    * Returns the current text mode.
+    * @returns {TextMode} The current text mode
+    **/
+    this.getMode = function() {
+        return this.$mode;
+    };
+
+    this.$scrollTop = 0;
+    /**
+    * This function sets the scroll top value. It also emits the `'changeScrollTop'` event.
+    * @param {Number} scrollTop The new scroll top value
+    *
+    **/
+    this.setScrollTop = function(scrollTop) {
+        // TODO: should we force integer lineheight instead? scrollTop = Math.round(scrollTop); 
+        if (this.$scrollTop === scrollTop || isNaN(scrollTop))
+            return;
+
+        this.$scrollTop = scrollTop;
+        this._signal("changeScrollTop", scrollTop);
+    };
+
+    /**
+    * [Returns the value of the distance between the top of the editor and the topmost part of the visible content.]{: #EditSession.getScrollTop}
+    * @returns {Number}
+    **/
+    this.getScrollTop = function() {
+        return this.$scrollTop;
+    };
+
+    this.$scrollLeft = 0;
+    /**
+    * [Sets the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.setScrollLeft}
+    **/
+    this.setScrollLeft = function(scrollLeft) {
+        // scrollLeft = Math.round(scrollLeft);
+        if (this.$scrollLeft === scrollLeft || isNaN(scrollLeft))
+            return;
+
+        this.$scrollLeft = scrollLeft;
+        this._signal("changeScrollLeft", scrollLeft);
+    };
+
+    /**
+    * [Returns the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.getScrollLeft}
+    * @returns {Number}
+    **/
+    this.getScrollLeft = function() {
+        return this.$scrollLeft;
+    };
+
+    /**
+    * Returns the width of the screen.
+    * @returns {Number}
+    **/
+    this.getScreenWidth = function() {
+        this.$computeWidth();
+        return this.screenWidth;
+    };
+
+    this.$computeWidth = function(force) {
+        if (this.$modified || force) {
+            this.$modified = false;
+
+            if (this.$useWrapMode)
+                return this.screenWidth = this.$wrapLimit;
+
+            var lines = this.doc.getAllLines();
+            var cache = this.$rowLengthCache;
+            var longestScreenLine = 0;
+            var foldIndex = 0;
+            var foldLine = this.$foldData[foldIndex];
+            var foldStart = foldLine ? foldLine.start.row : Infinity;
+            var len = lines.length;
+
+            for (var i = 0; i < len; i++) {
+                if (i > foldStart) {
+                    i = foldLine.end.row + 1;
+                    if (i >= len)
+                        break;
+                    foldLine = this.$foldData[foldIndex++];
+                    foldStart = foldLine ? foldLine.start.row : Infinity;
+                }
+
+                if (cache[i] == null)
+                    cache[i] = this.$getStringScreenWidth(lines[i])[0];
+
+                if (cache[i] > longestScreenLine)
+                    longestScreenLine = cache[i];
+            }
+            this.screenWidth = longestScreenLine;
+        }
+    };
+
+    /**
+     * Returns a verbatim copy of the given line as it is in the document
+     * @param {Number} row The row to retrieve from
+     *
+    *
+     * @returns {String}
+    *
+    **/
+    this.getLine = function(row) {
+        return this.doc.getLine(row);
+    };
+
+    /**
+     * Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`.
+     * @param {Number} firstRow The first row index to retrieve
+     * @param {Number} lastRow The final row index to retrieve
+     *
+     * @returns {[String]}
+     *
+     **/
+    this.getLines = function(firstRow, lastRow) {
+        return this.doc.getLines(firstRow, lastRow);
+    };
+
+    /**
+     * Returns the number of rows in the document.
+     * @returns {Number}
+     **/
+    this.getLength = function() {
+        return this.doc.getLength();
+    };
+
+    /**
+     * {:Document.getTextRange.desc}
+     * @param {Range} range The range to work with
+     *
+     * @returns {String}
+     **/
+    this.getTextRange = function(range) {
+        return this.doc.getTextRange(range || this.selection.getRange());
+    };
+
+    /**
+     * Inserts a block of `text` and the indicated `position`.
+     * @param {Object} position The position {row, column} to start inserting at
+     * @param {String} text A chunk of text to insert
+     * @returns {Object} The position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
+     *
+     *
+     **/
+    this.insert = function(position, text) {
+        return this.doc.insert(position, text);
+    };
+
+    /**
+     * Removes the `range` from the document.
+     * @param {Range} range A specified Range to remove
+     * @returns {Object} The new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`.
+     *
+     * @related Document.remove
+     *
+     **/
+    this.remove = function(range) {
+        return this.doc.remove(range);
+    };
+
+    /**
+     * Reverts previous changes to your document.
+     * @param {Array} deltas An array of previous changes
+     * @param {Boolean} dontSelect [If `true`, doesn't select the range of where the change occured]{: #dontSelect}
+    *
+     *
+     * @returns {Range}
+    **/
+    this.undoChanges = function(deltas, dontSelect) {
+        if (!deltas.length)
+            return;
+
+        this.$fromUndo = true;
+        var lastUndoRange = null;
+        for (var i = deltas.length - 1; i != -1; i--) {
+            var delta = deltas[i];
+            if (delta.group == "doc") {
+                this.doc.revertDeltas(delta.deltas);
+                lastUndoRange =
+                    this.$getUndoSelection(delta.deltas, true, lastUndoRange);
+            } else {
+                delta.deltas.forEach(function(foldDelta) {
+                    this.addFolds(foldDelta.folds);
+                }, this);
+            }
+        }
+        this.$fromUndo = false;
+        lastUndoRange &&
+            this.$undoSelect &&
+            !dontSelect &&
+            this.selection.setSelectionRange(lastUndoRange);
+        return lastUndoRange;
+    };
+
+    /**
+     * Re-implements a previously undone change to your document.
+     * @param {Array} deltas An array of previous changes
+     * @param {Boolean} dontSelect {:dontSelect}
+     *
+    *
+     * @returns {Range}
+    **/
+    this.redoChanges = function(deltas, dontSelect) {
+        if (!deltas.length)
+            return;
+
+        this.$fromUndo = true;
+        var lastUndoRange = null;
+        for (var i = 0; i < deltas.length; i++) {
+            var delta = deltas[i];
+            if (delta.group == "doc") {
+                this.doc.applyDeltas(delta.deltas);
+                lastUndoRange =
+                    this.$getUndoSelection(delta.deltas, false, lastUndoRange);
+            }
+        }
+        this.$fromUndo = false;
+        lastUndoRange &&
+            this.$undoSelect &&
+            !dontSelect &&
+            this.selection.setSelectionRange(lastUndoRange);
+        return lastUndoRange;
+    };
+
+    /**
+     * Enables or disables highlighting of the range where an undo occured.
+     * @param {Boolean} enable If `true`, selects the range of the reinserted change
+    *
+    **/
+    this.setUndoSelect = function(enable) {
+        this.$undoSelect = enable;
+    };
+
+    this.$getUndoSelection = function(deltas, isUndo, lastUndoRange) {
+        function isInsert(delta) {
+            var insert =
+                delta.action === "insertText" || delta.action === "insertLines";
+            return isUndo ? !insert : insert;
+        }
+
+        var delta = deltas[0];
+        var range, point;
+        var lastDeltaIsInsert = false;
+        if (isInsert(delta)) {
+            range = Range.fromPoints(delta.range.start, delta.range.end);
+            lastDeltaIsInsert = true;
+        } else {
+            range = Range.fromPoints(delta.range.start, delta.range.start);
+            lastDeltaIsInsert = false;
+        }
+
+        for (var i = 1; i < deltas.length; i++) {
+            delta = deltas[i];
+            if (isInsert(delta)) {
+                point = delta.range.start;
+                if (range.compare(point.row, point.column) == -1) {
+                    range.setStart(delta.range.start);
+                }
+                point = delta.range.end;
+                if (range.compare(point.row, point.column) == 1) {
+                    range.setEnd(delta.range.end);
+                }
+                lastDeltaIsInsert = true;
+            } else {
+                point = delta.range.start;
+                if (range.compare(point.row, point.column) == -1) {
+                    range =
+                        Range.fromPoints(delta.range.start, delta.range.start);
+                }
+                lastDeltaIsInsert = false;
+            }
+        }
+
+        // Check if this range and the last undo range has something in common.
+        // If true, merge the ranges.
+        if (lastUndoRange != null) {
+            if (Range.comparePoints(lastUndoRange.start, range.start) == 0) {
+                lastUndoRange.start.column += range.end.column - range.start.column;
+                lastUndoRange.end.column += range.end.column - range.start.column;
+            }
+
+            var cmp = lastUndoRange.compareRange(range);
+            if (cmp == 1) {
+                range.setStart(lastUndoRange.start);
+            } else if (cmp == -1) {
+                range.setEnd(lastUndoRange.end);
+            }
+        }
+
+        return range;
+    };
+
+    /**
+    * Replaces a range in the document with the new `text`.
+    *
+    * @param {Range} range A specified Range to replace
+    * @param {String} text The new text to use as a replacement
+    * @returns {Object} An object containing the final row and column, like this:
+    * ```
+    * {row: endRow, column: 0}
+    * ```
+    * If the text and range are empty, this function returns an object containing the current `range.start` value.
+    * If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value.
+    *
+    *
+    *
+    * @related Document.replace
+    *
+    *
+    **/
+    this.replace = function(range, text) {
+        return this.doc.replace(range, text);
+    };
+
+    /**
+    * Moves a range of text from the given range to the given position. `toPosition` is an object that looks like this:
+     *  ```json
+    *    { row: newRowLocation, column: newColumnLocation }
+     *  ```
+     * @param {Range} fromRange The range of text you want moved within the document
+     * @param {Object} toPosition The location (row and column) where you want to move the text to
+     * @returns {Range} The new range where the text was moved to.
+    *
+    *
+    *
+    **/
+    this.moveText = function(fromRange, toPosition, copy) {
+        var text = this.getTextRange(fromRange);
+        var folds = this.getFoldsInRange(fromRange);
+
+        var toRange = Range.fromPoints(toPosition, toPosition);
+        if (!copy) {
+            this.remove(fromRange);
+            var rowDiff = fromRange.start.row - fromRange.end.row;
+            var collDiff = rowDiff ? -fromRange.end.column : fromRange.start.column - fromRange.end.column;
+            if (collDiff) {
+                if (toRange.start.row == fromRange.end.row && toRange.start.column > fromRange.end.column)
+                    toRange.start.column += collDiff;
+                if (toRange.end.row == fromRange.end.row && toRange.end.column > fromRange.end.column)
+                    toRange.end.column += collDiff;
+            }
+            if (rowDiff && toRange.start.row >= fromRange.end.row) {
+                toRange.start.row += rowDiff;
+                toRange.end.row += rowDiff;
+            }
+        }
+
+        toRange.end = this.insert(toRange.start, text);
+        if (folds.length) {
+            var oldStart = fromRange.start;
+            var newStart = toRange.start;
+            var rowDiff = newStart.row - oldStart.row;
+            var collDiff = newStart.column - oldStart.column;
+            this.addFolds(folds.map(function(x) {
+                x = x.clone();
+                if (x.start.row == oldStart.row)
+                    x.start.column += collDiff;
+                if (x.end.row == oldStart.row)
+                    x.end.column += collDiff;
+                x.start.row += rowDiff;
+                x.end.row += rowDiff;
+                return x;
+            }));
+        }
+
+        return toRange;
+    };
+
+    /**
+    * Indents all the rows, from `startRow` to `endRow` (inclusive), by prefixing each row with the token in `indentString`.
+    *
+    * If `indentString` contains the `'\t'` character, it's replaced by whatever is defined by [[EditSession.getTabString `getTabString()`]].
+    * @param {Number} startRow Starting row
+    * @param {Number} endRow Ending row
+    * @param {String} indentString The indent token
+    *
+    *
+    **/
+    this.indentRows = function(startRow, endRow, indentString) {
+        indentString = indentString.replace(/\t/g, this.getTabString());
+        for (var row=startRow; row<=endRow; row++)
+            this.insert({row: row, column:0}, indentString);
+    };
+
+    /**
+    * Outdents all the rows defined by the `start` and `end` properties of `range`.
+    * @param {Range} range A range of rows
+    *
+    *
+    **/
+    this.outdentRows = function (range) {
+        var rowRange = range.collapseRows();
+        var deleteRange = new Range(0, 0, 0, 0);
+        var size = this.getTabSize();
+
+        for (var i = rowRange.start.row; i <= rowRange.end.row; ++i) {
+            var line = this.getLine(i);
+
+            deleteRange.start.row = i;
+            deleteRange.end.row = i;
+            for (var j = 0; j < size; ++j)
+                if (line.charAt(j) != ' ')
+                    break;
+            if (j < size && line.charAt(j) == '\t') {
+                deleteRange.start.column = j;
+                deleteRange.end.column = j + 1;
+            } else {
+                deleteRange.start.column = 0;
+                deleteRange.end.column = j;
+            }
+            this.remove(deleteRange);
+        }
+    };
+
+    this.$moveLines = function(firstRow, lastRow, dir) {
+        firstRow = this.getRowFoldStart(firstRow);
+        lastRow = this.getRowFoldEnd(lastRow);
+        if (dir < 0) {
+            var row = this.getRowFoldStart(firstRow + dir);
+            if (row < 0) return 0;
+            var diff = row-firstRow;
+        } else if (dir > 0) {
+            var row = this.getRowFoldEnd(lastRow + dir);
+            if (row > this.doc.getLength()-1) return 0;
+            var diff = row-lastRow;
+        } else {
+            firstRow = this.$clipRowToDocument(firstRow);
+            lastRow = this.$clipRowToDocument(lastRow);
+            var diff = lastRow - firstRow + 1;
+        }
+
+        var range = new Range(firstRow, 0, lastRow, Number.MAX_VALUE);
+        var folds = this.getFoldsInRange(range).map(function(x){
+            x = x.clone();
+            x.start.row += diff;
+            x.end.row += diff;
+            return x;
+        });
+
+        var lines = dir == 0
+            ? this.doc.getLines(firstRow, lastRow)
+            : this.doc.removeLines(firstRow, lastRow);
+        this.doc.insertLines(firstRow+diff, lines);
+        folds.length && this.addFolds(folds);
+        return diff;
+    };
+    /**
+    * Shifts all the lines in the document up one, starting from `firstRow` and ending at `lastRow`.
+    * @param {Number} firstRow The starting row to move up
+    * @param {Number} lastRow The final row to move up
+    * @returns {Number} If `firstRow` is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1.
+    *
+    * @related Document.insertLines
+    *
+    **/
+    this.moveLinesUp = function(firstRow, lastRow) {
+        return this.$moveLines(firstRow, lastRow, -1);
+    };
+
+    /**
+    * Shifts all the lines in the document down one, starting from `firstRow` and ending at `lastRow`.
+    * @param {Number} firstRow The starting row to move down
+    * @param {Number} lastRow The final row to move down
+    * @returns {Number} If `firstRow` is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1.
+    *
+    * @related Document.insertLines
+    **/
+    this.moveLinesDown = function(firstRow, lastRow) {
+        return this.$moveLines(firstRow, lastRow, 1);
+    };
+
+    /**
+    * Duplicates all the text between `firstRow` and `lastRow`.
+    * @param {Number} firstRow The starting row to duplicate
+    * @param {Number} lastRow The final row to duplicate
+    * @returns {Number} Returns the number of new rows added; in other words, `lastRow - firstRow + 1`.
+    *
+    *
+    **/
+    this.duplicateLines = function(firstRow, lastRow) {
+        return this.$moveLines(firstRow, lastRow, 0);
+    };
+
+
+    this.$clipRowToDocument = function(row) {
+        return Math.max(0, Math.min(row, this.doc.getLength()-1));
+    };
+
+    this.$clipColumnToRow = function(row, column) {
+        if (column < 0)
+            return 0;
+        return Math.min(this.doc.getLine(row).length, column);
+    };
+
+
+    this.$clipPositionToDocument = function(row, column) {
+        column = Math.max(0, column);
+
+        if (row < 0) {
+            row = 0;
+            column = 0;
+        } else {
+            var len = this.doc.getLength();
+            if (row >= len) {
+                row = len - 1;
+                column = this.doc.getLine(len-1).length;
+            } else {
+                column = Math.min(this.doc.getLine(row).length, column);
+            }
+        }
+
+        return {
+            row: row,
+            column: column
+        };
+    };
+
+    this.$clipRangeToDocument = function(range) {
+        if (range.start.row < 0) {
+            range.start.row = 0;
+            range.start.column = 0;
+        } else {
+            range.start.column = this.$clipColumnToRow(
+                range.start.row,
+                range.start.column
+            );
+        }
+
+        var len = this.doc.getLength() - 1;
+        if (range.end.row > len) {
+            range.end.row = len;
+            range.end.column = this.doc.getLine(len).length;
+        } else {
+            range.end.column = this.$clipColumnToRow(
+                range.end.row,
+                range.end.column
+            );
+        }
+        return range;
+    };
+
+    // WRAPMODE
+    this.$wrapLimit = 80;
+    this.$useWrapMode = false;
+    this.$wrapLimitRange = {
+        min : null,
+        max : null
+    };
+
+    /**
+     * Sets whether or not line wrapping is enabled. If `useWrapMode` is different than the current value, the `'changeWrapMode'` event is emitted.
+     * @param {Boolean} useWrapMode Enable (or disable) wrap mode
+     *
+    *
+    **/
+    this.setUseWrapMode = function(useWrapMode) {
+        if (useWrapMode != this.$useWrapMode) {
+            this.$useWrapMode = useWrapMode;
+            this.$modified = true;
+            this.$resetRowCache(0);
+
+            // If wrapMode is activaed, the wrapData array has to be initialized.
+            if (useWrapMode) {
+                var len = this.getLength();
+                this.$wrapData = [];
+                for (var i = 0; i < len; i++) {
+                    this.$wrapData.push([]);
+                }
+                this.$updateWrapData(0, len - 1);
+            }
+
+            this._emit("changeWrapMode");
+        }
+    };
+
+    /**
+    * Returns `true` if wrap mode is being used; `false` otherwise.
+    * @returns {Boolean}
+    **/
+    this.getUseWrapMode = function() {
+        return this.$useWrapMode;
+    };
+
+    // Allow the wrap limit to move freely between min and max. Either
+    // parameter can be null to allow the wrap limit to be unconstrained
+    // in that direction. Or set both parameters to the same number to pin
+    // the limit to that value.
+    /**
+     * Sets the boundaries of wrap. Either value can be `null` to have an unconstrained wrap, or, they can be the same number to pin the limit. If the wrap limits for `min` or `max` are different, this method also emits the `'changeWrapMode'` event.
+     * @param {Number} min The minimum wrap value (the left side wrap)
+     * @param {Number} max The maximum wrap value (the right side wrap)
+     *
+    *
+    **/
+    this.setWrapLimitRange = function(min, max) {
+        if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {
+            this.$wrapLimitRange = {
+                min: min,
+                max: max
+            };
+            this.$modified = true;
+            // This will force a recalculation of the wrap limit
+            this._emit("changeWrapMode");
+        }
+    };
+
+    /**
+    * This should generally only be called by the renderer when a resize is detected.
+    * @param {Number} desiredLimit The new wrap limit
+    * @returns {Boolean}
+    *
+    * @private
+    **/
+    this.adjustWrapLimit = function(desiredLimit, $printMargin) {
+        var limits = this.$wrapLimitRange
+        if (limits.max < 0)
+            limits = {min: $printMargin, max: $printMargin};
+        var wrapLimit = this.$constrainWrapLimit(desiredLimit, limits.min, limits.max);
+        if (wrapLimit != this.$wrapLimit && wrapLimit > 1) {
+            this.$wrapLimit = wrapLimit;
+            this.$modified = true;
+            if (this.$useWrapMode) {
+                this.$updateWrapData(0, this.getLength() - 1);
+                this.$resetRowCache(0);
+                this._emit("changeWrapLimit");
+            }
+            return true;
+        }
+        return false;
+    };
+
+    this.$constrainWrapLimit = function(wrapLimit, min, max) {
+        if (min)
+            wrapLimit = Math.max(min, wrapLimit);
+
+        if (max)
+            wrapLimit = Math.min(max, wrapLimit);
+
+        return wrapLimit;
+    };
+
+    /**
+    * Returns the value of wrap limit.
+    * @returns {Number} The wrap limit.
+    **/
+    this.getWrapLimit = function() {
+        return this.$wrapLimit;
+    };
+    
+    /**
+     * Sets the line length for soft wrap in the editor. Lines will break
+     *  at a minimum of the given length minus 20 chars and at a maximum
+     *  of the given number of chars.
+     * @param {number} limit The maximum line length in chars, for soft wrapping lines.
+     */
+    this.setWrapLimit = function (limit) {
+        this.setWrapLimitRange(limit, limit);
+    };
+    
+    /**
+    * Returns an object that defines the minimum and maximum of the wrap limit; it looks something like this:
+    *
+    *     { min: wrapLimitRange_min, max: wrapLimitRange_max }
+    *
+    * @returns {Object}
+    **/
+    this.getWrapLimitRange = function() {
+        // Avoid unexpected mutation by returning a copy
+        return {
+            min : this.$wrapLimitRange.min,
+            max : this.$wrapLimitRange.max
+        };
+    };
+
+    this.$updateInternalDataOnChange = function(e) {
+        var useWrapMode = this.$useWrapMode;
+        var len;
+        var action = e.data.action;
+        var firstRow = e.data.range.start.row;
+        var lastRow = e.data.range.end.row;
+        var start = e.data.range.start;
+        var end = e.data.range.end;
+        var removedFolds = null;
+
+        if (action.indexOf("Lines") != -1) {
+            if (action == "insertLines") {
+                lastRow = firstRow + (e.data.lines.length);
+            } else {
+                lastRow = firstRow;
+            }
+            len = e.data.lines ? e.data.lines.length : lastRow - firstRow;
+        } else {
+            len = lastRow - firstRow;
+        }
+
+        this.$updating = true;
+        if (len != 0) {
+            if (action.indexOf("remove") != -1) {
+                this[useWrapMode ? "$wrapData" : "$rowLengthCache"].splice(firstRow, len);
+
+                var foldLines = this.$foldData;
+                removedFolds = this.getFoldsInRange(e.data.range);
+                this.removeFolds(removedFolds);
+
+                var foldLine = this.getFoldLine(end.row);
+                var idx = 0;
+                if (foldLine) {
+                    foldLine.addRemoveChars(end.row, end.column, start.column - end.column);
+                    foldLine.shiftRow(-len);
+
+                    var foldLineBefore = this.getFoldLine(firstRow);
+                    if (foldLineBefore && foldLineBefore !== foldLine) {
+                        foldLineBefore.merge(foldLine);
+                        foldLine = foldLineBefore;
+                    }
+                    idx = foldLines.indexOf(foldLine) + 1;
+                }
+
+                for (idx; idx < foldLines.length; idx++) {
+                    var foldLine = foldLines[idx];
+                    if (foldLine.start.row >= end.row) {
+                        foldLine.shiftRow(-len);
+                    }
+                }
+
+                lastRow = firstRow;
+            } else {
+                var args;
+                if (useWrapMode) {
+                    args = [firstRow, 0];
+                    for (var i = 0; i < len; i++) args.push([]);
+                    this.$wrapData.splice.apply(this.$wrapData, args);
+                } else {
+                    args = Array(len);
+                    args.unshift(firstRow, 0);
+                    this.$rowLengthCache.splice.apply(this.$rowLengthCache, args);
+                }
+
+                // If some new line is added inside of a foldLine, then split
+                // the fold line up.
+                var foldLines = this.$foldData;
+                var foldLine = this.getFoldLine(firstRow);
+                var idx = 0;
+                if (foldLine) {
+                    var cmp = foldLine.range.compareInside(start.row, start.column)
+                    // Inside of the foldLine range. Need to split stuff up.
+                    if (cmp == 0) {
+                        foldLine = foldLine.split(start.row, start.column);
+                        foldLine.shiftRow(len);
+                        foldLine.addRemoveChars(
+                            lastRow, 0, end.column - start.column);
+                    } else
+                    // Infront of the foldLine but same row. Need to shift column.
+                    if (cmp == -1) {
+                        foldLine.addRemoveChars(firstRow, 0, end.column - start.column);
+                        foldLine.shiftRow(len);
+                    }
+                    // Nothing to do if the insert is after the foldLine.
+                    idx = foldLines.indexOf(foldLine) + 1;
+                }
+
+                for (idx; idx < foldLines.length; idx++) {
+                    var foldLine = foldLines[idx];
+                    if (foldLine.start.row >= firstRow) {
+                        foldLine.shiftRow(len);
+                    }
+                }
+            }
+        } else {
+            // Realign folds. E.g. if you add some new chars before a fold, the
+            // fold should "move" to the right.
+            len = Math.abs(e.data.range.start.column - e.data.range.end.column);
+            if (action.indexOf("remove") != -1) {
+                // Get all the folds in the change range and remove them.
+                removedFolds = this.getFoldsInRange(e.data.range);
+                this.removeFolds(removedFolds);
+
+                len = -len;
+            }
+            var foldLine = this.getFoldLine(firstRow);
+            if (foldLine) {
+                foldLine.addRemoveChars(firstRow, start.column, len);
+            }
+        }
+
+        if (useWrapMode && this.$wrapData.length != this.doc.getLength()) {
+            console.error("doc.getLength() and $wrapData.length have to be the same!");
+        }
+        this.$updating = false;
+
+        if (useWrapMode)
+            this.$updateWrapData(firstRow, lastRow);
+        else
+            this.$updateRowLengthCache(firstRow, lastRow);
+
+        return removedFolds;
+    };
+
+    this.$updateRowLengthCache = function(firstRow, lastRow, b) {
+        this.$rowLengthCache[firstRow] = null;
+        this.$rowLengthCache[lastRow] = null;
+    };
+
+    this.$updateWrapData = function(firstRow, lastRow) {
+        var lines = this.doc.getAllLines();
+        var tabSize = this.getTabSize();
+        var wrapData = this.$wrapData;
+        var wrapLimit = this.$wrapLimit;
+        var tokens;
+        var foldLine;
+
+        var row = firstRow;
+        lastRow = Math.min(lastRow, lines.length - 1);
+        while (row <= lastRow) {
+            foldLine = this.getFoldLine(row, foldLine);
+            if (!foldLine) {
+                tokens = this.$getDisplayTokens(lines[row]);
+                wrapData[row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize);
+                row ++;
+            } else {
+                tokens = [];
+                foldLine.walk(function(placeholder, row, column, lastColumn) {
+                        var walkTokens;
+                        if (placeholder != null) {
+                            walkTokens = this.$getDisplayTokens(
+                                            placeholder, tokens.length);
+                            walkTokens[0] = PLACEHOLDER_START;
+                            for (var i = 1; i < walkTokens.length; i++) {
+                                walkTokens[i] = PLACEHOLDER_BODY;
+                            }
+                        } else {
+                            walkTokens = this.$getDisplayTokens(
+                                lines[row].substring(lastColumn, column),
+                                tokens.length);
+                        }
+                        tokens = tokens.concat(walkTokens);
+                    }.bind(this),
+                    foldLine.end.row,
+                    lines[foldLine.end.row].length + 1
+                );
+
+                wrapData[foldLine.start.row]
+                    = this.$computeWrapSplits(tokens, wrapLimit, tabSize);
+                row = foldLine.end.row + 1;
+            }
+        }
+    };
+
+    // "Tokens"
+    var CHAR = 1,
+        CHAR_EXT = 2,
+        PLACEHOLDER_START = 3,
+        PLACEHOLDER_BODY =  4,
+        PUNCTUATION = 9,
+        SPACE = 10,
+        TAB = 11,
+        TAB_SPACE = 12;
+
+
+    this.$computeWrapSplits = function(tokens, wrapLimit) {
+        if (tokens.length == 0) {
+            return [];
+        }
+
+        var splits = [];
+        var displayLength = tokens.length;
+        var lastSplit = 0, lastDocSplit = 0;
+
+        var isCode = this.$wrapAsCode;
+
+        function addSplit(screenPos) {
+            var displayed = tokens.slice(lastSplit, screenPos);
+
+            // The document size is the current size - the extra width for tabs
+            // and multipleWidth characters.
+            var len = displayed.length;
+            displayed.join("").
+                // Get all the TAB_SPACEs.
+                replace(/12/g, function() {
+                    len -= 1;
+                }).
+                // Get all the CHAR_EXT/multipleWidth characters.
+                replace(/2/g, function() {
+                    len -= 1;
+                });
+
+            lastDocSplit += len;
+            splits.push(lastDocSplit);
+            lastSplit = screenPos;
+        }
+
+        while (displayLength - lastSplit > wrapLimit) {
+            // This is, where the split should be.
+            var split = lastSplit + wrapLimit;
+
+            // If there is a space or tab at this split position, then making
+            // a split is simple.
+            if (tokens[split - 1] >= SPACE && tokens[split] >= SPACE) {
+                /* disabled see https://github.com/ajaxorg/ace/issues/1186
+                // Include all following spaces + tabs in this split as well.
+                while (tokens[split] >= SPACE) {
+                    split ++;
+                } */
+                addSplit(split);
+                continue;
+            }
+
+            // === ELSE ===
+            // Check if split is inside of a placeholder. Placeholder are
+            // not splitable. Therefore, seek the beginning of the placeholder
+            // and try to place the split beofre the placeholder's start.
+            if (tokens[split] == PLACEHOLDER_START || tokens[split] == PLACEHOLDER_BODY) {
+                // Seek the start of the placeholder and do the split
+                // before the placeholder. By definition there always
+                // a PLACEHOLDER_START between split and lastSplit.
+                for (split; split != lastSplit - 1; split--) {
+                    if (tokens[split] == PLACEHOLDER_START) {
+                        // split++; << No incremental here as we want to
+                        //  have the position before the Placeholder.
+                        break;
+                    }
+                }
+
+                // If the PLACEHOLDER_START is not the index of the
+                // last split, then we can do the split
+                if (split > lastSplit) {
+                    addSplit(split);
+                    continue;
+                }
+
+                // If the PLACEHOLDER_START IS the index of the last
+                // split, then we have to place the split after the
+                // placeholder. So, let's seek for the end of the placeholder.
+                split = lastSplit + wrapLimit;
+                for (split; split < tokens.length; split++) {
+                    if (tokens[split] != PLACEHOLDER_BODY) {
+                        break;
+                    }
+                }
+
+                // If spilt == tokens.length, then the placeholder is the last
+                // thing in the line and adding a new split doesn't make sense.
+                if (split == tokens.length) {
+                    break;  // Breaks the while-loop.
+                }
+
+                // Finally, add the split...
+                addSplit(split);
+                continue;
+            }
+
+            // === ELSE ===
+            // Search for the first non space/tab/placeholder/punctuation token backwards.
+            var minSplit = Math.max(split - (isCode ? 10 : wrapLimit-(wrapLimit>>2)), lastSplit - 1);
+            while (split > minSplit && tokens[split] < PLACEHOLDER_START) {
+                split --;
+            }
+            if (isCode) {
+                while (split > minSplit && tokens[split] < PLACEHOLDER_START) {
+                    split --;
+                }
+                while (split > minSplit && tokens[split] == PUNCTUATION) {
+                    split --;
+                }
+            } else {
+                while (split > minSplit && tokens[split] < SPACE) {
+                    split --;
+                }
+            }
+            // If we found one, then add the split.
+            if (split > minSplit) {
+                addSplit(++split);
+                continue;
+            }
+
+            // === ELSE ===
+            split = lastSplit + wrapLimit;
+            // The split is inside of a CHAR or CHAR_EXT token and no space
+            // around -> force a split.
+            addSplit(split);
+        }
+        return splits;
+    };
+
+    /**
+    * Given a string, returns an array of the display characters, including tabs and spaces.
+    * @param {String} str The string to check
+    * @param {Number} offset The value to start at
+    *
+    *
+    **/
+    this.$getDisplayTokens = function(str, offset) {
+        var arr = [];
+        var tabSize;
+        offset = offset || 0;
+
+        for (var i = 0; i < str.length; i++) {
+            var c = str.charCodeAt(i);
+            // Tab
+            if (c == 9) {
+                tabSize = this.getScreenTabSize(arr.length + offset);
+                arr.push(TAB);
+                for (var n = 1; n < tabSize; n++) {
+                    arr.push(TAB_SPACE);
+                }
+            }
+            // Space
+            else if (c == 32) {
+                arr.push(SPACE);
+            } else if((c > 39 && c < 48) || (c > 57 && c < 64)) {
+                arr.push(PUNCTUATION);
+            }
+            // full width characters
+            else if (c >= 0x1100 && isFullWidth(c)) {
+                arr.push(CHAR, CHAR_EXT);
+            } else {
+                arr.push(CHAR);
+            }
+        }
+        return arr;
+    };
+
+    /**
+     * Calculates the width of the string `str` on the screen while assuming that the string starts at the first column on the screen.
+    * @param {String} str The string to calculate the screen width of
+    * @param {Number} maxScreenColumn
+    * @param {Number} screenColumn
+    * @returns {[Number]} Returns an `int[]` array with two elements:<br/>
+    * The first position indicates the number of columns for `str` on screen.<br/>
+    * The second value contains the position of the document column that this function read until.
+    *
+    *
+    *
+    *
+    **/
+    this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {
+        if (maxScreenColumn == 0)
+            return [0, 0];
+        if (maxScreenColumn == null)
+            maxScreenColumn = Infinity;
+        screenColumn = screenColumn || 0;
+
+        var c, column;
+        for (column = 0; column < str.length; column++) {
+            c = str.charCodeAt(column);
+            // tab
+            if (c == 9) {
+                screenColumn += this.getScreenTabSize(screenColumn);
+            }
+            // full width characters
+            else if (c >= 0x1100 && isFullWidth(c)) {
+                screenColumn += 2;
+            } else {
+                screenColumn += 1;
+            }
+            if (screenColumn > maxScreenColumn) {
+                break;
+            }
+        }
+
+        return [screenColumn, column];
+    };
+
+    /**
+    * Returns number of screenrows in a wrapped line.
+    * @param {Number} row The row number to check
+    *
+    * @returns {Number}
+    **/
+    this.getRowLength = function(row) {
+        if (!this.$useWrapMode || !this.$wrapData[row]) {
+            return 1;
+        } else {
+            return this.$wrapData[row].length + 1;
+        }
+    };
+
+    /**
+     * Returns the position (on screen) for the last character in the provided screen row.
+     * @param {Number} screenRow The screen row to check
+     * @returns {Number}
+     *
+     * @related EditSession.documentToScreenColumn
+    **/
+    this.getScreenLastRowColumn = function(screenRow) {
+        var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE);
+        return this.documentToScreenColumn(pos.row, pos.column);
+    };
+
+    /**
+    * For the given document row and column, this returns the column position of the last screen row.
+    * @param {Number} docRow
+    *
+    * @param {Number} docColumn
+    **/
+    this.getDocumentLastRowColumn = function(docRow, docColumn) {
+        var screenRow = this.documentToScreenRow(docRow, docColumn);
+        return this.getScreenLastRowColumn(screenRow);
+    };
+
+    /**
+    * For the given document row and column, this returns the document position of the last row.
+    * @param {Number} docRow
+    * @param {Number} docColumn
+    *
+    *
+    **/
+    this.getDocumentLastRowColumnPosition = function(docRow, docColumn) {
+        var screenRow = this.documentToScreenRow(docRow, docColumn);
+        return this.screenToDocumentPosition(screenRow, Number.MAX_VALUE / 10);
+    };
+
+    /**
+    * For the given row, this returns the split data.
+    * @returns {String}
+    **/
+    this.getRowSplitData = function(row) {
+        if (!this.$useWrapMode) {
+            return undefined;
+        } else {
+            return this.$wrapData[row];
+        }
+    };
+
+    /**
+    * The distance to the next tab stop at the specified screen column.
+    * @param {Number} screenColumn The screen column to check
+    *
+    *
+    * @returns {Number}
+    **/
+    this.getScreenTabSize = function(screenColumn) {
+        return this.$tabSize - screenColumn % this.$tabSize;
+    };
+
+
+    this.screenToDocumentRow = function(screenRow, screenColumn) {
+        return this.screenToDocumentPosition(screenRow, screenColumn).row;
+    };
+
+
+    this.screenToDocumentColumn = function(screenRow, screenColumn) {
+        return this.screenToDocumentPosition(screenRow, screenColumn).column;
+    };
+
+    /**
+    * Converts characters coordinates on the screen to characters coordinates within the document. [This takes into account code folding, word wrap, tab size, and any other visual modifications.]{: #conversionConsiderations}
+    * @param {Number} screenRow The screen row to check
+    * @param {Number} screenColumn The screen column to check
+    * @returns {Object} The object returned has two properties: `row` and `column`.
+    *
+    *
+    * @related EditSession.documentToScreenPosition
+    *
+    **/
+    this.screenToDocumentPosition = function(screenRow, screenColumn) {
+        if (screenRow < 0)
+            return {row: 0, column: 0};
+
+        var line;
+        var docRow = 0;
+        var docColumn = 0;
+        var column;
+        var row = 0;
+        var rowLength = 0;
+
+        var rowCache = this.$screenRowCache;
+        var i = this.$getRowCacheIndex(rowCache, screenRow);
+        var l = rowCache.length;
+        if (l && i >= 0) {
+            var row = rowCache[i];
+            var docRow = this.$docRowCache[i];
+            var doCache = screenRow > rowCache[l - 1];
+        } else {
+            var doCache = !l;
+        }
+
+        var maxRow = this.getLength() - 1;
+        var foldLine = this.getNextFoldLine(docRow);
+        var foldStart = foldLine ? foldLine.start.row : Infinity;
+
+        while (row <= screenRow) {
+            rowLength = this.getRowLength(docRow);
+            if (row + rowLength - 1 >= screenRow || docRow >= maxRow) {
+                break;
+            } else {
+                row += rowLength;
+                docRow++;
+                if (docRow > foldStart) {
+                    docRow = foldLine.end.row+1;
+                    foldLine = this.getNextFoldLine(docRow, foldLine);
+                    foldStart = foldLine ? foldLine.start.row : Infinity;
+                }
+            }
+
+            if (doCache) {
+                this.$docRowCache.push(docRow);
+                this.$screenRowCache.push(row);
+            }
+        }
+
+        if (foldLine && foldLine.start.row <= docRow) {
+            line = this.getFoldDisplayLine(foldLine);
+            docRow = foldLine.start.row;
+        } else if (row + rowLength <= screenRow || docRow > maxRow) {
+            // clip at the end of the document
+            return {
+                row: maxRow,
+                column: this.getLine(maxRow).length
+            }
+        } else {
+            line = this.getLine(docRow);
+            foldLine = null;
+        }
+
+        if (this.$useWrapMode) {
+            var splits = this.$wrapData[docRow];
+            if (splits) {
+                column = splits[screenRow - row];
+                if(screenRow > row && splits.length) {
+                    docColumn = splits[screenRow - row - 1] || splits[splits.length - 1];
+                    line = line.substring(docColumn);
+                }
+            }
+        }
+
+        docColumn += this.$getStringScreenWidth(line, screenColumn)[1];
+
+        // We remove one character at the end so that the docColumn
+        // position returned is not associated to the next row on the screen.
+        if (this.$useWrapMode && docColumn >= column)
+            docColumn = column - 1;
+
+        if (foldLine)
+            return foldLine.idxToPosition(docColumn);
+
+        return {row: docRow, column: docColumn};
+    };
+
+    /**
+    * Converts document coordinates to screen coordinates. {:conversionConsiderations}
+    * @param {Number} docRow The document row to check
+    * @param {Number} docColumn The document column to check
+    * @returns {Object} The object returned by this method has two properties: `row` and `column`.
+    *
+    *
+    * @related EditSession.screenToDocumentPosition
+    *
+    **/
+    this.documentToScreenPosition = function(docRow, docColumn) {
+        // Normalize the passed in arguments.
+        if (typeof docColumn === "undefined")
+            var pos = this.$clipPositionToDocument(docRow.row, docRow.column);
+        else
+            pos = this.$clipPositionToDocument(docRow, docColumn);
+
+        docRow = pos.row;
+        docColumn = pos.column;
+
+        var screenRow = 0;
+        var foldStartRow = null;
+        var fold = null;
+
+        // Clamp the docRow position in case it's inside of a folded block.
+        fold = this.getFoldAt(docRow, docColumn, 1);
+        if (fold) {
+            docRow = fold.start.row;
+            docColumn = fold.start.column;
+        }
+
+        var rowEnd, row = 0;
+
+
+        var rowCache = this.$docRowCache;
+        var i = this.$getRowCacheIndex(rowCache, docRow);
+        var l = rowCache.length;
+        if (l && i >= 0) {
+            var row = rowCache[i];
+            var screenRow = this.$screenRowCache[i];
+            var doCache = docRow > rowCache[l - 1];
+        } else {
+            var doCache = !l;
+        }
+
+        var foldLine = this.getNextFoldLine(row);
+        var foldStart = foldLine ?foldLine.start.row :Infinity;
+
+        while (row < docRow) {
+            if (row >= foldStart) {
+                rowEnd = foldLine.end.row + 1;
+                if (rowEnd > docRow)
+                    break;
+                foldLine = this.getNextFoldLine(rowEnd, foldLine);
+                foldStart = foldLine ?foldLine.start.row :Infinity;
+            }
+            else {
+                rowEnd = row + 1;
+            }
+
+            screenRow += this.getRowLength(row);
+            row = rowEnd;
+
+            if (doCache) {
+                this.$docRowCache.push(row);
+                this.$screenRowCache.push(screenRow);
+            }
+        }
+
+        // Calculate the text line that is displayed in docRow on the screen.
+        var textLine = "";
+        // Check if the final row we want to reach is inside of a fold.
+        if (foldLine && row >= foldStart) {
+            textLine = this.getFoldDisplayLine(foldLine, docRow, docColumn);
+            foldStartRow = foldLine.start.row;
+        } else {
+            textLine = this.getLine(docRow).substring(0, docColumn);
+            foldStartRow = docRow;
+        }
+        // Clamp textLine if in wrapMode.
+        if (this.$useWrapMode) {
+            var wrapRow = this.$wrapData[foldStartRow];
+            var screenRowOffset = 0;
+            while (textLine.length >= wrapRow[screenRowOffset]) {
+                screenRow ++;
+                screenRowOffset++;
+            }
+            textLine = textLine.substring(
+                wrapRow[screenRowOffset - 1] || 0, textLine.length
+            );
+        }
+
+        return {
+            row: screenRow,
+            column: this.$getStringScreenWidth(textLine)[0]
+        };
+    };
+
+    /**
+    * For the given document row and column, returns the screen column.
+    * @param {Number} row
+    * @param {Number} docColumn
+    * @returns {Number}
+    *
+    **/
+    this.documentToScreenColumn = function(row, docColumn) {
+        return this.documentToScreenPosition(row, docColumn).column;
+    };
+
+    /**
+    * For the given document row and column, returns the screen row.
+    * @param {Number} docRow
+    * @param {Number} docColumn
+    *
+    *
+    **/
+    this.documentToScreenRow = function(docRow, docColumn) {
+        return this.documentToScreenPosition(docRow, docColumn).row;
+    };
+
+    /**
+    * Returns the length of the screen.
+    * @returns {Number}
+    **/
+    this.getScreenLength = function() {
+        var screenRows = 0;
+        var fold = null;
+        if (!this.$useWrapMode) {
+            screenRows = this.getLength();
+
+            // Remove the folded lines again.
+            var foldData = this.$foldData;
+            for (var i = 0; i < foldData.length; i++) {
+                fold = foldData[i];
+                screenRows -= fold.end.row - fold.start.row;
+            }
+        } else {
+            var lastRow = this.$wrapData.length;
+            var row = 0, i = 0;
+            var fold = this.$foldData[i++];
+            var foldStart = fold ? fold.start.row :Infinity;
+
+            while (row < lastRow) {
+                screenRows += this.$wrapData[row].length + 1;
+                row ++;
+                if (row > foldStart) {
+                    row = fold.end.row+1;
+                    fold = this.$foldData[i++];
+                    foldStart = fold ?fold.start.row :Infinity;
+                }
+            }
+        }
+
+        return screenRows;
+    };
+
+    // For every keystroke this gets called once per char in the whole doc!!
+    // Wouldn't hurt to make it a bit faster for c >= 0x1100
+
+    /**
+     * @private
+     *
+     */
+    function isFullWidth(c) {
+        if (c < 0x1100)
+            return false;
+        return c >= 0x1100 && c <= 0x115F ||
+               c >= 0x11A3 && c <= 0x11A7 ||
+               c >= 0x11FA && c <= 0x11FF ||
+               c >= 0x2329 && c <= 0x232A ||
+               c >= 0x2E80 && c <= 0x2E99 ||
+               c >= 0x2E9B && c <= 0x2EF3 ||
+               c >= 0x2F00 && c <= 0x2FD5 ||
+               c >= 0x2FF0 && c <= 0x2FFB ||
+               c >= 0x3000 && c <= 0x303E ||
+               c >= 0x3041 && c <= 0x3096 ||
+               c >= 0x3099 && c <= 0x30FF ||
+               c >= 0x3105 && c <= 0x312D ||
+               c >= 0x3131 && c <= 0x318E ||
+               c >= 0x3190 && c <= 0x31BA ||
+               c >= 0x31C0 && c <= 0x31E3 ||
+               c >= 0x31F0 && c <= 0x321E ||
+               c >= 0x3220 && c <= 0x3247 ||
+               c >= 0x3250 && c <= 0x32FE ||
+               c >= 0x3300 && c <= 0x4DBF ||
+               c >= 0x4E00 && c <= 0xA48C ||
+               c >= 0xA490 && c <= 0xA4C6 ||
+               c >= 0xA960 && c <= 0xA97C ||
+               c >= 0xAC00 && c <= 0xD7A3 ||
+               c >= 0xD7B0 && c <= 0xD7C6 ||
+               c >= 0xD7CB && c <= 0xD7FB ||
+               c >= 0xF900 && c <= 0xFAFF ||
+               c >= 0xFE10 && c <= 0xFE19 ||
+               c >= 0xFE30 && c <= 0xFE52 ||
+               c >= 0xFE54 && c <= 0xFE66 ||
+               c >= 0xFE68 && c <= 0xFE6B ||
+               c >= 0xFF01 && c <= 0xFF60 ||
+               c >= 0xFFE0 && c <= 0xFFE6;
+    };
+
+}).call(EditSession.prototype);
+
+require("./edit_session/folding").Folding.call(EditSession.prototype);
+require("./edit_session/bracket_match").BracketMatch.call(EditSession.prototype);
+
+
+config.defineOptions(EditSession.prototype, "session", {
+    wrap: {
+        set: function(value) {
+            if (!value || value == "off")
+                value = false;
+            else if (value == "free")
+                value = true;
+            else if (value == "printMargin")
+                value = -1;
+            else if (typeof value == "string")
+                value = parseInt(value, 10) || false;
+
+            if (this.$wrap == value)
+                return;
+            if (!value) {
+                this.setUseWrapMode(false);
+            } else {
+                var col = typeof value == "number" ? value : null;
+                this.setWrapLimitRange(col, col);
+                this.setUseWrapMode(true);
+            }
+            this.$wrap = value;
+        },
+        get: function() {
+            return this.getUseWrapMode() ? this.getWrapLimitRange().min || "free" : "off";
+        },
+        handlesSet: true
+    },    
+    wrapMethod: {
+        // code|text|auto
+        set: function(val) {
+            if (val == "auto")
+                this.$wrapAsCode = this.$mode.type != "text";
+            else
+                this.$wrapAsCode = val != "text";
+        },
+        initialValue: "auto"
+    },
+    firstLineNumber: {
+        set: function() {this._emit("changeBreakpoint");},
+        initialValue: 1
+    },
+    useWorker: {
+        set: function(useWorker) {
+            this.$useWorker = useWorker;
+
+            this.$stopWorker();
+            if (useWorker)
+                this.$startWorker();
+        },
+        initialValue: true
+    },
+    useSoftTabs: {initialValue: true},
+    tabSize: {
+        set: function(tabSize) {
+            if (isNaN(tabSize) || this.$tabSize === tabSize) return;
+
+            this.$modified = true;
+            this.$rowLengthCache = [];
+            this.$tabSize = tabSize;
+            this._emit("changeTabSize");
+        },
+        initialValue: 4,
+        handlesSet: true
+    },
+    overwrite: {
+        set: function(val) {this._emit("changeOverwrite");},
+        initialValue: false
+    },
+    newLineMode: {
+        set: function(val) {this.doc.setNewLineMode(val)},
+        get: function() {return this.doc.getNewLineMode()},
+        handlesSet: true
+    }
+});
+
+exports.EditSession = EditSession;
+});


[45/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/editor.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/editor.js b/src/fauxton/assets/js/libs/ace/editor.js
new file mode 100644
index 0000000..4ff568c
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/editor.js
@@ -0,0 +1,2423 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+require("./lib/fixoldbrowsers");
+
+var oop = require("./lib/oop");
+var dom = require("./lib/dom");
+var lang = require("./lib/lang");
+var useragent = require("./lib/useragent");
+var TextInput = require("./keyboard/textinput").TextInput;
+var MouseHandler = require("./mouse/mouse_handler").MouseHandler;
+var FoldHandler = require("./mouse/fold_handler").FoldHandler;
+var KeyBinding = require("./keyboard/keybinding").KeyBinding;
+var EditSession = require("./edit_session").EditSession;
+var Search = require("./search").Search;
+var Range = require("./range").Range;
+var EventEmitter = require("./lib/event_emitter").EventEmitter;
+var CommandManager = require("./commands/command_manager").CommandManager;
+var defaultCommands = require("./commands/default_commands").commands;
+var config = require("./config");
+
+/**
+ * The main entry point into the Ace functionality.
+ *
+ * The `Editor` manages the [[EditSession]] (which manages [[Document]]s), as well as the [[VirtualRenderer]], which draws everything to the screen.
+ *
+ * Event sessions dealing with the mouse and keyboard are bubbled up from `Document` to the `Editor`, which decides what to do with them.
+ * @class Editor
+ **/
+
+/**
+ * Creates a new `Editor` object.
+ *
+ * @param {VirtualRenderer} renderer Associated `VirtualRenderer` that draws everything
+ * @param {EditSession} session The `EditSession` to refer to
+ *
+ *
+ * @constructor
+ **/
+var Editor = function(renderer, session) {
+    var container = renderer.getContainerElement();
+    this.container = container;
+    this.renderer = renderer;
+
+    this.commands = new CommandManager(useragent.isMac ? "mac" : "win", defaultCommands);
+    this.textInput  = new TextInput(renderer.getTextAreaContainer(), this);
+    this.renderer.textarea = this.textInput.getElement();
+    this.keyBinding = new KeyBinding(this);
+
+    // TODO detect touch event support
+    this.$mouseHandler = new MouseHandler(this);
+    new FoldHandler(this);
+
+    this.$blockScrolling = 0;
+    this.$search = new Search().set({
+        wrap: true
+    });
+
+    this.$historyTracker = this.$historyTracker.bind(this);
+    this.commands.on("exec", this.$historyTracker);
+
+    this.$initOperationListeners();
+    
+    this._$emitInputEvent = lang.delayedCall(function() {
+        this._signal("input", {});
+        this.session.bgTokenizer && this.session.bgTokenizer.scheduleStart();
+    }.bind(this));
+    
+    this.on("change", function(_, _self) {
+        _self._$emitInputEvent.schedule(31);
+    });
+
+    this.setSession(session || new EditSession(""));
+    config.resetOptions(this);
+    config._emit("editor", this);
+};
+
+(function(){
+
+    oop.implement(this, EventEmitter);
+
+    this.$initOperationListeners = function() {
+        function last(a) {return a[a.length - 1]};
+
+        this.selections = [];
+        this.commands.on("exec", function(e) {
+            this.startOperation(e);
+
+            var command = e.command;
+            if (command.group == "fileJump") {
+                var prev = this.prevOp;
+                if (!prev || prev.command.group != "fileJump") {
+                    this.lastFileJumpPos = last(this.selections)
+                }
+            } else {
+                this.lastFileJumpPos = null;
+            }
+        }.bind(this), true);
+
+        this.commands.on("afterExec", function(e) {
+            var command = e.command;
+
+            if (command.group == "fileJump") {
+                if (this.lastFileJumpPos && !this.curOp.selectionChanged) {
+                    this.selection.fromJSON(this.lastFileJumpPos);
+                    return
+                }
+            }
+            this.endOperation(e);
+        }.bind(this), true);
+
+        this.$opResetTimer = lang.delayedCall(this.endOperation.bind(this));
+
+        this.on("change", function() {
+            this.curOp || this.startOperation();
+            this.curOp.docChanged = true;
+        }.bind(this), true);
+
+        this.on("changeSelection", function() {
+            this.curOp || this.startOperation();
+            this.curOp.selectionChanged = true;
+        }.bind(this), true);
+    }
+
+    this.curOp = null;
+    this.prevOp = {};
+    this.startOperation = function(commadEvent) {
+        if (this.curOp) {
+            if (!commadEvent || this.curOp.command)
+                return;
+            this.prevOp = this.curOp;
+        }
+        if (!commadEvent) {
+            this.previousCommand = null;
+            commadEvent = {};
+        }
+
+        this.$opResetTimer.schedule();
+        this.curOp = {
+            command: commadEvent.command || {},
+            args: commadEvent.args
+        };
+
+        this.selections.push(this.selection.toJSON());
+    };
+
+    this.endOperation = function() {
+        if (this.curOp) {
+            this.prevOp = this.curOp;
+            this.curOp = null;
+        }
+    };
+
+    this.$historyTracker = function(e) {
+        if (!this.$mergeUndoDeltas)
+            return;
+
+
+        var prev = this.prevOp;
+        var mergeableCommands = ["backspace", "del", "insertstring"];
+        // previous command was the same
+        var shouldMerge = prev.command && (e.command.name == prev.command.name);
+        if (e.command.name == "insertstring") {
+            var text = e.args;
+            if (this.mergeNextCommand === undefined)
+                this.mergeNextCommand = true;
+
+            shouldMerge = shouldMerge
+                && this.mergeNextCommand // previous command allows to coalesce with
+                && (!/\s/.test(text) || /\s/.test(prev.args)) // previous insertion was of same type
+
+            this.mergeNextCommand = true;
+        } else {
+            shouldMerge = shouldMerge
+                && mergeableCommands.indexOf(e.command.name) !== -1// the command is mergeable
+        }
+
+        if (
+            this.$mergeUndoDeltas != "always"
+            && Date.now() - this.sequenceStartTime > 2000
+        ) {
+            shouldMerge = false; // the sequence is too long
+        }
+
+        if (shouldMerge)
+            this.session.mergeUndoDeltas = true;
+        else if (mergeableCommands.indexOf(e.command.name) !== -1)
+            this.sequenceStartTime = Date.now();
+    };
+
+    /**
+     * Sets a new key handler, such as "vim" or "windows".
+     * @param {String} keyboardHandler The new key handler
+     *
+     *
+     **/
+    this.setKeyboardHandler = function(keyboardHandler) {
+        if (!keyboardHandler) {
+            this.keyBinding.setKeyboardHandler(null);
+        } else if (typeof keyboardHandler == "string") {
+            this.$keybindingId = keyboardHandler;
+            var _self = this;
+            config.loadModule(["keybinding", keyboardHandler], function(module) {
+                if (_self.$keybindingId == keyboardHandler)
+                    _self.keyBinding.setKeyboardHandler(module && module.handler);
+            });
+        } else {
+            this.$keybindingId = null;
+            this.keyBinding.setKeyboardHandler(keyboardHandler);
+        }
+    };
+
+    /**
+     * Returns the keyboard handler, such as "vim" or "windows".
+     *
+     * @returns {String}
+     *
+     **/
+    this.getKeyboardHandler = function() {
+        return this.keyBinding.getKeyboardHandler();
+    };
+
+
+    /**
+     * Emitted whenever the [[EditSession]] changes.
+     * @event changeSession
+     * @param {Object} e An object with two properties, `oldSession` and `session`, that represent the old and new [[EditSession]]s.
+     *
+     *
+     **/
+    /**
+     * Sets a new editsession to use. This method also emits the `'changeSession'` event.
+     * @param {EditSession} session The new session to use
+     *
+     *
+     **/
+    this.setSession = function(session) {
+        if (this.session == session)
+            return;
+
+        if (this.session) {
+            var oldSession = this.session;
+            this.session.removeEventListener("change", this.$onDocumentChange);
+            this.session.removeEventListener("changeMode", this.$onChangeMode);
+            this.session.removeEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
+            this.session.removeEventListener("changeTabSize", this.$onChangeTabSize);
+            this.session.removeEventListener("changeWrapLimit", this.$onChangeWrapLimit);
+            this.session.removeEventListener("changeWrapMode", this.$onChangeWrapMode);
+            this.session.removeEventListener("onChangeFold", this.$onChangeFold);
+            this.session.removeEventListener("changeFrontMarker", this.$onChangeFrontMarker);
+            this.session.removeEventListener("changeBackMarker", this.$onChangeBackMarker);
+            this.session.removeEventListener("changeBreakpoint", this.$onChangeBreakpoint);
+            this.session.removeEventListener("changeAnnotation", this.$onChangeAnnotation);
+            this.session.removeEventListener("changeOverwrite", this.$onCursorChange);
+            this.session.removeEventListener("changeScrollTop", this.$onScrollTopChange);
+            this.session.removeEventListener("changeScrollLeft", this.$onScrollLeftChange);
+
+            var selection = this.session.getSelection();
+            selection.removeEventListener("changeCursor", this.$onCursorChange);
+            selection.removeEventListener("changeSelection", this.$onSelectionChange);
+        }
+
+        this.session = session;
+
+        this.$onDocumentChange = this.onDocumentChange.bind(this);
+        session.addEventListener("change", this.$onDocumentChange);
+        this.renderer.setSession(session);
+
+        this.$onChangeMode = this.onChangeMode.bind(this);
+        session.addEventListener("changeMode", this.$onChangeMode);
+
+        this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this);
+        session.addEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
+
+        this.$onChangeTabSize = this.renderer.onChangeTabSize.bind(this.renderer);
+        session.addEventListener("changeTabSize", this.$onChangeTabSize);
+
+        this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this);
+        session.addEventListener("changeWrapLimit", this.$onChangeWrapLimit);
+
+        this.$onChangeWrapMode = this.onChangeWrapMode.bind(this);
+        session.addEventListener("changeWrapMode", this.$onChangeWrapMode);
+
+        this.$onChangeFold = this.onChangeFold.bind(this);
+        session.addEventListener("changeFold", this.$onChangeFold);
+
+        this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this);
+        this.session.addEventListener("changeFrontMarker", this.$onChangeFrontMarker);
+
+        this.$onChangeBackMarker = this.onChangeBackMarker.bind(this);
+        this.session.addEventListener("changeBackMarker", this.$onChangeBackMarker);
+
+        this.$onChangeBreakpoint = this.onChangeBreakpoint.bind(this);
+        this.session.addEventListener("changeBreakpoint", this.$onChangeBreakpoint);
+
+        this.$onChangeAnnotation = this.onChangeAnnotation.bind(this);
+        this.session.addEventListener("changeAnnotation", this.$onChangeAnnotation);
+
+        this.$onCursorChange = this.onCursorChange.bind(this);
+        this.session.addEventListener("changeOverwrite", this.$onCursorChange);
+
+        this.$onScrollTopChange = this.onScrollTopChange.bind(this);
+        this.session.addEventListener("changeScrollTop", this.$onScrollTopChange);
+
+        this.$onScrollLeftChange = this.onScrollLeftChange.bind(this);
+        this.session.addEventListener("changeScrollLeft", this.$onScrollLeftChange);
+
+        this.selection = session.getSelection();
+        this.selection.addEventListener("changeCursor", this.$onCursorChange);
+
+        this.$onSelectionChange = this.onSelectionChange.bind(this);
+        this.selection.addEventListener("changeSelection", this.$onSelectionChange);
+
+        this.onChangeMode();
+
+        this.$blockScrolling += 1;
+        this.onCursorChange();
+        this.$blockScrolling -= 1;
+
+        this.onScrollTopChange();
+        this.onScrollLeftChange();
+        this.onSelectionChange();
+        this.onChangeFrontMarker();
+        this.onChangeBackMarker();
+        this.onChangeBreakpoint();
+        this.onChangeAnnotation();
+        this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
+        this.renderer.updateFull();
+
+        this._emit("changeSession", {
+            session: session,
+            oldSession: oldSession
+        });
+    };
+
+    /**
+     * Returns the current session being used.
+     * @returns {EditSession}
+     **/
+    this.getSession = function() {
+        return this.session;
+    };
+
+    /**
+     * Sets the current document to `val`.
+     * @param {String} val The new value to set for the document
+     * @param {Number} cursorPos Where to set the new value. `undefined` or 0 is selectAll, -1 is at the document start, and 1 is at the end
+     *
+     * @returns {String} The current document value
+     * @related Document.setValue
+     **/
+    this.setValue = function(val, cursorPos) {
+        this.session.doc.setValue(val);
+
+        if (!cursorPos)
+            this.selectAll();
+        else if (cursorPos == 1)
+            this.navigateFileEnd();
+        else if (cursorPos == -1)
+            this.navigateFileStart();
+
+        return val;
+    };
+
+    /**
+     * Returns the current session's content.
+     *
+     * @returns {String}
+     * @related EditSession.getValue
+     **/
+    this.getValue = function() {
+        return this.session.getValue();
+    };
+
+    /**
+     *
+     * Returns the currently highlighted selection.
+     * @returns {String} The highlighted selection
+     **/
+    this.getSelection = function() {
+        return this.selection;
+    };
+
+    /**
+     * {:VirtualRenderer.onResize}
+     * @param {Boolean} force If `true`, recomputes the size, even if the height and width haven't changed
+     *
+     *
+     * @related VirtualRenderer.onResize
+     **/
+    this.resize = function(force) {
+        this.renderer.onResize(force);
+    };
+
+    /**
+     * {:VirtualRenderer.setTheme}
+     * @param {String} theme The path to a theme
+     *
+     *
+     **/
+    this.setTheme = function(theme) {
+        this.renderer.setTheme(theme);
+    };
+
+    /**
+     * {:VirtualRenderer.getTheme}
+     *
+     * @returns {String} The set theme
+     * @related VirtualRenderer.getTheme
+     **/
+    this.getTheme = function() {
+        return this.renderer.getTheme();
+    };
+
+    /**
+     * {:VirtualRenderer.setStyle}
+     * @param {String} style A class name
+     *
+     *
+     * @related VirtualRenderer.setStyle
+     **/
+    this.setStyle = function(style) {
+        this.renderer.setStyle(style);
+    };
+
+    /**
+     * {:VirtualRenderer.unsetStyle}
+     * @related VirtualRenderer.unsetStyle
+     **/
+    this.unsetStyle = function(style) {
+        this.renderer.unsetStyle(style);
+    };
+
+    /**
+     * Gets the current font size of the editor text.
+     */
+    this.getFontSize = function () {
+        return this.getOption("fontSize") ||
+           dom.computedStyle(this.container, "fontSize");
+    };
+
+    /**
+     * Set a new font size (in pixels) for the editor text.
+     * @param {String} size A font size ( _e.g._ "12px")
+     *
+     *
+     **/
+    this.setFontSize = function(size) {
+        this.setOption("fontSize", size);
+    };
+
+    this.$highlightBrackets = function() {
+        if (this.session.$bracketHighlight) {
+            this.session.removeMarker(this.session.$bracketHighlight);
+            this.session.$bracketHighlight = null;
+        }
+
+        if (this.$highlightPending) {
+            return;
+        }
+
+        // perform highlight async to not block the browser during navigation
+        var self = this;
+        this.$highlightPending = true;
+        setTimeout(function() {
+            self.$highlightPending = false;
+
+            var pos = self.session.findMatchingBracket(self.getCursorPosition());
+            if (pos) {
+                var range = new Range(pos.row, pos.column, pos.row, pos.column+1);
+            } else if (self.session.$mode.getMatching) {
+                var range = self.session.$mode.getMatching(self.session);
+            }
+            if (range)
+                self.session.$bracketHighlight = self.session.addMarker(range, "ace_bracket", "text");
+        }, 50);
+    };
+
+    /**
+     *
+     * Brings the current `textInput` into focus.
+     **/
+    this.focus = function() {
+        // Safari needs the timeout
+        // iOS and Firefox need it called immediately
+        // to be on the save side we do both
+        var _self = this;
+        setTimeout(function() {
+            _self.textInput.focus();
+        });
+        this.textInput.focus();
+    };
+
+    /**
+     * Returns `true` if the current `textInput` is in focus.
+     * @return {Boolean}
+     **/
+    this.isFocused = function() {
+        return this.textInput.isFocused();
+    };
+
+    /**
+     *
+     * Blurs the current `textInput`.
+     **/
+    this.blur = function() {
+        this.textInput.blur();
+    };
+
+    /**
+     * Emitted once the editor comes into focus.
+     * @event focus
+     *
+     *
+     **/
+    this.onFocus = function() {
+        if (this.$isFocused)
+            return;
+        this.$isFocused = true;
+        this.renderer.showCursor();
+        this.renderer.visualizeFocus();
+        this._emit("focus");
+    };
+
+    /**
+     * Emitted once the editor has been blurred.
+     * @event blur
+     *
+     *
+     **/
+    this.onBlur = function() {
+        if (!this.$isFocused)
+            return;
+        this.$isFocused = false;
+        this.renderer.hideCursor();
+        this.renderer.visualizeBlur();
+        this._emit("blur");
+    };
+
+    this.$cursorChange = function() {
+        this.renderer.updateCursor();
+    };
+
+    /**
+     * Emitted whenever the document is changed.
+     * @event change
+     * @param {Object} e Contains a single property, `data`, which has the delta of changes
+     *
+     *
+     *
+     **/
+    this.onDocumentChange = function(e) {
+        var delta = e.data;
+        var range = delta.range;
+        var lastRow;
+
+        if (range.start.row == range.end.row && delta.action != "insertLines" && delta.action != "removeLines")
+            lastRow = range.end.row;
+        else
+            lastRow = Infinity;
+        this.renderer.updateLines(range.start.row, lastRow);
+
+        this._emit("change", e);
+
+        // update cursor because tab characters can influence the cursor position
+        this.$cursorChange();
+    };
+
+    this.onTokenizerUpdate = function(e) {
+        var rows = e.data;
+        this.renderer.updateLines(rows.first, rows.last);
+    };
+
+
+    this.onScrollTopChange = function() {
+        this.renderer.scrollToY(this.session.getScrollTop());
+    };
+
+    this.onScrollLeftChange = function() {
+        this.renderer.scrollToX(this.session.getScrollLeft());
+    };
+
+    /**
+     * Emitted when the selection changes.
+     *
+     **/
+    this.onCursorChange = function() {
+        this.$cursorChange();
+
+        if (!this.$blockScrolling) {
+            this.renderer.scrollCursorIntoView();
+        }
+
+        this.$highlightBrackets();
+        this.$updateHighlightActiveLine();
+        this._emit("changeSelection");
+    };
+
+    this.$updateHighlightActiveLine = function() {
+        var session = this.getSession();
+
+        var highlight;
+        if (this.$highlightActiveLine) {
+            if ((this.$selectionStyle != "line" || !this.selection.isMultiLine()))
+                highlight = this.getCursorPosition();
+            if (this.renderer.$maxLines && this.session.getLength() === 1)
+                highlight = false;
+        }
+
+        if (session.$highlightLineMarker && !highlight) {
+            session.removeMarker(session.$highlightLineMarker.id);
+            session.$highlightLineMarker = null;
+        } else if (!session.$highlightLineMarker && highlight) {
+            var range = new Range(highlight.row, highlight.column, highlight.row, Infinity);
+            range.id = session.addMarker(range, "ace_active-line", "screenLine");
+            session.$highlightLineMarker = range;
+        } else if (highlight) {
+            session.$highlightLineMarker.start.row = highlight.row;
+            session.$highlightLineMarker.end.row = highlight.row;
+            session.$highlightLineMarker.start.column = highlight.column;
+            session._emit("changeBackMarker");
+        }
+    };
+
+    this.onSelectionChange = function(e) {
+        var session = this.session;
+
+        if (session.$selectionMarker) {
+            session.removeMarker(session.$selectionMarker);
+        }
+        session.$selectionMarker = null;
+
+        if (!this.selection.isEmpty()) {
+            var range = this.selection.getRange();
+            var style = this.getSelectionStyle();
+            session.$selectionMarker = session.addMarker(range, "ace_selection", style);
+        } else {
+            this.$updateHighlightActiveLine();
+        }
+
+        var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp()
+        this.session.highlight(re);
+
+        this._emit("changeSelection");
+    };
+
+    this.$getSelectionHighLightRegexp = function() {
+        var session = this.session;
+
+        var selection = this.getSelectionRange();
+        if (selection.isEmpty() || selection.isMultiLine())
+            return;
+
+        var startOuter = selection.start.column - 1;
+        var endOuter = selection.end.column + 1;
+        var line = session.getLine(selection.start.row);
+        var lineCols = line.length;
+        var needle = line.substring(Math.max(startOuter, 0),
+                                    Math.min(endOuter, lineCols));
+
+        // Make sure the outer characters are not part of the word.
+        if ((startOuter >= 0 && /^[\w\d]/.test(needle)) ||
+            (endOuter <= lineCols && /[\w\d]$/.test(needle)))
+            return;
+
+        needle = line.substring(selection.start.column, selection.end.column);
+        if (!/^[\w\d]+$/.test(needle))
+            return;
+
+        var re = this.$search.$assembleRegExp({
+            wholeWord: true,
+            caseSensitive: true,
+            needle: needle
+        });
+
+        return re;
+    };
+
+
+    this.onChangeFrontMarker = function() {
+        this.renderer.updateFrontMarkers();
+    };
+
+    this.onChangeBackMarker = function() {
+        this.renderer.updateBackMarkers();
+    };
+
+
+    this.onChangeBreakpoint = function() {
+        this.renderer.updateBreakpoints();
+    };
+
+    this.onChangeAnnotation = function() {
+        this.renderer.setAnnotations(this.session.getAnnotations());
+    };
+
+
+    this.onChangeMode = function(e) {
+        this.renderer.updateText();
+        this._emit("changeMode", e);
+    };
+
+
+    this.onChangeWrapLimit = function() {
+        this.renderer.updateFull();
+    };
+
+    this.onChangeWrapMode = function() {
+        this.renderer.onResize(true);
+    };
+
+
+    this.onChangeFold = function() {
+        // Update the active line marker as due to folding changes the current
+        // line range on the screen might have changed.
+        this.$updateHighlightActiveLine();
+        // TODO: This might be too much updating. Okay for now.
+        this.renderer.updateFull();
+    };
+
+    
+    /**
+     * Returns the string of text currently highlighted.
+     * @returns {String}
+     **/
+    this.getSelectedText = function() {
+        return this.session.getTextRange(this.getSelectionRange());
+    };
+    
+    /**
+     * Emitted when text is copied.
+     * @event copy
+     * @param {String} text The copied text
+     *
+     **/
+    /**
+     * Returns the string of text currently highlighted.
+     * @returns {String}
+     * @deprecated Use getSelectedText instead.
+     **/
+    this.getCopyText = function() {
+        var text = this.getSelectedText();
+        this._signal("copy", text);
+        return text;
+    };
+
+    /**
+     * Called whenever a text "copy" happens.
+     **/
+    this.onCopy = function() {
+        this.commands.exec("copy", this);
+    };
+
+    /**
+     * Called whenever a text "cut" happens.
+     **/
+    this.onCut = function() {
+        this.commands.exec("cut", this);
+    };
+
+    /**
+     * Emitted when text is pasted.
+     * @event paste
+     * @param {String} text The pasted text
+     *
+     *
+     **/
+    /**
+     * Called whenever a text "paste" happens.
+     * @param {String} text The pasted text
+     *
+     *
+     **/
+    this.onPaste = function(text) {
+        // todo this should change when paste becomes a command
+        if (this.$readOnly)
+            return;
+        this._emit("paste", text);
+        this.insert(text);
+    };
+
+
+    this.execCommand = function(command, args) {
+        this.commands.exec(command, this, args);
+    };
+
+    /**
+     * Inserts `text` into wherever the cursor is pointing.
+     * @param {String} text The new text to add
+     *
+     *
+     **/
+    this.insert = function(text) {
+        var session = this.session;
+        var mode = session.getMode();
+        var cursor = this.getCursorPosition();
+
+        if (this.getBehavioursEnabled()) {
+            // Get a transform if the current mode wants one.
+            var transform = mode.transformAction(session.getState(cursor.row), 'insertion', this, session, text);
+            if (transform) {
+                if (text !== transform.text) {
+                    this.session.mergeUndoDeltas = false;
+                    this.$mergeNextCommand = false;
+                }
+                text = transform.text;
+
+            }
+        }
+        
+        if (text == "\t")
+            text = this.session.getTabString();
+
+        // remove selected text
+        if (!this.selection.isEmpty()) {
+            var range = this.getSelectionRange();
+            cursor = this.session.remove(range);
+            this.clearSelection();
+        }
+        else if (this.session.getOverwrite()) {
+            var range = new Range.fromPoints(cursor, cursor);
+            range.end.column += text.length;
+            this.session.remove(range);
+        }
+
+        if (text == "\n" || text == "\r\n") {
+            var line = session.getLine(cursor.row)
+            if (cursor.column > line.search(/\S|$/)) {
+                var d = line.substr(cursor.column).search(/\S|$/);
+                session.doc.removeInLine(cursor.row, cursor.column, cursor.column + d);
+            }
+        }
+        this.clearSelection();
+
+        var start = cursor.column;
+        var lineState = session.getState(cursor.row);
+        var line = session.getLine(cursor.row);
+        var shouldOutdent = mode.checkOutdent(lineState, line, text);
+        var end = session.insert(cursor, text);
+
+        if (transform && transform.selection) {
+            if (transform.selection.length == 2) { // Transform relative to the current column
+                this.selection.setSelectionRange(
+                    new Range(cursor.row, start + transform.selection[0],
+                              cursor.row, start + transform.selection[1]));
+            } else { // Transform relative to the current row.
+                this.selection.setSelectionRange(
+                    new Range(cursor.row + transform.selection[0],
+                              transform.selection[1],
+                              cursor.row + transform.selection[2],
+                              transform.selection[3]));
+            }
+        }
+
+        if (session.getDocument().isNewLine(text)) {
+            var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
+
+            session.insert({row: cursor.row+1, column: 0}, lineIndent);
+        }
+        if (shouldOutdent)
+            mode.autoOutdent(lineState, session, cursor.row);
+    };
+
+    this.onTextInput = function(text) {
+        this.keyBinding.onTextInput(text);
+    };
+
+    this.onCommandKey = function(e, hashId, keyCode) {
+        this.keyBinding.onCommandKey(e, hashId, keyCode);
+    };
+
+    /**
+     * Pass in `true` to enable overwrites in your session, or `false` to disable. If overwrites is enabled, any text you enter will type over any text after it. If the value of `overwrite` changes, this function also emites the `changeOverwrite` event.
+     * @param {Boolean} overwrite Defines wheter or not to set overwrites
+     *
+     *
+     * @related EditSession.setOverwrite
+     **/
+    this.setOverwrite = function(overwrite) {
+        this.session.setOverwrite(overwrite);
+    };
+
+    /**
+     * Returns `true` if overwrites are enabled; `false` otherwise.
+     * @returns {Boolean}
+     * @related EditSession.getOverwrite
+     **/
+    this.getOverwrite = function() {
+        return this.session.getOverwrite();
+    };
+
+    /**
+     * Sets the value of overwrite to the opposite of whatever it currently is.
+     * @related EditSession.toggleOverwrite
+     **/
+    this.toggleOverwrite = function() {
+        this.session.toggleOverwrite();
+    };
+
+    /**
+     * Sets how fast the mouse scrolling should do.
+     * @param {Number} speed A value indicating the new speed (in milliseconds)
+     **/
+    this.setScrollSpeed = function(speed) {
+        this.setOption("scrollSpeed", speed);
+    };
+
+    /**
+     * Returns the value indicating how fast the mouse scroll speed is (in milliseconds).
+     * @returns {Number}
+     **/
+    this.getScrollSpeed = function() {
+        return this.getOption("scrollSpeed");
+    };
+
+    /**
+     * Sets the delay (in milliseconds) of the mouse drag.
+     * @param {Number} dragDelay A value indicating the new delay
+     **/
+    this.setDragDelay = function(dragDelay) {
+        this.setOption("dragDelay", dragDelay);
+    };
+
+    /**
+     * Returns the current mouse drag delay.
+     * @returns {Number}
+     **/
+    this.getDragDelay = function() {
+        return this.getOption("dragDelay");
+    };
+
+    /**
+     * Emitted when the selection style changes, via [[Editor.setSelectionStyle]].
+     * @event changeSelectionStyle
+     * @param {Object} data Contains one property, `data`, which indicates the new selection style
+     **/
+    /**
+     * Draw selection markers spanning whole line, or only over selected text. Default value is "line"
+     * @param {String} style The new selection style "line"|"text"
+     *
+     **/
+    this.setSelectionStyle = function(val) {
+        this.setOption("selectionStyle", val);
+    };
+
+    /**
+     * Returns the current selection style.
+     * @returns {String}
+     **/
+    this.getSelectionStyle = function() {
+        return this.getOption("selectionStyle");
+    };
+
+    /**
+     * Determines whether or not the current line should be highlighted.
+     * @param {Boolean} shouldHighlight Set to `true` to highlight the current line
+     **/
+    this.setHighlightActiveLine = function(shouldHighlight) {
+        this.setOption("highlightActiveLine", shouldHighlight);
+    };
+    /**
+     * Returns `true` if current lines are always highlighted.
+     * @return {Boolean}
+     **/
+    this.getHighlightActiveLine = function() {
+        return this.getOption("highlightActiveLine");
+    };
+    this.setHighlightGutterLine = function(shouldHighlight) {
+        this.setOption("highlightGutterLine", shouldHighlight);
+    };
+
+    this.getHighlightGutterLine = function() {
+        return this.getOption("highlightGutterLine");
+    };
+    /**
+     * Determines if the currently selected word should be highlighted.
+     * @param {Boolean} shouldHighlight Set to `true` to highlight the currently selected word
+     *
+     **/
+    this.setHighlightSelectedWord = function(shouldHighlight) {
+        this.setOption("highlightSelectedWord", shouldHighlight);
+    };
+
+    /**
+     * Returns `true` if currently highlighted words are to be highlighted.
+     * @returns {Boolean}
+     **/
+    this.getHighlightSelectedWord = function() {
+        return this.$highlightSelectedWord;
+    };
+
+    this.setAnimatedScroll = function(shouldAnimate){
+        this.renderer.setAnimatedScroll(shouldAnimate);
+    };
+
+    this.getAnimatedScroll = function(){
+        return this.renderer.getAnimatedScroll();
+    };
+
+    /**
+     * If `showInvisibles` is set to `true`, invisible characters&mdash;like spaces or new lines&mdash;are show in the editor.
+     * @param {Boolean} showInvisibles Specifies whether or not to show invisible characters
+     *
+     **/
+    this.setShowInvisibles = function(showInvisibles) {
+        this.renderer.setShowInvisibles(showInvisibles);
+    };
+
+    /**
+     * Returns `true` if invisible characters are being shown.
+     * @returns {Boolean}
+     **/
+    this.getShowInvisibles = function() {
+        return this.renderer.getShowInvisibles();
+    };
+
+    this.setDisplayIndentGuides = function(display) {
+        this.renderer.setDisplayIndentGuides(display);
+    };
+
+    this.getDisplayIndentGuides = function() {
+        return this.renderer.getDisplayIndentGuides();
+    };
+
+    /**
+     * If `showPrintMargin` is set to `true`, the print margin is shown in the editor.
+     * @param {Boolean} showPrintMargin Specifies whether or not to show the print margin
+     *
+     **/
+    this.setShowPrintMargin = function(showPrintMargin) {
+        this.renderer.setShowPrintMargin(showPrintMargin);
+    };
+
+    /**
+     * Returns `true` if the print margin is being shown.
+     * @returns {Boolean}
+     **/
+    this.getShowPrintMargin = function() {
+        return this.renderer.getShowPrintMargin();
+    };
+
+    /**
+     * Sets the column defining where the print margin should be.
+     * @param {Number} showPrintMargin Specifies the new print margin
+     *
+     **/
+    this.setPrintMarginColumn = function(showPrintMargin) {
+        this.renderer.setPrintMarginColumn(showPrintMargin);
+    };
+
+    /**
+     * Returns the column number of where the print margin is.
+     * @returns {Number}
+     **/
+    this.getPrintMarginColumn = function() {
+        return this.renderer.getPrintMarginColumn();
+    };
+
+    /**
+     * If `readOnly` is true, then the editor is set to read-only mode, and none of the content can change.
+     * @param {Boolean} readOnly Specifies whether the editor can be modified or not
+     *
+     **/
+    this.setReadOnly = function(readOnly) {
+        this.setOption("readOnly", readOnly);
+    };
+
+    /**
+     * Returns `true` if the editor is set to read-only mode.
+     * @returns {Boolean}
+     **/
+    this.getReadOnly = function() {
+        return this.getOption("readOnly");
+    };
+
+    /**
+     * Specifies whether to use behaviors or not. ["Behaviors" in this case is the auto-pairing of special characters, like quotation marks, parenthesis, or brackets.]{: #BehaviorsDef}
+     * @param {Boolean} enabled Enables or disables behaviors
+     *
+     **/
+    this.setBehavioursEnabled = function (enabled) {
+        this.setOption("behavioursEnabled", enabled);
+    };
+
+    /**
+     * Returns `true` if the behaviors are currently enabled. {:BehaviorsDef}
+     *
+     * @returns {Boolean}
+     **/
+    this.getBehavioursEnabled = function () {
+        return this.getOption("behavioursEnabled");
+    };
+
+    /**
+     * Specifies whether to use wrapping behaviors or not, i.e. automatically wrapping the selection with characters such as brackets
+     * when such a character is typed in.
+     * @param {Boolean} enabled Enables or disables wrapping behaviors
+     *
+     **/
+    this.setWrapBehavioursEnabled = function (enabled) {
+        this.setOption("wrapBehavioursEnabled", enabled);
+    };
+
+    /**
+     * Returns `true` if the wrapping behaviors are currently enabled.
+     **/
+    this.getWrapBehavioursEnabled = function () {
+        return this.getOption("wrapBehavioursEnabled");
+    };
+
+    /**
+     * Indicates whether the fold widgets should be shown or not.
+     * @param {Boolean} show Specifies whether the fold widgets are shown
+     **/
+    this.setShowFoldWidgets = function(show) {
+        this.setOption("showFoldWidgets", show);
+
+    };
+    /**
+     * Returns `true` if the fold widgets are shown.
+     * @return {Boolean}
+     **/
+    this.getShowFoldWidgets = function() {
+        return this.getOption("showFoldWidgets");
+    };
+
+    this.setFadeFoldWidgets = function(fade) {
+        this.setOption("fadeFoldWidgets", fade);
+    };
+
+    this.getFadeFoldWidgets = function() {
+        return this.getOption("fadeFoldWidgets");
+    };
+
+    /**
+     * Removes words of text from the editor. A "word" is defined as a string of characters bookended by whitespace.
+     * @param {String} dir The direction of the deletion to occur, either "left" or "right"
+     *
+     **/
+    this.remove = function(dir) {
+        if (this.selection.isEmpty()){
+            if (dir == "left")
+                this.selection.selectLeft();
+            else
+                this.selection.selectRight();
+        }
+
+        var range = this.getSelectionRange();
+        if (this.getBehavioursEnabled()) {
+            var session = this.session;
+            var state = session.getState(range.start.row);
+            var new_range = session.getMode().transformAction(state, 'deletion', this, session, range);
+
+            if (range.end.column == 0) {
+                var text = session.getTextRange(range);
+                if (text[text.length - 1] == "\n") {
+                    var line = session.getLine(range.end.row)
+                    if (/^\s+$/.test(line)) {
+                        range.end.column = line.length
+                    }
+                }
+            }
+            if (new_range)
+                range = new_range;
+        }
+
+        this.session.remove(range);
+        this.clearSelection();
+    };
+
+    /**
+     * Removes the word directly to the right of the current selection.
+     **/
+    this.removeWordRight = function() {
+        if (this.selection.isEmpty())
+            this.selection.selectWordRight();
+
+        this.session.remove(this.getSelectionRange());
+        this.clearSelection();
+    };
+
+    /**
+     * Removes the word directly to the left of the current selection.
+     **/
+    this.removeWordLeft = function() {
+        if (this.selection.isEmpty())
+            this.selection.selectWordLeft();
+
+        this.session.remove(this.getSelectionRange());
+        this.clearSelection();
+    };
+
+    /**
+     * Removes all the words to the left of the current selection, until the start of the line.
+     **/
+    this.removeToLineStart = function() {
+        if (this.selection.isEmpty())
+            this.selection.selectLineStart();
+
+        this.session.remove(this.getSelectionRange());
+        this.clearSelection();
+    };
+
+    /**
+     * Removes all the words to the right of the current selection, until the end of the line.
+     **/
+    this.removeToLineEnd = function() {
+        if (this.selection.isEmpty())
+            this.selection.selectLineEnd();
+
+        var range = this.getSelectionRange();
+        if (range.start.column == range.end.column && range.start.row == range.end.row) {
+            range.end.column = 0;
+            range.end.row++;
+        }
+
+        this.session.remove(range);
+        this.clearSelection();
+    };
+
+    /**
+     * Splits the line at the current selection (by inserting an `'\n'`).
+     **/
+    this.splitLine = function() {
+        if (!this.selection.isEmpty()) {
+            this.session.remove(this.getSelectionRange());
+            this.clearSelection();
+        }
+
+        var cursor = this.getCursorPosition();
+        this.insert("\n");
+        this.moveCursorToPosition(cursor);
+    };
+
+    /**
+     * Transposes current line.
+     **/
+    this.transposeLetters = function() {
+        if (!this.selection.isEmpty()) {
+            return;
+        }
+
+        var cursor = this.getCursorPosition();
+        var column = cursor.column;
+        if (column === 0)
+            return;
+
+        var line = this.session.getLine(cursor.row);
+        var swap, range;
+        if (column < line.length) {
+            swap = line.charAt(column) + line.charAt(column-1);
+            range = new Range(cursor.row, column-1, cursor.row, column+1);
+        }
+        else {
+            swap = line.charAt(column-1) + line.charAt(column-2);
+            range = new Range(cursor.row, column-2, cursor.row, column);
+        }
+        this.session.replace(range, swap);
+    };
+
+    /**
+     * Converts the current selection entirely into lowercase.
+     **/
+    this.toLowerCase = function() {
+        var originalRange = this.getSelectionRange();
+        if (this.selection.isEmpty()) {
+            this.selection.selectWord();
+        }
+
+        var range = this.getSelectionRange();
+        var text = this.session.getTextRange(range);
+        this.session.replace(range, text.toLowerCase());
+        this.selection.setSelectionRange(originalRange);
+    };
+
+    /**
+     * Converts the current selection entirely into uppercase.
+     **/
+    this.toUpperCase = function() {
+        var originalRange = this.getSelectionRange();
+        if (this.selection.isEmpty()) {
+            this.selection.selectWord();
+        }
+
+        var range = this.getSelectionRange();
+        var text = this.session.getTextRange(range);
+        this.session.replace(range, text.toUpperCase());
+        this.selection.setSelectionRange(originalRange);
+    };
+
+    /**
+     * Inserts an indentation into the current cursor position or indents the selected lines.
+     *
+     * @related EditSession.indentRows
+     **/
+    this.indent = function() {
+        var session = this.session;
+        var range = this.getSelectionRange();
+
+        if (range.start.row < range.end.row) {
+            var rows = this.$getSelectedRows();
+            session.indentRows(rows.first, rows.last, "\t");
+            return;
+        } else if (range.start.column < range.end.column) {
+            var text = session.getTextRange(range)
+            if (!/^\s+$/.test(text)) {
+                var rows = this.$getSelectedRows();
+                session.indentRows(rows.first, rows.last, "\t");
+                return;
+            }
+        }
+        
+        var line = session.getLine(range.start.row)
+        var position = range.start;
+        var size = session.getTabSize();
+        var column = session.documentToScreenColumn(position.row, position.column);
+
+        if (this.session.getUseSoftTabs()) {
+            var count = (size - column % size);
+            var indentString = lang.stringRepeat(" ", count);
+        } else {
+            var count = column % size;
+            while (line[range.start.column] == " " && count) {
+                range.start.column--;
+                count--;
+            }
+            this.selection.setSelectionRange(range);
+            indentString = "\t";
+        }
+        return this.insert(indentString);
+    };
+
+    /**
+     * Indents the current line.
+     * @related EditSession.indentRows
+     **/
+    this.blockIndent = function() {
+        var rows = this.$getSelectedRows();
+        this.session.indentRows(rows.first, rows.last, "\t");
+    };
+
+    /**
+     * Outdents the current line.
+     * @related EditSession.outdentRows
+     **/
+    this.blockOutdent = function() {
+        var selection = this.session.getSelection();
+        this.session.outdentRows(selection.getRange());
+    };
+
+    // TODO: move out of core when we have good mechanism for managing extensions
+    this.sortLines = function() {
+        var rows = this.$getSelectedRows();
+        var session = this.session;
+
+        var lines = [];
+        for (i = rows.first; i <= rows.last; i++)
+            lines.push(session.getLine(i));
+
+        lines.sort(function(a, b) {
+            if (a.toLowerCase() < b.toLowerCase()) return -1;
+            if (a.toLowerCase() > b.toLowerCase()) return 1;
+            return 0;
+        });
+
+        var deleteRange = new Range(0, 0, 0, 0);
+        for (var i = rows.first; i <= rows.last; i++) {
+            var line = session.getLine(i);
+            deleteRange.start.row = i;
+            deleteRange.end.row = i;
+            deleteRange.end.column = line.length;
+            session.replace(deleteRange, lines[i-rows.first]);
+        }
+    };
+
+    /**
+     * Given the currently selected range, this function either comments all the lines, or uncomments all of them.
+     **/
+    this.toggleCommentLines = function() {
+        var state = this.session.getState(this.getCursorPosition().row);
+        var rows = this.$getSelectedRows();
+        this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);
+    };
+
+    this.toggleBlockComment = function() {
+        var cursor = this.getCursorPosition();
+        var state = this.session.getState(cursor.row);
+        var range = this.getSelectionRange();
+        this.session.getMode().toggleBlockComment(state, this.session, range, cursor);
+    };
+
+    /**
+     * Works like [[EditSession.getTokenAt]], except it returns a number.
+     * @returns {Number}
+     **/
+    this.getNumberAt = function( row, column ) {
+        var _numberRx = /[\-]?[0-9]+(?:\.[0-9]+)?/g
+        _numberRx.lastIndex = 0
+
+        var s = this.session.getLine(row)
+        while (_numberRx.lastIndex < column) {
+            var m = _numberRx.exec(s)
+            if(m.index <= column && m.index+m[0].length >= column){
+                var number = {
+                    value: m[0],
+                    start: m.index,
+                    end: m.index+m[0].length
+                }
+                return number;
+            }
+        }
+        return null;
+    };
+
+    /**
+     * If the character before the cursor is a number, this functions changes its value by `amount`.
+     * @param {Number} amount The value to change the numeral by (can be negative to decrease value)
+     *
+     **/
+    this.modifyNumber = function(amount) {
+        var row = this.selection.getCursor().row;
+        var column = this.selection.getCursor().column;
+
+        // get the char before the cursor
+        var charRange = new Range(row, column-1, row, column);
+
+        var c = this.session.getTextRange(charRange);
+        // if the char is a digit
+        if (!isNaN(parseFloat(c)) && isFinite(c)) {
+            // get the whole number the digit is part of
+            var nr = this.getNumberAt(row, column);
+            // if number found
+            if (nr) {
+                var fp = nr.value.indexOf(".") >= 0 ? nr.start + nr.value.indexOf(".") + 1 : nr.end;
+                var decimals = nr.start + nr.value.length - fp;
+
+                var t = parseFloat(nr.value);
+                t *= Math.pow(10, decimals);
+
+
+                if(fp !== nr.end && column < fp){
+                    amount *= Math.pow(10, nr.end - column - 1);
+                } else {
+                    amount *= Math.pow(10, nr.end - column);
+                }
+
+                t += amount;
+                t /= Math.pow(10, decimals);
+                var nnr = t.toFixed(decimals);
+
+                //update number
+                var replaceRange = new Range(row, nr.start, row, nr.end);
+                this.session.replace(replaceRange, nnr);
+
+                //reposition the cursor
+                this.moveCursorTo(row, Math.max(nr.start +1, column + nnr.length - nr.value.length));
+
+            }
+        }
+    };
+
+    /**
+     * Removes all the lines in the current selection
+     * @related EditSession.remove
+     **/
+    this.removeLines = function() {
+        var rows = this.$getSelectedRows();
+        var range;
+        if (rows.first === 0 || rows.last+1 < this.session.getLength())
+            range = new Range(rows.first, 0, rows.last+1, 0);
+        else
+            range = new Range(
+                rows.first-1, this.session.getLine(rows.first-1).length,
+                rows.last, this.session.getLine(rows.last).length
+            );
+        this.session.remove(range);
+        this.clearSelection();
+    };
+
+    this.duplicateSelection = function() {
+        var sel = this.selection;
+        var doc = this.session;
+        var range = sel.getRange();
+        var reverse = sel.isBackwards();
+        if (range.isEmpty()) {
+            var row = range.start.row;
+            doc.duplicateLines(row, row);
+        } else {
+            var point = reverse ? range.start : range.end;
+            var endPoint = doc.insert(point, doc.getTextRange(range), false);
+            range.start = point;
+            range.end = endPoint;
+
+            sel.setSelectionRange(range, reverse)
+        }
+    };
+
+    /**
+     * Shifts all the selected lines down one row.
+     *
+     * @returns {Number} On success, it returns -1.
+     * @related EditSession.moveLinesUp
+     **/
+    this.moveLinesDown = function() {
+        this.$moveLines(function(firstRow, lastRow) {
+            return this.session.moveLinesDown(firstRow, lastRow);
+        });
+    };
+
+    /**
+     * Shifts all the selected lines up one row.
+     * @returns {Number} On success, it returns -1.
+     * @related EditSession.moveLinesDown
+     **/
+    this.moveLinesUp = function() {
+        this.$moveLines(function(firstRow, lastRow) {
+            return this.session.moveLinesUp(firstRow, lastRow);
+        });
+    };
+
+    /**
+     * Moves a range of text from the given range to the given position. `toPosition` is an object that looks like this:
+     * ```json
+     *    { row: newRowLocation, column: newColumnLocation }
+     * ```
+     * @param {Range} fromRange The range of text you want moved within the document
+     * @param {Object} toPosition The location (row and column) where you want to move the text to
+     *
+     * @returns {Range} The new range where the text was moved to.
+     * @related EditSession.moveText
+     **/
+    this.moveText = function(range, toPosition, copy) {
+        return this.session.moveText(range, toPosition, copy);
+    };
+
+    /**
+     * Copies all the selected lines up one row.
+     * @returns {Number} On success, returns 0.
+     *
+     **/
+    this.copyLinesUp = function() {
+        this.$moveLines(function(firstRow, lastRow) {
+            this.session.duplicateLines(firstRow, lastRow);
+            return 0;
+        });
+    };
+
+    /**
+     * Copies all the selected lines down one row.
+     * @returns {Number} On success, returns the number of new rows added; in other words, `lastRow - firstRow + 1`.
+     * @related EditSession.duplicateLines
+     *
+     **/
+    this.copyLinesDown = function() {
+        this.$moveLines(function(firstRow, lastRow) {
+            return this.session.duplicateLines(firstRow, lastRow);
+        });
+    };
+
+    /**
+     * Executes a specific function, which can be anything that manipulates selected lines, such as copying them, duplicating them, or shifting them.
+     * @param {Function} mover A method to call on each selected row
+     *
+     *
+     **/
+    this.$moveLines = function(mover) {
+        var selection = this.selection;
+        if (!selection.inMultiSelectMode || this.inVirtualSelectionMode) {
+            var range = selection.toOrientedRange();
+            var rows = this.$getSelectedRows(range);
+            var linesMoved = mover.call(this, rows.first, rows.last);
+            range.moveBy(linesMoved, 0);
+            selection.fromOrientedRange(range);
+        } else {
+            var ranges = selection.rangeList.ranges;
+            selection.rangeList.detach(this.session);
+
+            for (var i = ranges.length; i--; ) {
+                var rangeIndex = i;
+                var rows = ranges[i].collapseRows();
+                var last = rows.end.row;
+                var first = rows.start.row;
+                while (i--) {
+                    var rows = ranges[i].collapseRows();
+                    if (first - rows.end.row <= 1)
+                        first = rows.end.row;
+                    else
+                        break;
+                }
+                i++;
+
+                var linesMoved = mover.call(this, first, last);
+                while (rangeIndex >= i) {
+                    ranges[rangeIndex].moveBy(linesMoved, 0);
+                    rangeIndex--;
+                }
+            }
+            selection.fromOrientedRange(selection.ranges[0]);
+            selection.rangeList.attach(this.session);
+        }
+    };
+
+    /**
+     * Returns an object indicating the currently selected rows. The object looks like this:
+     *
+     * ```json
+     * { first: range.start.row, last: range.end.row }
+     * ```
+     *
+     * @returns {Object}
+     **/
+    this.$getSelectedRows = function() {
+        var range = this.getSelectionRange().collapseRows();
+
+        return {
+            first: range.start.row,
+            last: range.end.row
+        };
+    };
+
+    this.onCompositionStart = function(text) {
+        this.renderer.showComposition(this.getCursorPosition());
+    };
+
+    this.onCompositionUpdate = function(text) {
+        this.renderer.setCompositionText(text);
+    };
+
+    this.onCompositionEnd = function() {
+        this.renderer.hideComposition();
+    };
+
+    /**
+     * {:VirtualRenderer.getFirstVisibleRow}
+     *
+     * @returns {Number}
+     * @related VirtualRenderer.getFirstVisibleRow
+     **/
+    this.getFirstVisibleRow = function() {
+        return this.renderer.getFirstVisibleRow();
+    };
+
+    /**
+     * {:VirtualRenderer.getLastVisibleRow}
+     *
+     * @returns {Number}
+     * @related VirtualRenderer.getLastVisibleRow
+     **/
+    this.getLastVisibleRow = function() {
+        return this.renderer.getLastVisibleRow();
+    };
+
+    /**
+     * Indicates if the row is currently visible on the screen.
+     * @param {Number} row The row to check
+     *
+     * @returns {Boolean}
+     **/
+    this.isRowVisible = function(row) {
+        return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow());
+    };
+
+    /**
+     * Indicates if the entire row is currently visible on the screen.
+     * @param {Number} row The row to check
+     *
+     *
+     * @returns {Boolean}
+     **/
+    this.isRowFullyVisible = function(row) {
+        return (row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow());
+    };
+
+    /**
+     * Returns the number of currently visibile rows.
+     * @returns {Number}
+     **/
+    this.$getVisibleRowCount = function() {
+        return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;
+    };
+
+    this.$moveByPage = function(dir, select) {
+        var renderer = this.renderer;
+        var config = this.renderer.layerConfig;
+        var rows = dir * Math.floor(config.height / config.lineHeight);
+
+        this.$blockScrolling++;
+        if (select == true) {
+            this.selection.$moveSelection(function(){
+                this.moveCursorBy(rows, 0);
+            });
+        } else if (select == false) {
+            this.selection.moveCursorBy(rows, 0);
+            this.selection.clearSelection();
+        }
+        this.$blockScrolling--;
+
+        var scrollTop = renderer.scrollTop;
+
+        renderer.scrollBy(0, rows * config.lineHeight);
+        if (select != null)
+            renderer.scrollCursorIntoView(null, 0.5);
+
+        renderer.animateScrolling(scrollTop);
+    };
+
+    /**
+     * Selects the text from the current position of the document until where a "page down" finishes.
+     **/
+    this.selectPageDown = function() {
+        this.$moveByPage(1, true);
+    };
+
+    /**
+     * Selects the text from the current position of the document until where a "page up" finishes.
+     **/
+    this.selectPageUp = function() {
+        this.$moveByPage(-1, true);
+    };
+
+    /**
+     * Shifts the document to wherever "page down" is, as well as moving the cursor position.
+     **/
+    this.gotoPageDown = function() {
+       this.$moveByPage(1, false);
+    };
+
+    /**
+     * Shifts the document to wherever "page up" is, as well as moving the cursor position.
+     **/
+    this.gotoPageUp = function() {
+        this.$moveByPage(-1, false);
+    };
+
+    /**
+     * Scrolls the document to wherever "page down" is, without changing the cursor position.
+     **/
+    this.scrollPageDown = function() {
+        this.$moveByPage(1);
+    };
+
+    /**
+     * Scrolls the document to wherever "page up" is, without changing the cursor position.
+     **/
+    this.scrollPageUp = function() {
+        this.$moveByPage(-1);
+    };
+
+    /**
+     * Moves the editor to the specified row.
+     * @related VirtualRenderer.scrollToRow
+     **/
+    this.scrollToRow = function(row) {
+        this.renderer.scrollToRow(row);
+    };
+
+    /**
+     * Scrolls to a line. If `center` is `true`, it puts the line in middle of screen (or attempts to).
+     * @param {Number} line The line to scroll to
+     * @param {Boolean} center If `true`
+     * @param {Boolean} animate If `true` animates scrolling
+     * @param {Function} callback Function to be called when the animation has finished
+     *
+     *
+     * @related VirtualRenderer.scrollToLine
+     **/
+    this.scrollToLine = function(line, center, animate, callback) {
+        this.renderer.scrollToLine(line, center, animate, callback);
+    };
+
+    /**
+     * Attempts to center the current selection on the screen.
+     **/
+    this.centerSelection = function() {
+        var range = this.getSelectionRange();
+        var pos = {
+            row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2),
+            column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2)
+        }
+        this.renderer.alignCursor(pos, 0.5);
+    };
+
+    /**
+     * Gets the current position of the cursor.
+     * @returns {Object} An object that looks something like this:
+     *
+     * ```json
+     * { row: currRow, column: currCol }
+     * ```
+     *
+     * @related Selection.getCursor
+     **/
+    this.getCursorPosition = function() {
+        return this.selection.getCursor();
+    };
+
+    /**
+     * Returns the screen position of the cursor.
+     * @returns {Number}
+     * @related EditSession.documentToScreenPosition
+     **/
+    this.getCursorPositionScreen = function() {
+        return this.session.documentToScreenPosition(this.getCursorPosition());
+    };
+
+    /**
+     * {:Selection.getRange}
+     * @returns {Range}
+     * @related Selection.getRange
+     **/
+    this.getSelectionRange = function() {
+        return this.selection.getRange();
+    };
+
+
+    /**
+     * Selects all the text in editor.
+     * @related Selection.selectAll
+     **/
+    this.selectAll = function() {
+        this.$blockScrolling += 1;
+        this.selection.selectAll();
+        this.$blockScrolling -= 1;
+    };
+
+    /**
+     * {:Selection.clearSelection}
+     * @related Selection.clearSelection
+     **/
+    this.clearSelection = function() {
+        this.selection.clearSelection();
+    };
+
+    /**
+     * Moves the cursor to the specified row and column. Note that this does not de-select the current selection.
+     * @param {Number} row The new row number
+     * @param {Number} column The new column number
+     *
+     *
+     * @related Selection.moveCursorTo
+     **/
+    this.moveCursorTo = function(row, column) {
+        this.selection.moveCursorTo(row, column);
+    };
+
+    /**
+     * Moves the cursor to the position indicated by `pos.row` and `pos.column`.
+     * @param {Object} pos An object with two properties, row and column
+     *
+     *
+     * @related Selection.moveCursorToPosition
+     **/
+    this.moveCursorToPosition = function(pos) {
+        this.selection.moveCursorToPosition(pos);
+    };
+
+    /**
+     * Moves the cursor's row and column to the next matching bracket.
+     *
+     **/
+    this.jumpToMatching = function(select) {
+        var cursor = this.getCursorPosition();
+
+        var range = this.session.getBracketRange(cursor);
+        if (!range) {
+            range = this.find({
+                needle: /[{}()\[\]]/g,
+                preventScroll:true,
+                start: {row: cursor.row, column: cursor.column - 1}
+            });
+            if (!range)
+                return;
+            var pos = range.start;
+            if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2)
+                range = this.session.getBracketRange(pos);
+        }
+
+        pos = range && range.cursor || pos;
+        if (pos) {
+            if (select) {
+                if (range && range.isEqual(this.getSelectionRange()))
+                    this.clearSelection();
+                else
+                    this.selection.selectTo(pos.row, pos.column);
+            } else {
+                this.clearSelection();
+                this.moveCursorTo(pos.row, pos.column);
+            }
+        }
+    };
+
+    /**
+     * Moves the cursor to the specified line number, and also into the indiciated column.
+     * @param {Number} lineNumber The line number to go to
+     * @param {Number} column A column number to go to
+     * @param {Boolean} animate If `true` animates scolling
+     *
+     **/
+    this.gotoLine = function(lineNumber, column, animate) {
+        this.selection.clearSelection();
+        this.session.unfold({row: lineNumber - 1, column: column || 0});
+
+        this.$blockScrolling += 1;
+        // todo: find a way to automatically exit multiselect mode
+        this.exitMultiSelectMode && this.exitMultiSelectMode();
+        this.moveCursorTo(lineNumber - 1, column || 0);
+        this.$blockScrolling -= 1;
+
+        if (!this.isRowFullyVisible(lineNumber - 1))
+            this.scrollToLine(lineNumber - 1, true, animate);
+    };
+
+    /**
+     * Moves the cursor to the specified row and column. Note that this does de-select the current selection.
+     * @param {Number} row The new row number
+     * @param {Number} column The new column number
+     *
+     *
+     * @related Editor.moveCursorTo
+     **/
+    this.navigateTo = function(row, column) {
+        this.clearSelection();
+        this.moveCursorTo(row, column);
+    };
+
+    /**
+     * Moves the cursor up in the document the specified number of times. Note that this does de-select the current selection.
+     * @param {Number} times The number of times to change navigation
+     *
+     *
+     **/
+    this.navigateUp = function(times) {
+        if (this.selection.isMultiLine() && !this.selection.isBackwards()) {
+            var selectionStart = this.selection.anchor.getPosition();
+            return this.moveCursorToPosition(selectionStart);
+        }
+        this.selection.clearSelection();
+        times = times || 1;
+        this.selection.moveCursorBy(-times, 0);
+    };
+
+    /**
+     * Moves the cursor down in the document the specified number of times. Note that this does de-select the current selection.
+     * @param {Number} times The number of times to change navigation
+     *
+     *
+     **/
+    this.navigateDown = function(times) {
+        if (this.selection.isMultiLine() && this.selection.isBackwards()) {
+            var selectionEnd = this.selection.anchor.getPosition();
+            return this.moveCursorToPosition(selectionEnd);
+        }
+        this.selection.clearSelection();
+        times = times || 1;
+        this.selection.moveCursorBy(times, 0);
+    };
+
+    /**
+     * Moves the cursor left in the document the specified number of times. Note that this does de-select the current selection.
+     * @param {Number} times The number of times to change navigation
+     *
+     *
+     **/
+    this.navigateLeft = function(times) {
+        if (!this.selection.isEmpty()) {
+            var selectionStart = this.getSelectionRange().start;
+            this.moveCursorToPosition(selectionStart);
+        }
+        else {
+            times = times || 1;
+            while (times--) {
+                this.selection.moveCursorLeft();
+            }
+        }
+        this.clearSelection();
+    };
+
+    /**
+     * Moves the cursor right in the document the specified number of times. Note that this does de-select the current selection.
+     * @param {Number} times The number of times to change navigation
+     *
+     *
+     **/
+    this.navigateRight = function(times) {
+        if (!this.selection.isEmpty()) {
+            var selectionEnd = this.getSelectionRange().end;
+            this.moveCursorToPosition(selectionEnd);
+        }
+        else {
+            times = times || 1;
+            while (times--) {
+                this.selection.moveCursorRight();
+            }
+        }
+        this.clearSelection();
+    };
+
+    /**
+     *
+     * Moves the cursor to the start of the current line. Note that this does de-select the current selection.
+     **/
+    this.navigateLineStart = function() {
+        this.selection.moveCursorLineStart();
+        this.clearSelection();
+    };
+
+    /**
+     *
+     * Moves the cursor to the end of the current line. Note that this does de-select the current selection.
+     **/
+    this.navigateLineEnd = function() {
+        this.selection.moveCursorLineEnd();
+        this.clearSelection();
+    };
+
+    /**
+     *
+     * Moves the cursor to the end of the current file. Note that this does de-select the current selection.
+     **/
+    this.navigateFileEnd = function() {
+        var scrollTop = this.renderer.scrollTop;
+        this.selection.moveCursorFileEnd();
+        this.clearSelection();
+        this.renderer.animateScrolling(scrollTop);
+    };
+
+    /**
+     *
+     * Moves the cursor to the start of the current file. Note that this does de-select the current selection.
+     **/
+    this.navigateFileStart = function() {
+        var scrollTop = this.renderer.scrollTop;
+        this.selection.moveCursorFileStart();
+        this.clearSelection();
+        this.renderer.animateScrolling(scrollTop);
+    };
+
+    /**
+     *
+     * Moves the cursor to the word immediately to the right of the current position. Note that this does de-select the current selection.
+     **/
+    this.navigateWordRight = function() {
+        this.selection.moveCursorWordRight();
+        this.clearSelection();
+    };
+
+    /**
+     *
+     * Moves the cursor to the word immediately to the left of the current position. Note that this does de-select the current selection.
+     **/
+    this.navigateWordLeft = function() {
+        this.selection.moveCursorWordLeft();
+        this.clearSelection();
+    };
+
+    /**
+     * Replaces the first occurance of `options.needle` with the value in `replacement`.
+     * @param {String} replacement The text to replace with
+     * @param {Object} options The [[Search `Search`]] options to use
+     *
+     *
+     **/
+    this.replace = function(replacement, options) {
+        if (options)
+            this.$search.set(options);
+
+        var range = this.$search.find(this.session);
+        var replaced = 0;
+        if (!range)
+            return replaced;
+
+        if (this.$tryReplace(range, replacement)) {
+            replaced = 1;
+        }
+        if (range !== null) {
+            this.selection.setSelectionRange(range);
+            this.renderer.scrollSelectionIntoView(range.start, range.end);
+        }
+
+        return replaced;
+    };
+
+    /**
+     * Replaces all occurances of `options.needle` with the value in `replacement`.
+     * @param {String} replacement The text to replace with
+     * @param {Object} options The [[Search `Search`]] options to use
+     *
+     *
+     **/
+    this.replaceAll = function(replacement, options) {
+        if (options) {
+            this.$search.set(options);
+        }
+
+        var ranges = this.$search.findAll(this.session);
+        var replaced = 0;
+        if (!ranges.length)
+            return replaced;
+
+        this.$blockScrolling += 1;
+
+        var selection = this.getSelectionRange();
+        this.clearSelection();
+        this.selection.moveCursorTo(0, 0);
+
+        for (var i = ranges.length - 1; i >= 0; --i) {
+            if(this.$tryReplace(ranges[i], replacement)) {
+                replaced++;
+            }
+        }
+
+        this.selection.setSelectionRange(selection);
+        this.$blockScrolling -= 1;
+
+        return replaced;
+    };
+
+    this.$tryReplace = function(range, replacement) {
+        var input = this.session.getTextRange(range);
+        replacement = this.$search.replace(input, replacement);
+        if (replacement !== null) {
+            range.end = this.session.replace(range, replacement);
+            return range;
+        } else {
+            return null;
+        }
+    };
+
+    /**
+     * {:Search.getOptions} For more information on `options`, see [[Search `Search`]].
+     * @related Search.getOptions
+     * @returns {Object}
+     **/
+    this.getLastSearchOptions = function() {
+        return this.$search.getOptions();
+    };
+
+    /**
+     * Attempts to find `needle` within the document. For more information on `options`, see [[Search `Search`]].
+     * @param {String} needle The text to search for (optional)
+     * @param {Object} options An object defining various search properties
+     * @param {Boolean} animate If `true` animate scrolling
+     *
+     *
+     * @related Search.find
+     **/
+    this.find = function(needle, options, animate) {
+        if (!options)
+            options = {};
+
+        if (typeof needle == "string" || needle instanceof RegExp)
+            options.needle = needle;
+        else if (typeof needle == "object")
+            oop.mixin(options, needle);
+
+        var range = this.selection.getRange();
+        if (options.needle == null) {
+            needle = this.session.getTextRange(range)
+                || this.$search.$options.needle;
+            if (!needle) {
+                range = this.session.getWordRange(range.start.row, range.start.column);
+                needle = this.session.getTextRange(range);
+            }
+            this.$search.set({needle: needle});
+        }
+
+        this.$search.set(options);
+        if (!options.start)
+            this.$search.set({start: range});
+
+        var newRange = this.$search.find(this.session);
+        if (options.preventScroll)
+            return newRange;
+        if (newRange) {
+            this.revealRange(newRange, animate);
+            return newRange;
+        }
+        // clear selection if nothing is found
+        if (options.backwards)
+            range.start = range.end;
+        else
+            range.end = range.start;
+        this.selection.setRange(range);
+    };
+
+    /**
+     * Performs another search for `needle` in the document. For more information on `options`, see [[Search `Search`]].
+     * @param {Object} options search options
+     * @param {Boolean} animate If `true` animate scrolling
+     *
+     *
+     * @related Editor.find
+     **/
+    this.findNext = function(options, animate) {
+        this.find({skipCurrent: true, backwards: false}, options, animate);
+    };
+
+    /**
+     * Performs a search for `needle` backwards. For more information on `options`, see [[Search `Search`]].
+     * @param {Object} options search options
+     * @param {Boolean} animate If `true` animate scrolling
+     *
+     *
+     * @related Editor.find
+     **/
+    this.findPrevious = function(options, animate) {
+        this.find(options, {skipCurrent: true, backwards: true}, animate);
+    };
+
+    this.revealRange = function(range, animate) {
+        this.$blockScrolling += 1;
+        this.session.unfold(range);
+        this.selection.setSelectionRange(range);
+        this.$blockScrolling -= 1;
+
+        var scrollTop = this.renderer.scrollTop;
+        this.renderer.scrollSelectionIntoView(range.start, range.end, 0.5);
+        if (animate != false)
+            this.renderer.animateScrolling(scrollTop);
+    };
+
+    /**
+     * {:UndoManager.undo}
+     * @related UndoManager.undo
+     **/
+    this.undo = function() {
+        this.$blockScrolling++;
+        this.session.getUndoManager().undo();
+        this.$blockScrolling--;
+        this.renderer.scrollCursorIntoView(null, 0.5);
+    };
+
+    /**
+     * {:UndoManager.redo}
+     * @related UndoManager.redo
+     **/
+    this.redo = function() {
+        this.$blockScrolling++;
+        this.session.getUndoManager().redo();
+        this.$blockScrolling--;
+        this.renderer.scrollCursorIntoView(null, 0.5);
+    };
+
+    /**
+     *
+     * Cleans up the entire editor.
+     **/
+    this.destroy = function() {
+        this.renderer.destroy();
+        this._emit("destroy", this);
+    };
+
+    /**
+     * Enables automatic scrolling of the cursor into view when editor itself is inside scrollable element
+     * @param {Boolean} enable default true
+     **/
+    this.setAutoScrollEditorIntoView = function(enable) {
+        if (enable === false)
+            return;
+        var rect;
+        var self = this;
+        var shouldScroll = false;
+        if (!this.$scrollAnchor)
+            this.$scrollAnchor = document.createElement("div");
+        var scrollAnchor = this.$scrollAnchor;
+        scrollAnchor.style.cssText = "position:absolute";
+        this.container.insertBefore(scrollAnchor, this.container.firstChild);
+        var onChangeSelection = this.on("changeSelection", function() {
+            shouldScroll = true;
+        });
+        // needed to not trigger sync reflow
+        var onBeforeRender = this.renderer.on("beforeRender", function() {
+            if (shouldScroll)
+                rect = self.renderer.container.getBoundingClientRect();
+        });
+        var onAfterRender = this.renderer.on("afterRender", function() {
+            if (shouldScroll && rect && self.isFocused()) {
+                var renderer = self.renderer;
+                var pos = renderer.$cursorLayer.$pixelPos;
+                var config = renderer.layerConfig;
+                var top = pos.top - config.offset;
+                if (pos.top >= 0 && top + rect.top < 0) {
+                    shouldScroll = true;
+                } else if (pos.top < config.height &&
+                    pos.top + rect.top + config.lineHeight > window.innerHeight) {
+                    shouldScroll = false;
+                } else {
+                    shouldScroll = null;
+                }
+                if (shouldScroll != null) {
+                    scrollAnchor.style.top = top + "px";
+                    scrollAnchor.style.left = pos.left + "px";
+                    scrollAnchor.style.height = config.lineHeight + "px";
+                    scrollAnchor.scrollIntoView(shouldScroll);
+                }
+                shouldScroll = rect = null;
+            }
+        });
+        this.setAutoScrollEditorIntoView = function(enable) {
+            if (enable === true)
+                return;
+            delete this.setAutoScrollEditorIntoView;
+            this.removeEventListener("changeSelection", onChangeSelection);
+            this.renderer.removeEventListener("afterRender", onAfterRender);
+            this.renderer.removeEventListener("beforeRender", onBeforeRender);
+        };
+    };
+
+
+    this.$resetCursorStyle = function() {
+        var style = this.$cursorStyle || "ace";
+        var cursorLayer = this.renderer.$cursorLayer;
+        if (!cursorLayer)
+            return;
+        cursorLayer.setSmoothBlinking(style == "smooth");
+        cursorLayer.isBlinking = !this.$readOnly && style != "wide";
+    };
+
+}).call(Editor.prototype);
+
+
+
+config.defineOptions(Editor.prototype, "editor", {
+    selectionStyle: {
+        set: function(style) {
+            this.onSelectionChange();
+            this._emit("changeSelectionStyle", {data: style});
+        },
+        initialValue: "line"
+    },
+    highlightActiveLine: {
+        set: function() {this.$updateHighlightActiveLine();},
+        initialValue: true
+    },
+    highlightSelectedWord: {
+        set: function(shouldHighlight) {this.$onSelectionChange();},
+        initialValue: true
+    },
+    readOnly: {
+        set: function(readOnly) {
+            this.textInput.setReadOnly(readOnly); 
+            this.$resetCursorStyle(); 
+        },
+        initialValue: false
+    },
+    cursorStyle: {
+        set: function(val) { this.$resetCursorStyle(); },
+        values: ["ace", "slim", "smooth", "wide"],
+        initialValue: "ace"
+    },
+    mergeUndoDeltas: {
+        values: [false, true, "always"],
+        initialValue: true
+    },
+    behavioursEnabled: {initialValue: true},
+    wrapBehavioursEnabled: {initialValue: true},
+
+    hScrollBarAlwaysVisible: "renderer",
+    vScrollBarAlwaysVisible: "renderer",
+    highlightGutterLine: "renderer",
+    animatedScroll: "renderer",
+    showInvisibles: "renderer",
+    showPrintMargin: "renderer",
+    printMarginColumn: "renderer",
+    printMargin: "renderer",
+    fadeFoldWidgets: "renderer",
+    showFoldWidgets: "renderer",
+    showGutter: "renderer",
+    displayIndentGuides: "renderer",
+    fontSize: "renderer",
+    fontFamily: "renderer",
+    maxLines: "renderer",
+    minLines: "renderer",
+    scrollPastEnd: "renderer",
+    fixedWidthGutter: "renderer",
+
+    scrollSpeed: "$mouseHandler",
+    dragDelay: "$mouseHandler",
+    dragEnabled: "$mouseHandler",
+    focusTimout: "$mouseHandler",
+
+    firstLineNumber: "session",
+    overwrite: "session",
+    newLineMode: "session",
+    useWorker: "session",
+    useSoftTabs: "session",
+    tabSize: "session",
+    wrap: "session",
+    foldStyle: "session"
+});
+
+exports.Editor = Editor;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/editor_change_document_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/editor_change_document_test.js b/src/fauxton/assets/js/libs/ace/editor_change_document_test.js
new file mode 100644
index 0000000..a1fdaad
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/editor_change_document_test.js
@@ -0,0 +1,188 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+    require("./test/mockdom");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("./edit_session").EditSession;
+var Editor = require("./editor").Editor;
+var Text = require("./mode/text").Mode;
+var JavaScriptMode = require("./mode/javascript").Mode;
+var CssMode = require("./mode/css").Mode;
+var HtmlMode = require("./mode/html").Mode;
+var MockRenderer = require("./test/mockrenderer").MockRenderer;
+var assert = require("./test/assertions");
+
+module.exports = {
+
+    setUp : function(next) {
+        this.session1 = new EditSession(["abc", "def"]);
+        this.session2 = new EditSession(["ghi", "jkl"]);
+        
+        
+        this.editor = new Editor(new MockRenderer());
+        next();
+    },
+
+    "test: change document" : function() {
+        this.editor.setSession(this.session1);
+        assert.equal(this.editor.getSession(), this.session1);
+
+        this.editor.setSession(this.session2);
+        assert.equal(this.editor.getSession(), this.session2);
+    },
+
+    "test: only changes to the new document should have effect" : function() {
+        var called = false;
+        this.editor.onDocumentChange = function() {
+            called = true;
+        };
+
+        this.editor.setSession(this.session1);
+        this.editor.setSession(this.session2);
+
+        this.session1.duplicateLines(0, 0);
+        assert.notOk(called);
+
+        this.session2.duplicateLines(0, 0);
+        assert.ok(called);
+    },
+
+    "test: should use cursor of new document" : function() {
+        this.session1.getSelection().moveCursorTo(0, 1);
+        this.session2.getSelection().moveCursorTo(1, 0);
+
+        this.editor.setSession(this.session1);
+        assert.position(this.editor.getCursorPosition(), 0, 1);
+
+        this.editor.setSession(this.session2);
+        assert.position(this.editor.getCursorPosition(), 1, 0);
+    },
+
+    "test: only changing the cursor of the new doc should not have an effect" : function() {
+        this.editor.onCursorChange = function() {
+            called = true;
+        };
+
+        this.editor.setSession(this.session1);
+        this.editor.setSession(this.session2);
+        assert.position(this.editor.getCursorPosition(), 0, 0);
+
+        var called = false;
+        this.session1.getSelection().moveCursorTo(0, 1);
+        assert.position(this.editor.getCursorPosition(), 0, 0);
+        assert.notOk(called);
+
+        this.session2.getSelection().moveCursorTo(1, 1);
+        assert.position(this.editor.getCursorPosition(), 1, 1);
+        assert.ok(called);
+    },
+
+    "test: should use selection of new document" : function() {
+        this.session1.getSelection().selectTo(0, 1);
+        this.session2.getSelection().selectTo(1, 0);
+
+        this.editor.setSession(this.session1);
+        assert.position(this.editor.getSelection().getSelectionLead(), 0, 1);
+
+        this.editor.setSession(this.session2);
+        assert.position(this.editor.getSelection().getSelectionLead(), 1, 0);
+    },
+
+    "test: only changing the selection of the new doc should not have an effect" : function() {
+        this.editor.onSelectionChange = function() {
+            called = true;
+        };
+
+        this.editor.setSession(this.session1);
+        this.editor.setSession(this.session2);
+        assert.position(this.editor.getSelection().getSelectionLead(), 0, 0);
+
+        var called = false;
+        this.session1.getSelection().selectTo(0, 1);
+        assert.position(this.editor.getSelection().getSelectionLead(), 0, 0);
+        assert.notOk(called);
+
+        this.session2.getSelection().selectTo(1, 1);
+        assert.position(this.editor.getSelection().getSelectionLead(), 1, 1);
+        assert.ok(called);
+    },
+
+    "test: should use mode of new document" : function() {
+        this.editor.onChangeMode = function() {
+            called = true;
+        };
+        this.editor.setSession(this.session1);
+        this.editor.setSession(this.session2);
+
+        var called = false;
+        this.session1.setMode(new Text());
+        assert.notOk(called);
+
+        this.session2.setMode(new JavaScriptMode());
+        assert.ok(called);
+    },
+    
+    "test: should use stop worker of old document" : function(next) {
+        var self = this;
+        
+        // 1. Open an editor and set the session to CssMode
+        self.editor.setSession(self.session1);
+        self.session1.setMode(new CssMode());
+        
+        // 2. Add a line or two of valid CSS.
+        self.session1.setValue("DIV { color: red; }");
+        
+        // 3. Clear the session value.
+        self.session1.setValue("");
+        
+        // 4. Set the session to HtmlMode
+        self.session1.setMode(new HtmlMode());
+
+        // 5. Try to type valid HTML
+        self.session1.insert({row: 0, column: 0}, "<html></html>");
+        
+        setTimeout(function() {
+            assert.equal(Object.keys(self.session1.getAnnotations()).length, 0);
+            next();
+        }, 600);
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}


[27/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/coffee/lexer.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/coffee/lexer.js b/src/fauxton/assets/js/libs/ace/mode/coffee/lexer.js
new file mode 100644
index 0000000..ed02bfe
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/coffee/lexer.js
@@ -0,0 +1,929 @@
+/**
+ * Copyright (c) 2009-2013 Jeremy Ashkenas
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ */
+
+define(function(require, exports, module) {
+// Generated by CoffeeScript 1.6.3
+
+  var BOM, BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, STRICT_PROSCRIBED, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, invertLiterate, key, last, locationDataToString, repeat, starts, throwSyntaxError, _ref, _ref1,
+    __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+
+  _ref = require('./rewriter'), Rewriter = _ref.Rewriter, INVERSES = _ref.INVERSES;
+
+  _ref1 = require('./helpers'), count = _ref1.count, starts = _ref1.starts, compact = _ref1.compact, last = _ref1.last, repeat = _ref1.repeat, invertLiterate = _ref1.invertLiterate, locationDataToString = _ref1.locationDataToString, throwSyntaxError = _ref1.throwSyntaxError;
+
+  exports.Lexer = Lexer = (function() {
+    function Lexer() {}
+
+    Lexer.prototype.tokenize = function(code, opts) {
+      var consumed, i, tag, _ref2;
+      if (opts == null) {
+        opts = {};
+      }
+      this.literate = opts.literate;
+      this.indent = 0;
+      this.baseIndent = 0;
+      this.indebt = 0;
+      this.outdebt = 0;
+      this.indents = [];
+      this.ends = [];
+      this.tokens = [];
+      this.chunkLine = opts.line || 0;
+      this.chunkColumn = opts.column || 0;
+      code = this.clean(code);
+      i = 0;
+      while (this.chunk = code.slice(i)) {
+        consumed = this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.heredocToken() || this.stringToken() || this.numberToken() || this.regexToken() || this.jsToken() || this.literalToken();
+        _ref2 = this.getLineAndColumnFromChunk(consumed), this.chunkLine = _ref2[0], this.chunkColumn = _ref2[1];
+        i += consumed;
+      }
+      this.closeIndentation();
+      if (tag = this.ends.pop()) {
+        this.error("missing " + tag);
+      }
+      if (opts.rewrite === false) {
+        return this.tokens;
+      }
+      return (new Rewriter).rewrite(this.tokens);
+    };
+
+    Lexer.prototype.clean = function(code) {
+      if (code.charCodeAt(0) === BOM) {
+        code = code.slice(1);
+      }
+      code = code.replace(/\r/g, '').replace(TRAILING_SPACES, '');
+      if (WHITESPACE.test(code)) {
+        code = "\n" + code;
+        this.chunkLine--;
+      }
+      if (this.literate) {
+        code = invertLiterate(code);
+      }
+      return code;
+    };
+
+    Lexer.prototype.identifierToken = function() {
+      var colon, colonOffset, forcedIdentifier, id, idLength, input, match, poppedToken, prev, tag, tagToken, _ref2, _ref3, _ref4;
+      if (!(match = IDENTIFIER.exec(this.chunk))) {
+        return 0;
+      }
+      input = match[0], id = match[1], colon = match[2];
+      idLength = id.length;
+      poppedToken = void 0;
+      if (id === 'own' && this.tag() === 'FOR') {
+        this.token('OWN', id);
+        return id.length;
+      }
+      forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref2 = prev[0]) === '.' || _ref2 === '?.' || _ref2 === '::' || _ref2 === '?::') || !prev.spaced && prev[0] === '@');
+      tag = 'IDENTIFIER';
+      if (!forcedIdentifier && (__indexOf.call(JS_KEYWORDS, id) >= 0 || __indexOf.call(COFFEE_KEYWORDS, id) >= 0)) {
+        tag = id.toUpperCase();
+        if (tag === 'WHEN' && (_ref3 = this.tag(), __indexOf.call(LINE_BREAK, _ref3) >= 0)) {
+          tag = 'LEADING_WHEN';
+        } else if (tag === 'FOR') {
+          this.seenFor = true;
+        } else if (tag === 'UNLESS') {
+          tag = 'IF';
+        } else if (__indexOf.call(UNARY, tag) >= 0) {
+          tag = 'UNARY';
+        } else if (__indexOf.call(RELATION, tag) >= 0) {
+          if (tag !== 'INSTANCEOF' && this.seenFor) {
+            tag = 'FOR' + tag;
+            this.seenFor = false;
+          } else {
+            tag = 'RELATION';
+            if (this.value() === '!') {
+              poppedToken = this.tokens.pop();
+              id = '!' + id;
+            }
+          }
+        }
+      }
+      if (__indexOf.call(JS_FORBIDDEN, id) >= 0) {
+        if (forcedIdentifier) {
+          tag = 'IDENTIFIER';
+          id = new String(id);
+          id.reserved = true;
+        } else if (__indexOf.call(RESERVED, id) >= 0) {
+          this.error("reserved word \"" + id + "\"");
+        }
+      }
+      if (!forcedIdentifier) {
+        if (__indexOf.call(COFFEE_ALIASES, id) >= 0) {
+          id = COFFEE_ALIAS_MAP[id];
+        }
+        tag = (function() {
+          switch (id) {
+            case '!':
+              return 'UNARY';
+            case '==':
+            case '!=':
+              return 'COMPARE';
+            case '&&':
+            case '||':
+              return 'LOGIC';
+            case 'true':
+            case 'false':
+              return 'BOOL';
+            case 'break':
+            case 'continue':
+              return 'STATEMENT';
+            default:
+              return tag;
+          }
+        })();
+      }
+      tagToken = this.token(tag, id, 0, idLength);
+      if (poppedToken) {
+        _ref4 = [poppedToken[2].first_line, poppedToken[2].first_column], tagToken[2].first_line = _ref4[0], tagToken[2].first_column = _ref4[1];
+      }
+      if (colon) {
+        colonOffset = input.lastIndexOf(':');
+        this.token(':', ':', colonOffset, colon.length);
+      }
+      return input.length;
+    };
+
+    Lexer.prototype.numberToken = function() {
+      var binaryLiteral, lexedLength, match, number, octalLiteral;
+      if (!(match = NUMBER.exec(this.chunk))) {
+        return 0;
+      }
+      number = match[0];
+      if (/^0[BOX]/.test(number)) {
+        this.error("radix prefix '" + number + "' must be lowercase");
+      } else if (/E/.test(number) && !/^0x/.test(number)) {
+        this.error("exponential notation '" + number + "' must be indicated with a lowercase 'e'");
+      } else if (/^0\d*[89]/.test(number)) {
+        this.error("decimal literal '" + number + "' must not be prefixed with '0'");
+      } else if (/^0\d+/.test(number)) {
+        this.error("octal literal '" + number + "' must be prefixed with '0o'");
+      }
+      lexedLength = number.length;
+      if (octalLiteral = /^0o([0-7]+)/.exec(number)) {
+        number = '0x' + parseInt(octalLiteral[1], 8).toString(16);
+      }
+      if (binaryLiteral = /^0b([01]+)/.exec(number)) {
+        number = '0x' + parseInt(binaryLiteral[1], 2).toString(16);
+      }
+      this.token('NUMBER', number, 0, lexedLength);
+      return lexedLength;
+    };
+
+    Lexer.prototype.stringToken = function() {
+      var match, octalEsc, string;
+      switch (this.chunk.charAt(0)) {
+        case "'":
+          if (!(match = SIMPLESTR.exec(this.chunk))) {
+            return 0;
+          }
+          string = match[0];
+          this.token('STRING', string.replace(MULTILINER, '\\\n'), 0, string.length);
+          break;
+        case '"':
+          if (!(string = this.balancedString(this.chunk, '"'))) {
+            return 0;
+          }
+          if (0 < string.indexOf('#{', 1)) {
+            this.interpolateString(string.slice(1, -1), {
+              strOffset: 1,
+              lexedLength: string.length
+            });
+          } else {
+            this.token('STRING', this.escapeLines(string, 0, string.length));
+          }
+          break;
+        default:
+          return 0;
+      }
+      if (octalEsc = /^(?:\\.|[^\\])*\\(?:0[0-7]|[1-7])/.test(string)) {
+        this.error("octal escape sequences " + string + " are not allowed");
+      }
+      return string.length;
+    };
+
+    Lexer.prototype.heredocToken = function() {
+      var doc, heredoc, match, quote;
+      if (!(match = HEREDOC.exec(this.chunk))) {
+        return 0;
+      }
+      heredoc = match[0];
+      quote = heredoc.charAt(0);
+      doc = this.sanitizeHeredoc(match[2], {
+        quote: quote,
+        indent: null
+      });
+      if (quote === '"' && 0 <= doc.indexOf('#{')) {
+        this.interpolateString(doc, {
+          heredoc: true,
+          strOffset: 3,
+          lexedLength: heredoc.length
+        });
+      } else {
+        this.token('STRING', this.makeString(doc, quote, true), 0, heredoc.length);
+      }
+      return heredoc.length;
+    };
+
+    Lexer.prototype.commentToken = function() {
+      var comment, here, match;
+      if (!(match = this.chunk.match(COMMENT))) {
+        return 0;
+      }
+      comment = match[0], here = match[1];
+      if (here) {
+        this.token('HERECOMMENT', this.sanitizeHeredoc(here, {
+          herecomment: true,
+          indent: repeat(' ', this.indent)
+        }), 0, comment.length);
+      }
+      return comment.length;
+    };
+
+    Lexer.prototype.jsToken = function() {
+      var match, script;
+      if (!(this.chunk.charAt(0) === '`' && (match = JSTOKEN.exec(this.chunk)))) {
+        return 0;
+      }
+      this.token('JS', (script = match[0]).slice(1, -1), 0, script.length);
+      return script.length;
+    };
+
+    Lexer.prototype.regexToken = function() {
+      var flags, length, match, prev, regex, _ref2, _ref3;
+      if (this.chunk.charAt(0) !== '/') {
+        return 0;
+      }
+      if (match = HEREGEX.exec(this.chunk)) {
+        length = this.heregexToken(match);
+        return length;
+      }
+      prev = last(this.tokens);
+      if (prev && (_ref2 = prev[0], __indexOf.call((prev.spaced ? NOT_REGEX : NOT_SPACED_REGEX), _ref2) >= 0)) {
+        return 0;
+      }
+      if (!(match = REGEX.exec(this.chunk))) {
+        return 0;
+      }
+      _ref3 = match, match = _ref3[0], regex = _ref3[1], flags = _ref3[2];
+      if (regex.slice(0, 2) === '/*') {
+        this.error('regular expressions cannot begin with `*`');
+      }
+      if (regex === '//') {
+        regex = '/(?:)/';
+      }
+      this.token('REGEX', "" + regex + flags, 0, match.length);
+      return match.length;
+    };
+
+    Lexer.prototype.heregexToken = function(match) {
+      var body, flags, flagsOffset, heregex, plusToken, prev, re, tag, token, tokens, value, _i, _len, _ref2, _ref3, _ref4;
+      heregex = match[0], body = match[1], flags = match[2];
+      if (0 > body.indexOf('#{')) {
+        re = body.replace(HEREGEX_OMIT, '').replace(/\//g, '\\/');
+        if (re.match(/^\*/)) {
+          this.error('regular expressions cannot begin with `*`');
+        }
+        this.token('REGEX', "/" + (re || '(?:)') + "/" + flags, 0, heregex.length);
+        return heregex.length;
+      }
+      this.token('IDENTIFIER', 'RegExp', 0, 0);
+      this.token('CALL_START', '(', 0, 0);
+      tokens = [];
+      _ref2 = this.interpolateString(body, {
+        regex: true
+      });
+      for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+        token = _ref2[_i];
+        tag = token[0], value = token[1];
+        if (tag === 'TOKENS') {
+          tokens.push.apply(tokens, value);
+        } else if (tag === 'NEOSTRING') {
+          if (!(value = value.replace(HEREGEX_OMIT, ''))) {
+            continue;
+          }
+          value = value.replace(/\\/g, '\\\\');
+          token[0] = 'STRING';
+          token[1] = this.makeString(value, '"', true);
+          tokens.push(token);
+        } else {
+          this.error("Unexpected " + tag);
+        }
+        prev = last(this.tokens);
+        plusToken = ['+', '+'];
+        plusToken[2] = prev[2];
+        tokens.push(plusToken);
+      }
+      tokens.pop();
+      if (((_ref3 = tokens[0]) != null ? _ref3[0] : void 0) !== 'STRING') {
+        this.token('STRING', '""', 0, 0);
+        this.token('+', '+', 0, 0);
+      }
+      (_ref4 = this.tokens).push.apply(_ref4, tokens);
+      if (flags) {
+        flagsOffset = heregex.lastIndexOf(flags);
+        this.token(',', ',', flagsOffset, 0);
+        this.token('STRING', '"' + flags + '"', flagsOffset, flags.length);
+      }
+      this.token(')', ')', heregex.length - 1, 0);
+      return heregex.length;
+    };
+
+    Lexer.prototype.lineToken = function() {
+      var diff, indent, match, noNewlines, size;
+      if (!(match = MULTI_DENT.exec(this.chunk))) {
+        return 0;
+      }
+      indent = match[0];
+      this.seenFor = false;
+      size = indent.length - 1 - indent.lastIndexOf('\n');
+      noNewlines = this.unfinished();
+      if (size - this.indebt === this.indent) {
+        if (noNewlines) {
+          this.suppressNewlines();
+        } else {
+          this.newlineToken(0);
+        }
+        return indent.length;
+      }
+      if (size > this.indent) {
+        if (noNewlines) {
+          this.indebt = size - this.indent;
+          this.suppressNewlines();
+          return indent.length;
+        }
+        if (!this.tokens.length) {
+          this.baseIndent = this.indent = size;
+          return indent.length;
+        }
+        diff = size - this.indent + this.outdebt;
+        this.token('INDENT', diff, indent.length - size, size);
+        this.indents.push(diff);
+        this.ends.push('OUTDENT');
+        this.outdebt = this.indebt = 0;
+      } else if (size < this.baseIndent) {
+        this.error('missing indentation', indent.length);
+      } else {
+        this.indebt = 0;
+        this.outdentToken(this.indent - size, noNewlines, indent.length);
+      }
+      this.indent = size;
+      return indent.length;
+    };
+
+    Lexer.prototype.outdentToken = function(moveOut, noNewlines, outdentLength) {
+      var dent, len;
+      while (moveOut > 0) {
+        len = this.indents.length - 1;
+        if (this.indents[len] === void 0) {
+          moveOut = 0;
+        } else if (this.indents[len] === this.outdebt) {
+          moveOut -= this.outdebt;
+          this.outdebt = 0;
+        } else if (this.indents[len] < this.outdebt) {
+          this.outdebt -= this.indents[len];
+          moveOut -= this.indents[len];
+        } else {
+          dent = this.indents.pop() + this.outdebt;
+          moveOut -= dent;
+          this.outdebt = 0;
+          this.pair('OUTDENT');
+          this.token('OUTDENT', dent, 0, outdentLength);
+        }
+      }
+      if (dent) {
+        this.outdebt -= moveOut;
+      }
+      while (this.value() === ';') {
+        this.tokens.pop();
+      }
+      if (!(this.tag() === 'TERMINATOR' || noNewlines)) {
+        this.token('TERMINATOR', '\n', outdentLength, 0);
+      }
+      return this;
+    };
+
+    Lexer.prototype.whitespaceToken = function() {
+      var match, nline, prev;
+      if (!((match = WHITESPACE.exec(this.chunk)) || (nline = this.chunk.charAt(0) === '\n'))) {
+        return 0;
+      }
+      prev = last(this.tokens);
+      if (prev) {
+        prev[match ? 'spaced' : 'newLine'] = true;
+      }
+      if (match) {
+        return match[0].length;
+      } else {
+        return 0;
+      }
+    };
+
+    Lexer.prototype.newlineToken = function(offset) {
+      while (this.value() === ';') {
+        this.tokens.pop();
+      }
+      if (this.tag() !== 'TERMINATOR') {
+        this.token('TERMINATOR', '\n', offset, 0);
+      }
+      return this;
+    };
+
+    Lexer.prototype.suppressNewlines = function() {
+      if (this.value() === '\\') {
+        this.tokens.pop();
+      }
+      return this;
+    };
+
+    Lexer.prototype.literalToken = function() {
+      var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5;
+      if (match = OPERATOR.exec(this.chunk)) {
+        value = match[0];
+        if (CODE.test(value)) {
+          this.tagParameters();
+        }
+      } else {
+        value = this.chunk.charAt(0);
+      }
+      tag = value;
+      prev = last(this.tokens);
+      if (value === '=' && prev) {
+        if (!prev[1].reserved && (_ref2 = prev[1], __indexOf.call(JS_FORBIDDEN, _ref2) >= 0)) {
+          this.error("reserved word \"" + (this.value()) + "\" can't be assigned");
+        }
+        if ((_ref3 = prev[1]) === '||' || _ref3 === '&&') {
+          prev[0] = 'COMPOUND_ASSIGN';
+          prev[1] += '=';
+          return value.length;
+        }
+      }
+      if (value === ';') {
+        this.seenFor = false;
+        tag = 'TERMINATOR';
+      } else if (__indexOf.call(MATH, value) >= 0) {
+        tag = 'MATH';
+      } else if (__indexOf.call(COMPARE, value) >= 0) {
+        tag = 'COMPARE';
+      } else if (__indexOf.call(COMPOUND_ASSIGN, value) >= 0) {
+        tag = 'COMPOUND_ASSIGN';
+      } else if (__indexOf.call(UNARY, value) >= 0) {
+        tag = 'UNARY';
+      } else if (__indexOf.call(SHIFT, value) >= 0) {
+        tag = 'SHIFT';
+      } else if (__indexOf.call(LOGIC, value) >= 0 || value === '?' && (prev != null ? prev.spaced : void 0)) {
+        tag = 'LOGIC';
+      } else if (prev && !prev.spaced) {
+        if (value === '(' && (_ref4 = prev[0], __indexOf.call(CALLABLE, _ref4) >= 0)) {
+          if (prev[0] === '?') {
+            prev[0] = 'FUNC_EXIST';
+          }
+          tag = 'CALL_START';
+        } else if (value === '[' && (_ref5 = prev[0], __indexOf.call(INDEXABLE, _ref5) >= 0)) {
+          tag = 'INDEX_START';
+          switch (prev[0]) {
+            case '?':
+              prev[0] = 'INDEX_SOAK';
+          }
+        }
+      }
+      switch (value) {
+        case '(':
+        case '{':
+        case '[':
+          this.ends.push(INVERSES[value]);
+          break;
+        case ')':
+        case '}':
+        case ']':
+          this.pair(value);
+      }
+      this.token(tag, value);
+      return value.length;
+    };
+
+    Lexer.prototype.sanitizeHeredoc = function(doc, options) {
+      var attempt, herecomment, indent, match, _ref2;
+      indent = options.indent, herecomment = options.herecomment;
+      if (herecomment) {
+        if (HEREDOC_ILLEGAL.test(doc)) {
+          this.error("block comment cannot contain \"*/\", starting");
+        }
+        if (doc.indexOf('\n') < 0) {
+          return doc;
+        }
+      } else {
+        while (match = HEREDOC_INDENT.exec(doc)) {
+          attempt = match[1];
+          if (indent === null || (0 < (_ref2 = attempt.length) && _ref2 < indent.length)) {
+            indent = attempt;
+          }
+        }
+      }
+      if (indent) {
+        doc = doc.replace(RegExp("\\n" + indent, "g"), '\n');
+      }
+      if (!herecomment) {
+        doc = doc.replace(/^\n/, '');
+      }
+      return doc;
+    };
+
+    Lexer.prototype.tagParameters = function() {
+      var i, stack, tok, tokens;
+      if (this.tag() !== ')') {
+        return this;
+      }
+      stack = [];
+      tokens = this.tokens;
+      i = tokens.length;
+      tokens[--i][0] = 'PARAM_END';
+      while (tok = tokens[--i]) {
+        switch (tok[0]) {
+          case ')':
+            stack.push(tok);
+            break;
+          case '(':
+          case 'CALL_START':
+            if (stack.length) {
+              stack.pop();
+            } else if (tok[0] === '(') {
+              tok[0] = 'PARAM_START';
+              return this;
+            } else {
+              return this;
+            }
+        }
+      }
+      return this;
+    };
+
+    Lexer.prototype.closeIndentation = function() {
+      return this.outdentToken(this.indent);
+    };
+
+    Lexer.prototype.balancedString = function(str, end) {
+      var continueCount, i, letter, match, prev, stack, _i, _ref2;
+      continueCount = 0;
+      stack = [end];
+      for (i = _i = 1, _ref2 = str.length; 1 <= _ref2 ? _i < _ref2 : _i > _ref2; i = 1 <= _ref2 ? ++_i : --_i) {
+        if (continueCount) {
+          --continueCount;
+          continue;
+        }
+        switch (letter = str.charAt(i)) {
+          case '\\':
+            ++continueCount;
+            continue;
+          case end:
+            stack.pop();
+            if (!stack.length) {
+              return str.slice(0, +i + 1 || 9e9);
+            }
+            end = stack[stack.length - 1];
+            continue;
+        }
+        if (end === '}' && (letter === '"' || letter === "'")) {
+          stack.push(end = letter);
+        } else if (end === '}' && letter === '/' && (match = HEREGEX.exec(str.slice(i)) || REGEX.exec(str.slice(i)))) {
+          continueCount += match[0].length - 1;
+        } else if (end === '}' && letter === '{') {
+          stack.push(end = '}');
+        } else if (end === '"' && prev === '#' && letter === '{') {
+          stack.push(end = '}');
+        }
+        prev = letter;
+      }
+      return this.error("missing " + (stack.pop()) + ", starting");
+    };
+
+    Lexer.prototype.interpolateString = function(str, options) {
+      var column, expr, heredoc, i, inner, interpolated, len, letter, lexedLength, line, locationToken, nested, offsetInChunk, pi, plusToken, popped, regex, rparen, strOffset, tag, token, tokens, value, _i, _len, _ref2, _ref3, _ref4;
+      if (options == null) {
+        options = {};
+      }
+      heredoc = options.heredoc, regex = options.regex, offsetInChunk = options.offsetInChunk, strOffset = options.strOffset, lexedLength = options.lexedLength;
+      offsetInChunk = offsetInChunk || 0;
+      strOffset = strOffset || 0;
+      lexedLength = lexedLength || str.length;
+      if (heredoc && str.length > 0 && str[0] === '\n') {
+        str = str.slice(1);
+        strOffset++;
+      }
+      tokens = [];
+      pi = 0;
+      i = -1;
+      while (letter = str.charAt(i += 1)) {
+        if (letter === '\\') {
+          i += 1;
+          continue;
+        }
+        if (!(letter === '#' && str.charAt(i + 1) === '{' && (expr = this.balancedString(str.slice(i + 1), '}')))) {
+          continue;
+        }
+        if (pi < i) {
+          tokens.push(this.makeToken('NEOSTRING', str.slice(pi, i), strOffset + pi));
+        }
+        inner = expr.slice(1, -1);
+        if (inner.length) {
+          _ref2 = this.getLineAndColumnFromChunk(strOffset + i + 1), line = _ref2[0], column = _ref2[1];
+          nested = new Lexer().tokenize(inner, {
+            line: line,
+            column: column,
+            rewrite: false
+          });
+          popped = nested.pop();
+          if (((_ref3 = nested[0]) != null ? _ref3[0] : void 0) === 'TERMINATOR') {
+            popped = nested.shift();
+          }
+          if (len = nested.length) {
+            if (len > 1) {
+              nested.unshift(this.makeToken('(', '(', strOffset + i + 1, 0));
+              nested.push(this.makeToken(')', ')', strOffset + i + 1 + inner.length, 0));
+            }
+            tokens.push(['TOKENS', nested]);
+          }
+        }
+        i += expr.length;
+        pi = i + 1;
+      }
+      if ((i > pi && pi < str.length)) {
+        tokens.push(this.makeToken('NEOSTRING', str.slice(pi), strOffset + pi));
+      }
+      if (regex) {
+        return tokens;
+      }
+      if (!tokens.length) {
+        return this.token('STRING', '""', offsetInChunk, lexedLength);
+      }
+      if (tokens[0][0] !== 'NEOSTRING') {
+        tokens.unshift(this.makeToken('NEOSTRING', '', offsetInChunk));
+      }
+      if (interpolated = tokens.length > 1) {
+        this.token('(', '(', offsetInChunk, 0);
+      }
+      for (i = _i = 0, _len = tokens.length; _i < _len; i = ++_i) {
+        token = tokens[i];
+        tag = token[0], value = token[1];
+        if (i) {
+          if (i) {
+            plusToken = this.token('+', '+');
+          }
+          locationToken = tag === 'TOKENS' ? value[0] : token;
+          plusToken[2] = {
+            first_line: locationToken[2].first_line,
+            first_column: locationToken[2].first_column,
+            last_line: locationToken[2].first_line,
+            last_column: locationToken[2].first_column
+          };
+        }
+        if (tag === 'TOKENS') {
+          (_ref4 = this.tokens).push.apply(_ref4, value);
+        } else if (tag === 'NEOSTRING') {
+          token[0] = 'STRING';
+          token[1] = this.makeString(value, '"', heredoc);
+          this.tokens.push(token);
+        } else {
+          this.error("Unexpected " + tag);
+        }
+      }
+      if (interpolated) {
+        rparen = this.makeToken(')', ')', offsetInChunk + lexedLength, 0);
+        rparen.stringEnd = true;
+        this.tokens.push(rparen);
+      }
+      return tokens;
+    };
+
+    Lexer.prototype.pair = function(tag) {
+      var size, wanted;
+      if (tag !== (wanted = last(this.ends))) {
+        if ('OUTDENT' !== wanted) {
+          this.error("unmatched " + tag);
+        }
+        this.indent -= size = last(this.indents);
+        this.outdentToken(size, true);
+        return this.pair(tag);
+      }
+      return this.ends.pop();
+    };
+
+    Lexer.prototype.getLineAndColumnFromChunk = function(offset) {
+      var column, lineCount, lines, string;
+      if (offset === 0) {
+        return [this.chunkLine, this.chunkColumn];
+      }
+      if (offset >= this.chunk.length) {
+        string = this.chunk;
+      } else {
+        string = this.chunk.slice(0, +(offset - 1) + 1 || 9e9);
+      }
+      lineCount = count(string, '\n');
+      column = this.chunkColumn;
+      if (lineCount > 0) {
+        lines = string.split('\n');
+        column = last(lines).length;
+      } else {
+        column += string.length;
+      }
+      return [this.chunkLine + lineCount, column];
+    };
+
+    Lexer.prototype.makeToken = function(tag, value, offsetInChunk, length) {
+      var lastCharacter, locationData, token, _ref2, _ref3;
+      if (offsetInChunk == null) {
+        offsetInChunk = 0;
+      }
+      if (length == null) {
+        length = value.length;
+      }
+      locationData = {};
+      _ref2 = this.getLineAndColumnFromChunk(offsetInChunk), locationData.first_line = _ref2[0], locationData.first_column = _ref2[1];
+      lastCharacter = Math.max(0, length - 1);
+      _ref3 = this.getLineAndColumnFromChunk(offsetInChunk + lastCharacter), locationData.last_line = _ref3[0], locationData.last_column = _ref3[1];
+      token = [tag, value, locationData];
+      return token;
+    };
+
+    Lexer.prototype.token = function(tag, value, offsetInChunk, length) {
+      var token;
+      token = this.makeToken(tag, value, offsetInChunk, length);
+      this.tokens.push(token);
+      return token;
+    };
+
+    Lexer.prototype.tag = function(index, tag) {
+      var tok;
+      return (tok = last(this.tokens, index)) && (tag ? tok[0] = tag : tok[0]);
+    };
+
+    Lexer.prototype.value = function(index, val) {
+      var tok;
+      return (tok = last(this.tokens, index)) && (val ? tok[1] = val : tok[1]);
+    };
+
+    Lexer.prototype.unfinished = function() {
+      var _ref2;
+      return LINE_CONTINUER.test(this.chunk) || ((_ref2 = this.tag()) === '\\' || _ref2 === '.' || _ref2 === '?.' || _ref2 === '?::' || _ref2 === 'UNARY' || _ref2 === 'MATH' || _ref2 === '+' || _ref2 === '-' || _ref2 === 'SHIFT' || _ref2 === 'RELATION' || _ref2 === 'COMPARE' || _ref2 === 'LOGIC' || _ref2 === 'THROW' || _ref2 === 'EXTENDS');
+    };
+
+    Lexer.prototype.escapeLines = function(str, heredoc) {
+      return str.replace(MULTILINER, heredoc ? '\\n' : '');
+    };
+
+    Lexer.prototype.makeString = function(body, quote, heredoc) {
+      if (!body) {
+        return quote + quote;
+      }
+      body = body.replace(/\\([\s\S])/g, function(match, contents) {
+        if (contents === '\n' || contents === quote) {
+          return contents;
+        } else {
+          return match;
+        }
+      });
+      body = body.replace(RegExp("" + quote, "g"), '\\$&');
+      return quote + this.escapeLines(body, heredoc) + quote;
+    };
+
+    Lexer.prototype.error = function(message, offset) {
+      var first_column, first_line, _ref2;
+      if (offset == null) {
+        offset = 0;
+      }
+      _ref2 = this.getLineAndColumnFromChunk(offset), first_line = _ref2[0], first_column = _ref2[1];
+      return throwSyntaxError(message, {
+        first_line: first_line,
+        first_column: first_column
+      });
+    };
+
+    return Lexer;
+
+  })();
+
+  JS_KEYWORDS = ['true', 'false', 'null', 'this', 'new', 'delete', 'typeof', 'in', 'instanceof', 'return', 'throw', 'break', 'continue', 'debugger', 'if', 'else', 'switch', 'for', 'while', 'do', 'try', 'catch', 'finally', 'class', 'extends', 'super'];
+
+  COFFEE_KEYWORDS = ['undefined', 'then', 'unless', 'until', 'loop', 'of', 'by', 'when'];
+
+  COFFEE_ALIAS_MAP = {
+    and: '&&',
+    or: '||',
+    is: '==',
+    isnt: '!=',
+    not: '!',
+    yes: 'true',
+    no: 'false',
+    on: 'true',
+    off: 'false'
+  };
+
+  COFFEE_ALIASES = (function() {
+    var _results;
+    _results = [];
+    for (key in COFFEE_ALIAS_MAP) {
+      _results.push(key);
+    }
+    return _results;
+  })();
+
+  COFFEE_KEYWORDS = COFFEE_KEYWORDS.concat(COFFEE_ALIASES);
+
+  RESERVED = ['case', 'default', 'function', 'var', 'void', 'with', 'const', 'let', 'enum', 'export', 'import', 'native', '__hasProp', '__extends', '__slice', '__bind', '__indexOf', 'implements', 'interface', 'package', 'private', 'protected', 'public', 'static', 'yield'];
+
+  STRICT_PROSCRIBED = ['arguments', 'eval'];
+
+  JS_FORBIDDEN = JS_KEYWORDS.concat(RESERVED).concat(STRICT_PROSCRIBED);
+
+  exports.RESERVED = RESERVED.concat(JS_KEYWORDS).concat(COFFEE_KEYWORDS).concat(STRICT_PROSCRIBED);
+
+  exports.STRICT_PROSCRIBED = STRICT_PROSCRIBED;
+
+  BOM = 65279;
+
+  IDENTIFIER = /^([$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)([^\n\S]*:(?!:))?/;
+
+  NUMBER = /^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i;
+
+  HEREDOC = /^("""|''')([\s\S]*?)(?:\n[^\n\S]*)?\1/;
+
+  OPERATOR = /^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?(\.|::)|\.{2,3})/;
+
+  WHITESPACE = /^[^\n\S]+/;
+
+  COMMENT = /^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)$)|^(?:\s*#(?!##[^#]).*)+/;
+
+  CODE = /^[-=]>/;
+
+  MULTI_DENT = /^(?:\n[^\n\S]*)+/;
+
+  SIMPLESTR = /^'[^\\']*(?:\\.[^\\']*)*'/;
+
+  JSTOKEN = /^`[^\\`]*(?:\\.[^\\`]*)*`/;
+
+  REGEX = /^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)([imgy]{0,4})(?!\w)/;
+
+  HEREGEX = /^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/;
+
+  HEREGEX_OMIT = /\s+(?:#.*)?/g;
+
+  MULTILINER = /\n/g;
+
+  HEREDOC_INDENT = /\n+([^\n\S]*)/g;
+
+  HEREDOC_ILLEGAL = /\*\//;
+
+  LINE_CONTINUER = /^\s*(?:,|\??\.(?![.\d])|::)/;
+
+  TRAILING_SPACES = /\s+$/;
+
+  COMPOUND_ASSIGN = ['-=', '+=', '/=', '*=', '%=', '||=', '&&=', '?=', '<<=', '>>=', '>>>=', '&=', '^=', '|='];
+
+  UNARY = ['!', '~', 'NEW', 'TYPEOF', 'DELETE', 'DO'];
+
+  LOGIC = ['&&', '||', '&', '|', '^'];
+
+  SHIFT = ['<<', '>>', '>>>'];
+
+  COMPARE = ['==', '!=', '<', '>', '<=', '>='];
+
+  MATH = ['*', '/', '%'];
+
+  RELATION = ['IN', 'OF', 'INSTANCEOF'];
+
+  BOOL = ['TRUE', 'FALSE'];
+
+  NOT_REGEX = ['NUMBER', 'REGEX', 'BOOL', 'NULL', 'UNDEFINED', '++', '--'];
+
+  NOT_SPACED_REGEX = NOT_REGEX.concat(')', '}', 'THIS', 'IDENTIFIER', 'STRING', ']');
+
+  CALLABLE = ['IDENTIFIER', 'STRING', 'REGEX', ')', ']', '}', '?', '::', '@', 'THIS', 'SUPER'];
+
+  INDEXABLE = CALLABLE.concat('NUMBER', 'BOOL', 'NULL', 'UNDEFINED');
+
+  LINE_BREAK = ['INDENT', 'OUTDENT', 'TERMINATOR'];
+
+
+});
\ No newline at end of file


[47/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/edit_session/bracket_match.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/edit_session/bracket_match.js b/src/fauxton/assets/js/libs/ace/edit_session/bracket_match.js
new file mode 100644
index 0000000..825f692
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/edit_session/bracket_match.js
@@ -0,0 +1,219 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var TokenIterator = require("../token_iterator").TokenIterator;
+var Range = require("../range").Range;
+
+
+function BracketMatch() {
+
+    this.findMatchingBracket = function(position, chr) {
+        if (position.column == 0) return null;
+
+        var charBeforeCursor = chr || this.getLine(position.row).charAt(position.column-1);
+        if (charBeforeCursor == "") return null;
+
+        var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/);
+        if (!match)
+            return null;
+
+        if (match[1])
+            return this.$findClosingBracket(match[1], position);
+        else
+            return this.$findOpeningBracket(match[2], position);
+    };
+    
+    this.getBracketRange = function(pos) {
+        var line = this.getLine(pos.row);
+        var before = true, range;
+
+        var chr = line.charAt(pos.column-1);
+        var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
+        if (!match) {
+            chr = line.charAt(pos.column);
+            pos = {row: pos.row, column: pos.column + 1};
+            match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
+            before = false;
+        }
+        if (!match)
+            return null;
+
+        if (match[1]) {
+            var bracketPos = this.$findClosingBracket(match[1], pos);
+            if (!bracketPos)
+                return null;
+            range = Range.fromPoints(pos, bracketPos);
+            if (!before) {
+                range.end.column++;
+                range.start.column--;
+            }
+            range.cursor = range.end;
+        } else {
+            var bracketPos = this.$findOpeningBracket(match[2], pos);
+            if (!bracketPos)
+                return null;
+            range = Range.fromPoints(bracketPos, pos);
+            if (!before) {
+                range.start.column++;
+                range.end.column--;
+            }
+            range.cursor = range.start;
+        }
+        
+        return range;
+    };
+
+    this.$brackets = {
+        ")": "(",
+        "(": ")",
+        "]": "[",
+        "[": "]",
+        "{": "}",
+        "}": "{"
+    };
+
+    this.$findOpeningBracket = function(bracket, position, typeRe) {
+        var openBracket = this.$brackets[bracket];
+        var depth = 1;
+
+        var iterator = new TokenIterator(this, position.row, position.column);
+        var token = iterator.getCurrentToken();
+        if (!token)
+            token = iterator.stepForward();
+        if (!token)
+            return;
+        
+         if (!typeRe){
+            typeRe = new RegExp(
+                "(\\.?" +
+                token.type.replace(".", "\\.").replace("rparen", ".paren")
+                + ")+"
+            );
+        }
+        
+        // Start searching in token, just before the character at position.column
+        var valueIndex = position.column - iterator.getCurrentTokenColumn() - 2;
+        var value = token.value;
+        
+        while (true) {
+        
+            while (valueIndex >= 0) {
+                var chr = value.charAt(valueIndex);
+                if (chr == openBracket) {
+                    depth -= 1;
+                    if (depth == 0) {
+                        return {row: iterator.getCurrentTokenRow(),
+                            column: valueIndex + iterator.getCurrentTokenColumn()};
+                    }
+                }
+                else if (chr == bracket) {
+                    depth += 1;
+                }
+                valueIndex -= 1;
+            }
+
+            // Scan backward through the document, looking for the next token
+            // whose type matches typeRe
+            do {
+                token = iterator.stepBackward();
+            } while (token && !typeRe.test(token.type));
+
+            if (token == null)
+                break;
+                
+            value = token.value;
+            valueIndex = value.length - 1;
+        }
+        
+        return null;
+    };
+
+    this.$findClosingBracket = function(bracket, position, typeRe) {
+        var closingBracket = this.$brackets[bracket];
+        var depth = 1;
+
+        var iterator = new TokenIterator(this, position.row, position.column);
+        var token = iterator.getCurrentToken();
+        if (!token)
+            token = iterator.stepForward();
+        if (!token)
+            return;
+
+        if (!typeRe){
+            typeRe = new RegExp(
+                "(\\.?" +
+                token.type.replace(".", "\\.").replace("lparen", ".paren")
+                + ")+"
+            );
+        }
+
+        // Start searching in token, after the character at position.column
+        var valueIndex = position.column - iterator.getCurrentTokenColumn();
+
+        while (true) {
+
+            var value = token.value;
+            var valueLength = value.length;
+            while (valueIndex < valueLength) {
+                var chr = value.charAt(valueIndex);
+                if (chr == closingBracket) {
+                    depth -= 1;
+                    if (depth == 0) {
+                        return {row: iterator.getCurrentTokenRow(),
+                            column: valueIndex + iterator.getCurrentTokenColumn()};
+                    }
+                }
+                else if (chr == bracket) {
+                    depth += 1;
+                }
+                valueIndex += 1;
+            }
+
+            // Scan forward through the document, looking for the next token
+            // whose type matches typeRe
+            do {
+                token = iterator.stepForward();
+            } while (token && !typeRe.test(token.type));
+
+            if (token == null)
+                break;
+
+            valueIndex = 0;
+        }
+        
+        return null;
+    };
+}
+exports.BracketMatch = BracketMatch;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/edit_session/fold.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/edit_session/fold.js b/src/fauxton/assets/js/libs/ace/edit_session/fold.js
new file mode 100644
index 0000000..232101b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/edit_session/fold.js
@@ -0,0 +1,140 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var Range = require("../range").Range;
+var RangeList = require("../range_list").RangeList;
+var oop = require("../lib/oop")
+/*
+ * Simple fold-data struct.
+ **/
+var Fold = exports.Fold = function(range, placeholder) {
+    this.foldLine = null;
+    this.placeholder = placeholder;
+    this.range = range;
+    this.start = range.start;
+    this.end = range.end;
+
+    this.sameRow = range.start.row == range.end.row;
+    this.subFolds = this.ranges = [];
+};
+
+oop.inherits(Fold, RangeList);
+
+(function() {
+
+    this.toString = function() {
+        return '"' + this.placeholder + '" ' + this.range.toString();
+    };
+
+    this.setFoldLine = function(foldLine) {
+        this.foldLine = foldLine;
+        this.subFolds.forEach(function(fold) {
+            fold.setFoldLine(foldLine);
+        });
+    };
+
+    this.clone = function() {
+        var range = this.range.clone();
+        var fold = new Fold(range, this.placeholder);
+        this.subFolds.forEach(function(subFold) {
+            fold.subFolds.push(subFold.clone());
+        });
+        fold.collapseChildren = this.collapseChildren;
+        return fold;
+    };
+
+    this.addSubFold = function(fold) {
+        if (this.range.isEqual(fold))
+            return;
+
+        if (!this.range.containsRange(fold))
+            throw new Error("A fold can't intersect already existing fold" + fold.range + this.range);
+
+        // transform fold to local coordinates
+        consumeRange(fold, this.start);
+
+        var row = fold.start.row, column = fold.start.column;
+        for (var i = 0, cmp = -1; i < this.subFolds.length; i++) {
+            cmp = this.subFolds[i].range.compare(row, column);
+            if (cmp != 1)
+                break;
+        }
+        var afterStart = this.subFolds[i];
+
+        if (cmp == 0)
+            return afterStart.addSubFold(fold);
+
+        // cmp == -1
+        var row = fold.range.end.row, column = fold.range.end.column;
+        for (var j = i, cmp = -1; j < this.subFolds.length; j++) {
+            cmp = this.subFolds[j].range.compare(row, column);
+            if (cmp != 1)
+                break;
+        }
+        var afterEnd = this.subFolds[j];
+
+        if (cmp == 0)
+            throw new Error("A fold can't intersect already existing fold" + fold.range + this.range);
+
+        var consumedFolds = this.subFolds.splice(i, j - i, fold);
+        fold.setFoldLine(this.foldLine);
+
+        return fold;
+    };
+    
+    this.restoreRange = function(range) {
+        return restoreRange(range, this.start);
+    };
+
+}).call(Fold.prototype);
+
+function consumePoint(point, anchor) {
+    point.row -= anchor.row;
+    if (point.row == 0)
+        point.column -= anchor.column;
+}
+function consumeRange(range, anchor) {
+    consumePoint(range.start, anchor);
+    consumePoint(range.end, anchor);
+}
+function restorePoint(point, anchor) {
+    if (point.row == 0)
+        point.column += anchor.column;
+    point.row += anchor.row;
+}
+function restoreRange(range, anchor) {
+    restorePoint(range.start, anchor);
+    restorePoint(range.end, anchor);
+}
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/edit_session/fold_line.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/edit_session/fold_line.js b/src/fauxton/assets/js/libs/ace/edit_session/fold_line.js
new file mode 100644
index 0000000..0218195
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/edit_session/fold_line.js
@@ -0,0 +1,268 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var Range = require("../range").Range;
+
+/*
+ * If an array is passed in, the folds are expected to be sorted already.
+ */
+function FoldLine(foldData, folds) {
+    this.foldData = foldData;
+    if (Array.isArray(folds)) {
+        this.folds = folds;
+    } else {
+        folds = this.folds = [ folds ];
+    }
+
+    var last = folds[folds.length - 1]
+    this.range = new Range(folds[0].start.row, folds[0].start.column,
+                           last.end.row, last.end.column);
+    this.start = this.range.start;
+    this.end   = this.range.end;
+
+    this.folds.forEach(function(fold) {
+        fold.setFoldLine(this);
+    }, this);
+}
+
+(function() {
+    /*
+     * Note: This doesn't update wrapData!
+     */
+    this.shiftRow = function(shift) {
+        this.start.row += shift;
+        this.end.row += shift;
+        this.folds.forEach(function(fold) {
+            fold.start.row += shift;
+            fold.end.row += shift;
+        });
+    }
+
+    this.addFold = function(fold) {
+        if (fold.sameRow) {
+            if (fold.start.row < this.startRow || fold.endRow > this.endRow) {
+                throw new Error("Can't add a fold to this FoldLine as it has no connection");
+            }
+            this.folds.push(fold);
+            this.folds.sort(function(a, b) {
+                return -a.range.compareEnd(b.start.row, b.start.column);
+            });
+            if (this.range.compareEnd(fold.start.row, fold.start.column) > 0) {
+                this.end.row = fold.end.row;
+                this.end.column =  fold.end.column;
+            } else if (this.range.compareStart(fold.end.row, fold.end.column) < 0) {
+                this.start.row = fold.start.row;
+                this.start.column = fold.start.column;
+            }
+        } else if (fold.start.row == this.end.row) {
+            this.folds.push(fold);
+            this.end.row = fold.end.row;
+            this.end.column = fold.end.column;
+        } else if (fold.end.row == this.start.row) {
+            this.folds.unshift(fold);
+            this.start.row = fold.start.row;
+            this.start.column = fold.start.column;
+        } else {
+            throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");
+        }
+        fold.foldLine = this;
+    }
+
+    this.containsRow = function(row) {
+        return row >= this.start.row && row <= this.end.row;
+    }
+
+    this.walk = function(callback, endRow, endColumn) {
+        var lastEnd = 0,
+            folds = this.folds,
+            fold,
+            comp, stop, isNewRow = true;
+
+        if (endRow == null) {
+            endRow = this.end.row;
+            endColumn = this.end.column;
+        }
+
+        for (var i = 0; i < folds.length; i++) {
+            fold = folds[i];
+
+            comp = fold.range.compareStart(endRow, endColumn);
+            // This fold is after the endRow/Column.
+            if (comp == -1) {
+                callback(null, endRow, endColumn, lastEnd, isNewRow);
+                return;
+            }
+
+            stop = callback(null, fold.start.row, fold.start.column, lastEnd, isNewRow);
+            stop = !stop && callback(fold.placeholder, fold.start.row, fold.start.column, lastEnd);
+
+            // If the user requested to stop the walk or endRow/endColumn is
+            // inside of this fold (comp == 0), then end here.
+            if (stop || comp == 0) {
+                return;
+            }
+
+            // Note the new lastEnd might not be on the same line. However,
+            // it's the callback's job to recognize this.
+            isNewRow = !fold.sameRow;
+            lastEnd = fold.end.column;
+        }
+        callback(null, endRow, endColumn, lastEnd, isNewRow);
+    }
+
+    this.getNextFoldTo = function(row, column) {
+        var fold, cmp;
+        for (var i = 0; i < this.folds.length; i++) {
+            fold = this.folds[i];
+            cmp = fold.range.compareEnd(row, column);
+            if (cmp == -1) {
+                return {
+                    fold: fold,
+                    kind: "after"
+                };
+            } else if (cmp == 0) {
+                return {
+                    fold: fold,
+                    kind: "inside"
+                }
+            }
+        }
+        return null;
+    }
+
+    this.addRemoveChars = function(row, column, len) {
+        var ret = this.getNextFoldTo(row, column),
+            fold, folds;
+        if (ret) {
+            fold = ret.fold;
+            if (ret.kind == "inside"
+                && fold.start.column != column
+                && fold.start.row != row)
+            {
+                //throwing here breaks whole editor
+                //TODO: properly handle this
+                window.console && window.console.log(row, column, fold);
+            } else if (fold.start.row == row) {
+                folds = this.folds;
+                var i = folds.indexOf(fold);
+                if (i == 0) {
+                    this.start.column += len;
+                }
+                for (i; i < folds.length; i++) {
+                    fold = folds[i];
+                    fold.start.column += len;
+                    if (!fold.sameRow) {
+                        return;
+                    }
+                    fold.end.column += len;
+                }
+                this.end.column += len;
+            }
+        }
+    }
+
+    this.split = function(row, column) {
+        var fold = this.getNextFoldTo(row, column).fold;
+        var folds = this.folds;
+        var foldData = this.foldData;
+
+        if (!fold)
+            return null;
+
+        var i = folds.indexOf(fold);
+        var foldBefore = folds[i - 1];
+        this.end.row = foldBefore.end.row;
+        this.end.column = foldBefore.end.column;
+
+        // Remove the folds after row/column and create a new FoldLine
+        // containing these removed folds.
+        folds = folds.splice(i, folds.length - i);
+
+        var newFoldLine = new FoldLine(foldData, folds);
+        foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine);
+        return newFoldLine;
+    }
+
+    this.merge = function(foldLineNext) {
+        var folds = foldLineNext.folds;
+        for (var i = 0; i < folds.length; i++) {
+            this.addFold(folds[i]);
+        }
+        // Remove the foldLineNext - no longer needed, as
+        // it's merged now with foldLineNext.
+        var foldData = this.foldData;
+        foldData.splice(foldData.indexOf(foldLineNext), 1);
+    }
+
+    this.toString = function() {
+        var ret = [this.range.toString() + ": [" ];
+
+        this.folds.forEach(function(fold) {
+            ret.push("  " + fold.toString());
+        });
+        ret.push("]")
+        return ret.join("\n");
+    }
+
+    this.idxToPosition = function(idx) {
+        var lastFoldEndColumn = 0;
+        var fold;
+
+        for (var i = 0; i < this.folds.length; i++) {
+            var fold = this.folds[i];
+
+            idx -= fold.start.column - lastFoldEndColumn;
+            if (idx < 0) {
+                return {
+                    row: fold.start.row,
+                    column: fold.start.column + idx
+                };
+            }
+
+            idx -= fold.placeholder.length;
+            if (idx < 0) {
+                return fold.start;
+            }
+
+            lastFoldEndColumn = fold.end.column;
+        }
+
+        return {
+            row: this.end.row,
+            column: this.end.column + idx
+        };
+    }
+}).call(FoldLine.prototype);
+
+exports.FoldLine = FoldLine;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/edit_session/folding.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/edit_session/folding.js b/src/fauxton/assets/js/libs/ace/edit_session/folding.js
new file mode 100644
index 0000000..a9b2ddd
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/edit_session/folding.js
@@ -0,0 +1,799 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var Range = require("../range").Range;
+var FoldLine = require("./fold_line").FoldLine;
+var Fold = require("./fold").Fold;
+var TokenIterator = require("../token_iterator").TokenIterator;
+
+function Folding() {
+    /*
+     * Looks up a fold at a given row/column. Possible values for side:
+     *   -1: ignore a fold if fold.start = row/column
+     *   +1: ignore a fold if fold.end = row/column
+     */
+    this.getFoldAt = function(row, column, side) {
+        var foldLine = this.getFoldLine(row);
+        if (!foldLine)
+            return null;
+
+        var folds = foldLine.folds;
+        for (var i = 0; i < folds.length; i++) {
+            var fold = folds[i];
+            if (fold.range.contains(row, column)) {
+                if (side == 1 && fold.range.isEnd(row, column)) {
+                    continue;
+                } else if (side == -1 && fold.range.isStart(row, column)) {
+                    continue;
+                }
+                return fold;
+            }
+        }
+    };
+
+    /*
+     * Returns all folds in the given range. Note, that this will return folds
+     *
+     */
+    this.getFoldsInRange = function(range) {
+        var start = range.start;
+        var end = range.end;
+        var foldLines = this.$foldData;
+        var foundFolds = [];
+
+        start.column += 1;
+        end.column -= 1;
+
+        for (var i = 0; i < foldLines.length; i++) {
+            var cmp = foldLines[i].range.compareRange(range);
+            if (cmp == 2) {
+                // Range is before foldLine. No intersection. This means,
+                // there might be other foldLines that intersect.
+                continue;
+            }
+            else if (cmp == -2) {
+                // Range is after foldLine. There can't be any other foldLines then,
+                // so let's give up.
+                break;
+            }
+
+            var folds = foldLines[i].folds;
+            for (var j = 0; j < folds.length; j++) {
+                var fold = folds[j];
+                cmp = fold.range.compareRange(range);
+                if (cmp == -2) {
+                    break;
+                } else if (cmp == 2) {
+                    continue;
+                } else
+                // WTF-state: Can happen due to -1/+1 to start/end column.
+                if (cmp == 42) {
+                    break;
+                }
+                foundFolds.push(fold);
+            }
+        }
+        start.column -= 1;
+        end.column += 1;
+
+        return foundFolds;
+    };
+    
+    /*
+     * Returns all folds in the document
+     */
+    this.getAllFolds = function() {
+        var folds = [];
+        var foldLines = this.$foldData;
+        
+        function addFold(fold) {
+            folds.push(fold);
+        }
+        
+        for (var i = 0; i < foldLines.length; i++)
+            for (var j = 0; j < foldLines[i].folds.length; j++)
+                addFold(foldLines[i].folds[j]);
+
+        return folds;
+    };
+
+    /*
+     * Returns the string between folds at the given position.
+     * E.g.
+     *  foo<fold>b|ar<fold>wolrd -> "bar"
+     *  foo<fold>bar<fold>wol|rd -> "world"
+     *  foo<fold>bar<fo|ld>wolrd -> <null>
+     *
+     * where | means the position of row/column
+     *
+     * The trim option determs if the return string should be trimed according
+     * to the "side" passed with the trim value:
+     *
+     * E.g.
+     *  foo<fold>b|ar<fold>wolrd -trim=-1> "b"
+     *  foo<fold>bar<fold>wol|rd -trim=+1> "rld"
+     *  fo|o<fold>bar<fold>wolrd -trim=00> "foo"
+     */
+    this.getFoldStringAt = function(row, column, trim, foldLine) {
+        foldLine = foldLine || this.getFoldLine(row);
+        if (!foldLine)
+            return null;
+
+        var lastFold = {
+            end: { column: 0 }
+        };
+        // TODO: Refactor to use getNextFoldTo function.
+        var str, fold;
+        for (var i = 0; i < foldLine.folds.length; i++) {
+            fold = foldLine.folds[i];
+            var cmp = fold.range.compareEnd(row, column);
+            if (cmp == -1) {
+                str = this
+                    .getLine(fold.start.row)
+                    .substring(lastFold.end.column, fold.start.column);
+                break;
+            }
+            else if (cmp === 0) {
+                return null;
+            }
+            lastFold = fold;
+        }
+        if (!str)
+            str = this.getLine(fold.start.row).substring(lastFold.end.column);
+
+        if (trim == -1)
+            return str.substring(0, column - lastFold.end.column);
+        else if (trim == 1)
+            return str.substring(column - lastFold.end.column);
+        else
+            return str;
+    };
+
+    this.getFoldLine = function(docRow, startFoldLine) {
+        var foldData = this.$foldData;
+        var i = 0;
+        if (startFoldLine)
+            i = foldData.indexOf(startFoldLine);
+        if (i == -1)
+            i = 0;
+        for (i; i < foldData.length; i++) {
+            var foldLine = foldData[i];
+            if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) {
+                return foldLine;
+            } else if (foldLine.end.row > docRow) {
+                return null;
+            }
+        }
+        return null;
+    };
+
+    // returns the fold which starts after or contains docRow
+    this.getNextFoldLine = function(docRow, startFoldLine) {
+        var foldData = this.$foldData;
+        var i = 0;
+        if (startFoldLine)
+            i = foldData.indexOf(startFoldLine);
+        if (i == -1)
+            i = 0;
+        for (i; i < foldData.length; i++) {
+            var foldLine = foldData[i];
+            if (foldLine.end.row >= docRow) {
+                return foldLine;
+            }
+        }
+        return null;
+    };
+
+    this.getFoldedRowCount = function(first, last) {
+        var foldData = this.$foldData, rowCount = last-first+1;
+        for (var i = 0; i < foldData.length; i++) {
+            var foldLine = foldData[i],
+                end = foldLine.end.row,
+                start = foldLine.start.row;
+            if (end >= last) {
+                if(start < last) {
+                    if(start >= first)
+                        rowCount -= last-start;
+                    else
+                        rowCount = 0;//in one fold
+                }
+                break;
+            } else if(end >= first){
+                if (start >= first) //fold inside range
+                    rowCount -=  end-start;
+                else
+                    rowCount -=  end-first+1;
+            }
+        }
+        return rowCount;
+    };
+
+    this.$addFoldLine = function(foldLine) {
+        this.$foldData.push(foldLine);
+        this.$foldData.sort(function(a, b) {
+            return a.start.row - b.start.row;
+        });
+        return foldLine;
+    };
+
+    /**
+     * Adds a new fold.
+     *
+     * @returns
+     *      The new created Fold object or an existing fold object in case the
+     *      passed in range fits an existing fold exactly.
+     */
+    this.addFold = function(placeholder, range) {
+        var foldData = this.$foldData;
+        var added = false;
+        var fold;
+        
+        if (placeholder instanceof Fold)
+            fold = placeholder;
+        else {
+            fold = new Fold(range, placeholder);
+            fold.collapseChildren = range.collapseChildren;
+        }
+        this.$clipRangeToDocument(fold.range);
+
+        var startRow = fold.start.row;
+        var startColumn = fold.start.column;
+        var endRow = fold.end.row;
+        var endColumn = fold.end.column;
+
+        // --- Some checking ---
+        if (!(startRow < endRow || 
+            startRow == endRow && startColumn <= endColumn - 2))
+            throw new Error("The range has to be at least 2 characters width");
+
+        var startFold = this.getFoldAt(startRow, startColumn, 1);
+        var endFold = this.getFoldAt(endRow, endColumn, -1);
+        if (startFold && endFold == startFold)
+            return startFold.addSubFold(fold);
+
+        if (
+            (startFold && !startFold.range.isStart(startRow, startColumn))
+            || (endFold && !endFold.range.isEnd(endRow, endColumn))
+        ) {
+            throw new Error("A fold can't intersect already existing fold" + fold.range + startFold.range);
+        }
+
+        // Check if there are folds in the range we create the new fold for.
+        var folds = this.getFoldsInRange(fold.range);
+        if (folds.length > 0) {
+            // Remove the folds from fold data.
+            this.removeFolds(folds);
+            // Add the removed folds as subfolds on the new fold.
+            folds.forEach(function(subFold) {
+                fold.addSubFold(subFold);
+            });
+        }
+
+        for (var i = 0; i < foldData.length; i++) {
+            var foldLine = foldData[i];
+            if (endRow == foldLine.start.row) {
+                foldLine.addFold(fold);
+                added = true;
+                break;
+            } else if (startRow == foldLine.end.row) {
+                foldLine.addFold(fold);
+                added = true;
+                if (!fold.sameRow) {
+                    // Check if we might have to merge two FoldLines.
+                    var foldLineNext = foldData[i + 1];
+                    if (foldLineNext && foldLineNext.start.row == endRow) {
+                        // We need to merge!
+                        foldLine.merge(foldLineNext);
+                        break;
+                    }
+                }
+                break;
+            } else if (endRow <= foldLine.start.row) {
+                break;
+            }
+        }
+
+        if (!added)
+            foldLine = this.$addFoldLine(new FoldLine(this.$foldData, fold));
+
+        if (this.$useWrapMode)
+            this.$updateWrapData(foldLine.start.row, foldLine.start.row);
+        else
+            this.$updateRowLengthCache(foldLine.start.row, foldLine.start.row);
+
+        // Notify that fold data has changed.
+        this.$modified = true;
+        this._emit("changeFold", { data: fold, action: "add" });
+
+        return fold;
+    };
+
+    this.addFolds = function(folds) {
+        folds.forEach(function(fold) {
+            this.addFold(fold);
+        }, this);
+    };
+
+    this.removeFold = function(fold) {
+        var foldLine = fold.foldLine;
+        var startRow = foldLine.start.row;
+        var endRow = foldLine.end.row;
+
+        var foldLines = this.$foldData;
+        var folds = foldLine.folds;
+        // Simple case where there is only one fold in the FoldLine such that
+        // the entire fold line can get removed directly.
+        if (folds.length == 1) {
+            foldLines.splice(foldLines.indexOf(foldLine), 1);
+        } else
+        // If the fold is the last fold of the foldLine, just remove it.
+        if (foldLine.range.isEnd(fold.end.row, fold.end.column)) {
+            folds.pop();
+            foldLine.end.row = folds[folds.length - 1].end.row;
+            foldLine.end.column = folds[folds.length - 1].end.column;
+        } else
+        // If the fold is the first fold of the foldLine, just remove it.
+        if (foldLine.range.isStart(fold.start.row, fold.start.column)) {
+            folds.shift();
+            foldLine.start.row = folds[0].start.row;
+            foldLine.start.column = folds[0].start.column;
+        } else
+        // We know there are more then 2 folds and the fold is not at the edge.
+        // This means, the fold is somewhere in between.
+        //
+        // If the fold is in one row, we just can remove it.
+        if (fold.sameRow) {
+            folds.splice(folds.indexOf(fold), 1);
+        } else
+        // The fold goes over more then one row. This means remvoing this fold
+        // will cause the fold line to get splitted up. newFoldLine is the second part
+        {
+            var newFoldLine = foldLine.split(fold.start.row, fold.start.column);
+            folds = newFoldLine.folds;
+            folds.shift();
+            newFoldLine.start.row = folds[0].start.row;
+            newFoldLine.start.column = folds[0].start.column;
+        }
+
+        if (!this.$updating) {
+            if (this.$useWrapMode)
+                this.$updateWrapData(startRow, endRow);
+            else
+                this.$updateRowLengthCache(startRow, endRow);
+        }
+        
+        // Notify that fold data has changed.
+        this.$modified = true;
+        this._emit("changeFold", { data: fold, action: "remove" });
+    };
+
+    this.removeFolds = function(folds) {
+        // We need to clone the folds array passed in as it might be the folds
+        // array of a fold line and as we call this.removeFold(fold), folds
+        // are removed from folds and changes the current index.
+        var cloneFolds = [];
+        for (var i = 0; i < folds.length; i++) {
+            cloneFolds.push(folds[i]);
+        }
+
+        cloneFolds.forEach(function(fold) {
+            this.removeFold(fold);
+        }, this);
+        this.$modified = true;
+    };
+
+    this.expandFold = function(fold) {
+        this.removeFold(fold);        
+        fold.subFolds.forEach(function(subFold) {
+            fold.restoreRange(subFold);
+            this.addFold(subFold);
+        }, this);
+        if (fold.collapseChildren > 0) {
+            this.foldAll(fold.start.row+1, fold.end.row, fold.collapseChildren-1);
+        }
+        fold.subFolds = [];
+    };
+
+    this.expandFolds = function(folds) {
+        folds.forEach(function(fold) {
+            this.expandFold(fold);
+        }, this);
+    };
+
+    this.unfold = function(location, expandInner) {
+        var range, folds;
+        if (location == null) {
+            range = new Range(0, 0, this.getLength(), 0);
+            expandInner = true;
+        } else if (typeof location == "number")
+            range = new Range(location, 0, location, this.getLine(location).length);
+        else if ("row" in location)
+            range = Range.fromPoints(location, location);
+        else
+            range = location;
+
+        folds = this.getFoldsInRange(range);
+        if (expandInner) {
+            this.removeFolds(folds);
+        } else {
+            // TODO: might need to remove and add folds in one go instead of using
+            // expandFolds several times.
+            while (folds.length) {
+                this.expandFolds(folds);
+                folds = this.getFoldsInRange(range);
+            }
+        }
+    };
+
+    /*
+     * Checks if a given documentRow is folded. This is true if there are some
+     * folded parts such that some parts of the line is still visible.
+     **/
+    this.isRowFolded = function(docRow, startFoldRow) {
+        return !!this.getFoldLine(docRow, startFoldRow);
+    };
+
+    this.getRowFoldEnd = function(docRow, startFoldRow) {
+        var foldLine = this.getFoldLine(docRow, startFoldRow);
+        return foldLine ? foldLine.end.row : docRow;
+    };
+
+    this.getRowFoldStart = function(docRow, startFoldRow) {
+        var foldLine = this.getFoldLine(docRow, startFoldRow);
+        return foldLine ? foldLine.start.row : docRow;
+    };
+
+    this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
+        if (startRow == null) {
+            startRow = foldLine.start.row;
+            startColumn = 0;
+        }
+
+        if (endRow == null) {
+            endRow = foldLine.end.row;
+            endColumn = this.getLine(endRow).length;
+        }
+
+        // Build the textline using the FoldLine walker.
+        var doc = this.doc;
+        var textLine = "";
+
+        foldLine.walk(function(placeholder, row, column, lastColumn) {
+            if (row < startRow)
+                return;
+            if (row == startRow) {
+                if (column < startColumn)
+                    return;
+                lastColumn = Math.max(startColumn, lastColumn);
+            }
+
+            if (placeholder != null) {
+                textLine += placeholder;
+            } else {
+                textLine += doc.getLine(row).substring(lastColumn, column);
+            }
+        }, endRow, endColumn);
+        return textLine;
+    };
+
+    this.getDisplayLine = function(row, endColumn, startRow, startColumn) {
+        var foldLine = this.getFoldLine(row);
+
+        if (!foldLine) {
+            var line;
+            line = this.doc.getLine(row);
+            return line.substring(startColumn || 0, endColumn || line.length);
+        } else {
+            return this.getFoldDisplayLine(
+                foldLine, row, endColumn, startRow, startColumn);
+        }
+    };
+
+    this.$cloneFoldData = function() {
+        var fd = [];
+        fd = this.$foldData.map(function(foldLine) {
+            var folds = foldLine.folds.map(function(fold) {
+                return fold.clone();
+            });
+            return new FoldLine(fd, folds);
+        });
+
+        return fd;
+    };
+
+    this.toggleFold = function(tryToUnfold) {
+        var selection = this.selection;
+        var range = selection.getRange();
+        var fold;
+        var bracketPos;
+
+        if (range.isEmpty()) {
+            var cursor = range.start;
+            fold = this.getFoldAt(cursor.row, cursor.column);
+
+            if (fold) {
+                this.expandFold(fold);
+                return;
+            } else if (bracketPos = this.findMatchingBracket(cursor)) {
+                if (range.comparePoint(bracketPos) == 1) {
+                    range.end = bracketPos;
+                } else {
+                    range.start = bracketPos;
+                    range.start.column++;
+                    range.end.column--;
+                }
+            } else if (bracketPos = this.findMatchingBracket({row: cursor.row, column: cursor.column + 1})) {
+                if (range.comparePoint(bracketPos) == 1)
+                    range.end = bracketPos;
+                else
+                    range.start = bracketPos;
+
+                range.start.column++;
+            } else {
+                range = this.getCommentFoldRange(cursor.row, cursor.column) || range;
+            }
+        } else {
+            var folds = this.getFoldsInRange(range);
+            if (tryToUnfold && folds.length) {
+                this.expandFolds(folds);
+                return;
+            } else if (folds.length == 1 ) {
+                fold = folds[0];
+            }
+        }
+
+        if (!fold)
+            fold = this.getFoldAt(range.start.row, range.start.column);
+
+        if (fold && fold.range.toString() == range.toString()) {
+            this.expandFold(fold);
+            return;
+        }
+
+        var placeholder = "...";
+        if (!range.isMultiLine()) {
+            placeholder = this.getTextRange(range);
+            if(placeholder.length < 4)
+                return;
+            placeholder = placeholder.trim().substring(0, 2) + "..";
+        }
+
+        this.addFold(placeholder, range);
+    };
+
+    this.getCommentFoldRange = function(row, column, dir) {
+        var iterator = new TokenIterator(this, row, column);
+        var token = iterator.getCurrentToken();
+        if (token && /^comment|string/.test(token.type)) {
+            var range = new Range();
+            var re = new RegExp(token.type.replace(/\..*/, "\\."));
+            if (dir != 1) {
+                do {
+                    token = iterator.stepBackward();
+                } while(token && re.test(token.type));
+                iterator.stepForward();
+            }
+            
+            range.start.row = iterator.getCurrentTokenRow();
+            range.start.column = iterator.getCurrentTokenColumn() + 2;
+
+            iterator = new TokenIterator(this, row, column);
+            
+            if (dir != -1) {
+                do {
+                    token = iterator.stepForward();
+                } while(token && re.test(token.type));
+                token = iterator.stepBackward();
+            } else
+                token = iterator.getCurrentToken();
+
+            range.end.row = iterator.getCurrentTokenRow();
+            range.end.column = iterator.getCurrentTokenColumn() + token.value.length - 2;
+            return range;
+        }
+    };
+
+    this.foldAll = function(startRow, endRow, depth) {
+        if (depth == undefined)
+            depth = 100000; // JSON.stringify doesn't hanle Infinity
+        var foldWidgets = this.foldWidgets;
+        endRow = endRow || this.getLength();
+        startRow = startRow || 0;
+        for (var row = startRow; row < endRow; row++) {
+            if (foldWidgets[row] == null)
+                foldWidgets[row] = this.getFoldWidget(row);
+            if (foldWidgets[row] != "start")
+                continue;
+
+            var range = this.getFoldWidgetRange(row);
+            var rangeEndRow = range.end.row;
+            // sometimes range can be incompatible with existing fold
+            // TODO change addFold to return null istead of throwing
+            if (range && range.isMultiLine()
+                && rangeEndRow <= endRow
+                && range.start.row >= startRow
+            ) try {
+                var fold = this.addFold("...", range);
+                fold.collapseChildren = depth;
+                // addFold can change the range
+                row = rangeEndRow;
+            } catch(e) {}
+        }
+    };
+    
+    // structured folding
+    this.$foldStyles = {
+        "manual": 1,
+        "markbegin": 1,
+        "markbeginend": 1
+    };
+    this.$foldStyle = "markbegin";
+    this.setFoldStyle = function(style) {
+        if (!this.$foldStyles[style])
+            throw new Error("invalid fold style: " + style + "[" + Object.keys(this.$foldStyles).join(", ") + "]");
+        
+        if (this.$foldStyle == style)
+            return;
+
+        this.$foldStyle = style;
+        
+        if (style == "manual")
+            this.unfold();
+        
+        // reset folding
+        var mode = this.$foldMode;
+        this.$setFolding(null);
+        this.$setFolding(mode);
+    };
+
+    this.$setFolding = function(foldMode) {
+        if (this.$foldMode == foldMode)
+            return;
+            
+        this.$foldMode = foldMode;
+        
+        this.removeListener('change', this.$updateFoldWidgets);
+        this._emit("changeAnnotation");
+        
+        if (!foldMode || this.$foldStyle == "manual") {
+            this.foldWidgets = null;
+            return;
+        }
+        
+        this.foldWidgets = [];
+        this.getFoldWidget = foldMode.getFoldWidget.bind(foldMode, this, this.$foldStyle);
+        this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, this, this.$foldStyle);
+        
+        this.$updateFoldWidgets = this.updateFoldWidgets.bind(this);
+        this.on('change', this.$updateFoldWidgets);
+        
+    };
+
+    this.getParentFoldRangeData = function (row, ignoreCurrent) {
+        var fw = this.foldWidgets;
+        if (!fw || (ignoreCurrent && fw[row]))
+            return {};
+
+        var i = row - 1, firstRange;
+        while (i >= 0) {
+            var c = fw[i];
+            if (c == null)
+                c = fw[i] = this.getFoldWidget(i);
+
+            if (c == "start") {
+                var range = this.getFoldWidgetRange(i);
+                if (!firstRange)
+                    firstRange = range;
+                if (range && range.end.row >= row)
+                    break;
+            }
+            i--;
+        }
+
+        return {
+            range: i !== -1 && range,
+            firstRange: firstRange
+        };
+    }
+
+    this.onFoldWidgetClick = function(row, e) {
+        var type = this.getFoldWidget(row);
+        var line = this.getLine(row);
+        e = e.domEvent;
+        var children = e.shiftKey;
+        var all = e.ctrlKey || e.metaKey;
+        var siblings = e.altKey;
+
+        var dir = type === "end" ? -1 : 1;
+        var fold = this.getFoldAt(row, dir === -1 ? 0 : line.length, dir);
+
+        if (fold) {
+            if (children || all)
+                this.removeFold(fold);
+            else
+                this.expandFold(fold);
+            return;
+        }
+
+        var range = this.getFoldWidgetRange(row);
+        // sometimes singleline folds can be missed by the code above
+        if (range && !range.isMultiLine()) {
+            fold = this.getFoldAt(range.start.row, range.start.column, 1);
+            if (fold && range.isEqual(fold.range)) {
+                this.removeFold(fold);
+                return;
+            }
+        }
+        
+        if (siblings) {
+            var data = this.getParentFoldRangeData(row);
+            if (data.range) {
+                var startRow = data.range.start.row + 1;
+                var endRow = data.range.end.row;
+            }
+            this.foldAll(startRow, endRow, all ? 10000 : 0);
+        } else if (children) {
+            var endRow = range ? range.end.row : this.getLength();
+            this.foldAll(row + 1, range.end.row, all ? 10000 : 0);
+        } else if (range) {
+            if (all) 
+                range.collapseChildren = 10000;
+            this.addFold("...", range);
+        }
+        
+        if (!range)
+            (e.target || e.srcElement).className += " ace_invalid"
+    };
+
+    this.updateFoldWidgets = function(e) {
+        var delta = e.data;
+        var range = delta.range;
+        var firstRow = range.start.row;
+        var len = range.end.row - firstRow;
+
+        if (len === 0) {
+            this.foldWidgets[firstRow] = null;
+        } else if (delta.action == "removeText" || delta.action == "removeLines") {
+            this.foldWidgets.splice(firstRow, len + 1, null);
+        } else {
+            var args = Array(len + 1);
+            args.unshift(firstRow, 1);
+            this.foldWidgets.splice.apply(this.foldWidgets, args);
+        }
+    };
+
+}
+
+exports.Folding = Folding;
+
+});


[30/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/actionscript_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/actionscript_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/actionscript_highlight_rules.js
new file mode 100644
index 0000000..1f30d9c
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/actionscript_highlight_rules.js
@@ -0,0 +1,141 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* This file was autogenerated from tm bundles\actionscript.tmbundle\Syntaxes\ActionScript.plist (uuid: ) */
+/****************************************************************************************
+ * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
+ * fileTypes                                                                            *
+ ****************************************************************************************/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var ActionScriptHighlightRules = function() {
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = { start: 
+       [ { token: 'support.class.actionscript.2',
+           regex: '\\b(?:R(?:ecordset|DBMSResolver|adioButton(?:Group)?)|X(?:ML(?:Socket|Node|Connector)?|UpdateResolverDataHolder)|M(?:M(?:Save|Execute)|icrophoneMicrophone|o(?:use|vieClip(?:Loader)?)|e(?:nu(?:Bar)?|dia(?:Controller|Display|Playback))|ath)|B(?:yName|inding|utton)|S(?:haredObject|ystem|crollPane|t(?:yleSheet|age|ream)|ound|e(?:ndEvent|rviceObject)|OAPCall|lide)|N(?:umericStepper|et(?:stream|S(?:tream|ervices)|Connection|Debug(?:Config)?))|C(?:heckBox|o(?:ntextMenu(?:Item)?|okie|lor|m(?:ponentMixins|boBox))|ustomActions|lient|amera)|T(?:ypedValue|ext(?:Snapshot|Input|F(?:ield|ormat)|Area)|ree|AB)|Object|D(?:ownload|elta(?:Item|Packet)?|at(?:e(?:Chooser|Field)?|a(?:G(?:lue|rid)|Set|Type)))|U(?:RL|TC|IScrollBar)|P(?:opUpManager|endingCall|r(?:intJob|o(?:duct|gressBar)))|E(?:ndPoint|rror)|Video|Key|F(?:RadioButton|GridColumn|MessageBox|BarChart|S(?:croll(?:Bar|Pane)|tyleFormat|plitView)|orm|C(?:heckbox|omboBox|alendar)|unction|T(?:icker|ooltip(?:Lite)?|ree(?:Node)?)|Ico
 nButton|D(?:ataGrid|raggablePane)|P(?:ieChart|ushButton|ro(?:gressBar|mptBox))|L(?:i(?:stBox|neChart)|oadingBox)|AdvancedMessageBox)|W(?:indow|SDLURL|ebService(?:Connector)?)|L(?:ist|o(?:calConnection|ad(?:er|Vars)|g)|a(?:unch|bel))|A(?:sBroadcaster|cc(?:ordion|essibility)|S(?:Set(?:Native|PropFlags)|N(?:ew|ative)|C(?:onstructor|lamp(?:2)?)|InstanceOf)|pplication|lert|rray))\\b' },
+         { token: 'support.function.actionscript.2',
+           regex: '\\b(?:s(?:h(?:ift|ow(?:GridLines|Menu|Border|Settings|Headers|ColumnHeaders|Today|Preferences)?|ad(?:ow|ePane))|c(?:hema|ale(?:X|Mode|Y|Content)|r(?:oll(?:Track|Drag)?|een(?:Resolution|Color|DPI)))|t(?:yleSheet|op(?:Drag|A(?:nimation|llSounds|gent))?|epSize|a(?:tus|rt(?:Drag|A(?:nimation|gent))?))|i(?:n|ze|lence(?:TimeOut|Level))|o(?:ngname|urce|rt(?:Items(?:By)?|On(?:HeaderRelease)?|able(?:Columns)?)?)|u(?:ppressInvalidCalls|bstr(?:ing)?)|p(?:li(?:ce|t)|aceCol(?:umnsEqually|lumnsEqually))|e(?:nd(?:DefaultPushButtonEvent|AndLoad)?|curity|t(?:R(?:GB|o(?:otNode|w(?:Height|Count))|esizable(?:Columns)?|a(?:nge|te))|G(?:ain|roupName)|X(?:AxisTitle)?|M(?:i(?:n(?:imum|utes)|lliseconds)|o(?:nth(?:Names)?|tionLevel|de)|ultilineMode|e(?:ssage|nu(?:ItemEnabled(?:At)?|EnabledAt)|dia)|a(?:sk|ximum))|B(?:u(?:tton(?:s|Width)|fferTime)|a(?:seTabIndex|ndwidthLimit|ckground))|S(?:howAsDisabled|croll(?:ing|Speed|Content|Target|P(?:osition|roperties)|barState|Location)|t(?:yle(?:Prop
 erty)?|opOnFocus|at(?:us|e))|i(?:ze|lenceLevel)|ort(?:able(?:Columns)?|Function)|p(?:litterBarPosition|acing)|e(?:conds|lect(?:Multiple|ion(?:Required|Type)?|Style|Color|ed(?:Node(?:s)?|Cell|I(?:nd(?:ices|ex)|tem(?:s)?))?|able))|kin|m(?:oothness|allScroll))|H(?:ighlight(?:s|Color)|Scroll|o(?:urs|rizontal)|eader(?:Symbol|Height|Text|Property|Format|Width|Location)?|as(?:Shader|CloseBox))|Y(?:ear|AxisTitle)?|N(?:ode(?:Properties|ExpansionHandler)|ewTextFormat)|C(?:h(?:ildNodes|a(?:ngeHandler|rt(?:Title|EventHandler)))|o(?:ntent(?:Size)?|okie|lumns)|ell(?:Symbol|Data)|l(?:i(?:ckHandler|pboard)|oseHandler)|redentials)|T(?:ype(?:dVaule)?|i(?:tle(?:barHeight)?|p(?:Target|Offset)?|me(?:out(?:Handler)?)?)|oggle|extFormat|ransform)|I(?:s(?:Branch|Open)|n(?:terval|putProperty)|con(?:SymbolName)?|te(?:rator|m(?:ByKey|Symbol)))|Orientation|D(?:i(?:splay(?:Range|Graphics|Mode|Clip|Text|edMonth)|rection)|uration|e(?:pth(?:Below|To|Above)|fault(?:GatewayURL|Mappings|NodeIconSymbolName)|l(?:iveryMo
 de|ay)|bug(?:ID)?)|a(?:yOfWeekNames|t(?:e(?:Filter)?|a(?:Mapping(?:s)?|Item(?:Text|Property|Format)|Provider|All(?:Height|Property|Format|Width))?))|ra(?:wConnectors|gContent))|U(?:se(?:Shadow|HandCursor|EchoSuppression|rInput|Fade)|TC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear))|P(?:osition|ercentComplete|an(?:e(?:M(?:inimumSize|aximumSize)|Size|Title))?|ro(?:pert(?:y(?:Data)?|iesAt)|gress))|E(?:nabled|dit(?:Handler|able)|xpand(?:NodeTrigger|erSymbolName))|V(?:Scroll|olume|alue(?:Source)?)|KeyFrameInterval|Quality|F(?:i(?:eld|rst(?:DayOfWeek|VisibleNode))|ocus|ullYear|ps|ade(?:InLength|OutLength)|rame(?:Color|Width))|Width|L(?:ine(?:Color|Weight)|o(?:opback|adTarget)|a(?:rgeScroll|bel(?:Source|Placement)?))|A(?:s(?:Boolean|String|Number)|n(?:yTypedValue|imation)|ctiv(?:e(?:State(?:Handler)?|Handler)|ateHandler)|utoH(?:ideScrollBar|eight)))?|paratorBefore|ek|lect(?:ion(?:Disabled|Unfocused)?|ed(?:Node(?:s)?|Child|I(?:nd(?:ices|ex)|tem(?:s)?)|Dat(?:e|a))?|able(?:Ra
 nges)?)|rver(?:String)?)|kip|qrt|wapDepths|lice|aveToSharedObj|moothing)|h(?:scroll(?:Policy)?|tml(?:Text)?|i(?:t(?:Test(?:TextNearPos)?|Area)|de(?:BuiltInItems|Child)?|ghlight(?:2D|3D)?)|orizontal|e(?:ight|ader(?:Re(?:nderer|lease)|Height|Text))|P(?:osition|ageScrollSize)|a(?:s(?:childNodes|MP3|S(?:creen(?:Broadcast|Playback)|treaming(?:Video|Audio)|ort)|Next|OwnProperty|Pr(?:inting|evious)|EmbeddedVideo|VideoEncoder|A(?:ccesibility|udio(?:Encoder)?))|ndlerName)|LineScrollSize)|ye(?:sLabel|ar)|n(?:o(?:t|de(?:Name|Close|Type|Open|Value)|Label)|u(?:llValue|mChild(?:S(?:creens|lides)|ren|Forms))|e(?:w(?:Item|line|Value|LocationDialog)|xt(?:S(?:cene|ibling|lide)|TabIndex|Value|Frame)?)?|ame(?:s)?)|c(?:h(?:ildNodes|eck|a(?:nge(?:sPending)?|r(?:CodeAt|At))|r)|o(?:s|n(?:st(?:ant|ructor)|nect|c(?:urrency|at)|t(?:ent(?:Type|Path)?|ains|rol(?:Placement|lerPolicy))|denseWhite|version)|py|l(?:or|umn(?:Stretch|Name(?:s)?|Count))|m(?:p(?:onent|lete)|ment))|u(?:stomItems|ePoint(?:s)?|r(?:veTo|Val
 ue|rent(?:Slide|ChildSlide|Item|F(?:ocused(?:S(?:creen|lide)|Form)|ps))))|e(?:il|ll(?:Renderer|Press|Edit|Focus(?:In|Out)))|l(?:i(?:ck|ents)|o(?:se(?:Button|Pane)?|ne(?:Node)?)|ear(?:S(?:haredObjects|treams)|Timeout|Interval)?)|a(?:ncelLabel|tch|p(?:tion|abilities)|l(?:cFields|l(?:e(?:e|r))?))|reate(?:GatewayConnection|Menu|Se(?:rver|gment)|C(?:hild(?:AtDepth)?|l(?:ient|ass(?:ChildAtDepth|Object(?:AtDepth)?))|all)|Text(?:Node|Field)|Item|Object(?:AtDepth)?|PopUp|E(?:lement|mptyMovieClip)))|t(?:h(?:is|row)|ype(?:of|Name)?|i(?:tle(?:StyleDeclaration)?|me(?:out)?)|o(?:talTime|String|olTipText|p|UpperCase|ggle(?:HighQuality)?|Lo(?:caleString|werCase))|e(?:st|llTarget|xt(?:RightMargin|Bold|S(?:ize|elected)|Height|Color|I(?:ndent|talic)|Disabled|Underline|F(?:ield|ont)|Width|LeftMargin|Align)?)|a(?:n|rget(?:Path)?|b(?:Stops|Children|Index|Enabled|leName))|r(?:y|igger|ac(?:e|k(?:AsMenu)?)))|i(?:s(?:Running|Branch|NaN|Con(?:soleOpen|nected)|Toggled|Installed|Open|D(?:own|ebugger)|P(?:urchas
 ed|ro(?:totypeOf|pertyEnumerable))|Empty|F(?:inite|ullyPopulated)|Local|Active)|n(?:s(?:tall|ertBefore)|cludeDeltaPacketInfo|t|it(?:ialize|Component|Pod|A(?:pplication|gent))?|de(?:nt|terminate|x(?:InParent(?:Slide|Form)?|Of)?)|put|validate|finity|LocalInternetCache)?|con(?:F(?:ield|unction))?|t(?:e(?:ratorScrolled|m(?:s|RollO(?:ut|ver)|ClassName))|alic)|d3|p|fFrameLoaded|gnore(?:Case|White))|o(?:s|n(?:R(?:ollO(?:ut|ver)|e(?:s(?:ize|ult)|l(?:ease(?:Outside)?|aseOutside)))|XML|Mouse(?:Move|Down|Up|Wheel)|S(?:ync|croller|tatus|oundComplete|e(?:tFocus|lect(?:edItem)?))|N(?:oticeEvent|etworkChange)|C(?:hanged|onnect|l(?:ipEvent|ose))|ID3|D(?:isconnect|eactivate|ata|ragO(?:ut|ver))|Un(?:install|load)|P(?:aymentResult|ress)|EnterFrame|K(?:illFocus|ey(?:Down|Up))|Fault|Lo(?:ad|g)|A(?:ctiv(?:ity|ate)|ppSt(?:op|art)))?|pe(?:n|ration)|verLayChildren|kLabel|ldValue|r(?:d)?)|d(?:i(?:s(?:connect|play(?:Normal|ed(?:Month|Year)|Full)|able(?:Shader|d(?:Ranges|Days)|CloseBox|Events))|rection)|o(?:cT
 ypeDecl|tall|Decoding|main|LazyDecoding)|u(?:plicateMovieClip|ration)|e(?:stroy(?:ChildAt|Object)|code|fault(?:PushButton(?:Enabled)?|KeydownHandler)?|l(?:ta(?:Packet(?:Changed)?)?|ete(?:PopUp|All)?)|blocking)|a(?:shBoardSave|yNames|ta(?:Provider)?|rkshadow)|r(?:opdown(?:Width)?|a(?:w|gO(?:ut|ver))))|u(?:se(?:Sort|HandCursor|Codepage|EchoSuppression)|n(?:shift|install|derline|escape|format|watch|lo(?:ck|ad(?:Movie(?:Num)?)?))|pdate(?:Results|Mode|I(?:nputProperties|tem(?:ByIndex)?)|P(?:acket|roperties)|View|AfterEvent)|rl)|join|p(?:ixelAspectRatio|o(?:sition|p|w)|u(?:sh|rge|blish)|ercen(?:tComplete|Loaded)|lay(?:head(?:Change|Time)|ing|Hidden|erType)?|a(?:ssword|use|r(?:se(?:XML|CSS|Int|Float)|ent(?:Node|Is(?:S(?:creen|lide)|Form))|ams))|r(?:int(?:Num|AsBitmap(?:Num)?)?|o(?:to(?:type)?|pert(?:y|ies)|gress)|e(?:ss|v(?:ious(?:S(?:ibling|lide)|Value)?|Scene|Frame)|ferred(?:Height|Width))))|e(?:scape|n(?:code(?:r)?|ter(?:Frame)?|dFill|able(?:Shader|d|CloseBox|Events))|dit(?:able|Field|L
 ocationDialog)|v(?:ent|al(?:uate)?)|q|x(?:tended|p|ec(?:ute)?|actSettings)|m(?:phasized(?:StyleDeclaration)?|bedFonts))|v(?:i(?:sible|ewPod)|ScrollPolicy|o(?:id|lume)|ersion|P(?:osition|ageScrollSize)|a(?:l(?:idat(?:ionError|e(?:Property|ActivationKey)?)|ue(?:Of)?)|riable)|LineScrollSize)|k(?:ind|ey(?:Down|Up|Press|FrameInterval))|q(?:sort|uality)|f(?:scommand|i(?:n(?:d(?:Text|First|Last)?|ally)|eldInfo|lter(?:ed|Func)?|rst(?:Slide|Child|DayOfWeek|VisibleNode)?)|o(?:nt|cus(?:In|edCell|Out|Enabled)|r(?:egroundDisabled|mat(?:ter)?))|unctionName|ps|l(?:oor|ush)|ace|romCharCode)|w(?:i(?:th|dth)|ordWrap|atch|riteAccess)|l(?:t|i(?:st(?:Owner)?|ne(?:Style|To))|o(?:c(?:k|a(?:t(?:ion|eByld)|l(?:ToGlobal|FileReadDisable)))|opback|ad(?:Movie(?:Num)?|S(?:crollContent|ound)|ed|Variables(?:Num)?|Application)?|g(?:Changes)?)|e(?:ngth|ft(?:Margin)?|ading)?|a(?:st(?:Slide|Child|Index(?:Of)?)?|nguage|b(?:el(?:Placement|F(?:ield|unction))?|leField)))|a(?:s(?:scociate(?:Controller|Display)|in|pectRatio
 |function)|nd|c(?:ceptConnection|tiv(?:ityLevel|ePlayControl)|os)|t(?:t(?:ach(?:Movie|Sound|Video|Audio)|ributes)|an(?:2)?)|dd(?:header|RequestHeader|Menu(?:Item(?:At)?|At)?|Sort|Header|No(?:tice|de(?:At)?)|C(?:olumn(?:At)?|uePoint)|T(?:oLocalInternetCache|reeNode(?:At)?)|I(?:con|tem(?:s(?:At)?|At)?)|DeltaItem|P(?:od|age|roperty)|EventListener|View|FieldInfo|Listener|Animation)?|uto(?:Size|Play|KeyNav|Load)|pp(?:endChild|ly(?:Changes|Updates)?)|vHardwareDisable|fterLoaded|l(?:ternateRowColors|ign|l(?:ow(?:InsecureDomain|Domain)|Transitions(?:InDone|OutDone))|bum)|r(?:tist|row|g(?:uments|List))|gent|bs)|r(?:ight(?:Margin)?|o(?:ot(?:S(?:creen|lide)|Form)|und|w(?:Height|Count)|llO(?:ut|ver))|e(?:s(?:yncDepth|t(?:orePane|artAnimation|rict)|iz(?:e|able(?:Columns)?)|olveDelta|ult(?:s)?|ponse)|c(?:o(?:ncile(?:Results|Updates)|rd)|eive(?:Video|Audio))|draw|jectConnection|place(?:Sel|ItemAt|AllItems)?|ve(?:al(?:Child)?|rse)|quest(?:SizeChange|Payment)?|f(?:errer|resh(?:ScrollContent|Destinat
 ions|Pane|FromSources)?)|lease(?:Outside)?|ad(?:Only|Access)|gister(?:SkinElement|C(?:olor(?:Style|Name)|lass)|InheritingStyle|Proxy)|move(?:Range|M(?:ovieClip|enu(?:Item(?:At)?|At))|Background|Sort|No(?:tice|de(?:sAt|At)?)|C(?:olum(?:nAt|At)|uePoints)|T(?:extField|reeNode(?:At)?)|Item(?:At)?|Pod|EventListener|FromLocalInternetCache|Listener|All(?:C(?:olumns|uePoints)|Items)?))|a(?:ndom|te|dioDot))|g(?:t|oto(?:Slide|NextSlide|PreviousSlide|FirstSlide|LastSlide|And(?:Stop|Play))|e(?:nre|t(?:R(?:GB|o(?:otNode|wCount)|e(?:sizable|mote))|X(?:AxisTitle)?|M(?:i(?:n(?:imum(?:Size)?|utes)|lliseconds)|onth(?:Names)?|ultilineMode|e(?:ssage|nu(?:ItemAt|EnabledAt|At))|aximum(?:Size)?)|B(?:ytes(?:Total|Loaded)|ounds|utton(?:s|Width)|eginIndex|a(?:ndwidthLimit|ckground))|S(?:howAsDisabled|croll(?:ing|Speed|Content|Position|barState|Location)|t(?:yle(?:Names)?|opOnFocus|ate)|ize|o(?:urce|rtState)|p(?:litterBarPosition|acing)|e(?:conds|lect(?:Multiple|ion(?:Required|Type)|Style|ed(?:Node(?:s)?|Cell
 |Text|I(?:nd(?:ices|ex)|tem(?:s)?))?)|rvice)|moothness|WFVersion)|H(?:ighlight(?:s|Color)|ours|e(?:ight|ader(?:Height|Text|Property|Format|Width|Location)?)|as(?:Shader|CloseBox))|Y(?:ear|AxisTitle)?|N(?:o(?:tices|de(?:DisplayedAt|At))|um(?:Children|berAvailable)|e(?:wTextFormat|xtHighestDepth))|C(?:h(?:ild(?:S(?:creen|lide)|Nodes|Form|At)|artTitle)|o(?:n(?:tent|figInfo)|okie|de|unt|lumn(?:Names|Count|Index|At))|uePoint|ellIndex|loseHandler|a(?:ll|retIndex))|T(?:ypedValue|i(?:tle(?:barHeight)?|p(?:Target|Offset)?|me(?:stamp|zoneOffset|out(?:State|Handler)|r)?)|oggle|ext(?:Extent|Format)?|r(?:ee(?:NodeAt|Length)|ans(?:form|actionId)))|I(?:s(?:Branch|Open)|n(?:stanceAtDepth|d(?:icesByKey|exByKey))|con(?:SymbolName)?|te(?:rator|m(?:sByKey|By(?:Name|Key)|id|ID|At))|d)|O(?:utput(?:Parameter(?:s|ByName)?|Value(?:s)?)|peration|ri(?:entation|ginalCellData))|D(?:i(?:s(?:play(?:Range|Mode|Clip|Index|edMonth)|kUsage)|rection)|uration|e(?:pth|faultNodeIconSymbolName|l(?:taPacket|ay)|bug(?:Confi
 g|ID)?)|a(?:y(?:OfWeekNames)?|t(?:e|a(?:Mapping(?:s)?|Item(?:Text|Property|Format)|Label|All(?:Height|Property|Format|Width))?))|rawConnectors)|U(?:se(?:Shadow|HandCursor|rInput|Fade)|RL|TC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear))|P(?:o(?:sition|ds)|ercentComplete|a(?:n(?:e(?:M(?:inimums|aximums)|Height|Title|Width))?|rentNode)|r(?:operty(?:Name|Data)?|efer(?:ences|red(?:Height|Width))))|E(?:n(?:dIndex|abled)|ditingData|x(?:panderSymbolName|andNodeTrigger))|V(?:iewed(?:Pods|Applications)|olume|ersion|alue(?:Source)?)|F(?:i(?:eld|rst(?:DayOfWeek|VisibleNode))|o(?:ntList|cus)|ullYear|ade(?:InLength|OutLength)|rame(?:Color|Width))|Width|L(?:ine(?:Color|Weight)|o(?:cal|adTarget)|ength|a(?:stTabIndex|bel(?:Source)?))|A(?:s(?:cii|Boolean|String|Number)|n(?:yTypedValue|imation)|ctiv(?:eState(?:Handler)?|ateHandler)|utoH(?:ideScrollBar|eight)|llItems|gent))?)?|lobal(?:StyleFormat|ToLocal)?|ain|roupName)|x(?:updatePackety|mlDecl)?|m(?:y(?:MethodName|Call)|in(?:im
 um)?|o(?:nthNames|tion(?:TimeOut|Level)|de(?:lChanged)?|use(?:Move|O(?:ut|ver)|Down(?:Somewhere|Outside)?|Up(?:Somewhere)?|WheelEnabled)|ve(?:To)?)|u(?:ted|lti(?:pleS(?:imultaneousAllowed|elections)|line))|e(?:ssage|nu(?:Show|Hide)?|th(?:od)?|diaType)|a(?:nufacturer|tch|x(?:scroll|hscroll|imum|HPosition|Chars|VPosition)?)|b(?:substring|chr|ord|length))|b(?:ytes(?:Total|Loaded)|indFormat(?:Strings|Function)|o(?:ttom(?:Scroll)?|ld|rder(?:Color)?)|u(?:tton(?:Height|Width)|iltInItems|ffer(?:Time|Length)|llet)|e(?:foreApplyUpdates|gin(?:GradientFill|Fill))|lockIndent|a(?:ndwidth|ckground(?:Style|Color|Disabled)?)|roadcastMessage)|onHTTPStatus)\\b' },
+         { token: 'support.constant.actionscript.2',
+           regex: '\\b(?:__proto__|__resolve|_accProps|_alpha|_changed|_currentframe|_droptarget|_flash|_focusrect|_framesloaded|_global|_height|_highquality|_level|_listeners|_lockroot|_name|_parent|_quality|_root|_rotation|_soundbuftime|_target|_totalframes|_url|_visible|_width|_x|_xmouse|_xscale|_y|_ymouse|_yscale)\\b' },
+         { token: 'keyword.control.actionscript.2',
+           regex: '\\b(?:dynamic|extends|import|implements|interface|public|private|new|static|super|var|for|in|break|continue|while|do|return|if|else|case|switch)\\b' },
+         { token: 'storage.type.actionscript.2',
+           regex: '\\b(?:Boolean|Number|String|Void)\\b' },
+         { token: 'constant.language.actionscript.2',
+           regex: '\\b(?:null|undefined|true|false)\\b' },
+         { token: 'constant.numeric.actionscript.2',
+           regex: '\\b(?:0(?:x|X)[0-9a-fA-F]*|(?:[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:(?:e|E)(?:\\+|-)?[0-9]+)?)(?:L|l|UL|ul|u|U|F|f)?\\b' },
+         { token: 'punctuation.definition.string.begin.actionscript.2',
+           regex: '"',
+           push: 
+            [ { token: 'punctuation.definition.string.end.actionscript.2',
+                regex: '"',
+                next: 'pop' },
+              { token: 'constant.character.escape.actionscript.2',
+                regex: '\\\\.' },
+              { defaultToken: 'string.quoted.double.actionscript.2' } ] },
+         { token: 'punctuation.definition.string.begin.actionscript.2',
+           regex: '\'',
+           push: 
+            [ { token: 'punctuation.definition.string.end.actionscript.2',
+                regex: '\'',
+                next: 'pop' },
+              { token: 'constant.character.escape.actionscript.2',
+                regex: '\\\\.' },
+              { defaultToken: 'string.quoted.single.actionscript.2' } ] },
+         { token: 'support.constant.actionscript.2',
+           regex: '\\b(?:BACKSPACE|CAPSLOCK|CONTROL|DELETEKEY|DOWN|END|ENTER|HOME|INSERT|LEFT|LN10|LN2|LOG10E|LOG2E|MAX_VALUE|MIN_VALUE|NEGATIVE_INFINITY|NaN|PGDN|PGUP|PI|POSITIVE_INFINITY|RIGHT|SPACE|SQRT1_2|SQRT2|UP)\\b' },
+         { token: 'punctuation.definition.comment.actionscript.2',
+           regex: '/\\*',
+           push: 
+            [ { token: 'punctuation.definition.comment.actionscript.2',
+                regex: '\\*/',
+                next: 'pop' },
+              { defaultToken: 'comment.block.actionscript.2' } ] },
+         { token: 'punctuation.definition.comment.actionscript.2',
+           regex: '//.*$',
+           push_: 
+            [ { token: 'comment.line.double-slash.actionscript.2',
+                regex: '$',
+                next: 'pop' },
+              { defaultToken: 'comment.line.double-slash.actionscript.2' } ] },
+         { token: 'keyword.operator.actionscript.2',
+           regex: '\\binstanceof\\b' },
+         { token: 'keyword.operator.symbolic.actionscript.2',
+           regex: '[-!%&*+=/?:]' },
+         { token: 
+            [ 'meta.preprocessor.actionscript.2',
+              'punctuation.definition.preprocessor.actionscript.2',
+              'meta.preprocessor.actionscript.2' ],
+           regex: '^([ \\t]*)(#)([a-zA-Z]+)' },
+         { token: 
+            [ 'storage.type.function.actionscript.2',
+              'meta.function.actionscript.2',
+              'entity.name.function.actionscript.2',
+              'meta.function.actionscript.2',
+              'punctuation.definition.parameters.begin.actionscript.2' ],
+           regex: '\\b(function)(\\s+)([a-zA-Z_]\\w*)(\\s*)(\\()',
+           push: 
+            [ { token: 'punctuation.definition.parameters.end.actionscript.2',
+                regex: '\\)',
+                next: 'pop' },
+              { token: 'variable.parameter.function.actionscript.2',
+                regex: '[^,)$]+' },
+              { defaultToken: 'meta.function.actionscript.2' } ] },
+         { token: 
+            [ 'storage.type.class.actionscript.2',
+              'meta.class.actionscript.2',
+              'entity.name.type.class.actionscript.2',
+              'meta.class.actionscript.2',
+              'storage.modifier.extends.actionscript.2',
+              'meta.class.actionscript.2',
+              'entity.other.inherited-class.actionscript.2' ],
+           regex: '\\b(class)(\\s+)([a-zA-Z_](?:\\w|\\.)*)(?:(\\s+)(extends)(\\s+)([a-zA-Z_](?:\\w|\\.)*))?' } ] }
+    
+    this.normalizeRules();
+};
+
+ActionScriptHighlightRules.metaData = { fileTypes: [ 'as' ],
+      keyEquivalent: '^~A',
+      name: 'ActionScript',
+      scopeName: 'source.actionscript.2' }
+
+
+oop.inherits(ActionScriptHighlightRules, TextHighlightRules);
+
+exports.ActionScriptHighlightRules = ActionScriptHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/ada.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/ada.js b/src/fauxton/assets/js/libs/ace/mode/ada.js
new file mode 100644
index 0000000..d368bfd
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/ada.js
@@ -0,0 +1,54 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var AdaHighlightRules = require("./ada_highlight_rules").AdaHighlightRules;
+var Range = require("../range").Range;
+
+var Mode = function() {
+    this.HighlightRules = AdaHighlightRules;
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = "--";
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+
+});
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/ada_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/ada_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/ada_highlight_rules.js
new file mode 100644
index 0000000..b345966
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/ada_highlight_rules.js
@@ -0,0 +1,93 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var AdaHighlightRules = function() {
+var keywords = "abort|else|new|return|abs|elsif|not|reverse|abstract|end|null|accept|entry|select|" +
+"access|exception|of|separate|aliased|exit|or|some|all|others|subtype|and|for|out|synchronized|" +
+"array|function|overriding|at|tagged|generic|package|task|begin|goto|pragma|terminate|" +
+"body|private|then|if|procedure|type|case|in|protected|constant|interface|until|" +
+"|is|raise|use|declare|range|delay|limited|record|when|delta|loop|rem|while|digits|renames|with|do|mod|requeue|xor";
+
+    var builtinConstants = (
+        "true|false|null"
+    );
+
+    var builtinFunctions = (
+        "count|min|max|avg|sum|rank|now|coalesce|main"
+    );
+
+    var keywordMapper = this.createKeywordMapper({
+        "support.function": builtinFunctions,
+        "keyword": keywords,
+        "constant.language": builtinConstants
+    }, "identifier", true);
+
+    this.$rules = {
+        "start" : [ {
+            token : "comment",
+            regex : "--.*$"
+        }, {
+            token : "string",           // " string
+            regex : '".*?"'
+        }, {
+            token : "string",           // ' string
+            regex : "'.*?'"
+        }, {
+            token : "constant.numeric", // float
+            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+        }, {
+            token : keywordMapper,
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        }, {
+            token : "keyword.operator",
+            regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
+        }, {
+            token : "paren.lparen",
+            regex : "[\\(]"
+        }, {
+            token : "paren.rparen",
+            regex : "[\\)]"
+        }, {
+            token : "text",
+            regex : "\\s+"
+        } ]
+    };
+};
+
+oop.inherits(AdaHighlightRules, TextHighlightRules);
+
+exports.AdaHighlightRules = AdaHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/asciidoc.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/asciidoc.js b/src/fauxton/assets/js/libs/ace/mode/asciidoc.js
new file mode 100644
index 0000000..02979f5
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/asciidoc.js
@@ -0,0 +1,64 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var AsciidocHighlightRules = require("./asciidoc_highlight_rules").AsciidocHighlightRules;
+var AsciidocFoldMode = require("./folding/asciidoc").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = AsciidocHighlightRules;
+    
+    this.foldingRules = new AsciidocFoldMode();    
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.type = "text";
+    this.getNextLineIndent = function(state, line, tab) {
+        if (state == "listblock") {
+            var match = /^((?:.+)?)([-+*][ ]+)/.exec(line);
+            if (match) {
+                return new Array(match[1].length + 1).join(" ") + match[2];
+            } else {
+                return "";
+            }
+        } else {
+            return this.$getIndent(line);
+        }
+    };
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/asciidoc_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/asciidoc_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/asciidoc_highlight_rules.js
new file mode 100644
index 0000000..c0d1a30
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/asciidoc_highlight_rules.js
@@ -0,0 +1,234 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var AsciidocHighlightRules = function() {
+    var identifierRe = "[a-zA-Z\u00a1-\uffff]+\\b";
+
+    this.$rules = {
+        "start": [
+            {token: "empty",   regex: /$/},
+            {token: "literal", regex: /^\.{4,}\s*$/,  next: "listingBlock"},
+            {token: "literal", regex: /^-{4,}\s*$/,   next: "literalBlock"},
+            {token: "string",  regex: /^\+{4,}\s*$/,  next: "passthroughBlock"},
+            {token: "keyword", regex: /^={4,}\s*$/},
+            {token: "text",    regex: /^\s*$/},
+            // immediately return to the start mode without matching anything
+            {token: "empty", regex: "", next: "dissallowDelimitedBlock"}
+        ],
+
+        "dissallowDelimitedBlock": [
+            {include: "paragraphEnd"},
+            {token: "comment", regex: '^//.+$'},
+            {token: "keyword", regex: "^(?:NOTE|TIP|IMPORTANT|WARNING|CAUTION):"},
+
+            {include: "listStart"},
+            {token: "literal", regex: /^\s+.+$/, next: "indentedBlock"},
+            {token: "empty",   regex: "", next: "text"}
+        ],
+
+        "paragraphEnd": [
+            {token: "doc.comment", regex: /^\/{4,}\s*$/,    next: "commentBlock"},
+            {token: "tableBlock",  regex: /^\s*[|!]=+\s*$/, next: "tableBlock"},
+            // open block, ruller
+            {token: "keyword",     regex: /^(?:--|''')\s*$/, next: "start"},
+            {token: "option",      regex: /^\[.*\]\s*$/,     next: "start"},
+            {token: "pageBreak",   regex: /^>{3,}$/,         next: "start"},
+            {token: "literal",     regex: /^\.{4,}\s*$/,     next: "listingBlock"},
+            {token: "titleUnderline",    regex: /^(?:={2,}|-{2,}|~{2,}|\^{2,}|\+{2,})\s*$/, next: "start"},
+            {token: "singleLineTitle",   regex: /^={1,5}\s+\S.*$/, next: "start"},
+
+            {token: "otherBlock",    regex: /^(?:\*{2,}|_{2,})\s*$/, next: "start"},
+            // .optional title
+            {token: "optionalTitle", regex: /^\.[^.\s].+$/,  next: "start"}
+        ],
+
+        "listStart": [
+            {token: "keyword",  regex: /^\s*(?:\d+\.|[a-zA-Z]\.|[ixvmIXVM]+\)|\*{1,5}|-|\.{1,5})\s/, next: "listText"},
+            {token: "meta.tag", regex: /^.+(?::{2,4}|;;)(?: |$)/, next: "listText"},
+            {token: "support.function.list.callout", regex: /^(?:<\d+>|\d+>|>) /, next: "text"},
+            // continuation
+            {token: "keyword",  regex: /^\+\s*$/, next: "start"}
+        ],
+
+        "text": [
+            {token: ["link", "variable.language"], regex: /((?:https?:\/\/|ftp:\/\/|file:\/\/|mailto:|callto:)[^\s\[]+)(\[.*?\])/},
+            {token: "link", regex: /(?:https?:\/\/|ftp:\/\/|file:\/\/|mailto:|callto:)[^\s\[]+/},
+            {token: "link", regex: /\b[\w\.\/\-]+@[\w\.\/\-]+\b/},
+            {include: "macros"},
+            {include: "paragraphEnd"},
+            {token: "literal", regex:/\+{3,}/, next:"smallPassthrough"},
+            {token: "escape", regex: /\((?:C|TM|R)\)|\.{3}|->|<-|=>|<=|&#(?:\d+|x[a-fA-F\d]+);|(?: |^)--(?=\s+\S)/},
+            {token: "escape", regex: /\\[_*'`+#]|\\{2}[_*'`+#]{2}/},
+            {token: "keyword", regex: /\s\+$/},
+            // any word
+            {token: "text", regex: identifierRe},
+            {token: ["keyword", "string", "keyword"],
+                regex: /(<<[\w\d\-$]+,)(.*?)(>>|$)/},
+            {token: "keyword", regex: /<<[\w\d\-$]+,?|>>/},
+            {token: "constant.character", regex: /\({2,3}.*?\){2,3}/},
+            // Anchor
+            {token: "keyword", regex: /\[\[.+?\]\]/},
+            // bibliography
+            {token: "support", regex: /^\[{3}[\w\d =\-]+\]{3}/},
+
+            {include: "quotes"},
+            // text block end
+            {token: "empty", regex: /^\s*$/, next: "start"}
+        ],
+
+        "listText": [
+            {include: "listStart"},
+            {include: "text"}
+        ],
+
+        "indentedBlock": [
+            {token: "literal", regex: /^[\s\w].+$/, next: "indentedBlock"},
+            {token: "literal", regex: "", next: "start"}
+        ],
+
+        "listingBlock": [
+            {token: "literal", regex: /^\.{4,}\s*$/, next: "dissallowDelimitedBlock"},
+            {token: "constant.numeric", regex: '<\\d+>'},
+            {token: "literal", regex: '[^<]+'},
+            {token: "literal", regex: '<'}
+        ],
+        "literalBlock": [
+            {token: "literal", regex: /^-{4,}\s*$/, next: "dissallowDelimitedBlock"},
+            {token: "constant.numeric", regex: '<\\d+>'},
+            {token: "literal", regex: '[^<]+'},
+            {token: "literal", regex: '<'}
+        ],
+        "passthroughBlock": [
+            {token: "literal", regex: /^\+{4,}\s*$/, next: "dissallowDelimitedBlock"},
+            {token: "literal", regex: identifierRe + "|\\d+"},
+            {include: "macros"},
+            {token: "literal", regex: "."}
+        ],
+
+        "smallPassthrough": [
+            {token: "literal", regex: /[+]{3,}/, next: "dissallowDelimitedBlock"},
+            {token: "literal", regex: /^\s*$/, next: "dissallowDelimitedBlock"},
+            {token: "literal", regex: identifierRe + "|\\d+"},
+            {include: "macros"}
+        ],
+
+        "commentBlock": [
+            {token: "doc.comment", regex: /^\/{4,}\s*$/, next: "dissallowDelimitedBlock"},
+            {token: "doc.comment", regex: '^.*$'}
+        ],
+        "tableBlock": [
+            {token: "tableBlock", regex: /^\s*\|={3,}\s*$/, next: "dissallowDelimitedBlock"},
+            {token: "tableBlock", regex: /^\s*!={3,}\s*$/, next: "innerTableBlock"},
+            {token: "tableBlock", regex: /\|/},
+            {include: "text", noEscape: true}
+        ],
+        "innerTableBlock": [
+            {token: "tableBlock", regex: /^\s*!={3,}\s*$/, next: "tableBlock"},
+            {token: "tableBlock", regex: /^\s*|={3,}\s*$/, next: "dissallowDelimitedBlock"},
+            {token: "tableBlock", regex: /\!/}
+        ],
+        "macros": [
+            {token: "macro", regex: /{[\w\-$]+}/},
+            {token: ["text", "string", "text", "constant.character", "text"], regex: /({)([\w\-$]+)(:)?(.+)?(})/},
+            {token: ["text", "markup.list.macro", "keyword", "string"], regex: /(\w+)(footnote(?:ref)?::?)([^\s\[]+)?(\[.*?\])?/},
+            {token: ["markup.list.macro", "keyword", "string"], regex: /([a-zA-Z\-][\w\.\/\-]*::?)([^\s\[]+)(\[.*?\])?/},
+            {token: ["markup.list.macro", "keyword"], regex: /([a-zA-Z\-][\w\.\/\-]+::?)(\[.*?\])/},
+            {token: "keyword",     regex: /^:.+?:(?= |$)/}
+        ],
+
+        "quotes": [
+            {token: "string.italic", regex: /__[^_\s].*?__/},
+            {token: "string.italic", regex: quoteRule("_")},
+            
+            {token: "keyword.bold", regex: /\*\*[^*\s].*?\*\*/},
+            {token: "keyword.bold", regex: quoteRule("\\*")},
+            
+            {token: "literal", regex: quoteRule("\\+")},
+            {token: "literal", regex: /\+\+[^+\s].*?\+\+/},
+            {token: "literal", regex: /\$\$.+?\$\$/},
+            {token: "literal", regex: quoteRule("`")},
+
+            {token: "keyword", regex: quoteRule("^")},
+            {token: "keyword", regex: quoteRule("~")},
+            {token: "keyword", regex: /##?/},
+            {token: "keyword", regex: /(?:\B|^)``|\b''/}
+        ]
+
+    };
+
+    function quoteRule(ch) {
+        var prefix = /\w/.test(ch) ? "\\b" : "(?:\\B|^)";
+        return prefix + ch + "[^" + ch + "].*?" + ch + "(?![\\w*])";
+    }
+
+    //addQuoteBlock("text")
+
+    var tokenMap = {
+        macro: "constant.character",
+        tableBlock: "doc.comment",
+        titleUnderline: "markup.heading",
+        singleLineTitle: "markup.heading",
+        pageBreak: "string",
+        option: "string.regexp",
+        otherBlock: "markup.list",
+        literal: "support.function",
+        optionalTitle: "constant.numeric",
+        escape: "constant.language.escape",
+        link: "markup.underline.list"
+    };
+
+    for (var state in this.$rules) {
+        var stateRules = this.$rules[state];
+        for (var i = stateRules.length; i--; ) {
+            var rule = stateRules[i];
+            if (rule.include || typeof rule == "string") {
+                var args = [i, 1].concat(this.$rules[rule.include || rule]);
+                if (rule.noEscape) {
+                    args = args.filter(function(x) {
+                        return !x.next;
+                    });
+                }
+                stateRules.splice.apply(stateRules, args);
+            } else if (rule.token in tokenMap) {
+                rule.token = tokenMap[rule.token];
+            }
+        }
+    }
+};
+oop.inherits(AsciidocHighlightRules, TextHighlightRules);
+
+exports.AsciidocHighlightRules = AsciidocHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/assembly_x86.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/assembly_x86.js b/src/fauxton/assets/js/libs/ace/mode/assembly_x86.js
new file mode 100644
index 0000000..2698919
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/assembly_x86.js
@@ -0,0 +1,56 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var AssemblyX86HighlightRules = require("./assembly_x86_highlight_rules").AssemblyX86HighlightRules;
+var FoldMode = require("./folding/coffee").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = AssemblyX86HighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = ";";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/assembly_x86_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/assembly_x86_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/assembly_x86_highlight_rules.js
new file mode 100644
index 0000000..247d1d0
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/assembly_x86_highlight_rules.js
@@ -0,0 +1,114 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* This file was autogenerated from Assembly x86.tmLanguage (uuid: ) */
+/****************************************************************************************
+ * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
+ * fileTypes                                                                            *
+ ****************************************************************************************/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var AssemblyX86HighlightRules = function() {
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = { start: 
+       [ { token: 'keyword.control.assembly',
+           regex: '\\b(?:aaa|aad|aam|aas|adc|add|addpd|addps|addsd|addss|addsubpd|addsubps|aesdec|aesdeclast|aesenc|aesenclast|aesimc|aeskeygenassist|and|andpd|andps|andnpd|andnps|arpl|blendpd|blendps|blendvpd|blendvps|bound|bsf|bsr|bswap|bt|btc|btr|bts|cbw|cwde|cdqe|clc|cld|cflush|clts|cmc|cmov(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|cmp|cmppd|cmpps|cmps|cnpsb|cmpsw|cmpsd|cmpsq|cmpss|cmpxchg|cmpxchg8b|cmpxchg16b|comisd|comiss|cpuid|crc32|cvtdq2pd|cvtdq2ps|cvtpd2dq|cvtpd2pi|cvtpd2ps|cvtpi2pd|cvtpi2ps|cvtps2dq|cvtps2pd|cvtps2pi|cvtsd2si|cvtsd2ss|cvts2sd|cvtsi2ss|cvtss2sd|cvtss2si|cvttpd2dq|cvtpd2pi|cvttps2dq|cvttps2pi|cvttps2dq|cvttps2pi|cvttsd2si|cvttss2si|cwd|cdq|cqo|daa|das|dec|div|divpd|divps|divsd|divss|dppd|dpps|emms|enter|extractps|f2xm1|fabs|fadd|faddp|fiadd|fbld|fbstp|fchs|fclex|fnclex|fcmov(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|fcom|fcmop|fcompp|fcomi|fcomip|fucomi|fucomip|fcos|fdecstp|fdiv|fdivp|fidiv|fdivr|fdivrp|fidivr|ffree|ficom|ficomp|fild|fincstp|finit|fnint|fist|fistp|fisttp|fld|fl
 d1|fldl2t|fldl2e|fldpi|fldlg2|fldln2|fldz|fldcw|fldenv|fmul|fmulp|fimul|fnop|fpatan|fprem|fprem1|fptan|frndint|frstor|fsave|fnsave|fscale|fsin|fsincos|fsqrt|fst|fstp|fstcw|fnstcw|fstenv|fnstenv|fsts|fnstsw|fsub|fsubp|fisub|fsubr|fsubrp|fisubr|ftst|fucom|fucomp|fucompp|fxam|fxch|fxrstor|fxsave|fxtract|fyl2x|fyl2xp1|haddpd|haddps|husbpd|hsubps|idiv|imul|in|inc|ins|insb|insw|insd|insertps|int|into|invd|invplg|invpcid|iret|iretd|iretq|lahf|lar|lddqu|ldmxcsr|lds|les|lfs|lgs|lss|lea|leave|lfence|lgdt|lidt|llgdt|lmsw|lock|lods|lodsb|lodsw|lodsd|lodsq|lsl|ltr|maskmovdqu|maskmovq|maxpd|maxps|maxsd|maxss|mfence|minpd|minps|minsd|minss|monitor|mov|movapd|movaps|movbe|movd|movq|movddup|movdqa|movdqu|movq2q|movhlps|movhpd|movhps|movlhps|movlpd|movlps|movmskpd|movmskps|movntdqa|movntdq|movnti|movntpd|movntps|movntq|movq|movq2dq|movs|movsb|movsw|movsd|movsq|movsd|movshdup|movsldup|movss|movsx|movsxd|movupd|movups|movzx|mpsadbw|mul|mulpd|mulps|mulsd|mulss|mwait|neg|not|or|orpd|orps|out|outs|outsb|o
 utsw|outsd|pabsb|pabsw|pabsd|packsswb|packssdw|packusdw|packuswbpaddb|paddw|paddd|paddq|paddsb|paddsw|paddusb|paddusw|palignr|pand|pandn|pause|pavgb|pavgw|pblendvb|pblendw|pclmulqdq|pcmpeqb|pcmpeqw|pcmpeqd|pcmpeqq|pcmpestri|pcmpestrm|pcmptb|pcmptgw|pcmpgtd|pcmpgtq|pcmpistri|pcmpisrm|pextrb|pextrd|pextrq|pextrw|phaddw|phaddd|phaddsw|phinposuw|phsubw|phsubd|phsubsw|pinsrb|pinsrd|pinsrq|pinsrw|pmaddubsw|pmadddwd|pmaxsb|pmaxsd|pmaxsw|pmaxsw|pmaxub|pmaxud|pmaxuw|pminsb|pminsd|pminsw|pminub|pminud|pminuw|pmovmskb|pmovsx|pmovzx|pmuldq|pmulhrsw|pmulhuw|pmulhw|pmulld|pmullw|pmuludw|pop|popa|popad|popcnt|popf|popfd|popfq|por|prefetch|psadbw|pshufb|pshufd|pshufhw|pshuflw|pshufw|psignb|psignw|psignd|pslldq|psllw|pslld|psllq|psraw|psrad|psrldq|psrlw|psrld|psrlq|psubb|psubw|psubd|psubq|psubsb|psubsw|psubusb|psubusw|test|ptest|punpckhbw|punpckhwd|punpckhdq|punpckhddq|punpcklbw|punpcklwd|punpckldq|punpckldqd|push|pusha|pushad|pushf|pushfd|pxor|prcl|rcr|rol|ror|rcpps|rcpss|rdfsbase|rdgsbase|rdmsr|rd
 pmc|rdrand|rdtsc|rdtscp|rep|repe|repz|repne|repnz|roundpd|roundps|roundsd|roundss|rsm|rsqrps|rsqrtss|sahf|sal|sar|shl|shr|sbb|scas|scasb|scasw|scasd|set(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|sfence|sgdt|shld|shrd|shufpd|shufps|sidt|sldt|smsw|sqrtpd|sqrtps|sqrtsd|sqrtss|stc|std|stmxcsr|stos|stosb|stosw|stosd|stosq|str|sub|subpd|subps|subsd|subss|swapgs|syscall|sysenter|sysexit|sysret|teset|ucomisd|ucomiss|ud2|unpckhpd|unpckhps|unpcklpd|unpcklps|vbroadcast|vcvtph2ps|vcvtp2sph|verr|verw|vextractf128|vinsertf128|vmaskmov|vpermilpd|vpermilps|vperm2f128|vtestpd|vtestps|vzeroall|vzeroupper|wait|fwait|wbinvd|wrfsbase|wrgsbase|wrmsr|xadd|xchg|xgetbv|xlat|xlatb|xor|xorpd|xorps|xrstor|xsave|xsaveopt|xsetbv|lzcnt|extrq|insertq|movntsd|movntss|vfmaddpd|vfmaddps|vfmaddsd|vfmaddss|vfmaddsubbpd|vfmaddsubps|vfmsubaddpd|vfmsubaddps|vfmsubpd|vfmsubps|vfmsubsd|vfnmaddpd|vfnmaddps|vfnmaddsd|vfnmaddss|vfnmsubpd|vfnmusbps|vfnmusbsd|vfnmusbss|cvt|xor|cli|sti|hlt|nop|lock|wait|enter|leave|ret|loop(?:n?e|n?z)?|call
 |j(?:mp|n?e|ge?|ae?|le?|be?|n?o|n?z))\\b',
+           caseInsensitive: true },
+         { token: 'variable.parameter.register.assembly',
+           regex: '\\b(?:CS|DS|ES|FS|GS|SS|RAX|EAX|RBX|EBX|RCX|ECX|RDX|EDX|RCX|RIP|EIP|IP|RSP|ESP|SP|RSI|ESI|SI|RDI|EDI|DI|RFLAGS|EFLAGS|FLAGS|R8-15|(?:Y|X)MM(?:[0-9]|10|11|12|13|14|15)|(?:A|B|C|D)(?:X|H|L)|CR(?:[0-4]|DR(?:[0-7]|TR6|TR7|EFER)))\\b',
+           caseInsensitive: true },
+         { token: 'constant.character.decimal.assembly',
+           regex: '\\b[0-9]+\\b' },
+         { token: 'constant.character.hexadecimal.assembly',
+           regex: '\\b0x[A-F0-9]+\\b',
+           caseInsensitive: true },
+         { token: 'constant.character.hexadecimal.assembly',
+           regex: '\\b[A-F0-9]+h\\b',
+           caseInsensitive: true },
+         { token: 'string.assembly', regex: /'([^\\']|\\.)*'/ },
+         { token: 'string.assembly', regex: /"([^\\"]|\\.)*"/ },
+         { token: 'support.function.directive.assembly',
+           regex: '^\\[',
+           push: 
+            [ { token: 'support.function.directive.assembly',
+                regex: '\\]$',
+                next: 'pop' },
+              { defaultToken: 'support.function.directive.assembly' } ] },
+         { token: 
+            [ 'support.function.directive.assembly',
+              'support.function.directive.assembly',
+              'entity.name.function.assembly' ],
+           regex: '(^struc)( )([_a-zA-Z][_a-zA-Z0-9]*)' },
+         { token: 'support.function.directive.assembly',
+           regex: '^endstruc\\b' },
+        { token: 
+            [ 'support.function.directive.assembly',
+              'entity.name.function.assembly',
+              'support.function.directive.assembly',
+              'constant.character.assembly' ],
+           regex: '^(%macro )([_a-zA-Z][_a-zA-Z0-9]*)( )([0-9]+)' },
+         { token: 'support.function.directive.assembly',
+           regex: '^%endmacro' },
+         { token: 
+            [ 'text',
+              'support.function.directive.assembly',
+              'text',
+              'entity.name.function.assembly' ],
+           regex: '(\\s*)(%define|%xdefine|%idefine|%undef|%assign|%defstr|%strcat|%strlen|%substr|%00|%0|%rotate|%rep|%endrep|%include|\\$\\$|\\$|%unmacro|%if|%elif|%else|%endif|%(?:el)?ifdef|%(?:el)?ifmacro|%(?:el)?ifctx|%(?:el)?ifidn|%(?:el)?ifidni|%(?:el)?ifid|%(?:el)?ifnum|%(?:el)?ifstr|%(?:el)?iftoken|%(?:el)?ifempty|%(?:el)?ifenv|%pathsearch|%depend|%use|%push|%pop|%repl|%arg|%stacksize|%local|%error|%warning|%fatal|%line|%!|%comment|%endcomment|__NASM_VERSION_ID__|__NASM_VER__|__FILE__|__LINE__|__BITS__|__OUTPUT_FORMAT__|__DATE__|__TIME__|__DATE_NUM__|_TIME__NUM__|__UTC_DATE__|__UTC_TIME__|__UTC_DATE_NUM__|__UTC_TIME_NUM__|__POSIX_TIME__|__PASS__|ISTRUC|AT|IEND|BITS 16|BITS 32|BITS 64|USE16|USE32|__SECT__|ABSOLUTE|EXTERN|GLOBAL|COMMON|CPU|FLOAT)\\b( ?)((?:[_a-zA-Z][_a-zA-Z0-9]*)?)',
+           caseInsensitive: true },
+          { token: 'support.function.directive.assembly',
+           regex: '\\b(?:d[bwdqtoy]|res[bwdqto]|equ|times|align|alignb|sectalign|section|ptr|byte|word|dword|qword|incbin)\\b',
+           caseInsensitive: true },
+         { token: 'entity.name.function.assembly', regex: '^\\s*%%[\\w.]+?:$' },
+         { token: 'entity.name.function.assembly', regex: '^\\s*%\\$[\\w.]+?:$' },
+         { token: 'entity.name.function.assembly', regex: '^[\\w.]+?:' },
+         { token: 'entity.name.function.assembly', regex: '^[\\w.]+?\\b' },
+         { token: 'comment.assembly', regex: ';.*$' } ] 
+    }
+    
+    this.normalizeRules();
+};
+
+AssemblyX86HighlightRules.metaData = { fileTypes: [ 'asm' ],
+      name: 'Assembly x86',
+      scopeName: 'source.assembly' }
+
+
+oop.inherits(AssemblyX86HighlightRules, TextHighlightRules);
+
+exports.AssemblyX86HighlightRules = AssemblyX86HighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/autohotkey.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/autohotkey.js b/src/fauxton/assets/js/libs/ace/mode/autohotkey.js
new file mode 100644
index 0000000..2a9ecee
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/autohotkey.js
@@ -0,0 +1,62 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ *
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var AutoHotKeyHighlightRules = require("./autohotkey_highlight_rules").AutoHotKeyHighlightRules;
+// TODO: pick appropriate fold mode
+var FoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = AutoHotKeyHighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = "/\\*";
+    this.blockComment = {start: "/*", end: "*/"};
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file


[22/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/css_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/css_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/css_highlight_rules.js
new file mode 100644
index 0000000..12b3d8f
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/css_highlight_rules.js
@@ -0,0 +1,179 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+
+/* All exports are for Stylus highlighter */
+var supportType = exports.supportType = "animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|b
 order-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-characte
 r|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-befo
 re|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index";
+var supportFunction = exports.supportFunction = "rgb|rgba|url|attr|counter|counters";
+var supportConstant = exports.supportConstant = "absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|i
 nline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-botto
 m|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero";
+var supportConstantColor = exports.supportConstantColor = "aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow";
+var supportConstantFonts = exports.supportConstantFonts = "arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace";
+
+var numRe = exports.numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
+var pseudoElements = exports.pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
+var pseudoClasses  = exports.pseudoClasses =  "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
+
+var CssHighlightRules = function() {
+
+    var keywordMapper = this.createKeywordMapper({
+        "support.function": supportFunction,
+        "support.constant": supportConstant,
+        "support.type": supportType,
+        "support.constant.color": supportConstantColor,
+        "support.constant.fonts": supportConstantFonts
+    }, "text", true);
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "start" : [{
+            token : "comment", // multi line comment
+            regex : "\\/\\*",
+            push : "comment"
+        }, {
+            token: "paren.lparen",
+            regex: "\\{",
+            push:  "ruleset"
+        }, {
+            token: "string",
+            regex: "@.*?{",
+            push:  "media"
+        }, {
+            token: "keyword",
+            regex: "#[a-z0-9-_]+"
+        }, {
+            token: "variable",
+            regex: "\\.[a-z0-9-_]+"
+        }, {
+            token: "string",
+            regex: ":[a-z0-9-_]+"
+        }, {
+            token: "constant",
+            regex: "[a-z0-9-_]+"
+        }, {
+            caseInsensitive: true
+        }],
+
+        "media" : [{
+            token : "comment", // multi line comment
+            regex : "\\/\\*",
+            push : "comment"
+        }, {
+            token: "paren.lparen",
+            regex: "\\{",
+            push:  "ruleset"
+        }, {
+            token: "string",
+            regex: "\\}",
+            next:  "pop"
+        }, {
+            token: "keyword",
+            regex: "#[a-z0-9-_]+"
+        }, {
+            token: "variable",
+            regex: "\\.[a-z0-9-_]+"
+        }, {
+            token: "string",
+            regex: ":[a-z0-9-_]+"
+        }, {
+            token: "constant",
+            regex: "[a-z0-9-_]+"
+        }, {
+            caseInsensitive: true
+        }],
+
+        "comment" : [{
+            token : "comment",
+            regex : "\\*\\/",
+            next : "pop"
+        }, {
+            defaultToken : "comment"
+        }],
+
+        "ruleset" : [
+        {
+            token : "paren.rparen",
+            regex : "\\}",
+            next:   "pop"
+        }, {
+            token : "comment", // multi line comment
+            regex : "\\/\\*",
+            push : "comment"
+        }, {
+            token : "string", // single line
+            regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+        }, {
+            token : "string", // single line
+            regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+        }, {
+            token : ["constant.numeric", "keyword"],
+            regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
+        }, {
+            token : "constant.numeric",
+            regex : numRe
+        }, {
+            token : "constant.numeric",  // hex6 color
+            regex : "#[a-f0-9]{6}"
+        }, {
+            token : "constant.numeric", // hex3 color
+            regex : "#[a-f0-9]{3}"
+        }, {
+            token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
+            regex : pseudoElements
+        }, {
+            token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
+            regex : pseudoClasses
+        }, {
+            token : ["support.function", "string", "support.function"],
+            regex : "(url\\()(.*)(\\))"
+        }, {
+            token : keywordMapper,
+            regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
+        }, {
+            caseInsensitive: true
+        }]
+    };
+
+    this.normalizeRules();
+};
+
+oop.inherits(CssHighlightRules, TextHighlightRules);
+
+exports.CssHighlightRules = CssHighlightRules;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/css_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/css_test.js b/src/fauxton/assets/js/libs/ace/mode/css_test.js
new file mode 100644
index 0000000..2ccb177
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/css_test.js
@@ -0,0 +1,78 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("../edit_session").EditSession;
+var CssMode = require("./css").Mode;
+var assert = require("../test/assertions");
+
+module.exports = {
+    
+    name: "CSS",
+    
+    setUp : function() {
+        this.mode = new CssMode();
+    },
+
+    "test: toggle comment lines" : function() {
+        var session = new EditSession(["  abc", "cde", "fg"].join("\n"));
+
+        var comment = this.mode.toggleCommentLines("start", session, 0, 1);
+        assert.equal(["/*  abc*/", "/*cde*/", "fg"].join("\n"), session.toString());
+    },
+
+
+    "test: lines should keep indentation" : function() {
+        assert.equal("   ", this.mode.getNextLineIndent("start", "   abc", "  "));
+        assert.equal("\t", this.mode.getNextLineIndent("start", "\tabc", "  "));
+    },
+
+    "test: new line after { should increase indent" : function() {
+        assert.equal("     ", this.mode.getNextLineIndent("start", "   abc{", "  "));
+        assert.equal("\t  ", this.mode.getNextLineIndent("start", "\tabc  { ", "  "));
+    },
+
+    "test: no indent increase after { in a comment" : function() {
+        assert.equal("   ", this.mode.getNextLineIndent("start", "   /*{", "  "));
+        assert.equal("   ", this.mode.getNextLineIndent("start", "   /*{  ", "  "));
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/css_worker.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/css_worker.js b/src/fauxton/assets/js/libs/ace/mode/css_worker.js
new file mode 100644
index 0000000..e5ef2eb
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/css_worker.js
@@ -0,0 +1,95 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var Mirror = require("../worker/mirror").Mirror;
+var CSSLint = require("./css/csslint").CSSLint;
+
+var Worker = exports.Worker = function(sender) {
+    Mirror.call(this, sender);
+    this.setTimeout(400);
+    this.ruleset = null;
+    this.setDisabledRules("ids");
+    this.setInfoRules("adjoining-classes|qualified-headings|zero-units|gradients|import|outline-none");
+};
+
+oop.inherits(Worker, Mirror);
+
+(function() {
+    this.setInfoRules = function(ruleNames) {
+        if (typeof ruleNames == "string")
+            ruleNames = ruleNames.split("|");
+        this.infoRules = lang.arrayToMap(ruleNames);
+        this.doc.getValue() && this.deferredUpdate.schedule(100);
+    };
+
+    this.setDisabledRules = function(ruleNames) {
+        if (!ruleNames) {
+            this.ruleset = null;
+        } else {
+            if (typeof ruleNames == "string")
+                ruleNames = ruleNames.split("|");
+            var all = {};
+
+            CSSLint.getRules().forEach(function(x){
+                all[x.id] = true;
+            });
+            ruleNames.forEach(function(x) {
+                delete all[x];
+            });
+            
+            this.ruleset = all;
+        }
+        this.doc.getValue() && this.deferredUpdate.schedule(100);
+    };
+
+    this.onUpdate = function() {
+        var value = this.doc.getValue();
+        var infoRules = this.infoRules;
+
+        var result = CSSLint.verify(value, this.ruleset);
+        this.sender.emit("csslint", result.messages.map(function(msg) {
+            return {
+                row: msg.line - 1,
+                column: msg.col - 1,
+                text: msg.message,
+                type: infoRules[msg.rule.id] ? "info" : msg.type,
+                rule: msg.rule.name
+            }
+        }));
+    };
+
+}).call(Worker.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/css_worker_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/css_worker_test.js b/src/fauxton/assets/js/libs/ace/mode/css_worker_test.js
new file mode 100644
index 0000000..5d5243e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/css_worker_test.js
@@ -0,0 +1,68 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var assert = require("../test/assertions");
+var Worker = require("./css_worker").Worker;
+
+
+module.exports = {
+    setUp : function() {
+        this.sender = {
+            on: function() {},
+            callback: function(data, id) {
+                this.data = data;
+            },
+            events: [],
+            emit: function(type, e) {
+                this.events.push([type, e]);
+            }
+        };
+    },
+    
+    "test check for syntax error": function() {
+        var worker = new Worker(this.sender);
+        worker.setValue("Juhu Kinners");
+        worker.deferredUpdate.call();
+        assert.equal(this.sender.events[0][1][0].type, "error");
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec();
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/curly.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/curly.js b/src/fauxton/assets/js/libs/ace/mode/curly.js
new file mode 100644
index 0000000..c98ab2e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/curly.js
@@ -0,0 +1,63 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ *
+ * Libo Cannici <libo AT zendesk DOT com>
+ *
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+// defines the parent mode
+var HtmlMode = require("./html").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+var HtmlFoldMode = require("./folding/html").FoldMode;
+
+// defines the language specific highlighters and folding rules
+var CurlyHighlightRules = require("./curly_highlight_rules").CurlyHighlightRules;
+
+var Mode = function() {
+    HtmlMode.call(this);
+    this.HighlightRules = CurlyHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+    this.foldingRules = new HtmlFoldMode();
+};
+oop.inherits(Mode, HtmlMode);
+
+(function() {
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/curly_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/curly_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/curly_highlight_rules.js
new file mode 100644
index 0000000..92e6f53
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/curly_highlight_rules.js
@@ -0,0 +1,66 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ *
+ * Libo Cannici <libo AT zendesk DOT com>
+ *
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+
+
+var CurlyHighlightRules = function() {
+    HtmlHighlightRules.call(this);
+
+    this.$rules["start"].unshift({
+        token: "variable",
+        regex: "{{",
+        push: "curly-start"
+    });
+
+    this.$rules["curly-start"] = [{
+        token: "variable",
+        regex: "}}",
+        next: "pop"
+    }];
+
+    this.normalizeRules();
+};
+
+oop.inherits(CurlyHighlightRules, HtmlHighlightRules);
+
+exports.CurlyHighlightRules = CurlyHighlightRules;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/d.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/d.js b/src/fauxton/assets/js/libs/ace/mode/d.js
new file mode 100644
index 0000000..2680366
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/d.js
@@ -0,0 +1,56 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var DHighlightRules = require("./d_highlight_rules").DHighlightRules;
+var FoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = DHighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = "/\\+";
+    this.blockComment = {start: "/*", end: "*/"};
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/d_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/d_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/d_highlight_rules.js
new file mode 100644
index 0000000..d0879fe
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/d_highlight_rules.js
@@ -0,0 +1,318 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* This file was autogenerated from G:\Program Files\sublime2\Data\Packages\D\D.tmLanguage (uuid: ) */
+/****************************************************************************************
+ * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
+ * fileTypes                                                                            *
+ ****************************************************************************************/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var DHighlightRules = function() {
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = { start: 
+       [ { token: 'punctuation.definition.comment.d', regex: '/\\*\\*/' },
+         { include: 'text.html.javadoc' },
+         { token: 
+            [ 'meta.definition.class.d',
+              'storage.modifier.d',
+              'storage.type.structure.d',
+              'meta.definition.class.d',
+              'entity.name.type.class.d',
+              'meta.definition.class.d',
+              'meta.definition.class.d',
+              'storage.type.template.d',
+              'meta.definition.class.d',
+              'meta.definition.class.d',
+              'meta.definition.class.d',
+              'punctuation.separator.inheritance.d',
+              'meta.definition.class.d',
+              'entity.other.inherited-class.d',
+              'meta.definition.class.d',
+              'entity.other.inherited-class.d',
+              'meta.definition.class.d',
+              'entity.other.inherited-class.d',
+              'meta.definition.class.d',
+              'entity.other.inherited-class.d',
+              'meta.definition.class.d',
+              'entity.other.inherited-class.d',
+              'meta.definition.class.d',
+              'entity.other.inherited-class.d',
+              'meta.definition.class.d',
+              'entity.other.inherited-class.d' ],
+           regex: '^(\\s*)((?:\\b(?:public|private|protected|static|final|native|synchronized|abstract|export)\\b\\s*)*)(class|interface)(\\s+)(\\w+)(\\s*)(?:(\\(\\s*)([^\\)]+)(\\s*\\))|)(\\s*)(?:(\\s*)(:)(\\s*)(\\w+)(?:(\\s*,\\s*)(\\w+))?(?:(\\s*,\\s*)(\\w+))?(?:(\\s*,\\s*)(\\w+))?(?:(\\s*,\\s*)(\\w+))?(?:(\\s*,\\s*)(\\w+))?(?:(\\s*,\\s*)(\\w+))?)?',
+           push: 
+            [ { token: 'meta.definition.class.d', regex: '(?={)', next: 'pop' },
+              { token: 'storage.modifier.d',
+                regex: '\\b(?:_|:)\\b',
+                push: 
+                 [ { token: [], regex: '(?={)', next: 'pop' },
+                   { include: '#all-types' },
+                   { defaultToken: 'meta.definition.class.extends.d' } ] },
+              { defaultToken: 'meta.definition.class.d' } ] },
+         { token: 
+            [ 'meta.definition.struct.d',
+              'storage.modifier.d',
+              'storage.type.structure.d',
+              'meta.definition.struct.d',
+              'entity.name.type.struct.d',
+              'meta.definition.struct.d',
+              'meta.definition.struct.d',
+              'storage.type.template.d',
+              'meta.definition.struct.d',
+              'meta.definition.struct.d' ],
+           regex: '^(\\s*)((?:\\b(?:public|private|protected|static|final|native|synchronized|abstract|export)\\b\\s*)*)(struct)(\\s+)(\\w+)(\\s*)(?:(\\(\\s*)([^\\)]+)(\\s*\\))|)(\\s*)',
+           push: 
+            [ { token: 'meta.definition.struct.d',
+                regex: '(?={)',
+                next: 'pop' },
+              { token: 'storage.modifier.d',
+                regex: '\\b(?:_|:)\\b',
+                push: 
+                 [ { token: [], regex: '(?={)', next: 'pop' },
+                   { include: '#all-types' },
+                   { defaultToken: 'meta.definition.class.extends.d' } ] },
+              { defaultToken: 'meta.definition.struct.d' } ] },
+         { token: 
+            [ 'meta.definition.constructor.d',
+              'storage.modifier.d',
+              'entity.name.function.constructor.d',
+              'meta.definition.constructor.d' ],
+           regex: '^(\\s*)((?:\\b(?:public|private|protected|static|final|native|synchronized|abstract|threadsafe|transient|export)\\b\\s*)*)(\\bthis)(\\s*)(?!.*;)(?=\\()' },
+         { token: 
+            [ 'storage.modifier.d',
+              'entity.name.function.destructor.d',
+              'meta.definition.destructor.d',
+              'meta.definition.destructor.d' ],
+           regex: '(?:^|)((?:\\b(?:public|private|protected|static|final|native|synchronized|abstract|threadsafe|transient|export)\\b\\s*)*)(~this)(\\s*)(\\()',
+           TODO: '(?<!else|new|=) were disallowed in original regex'},
+         { token: 
+            [ 'meta.definition.method.d',
+              'storage.modifier.d',
+              'storage.type.structure.d',
+              'meta.definition.method.d',
+              'entity.name.function.d',
+              'meta.definition.method.d' ],
+           regex: '^(\\s*)((?:\\b(?:public|private|protected|static|final|native|lazy|synchronized|abstract|threadsafe|transient|export)\\b\\s*)*)(\\b(?:void|boolean|byte|char|short|int|float|long|double|[\\w_]+[\\w0-9_]*|(?:\\w+\\.)*[A-Z]\\w+)\\b(?:<(?:(?:\\w+\\.)*[A-Z]\\w+(?:\\s*,\\s*)?)+>|(?:\\[\\s*\\])*)?)(\\s*)(\\w+)(\\s*)(?!.*;)(?=\\()' },
+         { token: 'constant.other.d', regex: '\\b[A-Z][A-Z0-9_]+\\b' },
+         { include: '#comments' },
+         { include: '#all-types' },
+         { token: 'storage.modifier.access-control.d',
+           regex: '\\b(?:private|protected|public|export)\\b' },
+         { token: 'storage.modifier.d',
+           regex: '\\b(?:auto|static|override|final|const|abstract|volatile|synchronized|lazy)\\b' },
+         { token: 'storage.type.structure.d',
+           regex: '\\b(?:template|interface|class|enum|struct|union)\\b' },
+         { token: 'storage.type.d',
+           regex: '\\b(?:ushort|int|uint|long|ulong|float|void|byte|ubyte|double|bit|char|wchar|ucent|cent|short|bool|dchar|real|ireal|ifloat|idouble|creal|cfloat|cdouble|lazy)\\b' },
+         { token: 'keyword.control.exception.d',
+           regex: '\\b(?:try|catch|finally|throw)\\b' },
+         { token: 'keyword.control.d',
+           regex: '\\b(?:return|break|case|continue|default|do|while|for|switch|if|else)\\b' },
+         { token: 'keyword.control.conditional.d',
+           regex: '\\b(?:if|else|switch|iftype)\\b' },
+         { token: 'keyword.control.branch.d',
+           regex: '\\b(?:goto|break|continue)\\b' },
+         { token: 'keyword.control.repeat.d',
+           regex: '\\b(?:while|for|do|foreach(?:_reverse)?)\\b' },
+         { token: 'keyword.control.statement.d',
+           regex: '\\b(?:version|return|with|invariant|body|scope|in|out|inout|asm|mixin|function|delegate)\\b' },
+         { token: 'keyword.control.pragma.d', regex: '\\bpragma\\b' },
+         { token: 'keyword.control.alias.d',
+           regex: '\\b(?:alias|typedef)\\b' },
+         { token: 'keyword.control.import.d', regex: '\\bimport\\b' },
+         { token: 
+            [ 'meta.module.d',
+              'keyword.control.module.d',
+              'meta.module.d',
+              'entity.name.function.package.d',
+              'meta.module.d' ],
+           regex: '^(\\s*)(module)(\\s+)([^ ;]+?)(;)' },
+         { token: 'constant.language.boolean.d',
+           regex: '\\b(?:true|false)\\b' },
+         { token: 'constant.language.d',
+           regex: '\\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|null)\\b' },
+         { token: 'variable.language.d', regex: '\\b(?:this|super)\\b' },
+         { token: 'constant.numeric.d',
+           regex: '\\b(?:0(?:x|X)[0-9a-fA-F]*|(?:[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:(?:e|E)(?:\\+|-)?[0-9]+)?)(?:[LlFfUuDd]|UL|ul)?\\b' },
+         { include: '#string_escaped_char' },
+         { include: '#strings' },
+         { token: 'keyword.operator.comparison.d',
+           regex: '==|!=|<=|>=|<>|<|>' },
+         { token: 'keyword.operator.increment-decrement.d',
+           regex: '\\-\\-|\\+\\+' },
+         { token: 'keyword.operator.arithmetic.d',
+           regex: '\\-|\\+|\\*|\\/|~|%' },
+         { token: 'keyword.operator.logical.d', regex: '!|&&|\\|\\|' },
+         { token: 'keyword.operator.overload.d',
+           regex: '\\b(?:opNeg|opCom|opPostInc|opPostDec|opCast|opAdd|opSub|opSub_r|opMul|opDiv|opDiv_r|opMod|opMod_r|opAnd|opOr|opXor|opShl|opShl_r|opShr|opShr_r|opUShr|opUShr_r|opCat|opCat_r|opEquals|opEquals|opCmp|opCmp|opCmp|opCmp|opAddAssign|opSubAssign|opMulAssign|opDivAssign|opModAssign|opAndAssign|opOrAssign|opXorAssign|opShlAssign|opShrAssign|opUShrAssign|opCatAssign|opIndex|opIndexAssign|opCall|opSlice|opSliceAssign|opPos|opAdd_r|opMul_r|opAnd_r|opOr_r|opXor_r)\\b' },
+         { token: 'keyword.operator.d',
+           regex: '\\b(?:new|delete|typeof|typeid|cast|align|is)\\b' },
+         { token: 'keyword.other.class-fns.d',
+           regex: '\\b(?:new|throws)\\b' },
+         { token: 'keyword.other.external.d',
+           regex: '\\b(?:package|extern)\\b' },
+         { token: 'keyword.other.debug.d',
+           regex: '\\b(?:deprecated|unittest|debug)\\b' },
+         { token: 'support.type.sys-types.c',
+           regex: '\\b(?:u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|dev_t|fixpt_t|blkcnt_t|blksize_t|gid_t|in_addr_t|in_port_t|ino_t|key_t|mode_t|nlink_t|id_t|pid_t|off_t|segsz_t|swblk_t|uid_t|id_t|clock_t|size_t|ssize_t|time_t|useconds_t|suseconds_t)\\b' },
+         { token: 'support.type.pthread.c',
+           regex: '\\b(?:pthread_attr_t|pthread_cond_t|pthread_condattr_t|pthread_mutex_t|pthread_mutexattr_t|pthread_once_t|pthread_rwlock_t|pthread_rwlockattr_t|pthread_t|pthread_key_t)\\b' },
+         { token: 'support.type.stdint.c',
+           regex: '\\b(?:int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t|uintmax_t|uintmax_t)\\b' } ],
+      '#all-types': 
+       [ { include: '#support-type-built-ins-d' },
+         { include: '#support-type-d' },
+         { include: '#storage-type-d' } ],
+      '#comments': 
+       [ { token: 'punctuation.definition.comment.d',
+           regex: '/\\*',
+           push: 
+            [ { token: 'punctuation.definition.comment.d',
+                regex: '\\*/',
+                next: 'pop' },
+              { defaultToken: 'comment.block.d' } ] },
+         { token: 'punctuation.definition.comment.d',
+           regex: '/\\+',
+           push: 
+            [ { token: 'punctuation.definition.comment.d',
+                regex: '\\+/',
+                next: 'pop' },
+              { defaultToken: 'comment.block.nested.d' } ] },
+         { token: 
+            [ 'punctuation.definition.comment.d',
+              'comment.line.double-slash.d' ],
+           regex: '(//)(.*$)' } ],
+      '#constant_placeholder': 
+       [ { token: 'constant.other.placeholder.d',
+           regex: '%(?:\\([a-z_]+\\))?#?0?\\-?[ ]?\\+?(?:[0-9]*|\\*)(?:\\.(?:[0-9]*|\\*))?[hL]?[a-z%]',
+           caseInsensitive: true } ],
+      '#regular_expressions': [{token: "constant.character.escape", regex: "\\\\."}], //[ { include: 'source.regexp.python' } ],
+      '#statement-remainder': 
+       [ { token: 'meta.definition.param-list.d',
+           regex: '\\(',
+           push: 
+            [ { token: 'meta.definition.param-list.d',
+                regex: '(?=\\))',
+                next: 'pop' },
+              { include: '#all-types' },
+              { defaultToken: 'meta.definition.param-list.d' } ] },
+         { token: 'keyword.other.class-fns.d',
+           regex: 'throws',
+           push: 
+            [ { token: [], regex: '(?={)', next: 'pop' },
+              { include: '#all-types' },
+              { defaultToken: 'meta.definition.throws.d' } ] } ],
+      '#storage-type-d': 
+       [ { token: 'storage.type.d',
+           regex: '\\b(?:void|byte|short|char|int|long|float|double|boolean|(?:[a-z]\\w+\\.)*[A-Z]\\w+)\\b' } ],
+      '#string_escaped_char': 
+       [ { token: 'constant.character.escape.d',
+           regex: '\\\\(?:\\\\|[abefnprtv\'"?]|[0-3]\\d{,2}|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|&\\w+;)' },
+         { token: 'invalid.illegal.unknown-escape.d', regex: '\\\\.' } ],
+      '#strings': 
+       [ { token: 'punctuation.definition.string.begin.d',
+           regex: '"',
+           push: 
+            [ { include: '#string_escaped_char' },
+              { token: 'punctuation.definition.string.end.d',
+                regex: '"',
+                next: 'pop' },
+              { defaultToken: 'string.quoted.double.d' } ] },
+         { token: 
+            [ 'storage.type.string.d',
+              'punctuation.definition.string.begin.d' ],
+           regex: '(r)(")',
+           push: 
+            [ { token: 'punctuation.definition.string.end.d',
+                regex: '"',
+                next: 'pop' },
+              { include: '#regular_expressions' },
+              { defaultToken: 'string.quoted.double.raw.d' } ] },
+         { token: 'punctuation.definition.string.begin.d',
+           regex: '`',
+           push: 
+            [ { token: 'punctuation.definition.string.end.d',
+                regex: '`',
+                next: 'pop' },
+              { defaultToken: 'string.quoted.double.raw.backtick.d' } ] },
+         { token: 'punctuation.definition.string.begin.d',
+           regex: '\'',
+           push: 
+            [ { include: '#string_escaped_char' },
+              { token: 'punctuation.definition.string.end.d',
+                regex: '\'',
+                next: 'pop' },
+              { defaultToken: 'string.quoted.single.d' } ] } ],
+      '#support-type-built-ins-classes-d': 
+       [ { token: 'support.type.built-ins.classes.d',
+           regex: '\\b(?:AbstractServer|ArchiveMember|ArgParser|Barrier|BomSniffer|Buffer|BufferInput|BufferOutput|BufferSlice|BufferedFile|BufferedStream|BzipInput|BzipOutput|CFile|CacheInvalidatee|CacheInvalidator|CacheServer|CacheThread|Certificate|CertificateStore|CertificateStoreCtx|ChunkInput|ChunkOutput|ClassInfo|Cluster|ClusterCache|ClusterQueue|ClusterThread|CmdParser|ComObject|Compress|Condition|Conduit|Cookie|CookieParser|CookieStack|CounterInput|CounterOutput|DataFileInput|DataFileOutput|DataInput|DataOutput|Database|DatagramConduit|DeviceConduit|DigestInput|DigestOutput|DocPrinter|Document|DummyInputStream|DummyOutputStream|EndianInput|EndianOutput|EndianProtocol|EndianStream|EventSeekInputStream|EventSeekOutputStream|FTPConnection|Fiber|Field|File|FileConduit|FileFolder|FileGroup|FileInput|FileOutput|FilePath|FileScan|FilterStream|Foo|FormatOutput|GreedyInput|GreedyOutput|Gregorian|GrowBuffer|HeapCopy|HeapSlice|Hierarchy|HttpClient|HttpCookies|HttpCookiesView|HttpGet|H
 ttpHeaders|HttpHeadersView|HttpParams|HttpPost|HttpStack|HttpTokens|HttpTriplet|IPv4Address|IUnknown|InputFilter|InternetAddress|InternetHost|Layout|LineInput|LineIterator|LinkedFolder|Log|MapInput|MapOutput|MappedBuffer|Md2|Md4|MemoryQueue|MemoryStream|MmFile|MmFileStream|ModuleInfo|MulticastConduit|Mutex|NativeProtocol|NetCall|NetHost|NetworkAlert|NetworkCache|NetworkCall|NetworkClient|NetworkCombo|NetworkMessage|NetworkQueue|NetworkRegistry|NetworkTask|NotImplemented|Object|Observer|OutBuffer|OutputFilter|PersistQueue|Pipe|PipeConduit|Print|PrivateKey|Process|Properties|Protocol|ProtocolReader|ProtocolWriter|PublicKey|PullParser|QueueFile|QueueServer|QueueThread|QueuedCache|QuoteIterator|Random|Range|ReadWriteMutex|Reader|Record|RegExp|RegExpT|RegexIterator|RollCall|SSLCtx|SSLServerSocket|SSLSocketConduit|SaxParser|SelectionKey|Semaphore|ServerSocket|ServerThread|Service|SimpleIterator|SliceInputStream|SliceSeekInputStream|SliceSeekOutputStream|SliceStream|SnoopInput|SnoopOutput|
 Socket|SocketConduit|SocketListener|SocketSet|SocketStream|Sprint|Stream|StreamIterator|TArrayStream|TaskServer|TaskThread|TcpSocket|Telnet|TempFile|Text|TextFileInput|TextFileOutput|TextView|Thread|ThreadGroup|ThreadLocal|ThreadPool|Token|TypeInfo|TypeInfo_AC|TypeInfo_Aa|TypeInfo_Ab|TypeInfo_Ac|TypeInfo_Ad|TypeInfo_Ae|TypeInfo_Af|TypeInfo_Ag|TypeInfo_Ah|TypeInfo_Ai|TypeInfo_Aj|TypeInfo_Ak|TypeInfo_Al|TypeInfo_Am|TypeInfo_Ao|TypeInfo_Ap|TypeInfo_Aq|TypeInfo_Ar|TypeInfo_Array|TypeInfo_As|TypeInfo_AssociativeArray|TypeInfo_At|TypeInfo_Au|TypeInfo_Av|TypeInfo_Aw|TypeInfo_C|TypeInfo_Class|TypeInfo_D|TypeInfo_Delegate|TypeInfo_Enum|TypeInfo_Function|TypeInfo_Interface|TypeInfo_P|TypeInfo_Pointer|TypeInfo_StaticArray|TypeInfo_Struct|TypeInfo_Tuple|TypeInfo_Typedef|TypeInfo_a|TypeInfo_b|TypeInfo_c|TypeInfo_d|TypeInfo_e|TypeInfo_f|TypeInfo_g|TypeInfo_h|TypeInfo_i|TypeInfo_j|TypeInfo_k|TypeInfo_l|TypeInfo_m|TypeInfo_o|TypeInfo_p|TypeInfo_q|TypeInfo_r|TypeInfo_s|TypeInfo_t|TypeInfo_u|TypeInfo
 _v|TypeInfo_w|TypedInput|TypedOutput|URIerror|UdpSocket|UnCompress|UniText|UnicodeBom|UnicodeFile|UnknownAddress|Uri|UtfInput|UtfOutput|VirtualFolder|WrapSeekInputStream|WrapSeekOutputStream|Writer|XmlPrinter|ZipArchive|ZipBlockReader|ZipBlockWriter|ZipEntry|ZipEntryVerifier|ZipFile|ZipFileGroup|ZipFolder|ZipSubFolder|ZipSubFolderEntry|ZipSubFolderGroup|ZlibInput|ZlibOutput)\\b' } ],
+      '#support-type-built-ins-d': 
+       [ { include: '#support-type-built-ins-exceptions-d' },
+         { include: '#support-type-built-ins-classes-d' },
+         { include: '#support-type-built-ins-interfaces-d' },
+         { include: '#support-type-built-ins-structs-d' } ],
+      '#support-type-built-ins-exceptions-d': 
+       [ { token: 'support.type.built-ins.exceptions.d',
+           regex: '\\b(?:AddressException|ArrayBoundsError|ArrayBoundsException|AssertError|AssertException|Base64CharException|Base64Exception|BzipClosedException|BzipException|ClusterEmptyException|ClusterFullException|ConvError|ConvOverflowError|ConversionException|CorruptedIteratorException|DatabaseException|DateParseError|Exception|FTPException|FiberException|FileException|FinalizeException|FormatError|HostException|IOException|IllegalArgumentException|IllegalElementException|InvalidKeyException|InvalidTypeException|LocaleException|ModuleCtorError|NoSuchElementException|OpenException|OpenRJException|OutOfMemoryException|PlatformException|ProcessCreateException|ProcessException|ProcessForkException|ProcessKillException|ProcessWaitException|ReadException|RegExpException|RegexException|RegistryException|SeekException|SharedLibException|SocketAcceptException|SocketException|StdioException|StreamException|StreamFileException|StringException|SwitchError|SwitchException|SyncException|
 TextException|ThreadError|ThreadException|UnboxException|UnicodeException|UtfException|VariantTypeMismatchException|Win32Exception|WriteException|XmlException|ZipChecksumException|ZipException|ZipExhaustedException|ZipNotSupportedException|ZlibClosedException|ZlibException|OurUnwindException|SysError)\\b' } ],
+      '#support-type-built-ins-interfaces-d': 
+       [ { token: 'support.type.built-ins.interfaces.d',
+           regex: '\\b(?:Buffered|HttpParamsView|ICache|IChannel|IClassFactory|ICluster|IConduit|IConsumer|IEvent|IHierarchy|ILevel|IListener|IMessage|IMessageLoader|IOStream|IReadable|ISelectable|ISelectionSet|ISelector|IServer|IUnknown|IWritable|IXmlPrinter|InputStream|OutputStream|PathView|VfsFile|VfsFiles|VfsFolder|VfsFolderEntry|VfsFolders|VfsHost|VfsSync|ZipReader|ZipWriter)\\b' } ],
+      '#support-type-built-ins-structs-d': 
+       [ { token: 'support.type.built-ins.structs.d',
+           regex: '\\b(?:ABC|ABCFLOAT|ACCEL|ACCESSTIMEOUT|ACCESS_ALLOWED_ACE|ACCESS_DENIED_ACE|ACE_HEADER|ACL|ACL_REVISION_INFORMATION|ACL_SIZE_INFORMATION|ACTION_HEADER|ADAPTER_STATUS|ADDJOB_INFO_1|ANIMATIONINFO|APPBARDATA|Argument|Atomic|Attribute|BITMAP|BITMAPCOREHEADER|BITMAPCOREINFO|BITMAPINFO|BITMAPINFOHEADER|BITMAPV4HEADER|BLOB|BROWSEINFO|BY_HANDLE_FILE_INFORMATION|Bar|Baz|BitArray|Box|BracketResult|ByteSwap|CANDIDATEFORM|CANDIDATELIST|CBTACTIVATESTRUCT|CBT_CREATEWND|CHARFORMAT|CHARRANGE|CHARSET|CHARSETINFO|CHAR_INFO|CIDA|CIEXYZ|CIEXYZTRIPLE|CLIENTCREATESTRUCT|CMINVOKECOMMANDINFO|COLORADJUSTMENT|COLORMAP|COMMCONFIG|COMMPROP|COMMTIMEOUTS|COMPAREITEMSTRUCT|COMPCOLOR|COMPOSITIONFORM|COMSTAT|CONNECTDLGSTRUCT|CONSOLE_CURSOR_INFO|CONTEXT|CONVCONTEXT|CONVINFO|COORD|COPYDATASTRUCT|CPINFO|CPLINFO|CREATESTRUCT|CREATE_PROCESS_DEBUG_INFO|CREATE_THREAD_DEBUG_INFO|CRITICAL_SECTION|CRITICAL_SECTION_DEBUG|CURRENCYFMT|CURSORSHAPE|CWPRETSTRUCT|CWPSTRUCT|CharClass|CharRange|Clock|CodePage|Conso
 le|DATATYPES_INFO_1|DCB|DDEACK|DDEADVISE|DDEDATA|DDELN|DDEML_MSG_HOOK_DATA|DDEPOKE|DDEUP|DEBUGHOOKINFO|DEBUG_EVENT|DELETEITEMSTRUCT|DEVMODE|DEVNAMES|DEV_BROADCAST_HDR|DEV_BROADCAST_OEM|DEV_BROADCAST_PORT|DEV_BROADCAST_VOLUME|DIBSECTION|DIR|DISCDLGSTRUCT|DISK_GEOMETRY|DISK_PERFORMANCE|DOCINFO|DOC_INFO_1|DOC_INFO_2|DRAGLISTINFO|DRAWITEMSTRUCT|DRAWTEXTPARAMS|DRIVER_INFO_1|DRIVER_INFO_2|DRIVER_INFO_3|DRIVE_LAYOUT_INFORMATION|Date|DateParse|DateTime|DirEntry|DynArg|EDITSTREAM|EMPTYRECORD|EMR|EMRABORTPATH|EMRANGLEARC|EMRARC|EMRBITBLT|EMRCREATEBRUSHINDIRECT|EMRCREATECOLORSPACE|EMRCREATEDIBPATTERNBRUSHPT|EMRCREATEMONOBRUSH|EMRCREATEPALETTE|EMRCREATEPEN|EMRELLIPSE|EMREOF|EMREXCLUDECLIPRECT|EMREXTCREATEFONTINDIRECTW|EMREXTCREATEPEN|EMREXTFLOODFILL|EMREXTSELECTCLIPRGN|EMREXTTEXTOUTA|EMRFILLPATH|EMRFILLRGN|EMRFORMAT|EMRFRAMERGN|EMRGDICOMMENT|EMRINVERTRGN|EMRLINETO|EMRMASKBLT|EMRMODIFYWORLDTRANSFORM|EMROFFSETCLIPRGN|EMRPLGBLT|EMRPOLYDRAW|EMRPOLYDRAW16|EMRPOLYLINE|EMRPOLYLINE16|EMRPOLYPOLYLINE|EM
 RPOLYPOLYLINE16|EMRPOLYTEXTOUTA|EMRRESIZEPALETTE|EMRRESTOREDC|EMRROUNDRECT|EMRSCALEVIEWPORTEXTEX|EMRSELECTCLIPPATH|EMRSELECTCOLORSPACE|EMRSELECTOBJECT|EMRSELECTPALETTE|EMRSETARCDIRECTION|EMRSETBKCOLOR|EMRSETCOLORADJUSTMENT|EMRSETDIBITSTODEVICE|EMRSETMAPPERFLAGS|EMRSETMITERLIMIT|EMRSETPALETTEENTRIES|EMRSETPIXELV|EMRSETVIEWPORTEXTEX|EMRSETVIEWPORTORGEX|EMRSETWORLDTRANSFORM|EMRSTRETCHBLT|EMRSTRETCHDIBITS|EMRTEXT|ENCORRECTTEXT|ENDROPFILES|ENHMETAHEADER|ENHMETARECORD|ENOLEOPFAILED|ENPROTECTED|ENSAVECLIPBOARD|ENUMLOGFONT|ENUMLOGFONTEX|ENUM_SERVICE_STATUS|EVENTLOGRECORD|EVENTMSG|EXCEPTION_DEBUG_INFO|EXCEPTION_POINTERS|EXCEPTION_RECORD|EXIT_PROCESS_DEBUG_INFO|EXIT_THREAD_DEBUG_INFO|EXTLOGFONT|EXTLOGPEN|EXT_BUTTON|EmptySlot|EndOfCDRecord|Environment|FILETIME|FILTERKEYS|FINDREPLACE|FINDTEXTEX|FIND_NAME_BUFFER|FIND_NAME_HEADER|FIXED|FLOATING_SAVE_AREA|FMS_GETDRIVEINFO|FMS_GETFILESEL|FMS_LOAD|FMS_TOOLBARLOAD|FOCUS_EVENT_RECORD|FONTSIGNATURE|FORMATRANGE|FORMAT_PARAMETERS|FORM_INFO_1|FileConst|Fi
 leHeader|FileRoots|FileSystem|FoldingCaseData|Foo|FtpConnectionDetail|FtpFeature|FtpFileInfo|FtpResponse|GC|GCP_RESULTS|GCStats|GENERIC_MAPPING|GLYPHMETRICS|GLYPHMETRICSFLOAT|GROUP_INFO_2|GUID|HANDLETABLE|HD_HITTESTINFO|HD_ITEM|HD_LAYOUT|HD_NOTIFY|HELPINFO|HELPWININFO|HIGHCONTRAST|HSZPAIR|HeaderElement|HttpConst|HttpHeader|HttpHeaderName|HttpResponses|HttpStatus|HttpToken|ICONINFO|ICONMETRICS|IMAGEINFO|IMAGE_DOS_HEADER|INPUT_RECORD|ITEMIDLIST|IeeeFlags|Interface|JOB_INFO_1|JOB_INFO_2|KERNINGPAIR|LANA_ENUM|LAYERPLANEDESCRIPTOR|LDT_ENTRY|LIST_ENTRY|LOAD_DLL_DEBUG_INFO|LOCALESIGNATURE|LOCALGROUP_INFO_0|LOCALGROUP_MEMBERS_INFO_0|LOCALGROUP_MEMBERS_INFO_3|LOGBRUSH|LOGCOLORSPACE|LOGFONT|LOGFONTA|LOGFONTW|LOGPALETTE|LOGPEN|LUID_AND_ATTRIBUTES|LV_COLUMN|LV_DISPINFO|LV_FINDINFO|LV_HITTESTINFO|LV_ITEM|LV_KEYDOWN|LocalFileHeader|MAT2|MD5_CTX|MDICREATESTRUCT|MEASUREITEMSTRUCT|MEMORYSTATUS|MEMORY_BASIC_INFORMATION|MENUEX_TEMPLATE_HEADER|MENUEX_TEMPLATE_ITEM|MENUITEMINFO|MENUITEMTEMPLATE|MENUITEM
 TEMPLATEHEADER|MENUTEMPLATE|MENU_EVENT_RECORD|METAFILEPICT|METARECORD|MINIMIZEDMETRICS|MINMAXINFO|MODEMDEVCAPS|MODEMSETTINGS|MONCBSTRUCT|MONCONVSTRUCT|MONERRSTRUCT|MONHSZSTRUCT|MONITOR_INFO_1|MONITOR_INFO_2|MONLINKSTRUCT|MONMSGSTRUCT|MOUSEHOOKSTRUCT|MOUSEKEYS|MOUSE_EVENT_RECORD|MSG|MSGBOXPARAMS|MSGFILTER|MULTIKEYHELP|NAME_BUFFER|NCB|NCCALCSIZE_PARAMS|NDDESHAREINFO|NETCONNECTINFOSTRUCT|NETINFOSTRUCT|NETRESOURCE|NEWCPLINFO|NEWTEXTMETRIC|NEWTEXTMETRICEX|NMHDR|NM_LISTVIEW|NM_TREEVIEW|NM_UPDOWNW|NONCLIENTMETRICS|NS_SERVICE_INFO|NUMBERFMT|OFNOTIFY|OFSTRUCT|OPENFILENAME|OPENFILENAMEA|OPENFILENAMEW|OSVERSIONINFO|OUTLINETEXTMETRIC|OUTPUT_DEBUG_STRING_INFO|OVERLAPPED|OffsetTypeInfo|PAINTSTRUCT|PALETTEENTRY|PANOSE|PARAFORMAT|PARTITION_INFORMATION|PERF_COUNTER_BLOCK|PERF_COUNTER_DEFINITION|PERF_DATA_BLOCK|PERF_INSTANCE_DEFINITION|PERF_OBJECT_TYPE|PIXELFORMATDESCRIPTOR|POINT|POINTFLOAT|POINTFX|POINTL|POINTS|POLYTEXT|PORT_INFO_1|PORT_INFO_2|PREVENT_MEDIA_REMOVAL|PRINTER_DEFAULTS|PRINTER_INFO_1|PR
 INTER_INFO_2|PRINTER_INFO_3|PRINTER_INFO_4|PRINTER_INFO_5|PRINTER_NOTIFY_INFO|PRINTER_NOTIFY_INFO_DATA|PRINTER_NOTIFY_OPTIONS|PRINTER_NOTIFY_OPTIONS_TYPE|PRINTPROCESSOR_INFO_1|PRIVILEGE_SET|PROCESS_HEAPENTRY|PROCESS_INFORMATION|PROPSHEETHEADER|PROPSHEETHEADER_U1|PROPSHEETHEADER_U2|PROPSHEETHEADER_U3|PROPSHEETPAGE|PROPSHEETPAGE_U1|PROPSHEETPAGE_U2|PROTOCOL_INFO|PROVIDOR_INFO_1|PSHNOTIFY|PUNCTUATION|PassByCopy|PassByRef|Phase1Info|PropertyConfigurator|QUERY_SERVICE_CONFIG|QUERY_SERVICE_LOCK_STATUS|RASAMB|RASCONN|RASCONNSTATUS|RASDIALEXTENSIONS|RASDIALPARAMS|RASENTRYNAME|RASPPPIP|RASPPPIPX|RASPPPNBF|RASTERIZER_STATUS|REASSIGN_BLOCKS|RECT|RECTL|REMOTE_NAME_INFO|REPASTESPECIAL|REQRESIZE|RGBQUAD|RGBTRIPLE|RGNDATA|RGNDATAHEADER|RIP_INFO|Runtime|SCROLLINFO|SECURITY_ATTRIBUTES|SECURITY_DESCRIPTOR|SECURITY_QUALITY_OF_SERVICE|SELCHANGE|SERIALKEYS|SERVICE_ADDRESS|SERVICE_ADDRESSES|SERVICE_INFO|SERVICE_STATUS|SERVICE_TABLE_ENTRY|SERVICE_TYPE_INFO_ABS|SERVICE_TYPE_VALUE_ABS|SESSION_BUFFER|SESSION
 _HEADER|SET_PARTITION_INFORMATION|SHFILEINFO|SHFILEOPSTRUCT|SHITEMID|SHNAMEMAPPING|SID|SID_AND_ATTRIBUTES|SID_IDENTIFIER_AUTHORITY|SINGLE_LIST_ENTRY|SIZE|SMALL_RECT|SOUNDSENTRY|STARTUPINFO|STICKYKEYS|STRRET|STYLEBUF|STYLESTRUCT|SYSTEMTIME|SYSTEM_AUDIT_ACE|SYSTEM_INFO|SYSTEM_INFO_U|SYSTEM_POWER_STATUS|Signal|SjLj_Function_Context|SpecialCaseData|TAPE_ERASE|TAPE_GET_DRIVE_PARAMETERS|TAPE_GET_MEDIA_PARAMETERS|TAPE_GET_POSITION|TAPE_PREPARE|TAPE_SET_DRIVE_PARAMETERS|TAPE_SET_MEDIA_PARAMETERS|TAPE_SET_POSITION|TAPE_WRITE_MARKS|TBADDBITMAP|TBBUTTON|TBNOTIFY|TBSAVEPARAMS|TCHOOSECOLOR|TCHOOSEFONT|TC_HITTESTINFO|TC_ITEM|TC_ITEMHEADER|TC_KEYDOWN|TEXTMETRIC|TEXTMETRICA|TEXTRANGE|TFINDTEXT|TIME_ZONE_INFORMATION|TOGGLEKEYS|TOKEN_CONTROL|TOKEN_DEFAULT_DACL|TOKEN_GROUPS|TOKEN_OWNER|TOKEN_PRIMARY_GROUP|TOKEN_PRIVILEGES|TOKEN_SOURCE|TOKEN_STATISTICS|TOKEN_USER|TOOLINFO|TOOLTIPTEXT|TPAGESETUPDLG|TPMPARAMS|TRANSMIT_FILE_BUFFERS|TREEITEM|TSMALLPOINT|TTHITTESTINFO|TTPOLYCURVE|TTPOLYGONHEADER|TVARIANT|TV
 _DISPINFO|TV_HITTESTINFO|TV_INSERTSTRUCT|TV_ITEM|TV_KEYDOWN|TV_SORTCB|Time|TimeOfDay|TimeSpan|Tuple|UDACCEL|ULARGE_INTEGER|UNIVERSAL_NAME_INFO|UNLOAD_DLL_DEBUG_INFO|USEROBJECTFLAGS|USER_INFO_0|USER_INFO_2|USER_INFO_3|UnicodeData|VALENT|VA_LIST|VERIFY_INFORMATION|VS_FIXEDFILEINFO|Variant|VfsFilterInfo|WIN32_FILE_ATTRIBUTE_DATA|WIN32_FIND_DATA|WIN32_FIND_DATAW|WIN32_STREAM_ID|WINDOWINFO|WINDOWPLACEMENT|WINDOWPOS|WINDOW_BUFFER_SIZE_RECORD|WNDCLASS|WNDCLASSA|WNDCLASSEX|WNDCLASSEXA|WSADATA|WallClock|XFORM|ZipEntryInfo)\\b' } ],
+      '#support-type-d': 
+       [ { token: 'support.type.d',
+           regex: '\\b(?:tango|std)\\.[\\w\\.]+\\b' } ] }
+    
+    this.normalizeRules();
+};
+
+DHighlightRules.metaData = { comment: 'D language',
+      fileTypes: [ 'd', 'di' ],
+      firstLineMatch: '^#!.*\\bg?dmd\\b.',
+      foldingStartMarker: '(?x)/\\*\\*(?!\\*)|^(?![^{]*?//|[^{]*?/\\*(?!.*?\\*/.*?\\{)).*?\\{\\s*($|//|/\\*(?!.*?\\*/.*\\S))',
+      foldingStopMarker: '(?<!\\*)\\*\\*/|^\\s*\\}',
+      keyEquivalent: '^~D',
+      name: 'D',
+      scopeName: 'source.d' }
+
+
+oop.inherits(DHighlightRules, TextHighlightRules);
+
+exports.DHighlightRules = DHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/dart.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/dart.js b/src/fauxton/assets/js/libs/ace/mode/dart.js
new file mode 100644
index 0000000..a94e33c
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/dart.js
@@ -0,0 +1,62 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ * 
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var CMode = require("./c_cpp").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var DartHighlightRules = require("./dart_highlight_rules").DartHighlightRules;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    CMode.call(this);
+    this.HighlightRules = DartHighlightRules;
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, CMode);
+
+(function() { 
+    this.lineCommentStart = "//";
+    this.blockComment = {start: "/*", end: "*/"};
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/dart_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/dart_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/dart_highlight_rules.js
new file mode 100644
index 0000000..0805550
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/dart_highlight_rules.js
@@ -0,0 +1,182 @@
+/*
+  THIS FILE WAS AUTOGENERATED BY mode_highlight_rules.tmpl.js (UUID: 958518BC-799F-477A-99F9-5B28EBF230F6) */
+
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var DartHighlightRules = function() {
+
+    var constantLanguage = "true|false|null";
+    var variableLanguage = "this|super";
+    var keywordControl = "try|catch|finally|throw|break|case|continue|default|do|else|for|if|in|return|switch|while|new";
+    var keywordDeclaration = "abstract|class|extends|external|factory|implements|get|native|operator|set|typedef";
+    var storageModifier = "static|final|const";
+    var storageType = "void|bool|num|int|double|dynamic|var|String";
+
+    var keywordMapper = this.createKeywordMapper({
+        "constant.language.dart": constantLanguage,
+        "variable.language.dart": variableLanguage,
+        "keyword.control.dart": keywordControl,
+        "keyword.declaration.dart": keywordDeclaration,
+        "storage.modifier.dart": storageModifier,
+        "storage.type.primitive.dart": storageType
+    }, "identifier");
+
+    var stringfill = {
+        token : "string",
+        regex : ".+"
+    };
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = 
+        {
+    "start": [
+        {
+            token : "comment",
+            regex : /\/\/.*$/
+        },
+        {
+            token : "comment", // multi line comment
+            regex : /\/\*/,
+            next : "comment"
+        },
+        {
+            token: ["meta.preprocessor.script.dart"],
+            regex: "^(#!.*)$"
+        },
+        {
+            token: "keyword.other.import.dart",
+            regex: "(?:\\b)(?:library|import|part|of)(?:\\b)"
+        },
+        {
+            token : ["keyword.other.import.dart", "text"],
+            regex : "(?:\\b)(prefix)(\\s*:)"
+        },
+        {
+            regex: "\\bas\\b",
+            token: "keyword.cast.dart"
+        },
+        {
+            regex: "\\?|:",
+            token: "keyword.control.ternary.dart"
+        },
+        {
+            regex: "(?:\\b)(is\\!?)(?:\\b)",
+            token: ["keyword.operator.dart"]
+        },
+        {
+            regex: "(<<|>>>?|~|\\^|\\||&)",
+            token: ["keyword.operator.bitwise.dart"]
+        },
+        {
+            regex: "((?:&|\\^|\\||<<|>>>?)=)",
+            token: ["keyword.operator.assignment.bitwise.dart"]
+        },
+        {
+            regex: "(===?|!==?|<=?|>=?)",
+            token: ["keyword.operator.comparison.dart"]
+        },
+        {
+            regex: "((?:[+*/%-]|\\~)=)",
+            token: ["keyword.operator.assignment.arithmetic.dart"]
+        },
+        {
+            regex: "=",
+            token: "keyword.operator.assignment.dart"
+        },
+        {
+            token : "string",
+            regex : "'''",
+            next : "qdoc"
+        }, 
+        {
+            token : "string",
+            regex : '"""',
+            next : "qqdoc"
+        }, 
+        {
+            token : "string",
+            regex : "'",
+            next : "qstring"
+        }, 
+        {
+            token : "string",
+            regex : '"',
+            next : "qqstring"
+        }, 
+        {
+            regex: "(\\-\\-|\\+\\+)",
+            token: ["keyword.operator.increment-decrement.dart"]
+        },
+        {
+            regex: "(\\-|\\+|\\*|\\/|\\~\\/|%)",
+            token: ["keyword.operator.arithmetic.dart"]
+        },
+        {
+            regex: "(!|&&|\\|\\|)",
+            token: ["keyword.operator.logical.dart"]
+        },
+        {
+            token : "constant.numeric", // hex
+            regex : "0[xX][0-9a-fA-F]+\\b"
+        }, 
+        {
+            token : "constant.numeric", // float
+            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+        }, 
+        {
+            token : keywordMapper,
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        }
+    ],
+    "comment" : [
+        {
+            token : "comment", // closing comment
+            regex : ".*?\\*\\/",
+            next : "start"
+        }, {
+            token : "comment", // comment spanning whole line
+            regex : ".+"
+        }
+    ],
+    "qdoc" : [
+        {
+            token : "string",
+            regex : ".*?'''",
+            next : "start"
+        }, stringfill],
+
+    "qqdoc" : [
+        {
+            token : "string",
+            regex : '.*?"""',
+            next : "start"
+        }, stringfill],
+
+    "qstring" : [
+        {
+            token : "string",
+            regex : "[^\\\\']*(?:\\\\.[^\\\\']*)*'",
+            next : "start"
+        }, stringfill],
+
+    "qqstring" : [
+        {
+            token : "string",
+            regex : '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
+            next : "start"
+        }, stringfill]
+}
+
+};
+
+oop.inherits(DartHighlightRules, TextHighlightRules);
+
+exports.DartHighlightRules = DartHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/diff.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/diff.js b/src/fauxton/assets/js/libs/ace/mode/diff.js
new file mode 100644
index 0000000..24e156e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/diff.js
@@ -0,0 +1,52 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var HighlightRules = require("./diff_highlight_rules").DiffHighlightRules;
+var FoldMode = require("./folding/diff").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = HighlightRules;
+    this.foldingRules = new FoldMode(["diff", "index", "\\+{3}", "@@|\\*{5}"], "i");
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/diff_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/diff_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/diff_highlight_rules.js
new file mode 100644
index 0000000..8996397
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/diff_highlight_rules.js
@@ -0,0 +1,108 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var DiffHighlightRules = function() {
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "start" : [{
+                regex: "^(?:\\*{15}|={67}|-{3}|\\+{3})$",
+                token: "punctuation.definition.separator.diff",
+                "name": "keyword"
+            }, { //diff.range.unified
+                regex: "^(@@)(\\s*.+?\\s*)(@@)(.*)$",
+                token: [
+                    "constant",
+                    "constant.numeric",
+                    "constant",
+                    "comment.doc.tag"
+                ]
+            }, { //diff.range.normal
+                regex: "^(\\d+)([,\\d]+)(a|d|c)(\\d+)([,\\d]+)(.*)$",
+                token: [
+                    "constant.numeric",
+                    "punctuation.definition.range.diff",
+                    "constant.function",
+                    "constant.numeric",
+                    "punctuation.definition.range.diff",
+                    "invalid"
+                ],
+                "name": "meta."
+            }, {
+                regex: "^(\\-{3}|\\+{3}|\\*{3})( .+)$",
+                token: [
+                    "constant.numeric",
+                    "meta.tag"
+                ]
+            }, { // added
+                regex: "^([!+>])(.*?)(\\s*)$",
+                token: [
+                    "support.constant",
+                    "text",
+                    "invalid"
+                ]
+            }, { // removed
+                regex: "^([<\\-])(.*?)(\\s*)$",
+                token: [
+                    "support.function",
+                    "string",
+                    "invalid"
+                ]
+            }, {
+                regex: "^(diff)(\\s+--\\w+)?(.+?)( .+)?$",
+                token: ["variable", "variable", "keyword", "variable"]
+            }, {
+                regex: "^Index.+$",
+                token: "variable"
+            }, {
+                regex: "^\\s+$",
+                token: "text"
+            }, {
+                regex: "\\s*$",
+                token: "invalid"
+            }, {
+                defaultToken: "invisible",
+                caseInsensitive: true
+            }
+        ]
+    };
+};
+
+oop.inherits(DiffHighlightRules, TextHighlightRules);
+
+exports.DiffHighlightRules = DiffHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/django.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/django.js b/src/fauxton/assets/js/libs/ace/mode/django.js
new file mode 100644
index 0000000..4a68bb7
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/django.js
@@ -0,0 +1,116 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+
+var oop = require("../lib/oop");
+var HtmlMode = require("./html").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var DjangoHighlightRules = function(){
+    this.$rules = {
+        'start': [{
+            token: "string",
+            regex: '".*?"'
+        }, {
+            token: "string",
+            regex: "'.*?'"
+        }, {
+            token: "constant",
+            regex: '[0-9]+'
+        }, {
+            token: "variable",
+            regex: "[-_a-zA-Z0-9:]+"
+        }],
+        'comment': [{
+            token : "comment.block",
+            merge: true,
+            regex : ".+?"
+        }],
+        'tag': [{
+            token: "entity.name.function",
+            regex: "[a-zA-Z][_a-zA-Z0-9]*",
+            next: "start"
+        }]
+    };
+};
+
+oop.inherits(DjangoHighlightRules, TextHighlightRules)
+
+var DjangoHtmlHighlightRules = function() {
+    this.$rules = new HtmlHighlightRules().getRules();
+
+    for (var i in this.$rules) {
+        this.$rules[i].unshift({
+            token: "comment.line",
+            regex: "\\{#.*?#\\}"
+        }, {
+            token: "comment.block",
+            regex: "\\{\\%\\s*comment\\s*\\%\\}",
+            merge: true,
+            next: "django-comment"
+        }, {
+            token: "constant.language",
+            regex: "\\{\\{",
+            next: "django-start"
+        }, {
+            token: "constant.language",
+            regex: "\\{\\%",
+            next: "django-tag"
+        });
+        this.embedRules(DjangoHighlightRules, "django-", [{
+                token: "comment.block",
+                regex: "\\{\\%\\s*endcomment\\s*\\%\\}",
+                merge: true,
+                next: "start"
+            }, {
+                token: "constant.language",
+                regex: "\\%\\}",
+                next: "start"
+            }, {
+                token: "constant.language",
+                regex: "\\}\\}",
+                next: "start"
+        }]);
+    }
+};
+
+oop.inherits(DjangoHtmlHighlightRules, HtmlHighlightRules);
+
+var Mode = function() {
+    HtmlMode.call(this);
+    this.HighlightRules = DjangoHtmlHighlightRules;
+};
+oop.inherits(Mode, HtmlMode);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/doc_comment_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/doc_comment_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/doc_comment_highlight_rules.js
new file mode 100644
index 0000000..5262a8e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/doc_comment_highlight_rules.js
@@ -0,0 +1,73 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var DocCommentHighlightRules = function() {
+
+    this.$rules = {
+        "start" : [ {
+            token : "comment.doc.tag",
+            regex : "@[\\w\\d_]+" // TODO: fix email addresses
+        }, {
+            token : "comment.doc.tag",
+            regex : "\\bTODO\\b"
+        }, {
+            defaultToken : "comment.doc"
+        }]
+    };
+};
+
+oop.inherits(DocCommentHighlightRules, TextHighlightRules);
+
+DocCommentHighlightRules.getStartRule = function(start) {
+    return {
+        token : "comment.doc", // doc comment
+        regex : "\\/\\*(?=\\*)",
+        next  : start
+    };
+};
+
+DocCommentHighlightRules.getEndRule = function (start) {
+    return {
+        token : "comment.doc", // closing comment
+        regex : "\\*\\/",
+        next  : start
+    };
+};
+
+
+exports.DocCommentHighlightRules = DocCommentHighlightRules;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/dot.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/dot.js b/src/fauxton/assets/js/libs/ace/mode/dot.js
new file mode 100644
index 0000000..116b2d2
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/dot.js
@@ -0,0 +1,55 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var DotHighlightRules = require("./dot_highlight_rules").DotHighlightRules;
+var DotFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = DotHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+    this.foldingRules = new DotFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = ["//", "#"];
+    this.blockComment = {start: "/*", end: "*/"};
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+        var endState = tokenizedLine.state;
+
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+
+        if (state == "start") {
+            var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});


[16/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/javascript_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/javascript_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/javascript_highlight_rules.js
new file mode 100644
index 0000000..f950da8
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/javascript_highlight_rules.js
@@ -0,0 +1,362 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var JavaScriptHighlightRules = function() {
+    // see: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects
+    var keywordMapper = this.createKeywordMapper({
+        "variable.language":
+            "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|"  + // Constructors
+            "Namespace|QName|XML|XMLList|"                                             + // E4X
+            "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|"   +
+            "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|"                    +
+            "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|"   + // Errors
+            "SyntaxError|TypeError|URIError|"                                          +
+            "decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
+            "isNaN|parseFloat|parseInt|"                                               +
+            "JSON|Math|"                                                               + // Other
+            "this|arguments|prototype|window|document"                                 , // Pseudo
+        "keyword":
+            "const|yield|import|get|set|" +
+            "break|case|catch|continue|default|delete|do|else|finally|for|function|" +
+            "if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
+            // invalid or reserved
+            "__parent__|__count__|escape|unescape|with|__proto__|" +
+            "class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
+        "storage.type":
+            "const|let|var|function",
+        "constant.language":
+            "null|Infinity|NaN|undefined",
+        "support.function":
+            "alert",
+        "constant.language.boolean": "true|false"
+    }, "identifier");
+
+    // keywords which can be followed by regular expressions
+    var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
+
+    // TODO: Unicode escape sequences
+    var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
+
+    var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
+        "u[0-9a-fA-F]{4}|" + // unicode
+        "[0-2][0-7]{0,2}|" + // oct
+        "3[0-6][0-7]?|" + // oct
+        "37[0-7]?|" + // oct
+        "[4-7][0-7]?|" + //oct
+        ".)";
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "no_regex" : [
+            {
+                token : "comment",
+                regex : "\\/\\/",
+                next : "line_comment"
+            },
+            DocCommentHighlightRules.getStartRule("doc-start"),
+            {
+                token : "comment", // multi line comment
+                regex : /\/\*/,
+                next : "comment"
+            }, {
+                token : "string",
+                regex : "'(?=.)",
+                next  : "qstring"
+            }, {
+                token : "string",
+                regex : '"(?=.)',
+                next  : "qqstring"
+            }, {
+                token : "constant.numeric", // hex
+                regex : /0[xX][0-9a-fA-F]+\b/
+            }, {
+                token : "constant.numeric", // float
+                regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
+            }, {
+                // Sound.prototype.play =
+                token : [
+                    "storage.type", "punctuation.operator", "support.function",
+                    "punctuation.operator", "entity.name.function", "text","keyword.operator"
+                ],
+                regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
+                next: "function_arguments"
+            }, {
+                // Sound.play = function() {  }
+                token : [
+                    "storage.type", "punctuation.operator", "entity.name.function", "text",
+                    "keyword.operator", "text", "storage.type", "text", "paren.lparen"
+                ],
+                regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
+                next: "function_arguments"
+            }, {
+                // play = function() {  }
+                token : [
+                    "entity.name.function", "text", "keyword.operator", "text", "storage.type",
+                    "text", "paren.lparen"
+                ],
+                regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
+                next: "function_arguments"
+            }, {
+                // Sound.play = function play() {  }
+                token : [
+                    "storage.type", "punctuation.operator", "entity.name.function", "text",
+                    "keyword.operator", "text",
+                    "storage.type", "text", "entity.name.function", "text", "paren.lparen"
+                ],
+                regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
+                next: "function_arguments"
+            }, {
+                // function myFunc(arg) { }
+                token : [
+                    "storage.type", "text", "entity.name.function", "text", "paren.lparen"
+                ],
+                regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
+                next: "function_arguments"
+            }, {
+                // foobar: function() { }
+                token : [
+                    "entity.name.function", "text", "punctuation.operator",
+                    "text", "storage.type", "text", "paren.lparen"
+                ],
+                regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
+                next: "function_arguments"
+            }, {
+                // : function() { } (this is for issues with 'foo': function() { })
+                token : [
+                    "text", "text", "storage.type", "text", "paren.lparen"
+                ],
+                regex : "(:)(\\s*)(function)(\\s*)(\\()",
+                next: "function_arguments"
+            }, {
+                token : "keyword",
+                regex : "(?:" + kwBeforeRe + ")\\b",
+                next : "start"
+            }, {
+                token : ["punctuation.operator", "support.function"],
+                regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nabl
 eExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
+            }, {
+                token : ["punctuation.operator", "support.function.dom"],
+                regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
+            }, {
+                token : ["punctuation.operator", "support.constant"],
+                regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thn
 ame|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
+            }, {
+                token : ["storage.type", "punctuation.operator", "support.function.firebug"],
+                regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
+            }, {
+                token : keywordMapper,
+                regex : identifierRe
+            }, {
+                token : "keyword.operator",
+                regex : /--|\+\+|[!$%&*+\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=/,
+                next  : "start"
+            }, {
+                token : "punctuation.operator",
+                regex : /\?|\:|\,|\;|\./,
+                next  : "start"
+            }, {
+                token : "paren.lparen",
+                regex : /[\[({]/,
+                next  : "start"
+            }, {
+                token : "paren.rparen",
+                regex : /[\])}]/
+            }, {
+                token : "keyword.operator",
+                regex : /\/=?/,
+                next  : "start"
+            }, {
+                token: "comment",
+                regex: /^#!.*$/
+            }
+        ],
+        // regular expressions are only allowed after certain tokens. This
+        // makes sure we don't mix up regexps with the divison operator
+        "start": [
+            DocCommentHighlightRules.getStartRule("doc-start"),
+            {
+                token : "comment", // multi line comment
+                regex : "\\/\\*",
+                next : "comment_regex_allowed"
+            }, {
+                token : "comment",
+                regex : "\\/\\/",
+                next : "line_comment_regex_allowed"
+            }, {
+                token: "string.regexp",
+                regex: "\\/",
+                next: "regex"
+            }, {
+                token : "text",
+                regex : "\\s+|^$",
+                next : "start"
+            }, {
+                // immediately return to the start mode without matching
+                // anything
+                token: "empty",
+                regex: "",
+                next: "no_regex"
+            }
+        ],
+        "regex": [
+            {
+                // escapes
+                token: "regexp.keyword.operator",
+                regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
+            }, {
+                // flag
+                token: "string.regexp",
+                regex: "/\\w*",
+                next: "no_regex"
+            }, {
+                // invalid operators
+                token : "invalid",
+                regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
+            }, {
+                // operators
+                token : "constant.language.escape",
+                regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?]/
+            }, {
+                token : "constant.language.delimiter",
+                regex: /\|/
+            }, {
+                token: "constant.language.escape",
+                regex: /\[\^?/,
+                next: "regex_character_class"
+            }, {
+                token: "empty",
+                regex: "$",
+                next: "no_regex"
+            }, {
+                defaultToken: "string.regexp"
+            }
+        ],
+        "regex_character_class": [
+            {
+                token: "regexp.keyword.operator",
+                regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
+            }, {
+                token: "constant.language.escape",
+                regex: "]",
+                next: "regex"
+            }, {
+                token: "constant.language.escape",
+                regex: "-"
+            }, {
+                token: "empty",
+                regex: "$",
+                next: "no_regex"
+            }, {
+                defaultToken: "string.regexp.charachterclass"
+            }
+        ],
+        "function_arguments": [
+            {
+                token: "variable.parameter",
+                regex: identifierRe
+            }, {
+                token: "punctuation.operator",
+                regex: "[, ]+"
+            }, {
+                token: "punctuation.operator",
+                regex: "$"
+            }, {
+                token: "empty",
+                regex: "",
+                next: "no_regex"
+            }
+        ],
+        "comment_regex_allowed" : [
+            {token : "comment", regex : "\\*\\/", next : "start"},
+            {defaultToken : "comment"}
+        ],
+        "comment" : [
+            {token : "comment", regex : "\\*\\/", next : "no_regex"},
+            {defaultToken : "comment"}
+        ],
+        "line_comment_regex_allowed" : [
+            {token : "comment", regex : "$|^", next : "start"},
+            {defaultToken : "comment"}
+        ],
+        "line_comment" : [
+            {token : "comment", regex : "$|^", next : "no_regex"},
+            {defaultToken : "comment"}
+        ],
+        "qqstring" : [
+            {
+                token : "constant.language.escape",
+                regex : escapedRe
+            }, {
+                token : "string",
+                regex : "\\\\$",
+                next  : "qqstring"
+            }, {
+                token : "string",
+                regex : '"|$',
+                next  : "no_regex"
+            }, {
+                defaultToken: "string"
+            }
+        ],
+        "qstring" : [
+            {
+                token : "constant.language.escape",
+                regex : escapedRe
+            }, {
+                token : "string",
+                regex : "\\\\$",
+                next  : "qstring"
+            }, {
+                token : "string",
+                regex : "'|$",
+                next  : "no_regex"
+            }, {
+                defaultToken: "string"
+            }
+        ]
+    };
+
+    this.embedRules(DocCommentHighlightRules, "doc-",
+        [ DocCommentHighlightRules.getEndRule("no_regex") ]);
+};
+
+oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
+
+exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/javascript_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/javascript_test.js b/src/fauxton/assets/js/libs/ace/mode/javascript_test.js
new file mode 100644
index 0000000..b413765
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/javascript_test.js
@@ -0,0 +1,213 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("../edit_session").EditSession;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var JavaScriptMode = require("./javascript").Mode;
+var assert = require("../test/assertions");
+
+module.exports = {
+    setUp : function() {    
+        this.mode = new JavaScriptMode();
+    },
+
+    "test: getTokenizer() (smoke test)" : function() {
+        var tokenizer = this.mode.getTokenizer();
+
+        assert.ok(tokenizer instanceof Tokenizer);
+
+        var tokens = tokenizer.getLineTokens("'juhu'", "start").tokens;
+        assert.equal("string", tokens[0].type);
+    },
+
+    "test: toggle comment lines should prepend '//' to each line" : function() {
+        var session = new EditSession(["  abc", "cde", "fg"]);
+        session.setTabSize(1);
+
+        this.mode.toggleCommentLines("start", session, 0, 1);
+        assert.equal(["//   abc", "// cde", "fg"].join("\n"), session.toString());
+    },
+
+    "test: toggle comment on commented lines should remove leading '//' chars" : function() {
+        var session = new EditSession(["//  abc", "//cde", "fg"]);
+        session.setTabSize(1);
+
+        this.mode.toggleCommentLines("start", session, 0, 1);
+        assert.equal([" abc", "cde", "fg"].join("\n"), session.toString());
+    },
+	
+	"test: toggle comment on all empty lines" : function() {
+        var session = new EditSession(["  ", " ", "  "]);
+        session.setTabSize(1);
+
+        this.mode.toggleCommentLines("start", session, 0, 1);
+        assert.equal([" //  ", " // ", "  "].join("\n"), session.toString());
+    },
+	
+	"test: toggle comment with empty lines" : function() {
+        var session = new EditSession([
+			"        abc",
+			"",
+			"    cde", 
+			"    fg"]);
+		
+		var initial = session.toString();
+        this.mode.toggleCommentLines("start", session, 0, 3);
+        assert.equal([
+		    "    //     abc",
+			"",
+			"    // cde", 
+			"    // fg"].join("\n"),
+			session.toString()
+		);
+		this.mode.toggleCommentLines("start", session, 0, 3);
+		assert.equal(initial, session.toString());
+    },
+
+    "test: toggle comment lines twice should return the original text" : function() {
+        var session = new EditSession(["  abc", "cde", "fg"]);
+
+        this.mode.toggleCommentLines("start", session, 0, 2);
+        this.mode.toggleCommentLines("start", session, 0, 2);
+        assert.equal(["  abc", "cde", "fg"].join("\n"), session.toString());
+    },
+
+    "test: toggle comment on multiple lines with one commented line prepend '//' to each line" : function() {
+        var session = new EditSession(["  //  abc", "  //cde", "    fg"]);
+        session.setTabSize(1);
+        this.mode.toggleCommentLines("start", session, 0, 2);
+        assert.equal(["  // //  abc", "  // //cde", "  //   fg"].join("\n"), session.toString());
+    },
+
+    "test: toggle comment on a comment line with leading white space": function() {
+        var session = new EditSession(["//cde", "  //fg"]);
+
+        this.mode.toggleCommentLines("start", session, 0, 1);
+        assert.equal(["cde", "  fg"].join("\n"), session.toString());
+    },
+
+    "test: toggle comment lines should take tabsize into account" : function() {
+        var session = new EditSession(["  //  abc", "  // cde", "//    fg"]);
+        session.setTabSize(2);
+        this.mode.toggleCommentLines("start", session, 0, 2);
+        assert.equal(["    abc", "  cde", "    fg"].join("\n"), session.toString());
+        session.setTabSize(4);
+        this.mode.toggleCommentLines("start", session, 0, 2);
+        assert.equal(["//     abc", "//   cde", "//     fg"].join("\n"), session.toString());
+        this.mode.toggleCommentLines("start", session, 0, 2);
+        assert.equal(["    abc", "  cde", "    fg"].join("\n"), session.toString());
+        
+        session.insert({row: 0, column: 0}, " ");
+        this.mode.toggleCommentLines("start", session, 0, 2);
+        assert.equal(["//      abc", "//   cde", "//     fg"].join("\n"), session.toString());        
+    },
+    //there doesn't seem to be any way to make this work
+    "!test: togglecomment on line with one space" : function() {
+        var session = new EditSession([" abc", "  // cde", "//    fg"]);
+        var initialValue = session + "";
+        session.setTabSize(4);
+        this.mode.toggleCommentLines("start", session, 0, 0);
+        this.mode.toggleCommentLines("start", session, 0, 0);
+        assert.equal(initialValue, session.toString());
+    },
+
+    "test: auto indent after opening brace" : function() {
+        assert.equal("  ", this.mode.getNextLineIndent("start", "if () {", "  "));
+    },
+    
+    "test: auto indent after case" : function() {
+        assert.equal("  ", this.mode.getNextLineIndent("start", "case 'juhu':", "  "));
+    },
+
+    "test: no auto indent in object literal" : function() {
+        assert.equal("", this.mode.getNextLineIndent("start", "{ 'juhu':", "  "));
+    },
+
+    "test: no auto indent after opening brace in multi line comment" : function() {
+        assert.equal("", this.mode.getNextLineIndent("start", "/*if () {", "  "));
+        assert.equal("  ", this.mode.getNextLineIndent("comment", "  abcd", "  "));
+    },
+
+    "test: no auto indent after opening brace in single line comment" : function() {
+        assert.equal("", this.mode.getNextLineIndent("start", "//if () {", "  "));
+        assert.equal("  ", this.mode.getNextLineIndent("start", "  //if () {", "  "));
+    },
+
+    "test: no auto indent should add to existing indent" : function() {
+        assert.equal("      ", this.mode.getNextLineIndent("start", "    if () {", "  "));
+        assert.equal("    ", this.mode.getNextLineIndent("start", "    cde", "  "));
+        assert.equal("    ", this.mode.getNextLineIndent("start", "function foo(items) {", "    "));
+    },
+
+    "test: special indent in doc comments" : function() {
+        assert.equal(" * ", this.mode.getNextLineIndent("doc-start", "/**", " "));
+        assert.equal("   * ", this.mode.getNextLineIndent("doc-start", "  /**", " "));
+        assert.equal(" * ", this.mode.getNextLineIndent("doc-start", " *", " "));
+        assert.equal("    * ", this.mode.getNextLineIndent("doc-start", "    *", " "));
+        assert.equal("  ", this.mode.getNextLineIndent("doc-start", "  abc", " "));
+    },
+
+    "test: no indent after doc comments" : function() {
+        assert.equal("", this.mode.getNextLineIndent("doc-start", "   */", "  "));
+    },
+
+    "test: trigger outdent if line is space and new text starts with closing brace" : function() {
+        assert.ok(this.mode.checkOutdent("start", "   ", " }"));
+        assert.ok(!this.mode.checkOutdent("start", " a  ", " }"));
+        assert.ok(!this.mode.checkOutdent("start", "", "}"));
+        assert.ok(!this.mode.checkOutdent("start", "   ", "a }"));
+        assert.ok(!this.mode.checkOutdent("start", "   }", "}"));
+    },
+
+    "test: auto outdent should indent the line with the same indent as the line with the matching opening brace" : function() {
+        var session = new EditSession(["  function foo() {", "    bla", "    }"], new JavaScriptMode());
+        this.mode.autoOutdent("start", session, 2);
+        assert.equal("  }", session.getLine(2));
+    },
+
+    "test: no auto outdent if no matching brace is found" : function() {
+        var session = new EditSession(["  function foo()", "    bla", "    }"]);
+        this.mode.autoOutdent("start", session, 2);
+        assert.equal("    }", session.getLine(2));
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/javascript_worker.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/javascript_worker.js b/src/fauxton/assets/js/libs/ace/mode/javascript_worker.js
new file mode 100644
index 0000000..e6503ef
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/javascript_worker.js
@@ -0,0 +1,187 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var Mirror = require("../worker/mirror").Mirror;
+var lint = require("./javascript/jshint").JSHINT;
+
+function startRegex(arr) {
+    return RegExp("^(" + arr.join("|") + ")");
+}
+
+var disabledWarningsRe = startRegex([
+    "Bad for in variable '(.+)'.",
+    'Missing "use strict"'
+]);
+var errorsRe = startRegex([
+    "Unexpected",
+    "Expected ",
+    "Confusing (plus|minus)",
+    "\\{a\\} unterminated regular expression",
+    "Unclosed ",
+    "Unmatched ",
+    "Unbegun comment",
+    "Bad invocation",
+    "Missing space after",
+    "Missing operator at"
+]);
+var infoRe = startRegex([
+    "Expected an assignment",
+    "Bad escapement of EOL",
+    "Unexpected comma",
+    "Unexpected space",
+    "Missing radix parameter.",
+    "A leading decimal point can",
+    "\\['{a}'\\] is better written in dot notation.",
+    "'{a}' used out of scope"
+]);
+
+var JavaScriptWorker = exports.JavaScriptWorker = function(sender) {
+    Mirror.call(this, sender);
+    this.setTimeout(500);
+    this.setOptions();
+};
+
+oop.inherits(JavaScriptWorker, Mirror);
+
+(function() {
+    this.setOptions = function(options) {
+        this.options = options || {
+            // undef: true,
+            // unused: true,
+            esnext: true,
+            moz: true,
+            devel: true,
+            browser: true,
+            node: true,
+            laxcomma: true,
+            laxbreak: true,
+            lastsemic: true,
+            onevar: false,
+            passfail: false,
+            maxerr: 100,
+            expr: true,
+            multistr: true,
+            globalstrict: true
+        };
+        this.doc.getValue() && this.deferredUpdate.schedule(100);
+    };
+
+    this.changeOptions = function(newOptions) {
+        oop.mixin(this.options, newOptions);
+        this.doc.getValue() && this.deferredUpdate.schedule(100);
+    };
+
+    this.isValidJS = function(str) {
+        try {
+            // evaluated code can only create variables in this function
+            eval("throw 0;" + str);
+        } catch(e) {
+            if (e === 0)
+                return true;
+        }
+        return false
+    };
+
+    this.onUpdate = function() {
+        var value = this.doc.getValue();
+        value = value.replace(/^#!.*\n/, "\n");
+        if (!value) {
+            this.sender.emit("jslint", []);
+            return;
+        }
+        var errors = [];
+
+        // jshint reports many false errors
+        // report them as error only if code is actually invalid
+        var maxErrorLevel = this.isValidJS(value) ? "warning" : "error";
+
+        // var start = new Date();
+        lint(value, this.options);
+        var results = lint.errors;
+
+        var errorAdded = false
+        for (var i = 0; i < results.length; i++) {
+            var error = results[i];
+            if (!error)
+                continue;
+            var raw = error.raw;
+            var type = "warning";
+
+            if (raw == "Missing semicolon.") {
+                var str = error.evidence.substr(error.character);
+                str = str.charAt(str.search(/\S/));
+                if (maxErrorLevel == "error" && str && /[\w\d{(['"]/.test(str)) {
+                    error.reason = 'Missing ";" before statement';
+                    type = "error";
+                } else {
+                    type = "info";
+                }
+            }
+            else if (disabledWarningsRe.test(raw)) {
+                continue;
+            }
+            else if (infoRe.test(raw)) {
+                type = "info"
+            }
+            else if (errorsRe.test(raw)) {
+                errorAdded  = true;
+                type = maxErrorLevel;
+            }
+            else if (raw == "'{a}' is not defined.") {
+                type = "warning";
+            }
+            else if (raw == "'{a}' is defined but never used.") {
+                type = "info";
+            }
+
+            errors.push({
+                row: error.line-1,
+                column: error.character-1,
+                text: error.reason,
+                type: type,
+                raw: raw
+            });
+
+            if (errorAdded) {
+               // break;
+            }
+        }
+        // console.log("lint time: " + (new Date() - start));
+
+        this.sender.emit("jslint", errors);
+    };
+
+}).call(JavaScriptWorker.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/javascript_worker_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/javascript_worker_test.js b/src/fauxton/assets/js/libs/ace/mode/javascript_worker_test.js
new file mode 100644
index 0000000..5d61fc8
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/javascript_worker_test.js
@@ -0,0 +1,106 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var assert = require("../test/assertions");
+var JavaScriptWorker = require("./javascript_worker").JavaScriptWorker;
+
+
+module.exports = {
+    setUp : function() {
+        this.sender = {
+            on: function() {},
+            callback: function(data, id) {
+                this.data = data;
+            },
+            events: [],
+            emit: function(type, e) {
+                this.events.push([type, e]);
+            }
+        };
+    },
+
+    "test check for syntax error": function() {
+        var worker = new JavaScriptWorker(this.sender);
+        worker.setValue("Juhu Kinners");
+        worker.deferredUpdate.call();
+
+        var error = this.sender.events[0][1][0];
+        assert.equal(error.text, 'Missing ";" before statement');
+        assert.equal(error.type, "error");
+        assert.equal(error.row, 0);
+        assert.equal(error.column, 4);
+    },
+
+    "test invalid multi line string": function() {
+        var worker = new JavaScriptWorker(this.sender);
+        worker.setValue('"a\n\\nn"');
+        worker.deferredUpdate.call();
+
+        var error = this.sender.events[0][1][0];
+        assert.equal(error.text, "Unclosed string.");
+        assert.equal(error.type, "error");
+        assert.equal(error.row, 0);
+        assert.equal(error.column, 2);
+    },
+
+    "test another invalid string": function() {
+        var worker = new JavaScriptWorker(this.sender);
+        worker.setValue("if('");
+        worker.deferredUpdate.call();
+        
+        var error = this.sender.events[0][1][0];
+        assert.equal(error.text, "Unclosed string.");
+        assert.equal(error.type, "error");
+        assert.equal(error.row, 0);
+        assert.equal(error.column, 4);
+    },
+    
+    "test for each": function() {
+        var worker = new JavaScriptWorker(this.sender);
+        worker.setValue("for each(var i in x)");
+        worker.deferredUpdate.call();
+        
+        var error = this.sender.events[0][1][0];
+        assert.equal(error.text, "Unexpected early end of program.");
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec();
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/js_regex_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/js_regex_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/js_regex_highlight_rules.js
new file mode 100644
index 0000000..d54e2ca
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/js_regex_highlight_rules.js
@@ -0,0 +1,94 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var escape = "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)";
+var quantifier = "({\\d+\\b,?\\d*}|[+*?])(\\??)";
+
+var JsRegexHighlightRules = function() {
+    this.$rules = {
+        "start": [{
+                // operators
+                token : "keyword",
+                regex: "\\\\[bB]",
+                next: "no_quantifier"
+            }, {
+                token: "regexp.keyword.operator",
+                regex: escape
+            }, {
+                // flag
+                token: "string.regexp",
+                regex: "/\\w*",
+                next: "start"
+            }, {               
+                token : ["string", "string.regex"],
+                regex: quantifier,
+                next: "no_quantifier"
+            }, {
+                // operators
+                token : "keyword",
+                regex: "[$^]|\\\\[bB]",
+                next: "no_quantifier"
+            }, {
+                // operators
+                token : "constant.language.escape",
+                regex: /\(\?[:=!]|\)|[()$^+*?]/,
+                next: "no_quantifier"
+            }, {
+                token : "constant.language.delimiter",
+                regex: /\|/,
+                next: "no_quantifier"
+            }, {
+                token: "constant.language.escape",
+                regex: /\[\^?/,
+                next: "character_class"
+            }, {
+                token: "empty",
+                regex: "$",
+                next: "start"
+            }
+        ],
+        
+
+        "character_class": [{
+                regex: /\\[dDwWsS]/
+            },{
+                token: "markup.list",
+                regex: "(?:" + escape + "|.)-(?:[^\\]\\\\]|" + escape + ")"
+            }, {
+                token: "keyword",
+                regex: escape
+            }, {
+                token: "constant.language.escape",
+                regex: "]",
+                next: "start"
+            }, {
+                token: "constant.language.escape",
+                regex: "-"
+            }, {
+                token: "empty",
+                regex: "$",
+                next: "start"
+            }, {
+                defaultToken: "string.regexp.charachterclass"
+            }
+        ],
+        "no_quantifier":[{
+                token: "invalid",
+                regex: quantifier
+            }, {
+                token: "invalid",
+                regex: "",
+                next: "start"
+            }
+        ]
+        
+    };
+};
+
+oop.inherits(JsRegexHighlightRules, TextHighlightRules);
+
+exports.JsRegexHighlightRules = JsRegexHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/json.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/json.js b/src/fauxton/assets/js/libs/ace/mode/json.js
new file mode 100644
index 0000000..1f92c56
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/json.js
@@ -0,0 +1,93 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var HighlightRules = require("./json_highlight_rules").JsonHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+var WorkerClient = require("../worker/worker_client").WorkerClient;
+
+var Mode = function() {
+    this.HighlightRules = HighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new CstyleBehaviour();
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        if (state == "start") {
+            var match = line.match(/^.*[\{\(\[]\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+    this.createWorker = function(session) {
+        var worker = new WorkerClient(["ace"], "ace/mode/json_worker", "JsonWorker");
+        worker.attachToDocument(session.getDocument());
+
+        worker.on("error", function(e) {
+            session.setAnnotations([e.data]);
+        });
+
+        worker.on("ok", function() {
+            session.clearAnnotations();
+        });
+
+        return worker;
+    };
+
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/json/json_parse.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/json/json_parse.js b/src/fauxton/assets/js/libs/ace/mode/json/json_parse.js
new file mode 100644
index 0000000..7841ab7
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/json/json_parse.js
@@ -0,0 +1,346 @@
+/*
+    http://www.JSON.org/json_parse.js
+    2008-09-18
+
+    Public Domain.
+
+    NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
+
+    This file creates a json_parse function.
+
+        json_parse(text, reviver)
+            This method parses a JSON text to produce an object or array.
+            It can throw a SyntaxError exception.
+
+            The optional reviver parameter is a function that can filter and
+            transform the results. It receives each of the keys and values,
+            and its return value is used instead of the original value.
+            If it returns what it received, then the structure is not modified.
+            If it returns undefined then the member is deleted.
+
+            Example:
+
+            // Parse the text. Values that look like ISO date strings will
+            // be converted to Date objects.
+
+            myData = json_parse(text, function (key, value) {
+                var a;
+                if (typeof value === 'string') {
+                    a =
+/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
+                    if (a) {
+                        return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+                            +a[5], +a[6]));
+                    }
+                }
+                return value;
+            });
+
+    This is a reference implementation. You are free to copy, modify, or
+    redistribute.
+
+    This code should be minified before deployment.
+    See http://javascript.crockford.com/jsmin.html
+
+    USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
+    NOT CONTROL.
+*/
+
+/*members "", "\"", "\/", "\\", at, b, call, charAt, f, fromCharCode,
+    hasOwnProperty, message, n, name, push, r, t, text
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+// This is a function that can parse a JSON text, producing a JavaScript
+// data structure. It is a simple, recursive descent parser. It does not use
+// eval or regular expressions, so it can be used as a model for implementing
+// a JSON parser in other languages.
+
+// We are defining the function inside of another function to avoid creating
+// global variables.
+
+    var at,     // The index of the current character
+        ch,     // The current character
+        escapee = {
+            '"':  '"',
+            '\\': '\\',
+            '/':  '/',
+            b:    '\b',
+            f:    '\f',
+            n:    '\n',
+            r:    '\r',
+            t:    '\t'
+        },
+        text,
+
+        error = function (m) {
+
+// Call error when something is wrong.
+
+            throw {
+                name:    'SyntaxError',
+                message: m,
+                at:      at,
+                text:    text
+            };
+        },
+
+        next = function (c) {
+
+// If a c parameter is provided, verify that it matches the current character.
+
+            if (c && c !== ch) {
+                error("Expected '" + c + "' instead of '" + ch + "'");
+            }
+
+// Get the next character. When there are no more characters,
+// return the empty string.
+
+            ch = text.charAt(at);
+            at += 1;
+            return ch;
+        },
+
+        number = function () {
+
+// Parse a number value.
+
+            var number,
+                string = '';
+
+            if (ch === '-') {
+                string = '-';
+                next('-');
+            }
+            while (ch >= '0' && ch <= '9') {
+                string += ch;
+                next();
+            }
+            if (ch === '.') {
+                string += '.';
+                while (next() && ch >= '0' && ch <= '9') {
+                    string += ch;
+                }
+            }
+            if (ch === 'e' || ch === 'E') {
+                string += ch;
+                next();
+                if (ch === '-' || ch === '+') {
+                    string += ch;
+                    next();
+                }
+                while (ch >= '0' && ch <= '9') {
+                    string += ch;
+                    next();
+                }
+            }
+            number = +string;
+            if (isNaN(number)) {
+                error("Bad number");
+            } else {
+                return number;
+            }
+        },
+
+        string = function () {
+
+// Parse a string value.
+
+            var hex,
+                i,
+                string = '',
+                uffff;
+
+// When parsing for string values, we must look for " and \ characters.
+
+            if (ch === '"') {
+                while (next()) {
+                    if (ch === '"') {
+                        next();
+                        return string;
+                    } else if (ch === '\\') {
+                        next();
+                        if (ch === 'u') {
+                            uffff = 0;
+                            for (i = 0; i < 4; i += 1) {
+                                hex = parseInt(next(), 16);
+                                if (!isFinite(hex)) {
+                                    break;
+                                }
+                                uffff = uffff * 16 + hex;
+                            }
+                            string += String.fromCharCode(uffff);
+                        } else if (typeof escapee[ch] === 'string') {
+                            string += escapee[ch];
+                        } else {
+                            break;
+                        }
+                    } else {
+                        string += ch;
+                    }
+                }
+            }
+            error("Bad string");
+        },
+
+        white = function () {
+
+// Skip whitespace.
+
+            while (ch && ch <= ' ') {
+                next();
+            }
+        },
+
+        word = function () {
+
+// true, false, or null.
+
+            switch (ch) {
+            case 't':
+                next('t');
+                next('r');
+                next('u');
+                next('e');
+                return true;
+            case 'f':
+                next('f');
+                next('a');
+                next('l');
+                next('s');
+                next('e');
+                return false;
+            case 'n':
+                next('n');
+                next('u');
+                next('l');
+                next('l');
+                return null;
+            }
+            error("Unexpected '" + ch + "'");
+        },
+
+        value,  // Place holder for the value function.
+
+        array = function () {
+
+// Parse an array value.
+
+            var array = [];
+
+            if (ch === '[') {
+                next('[');
+                white();
+                if (ch === ']') {
+                    next(']');
+                    return array;   // empty array
+                }
+                while (ch) {
+                    array.push(value());
+                    white();
+                    if (ch === ']') {
+                        next(']');
+                        return array;
+                    }
+                    next(',');
+                    white();
+                }
+            }
+            error("Bad array");
+        },
+
+        object = function () {
+
+// Parse an object value.
+
+            var key,
+                object = {};
+
+            if (ch === '{') {
+                next('{');
+                white();
+                if (ch === '}') {
+                    next('}');
+                    return object;   // empty object
+                }
+                while (ch) {
+                    key = string();
+                    white();
+                    next(':');
+                    if (Object.hasOwnProperty.call(object, key)) {
+                        error('Duplicate key "' + key + '"');
+                    }
+                    object[key] = value();
+                    white();
+                    if (ch === '}') {
+                        next('}');
+                        return object;
+                    }
+                    next(',');
+                    white();
+                }
+            }
+            error("Bad object");
+        };
+
+    value = function () {
+
+// Parse a JSON value. It could be an object, an array, a string, a number,
+// or a word.
+
+        white();
+        switch (ch) {
+        case '{':
+            return object();
+        case '[':
+            return array();
+        case '"':
+            return string();
+        case '-':
+            return number();
+        default:
+            return ch >= '0' && ch <= '9' ? number() : word();
+        }
+    };
+
+// Return the json_parse function. It will have access to all of the above
+// functions and variables.
+
+    return function (source, reviver) {
+        var result;
+
+        text = source;
+        at = 0;
+        ch = ' ';
+        result = value();
+        white();
+        if (ch) {
+            error("Syntax error");
+        }
+
+// If there is a reviver function, we recursively walk the new structure,
+// passing each name/value pair to the reviver function for possible
+// transformation, starting with a temporary root object that holds the result
+// in an empty key. If there is not a reviver function, we simply return the
+// result.
+
+        return typeof reviver === 'function' ? function walk(holder, key) {
+            var k, v, value = holder[key];
+            if (value && typeof value === 'object') {
+                for (k in value) {
+                    if (Object.hasOwnProperty.call(value, k)) {
+                        v = walk(value, k);
+                        if (v !== undefined) {
+                            value[k] = v;
+                        } else {
+                            delete value[k];
+                        }
+                    }
+                }
+            }
+            return reviver.call(holder, key, value);
+        }({'': result}, '') : result;
+    };
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/json_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/json_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/json_highlight_rules.js
new file mode 100644
index 0000000..4bccaf1
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/json_highlight_rules.js
@@ -0,0 +1,100 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var JsonHighlightRules = function() {
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+    this.$rules = {
+        "start" : [
+            {
+                token : "variable", // single line
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'
+            }, {
+                token : "string", // single line
+                regex : '"',
+                next  : "string"
+            }, {
+                token : "constant.numeric", // hex
+                regex : "0[xX][0-9a-fA-F]+\\b"
+            }, {
+                token : "constant.numeric", // float
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+            }, {
+                token : "constant.language.boolean",
+                regex : "(?:true|false)\\b"
+            }, {
+                token : "invalid.illegal", // single quoted strings are not allowed
+                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+            }, {
+                token : "invalid.illegal", // comments are not allowed
+                regex : "\\/\\/.*$"
+            }, {
+                token : "paren.lparen",
+                regex : "[[({]"
+            }, {
+                token : "paren.rparen",
+                regex : "[\\])}]"
+            }, {
+                token : "text",
+                regex : "\\s+"
+            }
+        ],
+        "string" : [
+            {
+                token : "constant.language.escape",
+                regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/
+            }, {
+                token : "string",
+                regex : '[^"\\\\]+'
+            }, {
+                token : "string",
+                regex : '"',
+                next  : "start"
+            }, {
+                token : "string",
+                regex : "",
+                next  : "start"
+            }
+        ]
+    };
+    
+};
+
+oop.inherits(JsonHighlightRules, TextHighlightRules);
+
+exports.JsonHighlightRules = JsonHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/json_worker.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/json_worker.js b/src/fauxton/assets/js/libs/ace/mode/json_worker.js
new file mode 100644
index 0000000..9c233d7
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/json_worker.js
@@ -0,0 +1,67 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var Mirror = require("../worker/mirror").Mirror;
+var parse = require("./json/json_parse");
+
+var JsonWorker = exports.JsonWorker = function(sender) {
+    Mirror.call(this, sender);
+    this.setTimeout(200);
+};
+
+oop.inherits(JsonWorker, Mirror);
+
+(function() {
+
+    this.onUpdate = function() {
+        var value = this.doc.getValue();
+
+        try {
+            var result = parse(value);
+        } catch (e) {
+            var pos = this.doc.indexToPosition(e.at-1);
+            this.sender.emit("error", {
+                row: pos.row,
+                column: pos.column,
+                text: e.message,
+                type: "error"
+            });
+            return;
+        }
+        this.sender.emit("ok");
+    };
+
+}).call(JsonWorker.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/json_worker_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/json_worker_test.js b/src/fauxton/assets/js/libs/ace/mode/json_worker_test.js
new file mode 100644
index 0000000..b4a8610
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/json_worker_test.js
@@ -0,0 +1,101 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var assert = require("../test/assertions");
+var Worker = require("./json_worker").JsonWorker;
+
+
+module.exports = {
+    setUp : function() {
+        this.sender = {
+            on: function() {},
+            callback: function(data, id) {
+                this.data = data;
+            },
+            events: [],
+            emit: function(type, e) {
+                this.events.push([type, e]);
+            }
+        };
+    },
+
+    "test check valid json": function() {
+        var worker = new Worker(this.sender);
+        worker.setValue("{}");
+        worker.deferredUpdate.call();
+
+        assert.equal(this.sender.events[0][0], "ok");
+    },
+
+    "test check for syntax error": function() {
+        var worker = new Worker(this.sender);
+        worker.setValue([
+            "{",
+            "juhu: 12",
+            "}"
+        ].join("\n"));
+        worker.deferredUpdate.call();
+
+        var event = this.sender.events[0];
+        assert.equal(event[0], "error");
+        assert.equal(event[1].type, "error");
+        assert.equal(event[1].text, "Bad string");
+        assert.equal(event[1].row, 1);
+        assert.equal(event[1].column, 0);
+
+    },
+
+    "test check for syntax error at first char": function() {
+        var worker = new Worker(this.sender);
+        worker.setValue("x");
+        worker.deferredUpdate.call();
+
+        var event = this.sender.events[0];
+        assert.equal(event[0], "error");
+        assert.equal(event[1].type, "error");
+        assert.equal(event[1].text, "Unexpected 'x'");
+        assert.equal(event[1].row, 0);
+        assert.equal(event[1].column, 0);
+    }
+
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec();
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/jsoniq.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/jsoniq.js b/src/fauxton/assets/js/libs/ace/mode/jsoniq.js
new file mode 100644
index 0000000..f269da1
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/jsoniq.js
@@ -0,0 +1,106 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var JSONiqLexer = require("./xquery/JSONiqLexer").JSONiqLexer;
+var Range = require("../range").Range;
+var XQueryBehaviour = require("./behaviour/xquery").XQueryBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+
+var Mode = function() {
+    this.$tokenizer   = new JSONiqLexer();
+    this.$behaviour   = new XQueryBehaviour();
+    this.foldingRules = new CStyleFoldMode();
+};
+
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+        var match = line.match(/\s*(?:then|else|return|[{\(]|<\w+>)\s*$/);
+        if (match)
+            indent += tab;
+        return indent;
+    };
+    
+    this.checkOutdent = function(state, line, input) {
+        if (! /^\s+$/.test(line))
+            return false;
+
+        return /^\s*[\}\)]/.test(input);
+    };
+    
+    this.autoOutdent = function(state, doc, row) {
+        var line = doc.getLine(row);
+        var match = line.match(/^(\s*[\}\)])/);
+
+        if (!match) return 0;
+
+        var column = match[1].length;
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
+
+        if (!openBracePos || openBracePos.row == row) return 0;
+
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
+        doc.replace(new Range(row, 0, row, column-1), indent);
+    };
+
+    this.toggleCommentLines = function(state, doc, startRow, endRow) {
+        var i, line;
+        var outdent = true;
+        var re = /^\s*\(:(.*):\)/;
+
+        for (i=startRow; i<= endRow; i++) {
+            if (!re.test(doc.getLine(i))) {
+                outdent = false;
+                break;
+            }
+        }
+
+        var range = new Range(0, 0, 0, 0);
+        for (i=startRow; i<= endRow; i++) {
+            line = doc.getLine(i);
+            range.start.row  = i;
+            range.end.row    = i;
+            range.end.column = line.length;
+
+            doc.replace(range, outdent ? line.match(re)[1] : "(:" + line + ":)");
+        }
+    };
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/jsp.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/jsp.js b/src/fauxton/assets/js/libs/ace/mode/jsp.js
new file mode 100644
index 0000000..03df8d3
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/jsp.js
@@ -0,0 +1,55 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var JspHighlightRules = require("./jsp_highlight_rules").JspHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = JspHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new CstyleBehaviour();
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/jsp_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/jsp_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/jsp_highlight_rules.js
new file mode 100644
index 0000000..e6775f5
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/jsp_highlight_rules.js
@@ -0,0 +1,91 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+var JavaHighlightRules = require("./java_highlight_rules").JavaHighlightRules;
+
+var JspHighlightRules = function() {
+    HtmlHighlightRules.call(this);
+
+    var builtinVariables = 'request|response|out|session|' +
+            'application|config|pageContext|page|Exception';
+
+    var keywords = 'page|include|taglib';
+
+    var startRules = [
+        {
+            token : "comment",
+            regex : "<%--",
+            push : "jsp-dcomment"
+        }, {
+            token : "meta.tag", // jsp open tag
+            regex : "<%@?|<%=?|<jsp:[^>]+>",
+            push  : "jsp-start"
+        }
+    ];
+
+    var endRules = [
+        {
+            token : "meta.tag", // jsp close tag
+            regex : "%>|<\\/jsp:[^>]+>",
+            next  : "pop"
+        }, {
+            token: "variable.language",
+            regex : builtinVariables
+        }, {
+            token: "keyword",
+            regex : keywords
+        }
+    ];
+
+    for (var key in this.$rules)
+        this.$rules[key].unshift.apply(this.$rules[key], startRules);
+
+    this.embedRules(JavaHighlightRules, "jsp-", endRules, ["start"]);
+
+    this.addRules({
+        "jsp-dcomment" : [{
+            token : "comment",
+            regex : ".*?--%>",
+            next : "pop"
+        }]
+    });
+
+    this.normalizeRules();
+};
+
+oop.inherits(JspHighlightRules, HtmlHighlightRules);
+
+exports.JspHighlightRules = JspHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/jsx.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/jsx.js b/src/fauxton/assets/js/libs/ace/mode/jsx.js
new file mode 100644
index 0000000..999a977
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/jsx.js
@@ -0,0 +1,56 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var JsxHighlightRules = require("./jsx_highlight_rules").JsxHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+function Mode() {
+    this.HighlightRules = JsxHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new CstyleBehaviour();
+    this.foldingRules = new CStyleFoldMode();
+}
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = "//";
+    this.blockComment = {start: "/*", end: "*/"};
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+
+        if (state == "start") {
+            var match = line.match(/^.*[\{\(\[]\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/jsx_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/jsx_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/jsx_highlight_rules.js
new file mode 100644
index 0000000..5dcfbd6
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/jsx_highlight_rules.js
@@ -0,0 +1,120 @@
+define(function(require, exports, module) {
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var JsxHighlightRules = function() {
+    var keywords = lang.arrayToMap(
+        ("break|do|instanceof|typeof|case|else|new|var|catch|finally|return|void|continue|for|switch|default|while|function|this|" +
+         "if|throw|" +
+         "delete|in|try|" +
+         "class|extends|super|import|from|into|implements|interface|static|mixin|override|abstract|final|" +
+         "number|int|string|boolean|variant|" +
+         "log|assert").split("|")
+    );
+    
+    var buildinConstants = lang.arrayToMap(
+        ("null|true|false|NaN|Infinity|__FILE__|__LINE__|undefined").split("|")
+    );
+    
+    var reserved = lang.arrayToMap(
+        ("debugger|with|" +
+         "const|export|" +
+         "let|private|public|yield|protected|" +
+         "extern|native|as|operator|__fake__|__readonly__").split("|")
+    );
+    
+    var identifierRe = "[a-zA-Z_][a-zA-Z0-9_]*\\b";
+    
+    this.$rules = {
+        "start" : [
+            {
+                token : "comment",
+                regex : "\\/\\/.*$"
+            },
+            DocCommentHighlightRules.getStartRule("doc-start"),
+            {
+                token : "comment", // multi line comment
+                regex : "\\/\\*",
+                next : "comment"
+            }, {
+                token : "string.regexp",
+                regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
+            }, {
+                token : "string", // single line
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+            }, {
+                token : "string", // single line
+                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+            }, {
+                token : "constant.numeric", // hex
+                regex : "0[xX][0-9a-fA-F]+\\b"
+            }, {
+                token : "constant.numeric", // float
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+            }, {
+                token : "constant.language.boolean",
+                regex : "(?:true|false)\\b"
+            }, {
+                token : [
+                    "storage.type",
+                    "text",
+                    "entity.name.function"
+                ],
+                regex : "(function)(\\s+)(" + identifierRe + ")"
+            }, {
+                token : function(value) {
+                    if (value == "this")
+                        return "variable.language";
+                    else if (value == "function")
+                        return "storage.type";
+                    else if (keywords.hasOwnProperty(value) || reserved.hasOwnProperty(value))
+                        return "keyword";
+                    else if (buildinConstants.hasOwnProperty(value))
+                        return "constant.language";
+                    else if (/^_?[A-Z][a-zA-Z0-9_]*$/.test(value))
+                        return "language.support.class";
+                    else
+                        return "identifier";
+                },
+                // TODO: Unicode escape sequences
+                // TODO: Unicode identifiers
+                regex : identifierRe
+            }, {
+                token : "keyword.operator",
+                regex : "!|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
+            }, {
+                token : "punctuation.operator",
+                regex : "\\?|\\:|\\,|\\;|\\."
+            }, {
+                token : "paren.lparen",
+                regex : "[[({<]"
+            }, {
+                token : "paren.rparen",
+                regex : "[\\])}>]"
+            }, {
+                token : "text",
+                regex : "\\s+"
+            }
+        ],
+        "comment" : [
+            {
+                token : "comment", // closing comment
+                regex : ".*?\\*\\/",
+                next : "start"
+            }, {
+                token : "comment", // comment spanning whole line
+                regex : ".+"
+            }
+        ]
+    };
+    
+    this.embedRules(DocCommentHighlightRules, "doc-",
+        [ DocCommentHighlightRules.getEndRule("start") ]);
+};
+
+oop.inherits(JsxHighlightRules, TextHighlightRules);
+
+exports.JsxHighlightRules = JsxHighlightRules;
+});
\ No newline at end of file


[05/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/sh_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/sh_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/sh_highlight_rules.js
new file mode 100644
index 0000000..d9ed560
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/sh_highlight_rules.js
@@ -0,0 +1,144 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var reservedKeywords = exports.reservedKeywords = (
+        '!|{|}|case|do|done|elif|else|'+
+        'esac|fi|for|if|in|then|until|while|'+
+        '&|;|export|local|read|typeset|unset|'+
+        'elif|select|set'
+    );
+
+var languageConstructs = exports.languageConstructs = (
+    '[|]|alias|bg|bind|break|builtin|'+
+     'cd|command|compgen|complete|continue|'+
+     'dirs|disown|echo|enable|eval|exec|'+
+     'exit|fc|fg|getopts|hash|help|history|'+
+     'jobs|kill|let|logout|popd|printf|pushd|'+
+     'pwd|return|set|shift|shopt|source|'+
+     'suspend|test|times|trap|type|ulimit|'+
+     'umask|unalias|wait'
+);
+
+var ShHighlightRules = function() {
+    var keywordMapper = this.createKeywordMapper({
+        "keyword": reservedKeywords,
+        "support.function.builtin": languageConstructs,
+        "invalid.deprecated": "debugger"
+    }, "identifier");
+
+    var integer = "(?:(?:[1-9]\\d*)|(?:0))";
+    // var integer = "(?:" + decimalInteger + ")";
+
+    var fraction = "(?:\\.\\d+)";
+    var intPart = "(?:\\d+)";
+    var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
+    var exponentFloat = "(?:(?:" + pointFloat + "|" +  intPart + ")" + ")";
+    var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
+    var fileDescriptor = "(?:&" + intPart + ")";
+
+    var variableName = "[a-zA-Z][a-zA-Z0-9_]*";
+    var variable = "(?:(?:\\$" + variableName + ")|(?:" + variableName + "=))";
+
+    var builtinVariable = "(?:\\$(?:SHLVL|\\$|\\!|\\?))";
+
+    var func = "(?:" + variableName + "\\s*\\(\\))";
+
+    this.$rules = {
+        "start" : [{
+            token : "constant",
+            regex : /\\./
+        }, {
+            token : ["text", "comment"],
+            regex : /(^|\s)(#.*)$/
+        }, {
+            token : "string",
+            regex : '"',
+            push : [{
+                token : "constant.language.escape",
+                regex : /\\(?:[$abeEfnrtv\\'"]|x[a-fA-F\d]{1,2}|u[a-fA-F\d]{4}([a-fA-F\d]{4})?|c.|\d{1,3})/
+            }, {
+                token : "constant",
+                regex : /\$\w+/
+            }, {
+                token : "string",
+                regex : '"',
+                next: "pop"
+            }, {
+                defaultToken: "string"
+            }]
+        }, {
+            token : "variable.language",
+            regex : builtinVariable
+        }, {
+            token : "variable",
+            regex : variable
+        }, {
+            token : "support.function",
+            regex : func
+        }, {
+            token : "support.function",
+            regex : fileDescriptor
+        }, {
+            token : "string",           // ' string
+            start : "'", end : "'"
+        }, {
+            token : "constant.numeric", // float
+            regex : floatNumber
+        }, {
+            token : "constant.numeric", // integer
+            regex : integer + "\\b"
+        }, {
+            token : keywordMapper,
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        }, {
+            token : "keyword.operator",
+            regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|~|<|>|<=|=>|=|!="
+        }, {
+            token : "paren.lparen",
+            regex : "[\\[\\(\\{]"
+        }, {
+            token : "paren.rparen",
+            regex : "[\\]\\)\\}]"
+        } ]
+    };
+    
+    this.normalizeRules();
+};
+
+oop.inherits(ShHighlightRules, TextHighlightRules);
+
+exports.ShHighlightRules = ShHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/sjs.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/sjs.js b/src/fauxton/assets/js/libs/ace/mode/sjs.js
new file mode 100644
index 0000000..e075d60
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/sjs.js
@@ -0,0 +1,59 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+var oop = require("../lib/oop");
+var JSMode = require("./javascript").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var SJSHighlightRules = require("./sjs_highlight_rules").SJSHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    var highlighter = new SJSHighlightRules();
+
+    this.$tokenizer = new Tokenizer(highlighter.getRules());
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new CstyleBehaviour();
+    this.$keywordList = highlighter.$keywordList;
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, JSMode);
+(function() {
+    // disable jshint
+    this.createWorker = function(session) {
+        return null;
+    }
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/sjs_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/sjs_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/sjs_highlight_rules.js
new file mode 100644
index 0000000..29ddda3
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/sjs_highlight_rules.js
@@ -0,0 +1,233 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var SJSHighlightRules = function() {
+    var parent = new JavaScriptHighlightRules();
+    var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
+        "u[0-9a-fA-F]{4}|" + // unicode
+        "[0-2][0-7]{0,2}|" + // oct
+        "3[0-6][0-7]?|" + // oct
+        "37[0-7]?|" + // oct
+        "[4-7][0-7]?|" + //oct
+        ".)";
+
+    var contextAware = function(f) {
+        f.isContextAware = true;
+        return f;
+    };
+
+    var ctxBegin = function(opts) {
+        return {
+            token: opts.token,
+            regex: opts.regex,
+            next: contextAware(function(currentState, stack) {
+                if (stack.length === 0)
+                    stack.unshift(currentState);
+                stack.unshift(opts.next);
+                return opts.next;
+            }),
+        };
+    };
+
+    var ctxEnd = function(opts) {
+        return {
+            token: opts.token,
+            regex: opts.regex,
+            next: contextAware(function(currentState, stack) {
+                stack.shift();
+                return stack[0] || "start";
+            }),
+        };
+    };
+
+    this.$rules = parent.$rules;
+    this.$rules.no_regex = [
+        {
+            token: "keyword",
+            regex: "(waitfor|or|and|collapse|spawn|retract)\\b"
+        },
+        {
+            token: "keyword.operator",
+            regex: "(->|=>|\\.\\.)"
+        },
+        {
+            token: "variable.language",
+            regex: "(hold|default)\\b"
+        },
+        ctxBegin({
+            token: "string",
+            regex: "`",
+            next: "bstring"
+        }),
+        ctxBegin({
+            token: "string",
+            regex: '"',
+            next: "qqstring"
+        }),
+        ctxBegin({
+            token: "string",
+            regex: '"',
+            next: "qqstring"
+        }),
+        {
+            token: ["paren.lparen", "text", "paren.rparen"],
+            regex: "(\\{)(\\s*)(\\|)",
+            next: "block_arguments",
+        }
+
+    ].concat(this.$rules.no_regex);
+
+    this.$rules.block_arguments = [
+        {
+            token: "paren.rparen",
+            regex: "\\|",
+            next: "no_regex",
+        }
+    ].concat(this.$rules.function_arguments);
+
+    this.$rules.bstring = [
+        {
+            token : "constant.language.escape",
+            regex : escapedRe
+        },
+        {
+            token : "string",
+            regex : "\\\\$",
+            next: "bstring"
+        },
+        ctxBegin({
+            token : "paren.lparen",
+            regex : "\\$\\{",
+            next: "string_interp"
+        }),
+        ctxBegin({
+            token : "paren.lparen",
+            regex : "\\$",
+            next: "bstring_interp_single"
+        }),
+        ctxEnd({
+            token : "string",
+            regex : "`",
+        }),
+        {
+            defaultToken: "string"
+        }
+    ];
+    
+    this.$rules.qqstring = [
+        {
+            token : "constant.language.escape",
+            regex : escapedRe
+        },
+        {
+            token : "string",
+            regex : "\\\\$",
+            next: "qqstring",
+        },
+        ctxBegin({
+            token : "paren.lparen",
+            regex : "#\\{",
+            next: "string_interp"
+        }),
+        ctxEnd({
+            token : "string",
+            regex : '"',
+        }),
+        {
+            defaultToken: "string"
+        }
+    ];
+
+    // collect all context-aware (or stateless), brace-less
+    // states. This gives us most normal highlighting
+    // for use within interpreted contexts
+    // without interfering with context nesting
+    var embeddableRules = [];
+    for (var i=0; i<this.$rules.no_regex.length; i++) {
+        var rule = this.$rules.no_regex[i];
+        var token = String(rule.token);
+        if(token.indexOf('paren') == -1 && (!rule.next || rule.next.isContextAware)) {
+            embeddableRules.push(rule);
+        }
+    };
+
+    this.$rules.string_interp = [
+        ctxEnd({
+            token: "paren.rparen",
+            regex: "\\}"
+        }),
+        ctxBegin({
+            token: "paren.lparen",
+            regex: '{',
+            next: "string_interp"
+        }),
+    ].concat(embeddableRules);
+
+    // backtick strings can have single interpolation, which accept
+    // \w+ followed by an optional set of function call parens
+    this.$rules.bstring_interp_single = [
+        {
+            token: ["identifier", "paren.lparen"],
+            regex: '(\\w+)(\\()',
+            next: 'bstring_interp_single_call'
+        },
+        // identifier-only match ends this interp
+        ctxEnd({
+            token : "identifier",
+            regex : "\\w*",
+        })
+    ];
+    
+    // the call part of a bstring_interp_single
+    // is terminated by a close paren `)`, but
+    // can have nested parens.
+    this.$rules.bstring_interp_single_call = [
+        ctxBegin({
+            token: "paren.lparen",
+            regex: "\\(",
+            next: "bstring_interp_single_call"
+        }),
+        ctxEnd({
+            token: "paren.rparen",
+            regex: "\\)"
+        })
+    ].concat(embeddableRules);
+}
+oop.inherits(SJSHighlightRules, TextHighlightRules);
+
+exports.SJSHighlightRules = SJSHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/snippets.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/snippets.js b/src/fauxton/assets/js/libs/ace/mode/snippets.js
new file mode 100644
index 0000000..865e0b3
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/snippets.js
@@ -0,0 +1,112 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var SnippetHighlightRules = function() {
+
+    var builtins = "SELECTION|CURRENT_WORD|SELECTED_TEXT|CURRENT_LINE|LINE_INDEX|" +
+        "LINE_NUMBER|SOFT_TABS|TAB_SIZE|FILENAME|FILEPATH|FULLNAME";
+
+    this.$rules = {
+        "start" : [
+            {token:"constant.language.escape", regex: /\\[\$}`\\]/},
+            {token:"keyword", regex: "\\$(?:TM_)?(?:" + builtins + ")\\b"},
+            {token:"variable", regex: "\\$\\w+"},
+            {onMatch: function(value, state, stack) {
+                if (stack[1])
+                    stack[1]++;
+                else
+                    stack.unshift(state, 1);
+                return this.tokenName;
+            }, tokenName: "markup.list", regex: "\\${", next: "varDecl"},
+            {onMatch: function(value, state, stack) {
+                if (!stack[1])
+                    return "text";
+                stack[1]--;
+                if (!stack[1])
+                    stack.splice(0,2);
+                return this.tokenName;
+            }, tokenName: "markup.list", regex: "}"},
+            {token: "doc.comment", regex:/^\${2}-{5,}$/}
+        ],
+        "varDecl" : [
+            {regex: /\d+\b/, token: "constant.numeric"},
+            {token:"keyword", regex: "(?:TM_)?(?:" + builtins + ")\\b"},
+            {token:"variable", regex: "\\w+"},
+            {regex: /:/, token: "punctuation.operator", next: "start"},
+            {regex: /\//, token: "string.regex", next: "regexp"},
+            {regex: "", next: "start"}
+        ],
+        "regexp" : [
+            {regex: /\\./, token: "escape"},
+            {regex: /\[/, token: "regex.start", next: "charClass"},
+            {regex: "/", token: "string.regex", next: "format"},
+            //{"default": "string.regex"},
+            {"token": "string.regex", regex:"."}
+        ],
+        charClass : [
+            {regex: "\\.", token: "escape"},
+            {regex: "\\]", token: "regex.end", next: "regexp"},
+            {"token": "string.regex", regex:"."}
+        ],
+        "format" : [
+            {regex: /\\[ulULE]/, token: "keyword"},
+            {regex: /\$\d+/, token: "variable"},
+            {regex: "/[gim]*:?", token: "string.regex", next: "start"},
+            // {"default": "string"},
+            {"token": "string", regex:"."}
+        ]
+    };
+};
+oop.inherits(SnippetHighlightRules, TextHighlightRules);
+
+exports.SnippetHighlightRules = SnippetHighlightRules;
+
+var SnippetGroupHighlightRules = function() {
+    this.$rules = {
+        "start" : [
+			{token: "text", regex: "^\\t", next: "sn-start"},
+			{token:"invalid", regex: /^ \s*/},
+            {token:"comment", regex: /^#.*/},
+            {token:"constant.language.escape", regex: "^regex ", next: "regex"},
+            {token:"constant.language.escape", regex: "^(trigger|endTrigger|name|snippet|guard|endGuard|tabTrigger|key)\\b"}
+        ],
+		"regex" : [
+			{token:"text", regex: "\\."},
+			{token:"keyword", regex: "/"},
+			{token:"empty", regex: "$", next: "start"}
+		]
+    };
+	this.embedRules(SnippetHighlightRules, "sn-", [
+		{token: "text", regex: "^\\t", next: "sn-start"},
+		{onMatch: function(value, state, stack) {
+			stack.splice(stack.length);
+			return this.tokenName;
+		}, tokenName: "text", regex: "^(?!\t)", next: "start"}
+	])
+	
+};
+
+oop.inherits(SnippetGroupHighlightRules, TextHighlightRules);
+
+exports.SnippetGroupHighlightRules = SnippetGroupHighlightRules;
+
+var FoldMode = require("./folding/coffee").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = SnippetGroupHighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.$indentWithTabs = true;
+}).call(Mode.prototype);
+exports.Mode = Mode;
+
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/soy_template.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/soy_template.js b/src/fauxton/assets/js/libs/ace/mode/soy_template.js
new file mode 100644
index 0000000..493c49c
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/soy_template.js
@@ -0,0 +1,60 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ *
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var HtmlMode = require("./html").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var SoyTemplateHighlightRules = require("./soy_template_highlight_rules").SoyTemplateHighlightRules;
+
+var Mode = function() {
+    HtmlMode.call(this);
+    this.HighlightRules = SoyTemplateHighlightRules;
+};
+oop.inherits(Mode, HtmlMode);
+
+(function() {
+    this.lineCommentStart = "//";
+    this.blockComment = {start: "/*", end: "*/"};
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/soy_template_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/soy_template_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/soy_template_highlight_rules.js
new file mode 100644
index 0000000..50e3ae4
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/soy_template_highlight_rules.js
@@ -0,0 +1,356 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* This file was autogenerated from tm bundles\SoyTemplate\Syntaxes\SoyTemplate.tmLanguage (uuid: ) */
+/****************************************************************************************
+ * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
+ * fileTypes                                                                            *
+ ****************************************************************************************/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+
+var SoyTemplateHighlightRules = function() {
+    HtmlHighlightRules.call(this);
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    var soyRules = { start: 
+       [ { include: '#template' },
+         { include: '#if' },
+         { include: '#comment-line' },
+         { include: '#comment-block' },
+         { include: '#comment-doc' },
+         { include: '#call' },
+         { include: '#css' },
+         { include: '#param' },
+         { include: '#print' },
+         { include: '#msg' },
+         { include: '#for' },
+         { include: '#foreach' },
+         { include: '#switch' },
+         { include: '#tag' },
+         { include: 'text.html.basic' } ],
+      '#call': 
+       [ { token: 
+            [ 'punctuation.definition.tag.begin.soy',
+              'meta.tag.call.soy' ],
+           regex: '(\\{/?)(\\s*)(?=call|delcall)',
+           push: 
+            [ { token: 'punctuation.definition.tag.end.soy',
+                regex: '\\}',
+                next: 'pop' },
+              { include: '#string-quoted-single' },
+              { include: '#string-quoted-double' },
+              { token: ['entity.name.tag.soy', 'variable.parameter.soy'],
+                regex: '(call|delcall)(\\s+[\\.\\w]+)'},
+              { token: 
+                 [ 'entity.other.attribute-name.soy',
+                   'text',
+                   'keyword.operator.soy' ],
+                regex: '\\b(data)(\\s*)(=)' },
+              { defaultToken: 'meta.tag.call.soy' } ] } ],
+      '#comment-line': 
+       [ { token: 
+            [ 'comment.line.double-slash.soy',
+              'punctuation.definition.comment.soy',
+              'comment.line.double-slash.soy' ],
+           regex: '(\\s+)(//)(.*$)' } ],
+      '#comment-block': 
+       [ { token: 'punctuation.definition.comment.begin.soy',
+           regex: '/\\*(?!\\*)',
+           push: 
+            [ { token: 'punctuation.definition.comment.end.soy',
+                regex: '\\*/',
+                next: 'pop' },
+              { defaultToken: 'comment.block.soy' } ] } ],
+      '#comment-doc': 
+       [ { token: 'punctuation.definition.comment.begin.soy',
+           regex: '/\\*\\*(?!/)',
+           push: 
+            [ { token: 'punctuation.definition.comment.end.soy',
+                regex: '\\*/',
+                next: 'pop' },
+              { token: [ 'support.type.soy', 'text', 'variable.parameter.soy' ],
+                regex: '(@param|@param\\?)(\\s+)(\\w+)' },
+              { defaultToken: 'comment.block.documentation.soy' } ] } ],
+      '#css': 
+       [ { token: 
+            [ 'punctuation.definition.tag.begin.soy',
+              'meta.tag.css.soy',
+              'entity.name.tag.soy' ],
+           regex: '(\\{/?)(\\s*)(css)\\b',
+           push: 
+            [ { token: 'punctuation.definition.tag.end.soy',
+                regex: '\\}',
+                next: 'pop' },
+              { token: 'support.constant.soy',
+                regex: '\\b(?:LITERAL|REFERENCE|BACKEND_SPECIFIC|GOOG)\\b' },
+              { defaultToken: 'meta.tag.css.soy' } ] } ],
+      '#for': 
+       [ { token: 
+            [ 'punctuation.definition.tag.begin.soy',
+              'meta.tag.for.soy',
+              'entity.name.tag.soy' ],
+           regex: '(\\{/?)(\\s*)(for)\\b',
+           push: 
+            [ { token: 'punctuation.definition.tag.end.soy',
+                regex: '\\}',
+                next: 'pop' },
+              { token: 'keyword.operator.soy', regex: '\\bin\\b' },
+              { token: 'support.function.soy', regex: '\\brange\\b' },
+              { include: '#variable' },
+              { include: '#number' },
+              { include: '#primitive' },
+              { defaultToken: 'meta.tag.for.soy' } ] } ],
+      '#foreach': 
+       [ { token: 
+            [ 'punctuation.definition.tag.begin.soy',
+              'meta.tag.foreach.soy',
+              'entity.name.tag.soy' ],
+           regex: '(\\{/?)(\\s*)(foreach)\\b',
+           push: 
+            [ { token: 'punctuation.definition.tag.end.soy',
+                regex: '\\}',
+                next: 'pop' },
+              { token: 'keyword.operator.soy', regex: '\\bin\\b' },
+              { include: '#variable' },
+              { defaultToken: 'meta.tag.foreach.soy' } ] } ],
+      '#function': 
+       [ { token: 'support.function.soy',
+           regex: '\\b(?:isFirst|isLast|index|hasData|length|keys|round|floor|ceiling|min|max|randomInt)\\b' } ],
+      '#if': 
+       [ { token: 
+            [ 'punctuation.definition.tag.begin.soy',
+              'meta.tag.if.soy',
+              'entity.name.tag.soy' ],
+           regex: '(\\{/?)(\\s*)(if|elseif)\\b',
+           push: 
+            [ { token: 'punctuation.definition.tag.end.soy',
+                regex: '\\}',
+                next: 'pop' },
+              { include: '#variable' },
+              { include: '#operator' },
+              { include: '#function' },
+              { include: '#string-quoted-single' },
+              { include: '#string-quoted-double' },
+              { defaultToken: 'meta.tag.if.soy' } ] } ],
+      '#namespace': 
+       [ { token: [ 'entity.name.tag.soy', 'text', 'variable.parameter.soy' ],
+           regex: '(namespace|delpackage)(\\s+)([\\w\\.]+)' } ],
+      '#number': [ { token: 'constant.numeric', regex: '[\\d]+' } ],
+      '#operator': 
+       [ { token: 'keyword.operator.soy',
+           regex: '==|!=|\\band\\b|\\bor\\b|\\bnot\\b|-|\\+|/|\\?:' } ],
+      '#param': 
+       [ { token: 
+            [ 'punctuation.definition.tag.begin.soy',
+              'meta.tag.param.soy',
+              'entity.name.tag.soy' ],
+           regex: '(\\{/?)(\\s*)(param)',
+           push: 
+            [ { token: 'punctuation.definition.tag.end.soy',
+                regex: '\\}',
+                next: 'pop' },
+              { include: '#variable' },
+              { token: 
+                 [ 'entity.other.attribute-name.soy',
+                   'text',
+                   'keyword.operator.soy' ],
+                regex: '\\b([\\w]*)(\\s*)((?::)?)' },
+              { defaultToken: 'meta.tag.param.soy' } ] } ],
+      '#primitive': 
+       [ { token: 'constant.language.soy',
+           regex: '\\b(?:null|false|true)\\b' } ],
+      '#msg': 
+       [ { token: 
+            [ 'punctuation.definition.tag.begin.soy',
+              'meta.tag.msg.soy',
+              'entity.name.tag.soy' ],
+           regex: '(\\{/?)(\\s*)(msg)\\b',
+           push: 
+            [ { token: 'punctuation.definition.tag.end.soy',
+                regex: '\\}',
+                next: 'pop' },
+              { include: '#string-quoted-single' },
+              { include: '#string-quoted-double' },
+              { token: 
+                 [ 'entity.other.attribute-name.soy',
+                   'text',
+                   'keyword.operator.soy' ],
+                regex: '\\b(meaning|desc)(\\s*)(=)' },
+              { defaultToken: 'meta.tag.msg.soy' } ] } ],
+      '#print': 
+       [ { token: 
+            [ 'punctuation.definition.tag.begin.soy',
+              'meta.tag.print.soy',
+              'entity.name.tag.soy' ],
+           regex: '(\\{/?)(\\s*)(print)\\b',
+           push: 
+            [ { token: 'punctuation.definition.tag.end.soy',
+                regex: '\\}',
+                next: 'pop' },
+              { include: '#variable' },
+              { include: '#print-parameter' },
+              { include: '#number' },
+              { include: '#primitive' },
+              { include: '#attribute-lookup' },
+              { defaultToken: 'meta.tag.print.soy' } ] } ],
+      '#print-parameter': 
+       [ { token: 'keyword.operator.soy', regex: '\\|' },
+         { token: 'variable.parameter.soy',
+           regex: 'noAutoescape|id|escapeHtml|escapeJs|insertWorkBreaks|truncate' } ],
+      '#special-character': 
+       [ { token: 'support.constant.soy',
+           regex: '\\bsp\\b|\\bnil\\b|\\\\r|\\\\n|\\\\t|\\blb\\b|\\brb\\b' } ],
+      '#string-quoted-double': [ { token: 'string.quoted.double', regex: '"[^"]*"' } ],
+      '#string-quoted-single': [ { token: 'string.quoted.single', regex: '\'[^\']*\'' } ],
+      '#switch': 
+       [ { token: 
+            [ 'punctuation.definition.tag.begin.soy',
+              'meta.tag.switch.soy',
+              'entity.name.tag.soy' ],
+           regex: '(\\{/?)(\\s*)(switch|case)\\b',
+           push: 
+            [ { token: 'punctuation.definition.tag.end.soy',
+                regex: '\\}',
+                next: 'pop' },
+              { include: '#variable' },
+              { include: '#function' },
+              { include: '#number' },
+              { include: '#string-quoted-single' },
+              { include: '#string-quoted-double' },
+              { defaultToken: 'meta.tag.switch.soy' } ] } ],
+      '#attribute-lookup': 
+       [ { token: 'punctuation.definition.attribute-lookup.begin.soy',
+           regex: '\\[',
+           push: 
+            [ { token: 'punctuation.definition.attribute-lookup.end.soy',
+                regex: '\\]',
+                next: 'pop' },
+              { include: '#variable' },
+              { include: '#function' },
+              { include: '#operator' },
+              { include: '#number' },
+              { include: '#primitive' },
+              { include: '#string-quoted-single' },
+              { include: '#string-quoted-double' } ] } ],
+      '#tag': 
+       [ { token: 'punctuation.definition.tag.begin.soy',
+           regex: '\\{',
+           push: 
+            [ { token: 'punctuation.definition.tag.end.soy',
+                regex: '\\}',
+                next: 'pop' },
+              { include: '#namespace' },
+              { include: '#variable' },
+              { include: '#special-character' },
+              { include: '#tag-simple' },
+              { include: '#function' },
+              { include: '#operator' },
+              { include: '#attribute-lookup' },
+              { include: '#number' },
+              { include: '#primitive' },
+              { include: '#print-parameter' } ] } ],
+      '#tag-simple': 
+       [ { token: 'entity.name.tag.soy',
+           regex: '{{\\s*(?:literal|else|ifempty|default)\\s*(?=\\})'} ],
+      '#template': 
+       [ { token: 
+            [ 'punctuation.definition.tag.begin.soy',
+              'meta.tag.template.soy' ],
+           regex: '(\\{/?)(\\s*)(?=template|deltemplate)',
+           push: 
+            [ { token: 'punctuation.definition.tag.end.soy',
+                regex: '\\}',
+                next: 'pop' },
+              { token: ['entity.name.tag.soy', 'text', 'entity.name.function.soy' ],
+                regex: '(template|deltemplate)(\\s+)([\\.\\w]+)',
+                originalRegex: '(?<=template|deltemplate)\\s+([\\.\\w]+)' },
+              { token: 
+                 [ 'entity.other.attribute-name.soy',
+                   'text',
+                   'keyword.operator.soy',
+                   'text',
+                   'string.quoted.double.soy' ],
+                regex: '\\b(private)(\\s*)(=)(\\s*)("true"|"false")' },
+              { token: 
+                 [ 'entity.other.attribute-name.soy',
+                   'text',
+                   'keyword.operator.soy',
+                   'text',
+                   'string.quoted.single.soy' ],
+                regex: '\\b(private)(\\s*)(=)(\\s*)(\'true\'|\'false\')' },
+              { token: 
+                 [ 'entity.other.attribute-name.soy',
+                   'text',
+                   'keyword.operator.soy',
+                   'text',
+                   'string.quoted.double.soy' ],
+                regex: '\\b(autoescape)(\\s*)(=)(\\s*)("true"|"false"|"contextual")' },
+              { token: 
+                 [ 'entity.other.attribute-name.soy',
+                   'text',
+                   'keyword.operator.soy',
+                   'text',
+                   'string.quoted.single.soy' ],
+                regex: '\\b(autoescape)(\\s*)(=)(\\s*)(\'true\'|\'false\'|\'contextual\')' },
+              { defaultToken: 'meta.tag.template.soy' } ] } ],
+      '#variable': [ { token: 'variable.other.soy', regex: '\\$[\\w\\.]+' } ] }
+    
+    
+    for (var i in soyRules) {
+        if (this.$rules[i]) {
+            this.$rules[i].unshift.call(this.$rules[i], soyRules[i]);
+        } else {
+            this.$rules[i] = soyRules[i];
+        }
+    }
+    
+    this.normalizeRules();
+};
+
+SoyTemplateHighlightRules.metaData = { comment: 'SoyTemplate',
+      fileTypes: [ 'soy' ],
+      firstLineMatch: '\\{\\s*namespace\\b',
+      foldingStartMarker: '\\{\\s*template\\s+[^\\}]*\\}',
+      foldingStopMarker: '\\{\\s*/\\s*template\\s*\\}',
+      name: 'SoyTemplate',
+      scopeName: 'source.soy' }
+
+
+oop.inherits(SoyTemplateHighlightRules, HtmlHighlightRules);
+
+exports.SoyTemplateHighlightRules = SoyTemplateHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/space.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/space.js b/src/fauxton/assets/js/libs/ace/mode/space.js
new file mode 100644
index 0000000..3210298
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/space.js
@@ -0,0 +1,21 @@
+define(function(require, exports, module) {
+"use strict";
+var oop = require("../lib/oop");
+// defines the parent mode
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var FoldMode = require("./folding/coffee").FoldMode;
+// defines the language specific highlighters and folding rules
+var SpaceHighlightRules = require("./space_highlight_rules").SpaceHighlightRules;
+var Mode = function() {
+    // set everything up
+    var highlighter = new SpaceHighlightRules();
+    this.$tokenizer = new Tokenizer(highlighter.getRules());
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+(function() {
+    
+}).call(Mode.prototype);
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/space_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/space_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/space_highlight_rules.js
new file mode 100644
index 0000000..4a347b1
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/space_highlight_rules.js
@@ -0,0 +1,56 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var SpaceHighlightRules = function() {
+
+    // Todo: support multiline values that escape the newline with spaces.
+    this.$rules = {
+        "start" : [
+            {
+                token : "empty_line",
+                regex : / */,
+                next : "key"
+            },
+            {
+                token : "empty_line",
+                regex : /$/,
+                next : "key"
+            }
+        ],
+        "key" : [
+            {
+                token : "variable",
+                regex : /\S+/
+            },
+            {
+                token : "empty_line",
+                regex : /$/,
+                next : "start"
+            },{
+                token : "keyword.operator",
+                regex : / /,
+                next  : "value"
+            }
+        ],
+        "value" : [
+            {
+                token : "keyword.operator",
+                regex : /$/,
+                next  : "start"
+            },
+            {
+                token : "string",
+                regex : /[^$]/
+            }
+        ]
+    };
+    
+};
+
+oop.inherits(SpaceHighlightRules, TextHighlightRules);
+
+exports.SpaceHighlightRules = SpaceHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/sql.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/sql.js b/src/fauxton/assets/js/libs/ace/mode/sql.js
new file mode 100644
index 0000000..d10a472
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/sql.js
@@ -0,0 +1,53 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var SqlHighlightRules = require("./sql_highlight_rules").SqlHighlightRules;
+var Range = require("../range").Range;
+
+var Mode = function() {
+    this.HighlightRules = SqlHighlightRules;
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = "--";
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/sql_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/sql_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/sql_highlight_rules.js
new file mode 100644
index 0000000..e16ac9a
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/sql_highlight_rules.js
@@ -0,0 +1,94 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var SqlHighlightRules = function() {
+
+    var keywords = (
+        "select|insert|update|delete|from|where|and|or|group|by|order|limit|offset|having|as|case|" +
+        "when|else|end|type|left|right|join|on|outer|desc|asc"
+    );
+
+    var builtinConstants = (
+        "true|false|null"
+    );
+
+    var builtinFunctions = (
+        "count|min|max|avg|sum|rank|now|coalesce"
+    );
+
+    var keywordMapper = this.createKeywordMapper({
+        "support.function": builtinFunctions,
+        "keyword": keywords,
+        "constant.language": builtinConstants
+    }, "identifier", true);
+
+    this.$rules = {
+        "start" : [ {
+            token : "comment",
+            regex : "--.*$"
+        }, {
+            token : "string",           // " string
+            regex : '".*?"'
+        }, {
+            token : "string",           // ' string
+            regex : "'.*?'"
+        }, {
+            token : "constant.numeric", // float
+            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+        }, {
+            token : keywordMapper,
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        }, {
+            token : "keyword.operator",
+            regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
+        }, {
+            token : "paren.lparen",
+            regex : "[\\(]"
+        }, {
+            token : "paren.rparen",
+            regex : "[\\)]"
+        }, {
+            token : "text",
+            regex : "\\s+"
+        } ]
+    };
+};
+
+oop.inherits(SqlHighlightRules, TextHighlightRules);
+
+exports.SqlHighlightRules = SqlHighlightRules;
+});
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/stylus.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/stylus.js b/src/fauxton/assets/js/libs/ace/mode/stylus.js
new file mode 100644
index 0000000..e33220b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/stylus.js
@@ -0,0 +1,59 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ * 
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var StylusHighlightRules = require("./stylus_highlight_rules").StylusHighlightRules;
+var FoldMode = require("./folding/coffee").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = StylusHighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() { 
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/stylus_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/stylus_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/stylus_highlight_rules.js
new file mode 100644
index 0000000..c9fb624
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/stylus_highlight_rules.js
@@ -0,0 +1,165 @@
+/*
+  THIS FILE WAS AUTOGENERATED BY Stylus.tmlanguage (UUID: 60519324-6A3A-4382-9E0B-546993A3869A) */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var CssHighlightRules = require("./css_highlight_rules");
+
+var StylusHighlightRules = function() {
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    var keywordMapper = this.createKeywordMapper({
+        "support.type": CssHighlightRules.supportType,
+        "support.function": CssHighlightRules.supportFunction,
+        "support.constant": CssHighlightRules.supportConstant,
+        "support.constant.color": CssHighlightRules.supportConstantColor,
+        "support.constant.fonts": CssHighlightRules.supportConstantFonts
+    }, "text", true);
+
+    this.$rules = {
+    start: [
+        {
+            token : "comment",
+            regex : /\/\/.*$/
+        },
+        {
+            token : "comment", // multi line comment
+            regex : /\/\*/,
+            next : "comment"
+        },
+        {
+            token: ["entity.name.function.stylus", "text"],
+            regex: "^([-a-zA-Z_][-\\w]*)?(\\()"
+        },
+        {
+            token: ["entity.other.attribute-name.class.stylus"],
+            regex: "\\.-?[_a-zA-Z]+[_a-zA-Z0-9-]*"
+        },
+        {
+            token: ["entity.language.stylus"],
+            regex: "^ *&"
+        },
+        {
+            token: ["variable.language.stylus"],
+            regex: "(arguments)"
+        },
+        {
+            token: ["keyword.stylus"],
+            regex: "@[-\\w]+"
+        },
+        {
+            token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
+            regex : CssHighlightRules.pseudoElements
+        }, {
+            token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
+            regex : CssHighlightRules.pseudoClasses
+        }, 
+        {
+            token: ["entity.name.tag.stylus"],
+            regex: "(?:\\b)(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|datalist|dd|del|details|dfn|dialog|div|dl|dt|em|eventsource|fieldset|figure|figcaption|footer|form|frame|frameset|(?:h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|label|legend|li|link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|samp|script|section|select|small|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)(?:\\b)"
+        },
+        {
+            token : "constant.numeric",  // hex6 color
+            regex : "#[a-f0-9]{6}"
+        }, 
+        {
+            token : "constant.numeric", // hex3 color
+            regex : "#[a-f0-9]{3}"
+        }, 
+        {
+            token: ["punctuation.definition.entity.stylus", "entity.other.attribute-name.id.stylus"],
+            regex: "(#)([a-zA-Z][a-zA-Z0-9_-]*)"
+        },
+        {
+            token: "meta.vendor-prefix.stylus",
+            regex: "-webkit-|-moz\\-|-ms-|-o-"
+        },
+        {
+            token: "keyword.control.stylus",
+            regex: "(?:!important|for|in|return|true|false|null|if|else|unless|return)\\b"
+        },
+        {
+            token: "keyword.operator.stylus",
+            regex: "!|~|\\+|-|(?:\\*)?\\*|\\/|%|(?:\\.)\\.\\.|<|>|(?:=|:|\\?|\\+|-|\\*|\\/|%|<|>)?=|!="
+        },
+        {
+            token: "keyword.operator.stylus",
+            regex: "(?:in|is(?:nt)?|not)\\b"
+        },
+        {
+            token : "string",
+            regex : "'(?=.)",
+            next  : "qstring"
+        }, {
+            token : "string",
+            regex : '"(?=.)',
+            next  : "qqstring"
+        }, 
+        {
+            token : "constant.numeric",
+            regex : CssHighlightRules.numRe
+        }, 
+        {
+            token : "keyword",
+            regex : "(?:ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\\b"
+        }, 
+        {
+            token : keywordMapper,
+            regex : "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
+        }
+    ],
+    "comment" : [
+        {
+            token : "comment", // closing comment
+            regex : ".*?\\*\\/",
+            next : "start"
+        }, {
+            token : "comment", // comment spanning whole line
+            regex : ".+"
+        }
+    ],
+    "qqstring" : [
+        {
+            token : "string",
+            regex : '[^"\\\\]+'
+        }, 
+        {
+            token : "string",
+            regex : "\\\\$",
+            next  : "qqstring"
+        }, 
+        {
+            token : "string",
+            regex : '"|$',
+            next  : "start"
+        }
+    ],
+    "qstring" : [
+        {
+            token : "string",
+            regex : "[^'\\\\]+"
+        }, 
+        {
+            token : "string",
+            regex : "\\\\$",
+            next  : "qstring"
+        }, 
+        {
+            token : "string",
+            regex : "'|$",
+            next  : "start"
+        }
+    ]
+}
+
+};
+
+oop.inherits(StylusHighlightRules, TextHighlightRules);
+
+exports.StylusHighlightRules = StylusHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/svg.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/svg.js b/src/fauxton/assets/js/libs/ace/mode/svg.js
new file mode 100644
index 0000000..0ca57e1
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/svg.js
@@ -0,0 +1,69 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var XmlMode = require("./xml").Mode;
+var JavaScriptMode = require("./javascript").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var SvgHighlightRules = require("./svg_highlight_rules").SvgHighlightRules;
+var MixedFoldMode = require("./folding/mixed").FoldMode;
+var XmlFoldMode = require("./folding/xml").FoldMode;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    XmlMode.call(this);
+    
+    this.HighlightRules = SvgHighlightRules;
+    
+    this.createModeDelegates({
+        "js-": JavaScriptMode
+    });
+    
+    this.foldingRules = new MixedFoldMode(new XmlFoldMode({}), {
+        "js-": new CStyleFoldMode()
+    });
+};
+
+oop.inherits(Mode, XmlMode);
+
+(function() {
+
+    this.getNextLineIndent = function(state, line, tab) {
+        return this.$getIndent(line);
+    };
+    
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/svg_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/svg_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/svg_highlight_rules.js
new file mode 100644
index 0000000..25722d7
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/svg_highlight_rules.js
@@ -0,0 +1,49 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
+var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
+
+var SvgHighlightRules = function() {
+    XmlHighlightRules.call(this);
+
+    this.embedTagRules(JavaScriptHighlightRules, "js-", "script");
+
+    this.normalizeRules();
+};
+
+oop.inherits(SvgHighlightRules, XmlHighlightRules);
+
+exports.SvgHighlightRules = SvgHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/tcl.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/tcl.js b/src/fauxton/assets/js/libs/ace/mode/tcl.js
new file mode 100644
index 0000000..c8e7c43
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/tcl.js
@@ -0,0 +1,84 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+var TclHighlightRules = require("./tcl_highlight_rules").TclHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var Range = require("../range").Range;
+
+var Mode = function() {
+    this.HighlightRules = TclHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = "#";
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+        
+        if (state == "start") {
+            var match = line.match(/^.*[\{\(\[]\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/tcl_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/tcl_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/tcl_highlight_rules.js
new file mode 100644
index 0000000..55b0ad6
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/tcl_highlight_rules.js
@@ -0,0 +1,172 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var TclHighlightRules = function() {
+
+    //TODO var builtinFunctions = "";
+
+    this.$rules = {
+        "start" : [
+           {
+                token : "comment",
+                regex : "#.*\\\\$",
+                next  : "commentfollow"
+            }, {
+                token : "comment",
+                regex : "#.*$"
+            }, {
+                token : "support.function",
+                regex : '[\\\\]$',
+                next  : "splitlineStart"
+            }, {
+                token : "text",
+                regex : '[\\\\](?:["]|[{]|[}]|[[]|[]]|[$]|[\])'
+            }, {
+                token : "text", // last value before command
+                regex : '^|[^{][;][^}]|[/\r/]',
+                next  : "commandItem"
+            }, {
+                token : "string", // single line
+                regex : '[ ]*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+            }, {
+                token : "string", // multi line """ string start
+                regex : '[ ]*["]',
+                next  : "qqstring"
+            }, {
+                token : "variable.instance",
+                regex : "[$]",
+                next  : "variable"
+            }, {
+                token : "support.function",
+                regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|{\\*}|;|::"
+            }, {
+                token : "identifier",
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+            }, {
+                token : "paren.lparen",
+                regex : "[[{]",
+                next  : "commandItem"
+            }, {
+                token : "paren.lparen",
+                regex : "[(]"
+            },  {
+                token : "paren.rparen",
+                regex : "[\\])}]"
+            }, {
+                token : "text",
+                regex : "\\s+"
+            }
+        ],
+        "commandItem" : [
+            {
+                token : "comment",
+                regex : "#.*\\\\$",
+                next  : "commentfollow"
+            }, {
+                token : "comment",
+                regex : "#.*$",
+                next  : "start"
+            }, {
+                token : "string", // single line
+                regex : '[ ]*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+            }, {
+                token : "variable.instance", 
+                regex : "[$]",
+                next  : "variable"
+            }, {
+                token : "support.function",
+                regex : "(?:[:][:])[a-zA-Z0-9_/]+(?:[:][:])",
+                next  : "commandItem"
+            }, {
+                token : "support.function",
+                regex : "[a-zA-Z0-9_/]+(?:[:][:])",
+                next  : "commandItem"
+            }, {
+                token : "support.function",
+                regex : "(?:[:][:])",
+                next  : "commandItem"
+            }, {
+                token : "paren.rparen",
+                regex : "[\\])}]"
+            }, {
+                token : "support.function",
+                regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|{\\*}|;|::"
+            }, {
+                token : "keyword",
+                regex : "[a-zA-Z0-9_/]+",
+                next  : "start"
+            } ],
+        "commentfollow" : [ 
+            {
+                token : "comment",
+                regex : ".*\\\\$",
+                next  : "commentfollow"
+            }, {
+                token : "comment",
+                regex : '.+',
+                next  : "start"
+        } ],
+        "splitlineStart" : [ 
+            {
+                token : "text",
+                regex : "^.",
+                next  : "start"
+            }],
+        "variable" : [ 
+            {
+                token : "variable.instance", // variable tcl
+                regex : "[a-zA-Z_\\d]+(?:[(][a-zA-Z_\\d]+[)])?",
+                next  : "start"
+            }, {
+                token : "variable.instance", // variable tcl with braces
+                regex : "{?[a-zA-Z_\\d]+}?",
+                next  : "start"
+            }],  
+        "qqstring" : [ {
+            token : "string", // multi line """ string end
+            regex : '(?:[^\\\\]|\\\\.)*?["]',
+            next : "start"
+        }, {
+            token : "string",
+            regex : '.+'
+        } ]
+    };
+};
+
+oop.inherits(TclHighlightRules, TextHighlightRules);
+
+exports.TclHighlightRules = TclHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/tex.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/tex.js b/src/fauxton/assets/js/libs/ace/mode/tex.js
new file mode 100644
index 0000000..cf7b737
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/tex.js
@@ -0,0 +1,68 @@
+/*
+ * tex.js
+ *
+ * Copyright (C) 2009-11 by RStudio, Inc.
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ *
+ */
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var TexHighlightRules = require("./tex_highlight_rules").TexHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+
+var Mode = function(suppressHighlighting) {
+	if (suppressHighlighting)
+    	this.HighlightRules = TextHighlightRules;
+	else
+    	this.HighlightRules = TexHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+   this.getNextLineIndent = function(state, line, tab) {
+      return this.$getIndent(line);
+   };
+
+   this.allowAutoInsert = function() {
+      return false;
+   };
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/tex_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/tex_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/tex_highlight_rules.js
new file mode 100644
index 0000000..c64d031
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/tex_highlight_rules.js
@@ -0,0 +1,107 @@
+/*
+ * tex_highlight_rules.js
+ *
+ * Copyright (C) 2009-11 by RStudio, Inc.
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * This program is licensed to you under the terms of version 3 of the
+ * GNU Affero General Public License. This program is distributed WITHOUT
+ * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
+ * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
+ *
+ */
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var TexHighlightRules = function(textClass) {
+
+    if (!textClass)
+        textClass = "text";
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "start" : [
+	        {
+	            token : "comment",
+	            regex : "%.*$"
+	        }, {
+	            token : textClass, // non-command
+	            regex : "\\\\[$&%#\\{\\}]"
+	        }, {
+	            token : "keyword", // command
+	            regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b",
+               next : "nospell"
+	        }, {
+	            token : "keyword", // command
+	            regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])"
+	        }, {
+               // Obviously these are neither keywords nor operators, but
+               // labelling them as such was the easiest way to get them
+               // to be colored distinctly from regular text
+               token : "paren.keyword.operator",
+	            regex : "[[({]"
+	        }, {
+               // Obviously these are neither keywords nor operators, but
+               // labelling them as such was the easiest way to get them
+               // to be colored distinctly from regular text
+               token : "paren.keyword.operator",
+	            regex : "[\\])}]"
+	        }, {
+	            token : textClass,
+	            regex : "\\s+"
+	        }
+        ],
+        // This mode is necessary to prevent spell checking, but to keep the
+        // same syntax highlighting behavior. The list of commands comes from
+        // Texlipse.
+        "nospell" : [
+           {
+               token : "comment",
+               regex : "%.*$",
+               next : "start"
+           }, {
+               token : "nospell." + textClass, // non-command
+               regex : "\\\\[$&%#\\{\\}]"
+           }, {
+               token : "keyword", // command
+               regex : "\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\b"
+           }, {
+               token : "keyword", // command
+               regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])",
+               next : "start"
+           }, {
+               token : "paren.keyword.operator",
+               regex : "[[({]"
+           }, {
+               token : "paren.keyword.operator",
+               regex : "[\\])]"
+           }, {
+               token : "paren.keyword.operator",
+               regex : "}",
+               next : "start"
+           }, {
+               token : "nospell." + textClass,
+               regex : "\\s+"
+           }, {
+               token : "nospell." + textClass,
+               regex : "\\w+"
+           }
+        ]
+    };
+};
+
+oop.inherits(TexHighlightRules, TextHighlightRules);
+
+exports.TexHighlightRules = TexHighlightRules;
+});


[36/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_dot.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_dot.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_dot.json
new file mode 100644
index 0000000..fec8b96
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_dot.json
@@ -0,0 +1,2254 @@
+[[
+   "start",
+  ["comment","// Original source: http://www.graphviz.org/content/lion_share"]
+],[
+   "start",
+  ["comment","##\"A few people in the field of genetics are using dot to draw \"marriage node diagram\"  pedigree drawings.  Here is one I have done of a test pedigree from the FTREE pedigree drawing package (Lion Share was a racehorse).\" Contributed by David Duffy."]
+],[
+   "start"
+],[
+   "start",
+  ["comment","##Command to get the layout: \"dot -Tpng thisfile > thisfile.png\""]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","digraph"],
+  ["text"," Ped_Lion_Share           "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["comment","# page = \"8.2677165,11.692913\" ;"]
+],[
+   "start",
+  ["variable","ratio"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["string","\"auto\""],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","mincross "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","2.0"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["variable","label"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["string","\"Pedigree Lion_Share\""],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start"
+],[
+   "start",
+  ["string","\"001\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","box     "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"002\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","box     "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"003\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","circle  "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"004\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","box     "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"005\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","box     "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"006\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","circle  "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"007\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","circle  "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"009\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","circle  "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"014\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","circle  "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"015\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","circle  "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"016\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","circle  "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"ZZ01\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","circle  "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"ZZ02\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","circle  "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"017\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","circle  "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"012\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","circle  "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"008\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","box     "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"011\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","box     "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"013\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","box     "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"010\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","box     "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"023\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","circle  "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"020\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","circle  "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"021\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","circle  "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"018\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","circle  "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"025\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","circle  "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"019\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","box     "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"022\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","box     "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"024\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","box     "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"027\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","circle  "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"026\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","box     "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","white   "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"028\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","box     "],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","regular"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","fillcolor"],
+  ["keyword.operator","="],
+  ["text","grey    "],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0001\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","diamond"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","label"],
+  ["keyword.operator","="],
+  ["string","\"\""],
+  ["punctuation.operator",","],
+  ["variable","height"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","width"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"001\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0001\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"007\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0001\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0001\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"017\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","2"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0002\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","diamond"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","label"],
+  ["keyword.operator","="],
+  ["string","\"\""],
+  ["punctuation.operator",","],
+  ["variable","height"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","width"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"001\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0002\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"ZZ02\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0002\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0002\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"012\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","2"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0003\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","diamond"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","label"],
+  ["keyword.operator","="],
+  ["string","\"\""],
+  ["punctuation.operator",","],
+  ["variable","height"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","width"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"002\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0003\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"003\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0003\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0003\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"008\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","2"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0004\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","diamond"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","label"],
+  ["keyword.operator","="],
+  ["string","\"\""],
+  ["punctuation.operator",","],
+  ["variable","height"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","width"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"002\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0004\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"006\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0004\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0004\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"011\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","2"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0005\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","diamond"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","label"],
+  ["keyword.operator","="],
+  ["string","\"\""],
+  ["punctuation.operator",","],
+  ["variable","height"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","width"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"002\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0005\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"ZZ01\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0005\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0005\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"013\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","2"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0006\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","diamond"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","label"],
+  ["keyword.operator","="],
+  ["string","\"\""],
+  ["punctuation.operator",","],
+  ["variable","height"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","width"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"004\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0006\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"009\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0006\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0006\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"010\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","2"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0007\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","diamond"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","label"],
+  ["keyword.operator","="],
+  ["string","\"\""],
+  ["punctuation.operator",","],
+  ["variable","height"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","width"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"005\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0007\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"015\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0007\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0007\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"023\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","2"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0008\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","diamond"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","label"],
+  ["keyword.operator","="],
+  ["string","\"\""],
+  ["punctuation.operator",","],
+  ["variable","height"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","width"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"005\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0008\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"016\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0008\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0008\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"020\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","2"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0009\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","diamond"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","label"],
+  ["keyword.operator","="],
+  ["string","\"\""],
+  ["punctuation.operator",","],
+  ["variable","height"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","width"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"005\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0009\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"012\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0009\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0009\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"021\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","2"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0010\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","diamond"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","label"],
+  ["keyword.operator","="],
+  ["string","\"\""],
+  ["punctuation.operator",","],
+  ["variable","height"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","width"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"008\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0010\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"017\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0010\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0010\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"018\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","2"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0011\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","diamond"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","label"],
+  ["keyword.operator","="],
+  ["string","\"\""],
+  ["punctuation.operator",","],
+  ["variable","height"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","width"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"011\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0011\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"023\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0011\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0011\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"025\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","2"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0012\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","diamond"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","label"],
+  ["keyword.operator","="],
+  ["string","\"\""],
+  ["punctuation.operator",","],
+  ["variable","height"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","width"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"013\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0012\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"014\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0012\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0012\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"019\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","2"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0013\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","diamond"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","label"],
+  ["keyword.operator","="],
+  ["string","\"\""],
+  ["punctuation.operator",","],
+  ["variable","height"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","width"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"010\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0013\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"021\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0013\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0013\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"022\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","2"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0014\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","diamond"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","label"],
+  ["keyword.operator","="],
+  ["string","\"\""],
+  ["punctuation.operator",","],
+  ["variable","height"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","width"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"019\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0014\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"020\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0014\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0014\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"024\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","2"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0015\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","diamond"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","label"],
+  ["keyword.operator","="],
+  ["string","\"\""],
+  ["punctuation.operator",","],
+  ["variable","height"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","width"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"022\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0015\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"025\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0015\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0015\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"027\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","2"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0016\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","diamond"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","label"],
+  ["keyword.operator","="],
+  ["string","\"\""],
+  ["punctuation.operator",","],
+  ["variable","height"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","width"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"024\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0016\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"018\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0016\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0016\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"026\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","2"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0017\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","shape"],
+  ["keyword.operator","="],
+  ["text","diamond"],
+  ["punctuation.operator",","],
+  ["variable","style"],
+  ["keyword.operator","="],
+  ["text","filled"],
+  ["punctuation.operator",","],
+  ["variable","label"],
+  ["keyword.operator","="],
+  ["string","\"\""],
+  ["punctuation.operator",","],
+  ["variable","height"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["variable","width"],
+  ["keyword.operator","="],
+  ["text","."],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"026\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0017\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"027\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"marr0017\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["string","\"marr0017\""],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["string","\"028\""],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["variable","dir"],
+  ["keyword.operator","="],
+  ["text","none"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["variable","weight"],
+  ["keyword.operator","="],
+  ["constant.numeric","2"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_erlang.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_erlang.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_erlang.json
new file mode 100644
index 0000000..8a82897
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_erlang.json
@@ -0,0 +1,166 @@
+[[
+   "start",
+  ["text","  "],
+  ["punctuation.definition.comment.erlang","%% A process whose only job is to keep a counter."]
+],[
+   "start",
+  ["text","  "],
+  ["punctuation.definition.comment.erlang","%% First version"]
+],[
+   "start",
+  ["meta.directive.module.erlang","  "],
+  ["punctuation.section.directive.begin.erlang","-"],
+  ["keyword.control.directive.module.erlang","module"],
+  ["punctuation.definition.parameters.begin.erlang","("],
+  ["entity.name.type.class.module.definition.erlang","counter"],
+  ["punctuation.definition.parameters.end.erlang",")"],
+  ["punctuation.section.directive.end.erlang","."]
+],[
+   "start",
+  ["meta.directive.export.erlang","  "],
+  ["punctuation.section.directive.begin.erlang","-"],
+  ["keyword.control.directive.export.erlang","export"],
+  ["punctuation.definition.parameters.begin.erlang","("],
+  ["punctuation.definition.list.begin.erlang","["],
+  ["entity.name.function.erlang","start"],
+  ["punctuation.separator.function-arity.erlang","/"],
+  ["constant.numeric.integer.decimal.erlang","0"],
+  ["punctuation.separator.list.erlang",","],
+  ["meta.structure.list.function.erlang"," "],
+  ["entity.name.function.erlang","codeswitch"],
+  ["punctuation.separator.function-arity.erlang","/"],
+  ["constant.numeric.integer.decimal.erlang","1"],
+  ["punctuation.definition.list.end.erlang","]"],
+  ["punctuation.definition.parameters.end.erlang",")"],
+  ["punctuation.section.directive.end.erlang","."]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["meta.function.erlang","  "],
+  ["entity.name.function.definition.erlang","start"],
+  ["punctuation.section.expression.begin.erlang","("],
+  ["punctuation.section.expression.end.erlang",")"],
+  ["text"," "],
+  ["keyword.operator.symbolic.erlang","->"],
+  ["text"," "],
+  ["entity.name.function.erlang","loop"],
+  ["punctuation.definition.parameters.begin.erlang","("],
+  ["constant.numeric.integer.decimal.erlang","0"],
+  ["punctuation.definition.parameters.end.erlang",")"],
+  ["punctuation.terminator.function.erlang","."]
+],[
+   "start",
+  ["text"," "]
+],[
+   ["text6","meta.function.erlang"],
+  ["meta.function.erlang","  "],
+  ["entity.name.function.definition.erlang","loop"],
+  ["punctuation.section.expression.begin.erlang","("],
+  ["variable.other.erlang","Sum"],
+  ["punctuation.section.expression.end.erlang",")"],
+  ["text"," "],
+  ["keyword.operator.symbolic.erlang","->"]
+],[
+   ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"],
+  ["text","    "],
+  ["keyword.control.receive.erlang","receive"]
+],[
+   ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"],
+  ["meta.expression.receive.erlang","       "],
+  ["punctuation.definition.tuple.begin.erlang","{"],
+  ["constant.other.symbol.unquoted.erlang","increment"],
+  ["punctuation.separator.tuple.erlang",","],
+  ["meta.structure.tuple.erlang"," "],
+  ["variable.other.erlang","Count"],
+  ["punctuation.definition.tuple.end.erlang","}"],
+  ["meta.expression.receive.erlang"," "],
+  ["punctuation.separator.clause-head-body.erlang","->"]
+],[
+   ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"],
+  ["meta.expression.receive.erlang","          "],
+  ["entity.name.function.erlang","loop"],
+  ["punctuation.definition.parameters.begin.erlang","("],
+  ["variable.other.erlang","Sum"],
+  ["keyword.operator.symbolic.erlang","+"],
+  ["variable.other.erlang","Count"],
+  ["punctuation.definition.parameters.end.erlang",")"],
+  ["punctuation.separator.clauses.erlang",";"]
+],[
+   ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"],
+  ["meta.expression.receive.erlang","       "],
+  ["punctuation.definition.tuple.begin.erlang","{"],
+  ["constant.other.symbol.unquoted.erlang","counter"],
+  ["punctuation.separator.tuple.erlang",","],
+  ["meta.structure.tuple.erlang"," "],
+  ["variable.other.erlang","Pid"],
+  ["punctuation.definition.tuple.end.erlang","}"],
+  ["meta.expression.receive.erlang"," "],
+  ["punctuation.separator.clause-head-body.erlang","->"]
+],[
+   ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"],
+  ["meta.expression.receive.erlang","          "],
+  ["variable.other.erlang","Pid"],
+  ["meta.expression.receive.erlang"," "],
+  ["keyword.operator.symbolic.erlang","!"],
+  ["meta.expression.receive.erlang"," "],
+  ["punctuation.definition.tuple.begin.erlang","{"],
+  ["constant.other.symbol.unquoted.erlang","counter"],
+  ["punctuation.separator.tuple.erlang",","],
+  ["meta.structure.tuple.erlang"," "],
+  ["variable.other.erlang","Sum"],
+  ["punctuation.definition.tuple.end.erlang","}"],
+  ["punctuation.separator.expressions.erlang",","]
+],[
+   ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"],
+  ["meta.expression.receive.erlang","          "],
+  ["entity.name.function.erlang","loop"],
+  ["punctuation.definition.parameters.begin.erlang","("],
+  ["variable.other.erlang","Sum"],
+  ["punctuation.definition.parameters.end.erlang",")"],
+  ["punctuation.separator.clauses.erlang",";"]
+],[
+   ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"],
+  ["meta.expression.receive.erlang","       "],
+  ["constant.other.symbol.unquoted.erlang","code_switch"],
+  ["meta.expression.receive.erlang"," "],
+  ["punctuation.separator.clause-head-body.erlang","->"]
+],[
+   ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"],
+  ["meta.expression.receive.erlang","          "],
+  ["keyword.operator.macro.erlang","?"],
+  ["entity.name.function.macro.erlang","MODULE"],
+  ["meta.expression.receive.erlang",":"],
+  ["entity.name.function.erlang","codeswitch"],
+  ["punctuation.definition.parameters.begin.erlang","("],
+  ["variable.other.erlang","Sum"],
+  ["punctuation.definition.parameters.end.erlang",")"]
+],[
+   ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"],
+  ["meta.expression.receive.erlang","          "],
+  ["punctuation.definition.comment.erlang","% Force the use of 'codeswitch/1' from the latest MODULE version"]
+],[
+   "start",
+  ["meta.expression.receive.erlang","    "],
+  ["keyword.control.end.erlang","end"],
+  ["punctuation.terminator.function.erlang","."]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["meta.function.erlang","  "],
+  ["entity.name.function.definition.erlang","codeswitch"],
+  ["punctuation.section.expression.begin.erlang","("],
+  ["variable.other.erlang","Sum"],
+  ["punctuation.section.expression.end.erlang",")"],
+  ["text"," "],
+  ["keyword.operator.symbolic.erlang","->"],
+  ["text"," "],
+  ["entity.name.function.erlang","loop"],
+  ["punctuation.definition.parameters.begin.erlang","("],
+  ["variable.other.erlang","Sum"],
+  ["punctuation.definition.parameters.end.erlang",")"],
+  ["punctuation.terminator.function.erlang","."]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_forth.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_forth.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_forth.json
new file mode 100644
index 0000000..8c8a007
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_forth.json
@@ -0,0 +1,219 @@
+[[
+   "start",
+  ["keyword.other.compile-only.forth",":"],
+  ["meta.block.forth"," "],
+  ["entity.name.function.forth","HELLO"],
+  ["meta.block.forth"," "],
+  ["comment.line.parentheses.forth"," ( -- )"],
+  ["meta.block.forth","  CR "],
+  ["string.quoted.double.forth",".\" Hello, world!\""],
+  ["meta.block.forth"," "],
+  ["keyword.other.compile-only.forth",";"],
+  ["text"," "]
+],[
+   "start"
+],[
+   "start",
+  ["text","HELLO <cr>"]
+],[
+   "start",
+  ["text","Hello, world!"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword.other.compile-only.forth",":"],
+  ["meta.block.forth"," "],
+  ["entity.name.function.forth","[CHAR]"],
+  ["meta.block.forth","  "],
+  ["keyword.other.non-immediate.forth"," CHAR"],
+  ["meta.block.forth"," "],
+  ["keyword.other.compile-only.forth"," POSTPONE"],
+  ["meta.block.forth"," LITERAL "],
+  ["keyword.other.compile-only.forth",";"],
+  ["keyword.other.immediate.forth"," IMMEDIATE"]
+],[
+   "start"
+],[
+   "start",
+  ["constant.numeric.forth","0"],
+  ["storage.type.forth"," value"],
+  ["text"," ii       "],
+  ["constant.numeric.forth"," 0"],
+  ["storage.type.forth"," value"],
+  ["text"," jj"]
+],[
+   "start",
+  ["constant.numeric.forth","0"],
+  ["storage.type.forth"," value"],
+  ["text"," KeyAddr  "],
+  ["constant.numeric.forth"," 0"],
+  ["storage.type.forth"," value"],
+  ["text"," KeyLen"]
+],[
+   "start",
+  ["storage.type.forth","create"],
+  ["text"," SArray  "],
+  ["constant.numeric.forth"," 256"],
+  ["text"," allot  "],
+  ["comment.line.backslash.forth"," \\ state array of 256 bytes"]
+],[
+   "start",
+  ["keyword.other.compile-only.forth",":"],
+  ["meta.block.forth"," "],
+  ["entity.name.function.forth","KeyArray"],
+  ["meta.block.forth","      KeyLen mod   KeyAddr "],
+  ["keyword.other.compile-only.forth",";"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword.other.compile-only.forth",":"],
+  ["meta.block.forth"," "],
+  ["entity.name.function.forth","get_byte"],
+  ["meta.block.forth","      + c@ "],
+  ["keyword.other.compile-only.forth",";"]
+],[
+   "start",
+  ["keyword.other.compile-only.forth",":"],
+  ["meta.block.forth"," "],
+  ["entity.name.function.forth","set_byte"],
+  ["meta.block.forth","      + c! "],
+  ["keyword.other.compile-only.forth",";"]
+],[
+   "start",
+  ["keyword.other.compile-only.forth",":"],
+  ["meta.block.forth"," "],
+  ["entity.name.function.forth","as_byte"],
+  ["meta.block.forth","      "],
+  ["constant.numeric.forth"," 255"],
+  ["meta.block.forth"," and "],
+  ["keyword.other.compile-only.forth",";"]
+],[
+   "start",
+  ["keyword.other.compile-only.forth",":"],
+  ["meta.block.forth"," "],
+  ["entity.name.function.forth","reset_ij"],
+  ["meta.block.forth","     "],
+  ["constant.numeric.forth"," 0"],
+  ["keyword.other.immediate.forth"," TO"],
+  ["meta.block.forth"," ii  "],
+  ["constant.numeric.forth"," 0"],
+  ["keyword.other.immediate.forth"," TO"],
+  ["meta.block.forth"," jj "],
+  ["keyword.other.compile-only.forth",";"]
+],[
+   "start",
+  ["keyword.other.compile-only.forth",":"],
+  ["meta.block.forth"," "],
+  ["entity.name.function.forth","i_update"],
+  ["meta.block.forth","     "],
+  ["constant.numeric.forth"," 1"],
+  ["meta.block.forth"," +   as_byte"],
+  ["keyword.other.immediate.forth"," TO"],
+  ["meta.block.forth"," ii "],
+  ["keyword.other.compile-only.forth",";"]
+],[
+   "start",
+  ["keyword.other.compile-only.forth",":"],
+  ["meta.block.forth"," "],
+  ["entity.name.function.forth","j_update"],
+  ["meta.block.forth","      ii SArray get_byte +   as_byte"],
+  ["keyword.other.immediate.forth"," TO"],
+  ["meta.block.forth"," jj "],
+  ["keyword.other.compile-only.forth",";"]
+],[
+   "keyword.other.compile-only.forth",
+  ["keyword.other.compile-only.forth",":"],
+  ["meta.block.forth"," "],
+  ["entity.name.function.forth","swap_s_ij"]
+],[
+   "keyword.other.compile-only.forth",
+  ["meta.block.forth","    jj SArray get_byte"]
+],[
+   "keyword.other.compile-only.forth",
+  ["meta.block.forth","       ii SArray get_byte  jj SArray set_byte"]
+],[
+   "keyword.other.compile-only.forth",
+  ["meta.block.forth","    ii SArray set_byte"]
+],[
+   "start",
+  ["keyword.other.compile-only.forth",";"]
+],[
+   "start"
+],[
+   "keyword.other.compile-only.forth",
+  ["keyword.other.compile-only.forth",":"],
+  ["meta.block.forth"," "],
+  ["entity.name.function.forth","rc4_init"],
+  ["comment.line.parentheses.forth"," ( KeyAddr KeyLen -- )"]
+],[
+   "keyword.other.compile-only.forth",
+  ["meta.block.forth","   "],
+  ["constant.numeric.forth"," 256"],
+  ["meta.block.forth"," min"],
+  ["keyword.other.immediate.forth"," TO"],
+  ["meta.block.forth"," KeyLen  "],
+  ["keyword.other.immediate.forth"," TO"],
+  ["meta.block.forth"," KeyAddr"]
+],[
+   "keyword.other.compile-only.forth",
+  ["meta.block.forth","   "],
+  ["constant.numeric.forth"," 256 0"],
+  ["keyword.control.compile-only.forth"," DO"],
+  ["meta.block.forth","   "],
+  ["variable.language.forth","i"],
+  ["meta.block.forth"," "],
+  ["variable.language.forth","i"],
+  ["meta.block.forth"," SArray set_byte  "],
+  ["keyword.control.compile-only.forth"," LOOP"]
+],[
+   "keyword.other.compile-only.forth",
+  ["meta.block.forth","    reset_ij"]
+],[
+   "keyword.other.compile-only.forth",
+  ["meta.block.forth","   "],
+  ["keyword.control.compile-only.forth"," BEGIN"]
+],[
+   "keyword.other.compile-only.forth",
+  ["meta.block.forth","        ii KeyArray get_byte   jj +  j_update"]
+],[
+   "keyword.other.compile-only.forth",
+  ["meta.block.forth","        swap_s_ij"]
+],[
+   "keyword.other.compile-only.forth",
+  ["meta.block.forth","        ii"],
+  ["constant.numeric.forth"," 255"],
+  ["meta.block.forth"," <"],
+  ["keyword.control.compile-only.forth"," WHILE"]
+],[
+   "keyword.other.compile-only.forth",
+  ["meta.block.forth","        ii i_update"]
+],[
+   "keyword.other.compile-only.forth",
+  ["meta.block.forth","   "],
+  ["keyword.control.compile-only.forth"," REPEAT"]
+],[
+   "keyword.other.compile-only.forth",
+  ["meta.block.forth","    reset_ij"]
+],[
+   "start",
+  ["keyword.other.compile-only.forth",";"]
+],[
+   "keyword.other.compile-only.forth",
+  ["keyword.other.compile-only.forth",":"],
+  ["meta.block.forth"," "],
+  ["entity.name.function.forth","rc4_byte"]
+],[
+   "keyword.other.compile-only.forth",
+  ["meta.block.forth","    ii i_update   jj j_update"]
+],[
+   "keyword.other.compile-only.forth",
+  ["meta.block.forth","    swap_s_ij"]
+],[
+   "keyword.other.compile-only.forth",
+  ["meta.block.forth","    ii SArray get_byte   jj SArray get_byte +   as_byte SArray get_byte  xor"]
+],[
+   "start",
+  ["keyword.other.compile-only.forth",";"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_ftl.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_ftl.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_ftl.json
new file mode 100644
index 0000000..eb81f1f
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_ftl.json
@@ -0,0 +1,341 @@
+[[
+   "start",
+  ["keyword.function","<#ftl"],
+  ["text"," "],
+  ["entity.other.attribute-name","encoding"],
+  ["keyword.operator","="],
+  ["string","\"utf-8\""],
+  ["text"," "],
+  ["keyword","/>"]
+],[
+   "start",
+  ["keyword.function","<#setting"],
+  ["text"," "],
+  ["entity.other.attribute-name","locale"],
+  ["keyword.operator","="],
+  ["string","\"en_US\""],
+  ["text"," "],
+  ["keyword","/>"]
+],[
+   "start",
+  ["keyword.function","<#import"],
+  ["text"," "],
+  ["string","\"library\""],
+  ["text"," "],
+  ["keyword.operator","as"],
+  ["text"," "],
+  ["variable","lib"],
+  ["text"," "],
+  ["keyword","/>"]
+],[
+   "ftl-dcomment",
+  ["comment","<#--"]
+],[
+   "ftl-dcomment",
+  ["comment","    FreeMarker comment"]
+],[
+   "ftl-dcomment",
+  ["comment","    ${abc} <#assign a=12 />"]
+],[
+   "start",
+  ["comment","-->"]
+],[
+   "start"
+],[
+   "start",
+  ["punctuation.doctype.begin","<!"],
+  ["meta.tag.doctype","DOCTYPE"],
+  ["text"," "],
+  ["xml-pe","html"],
+  ["punctuation.doctype.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","html"],
+  ["text"," "],
+  ["entity.other.attribute-name","lang"],
+  ["keyword.operator.separator","="],
+  ["string","\"en-us\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","head"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","meta"],
+  ["text"," "],
+  ["entity.other.attribute-name","charset"],
+  ["keyword.operator.separator","="],
+  ["string","\"utf-8\""],
+  ["text"," "],
+  ["meta.tag.punctuation.end","/>"]
+],[
+   "start",
+  ["text","        "]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","title"],
+  ["meta.tag.punctuation.end",">"],
+  ["string.interpolated","${"],
+  ["variable","title"],
+  ["keyword.operator","!"],
+  ["string","\"FreeMarker\""],
+  ["string.interpolated","}"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","title"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","head"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","body"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","h1"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","Hello "],
+  ["string.interpolated","${"],
+  ["variable","name"],
+  ["keyword.operator","!"],
+  ["string","\"\""],
+  ["string.interpolated","}"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","h1"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        "]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","Today is: "],
+  ["string.interpolated","${"],
+  ["language.variable",".now"],
+  ["support.function","?date"],
+  ["string.interpolated","}"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        "]
+],[
+   "start",
+  ["text","        "],
+  ["keyword.function","<#assign"],
+  ["text"," "],
+  ["variable","x"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","13"],
+  ["keyword",">"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword.function","<#if"],
+  ["text"," "],
+  ["variable","x"],
+  ["text"," "],
+  ["constant.character.entity","&gt;"],
+  ["text"," "],
+  ["constant.numeric","12"],
+  ["text"," "],
+  ["keyword.operator","&&"],
+  ["text"," "],
+  ["variable","x"],
+  ["text"," "],
+  ["keyword.operator","lt"],
+  ["text"," "],
+  ["constant.numeric","14"],
+  ["keyword",">"],
+  ["text","x equals 13: "],
+  ["string.interpolated","${"],
+  ["variable","x"],
+  ["string.interpolated","}"],
+  ["keyword.function","</#if"],
+  ["keyword",">"]
+],[
+   "start",
+  ["text","        "]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","ul"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","            "],
+  ["keyword.function","<#list"],
+  ["text"," "],
+  ["variable","items"],
+  ["text"," "],
+  ["keyword.operator","as"],
+  ["text"," "],
+  ["variable","item"],
+  ["keyword",">"]
+],[
+   "start",
+  ["text","                "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","li"],
+  ["meta.tag.punctuation.end",">"],
+  ["string.interpolated","${"],
+  ["variable","item_index"],
+  ["string.interpolated","}"],
+  ["text",": "],
+  ["string.interpolated","${"],
+  ["variable","item.name"],
+  ["keyword.operator","!"],
+  ["support.function","?split"],
+  ["paren.lparen","("],
+  ["string","\""],
+  ["constant.character.escape","\\n"],
+  ["string","\""],
+  ["paren.rparen",")"],
+  ["paren.lparen","["],
+  ["constant.numeric","0"],
+  ["paren.rparen","]"],
+  ["string.interpolated","}"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","li"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","            "],
+  ["keyword.function","</#list"],
+  ["keyword",">"]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","ul"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        "]
+],[
+   "start",
+  ["text","        User directive: "],
+  ["keyword.other","<@lib.function"],
+  ["text"," "],
+  ["variable","attr1"],
+  ["keyword.operator","="],
+  ["constant.language","true"],
+  ["text"," "],
+  ["variable","attr2"],
+  ["keyword.operator","="],
+  ["string","'value'"],
+  ["text"," "],
+  ["variable","attr3"],
+  ["keyword.operator","="],
+  ["constant.numeric","-42.12"],
+  ["keyword",">"],
+  ["text","Test"],
+  ["keyword.other","</@lib.function"],
+  ["keyword",">"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword.other","<@anotherOne"],
+  ["text"," "],
+  ["keyword","/>"]
+],[
+   "start",
+  ["text","        "]
+],[
+   "start",
+  ["text","        "],
+  ["keyword.function","<#if"],
+  ["text"," "],
+  ["variable","variable"],
+  ["support.function.deprecated","?exists"],
+  ["keyword",">"]
+],[
+   "start",
+  ["text","            Deprecated"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword.function","<#elseif"],
+  ["text"," "],
+  ["variable","variable"],
+  ["support.function","??"],
+  ["keyword",">"]
+],[
+   "start",
+  ["text","            Better"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword.function","<#else"],
+  ["keyword",">"]
+],[
+   "start",
+  ["text","            Default"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword.function","</#if"],
+  ["keyword",">"]
+],[
+   "start",
+  ["text","        "]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.image","img"],
+  ["text"," "],
+  ["entity.other.attribute-name","src"],
+  ["keyword.operator.separator","="],
+  ["string","\"images/"],
+  ["string.interpolated","${"],
+  ["variable","user.id"],
+  ["string.interpolated","}"],
+  ["string",".png\""],
+  ["text"," "],
+  ["meta.tag.punctuation.end","/>"]
+],[
+   "start",
+  ["text","        "]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","body"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","html"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_glsl.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_glsl.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_glsl.json
new file mode 100644
index 0000000..ce8a4d1
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_glsl.json
@@ -0,0 +1,127 @@
+[[
+   "start",
+  ["keyword","uniform"],
+  ["text"," "],
+  ["keyword","float"],
+  ["text"," "],
+  ["identifier","amplitude"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["keyword","attribute"],
+  ["text"," "],
+  ["keyword","float"],
+  ["text"," "],
+  ["identifier","displacement"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["keyword","varying"],
+  ["text"," "],
+  ["keyword","vec3"],
+  ["text"," "],
+  ["identifier","vNormal"],
+  ["punctuation.operator",";"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","void"],
+  ["text"," "],
+  ["identifier","main"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    "],
+  ["identifier","vNormal"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","normal"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","  "]
+],[
+   "start",
+  ["text","    "],
+  ["comment","// multiply our displacement by the"]
+],[
+   "start",
+  ["text","    "],
+  ["comment","// amplitude. The amp will get animated"]
+],[
+   "start",
+  ["text","    "],
+  ["comment","// so we'll have animated displacement"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","vec3"],
+  ["text"," "],
+  ["identifier","newPosition"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","position"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "]
+],[
+   "start",
+  ["text","                       "],
+  ["identifier","normal"],
+  ["text"," "],
+  ["keyword.operator","*"],
+  ["text"," "]
+],[
+   "start",
+  ["text","                       "],
+  ["keyword","vec3"],
+  ["paren.lparen","("],
+  ["identifier","displacement"],
+  ["text"," "],
+  ["keyword.operator","*"]
+],[
+   "start",
+  ["text","                            "],
+  ["identifier","amplitude"],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    "],
+  ["constant.language","gl_Position"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","projectionMatrix"],
+  ["text"," "],
+  ["keyword.operator","*"]
+],[
+   "start",
+  ["text","                  "],
+  ["identifier","modelViewMatrix"],
+  ["text"," "],
+  ["keyword.operator","*"]
+],[
+   "start",
+  ["text","                  "],
+  ["keyword","vec4"],
+  ["paren.lparen","("],
+  ["identifier","newPosition"],
+  ["punctuation.operator",","],
+  ["constant.numeric","1.0"],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["paren.rparen","}"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_golang.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_golang.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_golang.json
new file mode 100644
index 0000000..070c0a1
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_golang.json
@@ -0,0 +1,256 @@
+[[
+   "start",
+  ["comment","// Concurrent computation of pi."]
+],[
+   "start",
+  ["comment","// See http://goo.gl/ZuTZM."]
+],[
+   "start",
+  ["comment","//"]
+],[
+   "start",
+  ["comment","// This demonstrates Go's ability to handle"]
+],[
+   "start",
+  ["comment","// large numbers of concurrent processes."]
+],[
+   "start",
+  ["comment","// It is an unreasonable way to calculate pi."]
+],[
+   "start",
+  ["keyword","package"],
+  ["text"," "],
+  ["identifier","main"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","import"],
+  ["text"," "],
+  ["paren.lparen","("]
+],[
+   "start",
+  ["text","    "],
+  ["string","\"fmt\""]
+],[
+   "start",
+  ["text","    "],
+  ["string","\"math\""]
+],[
+   "start",
+  ["paren.rparen",")"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","func"],
+  ["text"," "],
+  ["identifier","main"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","fmt"],
+  ["punctuation.operator","."],
+  ["identifier","Println"],
+  ["paren.lparen","("],
+  ["identifier","pi"],
+  ["paren.lparen","("],
+  ["constant.numeric","5000"],
+  ["paren.rparen","))"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["comment","// pi launches n goroutines to compute an"]
+],[
+   "start",
+  ["comment","// approximation of pi."]
+],[
+   "start",
+  ["keyword","func"],
+  ["text"," "],
+  ["identifier","pi"],
+  ["paren.lparen","("],
+  ["identifier","n"],
+  ["text"," "],
+  ["support.type","int"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["support.type","float64"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","ch"],
+  ["text"," "],
+  ["punctuation.operator",":"],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["support.function","make"],
+  ["paren.lparen","("],
+  ["keyword","chan"],
+  ["text"," "],
+  ["support.type","float64"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","for"],
+  ["text"," "],
+  ["identifier","k"],
+  ["text"," "],
+  ["punctuation.operator",":"],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["punctuation.operator",";"],
+  ["text"," "],
+  ["identifier","k"],
+  ["text"," "],
+  ["keyword.operator","<="],
+  ["text"," "],
+  ["identifier","n"],
+  ["punctuation.operator",";"],
+  ["text"," "],
+  ["identifier","k"],
+  ["keyword.operator","++"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","go"],
+  ["text"," "],
+  ["identifier","term"],
+  ["paren.lparen","("],
+  ["identifier","ch"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["support.type","float64"],
+  ["paren.lparen","("],
+  ["identifier","k"],
+  ["paren.rparen","))"]
+],[
+   "start",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","f"],
+  ["text"," "],
+  ["punctuation.operator",":"],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","0.0"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","for"],
+  ["text"," "],
+  ["identifier","k"],
+  ["text"," "],
+  ["punctuation.operator",":"],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["punctuation.operator",";"],
+  ["text"," "],
+  ["identifier","k"],
+  ["text"," "],
+  ["keyword.operator","<="],
+  ["text"," "],
+  ["identifier","n"],
+  ["punctuation.operator",";"],
+  ["text"," "],
+  ["identifier","k"],
+  ["keyword.operator","++"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","        "],
+  ["identifier","f"],
+  ["text"," "],
+  ["keyword.operator","+="],
+  ["text"," "],
+  ["keyword.operator","<-"],
+  ["identifier","ch"]
+],[
+   "start",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","return"],
+  ["text"," "],
+  ["identifier","f"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","func"],
+  ["text"," "],
+  ["identifier","term"],
+  ["paren.lparen","("],
+  ["identifier","ch"],
+  ["text"," "],
+  ["keyword","chan"],
+  ["text"," "],
+  ["support.type","float64"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["identifier","k"],
+  ["text"," "],
+  ["support.type","float64"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","ch"],
+  ["text"," "],
+  ["keyword.operator","<-"],
+  ["text"," "],
+  ["constant.numeric","4"],
+  ["text"," "],
+  ["keyword.operator","*"],
+  ["text"," "],
+  ["identifier","math"],
+  ["punctuation.operator","."],
+  ["identifier","Pow"],
+  ["paren.lparen","("],
+  ["constant.numeric","-1"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["identifier","k"],
+  ["paren.rparen",")"],
+  ["text"," / "],
+  ["paren.lparen","("],
+  ["constant.numeric","2"],
+  ["keyword.operator","*"],
+  ["identifier","k"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start"
+]]
\ No newline at end of file


[39/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/layer/marker.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/layer/marker.js b/src/fauxton/assets/js/libs/ace/layer/marker.js
new file mode 100644
index 0000000..cd1b992
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/layer/marker.js
@@ -0,0 +1,218 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var Range = require("../range").Range;
+var dom = require("../lib/dom");
+
+var Marker = function(parentEl) {
+    this.element = dom.createElement("div");
+    this.element.className = "ace_layer ace_marker-layer";
+    parentEl.appendChild(this.element);
+};
+
+(function() {
+
+    this.$padding = 0;
+
+    this.setPadding = function(padding) {
+        this.$padding = padding;
+    };
+    this.setSession = function(session) {
+        this.session = session;
+    };
+    
+    this.setMarkers = function(markers) {
+        this.markers = markers;
+    };
+
+    this.update = function(config) {
+        var config = config || this.config;
+        if (!config)
+            return;
+
+        this.config = config;
+
+
+        var html = [];
+        for (var key in this.markers) {
+            var marker = this.markers[key];
+
+            if (!marker.range) {
+                marker.update(html, this, this.session, config);
+                continue;
+            }
+
+            var range = marker.range.clipRows(config.firstRow, config.lastRow);
+            if (range.isEmpty()) continue;
+
+            range = range.toScreenRange(this.session);
+            if (marker.renderer) {
+                var top = this.$getTop(range.start.row, config);
+                var left = this.$padding + range.start.column * config.characterWidth;
+                marker.renderer(html, range, left, top, config);
+            } else if (marker.type == "fullLine") {
+                this.drawFullLineMarker(html, range, marker.clazz, config);
+            } else if (marker.type == "screenLine") {
+                this.drawScreenLineMarker(html, range, marker.clazz, config);
+            } else if (range.isMultiLine()) {
+                if (marker.type == "text")
+                    this.drawTextMarker(html, range, marker.clazz, config);
+                else
+                    this.drawMultiLineMarker(html, range, marker.clazz, config);
+            } else {
+                this.drawSingleLineMarker(html, range, marker.clazz + " ace_start", config);
+            }
+        }
+        this.element = dom.setInnerHtml(this.element, html.join(""));
+    };
+
+    this.$getTop = function(row, layerConfig) {
+        return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
+    };
+
+    // Draws a marker, which spans a range of text on multiple lines 
+    this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig, extraStyle) {
+        // selection start
+        var row = range.start.row;
+
+        var lineRange = new Range(
+            row, range.start.column,
+            row, this.session.getScreenLastRowColumn(row)
+        );
+        this.drawSingleLineMarker(stringBuilder, lineRange, clazz + " ace_start", layerConfig, 1, extraStyle);
+
+        // selection end
+        row = range.end.row;
+        lineRange = new Range(row, 0, row, range.end.column);
+        this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 0, extraStyle);
+
+        for (row = range.start.row + 1; row < range.end.row; row++) {
+            lineRange.start.row = row;
+            lineRange.end.row = row;
+            lineRange.end.column = this.session.getScreenLastRowColumn(row);
+            this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, extraStyle);
+        }
+    };
+
+    // Draws a multi line marker, where lines span the full width
+    this.drawMultiLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {
+        // from selection start to the end of the line
+        var padding = this.$padding;
+        var height = config.lineHeight;
+        var top = this.$getTop(range.start.row, config);
+        var left = padding + range.start.column * config.characterWidth;
+        extraStyle = extraStyle || "";
+
+        stringBuilder.push(
+            "<div class='", clazz, " ace_start' style='",
+            "height:", height, "px;",
+            "right:0;",
+            "top:", top, "px;",
+            "left:", left, "px;", extraStyle, "'></div>"
+        );
+
+        // from start of the last line to the selection end
+        top = this.$getTop(range.end.row, config);
+        var width = range.end.column * config.characterWidth;
+
+        stringBuilder.push(
+            "<div class='", clazz, "' style='",
+            "height:", height, "px;",
+            "width:", width, "px;",
+            "top:", top, "px;",
+            "left:", padding, "px;", extraStyle, "'></div>"
+        );
+
+        // all the complete lines
+        height = (range.end.row - range.start.row - 1) * config.lineHeight;
+        if (height < 0)
+            return;
+        top = this.$getTop(range.start.row + 1, config);
+
+        stringBuilder.push(
+            "<div class='", clazz, "' style='",
+            "height:", height, "px;",
+            "right:0;",
+            "top:", top, "px;",
+            "left:", padding, "px;", extraStyle, "'></div>"
+        );
+    };
+
+    // Draws a marker which covers part or whole width of a single screen line
+    this.drawSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength, extraStyle) {
+        var height = config.lineHeight;
+        var width = (range.end.column + (extraLength || 0) - range.start.column) * config.characterWidth;
+
+        var top = this.$getTop(range.start.row, config);
+        var left = this.$padding + range.start.column * config.characterWidth;
+
+        stringBuilder.push(
+            "<div class='", clazz, "' style='",
+            "height:", height, "px;",
+            "width:", width, "px;",
+            "top:", top, "px;",
+            "left:", left, "px;", extraStyle || "", "'></div>"
+        );
+    };
+
+    this.drawFullLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {
+        var top = this.$getTop(range.start.row, config);
+        var height = config.lineHeight;
+        if (range.start.row != range.end.row)
+            height += this.$getTop(range.end.row, config) - top;
+
+        stringBuilder.push(
+            "<div class='", clazz, "' style='",
+            "height:", height, "px;",
+            "top:", top, "px;",
+            "left:0;right:0;", extraStyle || "", "'></div>"
+        );
+    };
+    
+    this.drawScreenLineMarker = function(stringBuilder, range, clazz, config, extraStyle) {
+        var top = this.$getTop(range.start.row, config);
+        var height = config.lineHeight;
+
+        stringBuilder.push(
+            "<div class='", clazz, "' style='",
+            "height:", height, "px;",
+            "top:", top, "px;",
+            "left:0;right:0;", extraStyle || "", "'></div>"
+        );
+    };
+
+}).call(Marker.prototype);
+
+exports.Marker = Marker;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/layer/text.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/layer/text.js b/src/fauxton/assets/js/libs/ace/layer/text.js
new file mode 100644
index 0000000..54f0ef4
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/layer/text.js
@@ -0,0 +1,661 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var dom = require("../lib/dom");
+var lang = require("../lib/lang");
+var useragent = require("../lib/useragent");
+var EventEmitter = require("../lib/event_emitter").EventEmitter;
+
+var Text = function(parentEl) {
+    this.element = dom.createElement("div");
+    this.element.className = "ace_layer ace_text-layer";
+    parentEl.appendChild(this.element);
+
+    this.$characterSize = {width: 0, height: 0};
+    this.checkForSizeChanges();
+    this.$pollSizeChanges();
+};
+
+(function() {
+
+    oop.implement(this, EventEmitter);
+
+    this.EOF_CHAR = "\xB6"; //"&para;";
+    this.EOL_CHAR = "\xAC"; //"&not;";
+    this.TAB_CHAR = "\u2192"; //"&rarr;" "\u21E5";
+    this.SPACE_CHAR = "\xB7"; //"&middot;";
+    this.$padding = 0;
+
+    this.setPadding = function(padding) {
+        this.$padding = padding;
+        this.element.style.padding = "0 " + padding + "px";
+    };
+
+    this.getLineHeight = function() {
+        return this.$characterSize.height || 0;
+    };
+
+    this.getCharacterWidth = function() {
+        return this.$characterSize.width || 0;
+    };
+
+    this.checkForSizeChanges = function() {
+        var size = this.$measureSizes();
+        if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) {
+            this.$measureNode.style.fontWeight = "bold";
+            var boldSize = this.$measureSizes();
+            this.$measureNode.style.fontWeight = "";
+            this.$characterSize = size;
+            this.allowBoldFonts = boldSize && boldSize.width === size.width && boldSize.height === size.height;
+            this._emit("changeCharacterSize", {data: size});
+        }
+    };
+
+    this.$pollSizeChanges = function() {
+        var self = this;
+        this.$pollSizeChangesTimer = setInterval(function() {
+            self.checkForSizeChanges();
+        }, 500);
+    };
+
+    this.$fontStyles = {
+        fontFamily : 1,
+        fontSize : 1,
+        fontWeight : 1,
+        fontStyle : 1,
+        lineHeight : 1
+    };
+
+    this.$measureSizes = useragent.isIE || useragent.isOldGecko ? function() {
+        var n = 1000;
+        if (!this.$measureNode) {
+            var measureNode = this.$measureNode = dom.createElement("div");
+            var style = measureNode.style;
+
+            style.width = style.height = "auto";
+            style.left = style.top = (-n * 40)  + "px";
+
+            style.visibility = "hidden";
+            style.position = "fixed";
+            style.overflow = "visible";
+            style.whiteSpace = "nowrap";
+
+            // in FF 3.6 monospace fonts can have a fixed sub pixel width.
+            // that's why we have to measure many characters
+            // Note: characterWidth can be a float!
+            measureNode.innerHTML = lang.stringRepeat("Xy", n);
+
+            if (this.element.ownerDocument.body) {
+                this.element.ownerDocument.body.appendChild(measureNode);
+            } else {
+                var container = this.element.parentNode;
+                while (!dom.hasCssClass(container, "ace_editor"))
+                    container = container.parentNode;
+                container.appendChild(measureNode);
+            }
+        }
+
+        // Size and width can be null if the editor is not visible or
+        // detached from the document
+        if (!this.element.offsetWidth)
+            return null;
+
+        var style = this.$measureNode.style;
+        var computedStyle = dom.computedStyle(this.element);
+        for (var prop in this.$fontStyles)
+            style[prop] = computedStyle[prop];
+
+        var size = {
+            height: this.$measureNode.offsetHeight,
+            width: this.$measureNode.offsetWidth / (n * 2)
+        };
+
+        // Size and width can be null if the editor is not visible or
+        // detached from the document
+        if (size.width == 0 || size.height == 0)
+            return null;
+
+        return size;
+    }
+    : function() {
+        if (!this.$measureNode) {
+            var measureNode = this.$measureNode = dom.createElement("div");
+            var style = measureNode.style;
+
+            style.width = style.height = "auto";
+            style.left = style.top = -100 + "px";
+
+            style.visibility = "hidden";
+            style.position = "fixed";
+            style.overflow = "visible";
+            style.whiteSpace = "nowrap";
+
+            // fixes fractional fixed-width fonts; see http://git.io/CavZNw
+            measureNode.innerHTML = lang.stringRepeat("X", 100);
+
+            var container = this.element.parentNode;
+            while (container && !dom.hasCssClass(container, "ace_editor"))
+                container = container.parentNode;
+
+            if (!container)
+                return this.$measureNode = null;
+
+            container.appendChild(measureNode);
+        }
+
+        var rect = this.$measureNode.getBoundingClientRect();
+
+        var size = {
+            height: rect.height,
+            width: rect.width / 100
+        };
+
+        // Size and width can be null if the editor is not visible or
+        // detached from the document
+        if (size.width == 0 || size.height == 0)
+            return null;
+
+        return size;
+    };
+
+    this.setSession = function(session) {
+        this.session = session;
+        this.$computeTabString();
+    };
+
+    this.showInvisibles = false;
+    this.setShowInvisibles = function(showInvisibles) {
+        if (this.showInvisibles == showInvisibles)
+            return false;
+
+        this.showInvisibles = showInvisibles;
+        this.$computeTabString();
+        return true;
+    };
+
+    this.displayIndentGuides = true;
+    this.setDisplayIndentGuides = function(display) {
+        if (this.displayIndentGuides == display)
+            return false;
+
+        this.displayIndentGuides = display;
+        this.$computeTabString();
+        return true;
+    };
+
+    this.$tabStrings = [];
+    this.onChangeTabSize =
+    this.$computeTabString = function() {
+        var tabSize = this.session.getTabSize();
+        this.tabSize = tabSize;
+        var tabStr = this.$tabStrings = [0];
+        for (var i = 1; i < tabSize + 1; i++) {
+            if (this.showInvisibles) {
+                tabStr.push("<span class='ace_invisible'>"
+                    + this.TAB_CHAR
+                    + lang.stringRepeat("\xa0", i - 1)
+                    + "</span>");
+            } else {
+                tabStr.push(lang.stringRepeat("\xa0", i));
+            }
+        }
+        if (this.displayIndentGuides) {
+            this.$indentGuideRe =  /\s\S| \t|\t |\s$/;
+            var className = "ace_indent-guide";
+            if (this.showInvisibles) {
+                className += " ace_invisible";
+                var spaceContent = lang.stringRepeat(this.SPACE_CHAR, this.tabSize);
+                var tabContent = this.TAB_CHAR + lang.stringRepeat("\xa0", this.tabSize - 1);
+            } else{
+                var spaceContent = lang.stringRepeat("\xa0", this.tabSize);
+                var tabContent = spaceContent;
+            }
+
+            this.$tabStrings[" "] = "<span class='" + className + "'>" + spaceContent + "</span>";
+            this.$tabStrings["\t"] = "<span class='" + className + "'>" + tabContent + "</span>";
+        }
+    };
+
+    this.updateLines = function(config, firstRow, lastRow) {
+        // Due to wrap line changes there can be new lines if e.g.
+        // the line to updated wrapped in the meantime.
+        if (this.config.lastRow != config.lastRow ||
+            this.config.firstRow != config.firstRow) {
+            this.scrollLines(config);
+        }
+        this.config = config;
+
+        var first = Math.max(firstRow, config.firstRow);
+        var last = Math.min(lastRow, config.lastRow);
+
+        var lineElements = this.element.childNodes;
+        var lineElementsIdx = 0;
+
+        for (var row = config.firstRow; row < first; row++) {
+            var foldLine = this.session.getFoldLine(row);
+            if (foldLine) {
+                if (foldLine.containsRow(first)) {
+                    first = foldLine.start.row;
+                    break;
+                } else {
+                    row = foldLine.end.row;
+                }
+            }
+            lineElementsIdx ++;
+        }
+
+        var row = first;
+        var foldLine = this.session.getNextFoldLine(row);
+        var foldStart = foldLine ? foldLine.start.row : Infinity;
+
+        while (true) {
+            if (row > foldStart) {
+                row = foldLine.end.row+1;
+                foldLine = this.session.getNextFoldLine(row, foldLine);
+                foldStart = foldLine ? foldLine.start.row :Infinity;
+            }
+            if (row > last)
+                break;
+
+            var lineElement = lineElements[lineElementsIdx++];
+            if (lineElement) {
+                var html = [];
+                this.$renderLine(
+                    html, row, !this.$useLineGroups(), row == foldStart ? foldLine : false
+                );
+                dom.setInnerHtml(lineElement, html.join(""));
+            }
+            row++;
+        }
+    };
+
+    this.scrollLines = function(config) {
+        var oldConfig = this.config;
+        this.config = config;
+
+        if (!oldConfig || oldConfig.lastRow < config.firstRow)
+            return this.update(config);
+
+        if (config.lastRow < oldConfig.firstRow)
+            return this.update(config);
+
+        var el = this.element;
+        if (oldConfig.firstRow < config.firstRow)
+            for (var row=this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row>0; row--)
+                el.removeChild(el.firstChild);
+
+        if (oldConfig.lastRow > config.lastRow)
+            for (var row=this.session.getFoldedRowCount(config.lastRow + 1, oldConfig.lastRow); row>0; row--)
+                el.removeChild(el.lastChild);
+
+        if (config.firstRow < oldConfig.firstRow) {
+            var fragment = this.$renderLinesFragment(config, config.firstRow, oldConfig.firstRow - 1);
+            if (el.firstChild)
+                el.insertBefore(fragment, el.firstChild);
+            else
+                el.appendChild(fragment);
+        }
+
+        if (config.lastRow > oldConfig.lastRow) {
+            var fragment = this.$renderLinesFragment(config, oldConfig.lastRow + 1, config.lastRow);
+            el.appendChild(fragment);
+        }
+    };
+
+    this.$renderLinesFragment = function(config, firstRow, lastRow) {
+        var fragment = this.element.ownerDocument.createDocumentFragment();
+        var row = firstRow;
+        var foldLine = this.session.getNextFoldLine(row);
+        var foldStart = foldLine ? foldLine.start.row : Infinity;
+
+        while (true) {
+            if (row > foldStart) {
+                row = foldLine.end.row+1;
+                foldLine = this.session.getNextFoldLine(row, foldLine);
+                foldStart = foldLine ? foldLine.start.row : Infinity;
+            }
+            if (row > lastRow)
+                break;
+
+            var container = dom.createElement("div");
+
+            var html = [];
+            // Get the tokens per line as there might be some lines in between
+            // beeing folded.
+            this.$renderLine(html, row, false, row == foldStart ? foldLine : false);
+
+            // don't use setInnerHtml since we are working with an empty DIV
+            container.innerHTML = html.join("");
+            if (this.$useLineGroups()) {
+                container.className = 'ace_line_group';
+                fragment.appendChild(container);
+            } else {
+                var lines = container.childNodes
+                while(lines.length)
+                    fragment.appendChild(lines[0]);
+            }
+
+            row++;
+        }
+        return fragment;
+    };
+
+    this.update = function(config) {
+        this.config = config;
+
+        var html = [];
+        var firstRow = config.firstRow, lastRow = config.lastRow;
+
+        var row = firstRow;
+        var foldLine = this.session.getNextFoldLine(row);
+        var foldStart = foldLine ? foldLine.start.row : Infinity;
+
+        while (true) {
+            if (row > foldStart) {
+                row = foldLine.end.row+1;
+                foldLine = this.session.getNextFoldLine(row, foldLine);
+                foldStart = foldLine ? foldLine.start.row :Infinity;
+            }
+            if (row > lastRow)
+                break;
+
+            if (this.$useLineGroups())
+                html.push("<div class='ace_line_group'>")
+
+            this.$renderLine(html, row, false, row == foldStart ? foldLine : false);
+
+            if (this.$useLineGroups())
+                html.push("</div>"); // end the line group
+
+            row++;
+        }
+        this.element = dom.setInnerHtml(this.element, html.join(""));
+    };
+
+    this.$textToken = {
+        "text": true,
+        "rparen": true,
+        "lparen": true
+    };
+
+    this.$renderToken = function(stringBuilder, screenColumn, token, value) {
+        var self = this;
+        var replaceReg = /\t|&|<|( +)|([\x00-\x1f\x80-\xa0\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g;
+        var replaceFunc = function(c, a, b, tabIdx, idx4) {
+            if (a) {
+                return self.showInvisibles ?
+                    "<span class='ace_invisible'>" + lang.stringRepeat(self.SPACE_CHAR, c.length) + "</span>" :
+                    lang.stringRepeat("\xa0", c.length);
+            } else if (c == "&") {
+                return "&#38;";
+            } else if (c == "<") {
+                return "&#60;";
+            } else if (c == "\t") {
+                var tabSize = self.session.getScreenTabSize(screenColumn + tabIdx);
+                screenColumn += tabSize - 1;
+                return self.$tabStrings[tabSize];
+            } else if (c == "\u3000") {
+                // U+3000 is both invisible AND full-width, so must be handled uniquely
+                var classToUse = self.showInvisibles ? "ace_cjk ace_invisible" : "ace_cjk";
+                var space = self.showInvisibles ? self.SPACE_CHAR : "";
+                screenColumn += 1;
+                return "<span class='" + classToUse + "' style='width:" +
+                    (self.config.characterWidth * 2) +
+                    "px'>" + space + "</span>";
+            } else if (b) {
+                return "<span class='ace_invisible ace_invalid'>" + self.SPACE_CHAR + "</span>";
+            } else {
+                screenColumn += 1;
+                return "<span class='ace_cjk' style='width:" +
+                    (self.config.characterWidth * 2) +
+                    "px'>" + c + "</span>";
+            }
+        };
+
+        var output = value.replace(replaceReg, replaceFunc);
+
+        if (!this.$textToken[token.type]) {
+            var classes = "ace_" + token.type.replace(/\./g, " ace_");
+            var style = "";
+            if (token.type == "fold")
+                style = " style='width:" + (token.value.length * this.config.characterWidth) + "px;' ";
+            stringBuilder.push("<span class='", classes, "'", style, ">", output, "</span>");
+        }
+        else {
+            stringBuilder.push(output);
+        }
+        return screenColumn + value.length;
+    };
+
+    this.renderIndentGuide = function(stringBuilder, value, max) {
+        var cols = value.search(this.$indentGuideRe);
+        if (cols <= 0 || cols >= max)
+            return value;
+        if (value[0] == " ") {
+            cols -= cols % this.tabSize;
+            stringBuilder.push(lang.stringRepeat(this.$tabStrings[" "], cols/this.tabSize));
+            return value.substr(cols);
+        } else if (value[0] == "\t") {
+            stringBuilder.push(lang.stringRepeat(this.$tabStrings["\t"], cols));
+            return value.substr(cols);
+        }
+        return value;
+    };
+
+    this.$renderWrappedLine = function(stringBuilder, tokens, splits, onlyContents) {
+        var chars = 0;
+        var split = 0;
+        var splitChars = splits[0];
+        var screenColumn = 0;
+
+        for (var i = 0; i < tokens.length; i++) {
+            var token = tokens[i];
+            var value = token.value;
+            if (i == 0 && this.displayIndentGuides) {
+                chars = value.length;
+                value = this.renderIndentGuide(stringBuilder, value, splitChars);
+                if (!value)
+                    continue;
+                chars -= value.length;
+            }
+
+            if (chars + value.length < splitChars) {
+                screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
+                chars += value.length;
+            } else {
+                while (chars + value.length >= splitChars) {
+                    screenColumn = this.$renderToken(
+                        stringBuilder, screenColumn,
+                        token, value.substring(0, splitChars - chars)
+                    );
+                    value = value.substring(splitChars - chars);
+                    chars = splitChars;
+
+                    if (!onlyContents) {
+                        stringBuilder.push("</div>",
+                            "<div class='ace_line' style='height:",
+                            this.config.lineHeight, "px'>"
+                        );
+                    }
+
+                    split ++;
+                    screenColumn = 0;
+                    splitChars = splits[split] || Number.MAX_VALUE;
+                }
+                if (value.length != 0) {
+                    chars += value.length;
+                    screenColumn = this.$renderToken(
+                        stringBuilder, screenColumn, token, value
+                    );
+                }
+            }
+        }
+    };
+
+    this.$renderSimpleLine = function(stringBuilder, tokens) {
+        var screenColumn = 0;
+        var token = tokens[0];
+        var value = token.value;
+        if (this.displayIndentGuides)
+            value = this.renderIndentGuide(stringBuilder, value);
+        if (value)
+            screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
+        for (var i = 1; i < tokens.length; i++) {
+            token = tokens[i];
+            value = token.value;
+            screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
+        }
+    };
+
+    // row is either first row of foldline or not in fold
+    this.$renderLine = function(stringBuilder, row, onlyContents, foldLine) {
+        if (!foldLine && foldLine != false)
+            foldLine = this.session.getFoldLine(row);
+
+        if (foldLine)
+            var tokens = this.$getFoldLineTokens(row, foldLine);
+        else
+            var tokens = this.session.getTokens(row);
+
+
+        if (!onlyContents) {
+            stringBuilder.push(
+                "<div class='ace_line' style='height:", this.config.lineHeight, "px'>"
+            );
+        }
+
+        if (tokens.length) {
+            var splits = this.session.getRowSplitData(row);
+            if (splits && splits.length)
+                this.$renderWrappedLine(stringBuilder, tokens, splits, onlyContents);
+            else
+                this.$renderSimpleLine(stringBuilder, tokens);
+        }
+
+        if (this.showInvisibles) {
+            if (foldLine)
+                row = foldLine.end.row
+
+            stringBuilder.push(
+                "<span class='ace_invisible'>",
+                row == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR,
+                "</span>"
+            );
+        }
+        if (!onlyContents)
+            stringBuilder.push("</div>");
+    };
+
+    this.$getFoldLineTokens = function(row, foldLine) {
+        var session = this.session;
+        var renderTokens = [];
+
+        function addTokens(tokens, from, to) {
+            var idx = 0, col = 0;
+            while ((col + tokens[idx].value.length) < from) {
+                col += tokens[idx].value.length;
+                idx++;
+
+                if (idx == tokens.length)
+                    return;
+            }
+            if (col != from) {
+                var value = tokens[idx].value.substring(from - col);
+                // Check if the token value is longer then the from...to spacing.
+                if (value.length > (to - from))
+                    value = value.substring(0, to - from);
+
+                renderTokens.push({
+                    type: tokens[idx].type,
+                    value: value
+                });
+
+                col = from + value.length;
+                idx += 1;
+            }
+
+            while (col < to && idx < tokens.length) {
+                var value = tokens[idx].value;
+                if (value.length + col > to) {
+                    renderTokens.push({
+                        type: tokens[idx].type,
+                        value: value.substring(0, to - col)
+                    });
+                } else
+                    renderTokens.push(tokens[idx]);
+                col += value.length;
+                idx += 1;
+            }
+        }
+
+        var tokens = session.getTokens(row);
+        foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
+            if (placeholder != null) {
+                renderTokens.push({
+                    type: "fold",
+                    value: placeholder
+                });
+            } else {
+                if (isNewRow)
+                    tokens = session.getTokens(row);
+
+                if (tokens.length)
+                    addTokens(tokens, lastColumn, column);
+            }
+        }, foldLine.end.row, this.session.getLine(foldLine.end.row).length);
+
+        return renderTokens;
+    };
+
+    this.$useLineGroups = function() {
+        // For the updateLines function to work correctly, it's important that the
+        // child nodes of this.element correspond on a 1-to-1 basis to rows in the
+        // document (as distinct from lines on the screen). For sessions that are
+        // wrapped, this means we need to add a layer to the node hierarchy (tagged
+        // with the class name ace_line_group).
+        return this.session.getUseWrapMode();
+    };
+
+    this.destroy = function() {
+        clearInterval(this.$pollSizeChangesTimer);
+        if (this.$measureNode)
+            this.$measureNode.parentNode.removeChild(this.$measureNode);
+        delete this.$measureNode;
+    };
+
+}).call(Text.prototype);
+
+exports.Text = Text;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/layer/text_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/layer/text_test.js b/src/fauxton/assets/js/libs/ace/layer/text_test.js
new file mode 100644
index 0000000..a14a37e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/layer/text_test.js
@@ -0,0 +1,126 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+    require("../test/mockdom");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var assert = require("../test/assertions");
+var EditSession = require("../edit_session").EditSession;
+var TextLayer = require("./text").Text;
+var JavaScriptMode = require("../mode/javascript").Mode;
+
+module.exports = {
+
+    setUp: function(next) {
+        this.session = new EditSession("");
+        this.session.setMode(new JavaScriptMode());
+        this.textLayer = new TextLayer(document.createElement("div"));
+        this.textLayer.setSession(this.session);
+        this.textLayer.config = {
+            characterWidth: 10,
+            lineHeight: 20
+        };
+        next()
+    },
+
+    "test: render line with hard tabs should render the same as lines with soft tabs" : function() {
+        this.session.setValue("a\ta\ta\t\na   a   a   \n");
+        this.textLayer.$computeTabString();
+        
+        // row with hard tabs
+        var stringBuilder = [];
+        this.textLayer.$renderLine(stringBuilder, 0);
+        
+        // row with soft tabs
+        var stringBuilder2 = [];
+        this.textLayer.$renderLine(stringBuilder2, 1);
+        assert.equal(stringBuilder.join(""), stringBuilder2.join(""));
+    },
+    
+    "test rendering width of ideographic space (U+3000)" : function() {
+        this.session.setValue("\u3000");
+        
+        var stringBuilder = [];
+        this.textLayer.$renderLine(stringBuilder, 0, true);
+        assert.equal(stringBuilder.join(""), "<span class='ace_cjk' style='width:20px'></span>");
+
+        this.textLayer.setShowInvisibles(true);
+        var stringBuilder = [];
+        this.textLayer.$renderLine(stringBuilder, 0, true);
+        assert.equal(
+            stringBuilder.join(""),
+            "<span class='ace_cjk ace_invisible' style='width:20px'>" + this.textLayer.SPACE_CHAR + "</span>"
+            + "<span class='ace_invisible'>\xB6</span>"
+        );
+    },
+    
+    "test rendering of indent guides" : function() {       
+        var textLayer = this.textLayer
+        var EOL = "<span class='ace_invisible'>" + textLayer.EOL_CHAR + "</span>";
+        var SPACE = function(i) {return Array(i+1).join("\xa0")}
+        var DOT = function(i) {return Array(i+1).join(textLayer.SPACE_CHAR)}
+        var TAB = function(i) {return textLayer.TAB_CHAR + SPACE(i-1)}
+        function testRender(results) {
+            for (var i = results.length; i--; ) {
+                var stringBuilder = [];
+                textLayer.$renderLine(stringBuilder, i, true);
+                assert.equal(stringBuilder.join(""), results[i]);
+            }
+        }
+        
+        this.session.setValue("      \n\t\tf\n   ");
+        testRender([
+            "<span class='ace_indent-guide'>" + SPACE(4) + "</span>" + SPACE(2),
+            "<span class='ace_indent-guide'>" + SPACE(4) + "</span>" + SPACE(4) + "<span class='ace_identifier'>f</span>",
+            SPACE(3)
+        ]);
+        this.textLayer.setShowInvisibles(true);
+        testRender([
+            "<span class='ace_indent-guide ace_invisible'>" + DOT(4) + "</span><span class='ace_invisible'>" + DOT(2) + "</span>" + EOL,
+            "<span class='ace_indent-guide ace_invisible'>" + TAB(4) + "</span><span class='ace_invisible'>" + TAB(4) + "</span><span class='ace_identifier'>f</span>" + EOL,
+        ]);
+        this.textLayer.setDisplayIndentGuides(false);
+        testRender([
+            "<span class='ace_invisible'>" + DOT(6) + "</span>" + EOL,
+            "<span class='ace_invisible'>" + TAB(4) + "</span><span class='ace_invisible'>" + TAB(4) + "</span><span class='ace_identifier'>f</span>" + EOL
+        ]);
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/lib/dom.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/lib/dom.js b/src/fauxton/assets/js/libs/ace/lib/dom.js
new file mode 100644
index 0000000..b372400
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/lib/dom.js
@@ -0,0 +1,283 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+if (typeof document == "undefined")
+    return;
+
+var XHTML_NS = "http://www.w3.org/1999/xhtml";
+
+exports.getDocumentHead = function(doc) {
+    if (!doc)
+        doc = document;
+    return doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement;
+}
+
+exports.createElement = function(tag, ns) {
+    return document.createElementNS ?
+           document.createElementNS(ns || XHTML_NS, tag) :
+           document.createElement(tag);
+};
+
+exports.hasCssClass = function(el, name) {
+    var classes = el.className.split(/\s+/g);
+    return classes.indexOf(name) !== -1;
+};
+
+/*
+* Add a CSS class to the list of classes on the given node
+*/
+exports.addCssClass = function(el, name) {
+    if (!exports.hasCssClass(el, name)) {
+        el.className += " " + name;
+    }
+};
+
+/*
+* Remove a CSS class from the list of classes on the given node
+*/
+exports.removeCssClass = function(el, name) {
+    var classes = el.className.split(/\s+/g);
+    while (true) {
+        var index = classes.indexOf(name);
+        if (index == -1) {
+            break;
+        }
+        classes.splice(index, 1);
+    }
+    el.className = classes.join(" ");
+};
+
+exports.toggleCssClass = function(el, name) {
+    var classes = el.className.split(/\s+/g), add = true;
+    while (true) {
+        var index = classes.indexOf(name);
+        if (index == -1) {
+            break;
+        }
+        add = false;
+        classes.splice(index, 1);
+    }
+    if(add)
+        classes.push(name);
+
+    el.className = classes.join(" ");
+    return add;
+};
+
+/*
+ * Add or remove a CSS class from the list of classes on the given node
+ * depending on the value of <tt>include</tt>
+ */
+exports.setCssClass = function(node, className, include) {
+    if (include) {
+        exports.addCssClass(node, className);
+    } else {
+        exports.removeCssClass(node, className);
+    }
+};
+
+exports.hasCssString = function(id, doc) {
+    var index = 0, sheets;
+    doc = doc || document;
+
+    if (doc.createStyleSheet && (sheets = doc.styleSheets)) {
+        while (index < sheets.length)
+            if (sheets[index++].owningElement.id === id) return true;
+    } else if ((sheets = doc.getElementsByTagName("style"))) {
+        while (index < sheets.length)
+            if (sheets[index++].id === id) return true;
+    }
+
+    return false;
+};
+
+exports.importCssString = function importCssString(cssText, id, doc) {
+    doc = doc || document;
+    // If style is already imported return immediately.
+    if (id && exports.hasCssString(id, doc))
+        return null;
+    
+    var style;
+    
+    if (doc.createStyleSheet) {
+        style = doc.createStyleSheet();
+        style.cssText = cssText;
+        if (id)
+            style.owningElement.id = id;
+    } else {
+        style = doc.createElementNS
+            ? doc.createElementNS(XHTML_NS, "style")
+            : doc.createElement("style");
+
+        style.appendChild(doc.createTextNode(cssText));
+        if (id)
+            style.id = id;
+
+        exports.getDocumentHead(doc).appendChild(style);
+    }
+};
+
+exports.importCssStylsheet = function(uri, doc) {
+    if (doc.createStyleSheet) {
+        doc.createStyleSheet(uri);
+    } else {
+        var link = exports.createElement('link');
+        link.rel = 'stylesheet';
+        link.href = uri;
+
+        exports.getDocumentHead(doc).appendChild(link);
+    }
+};
+
+exports.getInnerWidth = function(element) {
+    return (
+        parseInt(exports.computedStyle(element, "paddingLeft"), 10) +
+        parseInt(exports.computedStyle(element, "paddingRight"), 10) + 
+        element.clientWidth
+    );
+};
+
+exports.getInnerHeight = function(element) {
+    return (
+        parseInt(exports.computedStyle(element, "paddingTop"), 10) +
+        parseInt(exports.computedStyle(element, "paddingBottom"), 10) +
+        element.clientHeight
+    );
+};
+
+if (window.pageYOffset !== undefined) {
+    exports.getPageScrollTop = function() {
+        return window.pageYOffset;
+    };
+
+    exports.getPageScrollLeft = function() {
+        return window.pageXOffset;
+    };
+}
+else {
+    exports.getPageScrollTop = function() {
+        return document.body.scrollTop;
+    };
+
+    exports.getPageScrollLeft = function() {
+        return document.body.scrollLeft;
+    };
+}
+
+if (window.getComputedStyle)
+    exports.computedStyle = function(element, style) {
+        if (style)
+            return (window.getComputedStyle(element, "") || {})[style] || "";
+        return window.getComputedStyle(element, "") || {};
+    };
+else
+    exports.computedStyle = function(element, style) {
+        if (style)
+            return element.currentStyle[style];
+        return element.currentStyle;
+    };
+
+exports.scrollbarWidth = function(document) {
+    var inner = exports.createElement("ace_inner");
+    inner.style.width = "100%";
+    inner.style.minWidth = "0px";
+    inner.style.height = "200px";
+    inner.style.display = "block";
+
+    var outer = exports.createElement("ace_outer");
+    var style = outer.style;
+
+    style.position = "absolute";
+    style.left = "-10000px";
+    style.overflow = "hidden";
+    style.width = "200px";
+    style.minWidth = "0px";
+    style.height = "150px";
+    style.display = "block";
+
+    outer.appendChild(inner);
+
+    var body = document.documentElement;
+    body.appendChild(outer);
+
+    var noScrollbar = inner.offsetWidth;
+
+    style.overflow = "scroll";
+    var withScrollbar = inner.offsetWidth;
+
+    if (noScrollbar == withScrollbar) {
+        withScrollbar = outer.clientWidth;
+    }
+
+    body.removeChild(outer);
+
+    return noScrollbar-withScrollbar;
+};
+
+/*
+ * Optimized set innerHTML. This is faster than plain innerHTML if the element
+ * already contains a lot of child elements.
+ *
+ * See http://blog.stevenlevithan.com/archives/faster-than-innerhtml for details
+ */
+exports.setInnerHtml = function(el, innerHtml) {
+    var element = el.cloneNode(false);//document.createElement("div");
+    element.innerHTML = innerHtml;
+    el.parentNode.replaceChild(element, el);
+    return element;
+};
+
+if ("textContent" in document.documentElement) {
+    exports.setInnerText = function(el, innerText) {
+        el.textContent = innerText;
+    };
+
+    exports.getInnerText = function(el) {
+        return el.textContent;
+    };
+}
+else {
+    exports.setInnerText = function(el, innerText) {
+        el.innerText = innerText;
+    };
+
+    exports.getInnerText = function(el) {
+        return el.innerText;
+    };
+}
+
+exports.getParentWindow = function(document) {
+    return document.defaultView || document.parentWindow;
+};
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/lib/es5-shim.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/lib/es5-shim.js b/src/fauxton/assets/js/libs/ace/lib/es5-shim.js
new file mode 100644
index 0000000..217bdc6
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/lib/es5-shim.js
@@ -0,0 +1,1062 @@
+// https://github.com/kriskowal/es5-shim
+// Copyright 2009-2012 by contributors, MIT License
+
+define(function(require, exports, module) {
+
+/*
+ * Brings an environment as close to ECMAScript 5 compliance
+ * as is possible with the facilities of erstwhile engines.
+ *
+ * Annotated ES5: http://es5.github.com/ (specific links below)
+ * ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
+ * Required reading: http://javascriptweblog.wordpress.com/2011/12/05/extending-javascript-natives/
+ */
+
+//
+// Function
+// ========
+//
+
+// ES-5 15.3.4.5
+// http://es5.github.com/#x15.3.4.5
+
+function Empty() {}
+
+if (!Function.prototype.bind) {
+    Function.prototype.bind = function bind(that) { // .length is 1
+        // 1. Let Target be the this value.
+        var target = this;
+        // 2. If IsCallable(Target) is false, throw a TypeError exception.
+        if (typeof target != "function") {
+            throw new TypeError("Function.prototype.bind called on incompatible " + target);
+        }
+        // 3. Let A be a new (possibly empty) internal list of all of the
+        //   argument values provided after thisArg (arg1, arg2 etc), in order.
+        // XXX slicedArgs will stand in for "A" if used
+        var args = slice.call(arguments, 1); // for normal call
+        // 4. Let F be a new native ECMAScript object.
+        // 11. Set the [[Prototype]] internal property of F to the standard
+        //   built-in Function prototype object as specified in 15.3.3.1.
+        // 12. Set the [[Call]] internal property of F as described in
+        //   15.3.4.5.1.
+        // 13. Set the [[Construct]] internal property of F as described in
+        //   15.3.4.5.2.
+        // 14. Set the [[HasInstance]] internal property of F as described in
+        //   15.3.4.5.3.
+        var bound = function () {
+
+            if (this instanceof bound) {
+                // 15.3.4.5.2 [[Construct]]
+                // When the [[Construct]] internal method of a function object,
+                // F that was created using the bind function is called with a
+                // list of arguments ExtraArgs, the following steps are taken:
+                // 1. Let target be the value of F's [[TargetFunction]]
+                //   internal property.
+                // 2. If target has no [[Construct]] internal method, a
+                //   TypeError exception is thrown.
+                // 3. Let boundArgs be the value of F's [[BoundArgs]] internal
+                //   property.
+                // 4. Let args be a new list containing the same values as the
+                //   list boundArgs in the same order followed by the same
+                //   values as the list ExtraArgs in the same order.
+                // 5. Return the result of calling the [[Construct]] internal
+                //   method of target providing args as the arguments.
+
+                var result = target.apply(
+                    this,
+                    args.concat(slice.call(arguments))
+                );
+                if (Object(result) === result) {
+                    return result;
+                }
+                return this;
+
+            } else {
+                // 15.3.4.5.1 [[Call]]
+                // When the [[Call]] internal method of a function object, F,
+                // which was created using the bind function is called with a
+                // this value and a list of arguments ExtraArgs, the following
+                // steps are taken:
+                // 1. Let boundArgs be the value of F's [[BoundArgs]] internal
+                //   property.
+                // 2. Let boundThis be the value of F's [[BoundThis]] internal
+                //   property.
+                // 3. Let target be the value of F's [[TargetFunction]] internal
+                //   property.
+                // 4. Let args be a new list containing the same values as the
+                //   list boundArgs in the same order followed by the same
+                //   values as the list ExtraArgs in the same order.
+                // 5. Return the result of calling the [[Call]] internal method
+                //   of target providing boundThis as the this value and
+                //   providing args as the arguments.
+
+                // equiv: target.call(this, ...boundArgs, ...args)
+                return target.apply(
+                    that,
+                    args.concat(slice.call(arguments))
+                );
+
+            }
+
+        };
+        if(target.prototype) {
+            Empty.prototype = target.prototype;
+            bound.prototype = new Empty();
+            // Clean up dangling references.
+            Empty.prototype = null;
+        }
+        // XXX bound.length is never writable, so don't even try
+        //
+        // 15. If the [[Class]] internal property of Target is "Function", then
+        //     a. Let L be the length property of Target minus the length of A.
+        //     b. Set the length own property of F to either 0 or L, whichever is
+        //       larger.
+        // 16. Else set the length own property of F to 0.
+        // 17. Set the attributes of the length own property of F to the values
+        //   specified in 15.3.5.1.
+
+        // TODO
+        // 18. Set the [[Extensible]] internal property of F to true.
+
+        // TODO
+        // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3).
+        // 20. Call the [[DefineOwnProperty]] internal method of F with
+        //   arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]:
+        //   thrower, [[Enumerable]]: false, [[Configurable]]: false}, and
+        //   false.
+        // 21. Call the [[DefineOwnProperty]] internal method of F with
+        //   arguments "arguments", PropertyDescriptor {[[Get]]: thrower,
+        //   [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
+        //   and false.
+
+        // TODO
+        // NOTE Function objects created using Function.prototype.bind do not
+        // have a prototype property or the [[Code]], [[FormalParameters]], and
+        // [[Scope]] internal properties.
+        // XXX can't delete prototype in pure-js.
+
+        // 22. Return F.
+        return bound;
+    };
+}
+
+// Shortcut to an often accessed properties, in order to avoid multiple
+// dereference that costs universally.
+// _Please note: Shortcuts are defined after `Function.prototype.bind` as we
+// us it in defining shortcuts.
+var call = Function.prototype.call;
+var prototypeOfArray = Array.prototype;
+var prototypeOfObject = Object.prototype;
+var slice = prototypeOfArray.slice;
+// Having a toString local variable name breaks in Opera so use _toString.
+var _toString = call.bind(prototypeOfObject.toString);
+var owns = call.bind(prototypeOfObject.hasOwnProperty);
+
+// If JS engine supports accessors creating shortcuts.
+var defineGetter;
+var defineSetter;
+var lookupGetter;
+var lookupSetter;
+var supportsAccessors;
+if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
+    defineGetter = call.bind(prototypeOfObject.__defineGetter__);
+    defineSetter = call.bind(prototypeOfObject.__defineSetter__);
+    lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
+    lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
+}
+
+//
+// Array
+// =====
+//
+
+// ES5 15.4.4.12
+// http://es5.github.com/#x15.4.4.12
+// Default value for second param
+// [bugfix, ielt9, old browsers]
+// IE < 9 bug: [1,2].splice(0).join("") == "" but should be "12"
+if ([1,2].splice(0).length != 2) {
+    if(function() { // test IE < 9 to splice bug - see issue #138
+        function makeArray(l) {
+            var a = new Array(l+2);
+            a[0] = a[1] = 0;
+            return a;
+        }
+        var array = [], lengthBefore;
+        
+        array.splice.apply(array, makeArray(20));
+        array.splice.apply(array, makeArray(26));
+
+        lengthBefore = array.length; //46
+        array.splice(5, 0, "XXX"); // add one element
+
+        lengthBefore + 1 == array.length
+
+        if (lengthBefore + 1 == array.length) {
+            return true;// has right splice implementation without bugs
+        }
+        // else {
+        // IE8 bug
+        // }
+    }()) {//IE 6/7
+        var array_splice = Array.prototype.splice;
+        Array.prototype.splice = function(start, deleteCount) {
+            if (!arguments.length) {
+                return [];
+            } else {
+                return array_splice.apply(this, [
+                    start === void 0 ? 0 : start,
+                    deleteCount === void 0 ? (this.length - start) : deleteCount
+                ].concat(slice.call(arguments, 2)))
+            }
+        };
+    } else {//IE8
+        // taken from http://docs.sencha.com/ext-js/4-1/source/Array2.html
+        Array.prototype.splice = function(pos, removeCount){
+            var length = this.length;
+            if (pos > 0) {
+                if (pos > length)
+                    pos = length;
+            } else if (pos == void 0) {
+                pos = 0;
+            } else if (pos < 0) {
+                pos = Math.max(length + pos, 0);
+            }
+
+            if (!(pos+removeCount < length))
+                removeCount = length - pos;
+
+            var removed = this.slice(pos, pos+removeCount);
+            var insert = slice.call(arguments, 2);
+            var add = insert.length;            
+
+            // we try to use Array.push when we can for efficiency...
+            if (pos === length) {
+                if (add) {
+                    this.push.apply(this, insert);
+                }
+            } else {
+                var remove = Math.min(removeCount, length - pos);
+                var tailOldPos = pos + remove;
+                var tailNewPos = tailOldPos + add - remove;
+                var tailCount = length - tailOldPos;
+                var lengthAfterRemove = length - remove;
+
+                if (tailNewPos < tailOldPos) { // case A
+                    for (var i = 0; i < tailCount; ++i) {
+                        this[tailNewPos+i] = this[tailOldPos+i];
+                    }
+                } else if (tailNewPos > tailOldPos) { // case B
+                    for (i = tailCount; i--; ) {
+                        this[tailNewPos+i] = this[tailOldPos+i];
+                    }
+                } // else, add == remove (nothing to do)
+
+                if (add && pos === lengthAfterRemove) {
+                    this.length = lengthAfterRemove; // truncate array
+                    this.push.apply(this, insert);
+                } else {
+                    this.length = lengthAfterRemove + add; // reserves space
+                    for (i = 0; i < add; ++i) {
+                        this[pos+i] = insert[i];
+                    }
+                }
+            }
+            return removed;
+        };
+    }
+}
+
+// ES5 15.4.3.2
+// http://es5.github.com/#x15.4.3.2
+// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray
+if (!Array.isArray) {
+    Array.isArray = function isArray(obj) {
+        return _toString(obj) == "[object Array]";
+    };
+}
+
+// The IsCallable() check in the Array functions
+// has been replaced with a strict check on the
+// internal class of the object to trap cases where
+// the provided function was actually a regular
+// expression literal, which in V8 and
+// JavaScriptCore is a typeof "function".  Only in
+// V8 are regular expression literals permitted as
+// reduce parameters, so it is desirable in the
+// general case for the shim to match the more
+// strict and common behavior of rejecting regular
+// expressions.
+
+// ES5 15.4.4.18
+// http://es5.github.com/#x15.4.4.18
+// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/forEach
+
+// Check failure of by-index access of string characters (IE < 9)
+// and failure of `0 in boxedString` (Rhino)
+var boxedString = Object("a"),
+    splitString = boxedString[0] != "a" || !(0 in boxedString);
+
+if (!Array.prototype.forEach) {
+    Array.prototype.forEach = function forEach(fun /*, thisp*/) {
+        var object = toObject(this),
+            self = splitString && _toString(this) == "[object String]" ?
+                this.split("") :
+                object,
+            thisp = arguments[1],
+            i = -1,
+            length = self.length >>> 0;
+
+        // If no callback function or if callback is not a callable function
+        if (_toString(fun) != "[object Function]") {
+            throw new TypeError(); // TODO message
+        }
+
+        while (++i < length) {
+            if (i in self) {
+                // Invoke the callback function with call, passing arguments:
+                // context, property value, property key, thisArg object
+                // context
+                fun.call(thisp, self[i], i, object);
+            }
+        }
+    };
+}
+
+// ES5 15.4.4.19
+// http://es5.github.com/#x15.4.4.19
+// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
+if (!Array.prototype.map) {
+    Array.prototype.map = function map(fun /*, thisp*/) {
+        var object = toObject(this),
+            self = splitString && _toString(this) == "[object String]" ?
+                this.split("") :
+                object,
+            length = self.length >>> 0,
+            result = Array(length),
+            thisp = arguments[1];
+
+        // If no callback function or if callback is not a callable function
+        if (_toString(fun) != "[object Function]") {
+            throw new TypeError(fun + " is not a function");
+        }
+
+        for (var i = 0; i < length; i++) {
+            if (i in self)
+                result[i] = fun.call(thisp, self[i], i, object);
+        }
+        return result;
+    };
+}
+
+// ES5 15.4.4.20
+// http://es5.github.com/#x15.4.4.20
+// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter
+if (!Array.prototype.filter) {
+    Array.prototype.filter = function filter(fun /*, thisp */) {
+        var object = toObject(this),
+            self = splitString && _toString(this) == "[object String]" ?
+                this.split("") :
+                    object,
+            length = self.length >>> 0,
+            result = [],
+            value,
+            thisp = arguments[1];
+
+        // If no callback function or if callback is not a callable function
+        if (_toString(fun) != "[object Function]") {
+            throw new TypeError(fun + " is not a function");
+        }
+
+        for (var i = 0; i < length; i++) {
+            if (i in self) {
+                value = self[i];
+                if (fun.call(thisp, value, i, object)) {
+                    result.push(value);
+                }
+            }
+        }
+        return result;
+    };
+}
+
+// ES5 15.4.4.16
+// http://es5.github.com/#x15.4.4.16
+// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every
+if (!Array.prototype.every) {
+    Array.prototype.every = function every(fun /*, thisp */) {
+        var object = toObject(this),
+            self = splitString && _toString(this) == "[object String]" ?
+                this.split("") :
+                object,
+            length = self.length >>> 0,
+            thisp = arguments[1];
+
+        // If no callback function or if callback is not a callable function
+        if (_toString(fun) != "[object Function]") {
+            throw new TypeError(fun + " is not a function");
+        }
+
+        for (var i = 0; i < length; i++) {
+            if (i in self && !fun.call(thisp, self[i], i, object)) {
+                return false;
+            }
+        }
+        return true;
+    };
+}
+
+// ES5 15.4.4.17
+// http://es5.github.com/#x15.4.4.17
+// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some
+if (!Array.prototype.some) {
+    Array.prototype.some = function some(fun /*, thisp */) {
+        var object = toObject(this),
+            self = splitString && _toString(this) == "[object String]" ?
+                this.split("") :
+                object,
+            length = self.length >>> 0,
+            thisp = arguments[1];
+
+        // If no callback function or if callback is not a callable function
+        if (_toString(fun) != "[object Function]") {
+            throw new TypeError(fun + " is not a function");
+        }
+
+        for (var i = 0; i < length; i++) {
+            if (i in self && fun.call(thisp, self[i], i, object)) {
+                return true;
+            }
+        }
+        return false;
+    };
+}
+
+// ES5 15.4.4.21
+// http://es5.github.com/#x15.4.4.21
+// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce
+if (!Array.prototype.reduce) {
+    Array.prototype.reduce = function reduce(fun /*, initial*/) {
+        var object = toObject(this),
+            self = splitString && _toString(this) == "[object String]" ?
+                this.split("") :
+                object,
+            length = self.length >>> 0;
+
+        // If no callback function or if callback is not a callable function
+        if (_toString(fun) != "[object Function]") {
+            throw new TypeError(fun + " is not a function");
+        }
+
+        // no value to return if no initial value and an empty array
+        if (!length && arguments.length == 1) {
+            throw new TypeError("reduce of empty array with no initial value");
+        }
+
+        var i = 0;
+        var result;
+        if (arguments.length >= 2) {
+            result = arguments[1];
+        } else {
+            do {
+                if (i in self) {
+                    result = self[i++];
+                    break;
+                }
+
+                // if array contains no values, no initial value to return
+                if (++i >= length) {
+                    throw new TypeError("reduce of empty array with no initial value");
+                }
+            } while (true);
+        }
+
+        for (; i < length; i++) {
+            if (i in self) {
+                result = fun.call(void 0, result, self[i], i, object);
+            }
+        }
+
+        return result;
+    };
+}
+
+// ES5 15.4.4.22
+// http://es5.github.com/#x15.4.4.22
+// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight
+if (!Array.prototype.reduceRight) {
+    Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
+        var object = toObject(this),
+            self = splitString && _toString(this) == "[object String]" ?
+                this.split("") :
+                object,
+            length = self.length >>> 0;
+
+        // If no callback function or if callback is not a callable function
+        if (_toString(fun) != "[object Function]") {
+            throw new TypeError(fun + " is not a function");
+        }
+
+        // no value to return if no initial value, empty array
+        if (!length && arguments.length == 1) {
+            throw new TypeError("reduceRight of empty array with no initial value");
+        }
+
+        var result, i = length - 1;
+        if (arguments.length >= 2) {
+            result = arguments[1];
+        } else {
+            do {
+                if (i in self) {
+                    result = self[i--];
+                    break;
+                }
+
+                // if array contains no values, no initial value to return
+                if (--i < 0) {
+                    throw new TypeError("reduceRight of empty array with no initial value");
+                }
+            } while (true);
+        }
+
+        do {
+            if (i in this) {
+                result = fun.call(void 0, result, self[i], i, object);
+            }
+        } while (i--);
+
+        return result;
+    };
+}
+
+// ES5 15.4.4.14
+// http://es5.github.com/#x15.4.4.14
+// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf
+if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
+    Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
+        var self = splitString && _toString(this) == "[object String]" ?
+                this.split("") :
+                toObject(this),
+            length = self.length >>> 0;
+
+        if (!length) {
+            return -1;
+        }
+
+        var i = 0;
+        if (arguments.length > 1) {
+            i = toInteger(arguments[1]);
+        }
+
+        // handle negative indices
+        i = i >= 0 ? i : Math.max(0, length + i);
+        for (; i < length; i++) {
+            if (i in self && self[i] === sought) {
+                return i;
+            }
+        }
+        return -1;
+    };
+}
+
+// ES5 15.4.4.15
+// http://es5.github.com/#x15.4.4.15
+// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf
+if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
+    Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
+        var self = splitString && _toString(this) == "[object String]" ?
+                this.split("") :
+                toObject(this),
+            length = self.length >>> 0;
+
+        if (!length) {
+            return -1;
+        }
+        var i = length - 1;
+        if (arguments.length > 1) {
+            i = Math.min(i, toInteger(arguments[1]));
+        }
+        // handle negative indices
+        i = i >= 0 ? i : length - Math.abs(i);
+        for (; i >= 0; i--) {
+            if (i in self && sought === self[i]) {
+                return i;
+            }
+        }
+        return -1;
+    };
+}
+
+//
+// Object
+// ======
+//
+
+// ES5 15.2.3.2
+// http://es5.github.com/#x15.2.3.2
+if (!Object.getPrototypeOf) {
+    // https://github.com/kriskowal/es5-shim/issues#issue/2
+    // http://ejohn.org/blog/objectgetprototypeof/
+    // recommended by fschaefer on github
+    Object.getPrototypeOf = function getPrototypeOf(object) {
+        return object.__proto__ || (
+            object.constructor ?
+            object.constructor.prototype :
+            prototypeOfObject
+        );
+    };
+}
+
+// ES5 15.2.3.3
+// http://es5.github.com/#x15.2.3.3
+if (!Object.getOwnPropertyDescriptor) {
+    var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
+                         "non-object: ";
+    Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
+        if ((typeof object != "object" && typeof object != "function") || object === null)
+            throw new TypeError(ERR_NON_OBJECT + object);
+        // If object does not owns property return undefined immediately.
+        if (!owns(object, property))
+            return;
+
+        var descriptor, getter, setter;
+
+        // If object has a property then it's for sure both `enumerable` and
+        // `configurable`.
+        descriptor =  { enumerable: true, configurable: true };
+
+        // If JS engine supports accessor properties then property may be a
+        // getter or setter.
+        if (supportsAccessors) {
+            // Unfortunately `__lookupGetter__` will return a getter even
+            // if object has own non getter property along with a same named
+            // inherited getter. To avoid misbehavior we temporary remove
+            // `__proto__` so that `__lookupGetter__` will return getter only
+            // if it's owned by an object.
+            var prototype = object.__proto__;
+            object.__proto__ = prototypeOfObject;
+
+            var getter = lookupGetter(object, property);
+            var setter = lookupSetter(object, property);
+
+            // Once we have getter and setter we can put values back.
+            object.__proto__ = prototype;
+
+            if (getter || setter) {
+                if (getter) descriptor.get = getter;
+                if (setter) descriptor.set = setter;
+
+                // If it was accessor property we're done and return here
+                // in order to avoid adding `value` to the descriptor.
+                return descriptor;
+            }
+        }
+
+        // If we got this far we know that object has an own property that is
+        // not an accessor so we set it as a value and return descriptor.
+        descriptor.value = object[property];
+        return descriptor;
+    };
+}
+
+// ES5 15.2.3.4
+// http://es5.github.com/#x15.2.3.4
+if (!Object.getOwnPropertyNames) {
+    Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
+        return Object.keys(object);
+    };
+}
+
+// ES5 15.2.3.5
+// http://es5.github.com/#x15.2.3.5
+if (!Object.create) {
+    var createEmpty;
+    if (Object.prototype.__proto__ === null) {
+        createEmpty = function () {
+            return { "__proto__": null };
+        };
+    } else {
+        // In old IE __proto__ can't be used to manually set `null`
+        createEmpty = function () {
+            var empty = {};
+            for (var i in empty)
+                empty[i] = null;
+            empty.constructor =
+            empty.hasOwnProperty =
+            empty.propertyIsEnumerable =
+            empty.isPrototypeOf =
+            empty.toLocaleString =
+            empty.toString =
+            empty.valueOf =
+            empty.__proto__ = null;
+            return empty;
+        }
+    }
+
+    Object.create = function create(prototype, properties) {
+        var object;
+        if (prototype === null) {
+            object = createEmpty();
+        } else {
+            if (typeof prototype != "object")
+                throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
+            var Type = function () {};
+            Type.prototype = prototype;
+            object = new Type();
+            // IE has no built-in implementation of `Object.getPrototypeOf`
+            // neither `__proto__`, but this manually setting `__proto__` will
+            // guarantee that `Object.getPrototypeOf` will work as expected with
+            // objects created using `Object.create`
+            object.__proto__ = prototype;
+        }
+        if (properties !== void 0)
+            Object.defineProperties(object, properties);
+        return object;
+    };
+}
+
+// ES5 15.2.3.6
+// http://es5.github.com/#x15.2.3.6
+
+// Patch for WebKit and IE8 standard mode
+// Designed by hax <hax.github.com>
+// related issue: https://github.com/kriskowal/es5-shim/issues#issue/5
+// IE8 Reference:
+//     http://msdn.microsoft.com/en-us/library/dd282900.aspx
+//     http://msdn.microsoft.com/en-us/library/dd229916.aspx
+// WebKit Bugs:
+//     https://bugs.webkit.org/show_bug.cgi?id=36423
+
+function doesDefinePropertyWork(object) {
+    try {
+        Object.defineProperty(object, "sentinel", {});
+        return "sentinel" in object;
+    } catch (exception) {
+        // returns falsy
+    }
+}
+
+// check whether defineProperty works if it's given. Otherwise,
+// shim partially.
+if (Object.defineProperty) {
+    var definePropertyWorksOnObject = doesDefinePropertyWork({});
+    var definePropertyWorksOnDom = typeof document == "undefined" ||
+        doesDefinePropertyWork(document.createElement("div"));
+    if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
+        var definePropertyFallback = Object.defineProperty;
+    }
+}
+
+if (!Object.defineProperty || definePropertyFallback) {
+    var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
+    var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
+    var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
+                                      "on this javascript engine";
+
+    Object.defineProperty = function defineProperty(object, property, descriptor) {
+        if ((typeof object != "object" && typeof object != "function") || object === null)
+            throw new TypeError(ERR_NON_OBJECT_TARGET + object);
+        if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
+            throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
+
+        // make a valiant attempt to use the real defineProperty
+        // for I8's DOM elements.
+        if (definePropertyFallback) {
+            try {
+                return definePropertyFallback.call(Object, object, property, descriptor);
+            } catch (exception) {
+                // try the shim if the real one doesn't work
+            }
+        }
+
+        // If it's a data property.
+        if (owns(descriptor, "value")) {
+            // fail silently if "writable", "enumerable", or "configurable"
+            // are requested but not supported
+            /*
+            // alternate approach:
+            if ( // can't implement these features; allow false but not true
+                !(owns(descriptor, "writable") ? descriptor.writable : true) ||
+                !(owns(descriptor, "enumerable") ? descriptor.enumerable : true) ||
+                !(owns(descriptor, "configurable") ? descriptor.configurable : true)
+            )
+                throw new RangeError(
+                    "This implementation of Object.defineProperty does not " +
+                    "support configurable, enumerable, or writable."
+                );
+            */
+
+            if (supportsAccessors && (lookupGetter(object, property) ||
+                                      lookupSetter(object, property)))
+            {
+                // As accessors are supported only on engines implementing
+                // `__proto__` we can safely override `__proto__` while defining
+                // a property to make sure that we don't hit an inherited
+                // accessor.
+                var prototype = object.__proto__;
+                object.__proto__ = prototypeOfObject;
+                // Deleting a property anyway since getter / setter may be
+                // defined on object itself.
+                delete object[property];
+                object[property] = descriptor.value;
+                // Setting original `__proto__` back now.
+                object.__proto__ = prototype;
+            } else {
+                object[property] = descriptor.value;
+            }
+        } else {
+            if (!supportsAccessors)
+                throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
+            // If we got that far then getters and setters can be defined !!
+            if (owns(descriptor, "get"))
+                defineGetter(object, property, descriptor.get);
+            if (owns(descriptor, "set"))
+                defineSetter(object, property, descriptor.set);
+        }
+
+        return object;
+    };
+}
+
+// ES5 15.2.3.7
+// http://es5.github.com/#x15.2.3.7
+if (!Object.defineProperties) {
+    Object.defineProperties = function defineProperties(object, properties) {
+        for (var property in properties) {
+            if (owns(properties, property))
+                Object.defineProperty(object, property, properties[property]);
+        }
+        return object;
+    };
+}
+
+// ES5 15.2.3.8
+// http://es5.github.com/#x15.2.3.8
+if (!Object.seal) {
+    Object.seal = function seal(object) {
+        // this is misleading and breaks feature-detection, but
+        // allows "securable" code to "gracefully" degrade to working
+        // but insecure code.
+        return object;
+    };
+}
+
+// ES5 15.2.3.9
+// http://es5.github.com/#x15.2.3.9
+if (!Object.freeze) {
+    Object.freeze = function freeze(object) {
+        // this is misleading and breaks feature-detection, but
+        // allows "securable" code to "gracefully" degrade to working
+        // but insecure code.
+        return object;
+    };
+}
+
+// detect a Rhino bug and patch it
+try {
+    Object.freeze(function () {});
+} catch (exception) {
+    Object.freeze = (function freeze(freezeObject) {
+        return function freeze(object) {
+            if (typeof object == "function") {
+                return object;
+            } else {
+                return freezeObject(object);
+            }
+        };
+    })(Object.freeze);
+}
+
+// ES5 15.2.3.10
+// http://es5.github.com/#x15.2.3.10
+if (!Object.preventExtensions) {
+    Object.preventExtensions = function preventExtensions(object) {
+        // this is misleading and breaks feature-detection, but
+        // allows "securable" code to "gracefully" degrade to working
+        // but insecure code.
+        return object;
+    };
+}
+
+// ES5 15.2.3.11
+// http://es5.github.com/#x15.2.3.11
+if (!Object.isSealed) {
+    Object.isSealed = function isSealed(object) {
+        return false;
+    };
+}
+
+// ES5 15.2.3.12
+// http://es5.github.com/#x15.2.3.12
+if (!Object.isFrozen) {
+    Object.isFrozen = function isFrozen(object) {
+        return false;
+    };
+}
+
+// ES5 15.2.3.13
+// http://es5.github.com/#x15.2.3.13
+if (!Object.isExtensible) {
+    Object.isExtensible = function isExtensible(object) {
+        // 1. If Type(O) is not Object throw a TypeError exception.
+        if (Object(object) === object) {
+            throw new TypeError(); // TODO message
+        }
+        // 2. Return the Boolean value of the [[Extensible]] internal property of O.
+        var name = '';
+        while (owns(object, name)) {
+            name += '?';
+        }
+        object[name] = true;
+        var returnValue = owns(object, name);
+        delete object[name];
+        return returnValue;
+    };
+}
+
+// ES5 15.2.3.14
+// http://es5.github.com/#x15.2.3.14
+if (!Object.keys) {
+    // http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
+    var hasDontEnumBug = true,
+        dontEnums = [
+            "toString",
+            "toLocaleString",
+            "valueOf",
+            "hasOwnProperty",
+            "isPrototypeOf",
+            "propertyIsEnumerable",
+            "constructor"
+        ],
+        dontEnumsLength = dontEnums.length;
+
+    for (var key in {"toString": null}) {
+        hasDontEnumBug = false;
+    }
+
+    Object.keys = function keys(object) {
+
+        if (
+            (typeof object != "object" && typeof object != "function") ||
+            object === null
+        ) {
+            throw new TypeError("Object.keys called on a non-object");
+        }
+
+        var keys = [];
+        for (var name in object) {
+            if (owns(object, name)) {
+                keys.push(name);
+            }
+        }
+
+        if (hasDontEnumBug) {
+            for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
+                var dontEnum = dontEnums[i];
+                if (owns(object, dontEnum)) {
+                    keys.push(dontEnum);
+                }
+            }
+        }
+        return keys;
+    };
+
+}
+
+//
+// most of es5-shim Date section is removed since ace doesn't need it, it is too intrusive and it causes problems for users
+// ====
+//
+
+// ES5 15.9.4.4
+// http://es5.github.com/#x15.9.4.4
+if (!Date.now) {
+    Date.now = function now() {
+        return new Date().getTime();
+    };
+}
+
+
+//
+// String
+// ======
+//
+
+// ES5 15.5.4.20
+// http://es5.github.com/#x15.5.4.20
+var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
+    "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
+    "\u2029\uFEFF";
+if (!String.prototype.trim || ws.trim()) {
+    // http://blog.stevenlevithan.com/archives/faster-trim-javascript
+    // http://perfectionkills.com/whitespace-deviations/
+    ws = "[" + ws + "]";
+    var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
+        trimEndRegexp = new RegExp(ws + ws + "*$");
+    String.prototype.trim = function trim() {
+        return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
+    };
+}
+
+//
+// Util
+// ======
+//
+
+// ES5 9.4
+// http://es5.github.com/#x9.4
+// http://jsperf.com/to-integer
+
+function toInteger(n) {
+    n = +n;
+    if (n !== n) { // isNaN
+        n = 0;
+    } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
+        n = (n > 0 || -1) * Math.floor(Math.abs(n));
+    }
+    return n;
+}
+
+function isPrimitive(input) {
+    var type = typeof input;
+    return (
+        input === null ||
+        type === "undefined" ||
+        type === "boolean" ||
+        type === "number" ||
+        type === "string"
+    );
+}
+
+function toPrimitive(input) {
+    var val, valueOf, toString;
+    if (isPrimitive(input)) {
+        return input;
+    }
+    valueOf = input.valueOf;
+    if (typeof valueOf === "function") {
+        val = valueOf.call(input);
+        if (isPrimitive(val)) {
+            return val;
+        }
+    }
+    toString = input.toString;
+    if (typeof toString === "function") {
+        val = toString.call(input);
+        if (isPrimitive(val)) {
+            return val;
+        }
+    }
+    throw new TypeError();
+}
+
+// ES5 9.9
+// http://es5.github.com/#x9.9
+var toObject = function (o) {
+    if (o == null) { // this matches both null and undefined
+        throw new TypeError("can't convert "+o+" to object");
+    }
+    return Object(o);
+};
+
+});


[12/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/markdown_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/markdown_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/markdown_highlight_rules.js
new file mode 100644
index 0000000..4e07edf
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/markdown_highlight_rules.js
@@ -0,0 +1,219 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
+var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
+
+var escaped = function(ch) {
+    return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*";
+}
+
+function github_embed(tag, prefix) {
+    return { // Github style block
+        token : "support.function",
+        regex : "^```" + tag + "\\s*$",
+        push  : prefix + "start"
+    };
+}
+
+var MarkdownHighlightRules = function() {
+    HtmlHighlightRules.call(this);
+    // regexp must not have capturing parentheses
+    // regexps are ordered -> the first match is used
+
+    this.$rules["start"].unshift({
+        token : "empty_line",
+        regex : '^$',
+        next: "allowBlock"
+    }, { // h1
+        token: "markup.heading.1",
+        regex: "^=+(?=\\s*$)"
+    }, { // h2
+        token: "markup.heading.2",
+        regex: "^\\-+(?=\\s*$)"
+    }, {
+        token : function(value) {
+            return "markup.heading." + value.length;
+        },
+        regex : /^#{1,6}(?=\s*[^ #]|\s+#.)/,
+        next : "header"
+    },
+       github_embed("(?:javascript|js)", "jscode-"),
+       github_embed("xml", "xmlcode-"),
+       github_embed("html", "htmlcode-"),
+       github_embed("css", "csscode-"),
+    { // Github style block
+        token : "support.function",
+        regex : "^```\\s*[a-zA-Z]*(?:{.*?\\})?\\s*$",
+        next  : "githubblock"
+    }, { // block quote
+        token : "string",
+        regex : "^>[ ].+$",
+        next  : "blockquote"
+    }, { // HR * - _
+        token : "constant",
+        regex : "^ {0,2}(?:(?: ?\\* ?){3,}|(?: ?\\- ?){3,}|(?: ?\\_ ?){3,})\\s*$",
+        next: "allowBlock"
+    }, { // list
+        token : "markup.list",
+        regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
+        next  : "listblock-start"
+    }, {
+        include : "basic"
+    });
+
+    this.addRules({
+        "basic" : [{
+            token : "constant.language.escape",
+            regex : /\\[\\`*_{}\[\]()#+\-.!]/
+        }, { // code span `
+            token : "support.function",
+            regex : "(`+)(.*?[^`])(\\1)"
+        }, { // reference
+            token : ["text", "constant", "text", "url", "string", "text"],
+            regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
+        }, { // link by reference
+            token : ["text", "string", "text", "constant", "text"],
+            regex : "(\\[)(" + escaped("]") + ")(\\]\s*\\[)("+ escaped("]") + ")(\\])"
+        }, { // link by url
+            token : ["text", "string", "text", "markup.underline", "string", "text"],
+            regex : "(\\[)(" +                                        // [
+                    escaped("]") +                                    // link text
+                    ")(\\]\\()"+                                      // ](
+                    '((?:[^\\)\\s\\\\]|\\\\.|\\s(?=[^"]))*)' +        // href
+                    '(\\s*"' +  escaped('"') + '"\\s*)?' +            // "title"
+                    "(\\))"                                           // )
+        }, { // strong ** __
+            token : "string",
+            regex : "([*]{2}|[_]{2}(?=\\S))(.*?\\S[*_]*)(\\1)"
+        }, { // emphasis * _
+            token : "string",
+            regex : "([*]|[_](?=\\S))(.*?\\S[*_]*)(\\1)"
+        }, { //
+            token : ["text", "url", "text"],
+            regex : "(<)("+
+                      "(?:https?|ftp|dict):[^'\">\\s]+"+
+                      "|"+
+                      "(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+"+
+                    ")(>)"
+        }],
+
+        // code block
+        "allowBlock": [
+            {token : "support.function", regex : "^ {4}.+", next : "allowBlock"},
+            {token : "empty", regex : "", next : "start"}
+        ],
+
+        "header" : [{
+            regex: "$",
+            next : "start"
+        }, {
+            include: "basic"
+        }, {
+            defaultToken : "heading"
+        } ],
+
+        "listblock-start" : [{
+            token : "support.variable",
+            regex : /(?:\[[ x]\])?/,
+            next  : "listblock"
+        }],
+
+        "listblock" : [ { // Lists only escape on completely blank lines.
+            token : "empty_line",
+            regex : "^$",
+            next  : "start"
+        }, { // list
+            token : "markup.list",
+            regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
+            next  : "listblock-start"
+        }, {
+            include : "basic", noEscape: true
+        }, {
+            defaultToken : "list"
+        } ],
+
+        "blockquote" : [ { // BLockquotes only escape on blank lines.
+            token : "empty_line",
+            regex : "^\\s*$",
+            next  : "start"
+        }, {
+            token : "string",
+            regex : ".+"
+        } ],
+
+        "githubblock" : [ {
+            token : "support.function",
+            regex : "^```",
+            next  : "start"
+        }, {
+            token : "support.function",
+            regex : ".+"
+        } ]
+    });
+
+    this.embedRules(JavaScriptHighlightRules, "jscode-", [{
+       token : "support.function",
+       regex : "^```",
+       next  : "pop"
+    }]);
+
+    this.embedRules(HtmlHighlightRules, "htmlcode-", [{
+       token : "support.function",
+       regex : "^```",
+       next  : "pop"
+    }]);
+
+    this.embedRules(CssHighlightRules, "csscode-", [{
+       token : "support.function",
+       regex : "^```",
+       next  : "pop"
+    }]);
+
+    this.embedRules(XmlHighlightRules, "xmlcode-", [{
+       token : "support.function",
+       regex : "^```",
+       next  : "pop"
+    }]);
+
+    this.normalizeRules();
+};
+oop.inherits(MarkdownHighlightRules, TextHighlightRules);
+
+exports.MarkdownHighlightRules = MarkdownHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/matching_brace_outdent.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/matching_brace_outdent.js b/src/fauxton/assets/js/libs/ace/mode/matching_brace_outdent.js
new file mode 100644
index 0000000..07f4829
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/matching_brace_outdent.js
@@ -0,0 +1,69 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var Range = require("../range").Range;
+
+var MatchingBraceOutdent = function() {};
+
+(function() {
+
+    this.checkOutdent = function(line, input) {
+        if (! /^\s+$/.test(line))
+            return false;
+
+        return /^\s*\}/.test(input);
+    };
+
+    this.autoOutdent = function(doc, row) {
+        var line = doc.getLine(row);
+        var match = line.match(/^(\s*\})/);
+
+        if (!match) return 0;
+
+        var column = match[1].length;
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
+
+        if (!openBracePos || openBracePos.row == row) return 0;
+
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
+        doc.replace(new Range(row, 0, row, column-1), indent);
+    };
+
+    this.$getIndent = function(line) {
+        return line.match(/^\s*/)[0];
+    };
+
+}).call(MatchingBraceOutdent.prototype);
+
+exports.MatchingBraceOutdent = MatchingBraceOutdent;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/matching_parens_outdent.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/matching_parens_outdent.js b/src/fauxton/assets/js/libs/ace/mode/matching_parens_outdent.js
new file mode 100644
index 0000000..0aadf6e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/matching_parens_outdent.js
@@ -0,0 +1,74 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var Range = require("../range").Range;
+
+var MatchingParensOutdent = function() {};
+
+(function() {
+
+    this.checkOutdent = function(line, input) {
+        if (! /^\s+$/.test(line))
+            return false;
+
+        return /^\s*\)/.test(input);
+    };
+
+    this.autoOutdent = function(doc, row) {
+        var line = doc.getLine(row);
+        var match = line.match(/^(\s*\))/);
+
+        if (!match) return 0;
+
+        var column = match[1].length;
+        var openBracePos = doc.findMatchingBracket({row: row, column: column});
+
+        if (!openBracePos || openBracePos.row == row) return 0;
+
+        var indent = this.$getIndent(doc.getLine(openBracePos.row));
+        doc.replace(new Range(row, 0, row, column-1), indent);
+    };
+
+    this.$getIndent = function(line) {
+        var match = line.match(/^(\s+)/);
+        if (match) {
+            return match[1];
+        }
+
+        return "";
+    };
+
+}).call(MatchingParensOutdent.prototype);
+
+exports.MatchingParensOutdent = MatchingParensOutdent;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/matlab.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/matlab.js b/src/fauxton/assets/js/libs/ace/mode/matlab.js
new file mode 100644
index 0000000..ca56b44
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/matlab.js
@@ -0,0 +1,55 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var MatlabHighlightRules = require("./matlab_highlight_rules").MatlabHighlightRules;
+var Range = require("../range").Range;
+
+var Mode = function() {
+    this.HighlightRules = MatlabHighlightRules;
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = "%";
+    this.blockComment = {start: "%{", end: "%}"};
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+
+});
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/matlab_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/matlab_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/matlab_highlight_rules.js
new file mode 100644
index 0000000..6194292
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/matlab_highlight_rules.js
@@ -0,0 +1,204 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var MatlabHighlightRules = function() {
+
+var keywords = (
+        "break|case|catch|classdef|continue|else|elseif|end|for|function|global|if|otherwise|parfor|persistent|return|spmd|switch|try|while"
+    );
+
+    var builtinConstants = (
+        "true|false|inf|Inf|nan|NaN|eps|pi|ans|nargin|nargout|varargin|varargout"
+    );
+
+    var builtinFunctions = (
+        "abs|accumarray|acos(?:d|h)?|acot(?:d|h)?|acsc(?:d|h)?|actxcontrol(?:list|select)?|actxGetRunningServer|actxserver|addlistener|addpath|addpref|addtodate|"+
+		"airy|align|alim|all|allchild|alpha|alphamap|amd|ancestor|and|angle|annotation|any|area|arrayfun|asec(?:d|h)?|asin(?:d|h)?|assert|assignin|atan(?:2|d|h)?|" +
+		"audiodevinfo|audioplayer|audiorecorder|aufinfo|auread|autumn|auwrite|avifile|aviinfo|aviread|axes|axis|balance|bar(?:3|3h|h)?|base2dec|beep|BeginInvoke|bench|"+
+		"bessel(?:h|i|j|k|y)|beta|betainc|betaincinv|betaln|bicg|bicgstab|bicgstabl|bin2dec|bitand|bitcmp|bitget|bitmax|bitnot|bitor|bitset|bitshift|bitxor|blanks|blkdiag|"+
+		"bone|box|brighten|brush|bsxfun|builddocsearchdb|builtin|bvp4c|bvp5c|bvpget|bvpinit|bvpset|bvpxtend|calendar|calllib|callSoapService|camdolly|cameratoolbar|camlight|"+
+		"camlookat|camorbit|campan|campos|camproj|camroll|camtarget|camup|camva|camzoom|cart2pol|cart2sph|cast|cat|caxis|cd|cdf2rdf|cdfepoch|cdfinfo|cdflib(?:\.(?:close|closeVar|"+
+		"computeEpoch|computeEpoch16|create|createAttr|createVar|delete|deleteAttr|deleteAttrEntry|deleteAttrgEntry|deleteVar|deleteVarRecords|epoch16Breakdown|epochBreakdown|getAttrEntry|"+
+		"getAttrgEntry|getAttrMaxEntry|getAttrMaxgEntry|getAttrName|getAttrNum|getAttrScope|getCacheSize|getChecksum|getCompression|getCompressionCacheSize|getConstantNames|"+
+		"getConstantValue|getCopyright|getFileBackward|getFormat|getLibraryCopyright|getLibraryVersion|getMajority|getName|getNumAttrEntries|getNumAttrgEntries|getNumAttributes|"+
+		"getNumgAttributes|getReadOnlyMode|getStageCacheSize|getValidate|getVarAllocRecords|getVarBlockingFactor|getVarCacheSize|getVarCompression|getVarData|getVarMaxAllocRecNum|"+
+		"getVarMaxWrittenRecNum|getVarName|getVarNum|getVarNumRecsWritten|getVarPadValue|getVarRecordData|getVarReservePercent|getVarsMaxWrittenRecNum|getVarSparseRecords|getVersion|"+
+		"hyperGetVarData|hyperPutVarData|inquire|inquireAttr|inquireAttrEntry|inquireAttrgEntry|inquireVar|open|putAttrEntry|putAttrgEntry|putVarData|putVarRecordData|renameAttr|"+
+		"renameVar|setCacheSize|setChecksum|setCompression|setCompressionCacheSize|setFileBackward|setFormat|setMajority|setReadOnlyMode|setStageCacheSize|setValidate|"+
+		"setVarAllocBlockRecords|setVarBlockingFactor|setVarCacheSize|setVarCompression|setVarInitialRecs|setVarPadValue|SetVarReservePercent|setVarsCacheSize|setVarSparseRecords))?|"+
+		"cdfread|cdfwrite|ceil|cell2mat|cell2struct|celldisp|cellfun|cellplot|cellstr|cgs|checkcode|checkin|checkout|chol|cholinc|cholupdate|circshift|cla|clabel|class|clc|clear|"+
+		"clearvars|clf|clipboard|clock|close|closereq|cmopts|cmpermute|cmunique|colamd|colon|colorbar|colordef|colormap|colormapeditor|colperm|Combine|comet|comet3|commandhistory|"+
+		"commandwindow|compan|compass|complex|computer|cond|condeig|condest|coneplot|conj|containers\.Map|contour(?:3|c|f|slice)?|contrast|conv|conv2|convhull|convhulln|convn|cool|"+
+		"copper|copyfile|copyobj|corrcoef|cos(?:d|h)?|cot(?:d|h)?|cov|cplxpair|cputime|createClassFromWsdl|createSoapMessage|cross|csc(?:d|h)?|csvread|csvwrite|ctranspose|cumprod|"+
+		"cumsum|cumtrapz|curl|customverctrl|cylinder|daqread|daspect|datacursormode|datatipinfo|date|datenum|datestr|datetick|datevec|dbclear|dbcont|dbdown|dblquad|dbmex|dbquit|"+
+		"dbstack|dbstatus|dbstep|dbstop|dbtype|dbup|dde23|ddeget|ddesd|ddeset|deal|deblank|dec2base|dec2bin|dec2hex|decic|deconv|del2|delaunay|delaunay3|delaunayn|DelaunayTri|delete|"+
+		"demo|depdir|depfun|det|detrend|deval|diag|dialog|diary|diff|diffuse|dir|disp|display|dither|divergence|dlmread|dlmwrite|dmperm|doc|docsearch|dos|dot|dragrect|drawnow|dsearch|"+
+		"dsearchn|dynamicprops|echo|echodemo|edit|eig|eigs|ellipj|ellipke|ellipsoid|empty|enableNETfromNetworkDrive|enableservice|EndInvoke|enumeration|eomday|eq|erf|erfc|erfcinv|"+
+		"erfcx|erfinv|error|errorbar|errordlg|etime|etree|etreeplot|eval|evalc|evalin|event\.(?:EventData|listener|PropertyEvent|proplistener)|exifread|exist|exit|exp|expint|expm|"+
+		"expm1|export2wsdlg|eye|ezcontour|ezcontourf|ezmesh|ezmeshc|ezplot|ezplot3|ezpolar|ezsurf|ezsurfc|factor|factorial|fclose|feather|feature|feof|ferror|feval|fft|fft2|fftn|"+
+		"fftshift|fftw|fgetl|fgets|fieldnames|figure|figurepalette|fileattrib|filebrowser|filemarker|fileparts|fileread|filesep|fill|fill3|filter|filter2|find|findall|findfigs|"+
+		"findobj|findstr|finish|fitsdisp|fitsinfo|fitsread|fitswrite|fix|flag|flipdim|fliplr|flipud|floor|flow|fminbnd|fminsearch|fopen|format|fplot|fprintf|frame2im|fread|freqspace|"+
+		"frewind|fscanf|fseek|ftell|FTP|full|fullfile|func2str|functions|funm|fwrite|fzero|gallery|gamma|gammainc|gammaincinv|gammaln|gca|gcbf|gcbo|gcd|gcf|gco|ge|genpath|genvarname|"+
+		"get|getappdata|getenv|getfield|getframe|getpixelposition|getpref|ginput|gmres|gplot|grabcode|gradient|gray|graymon|grid|griddata(?:3|n)?|griddedInterpolant|gsvd|gt|gtext|"+
+		"guidata|guide|guihandles|gunzip|gzip|h5create|h5disp|h5info|h5read|h5readatt|h5write|h5writeatt|hadamard|handle|hankel|hdf|hdf5|hdf5info|hdf5read|hdf5write|hdfinfo|"+
+		"hdfread|hdftool|help|helpbrowser|helpdesk|helpdlg|helpwin|hess|hex2dec|hex2num|hgexport|hggroup|hgload|hgsave|hgsetget|hgtransform|hidden|hilb|hist|histc|hold|home|horzcat|"+
+		"hostid|hot|hsv|hsv2rgb|hypot|ichol|idivide|ifft|ifft2|ifftn|ifftshift|ilu|im2frame|im2java|imag|image|imagesc|imapprox|imfinfo|imformats|import|importdata|imread|imwrite|"+
+		"ind2rgb|ind2sub|inferiorto|info|inline|inmem|inpolygon|input|inputdlg|inputname|inputParser|inspect|instrcallback|instrfind|instrfindall|int2str|integral(?:2|3)?|interp(?:1|"+
+		"1q|2|3|ft|n)|interpstreamspeed|intersect|intmax|intmin|inv|invhilb|ipermute|isa|isappdata|iscell|iscellstr|ischar|iscolumn|isdir|isempty|isequal|isequaln|isequalwithequalnans|"+
+		"isfield|isfinite|isfloat|isglobal|ishandle|ishghandle|ishold|isinf|isinteger|isjava|iskeyword|isletter|islogical|ismac|ismatrix|ismember|ismethod|isnan|isnumeric|isobject|"+
+		"isocaps|isocolors|isonormals|isosurface|ispc|ispref|isprime|isprop|isreal|isrow|isscalar|issorted|isspace|issparse|isstr|isstrprop|isstruct|isstudent|isunix|isvarname|"+
+		"isvector|javaaddpath|javaArray|javachk|javaclasspath|javacomponent|javaMethod|javaMethodEDT|javaObject|javaObjectEDT|javarmpath|jet|keyboard|kron|lasterr|lasterror|"+
+		"lastwarn|lcm|ldivide|ldl|le|legend|legendre|length|libfunctions|libfunctionsview|libisloaded|libpointer|libstruct|license|light|lightangle|lighting|lin2mu|line|lines|"+
+		"linkaxes|linkdata|linkprop|linsolve|linspace|listdlg|listfonts|load|loadlibrary|loadobj|log|log10|log1p|log2|loglog|logm|logspace|lookfor|lower|ls|lscov|lsqnonneg|lsqr|"+
+		"lt|lu|luinc|magic|makehgtform|mat2cell|mat2str|material|matfile|matlab\.io\.MatFile|matlab\.mixin\.(?:Copyable|Heterogeneous(?:\.getDefaultScalarElement)?)|matlabrc|"+
+		"matlabroot|max|maxNumCompThreads|mean|median|membrane|memmapfile|memory|menu|mesh|meshc|meshgrid|meshz|meta\.(?:class(?:\.fromName)?|DynamicProperty|EnumeratedValue|event|"+
+		"MetaData|method|package(?:\.(?:fromName|getAllPackages))?|property)|metaclass|methods|methodsview|mex(?:\.getCompilerConfigurations)?|MException|mexext|mfilename|min|minres|"+
+		"minus|mislocked|mkdir|mkpp|mldivide|mlint|mlintrpt|mlock|mmfileinfo|mmreader|mod|mode|more|move|movefile|movegui|movie|movie2avi|mpower|mrdivide|msgbox|mtimes|mu2lin|"+
+		"multibandread|multibandwrite|munlock|namelengthmax|nargchk|narginchk|nargoutchk|native2unicode|nccreate|ncdisp|nchoosek|ncinfo|ncread|ncreadatt|ncwrite|ncwriteatt|"+
+		"ncwriteschema|ndgrid|ndims|ne|NET(?:\.(?:addAssembly|Assembly|convertArray|createArray|createGeneric|disableAutoRelease|enableAutoRelease|GenericClass|invokeGenericMethod|"+
+		"NetException|setStaticProperty))?|netcdf\.(?:abort|close|copyAtt|create|defDim|defGrp|defVar|defVarChunking|defVarDeflate|defVarFill|defVarFletcher32|delAtt|endDef|getAtt|"+
+		"getChunkCache|getConstant|getConstantNames|getVar|inq|inqAtt|inqAttID|inqAttName|inqDim|inqDimID|inqDimIDs|inqFormat|inqGrpName|inqGrpNameFull|inqGrpParent|inqGrps|"+
+		"inqLibVers|inqNcid|inqUnlimDims|inqVar|inqVarChunking|inqVarDeflate|inqVarFill|inqVarFletcher32|inqVarID|inqVarIDs|open|putAtt|putVar|reDef|renameAtt|renameDim|renameVar|"+
+		"setChunkCache|setDefaultFormat|setFill|sync)|newplot|nextpow2|nnz|noanimate|nonzeros|norm|normest|not|notebook|now|nthroot|null|num2cell|num2hex|num2str|numel|nzmax|"+
+		"ode(?:113|15i|15s|23|23s|23t|23tb|45)|odeget|odeset|odextend|onCleanup|ones|open|openfig|opengl|openvar|optimget|optimset|or|ordeig|orderfields|ordqz|ordschur|orient|"+
+		"orth|pack|padecoef|pagesetupdlg|pan|pareto|parseSoapResponse|pascal|patch|path|path2rc|pathsep|pathtool|pause|pbaspect|pcg|pchip|pcode|pcolor|pdepe|pdeval|peaks|perl|perms|"+
+		"permute|pie|pink|pinv|planerot|playshow|plot|plot3|plotbrowser|plotedit|plotmatrix|plottools|plotyy|plus|pol2cart|polar|poly|polyarea|polyder|polyeig|polyfit|polyint|polyval|"+
+		"polyvalm|pow2|power|ppval|prefdir|preferences|primes|print|printdlg|printopt|printpreview|prod|profile|profsave|propedit|propertyeditor|psi|publish|PutCharArray|PutFullMatrix|"+
+		"PutWorkspaceData|pwd|qhull|qmr|qr|qrdelete|qrinsert|qrupdate|quad|quad2d|quadgk|quadl|quadv|questdlg|quit|quiver|quiver3|qz|rand|randi|randn|randperm|RandStream(?:\.(?:create|"+
+		"getDefaultStream|getGlobalStream|list|setDefaultStream|setGlobalStream))?|rank|rat|rats|rbbox|rcond|rdivide|readasync|real|reallog|realmax|realmin|realpow|realsqrt|record|"+
+		"rectangle|rectint|recycle|reducepatch|reducevolume|refresh|refreshdata|regexp|regexpi|regexprep|regexptranslate|rehash|rem|Remove|RemoveAll|repmat|reset|reshape|residue|"+
+		"restoredefaultpath|rethrow|rgb2hsv|rgb2ind|rgbplot|ribbon|rmappdata|rmdir|rmfield|rmpath|rmpref|rng|roots|rose|rosser|rot90|rotate|rotate3d|round|rref|rsf2csf|run|save|saveas|"+
+		"saveobj|savepath|scatter|scatter3|schur|sec|secd|sech|selectmoveresize|semilogx|semilogy|sendmail|serial|set|setappdata|setdiff|setenv|setfield|setpixelposition|setpref|setstr|"+
+		"setxor|shading|shg|shiftdim|showplottool|shrinkfaces|sign|sin(?:d|h)?|size|slice|smooth3|snapnow|sort|sortrows|sound|soundsc|spalloc|spaugment|spconvert|spdiags|specular|speye|"+
+		"spfun|sph2cart|sphere|spinmap|spline|spones|spparms|sprand|sprandn|sprandsym|sprank|spring|sprintf|spy|sqrt|sqrtm|squeeze|ss2tf|sscanf|stairs|startup|std|stem|stem3|stopasync|"+
+		"str2double|str2func|str2mat|str2num|strcat|strcmp|strcmpi|stream2|stream3|streamline|streamparticles|streamribbon|streamslice|streamtube|strfind|strjust|strmatch|strncmp|"+
+		"strncmpi|strread|strrep|strtok|strtrim|struct2cell|structfun|strvcat|sub2ind|subplot|subsasgn|subsindex|subspace|subsref|substruct|subvolume|sum|summer|superclasses|superiorto|"+
+		"support|surf|surf2patch|surface|surfc|surfl|surfnorm|svd|svds|swapbytes|symamd|symbfact|symmlq|symrcm|symvar|system|tan(?:d|h)?|tar|tempdir|tempname|tetramesh|texlabel|text|"+
+		"textread|textscan|textwrap|tfqmr|throw|tic|Tiff(?:\.(?:getTagNames|getVersion))?|timer|timerfind|timerfindall|times|timeseries|title|toc|todatenum|toeplitz|toolboxdir|trace|"+
+		"transpose|trapz|treelayout|treeplot|tril|trimesh|triplequad|triplot|TriRep|TriScatteredInterp|trisurf|triu|tscollection|tsearch|tsearchn|tstool|type|typecast|uibuttongroup|"+
+		"uicontextmenu|uicontrol|uigetdir|uigetfile|uigetpref|uiimport|uimenu|uiopen|uipanel|uipushtool|uiputfile|uiresume|uisave|uisetcolor|uisetfont|uisetpref|uistack|uitable|"+
+		"uitoggletool|uitoolbar|uiwait|uminus|undocheckout|unicode2native|union|unique|unix|unloadlibrary|unmesh|unmkpp|untar|unwrap|unzip|uplus|upper|urlread|urlwrite|usejava|"+
+		"userpath|validateattributes|validatestring|vander|var|vectorize|ver|verctrl|verLessThan|version|vertcat|VideoReader(?:\.isPlatformSupported)?|VideoWriter(?:\.getProfiles)?|"+
+		"view|viewmtx|visdiff|volumebounds|voronoi|voronoin|wait|waitbar|waitfor|waitforbuttonpress|warndlg|warning|waterfall|wavfinfo|wavplay|wavread|wavrecord|wavwrite|web|weekday|"+
+		"what|whatsnew|which|whitebg|who|whos|wilkinson|winopen|winqueryreg|winter|wk1finfo|wk1read|wk1write|workspace|xlabel|xlim|xlsfinfo|xlsread|xlswrite|xmlread|xmlwrite|xor|xslt|"+
+		"ylabel|ylim|zeros|zip|zlabel|zlim|zoom|addedvarplot|andrewsplot|anova(?:1|2|n)|ansaribradley|aoctool|barttest|bbdesign|beta(?:cdf|fit|inv|like|pdf|rnd|stat)|bino(?:cdf|fit|inv|"+
+		"pdf|rnd|stat)|biplot|bootci|bootstrp|boxplot|candexch|candgen|canoncorr|capability|capaplot|caseread|casewrite|categorical|ccdesign|cdfplot|chi2(?:cdf|gof|inv|pdf|rnd|stat)|"+
+		"cholcov|Classification(?:BaggedEnsemble|Discriminant(?:\.(?:fit|make|template))?|Ensemble|KNN(?:\.(?:fit|template))?|PartitionedEnsemble|PartitionedModel|Tree(?:\.(?:fit|"+
+		"template))?)|classify|classregtree|cluster|clusterdata|cmdscale|combnk|Compact(?:Classification(?:Discriminant|Ensemble|Tree)|Regression(?:Ensemble|Tree)|TreeBagger)|confusionmat|"+
+		"controlchart|controlrules|cophenet|copula(?:cdf|fit|param|pdf|rnd|stat)|cordexch|corr|corrcov|coxphfit|createns|crosstab|crossval|cvpartition|datasample|dataset|daugment|dcovary|"+
+		"dendrogram|dfittool|disttool|dummyvar|dwtest|ecdf|ecdfhist|ev(?:cdf|fit|inv|like|pdf|rnd|stat)|ExhaustiveSearcher|exp(?:cdf|fit|inv|like|pdf|rnd|stat)|factoran|fcdf|ff2n|finv|"+
+		"fitdist|fitensemble|fpdf|fracfact|fracfactgen|friedman|frnd|fstat|fsurfht|fullfact|gagerr|gam(?:cdf|fit|inv|like|pdf|rnd|stat)|GeneralizedLinearModel(?:\.fit)?|geo(?:cdf|inv|mean|"+
+		"pdf|rnd|stat)|gev(?:cdf|fit|inv|like|pdf|rnd|stat)|gline|glmfit|glmval|glyphplot|gmdistribution(?:\.fit)?|gname|gp(?:cdf|fit|inv|like|pdf|rnd|stat)|gplotmatrix|grp2idx|grpstats|"+
+		"gscatter|haltonset|harmmean|hist3|histfit|hmm(?:decode|estimate|generate|train|viterbi)|hougen|hyge(?:cdf|inv|pdf|rnd|stat)|icdf|inconsistent|interactionplot|invpred|iqr|iwishrnd|"+
+		"jackknife|jbtest|johnsrnd|KDTreeSearcher|kmeans|knnsearch|kruskalwallis|ksdensity|kstest|kstest2|kurtosis|lasso|lassoglm|lassoPlot|leverage|lhsdesign|lhsnorm|lillietest|"+
+		"LinearModel(?:\.fit)?|linhyptest|linkage|logn(?:cdf|fit|inv|like|pdf|rnd|stat)|lsline|mad|mahal|maineffectsplot|manova1|manovacluster|mdscale|mhsample|mle|mlecov|mnpdf|"+
+		"mnrfit|mnrnd|mnrval|moment|multcompare|multivarichart|mvn(?:cdf|pdf|rnd)|mvregress|mvregresslike|mvt(?:cdf|pdf|rnd)|NaiveBayes(?:\.fit)?|nan(?:cov|max|mean|median|min|std|"+
+		"sum|var)|nbin(?:cdf|fit|inv|pdf|rnd|stat)|ncf(?:cdf|inv|pdf|rnd|stat)|nct(?:cdf|inv|pdf|rnd|stat)|ncx2(?:cdf|inv|pdf|rnd|stat)|NeighborSearcher|nlinfit|nlintool|nlmefit|nlmefitsa|"+
+		"nlparci|nlpredci|nnmf|nominal|NonLinearModel(?:\.fit)?|norm(?:cdf|fit|inv|like|pdf|rnd|stat)|normplot|normspec|ordinal|outlierMeasure|parallelcoords|paretotails|partialcorr|"+
+		"pcacov|pcares|pdf|pdist|pdist2|pearsrnd|perfcurve|perms|piecewisedistribution|plsregress|poiss(?:cdf|fit|inv|pdf|rnd|tat)|polyconf|polytool|prctile|princomp|ProbDist(?:Kernel|"+
+		"Parametric|UnivKernel|UnivParam)?|probplot|procrustes|qqplot|qrandset|qrandstream|quantile|randg|random|randsample|randtool|range|rangesearch|ranksum|rayl(?:cdf|fit|inv|pdf|"+
+		"rnd|stat)|rcoplot|refcurve|refline|regress|Regression(?:BaggedEnsemble|Ensemble|PartitionedEnsemble|PartitionedModel|Tree(?:\.(?:fit|template))?)|regstats|relieff|ridge|"+
+		"robustdemo|robustfit|rotatefactors|rowexch|rsmdemo|rstool|runstest|sampsizepwr|scatterhist|sequentialfs|signrank|signtest|silhouette|skewness|slicesample|sobolset|squareform|"+
+		"statget|statset|stepwise|stepwisefit|surfht|tabulate|tblread|tblwrite|tcdf|tdfread|tiedrank|tinv|tpdf|TreeBagger|treedisp|treefit|treeprune|treetest|treeval|trimmean|trnd|tstat|"+
+		"ttest|ttest2|unid(?:cdf|inv|pdf|rnd|stat)|unif(?:cdf|inv|it|pdf|rnd|stat)|vartest(?:2|n)?|wbl(?:cdf|fit|inv|like|pdf|rnd|stat)|wblplot|wishrnd|x2fx|xptread|zscore|ztest"+
+		"adapthisteq|analyze75info|analyze75read|applycform|applylut|axes2pix|bestblk|blockproc|bwarea|bwareaopen|bwboundaries|bwconncomp|bwconvhull|bwdist|bwdistgeodesic|bweuler|"+
+		"bwhitmiss|bwlabel|bwlabeln|bwmorph|bwpack|bwperim|bwselect|bwtraceboundary|bwulterode|bwunpack|checkerboard|col2im|colfilt|conndef|convmtx2|corner|cornermetric|corr2|cp2tform|"+
+		"cpcorr|cpselect|cpstruct2pairs|dct2|dctmtx|deconvblind|deconvlucy|deconvreg|deconvwnr|decorrstretch|demosaic|dicom(?:anon|dict|info|lookup|read|uid|write)|edge|edgetaper|entropy|"+
+		"entropyfilt|fan2para|fanbeam|findbounds|fliptform|freqz2|fsamp2|fspecial|ftrans2|fwind1|fwind2|getheight|getimage|getimagemodel|getline|getneighbors|getnhood|getpts|"+
+		"getrangefromclass|getrect|getsequence|gray2ind|graycomatrix|graycoprops|graydist|grayslice|graythresh|hdrread|hdrwrite|histeq|hough|houghlines|houghpeaks|iccfind|iccread|"+
+		"iccroot|iccwrite|idct2|ifanbeam|im2bw|im2col|im2double|im2int16|im2java2d|im2single|im2uint16|im2uint8|imabsdiff|imadd|imadjust|ImageAdapter|imageinfo|imagemodel|imapplymatrix|"+
+		"imattributes|imbothat|imclearborder|imclose|imcolormaptool|imcomplement|imcontour|imcontrast|imcrop|imdilate|imdisplayrange|imdistline|imdivide|imellipse|imerode|imextendedmax|"+
+		"imextendedmin|imfill|imfilter|imfindcircles|imfreehand|imfuse|imgca|imgcf|imgetfile|imhandles|imhist|imhmax|imhmin|imimposemin|imlincomb|imline|immagbox|immovie|immultiply|imnoise|"+
+		"imopen|imoverview|imoverviewpanel|impixel|impixelinfo|impixelinfoval|impixelregion|impixelregionpanel|implay|impoint|impoly|impositionrect|improfile|imputfile|impyramid|"+
+		"imreconstruct|imrect|imregconfig|imregionalmax|imregionalmin|imregister|imresize|imroi|imrotate|imsave|imscrollpanel|imshow|imshowpair|imsubtract|imtool|imtophat|imtransform|"+
+		"imview|ind2gray|ind2rgb|interfileinfo|interfileread|intlut|ippl|iptaddcallback|iptcheckconn|iptcheckhandle|iptcheckinput|iptcheckmap|iptchecknargin|iptcheckstrs|iptdemos|iptgetapi|"+
+		"iptGetPointerBehavior|iptgetpref|ipticondir|iptnum2ordinal|iptPointerManager|iptprefs|iptremovecallback|iptSetPointerBehavior|iptsetpref|iptwindowalign|iradon|isbw|isflat|isgray|"+
+		"isicc|isind|isnitf|isrgb|isrset|lab2double|lab2uint16|lab2uint8|label2rgb|labelmatrix|makecform|makeConstrainToRectFcn|makehdr|makelut|makeresampler|maketform|mat2gray|mean2|"+
+		"medfilt2|montage|nitfinfo|nitfread|nlfilter|normxcorr2|ntsc2rgb|openrset|ordfilt2|otf2psf|padarray|para2fan|phantom|poly2mask|psf2otf|qtdecomp|qtgetblk|qtsetblk|radon|rangefilt|"+
+		"reflect|regionprops|registration\.metric\.(?:MattesMutualInformation|MeanSquares)|registration\.optimizer\.(?:OnePlusOneEvolutionary|RegularStepGradientDescent)|rgb2gray|"+
+		"rgb2ntsc|rgb2ycbcr|roicolor|roifill|roifilt2|roipoly|rsetwrite|std2|stdfilt|strel|stretchlim|subimage|tformarray|tformfwd|tforminv|tonemap|translate|truesize|uintlut|viscircles|"+
+		"warp|watershed|whitepoint|wiener2|xyz2double|xyz2uint16|ycbcr2rgb|bintprog|color|fgoalattain|fminbnd|fmincon|fminimax|fminsearch|fminunc|fseminf|fsolve|fzero|fzmult|gangstr|ktrlink|"+
+		"linprog|lsqcurvefit|lsqlin|lsqnonlin|lsqnonneg|optimget|optimset|optimtool|quadprog"
+    );
+    var storageType = (
+        "cell|struct|char|double|single|logical|u?int(?:8|16|32|64)|sparse"
+    );
+    var keywordMapper = this.createKeywordMapper({
+        "storage.type": storageType,
+        "support.function": builtinFunctions,
+        "keyword": keywords,
+        "constant.language": builtinConstants
+    }, "identifier", true);
+
+    this.$rules = {
+        "start" : [ {
+            token : "comment",
+            regex : "^%[^\r\n]*"
+        }, {
+             token : "string",           // " string
+            regex : '".*?"'
+        }, {
+            token : "string",           // ' string
+            regex : "'.*?'"
+        }, {
+            token : "constant.numeric", // float
+            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+        }, {
+            token : keywordMapper,
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        }, {
+            token : "keyword.operator",
+            regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
+        }, {
+             token : "punctuation.operator",
+             regex : "\\?|\\:|\\,|\\;|\\."
+        }, {
+            token : "paren.lparen",
+            regex : "[\\(]"
+        }, {
+            token : "paren.rparen",
+            regex : "[\\)]"
+        }, {
+            token : "text",
+            regex : "\\s+"
+        } ]
+    };
+};
+
+oop.inherits(MatlabHighlightRules, TextHighlightRules);
+
+exports.MatlabHighlightRules = MatlabHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/mushcode.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/mushcode.js b/src/fauxton/assets/js/libs/ace/mode/mushcode.js
new file mode 100644
index 0000000..bdaeeb4
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/mushcode.js
@@ -0,0 +1,116 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var MushCodeRules = require("./mushcode_high_rules").MushCodeRules;
+var PythonFoldMode = require("./folding/pythonic").FoldMode;
+var Range = require("../range").Range;
+
+var Mode = function() {
+    this.HighlightRules = MushCodeRules;
+    this.foldingRules = new PythonFoldMode("\\:");
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = "#";
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+
+        if (state == "start") {
+            var match = line.match(/^.*[\{\(\[\:]\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        }
+
+        return indent;
+    };
+
+   var outdents = {
+        "pass": 1,
+        "return": 1,
+        "raise": 1,
+        "break": 1,
+        "continue": 1
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        if (input !== "\r\n" && input !== "\r" && input !== "\n")
+            return false;
+
+        var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
+
+        if (!tokens)
+            return false;
+
+        // ignore trailing comments
+        do {
+            var last = tokens.pop();
+        } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
+
+        if (!last)
+            return false;
+
+        return (last.type == "keyword" && outdents[last.value]);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        // outdenting in python is slightly different because it always applies
+        // to the next line and only of a new line is inserted
+
+        row += 1;
+        var indent = this.$getIndent(doc.getLine(row));
+        var tab = doc.getTabString();
+        if (indent.slice(-tab.length) == tab)
+            doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
+
+
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/mushcode_high_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/mushcode_high_rules.js b/src/fauxton/assets/js/libs/ace/mode/mushcode_high_rules.js
new file mode 100644
index 0000000..e3197be
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/mushcode_high_rules.js
@@ -0,0 +1,569 @@
+/*
+ * MUSHCodeMode
+ */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var MushCodeRules = function() {
+
+
+    var keywords = (
+ "@if|"+
+ "@ifelse|"+
+ "@switch|"+
+ "@halt|"+
+ "@dolist|"+
+ "@create|"+
+ "@scent|"+
+ "@sound|"+
+ "@touch|"+
+ "@ataste|"+
+ "@osound|"+
+ "@ahear|"+
+ "@aahear|"+
+ "@amhear|"+
+ "@otouch|"+
+ "@otaste|"+
+ "@drop|"+
+ "@odrop|"+
+ "@adrop|"+
+ "@dropfail|"+
+ "@odropfail|"+
+ "@smell|"+
+ "@oemit|"+
+ "@emit|"+
+ "@pemit|"+
+ "@parent|"+
+ "@clone|"+
+ "@taste|"+
+ "whisper|"+
+ "page|"+
+ "say|"+
+ "pose|"+
+ "semipose|"+
+ "teach|"+
+ "touch|"+
+ "taste|"+
+ "smell|"+
+ "listen|"+
+ "look|"+
+ "move|"+
+ "go|"+
+ "home|"+
+ "follow|"+
+ "unfollow|"+
+ "desert|"+
+ "dismiss|"+
+ "@tel"
+    );
+
+    var builtinConstants = (
+        "=#0"
+    );
+
+    var builtinFunctions = (
+ "default|"+
+ "edefault|"+
+ "eval|"+
+ "get_eval|"+
+ "get|"+
+ "grep|"+
+ "grepi|"+
+ "hasattr|"+
+ "hasattrp|"+
+ "hasattrval|"+
+ "hasattrpval|"+
+ "lattr|"+
+ "nattr|"+
+ "poss|"+
+ "udefault|"+
+ "ufun|"+
+ "u|"+
+ "v|"+
+ "uldefault|"+
+ "xget|"+
+ "zfun|"+
+ "band|"+
+ "bnand|"+
+ "bnot|"+
+ "bor|"+
+ "bxor|"+
+ "shl|"+
+ "shr|"+
+ "and|"+
+ "cand|"+
+ "cor|"+
+ "eq|"+
+ "gt|"+
+ "gte|"+
+ "lt|"+
+ "lte|"+
+ "nand|"+
+ "neq|"+
+ "nor|"+
+ "not|"+
+ "or|"+
+ "t|"+
+ "xor|"+
+ "con|"+
+ "entrances|"+
+ "exit|"+
+ "followers|"+
+ "home|"+
+ "lcon|"+
+ "lexits|"+
+ "loc|"+
+ "locate|"+
+ "lparent|"+
+ "lsearch|"+
+ "next|"+
+ "num|"+
+ "owner|"+
+ "parent|"+
+ "pmatch|"+
+ "rloc|"+
+ "rnum|"+
+ "room|"+
+ "where|"+
+ "zone|"+
+ "worn|"+
+ "held|"+
+ "carried|"+
+ "acos|"+
+ "asin|"+
+ "atan|"+
+ "ceil|"+
+ "cos|"+
+ "e|"+
+ "exp|"+
+ "fdiv|"+
+ "fmod|"+
+ "floor|"+
+ "log|"+
+ "ln|"+
+ "pi|"+
+ "power|"+
+ "round|"+
+ "sin|"+
+ "sqrt|"+
+ "tan|"+
+ "aposs|"+
+ "andflags|"+
+ "conn|"+
+ "commandssent|"+
+ "controls|"+
+ "doing|"+
+ "elock|"+
+ "findable|"+
+ "flags|"+
+ "fullname|"+
+ "hasflag|"+
+ "haspower|"+
+ "hastype|"+
+ "hidden|"+
+ "idle|"+
+ "isbaker|"+
+ "lock|"+
+ "lstats|"+
+ "money|"+
+ "who|"+
+ "name|"+
+ "nearby|"+
+ "obj|"+
+ "objflags|"+
+ "photo|"+
+ "poll|"+
+ "powers|"+
+ "pendingtext|"+
+ "receivedtext|"+
+ "restarts|"+
+ "restarttime|"+
+ "subj|"+
+ "shortestpath|"+
+ "tmoney|"+
+ "type|"+
+ "visible|"+
+ "cat|"+
+ "element|"+
+ "elements|"+
+ "extract|"+
+ "filter|"+
+ "filterbool|"+
+ "first|"+
+ "foreach|"+
+ "fold|"+
+ "grab|"+
+ "graball|"+
+ "index|"+
+ "insert|"+
+ "itemize|"+
+ "items|"+
+ "iter|"+
+ "last|"+
+ "ldelete|"+
+ "map|"+
+ "match|"+
+ "matchall|"+
+ "member|"+
+ "mix|"+
+ "munge|"+
+ "pick|"+
+ "remove|"+
+ "replace|"+
+ "rest|"+
+ "revwords|"+
+ "setdiff|"+
+ "setinter|"+
+ "setunion|"+
+ "shuffle|"+
+ "sort|"+
+ "sortby|"+
+ "splice|"+
+ "step|"+
+ "wordpos|"+
+ "words|"+
+ "add|"+
+ "lmath|"+
+ "max|"+
+ "mean|"+
+ "median|"+
+ "min|"+
+ "mul|"+
+ "percent|"+
+ "sign|"+
+ "stddev|"+
+ "sub|"+
+ "val|"+
+ "bound|"+
+ "abs|"+
+ "inc|"+
+ "dec|"+
+ "dist2d|"+
+ "dist3d|"+
+ "div|"+
+ "floordiv|"+
+ "mod|"+
+ "modulo|"+
+ "remainder|"+
+ "vadd|"+
+ "vdim|"+
+ "vdot|"+
+ "vmag|"+
+ "vmax|"+
+ "vmin|"+
+ "vmul|"+
+ "vsub|"+
+ "vunit|"+
+ "regedit|"+
+ "regeditall|"+
+ "regeditalli|"+
+ "regediti|"+
+ "regmatch|"+
+ "regmatchi|"+
+ "regrab|"+
+ "regraball|"+
+ "regraballi|"+
+ "regrabi|"+
+ "regrep|"+
+ "regrepi|"+
+ "after|"+
+ "alphamin|"+
+ "alphamax|"+
+ "art|"+
+ "before|"+
+ "brackets|"+
+ "capstr|"+
+ "case|"+
+ "caseall|"+
+ "center|"+
+ "containsfansi|"+
+ "comp|"+
+ "decompose|"+
+ "decrypt|"+
+ "delete|"+
+ "edit|"+
+ "encrypt|"+
+ "escape|"+
+ "if|"+
+ "ifelse|"+
+ "lcstr|"+
+ "left|"+
+ "lit|"+
+ "ljust|"+
+ "merge|"+
+ "mid|"+
+ "ostrlen|"+
+ "pos|"+
+ "repeat|"+
+ "reverse|"+
+ "right|"+
+ "rjust|"+
+ "scramble|"+
+ "secure|"+
+ "space|"+
+ "spellnum|"+
+ "squish|"+
+ "strcat|"+
+ "strmatch|"+
+ "strinsert|"+
+ "stripansi|"+
+ "stripfansi|"+
+ "strlen|"+
+ "switch|"+
+ "switchall|"+
+ "table|"+
+ "tr|"+
+ "trim|"+
+ "ucstr|"+
+ "unsafe|"+
+ "wrap|"+
+ "ctitle|"+
+ "cwho|"+
+ "channels|"+
+ "clock|"+
+ "cflags|"+
+ "ilev|"+
+ "itext|"+
+ "inum|"+
+ "convsecs|"+
+ "convutcsecs|"+
+ "convtime|"+
+ "ctime|"+
+ "etimefmt|"+
+ "isdaylight|"+
+ "mtime|"+
+ "secs|"+
+ "msecs|"+
+ "starttime|"+
+ "time|"+
+ "timefmt|"+
+ "timestring|"+
+ "utctime|"+
+ "atrlock|"+
+ "clone|"+
+ "create|"+
+ "cook|"+
+ "dig|"+
+ "emit|"+
+ "lemit|"+
+ "link|"+
+ "oemit|"+
+ "open|"+
+ "pemit|"+
+ "remit|"+
+ "set|"+
+ "tel|"+
+ "wipe|"+
+ "zemit|"+
+ "fbcreate|"+
+ "fbdestroy|"+
+ "fbwrite|"+
+ "fbclear|"+
+ "fbcopy|"+
+ "fbcopyto|"+
+ "fbclip|"+
+ "fbdump|"+
+ "fbflush|"+
+ "fbhset|"+
+ "fblist|"+
+ "fbstats|"+
+ "qentries|"+
+ "qentry|"+
+ "play|"+
+ "ansi|"+
+ "break|"+
+ "c|"+
+ "asc|"+
+ "die|"+
+ "isdbref|"+
+ "isint|"+
+ "isnum|"+
+ "isletters|"+
+ "linecoords|"+
+ "localize|"+
+ "lnum|"+
+ "nameshort|"+
+ "null|"+
+ "objeval|"+
+ "r|"+
+ "rand|"+
+ "s|"+
+ "setq|"+
+ "setr|"+
+ "soundex|"+
+ "soundslike|"+
+ "valid|"+
+ "vchart|"+
+ "vchart2|"+
+ "vlabel|"+
+ "@@|"+
+ "bakerdays|"+
+ "bodybuild|"+
+ "box|"+
+ "capall|"+
+ "catalog|"+
+ "children|"+
+ "ctrailer|"+
+ "darttime|"+
+ "debt|"+
+ "detailbar|"+
+ "exploredroom|"+
+ "fansitoansi|"+
+ "fansitoxansi|"+
+ "fullbar|"+
+ "halfbar|"+
+ "isdarted|"+
+ "isnewbie|"+
+ "isword|"+
+ "lambda|"+
+ "lobjects|"+
+ "lplayers|"+
+ "lthings|"+
+ "lvexits|"+
+ "lvobjects|"+
+ "lvplayers|"+
+ "lvthings|"+
+ "newswrap|"+
+ "numsuffix|"+
+ "playerson|"+
+ "playersthisweek|"+
+ "randomad|"+
+ "randword|"+
+ "realrandword|"+
+ "replacechr|"+
+ "second|"+
+ "splitamount|"+
+ "strlenall|"+
+ "text|"+
+ "third|"+
+ "tofansi|"+
+ "totalac|"+
+ "unique|"+
+ "getaddressroom|"+
+ "listpropertycomm|"+
+ "listpropertyres|"+
+ "lotowner|"+
+ "lotrating|"+
+ "lotratingcount|"+
+ "lotvalue|"+
+ "boughtproduct|"+
+ "companyabb|"+
+ "companyicon|"+
+ "companylist|"+
+ "companyname|"+
+ "companyowners|"+
+ "companyvalue|"+
+ "employees|"+
+ "invested|"+
+ "productlist|"+
+ "productname|"+
+ "productowners|"+
+ "productrating|"+
+ "productratingcount|"+
+ "productsoldat|"+
+ "producttype|"+
+ "ratedproduct|"+
+ "soldproduct|"+
+ "topproducts|"+
+ "totalspentonproduct|"+
+ "totalstock|"+
+ "transfermoney|"+
+ "uniquebuyercount|"+
+ "uniqueproductsbought|"+
+ "validcompany|"+
+ "deletepicture|"+
+ "fbsave|"+
+ "getpicturesecurity|"+
+ "haspicture|"+
+ "listpictures|"+
+ "picturesize|"+
+ "replacecolor|"+
+ "rgbtocolor|"+
+ "savepicture|"+
+ "setpicturesecurity|"+
+ "showpicture|"+
+ "piechart|"+
+ "piechartlabel|"+
+ "createmaze|"+
+ "drawmaze|"+
+ "drawwireframe"
+    );
+    var keywordMapper = this.createKeywordMapper({
+        "invalid.deprecated": "debugger",
+        "support.function": builtinFunctions,
+        "constant.language": builtinConstants,
+        "keyword": keywords
+    }, "identifier");
+
+    var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
+
+    var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
+    var octInteger = "(?:0[oO]?[0-7]+)";
+    var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
+    var binInteger = "(?:0[bB][01]+)";
+    var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
+
+    var exponent = "(?:[eE][+-]?\\d+)";
+    var fraction = "(?:\\.\\d+)";
+    var intPart = "(?:\\d+)";
+    var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
+    var exponentFloat = "(?:(?:" + pointFloat + "|" +  intPart + ")" + exponent + ")";
+    var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
+
+    this.$rules = {
+        "start" : [
+         {
+                token : "variable", // mush substitution register
+                regex : "%[0-9]{1}"
+         },
+         {
+                token : "variable", // mush substitution register
+                regex : "%q[0-9A-Za-z]{1}"
+         },
+         {
+                token : "variable", // mush special character register
+                regex : "%[a-zA-Z]{1}"
+         },
+         {
+                token: "variable.language",
+                regex: "%[a-z0-9-_]+"
+         },
+        {
+            token : "constant.numeric", // imaginary
+            regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
+        }, {
+            token : "constant.numeric", // float
+            regex : floatNumber
+        }, {
+            token : "constant.numeric", // long integer
+            regex : integer + "[lL]\\b"
+        }, {
+            token : "constant.numeric", // integer
+            regex : integer + "\\b"
+        }, {
+            token : keywordMapper,
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        }, {
+            token : "keyword.operator",
+            regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|#|%|<<|>>|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
+        }, {
+            token : "paren.lparen",
+            regex : "[\\[\\(\\{]"
+        }, {
+            token : "paren.rparen",
+            regex : "[\\]\\)\\}]"
+        }, {
+            token : "text",
+            regex : "\\s+"
+        } ]
+    };
+};
+
+oop.inherits(MushCodeRules, TextHighlightRules);
+
+exports.MushCodeRules = MushCodeRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/mysql.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/mysql.js b/src/fauxton/assets/js/libs/ace/mode/mysql.js
new file mode 100644
index 0000000..2f9754a
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/mysql.js
@@ -0,0 +1,51 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+
+var oop = require("../lib/oop");
+var TextMode = require("../mode/text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var MysqlHighlightRules = require("./mysql_highlight_rules").MysqlHighlightRules;
+var Range = require("../range").Range;
+
+var Mode = function() {
+    this.HighlightRules = MysqlHighlightRules;
+};
+oop.inherits(Mode, TextMode);
+
+(function() {       
+    this.lineCommentStart = ["--", "#"]; // todo space
+    this.blockComment = {start: "/*", end: "*/"};
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/mysql_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/mysql_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/mysql_highlight_rules.js
new file mode 100644
index 0000000..7f428bc
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/mysql_highlight_rules.js
@@ -0,0 +1,122 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var MysqlHighlightRules = function() {
+
+    var mySqlKeywords = /*sql*/ "alter|and|as|asc|between|count|create|delete|desc|distinct|drop|from|having|in|insert|into|is|join|like|not|on|or|order|select|set|table|union|update|values|where"
+        /*mysql*/ + "|accessible|action|add|after|algorithm|all|analyze|asensitive|at|authors|auto_increment|autocommit|avg|avg_row_length|before|binary|binlog|both|btree|cache|call|cascade|cascaded|case|catalog_name|chain|change|changed|character|check|checkpoint|checksum|class_origin|client_statistics|close|coalesce|code|collate|collation|collations|column|columns|comment|commit|committed|completion|concurrent|condition|connection|consistent|constraint|contains|continue|contributors|convert|cross|current_date|current_time|current_timestamp|current_user|cursor|data|database|databases|day_hour|day_microsecond|day_minute|day_second|deallocate|dec|declare|default|delay_key_write|delayed|delimiter|des_key_file|describe|deterministic|dev_pop|dev_samp|deviance|directory|disable|discard|distinctrow|div|dual|dumpfile|each|elseif|enable|enclosed|end|ends|engine|engines|enum|errors|escape|escaped|even|event|events|every|execute|exists|exit|explain|extended|fast|fetch|field|fields|first|flush
 |for|force|foreign|found_rows|full|fulltext|function|general|global|grant|grants|group|groupby_concat|handler|hash|help|high_priority|hosts|hour_microsecond|hour_minute|hour_second|if|ignore|ignore_server_ids|import|index|index_statistics|infile|inner|innodb|inout|insensitive|insert_method|install|interval|invoker|isolation|iterate|key|keys|kill|language|last|leading|leave|left|level|limit|linear|lines|list|load|local|localtime|localtimestamp|lock|logs|low_priority|master|master_heartbeat_period|master_ssl_verify_server_cert|masters|match|max|max_rows|maxvalue|message_text|middleint|migrate|min|min_rows|minute_microsecond|minute_second|mod|mode|modifies|modify|mutex|mysql_errno|natural|next|no|no_write_to_binlog|offline|offset|one|online|open|optimize|option|optionally|out|outer|outfile|pack_keys|parser|partition|partitions|password|phase|plugin|plugins|prepare|preserve|prev|primary|privileges|procedure|processlist|profile|profiles|purge|query|quick|range|read|read_write|reads|real|
 rebuild|recover|references|regexp|relaylog|release|remove|rename|reorganize|repair|repeatable|replace|require|resignal|restrict|resume|return|returns|revoke|right|rlike|rollback|rollup|row|row_format|rtree|savepoint|schedule|schema|schema_name|schemas|second_microsecond|security|sensitive|separator|serializable|server|session|share|show|signal|slave|slow|smallint|snapshot|soname|spatial|specific|sql|sql_big_result|sql_buffer_result|sql_cache|sql_calc_found_rows|sql_no_cache|sql_small_result|sqlexception|sqlstate|sqlwarning|ssl|start|starting|starts|status|std|stddev|stddev_pop|stddev_samp|storage|straight_join|subclass_origin|sum|suspend|table_name|table_statistics|tables|tablespace|temporary|terminated|to|trailing|transaction|trigger|triggers|truncate|uncommitted|undo|uninstall|unique|unlock|upgrade|usage|use|use_frm|user|user_resources|user_statistics|using|utc_date|utc_time|utc_timestamp|value|variables|varying|view|views|warnings|when|while|with|work|write|xa|xor|year_month|zero
 fill|begin|do|then|else|loop|repeat";
+    var builtins = "by|bool|boolean|bit|blob|decimal|double|enum|float|long|longblob|longtext|medium|mediumblob|mediumint|mediumtext|time|timestamp|tinyblob|tinyint|tinytext|text|bigint|int|int1|int2|int3|int4|int8|integer|float|float4|float8|double|char|varbinary|varchar|varcharacter|precision|date|datetime|year|unsigned|signed|numeric"
+    var variable = "charset|clear|connect|edit|ego|exit|go|help|nopager|notee|nowarning|pager|print|prompt|quit|rehash|source|status|system|tee"
+
+    //operatorChars: /^[*+\-%<>!=&|^]/,
+
+    var keywordMapper = this.createKeywordMapper({
+        "support.function": builtins,
+        "keyword": mySqlKeywords,
+        "constant": "false|true|null|unknown|date|time|timestamp|ODBCdotTable|zerolessFloat",
+        "variable.language": variable
+    }, "identifier", true);
+
+    
+    function string(rule) {
+        var start = rule.start;
+        var escapeSeq = rule.escape;
+        return {
+            token: "string.start",
+            regex: start,
+            next: [
+                {token: "constant.language.escape", regex: escapeSeq},
+                {token: "string.end", next: "start", regex: start},
+                {defaultToken: "string"}
+            ]
+        };
+    }
+
+    this.$rules = {
+        "start" : [ {
+            token : "comment", regex : "(?:-- |#).*$"
+        },  
+        string({start: '"', escape: /\\[0'"bnrtZ\\%_]?/}),
+        string({start: "'", escape: /\\[0'"bnrtZ\\%_]?/}),
+        DocCommentHighlightRules.getStartRule("doc-start"),
+        {
+            token : "comment", // multi line comment
+            regex : /\/\*/,
+            next : "comment"
+        }, {
+            token : "constant.numeric", // hex
+            regex : /0[xX][0-9a-fA-F]+|[xX]'[0-9a-fA-F]+'|0[bB][01]+|[bB]'[01]+'/
+        }, {
+            token : "constant.numeric", // float
+            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+        }, {
+            token : keywordMapper,
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        }, {
+            token : "constant.class",
+            regex : "@@?[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        }, {
+            token : "constant.buildin",
+            regex : "`[^`]*`"
+        }, {
+            token : "keyword.operator",
+            regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
+        }, {
+            token : "paren.lparen",
+            regex : "[\\(]"
+        }, {
+            token : "paren.rparen",
+            regex : "[\\)]"
+        }, {
+            token : "text",
+            regex : "\\s+"
+        } ],
+        "comment" : [
+            {token : "comment", regex : "\\*\\/", next : "start"},
+            {defaultToken : "comment"}
+        ]
+    };
+
+    this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]);
+    this.normalizeRules();
+};
+
+oop.inherits(MysqlHighlightRules, TextHighlightRules);
+
+exports.MysqlHighlightRules = MysqlHighlightRules;
+});
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/nix.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/nix.js b/src/fauxton/assets/js/libs/ace/mode/nix.js
new file mode 100644
index 0000000..a745aca
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/nix.js
@@ -0,0 +1,62 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ * 
+ *    Zef Hemel
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var CMode = require("./c_cpp").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var NixHighlightRules = require("./nix_highlight_rules").NixHighlightRules;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    CMode.call(this);
+    this.HighlightRules = NixHighlightRules;
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, CMode);
+
+(function() { 
+    this.lineCommentStart = "#";
+    this.blockComment = {start: "/*", end: "*/"};
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/nix_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/nix_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/nix_highlight_rules.js
new file mode 100644
index 0000000..986ccef
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/nix_highlight_rules.js
@@ -0,0 +1,119 @@
+define(function(require, exports, module) {
+    "use strict";
+
+    var oop = require("../lib/oop");
+    var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+    var NixHighlightRules = function() {
+
+        var constantLanguage = "true|false";
+        var keywordControl = "with|import|if|else|then|inherit";
+        var keywordDeclaration = "let|in|rec";
+
+        var keywordMapper = this.createKeywordMapper({
+            "constant.language.nix": constantLanguage,
+            "keyword.control.nix": keywordControl,
+            "keyword.declaration.nix": keywordDeclaration
+        }, "identifier");
+
+        this.$rules = {
+            "start": [{
+                    token: "comment",
+                    regex: /#.*$/
+                }, {
+                    token: "comment",
+                    regex: /\/\*/,
+                    next: "comment"
+                }, {
+                    token: "constant",
+                    regex: "<[^>]+>"
+                }, {
+                    regex: "(==|!=|<=?|>=?)",
+                    token: ["keyword.operator.comparison.nix"]
+                }, {
+                    regex: "((?:[+*/%-]|\\~)=)",
+                    token: ["keyword.operator.assignment.arithmetic.nix"]
+                }, {
+                    regex: "=",
+                    token: "keyword.operator.assignment.nix"
+                }, {
+                    token: "string",
+                    regex: "''",
+                    next: "qqdoc"
+                }, {
+                    token: "string",
+                    regex: "'",
+                    next: "qstring"
+                }, {
+                    token: "string",
+                    regex: '"',
+                    push: "qqstring"
+                }, {
+                    token: "constant.numeric", // hex
+                    regex: "0[xX][0-9a-fA-F]+\\b"
+                }, {
+                    token: "constant.numeric", // float
+                    regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+                }, {
+                    token: keywordMapper,
+                    regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+                }, {
+                    regex: "}",
+                    token: function(val, start, stack) {
+                        return stack[1] && stack[1].charAt(0) == "q" ? "constant.language.escape" : "text";
+                    },
+                    next: "pop"
+                }],
+            "comment": [{
+                token: "comment", // closing comment
+                regex: ".*?\\*\\/",
+                next: "start"
+            }, {
+                token: "comment", // comment spanning whole line
+                regex: ".+"
+            }],
+            "qqdoc": [
+                {
+                    token: "constant.language.escape",
+                    regex: /\$\{/,
+                    push: "start"
+                }, {
+                    token: "string",
+                    regex: "''",
+                    next: "pop"
+                }, {
+                    defaultToken: "string"
+                }],
+            "qqstring": [
+                {
+                    token: "constant.language.escape",
+                    regex: /\$\{/,
+                    push: "start"
+                }, {
+                    token: "string",
+                    regex: '"',
+                    next: "pop"
+                }, {
+                    defaultToken: "string"
+                }],
+            "qstring": [
+                {
+                    token: "constant.language.escape",
+                    regex: /\$\{/,
+                    push: "start"
+                }, {
+                    token: "string",
+                    regex: "'",
+                    next: "pop"
+                }, {
+                    defaultToken: "string"
+                }]
+        };
+
+        this.normalizeRules();
+    };
+
+    oop.inherits(NixHighlightRules, TextHighlightRules);
+
+    exports.NixHighlightRules = NixHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/objectivec.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/objectivec.js b/src/fauxton/assets/js/libs/ace/mode/objectivec.js
new file mode 100644
index 0000000..76fdf14
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/objectivec.js
@@ -0,0 +1,61 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ * 
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var ObjectiveCHighlightRules = require("./objectivec_highlight_rules").ObjectiveCHighlightRules;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = ObjectiveCHighlightRules;
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = "//";
+    this.blockComment = {start: "/*", end: "*/"};
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file


[25/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/coffee/parser.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/coffee/parser.js b/src/fauxton/assets/js/libs/ace/mode/coffee/parser.js
new file mode 100644
index 0000000..00d1b72
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/coffee/parser.js
@@ -0,0 +1,724 @@
+/**
+ * Copyright (c) 2009-2013 Jeremy Ashkenas
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ */
+
+define(function(require, exports, module) {
+/* parser generated by jison 0.4.4 */
+/*
+  Returns a Parser object of the following structure:
+
+  Parser: {
+    yy: {}
+  }
+
+  Parser.prototype: {
+    yy: {},
+    trace: function(),
+    symbols_: {associative list: name ==> number},
+    terminals_: {associative list: number ==> name},
+    productions_: [...],
+    performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
+    table: [...],
+    defaultActions: {...},
+    parseError: function(str, hash),
+    parse: function(input),
+
+    lexer: {
+        EOF: 1,
+        parseError: function(str, hash),
+        setInput: function(input),
+        input: function(),
+        unput: function(str),
+        more: function(),
+        less: function(n),
+        pastInput: function(),
+        upcomingInput: function(),
+        showPosition: function(),
+        test_match: function(regex_match_array, rule_index),
+        next: function(),
+        lex: function(),
+        begin: function(condition),
+        popState: function(),
+        _currentRules: function(),
+        topState: function(),
+        pushState: function(condition),
+
+        options: {
+            ranges: boolean           (optional: true ==> token location info will include a .range[] member)
+            flex: boolean             (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
+            backtrack_lexer: boolean  (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
+        },
+
+        performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
+        rules: [...],
+        conditions: {associative list: name ==> set},
+    }
+  }
+
+
+  token location info (@$, _$, etc.): {
+    first_line: n,
+    last_line: n,
+    first_column: n,
+    last_column: n,
+    range: [start_number, end_number]       (where the numbers are indexes into the input string, regular zero-based)
+  }
+
+
+  the parseError function receives a 'hash' object with these members for lexer and parser errors: {
+    text:        (matched text)
+    token:       (the produced terminal token, if any)
+    line:        (yylineno)
+  }
+  while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
+    loc:         (yylloc)
+    expected:    (string describing the set of expected tokens)
+    recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
+  }
+*/
+
+var parser = {trace: function trace() { },
+yy: {},
+symbols_: {"error":2,"Root":3,"Body":4,"Line":5,"TERMINATOR":6,"Expression":7,"Statement":8,"Return":9,"Comment":10,"STATEMENT":11,"Value":12,"Invocation":13,"Code":14,"Operation":15,"Assign":16,"If":17,"Try":18,"While":19,"For":20,"Switch":21,"Class":22,"Throw":23,"Block":24,"INDENT":25,"OUTDENT":26,"Identifier":27,"IDENTIFIER":28,"AlphaNumeric":29,"NUMBER":30,"STRING":31,"Literal":32,"JS":33,"REGEX":34,"DEBUGGER":35,"UNDEFINED":36,"NULL":37,"BOOL":38,"Assignable":39,"=":40,"AssignObj":41,"ObjAssignable":42,":":43,"ThisProperty":44,"RETURN":45,"HERECOMMENT":46,"PARAM_START":47,"ParamList":48,"PARAM_END":49,"FuncGlyph":50,"->":51,"=>":52,"OptComma":53,",":54,"Param":55,"ParamVar":56,"...":57,"Array":58,"Object":59,"Splat":60,"SimpleAssignable":61,"Accessor":62,"Parenthetical":63,"Range":64,"This":65,".":66,"?.":67,"::":68,"?::":69,"Index":70,"INDEX_START":71,"IndexValue":72,"INDEX_END":73,"INDEX_SOAK":74,"Slice":75,"{":76,"AssignList":77,"}":78,"CLASS":79,"EXTENDS":80,"OptFuncExist"
 :81,"Arguments":82,"SUPER":83,"FUNC_EXIST":84,"CALL_START":85,"CALL_END":86,"ArgList":87,"THIS":88,"@":89,"[":90,"]":91,"RangeDots":92,"..":93,"Arg":94,"SimpleArgs":95,"TRY":96,"Catch":97,"FINALLY":98,"CATCH":99,"THROW":100,"(":101,")":102,"WhileSource":103,"WHILE":104,"WHEN":105,"UNTIL":106,"Loop":107,"LOOP":108,"ForBody":109,"FOR":110,"ForStart":111,"ForSource":112,"ForVariables":113,"OWN":114,"ForValue":115,"FORIN":116,"FOROF":117,"BY":118,"SWITCH":119,"Whens":120,"ELSE":121,"When":122,"LEADING_WHEN":123,"IfBlock":124,"IF":125,"POST_IF":126,"UNARY":127,"-":128,"+":129,"--":130,"++":131,"?":132,"MATH":133,"SHIFT":134,"COMPARE":135,"LOGIC":136,"RELATION":137,"COMPOUND_ASSIGN":138,"$accept":0,"$end":1},
+terminals_: {2:"error",6:"TERMINATOR",11:"STATEMENT",25:"INDENT",26:"OUTDENT",28:"IDENTIFIER",30:"NUMBER",31:"STRING",33:"JS",34:"REGEX",35:"DEBUGGER",36:"UNDEFINED",37:"NULL",38:"BOOL",40:"=",43:":",45:"RETURN",46:"HERECOMMENT",47:"PARAM_START",49:"PARAM_END",51:"->",52:"=>",54:",",57:"...",66:".",67:"?.",68:"::",69:"?::",71:"INDEX_START",73:"INDEX_END",74:"INDEX_SOAK",76:"{",78:"}",79:"CLASS",80:"EXTENDS",83:"SUPER",84:"FUNC_EXIST",85:"CALL_START",86:"CALL_END",88:"THIS",89:"@",90:"[",91:"]",93:"..",96:"TRY",98:"FINALLY",99:"CATCH",100:"THROW",101:"(",102:")",104:"WHILE",105:"WHEN",106:"UNTIL",108:"LOOP",110:"FOR",114:"OWN",116:"FORIN",117:"FOROF",118:"BY",119:"SWITCH",121:"ELSE",123:"LEADING_WHEN",125:"IF",126:"POST_IF",127:"UNARY",128:"-",129:"+",130:"--",131:"++",132:"?",133:"MATH",134:"SHIFT",135:"COMPARE",136:"LOGIC",137:"RELATION",138:"COMPOUND_ASSIGN"},
+productions_: [0,[3,0],[3,1],[4,1],[4,3],[4,2],[5,1],[5,1],[8,1],[8,1],[8,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[24,2],[24,3],[27,1],[29,1],[29,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[16,3],[16,4],[16,5],[41,1],[41,3],[41,5],[41,1],[42,1],[42,1],[42,1],[9,2],[9,1],[10,1],[14,5],[14,2],[50,1],[50,1],[53,0],[53,1],[48,0],[48,1],[48,3],[48,4],[48,6],[55,1],[55,2],[55,3],[56,1],[56,1],[56,1],[56,1],[60,2],[61,1],[61,2],[61,2],[61,1],[39,1],[39,1],[39,1],[12,1],[12,1],[12,1],[12,1],[12,1],[62,2],[62,2],[62,2],[62,2],[62,1],[62,1],[70,3],[70,2],[72,1],[72,1],[59,4],[77,0],[77,1],[77,3],[77,4],[77,6],[22,1],[22,2],[22,3],[22,4],[22,2],[22,3],[22,4],[22,5],[13,3],[13,3],[13,1],[13,2],[81,0],[81,1],[82,2],[82,4],[65,1],[65,1],[44,2],[58,2],[58,4],[92,1],[92,1],[64,5],[75,3],[75,2],[75,2],[75,1],[87,1],[87,3],[87,4],[87,4],[87,6],[94,1],[94,1],[95,1],[95,3],[18,2],[18,3],[18,4],[18,5],[97,3],[97,3],[97,2],[23,2],[63,3],[63,5],[103,2],[103,4],[
 103,2],[103,4],[19,2],[19,2],[19,2],[19,1],[107,2],[107,2],[20,2],[20,2],[20,2],[109,2],[109,2],[111,2],[111,3],[115,1],[115,1],[115,1],[115,1],[113,1],[113,3],[112,2],[112,2],[112,4],[112,4],[112,4],[112,6],[112,6],[21,5],[21,7],[21,4],[21,6],[120,1],[120,2],[122,3],[122,4],[124,3],[124,5],[17,1],[17,3],[17,3],[17,3],[15,2],[15,2],[15,2],[15,2],[15,2],[15,2],[15,2],[15,2],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,5],[15,4],[15,3]],
+performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
+/* this == yyval */
+
+var $0 = $$.length - 1;
+switch (yystate) {
+case 1:return this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Block);
+break;
+case 2:return this.$ = $$[$0];
+break;
+case 3:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(yy.Block.wrap([$$[$0]]));
+break;
+case 4:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].push($$[$0]));
+break;
+case 5:this.$ = $$[$0-1];
+break;
+case 6:this.$ = $$[$0];
+break;
+case 7:this.$ = $$[$0];
+break;
+case 8:this.$ = $$[$0];
+break;
+case 9:this.$ = $$[$0];
+break;
+case 10:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
+break;
+case 11:this.$ = $$[$0];
+break;
+case 12:this.$ = $$[$0];
+break;
+case 13:this.$ = $$[$0];
+break;
+case 14:this.$ = $$[$0];
+break;
+case 15:this.$ = $$[$0];
+break;
+case 16:this.$ = $$[$0];
+break;
+case 17:this.$ = $$[$0];
+break;
+case 18:this.$ = $$[$0];
+break;
+case 19:this.$ = $$[$0];
+break;
+case 20:this.$ = $$[$0];
+break;
+case 21:this.$ = $$[$0];
+break;
+case 22:this.$ = $$[$0];
+break;
+case 23:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Block);
+break;
+case 24:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-1]);
+break;
+case 25:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
+break;
+case 26:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
+break;
+case 27:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
+break;
+case 28:this.$ = $$[$0];
+break;
+case 29:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
+break;
+case 30:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
+break;
+case 31:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Literal($$[$0]));
+break;
+case 32:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Undefined);
+break;
+case 33:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Null);
+break;
+case 34:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Bool($$[$0]));
+break;
+case 35:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign($$[$0-2], $$[$0]));
+break;
+case 36:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Assign($$[$0-3], $$[$0]));
+break;
+case 37:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign($$[$0-4], $$[$0-1]));
+break;
+case 38:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
+break;
+case 39:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign(yy.addLocationDataFn(_$[$0-2])(new yy.Value($$[$0-2])), $$[$0], 'object'));
+break;
+case 40:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign(yy.addLocationDataFn(_$[$0-4])(new yy.Value($$[$0-4])), $$[$0-1], 'object'));
+break;
+case 41:this.$ = $$[$0];
+break;
+case 42:this.$ = $$[$0];
+break;
+case 43:this.$ = $$[$0];
+break;
+case 44:this.$ = $$[$0];
+break;
+case 45:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Return($$[$0]));
+break;
+case 46:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Return);
+break;
+case 47:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Comment($$[$0]));
+break;
+case 48:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Code($$[$0-3], $$[$0], $$[$0-1]));
+break;
+case 49:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Code([], $$[$0], $$[$0-1]));
+break;
+case 50:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('func');
+break;
+case 51:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('boundfunc');
+break;
+case 52:this.$ = $$[$0];
+break;
+case 53:this.$ = $$[$0];
+break;
+case 54:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([]);
+break;
+case 55:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]);
+break;
+case 56:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].concat($$[$0]));
+break;
+case 57:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-3].concat($$[$0]));
+break;
+case 58:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])($$[$0-5].concat($$[$0-2]));
+break;
+case 59:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Param($$[$0]));
+break;
+case 60:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Param($$[$0-1], null, true));
+break;
+case 61:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Param($$[$0-2], $$[$0]));
+break;
+case 62:this.$ = $$[$0];
+break;
+case 63:this.$ = $$[$0];
+break;
+case 64:this.$ = $$[$0];
+break;
+case 65:this.$ = $$[$0];
+break;
+case 66:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Splat($$[$0-1]));
+break;
+case 67:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
+break;
+case 68:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].add($$[$0]));
+break;
+case 69:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Value($$[$0-1], [].concat($$[$0])));
+break;
+case 70:this.$ = $$[$0];
+break;
+case 71:this.$ = $$[$0];
+break;
+case 72:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
+break;
+case 73:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
+break;
+case 74:this.$ = $$[$0];
+break;
+case 75:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
+break;
+case 76:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
+break;
+case 77:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
+break;
+case 78:this.$ = $$[$0];
+break;
+case 79:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Access($$[$0]));
+break;
+case 80:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Access($$[$0], 'soak'));
+break;
+case 81:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([yy.addLocationDataFn(_$[$0-1])(new yy.Access(new yy.Literal('prototype'))), yy.addLocationDataFn(_$[$0])(new yy.Access($$[$0]))]);
+break;
+case 82:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([yy.addLocationDataFn(_$[$0-1])(new yy.Access(new yy.Literal('prototype'), 'soak')), yy.addLocationDataFn(_$[$0])(new yy.Access($$[$0]))]);
+break;
+case 83:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Access(new yy.Literal('prototype')));
+break;
+case 84:this.$ = $$[$0];
+break;
+case 85:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-1]);
+break;
+case 86:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(yy.extend($$[$0], {
+          soak: true
+        }));
+break;
+case 87:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Index($$[$0]));
+break;
+case 88:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Slice($$[$0]));
+break;
+case 89:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Obj($$[$0-2], $$[$0-3].generated));
+break;
+case 90:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([]);
+break;
+case 91:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]);
+break;
+case 92:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].concat($$[$0]));
+break;
+case 93:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-3].concat($$[$0]));
+break;
+case 94:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])($$[$0-5].concat($$[$0-2]));
+break;
+case 95:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Class);
+break;
+case 96:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Class(null, null, $$[$0]));
+break;
+case 97:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Class(null, $$[$0]));
+break;
+case 98:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Class(null, $$[$0-1], $$[$0]));
+break;
+case 99:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Class($$[$0]));
+break;
+case 100:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Class($$[$0-1], null, $$[$0]));
+break;
+case 101:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Class($$[$0-2], $$[$0]));
+break;
+case 102:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Class($$[$0-3], $$[$0-1], $$[$0]));
+break;
+case 103:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Call($$[$0-2], $$[$0], $$[$0-1]));
+break;
+case 104:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Call($$[$0-2], $$[$0], $$[$0-1]));
+break;
+case 105:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Call('super', [new yy.Splat(new yy.Literal('arguments'))]));
+break;
+case 106:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Call('super', $$[$0]));
+break;
+case 107:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(false);
+break;
+case 108:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(true);
+break;
+case 109:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([]);
+break;
+case 110:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-2]);
+break;
+case 111:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value(new yy.Literal('this')));
+break;
+case 112:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value(new yy.Literal('this')));
+break;
+case 113:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Value(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('this')), [yy.addLocationDataFn(_$[$0])(new yy.Access($$[$0]))], 'this'));
+break;
+case 114:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Arr([]));
+break;
+case 115:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Arr($$[$0-2]));
+break;
+case 116:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('inclusive');
+break;
+case 117:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])('exclusive');
+break;
+case 118:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Range($$[$0-3], $$[$0-1], $$[$0-2]));
+break;
+case 119:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Range($$[$0-2], $$[$0], $$[$0-1]));
+break;
+case 120:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Range($$[$0-1], null, $$[$0]));
+break;
+case 121:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Range(null, $$[$0], $$[$0-1]));
+break;
+case 122:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Range(null, null, $$[$0]));
+break;
+case 123:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]);
+break;
+case 124:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].concat($$[$0]));
+break;
+case 125:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-3].concat($$[$0]));
+break;
+case 126:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])($$[$0-2]);
+break;
+case 127:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])($$[$0-5].concat($$[$0-2]));
+break;
+case 128:this.$ = $$[$0];
+break;
+case 129:this.$ = $$[$0];
+break;
+case 130:this.$ = $$[$0];
+break;
+case 131:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([].concat($$[$0-2], $$[$0]));
+break;
+case 132:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Try($$[$0]));
+break;
+case 133:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Try($$[$0-1], $$[$0][0], $$[$0][1]));
+break;
+case 134:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Try($$[$0-2], null, null, $$[$0]));
+break;
+case 135:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Try($$[$0-3], $$[$0-2][0], $$[$0-2][1], $$[$0]));
+break;
+case 136:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([$$[$0-1], $$[$0]]);
+break;
+case 137:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([yy.addLocationDataFn(_$[$0-1])(new yy.Value($$[$0-1])), $$[$0]]);
+break;
+case 138:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])([null, $$[$0]]);
+break;
+case 139:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Throw($$[$0]));
+break;
+case 140:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Parens($$[$0-1]));
+break;
+case 141:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Parens($$[$0-2]));
+break;
+case 142:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While($$[$0]));
+break;
+case 143:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.While($$[$0-2], {
+          guard: $$[$0]
+        }));
+break;
+case 144:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While($$[$0], {
+          invert: true
+        }));
+break;
+case 145:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.While($$[$0-2], {
+          invert: true,
+          guard: $$[$0]
+        }));
+break;
+case 146:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].addBody($$[$0]));
+break;
+case 147:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0].addBody(yy.addLocationDataFn(_$[$0-1])(yy.Block.wrap([$$[$0-1]]))));
+break;
+case 148:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0].addBody(yy.addLocationDataFn(_$[$0-1])(yy.Block.wrap([$$[$0-1]]))));
+break;
+case 149:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])($$[$0]);
+break;
+case 150:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('true'))).addBody($$[$0]));
+break;
+case 151:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.While(yy.addLocationDataFn(_$[$0-1])(new yy.Literal('true'))).addBody(yy.addLocationDataFn(_$[$0])(yy.Block.wrap([$$[$0]]))));
+break;
+case 152:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.For($$[$0-1], $$[$0]));
+break;
+case 153:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.For($$[$0-1], $$[$0]));
+break;
+case 154:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.For($$[$0], $$[$0-1]));
+break;
+case 155:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])({
+          source: yy.addLocationDataFn(_$[$0])(new yy.Value($$[$0]))
+        });
+break;
+case 156:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])((function () {
+        $$[$0].own = $$[$0-1].own;
+        $$[$0].name = $$[$0-1][0];
+        $$[$0].index = $$[$0-1][1];
+        return $$[$0];
+      }()));
+break;
+case 157:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0]);
+break;
+case 158:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])((function () {
+        $$[$0].own = true;
+        return $$[$0];
+      }()));
+break;
+case 159:this.$ = $$[$0];
+break;
+case 160:this.$ = $$[$0];
+break;
+case 161:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
+break;
+case 162:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])(new yy.Value($$[$0]));
+break;
+case 163:this.$ = yy.addLocationDataFn(_$[$0], _$[$0])([$$[$0]]);
+break;
+case 164:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([$$[$0-2], $$[$0]]);
+break;
+case 165:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])({
+          source: $$[$0]
+        });
+break;
+case 166:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])({
+          source: $$[$0],
+          object: true
+        });
+break;
+case 167:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])({
+          source: $$[$0-2],
+          guard: $$[$0]
+        });
+break;
+case 168:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])({
+          source: $$[$0-2],
+          guard: $$[$0],
+          object: true
+        });
+break;
+case 169:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])({
+          source: $$[$0-2],
+          step: $$[$0]
+        });
+break;
+case 170:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])({
+          source: $$[$0-4],
+          guard: $$[$0-2],
+          step: $$[$0]
+        });
+break;
+case 171:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])({
+          source: $$[$0-4],
+          step: $$[$0-2],
+          guard: $$[$0]
+        });
+break;
+case 172:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Switch($$[$0-3], $$[$0-1]));
+break;
+case 173:this.$ = yy.addLocationDataFn(_$[$0-6], _$[$0])(new yy.Switch($$[$0-5], $$[$0-3], $$[$0-1]));
+break;
+case 174:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Switch(null, $$[$0-1]));
+break;
+case 175:this.$ = yy.addLocationDataFn(_$[$0-5], _$[$0])(new yy.Switch(null, $$[$0-3], $$[$0-1]));
+break;
+case 176:this.$ = $$[$0];
+break;
+case 177:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])($$[$0-1].concat($$[$0]));
+break;
+case 178:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])([[$$[$0-1], $$[$0]]]);
+break;
+case 179:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])([[$$[$0-2], $$[$0-1]]]);
+break;
+case 180:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0-1], $$[$0], {
+          type: $$[$0-2]
+        }));
+break;
+case 181:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])($$[$0-4].addElse(yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0-1], $$[$0], {
+          type: $$[$0-2]
+        }))));
+break;
+case 182:this.$ = $$[$0];
+break;
+case 183:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])($$[$0-2].addElse($$[$0]));
+break;
+case 184:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0], yy.addLocationDataFn(_$[$0-2])(yy.Block.wrap([$$[$0-2]])), {
+          type: $$[$0-1],
+          statement: true
+        }));
+break;
+case 185:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.If($$[$0], yy.addLocationDataFn(_$[$0-2])(yy.Block.wrap([$$[$0-2]])), {
+          type: $$[$0-1],
+          statement: true
+        }));
+break;
+case 186:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op($$[$0-1], $$[$0]));
+break;
+case 187:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('-', $$[$0]));
+break;
+case 188:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('+', $$[$0]));
+break;
+case 189:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('--', $$[$0]));
+break;
+case 190:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('++', $$[$0]));
+break;
+case 191:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('--', $$[$0-1], null, true));
+break;
+case 192:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Op('++', $$[$0-1], null, true));
+break;
+case 193:this.$ = yy.addLocationDataFn(_$[$0-1], _$[$0])(new yy.Existence($$[$0-1]));
+break;
+case 194:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op('+', $$[$0-2], $$[$0]));
+break;
+case 195:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op('-', $$[$0-2], $$[$0]));
+break;
+case 196:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0]));
+break;
+case 197:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0]));
+break;
+case 198:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0]));
+break;
+case 199:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Op($$[$0-1], $$[$0-2], $$[$0]));
+break;
+case 200:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])((function () {
+        if ($$[$0-1].charAt(0) === '!') {
+          return new yy.Op($$[$0-1].slice(1), $$[$0-2], $$[$0]).invert();
+        } else {
+          return new yy.Op($$[$0-1], $$[$0-2], $$[$0]);
+        }
+      }()));
+break;
+case 201:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Assign($$[$0-2], $$[$0], $$[$0-1]));
+break;
+case 202:this.$ = yy.addLocationDataFn(_$[$0-4], _$[$0])(new yy.Assign($$[$0-4], $$[$0-1], $$[$0-3]));
+break;
+case 203:this.$ = yy.addLocationDataFn(_$[$0-3], _$[$0])(new yy.Assign($$[$0-3], $$[$0], $$[$0-2]));
+break;
+case 204:this.$ = yy.addLocationDataFn(_$[$0-2], _$[$0])(new yy.Extends($$[$0-2], $$[$0]));
+break;
+}
+},
+table: [{1:[2,1],3:1,4:2,5:3,7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[3]},{1:[2,2],6:[1,72]},{1:[2,3],6:[2,3],26:[2,3],102:[2,3]},{1:[2,6],6:[2,6],26:[2,6],102:[2,6],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,7],6:[2,7],26:[2,7],102:[2,7],103:85,104:[1,63],106:[1,64],109:86,110:[1,66],111:67,126:[1,84]},{1:[2,11],6:[2,11],25:[2,11],26:[2,11],49:[2,11],54:[2
 ,11],57:[2,11],62:88,66:[1,90],67:[1,91],68:[1,92],69:[1,93],70:94,71:[1,95],73:[2,11],74:[1,96],78:[2,11],81:87,84:[1,89],85:[2,107],86:[2,11],91:[2,11],93:[2,11],102:[2,11],104:[2,11],105:[2,11],106:[2,11],110:[2,11],118:[2,11],126:[2,11],128:[2,11],129:[2,11],132:[2,11],133:[2,11],134:[2,11],135:[2,11],136:[2,11],137:[2,11]},{1:[2,12],6:[2,12],25:[2,12],26:[2,12],49:[2,12],54:[2,12],57:[2,12],62:98,66:[1,90],67:[1,91],68:[1,92],69:[1,93],70:94,71:[1,95],73:[2,12],74:[1,96],78:[2,12],81:97,84:[1,89],85:[2,107],86:[2,12],91:[2,12],93:[2,12],102:[2,12],104:[2,12],105:[2,12],106:[2,12],110:[2,12],118:[2,12],126:[2,12],128:[2,12],129:[2,12],132:[2,12],133:[2,12],134:[2,12],135:[2,12],136:[2,12],137:[2,12]},{1:[2,13],6:[2,13],25:[2,13],26:[2,13],49:[2,13],54:[2,13],57:[2,13],73:[2,13],78:[2,13],86:[2,13],91:[2,13],93:[2,13],102:[2,13],104:[2,13],105:[2,13],106:[2,13],110:[2,13],118:[2,13],126:[2,13],128:[2,13],129:[2,13],132:[2,13],133:[2,13],134:[2,13],135:[2,13],136:[2,13],137:[2,13]
 },{1:[2,14],6:[2,14],25:[2,14],26:[2,14],49:[2,14],54:[2,14],57:[2,14],73:[2,14],78:[2,14],86:[2,14],91:[2,14],93:[2,14],102:[2,14],104:[2,14],105:[2,14],106:[2,14],110:[2,14],118:[2,14],126:[2,14],128:[2,14],129:[2,14],132:[2,14],133:[2,14],134:[2,14],135:[2,14],136:[2,14],137:[2,14]},{1:[2,15],6:[2,15],25:[2,15],26:[2,15],49:[2,15],54:[2,15],57:[2,15],73:[2,15],78:[2,15],86:[2,15],91:[2,15],93:[2,15],102:[2,15],104:[2,15],105:[2,15],106:[2,15],110:[2,15],118:[2,15],126:[2,15],128:[2,15],129:[2,15],132:[2,15],133:[2,15],134:[2,15],135:[2,15],136:[2,15],137:[2,15]},{1:[2,16],6:[2,16],25:[2,16],26:[2,16],49:[2,16],54:[2,16],57:[2,16],73:[2,16],78:[2,16],86:[2,16],91:[2,16],93:[2,16],102:[2,16],104:[2,16],105:[2,16],106:[2,16],110:[2,16],118:[2,16],126:[2,16],128:[2,16],129:[2,16],132:[2,16],133:[2,16],134:[2,16],135:[2,16],136:[2,16],137:[2,16]},{1:[2,17],6:[2,17],25:[2,17],26:[2,17],49:[2,17],54:[2,17],57:[2,17],73:[2,17],78:[2,17],86:[2,17],91:[2,17],93:[2,17],102:[2,17],104:[2,17]
 ,105:[2,17],106:[2,17],110:[2,17],118:[2,17],126:[2,17],128:[2,17],129:[2,17],132:[2,17],133:[2,17],134:[2,17],135:[2,17],136:[2,17],137:[2,17]},{1:[2,18],6:[2,18],25:[2,18],26:[2,18],49:[2,18],54:[2,18],57:[2,18],73:[2,18],78:[2,18],86:[2,18],91:[2,18],93:[2,18],102:[2,18],104:[2,18],105:[2,18],106:[2,18],110:[2,18],118:[2,18],126:[2,18],128:[2,18],129:[2,18],132:[2,18],133:[2,18],134:[2,18],135:[2,18],136:[2,18],137:[2,18]},{1:[2,19],6:[2,19],25:[2,19],26:[2,19],49:[2,19],54:[2,19],57:[2,19],73:[2,19],78:[2,19],86:[2,19],91:[2,19],93:[2,19],102:[2,19],104:[2,19],105:[2,19],106:[2,19],110:[2,19],118:[2,19],126:[2,19],128:[2,19],129:[2,19],132:[2,19],133:[2,19],134:[2,19],135:[2,19],136:[2,19],137:[2,19]},{1:[2,20],6:[2,20],25:[2,20],26:[2,20],49:[2,20],54:[2,20],57:[2,20],73:[2,20],78:[2,20],86:[2,20],91:[2,20],93:[2,20],102:[2,20],104:[2,20],105:[2,20],106:[2,20],110:[2,20],118:[2,20],126:[2,20],128:[2,20],129:[2,20],132:[2,20],133:[2,20],134:[2,20],135:[2,20],136:[2,20],137:[2,20
 ]},{1:[2,21],6:[2,21],25:[2,21],26:[2,21],49:[2,21],54:[2,21],57:[2,21],73:[2,21],78:[2,21],86:[2,21],91:[2,21],93:[2,21],102:[2,21],104:[2,21],105:[2,21],106:[2,21],110:[2,21],118:[2,21],126:[2,21],128:[2,21],129:[2,21],132:[2,21],133:[2,21],134:[2,21],135:[2,21],136:[2,21],137:[2,21]},{1:[2,22],6:[2,22],25:[2,22],26:[2,22],49:[2,22],54:[2,22],57:[2,22],73:[2,22],78:[2,22],86:[2,22],91:[2,22],93:[2,22],102:[2,22],104:[2,22],105:[2,22],106:[2,22],110:[2,22],118:[2,22],126:[2,22],128:[2,22],129:[2,22],132:[2,22],133:[2,22],134:[2,22],135:[2,22],136:[2,22],137:[2,22]},{1:[2,8],6:[2,8],26:[2,8],102:[2,8],104:[2,8],106:[2,8],110:[2,8],126:[2,8]},{1:[2,9],6:[2,9],26:[2,9],102:[2,9],104:[2,9],106:[2,9],110:[2,9],126:[2,9]},{1:[2,10],6:[2,10],26:[2,10],102:[2,10],104:[2,10],106:[2,10],110:[2,10],126:[2,10]},{1:[2,74],6:[2,74],25:[2,74],26:[2,74],40:[1,99],49:[2,74],54:[2,74],57:[2,74],66:[2,74],67:[2,74],68:[2,74],69:[2,74],71:[2,74],73:[2,74],74:[2,74],78:[2,74],84:[2,74],85:[2,74],86:[2,
 74],91:[2,74],93:[2,74],102:[2,74],104:[2,74],105:[2,74],106:[2,74],110:[2,74],118:[2,74],126:[2,74],128:[2,74],129:[2,74],132:[2,74],133:[2,74],134:[2,74],135:[2,74],136:[2,74],137:[2,74]},{1:[2,75],6:[2,75],25:[2,75],26:[2,75],49:[2,75],54:[2,75],57:[2,75],66:[2,75],67:[2,75],68:[2,75],69:[2,75],71:[2,75],73:[2,75],74:[2,75],78:[2,75],84:[2,75],85:[2,75],86:[2,75],91:[2,75],93:[2,75],102:[2,75],104:[2,75],105:[2,75],106:[2,75],110:[2,75],118:[2,75],126:[2,75],128:[2,75],129:[2,75],132:[2,75],133:[2,75],134:[2,75],135:[2,75],136:[2,75],137:[2,75]},{1:[2,76],6:[2,76],25:[2,76],26:[2,76],49:[2,76],54:[2,76],57:[2,76],66:[2,76],67:[2,76],68:[2,76],69:[2,76],71:[2,76],73:[2,76],74:[2,76],78:[2,76],84:[2,76],85:[2,76],86:[2,76],91:[2,76],93:[2,76],102:[2,76],104:[2,76],105:[2,76],106:[2,76],110:[2,76],118:[2,76],126:[2,76],128:[2,76],129:[2,76],132:[2,76],133:[2,76],134:[2,76],135:[2,76],136:[2,76],137:[2,76]},{1:[2,77],6:[2,77],25:[2,77],26:[2,77],49:[2,77],54:[2,77],57:[2,77],66:[2,77
 ],67:[2,77],68:[2,77],69:[2,77],71:[2,77],73:[2,77],74:[2,77],78:[2,77],84:[2,77],85:[2,77],86:[2,77],91:[2,77],93:[2,77],102:[2,77],104:[2,77],105:[2,77],106:[2,77],110:[2,77],118:[2,77],126:[2,77],128:[2,77],129:[2,77],132:[2,77],133:[2,77],134:[2,77],135:[2,77],136:[2,77],137:[2,77]},{1:[2,78],6:[2,78],25:[2,78],26:[2,78],49:[2,78],54:[2,78],57:[2,78],66:[2,78],67:[2,78],68:[2,78],69:[2,78],71:[2,78],73:[2,78],74:[2,78],78:[2,78],84:[2,78],85:[2,78],86:[2,78],91:[2,78],93:[2,78],102:[2,78],104:[2,78],105:[2,78],106:[2,78],110:[2,78],118:[2,78],126:[2,78],128:[2,78],129:[2,78],132:[2,78],133:[2,78],134:[2,78],135:[2,78],136:[2,78],137:[2,78]},{1:[2,105],6:[2,105],25:[2,105],26:[2,105],49:[2,105],54:[2,105],57:[2,105],66:[2,105],67:[2,105],68:[2,105],69:[2,105],71:[2,105],73:[2,105],74:[2,105],78:[2,105],82:100,84:[2,105],85:[1,101],86:[2,105],91:[2,105],93:[2,105],102:[2,105],104:[2,105],105:[2,105],106:[2,105],110:[2,105],118:[2,105],126:[2,105],128:[2,105],129:[2,105],132:[2,105
 ],133:[2,105],134:[2,105],135:[2,105],136:[2,105],137:[2,105]},{6:[2,54],25:[2,54],27:105,28:[1,71],44:106,48:102,49:[2,54],54:[2,54],55:103,56:104,58:107,59:108,76:[1,68],89:[1,109],90:[1,110]},{24:111,25:[1,112]},{7:113,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:115,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:
 61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:116,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{12:118,13:119,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,5
 0],36:[1,51],37:[1,52],38:[1,53],39:120,44:61,58:45,59:46,61:117,63:23,64:24,65:25,76:[1,68],83:[1,26],88:[1,56],89:[1,57],90:[1,55],101:[1,54]},{12:118,13:119,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:120,44:61,58:45,59:46,61:121,63:23,64:24,65:25,76:[1,68],83:[1,26],88:[1,56],89:[1,57],90:[1,55],101:[1,54]},{1:[2,71],6:[2,71],25:[2,71],26:[2,71],40:[2,71],49:[2,71],54:[2,71],57:[2,71],66:[2,71],67:[2,71],68:[2,71],69:[2,71],71:[2,71],73:[2,71],74:[2,71],78:[2,71],80:[1,125],84:[2,71],85:[2,71],86:[2,71],91:[2,71],93:[2,71],102:[2,71],104:[2,71],105:[2,71],106:[2,71],110:[2,71],118:[2,71],126:[2,71],128:[2,71],129:[2,71],130:[1,122],131:[1,123],132:[2,71],133:[2,71],134:[2,71],135:[2,71],136:[2,71],137:[2,71],138:[1,124]},{1:[2,182],6:[2,182],25:[2,182],26:[2,182],49:[2,182],54:[2,182],57:[2,182],73:[2,182],78:[2,182],86:[2,182],91:[2,182],93:[2,182],102:[2,182],104:[2,182],105:[2,182],106:[2,182],110:[2,182],118:
 [2,182],121:[1,126],126:[2,182],128:[2,182],129:[2,182],132:[2,182],133:[2,182],134:[2,182],135:[2,182],136:[2,182],137:[2,182]},{24:127,25:[1,112]},{24:128,25:[1,112]},{1:[2,149],6:[2,149],25:[2,149],26:[2,149],49:[2,149],54:[2,149],57:[2,149],73:[2,149],78:[2,149],86:[2,149],91:[2,149],93:[2,149],102:[2,149],104:[2,149],105:[2,149],106:[2,149],110:[2,149],118:[2,149],126:[2,149],128:[2,149],129:[2,149],132:[2,149],133:[2,149],134:[2,149],135:[2,149],136:[2,149],137:[2,149]},{24:129,25:[1,112]},{7:130,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,131],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,
 40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,95],6:[2,95],12:118,13:119,24:132,25:[1,112],26:[2,95],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:120,44:61,49:[2,95],54:[2,95],57:[2,95],58:45,59:46,61:134,63:23,64:24,65:25,73:[2,95],76:[1,68],78:[2,95],80:[1,133],83:[1,26],86:[2,95],88:[1,56],89:[1,57],90:[1,55],91:[2,95],93:[2,95],101:[1,54],102:[2,95],104:[2,95],105:[2,95],106:[2,95],110:[2,95],118:[2,95],126:[2,95],128:[2,95],129:[2,95],132:[2,95],133:[2,95],134:[2,95],135:[2,95],136:[2,95],137:[2,95]},{7:135,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36
 ],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,46],6:[2,46],7:136,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,26:[2,46],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],102:[2,46],103:37,104:[2,46],106:[2,46],107:38,108:[1,65],109:39,110:[2,46],111:67,119:[1,40],124:35,125:[1,62],126:[2,46],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,47],6:[2,47],25:[2,47],26:[2,47],54:[2,47],78:[2,47],102:[2,47],104:[2,47],106:[2,47],110:[2,47],126:[2,47]},{1:[2,72],6:[2,72],25:[2,72],26:[2,72],40:[2,72],49:[2,72],54:[2,72],57:[2,72],66:[2,72]
 ,67:[2,72],68:[2,72],69:[2,72],71:[2,72],73:[2,72],74:[2,72],78:[2,72],84:[2,72],85:[2,72],86:[2,72],91:[2,72],93:[2,72],102:[2,72],104:[2,72],105:[2,72],106:[2,72],110:[2,72],118:[2,72],126:[2,72],128:[2,72],129:[2,72],132:[2,72],133:[2,72],134:[2,72],135:[2,72],136:[2,72],137:[2,72]},{1:[2,73],6:[2,73],25:[2,73],26:[2,73],40:[2,73],49:[2,73],54:[2,73],57:[2,73],66:[2,73],67:[2,73],68:[2,73],69:[2,73],71:[2,73],73:[2,73],74:[2,73],78:[2,73],84:[2,73],85:[2,73],86:[2,73],91:[2,73],93:[2,73],102:[2,73],104:[2,73],105:[2,73],106:[2,73],110:[2,73],118:[2,73],126:[2,73],128:[2,73],129:[2,73],132:[2,73],133:[2,73],134:[2,73],135:[2,73],136:[2,73],137:[2,73]},{1:[2,28],6:[2,28],25:[2,28],26:[2,28],49:[2,28],54:[2,28],57:[2,28],66:[2,28],67:[2,28],68:[2,28],69:[2,28],71:[2,28],73:[2,28],74:[2,28],78:[2,28],84:[2,28],85:[2,28],86:[2,28],91:[2,28],93:[2,28],102:[2,28],104:[2,28],105:[2,28],106:[2,28],110:[2,28],118:[2,28],126:[2,28],128:[2,28],129:[2,28],132:[2,28],133:[2,28],134:[2,28],135:
 [2,28],136:[2,28],137:[2,28]},{1:[2,29],6:[2,29],25:[2,29],26:[2,29],49:[2,29],54:[2,29],57:[2,29],66:[2,29],67:[2,29],68:[2,29],69:[2,29],71:[2,29],73:[2,29],74:[2,29],78:[2,29],84:[2,29],85:[2,29],86:[2,29],91:[2,29],93:[2,29],102:[2,29],104:[2,29],105:[2,29],106:[2,29],110:[2,29],118:[2,29],126:[2,29],128:[2,29],129:[2,29],132:[2,29],133:[2,29],134:[2,29],135:[2,29],136:[2,29],137:[2,29]},{1:[2,30],6:[2,30],25:[2,30],26:[2,30],49:[2,30],54:[2,30],57:[2,30],66:[2,30],67:[2,30],68:[2,30],69:[2,30],71:[2,30],73:[2,30],74:[2,30],78:[2,30],84:[2,30],85:[2,30],86:[2,30],91:[2,30],93:[2,30],102:[2,30],104:[2,30],105:[2,30],106:[2,30],110:[2,30],118:[2,30],126:[2,30],128:[2,30],129:[2,30],132:[2,30],133:[2,30],134:[2,30],135:[2,30],136:[2,30],137:[2,30]},{1:[2,31],6:[2,31],25:[2,31],26:[2,31],49:[2,31],54:[2,31],57:[2,31],66:[2,31],67:[2,31],68:[2,31],69:[2,31],71:[2,31],73:[2,31],74:[2,31],78:[2,31],84:[2,31],85:[2,31],86:[2,31],91:[2,31],93:[2,31],102:[2,31],104:[2,31],105:[2,31],106:[
 2,31],110:[2,31],118:[2,31],126:[2,31],128:[2,31],129:[2,31],132:[2,31],133:[2,31],134:[2,31],135:[2,31],136:[2,31],137:[2,31]},{1:[2,32],6:[2,32],25:[2,32],26:[2,32],49:[2,32],54:[2,32],57:[2,32],66:[2,32],67:[2,32],68:[2,32],69:[2,32],71:[2,32],73:[2,32],74:[2,32],78:[2,32],84:[2,32],85:[2,32],86:[2,32],91:[2,32],93:[2,32],102:[2,32],104:[2,32],105:[2,32],106:[2,32],110:[2,32],118:[2,32],126:[2,32],128:[2,32],129:[2,32],132:[2,32],133:[2,32],134:[2,32],135:[2,32],136:[2,32],137:[2,32]},{1:[2,33],6:[2,33],25:[2,33],26:[2,33],49:[2,33],54:[2,33],57:[2,33],66:[2,33],67:[2,33],68:[2,33],69:[2,33],71:[2,33],73:[2,33],74:[2,33],78:[2,33],84:[2,33],85:[2,33],86:[2,33],91:[2,33],93:[2,33],102:[2,33],104:[2,33],105:[2,33],106:[2,33],110:[2,33],118:[2,33],126:[2,33],128:[2,33],129:[2,33],132:[2,33],133:[2,33],134:[2,33],135:[2,33],136:[2,33],137:[2,33]},{1:[2,34],6:[2,34],25:[2,34],26:[2,34],49:[2,34],54:[2,34],57:[2,34],66:[2,34],67:[2,34],68:[2,34],69:[2,34],71:[2,34],73:[2,34],74:[2,34],
 78:[2,34],84:[2,34],85:[2,34],86:[2,34],91:[2,34],93:[2,34],102:[2,34],104:[2,34],105:[2,34],106:[2,34],110:[2,34],118:[2,34],126:[2,34],128:[2,34],129:[2,34],132:[2,34],133:[2,34],134:[2,34],135:[2,34],136:[2,34],137:[2,34]},{4:137,5:3,7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,138],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:139,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,143],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],
 36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,60:144,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],87:141,88:[1,56],89:[1,57],90:[1,55],91:[1,140],94:142,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,111],6:[2,111],25:[2,111],26:[2,111],49:[2,111],54:[2,111],57:[2,111],66:[2,111],67:[2,111],68:[2,111],69:[2,111],71:[2,111],73:[2,111],74:[2,111],78:[2,111],84:[2,111],85:[2,111],86:[2,111],91:[2,111],93:[2,111],102:[2,111],104:[2,111],105:[2,111],106:[2,111],110:[2,111],118:[2,111],126:[2,111],128:[2,111],129:[2,111],132:[2,111],133:[2,111],134:[2,111],135:[2,111],136:[2,111],137:[2,111]},{1:[2,112],6:[2,112],25:[2,112],26:[2,112],27:145,28:[1,71],49:[2,112],54:[2,112],57:[2,112],66:[2,112],67:[2,112],68:[2,112],69:[2,112],71:[2,112],73:[2,112],74:[2,112],78:[2,112],8
 4:[2,112],85:[2,112],86:[2,112],91:[2,112],93:[2,112],102:[2,112],104:[2,112],105:[2,112],106:[2,112],110:[2,112],118:[2,112],126:[2,112],128:[2,112],129:[2,112],132:[2,112],133:[2,112],134:[2,112],135:[2,112],136:[2,112],137:[2,112]},{25:[2,50]},{25:[2,51]},{1:[2,67],6:[2,67],25:[2,67],26:[2,67],40:[2,67],49:[2,67],54:[2,67],57:[2,67],66:[2,67],67:[2,67],68:[2,67],69:[2,67],71:[2,67],73:[2,67],74:[2,67],78:[2,67],80:[2,67],84:[2,67],85:[2,67],86:[2,67],91:[2,67],93:[2,67],102:[2,67],104:[2,67],105:[2,67],106:[2,67],110:[2,67],118:[2,67],126:[2,67],128:[2,67],129:[2,67],130:[2,67],131:[2,67],132:[2,67],133:[2,67],134:[2,67],135:[2,67],136:[2,67],137:[2,67],138:[2,67]},{1:[2,70],6:[2,70],25:[2,70],26:[2,70],40:[2,70],49:[2,70],54:[2,70],57:[2,70],66:[2,70],67:[2,70],68:[2,70],69:[2,70],71:[2,70],73:[2,70],74:[2,70],78:[2,70],80:[2,70],84:[2,70],85:[2,70],86:[2,70],91:[2,70],93:[2,70],102:[2,70],104:[2,70],105:[2,70],106:[2,70],110:[2,70],118:[2,70],126:[2,70],128:[2,70],129:[2,70],13
 0:[2,70],131:[2,70],132:[2,70],133:[2,70],134:[2,70],135:[2,70],136:[2,70],137:[2,70],138:[2,70]},{7:146,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:147,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83
 :[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:148,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:150,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:149,25:[1,112],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51]
 ,37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{27:155,28:[1,71],44:156,58:157,59:158,64:151,76:[1,68],89:[1,109],90:[1,55],113:152,114:[1,153],115:154},{112:159,116:[1,160],117:[1,161]},{6:[2,90],10:165,25:[2,90],27:166,28:[1,71],29:167,30:[1,69],31:[1,70],41:163,42:164,44:168,46:[1,44],54:[2,90],77:162,78:[2,90],89:[1,109]},{1:[2,26],6:[2,26],25:[2,26],26:[2,26],43:[2,26],49:[2,26],54:[2,26],57:[2,26],66:[2,26],67:[2,26],68:[2,26],69:[2,26],71:[2,26],73:[2,26],74:[2,26],78:[2,26],84:[2,26],85:[2,26],86:[2,26],91:[2,26],93:[2,26],102:[2,26],104:[2,26],105:[2,26],106:[2,26],110:[2,26],118:[2,26],126:[2,26],128:[2,26],129:[2,26],132:[2,26],133:[2,26],134:[2,26],1
 35:[2,26],136:[2,26],137:[2,26]},{1:[2,27],6:[2,27],25:[2,27],26:[2,27],43:[2,27],49:[2,27],54:[2,27],57:[2,27],66:[2,27],67:[2,27],68:[2,27],69:[2,27],71:[2,27],73:[2,27],74:[2,27],78:[2,27],84:[2,27],85:[2,27],86:[2,27],91:[2,27],93:[2,27],102:[2,27],104:[2,27],105:[2,27],106:[2,27],110:[2,27],118:[2,27],126:[2,27],128:[2,27],129:[2,27],132:[2,27],133:[2,27],134:[2,27],135:[2,27],136:[2,27],137:[2,27]},{1:[2,25],6:[2,25],25:[2,25],26:[2,25],40:[2,25],43:[2,25],49:[2,25],54:[2,25],57:[2,25],66:[2,25],67:[2,25],68:[2,25],69:[2,25],71:[2,25],73:[2,25],74:[2,25],78:[2,25],80:[2,25],84:[2,25],85:[2,25],86:[2,25],91:[2,25],93:[2,25],102:[2,25],104:[2,25],105:[2,25],106:[2,25],110:[2,25],116:[2,25],117:[2,25],118:[2,25],126:[2,25],128:[2,25],129:[2,25],130:[2,25],131:[2,25],132:[2,25],133:[2,25],134:[2,25],135:[2,25],136:[2,25],137:[2,25],138:[2,25]},{1:[2,5],5:169,6:[2,5],7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,26:[2,5],27:60,28:[
 1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],102:[2,5],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,193],6:[2,193],25:[2,193],26:[2,193],49:[2,193],54:[2,193],57:[2,193],73:[2,193],78:[2,193],86:[2,193],91:[2,193],93:[2,193],102:[2,193],104:[2,193],105:[2,193],106:[2,193],110:[2,193],118:[2,193],126:[2,193],128:[2,193],129:[2,193],132:[2,193],133:[2,193],134:[2,193],135:[2,193],136:[2,193],137:[2,193]},{7:170,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45
 :[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:171,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:172,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16
 ,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:173,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],
 129:[1,31],130:[1,32],131:[1,33]},{7:174,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:175,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[
 1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:176,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:177,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:
 [1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,148],6:[2,148],25:[2,148],26:[2,148],49:[2,148],54:[2,148],57:[2,148],73:[2,148],78:[2,148],86:[2,148],91:[2,148],93:[2,148],102:[2,148],104:[2,148],105:[2,148],106:[2,148],110:[2,148],118:[2,148],126:[2,148],128:[2,148],129:[2,148],132:[2,148],133:[2,148],134:[2,148],135:[2,148],136:[2,148],137:[2,148]},{1:[2,153],6:[2,153],25:[2,153],26:[2,153],49:[2,153],54:[2,153],57:[2,153],73:[2,153],78:[2,153],86:[2,153],91:[2,153],93:[2,153],102:[2,153],104:[2,153],105:[2,153],106:[2,153],110:[2,153],118:[2,153],126:[2,153],128:[2,153],129:[2,153],132:[2,153],133:[2,153],134:[2,153],135:[2,153],136:[2,153],137:[2,153]},{7:178,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:
 14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,147],6:[2,147],25:[2,147],26:[2,147],49:[2,147],54:[2,147],57:[2,147],73:[2,147],78:[2,147],86:[2,147],91:[2,147],93:[2,147],102:[2,147],104:[2,147],105:[2,147],106:[2,147],110:[2,147],118:[2,147],126:[2,147],128:[2,147],129:[2,147],132:[2,147],133:[2,147],134:[2,147],135:[2,147],136:[2,147],137:[2,147]},{1:[2,152],6:[2,152],25:[2,152],26:[2,152],49:[2,152],54:[2,152],57:[2,152],73:[2,152],78:[2,152],86:[2,152],91:[2,152],93:[2,152],102:[2,152],104:[2,152],105:[2,152],106:[2,152],110:[2,152],118:[2,152],
 126:[2,152],128:[2,152],129:[2,152],132:[2,152],133:[2,152],134:[2,152],135:[2,152],136:[2,152],137:[2,152]},{82:179,85:[1,101]},{1:[2,68],6:[2,68],25:[2,68],26:[2,68],40:[2,68],49:[2,68],54:[2,68],57:[2,68],66:[2,68],67:[2,68],68:[2,68],69:[2,68],71:[2,68],73:[2,68],74:[2,68],78:[2,68],80:[2,68],84:[2,68],85:[2,68],86:[2,68],91:[2,68],93:[2,68],102:[2,68],104:[2,68],105:[2,68],106:[2,68],110:[2,68],118:[2,68],126:[2,68],128:[2,68],129:[2,68],130:[2,68],131:[2,68],132:[2,68],133:[2,68],134:[2,68],135:[2,68],136:[2,68],137:[2,68],138:[2,68]},{85:[2,108]},{27:180,28:[1,71]},{27:181,28:[1,71]},{1:[2,83],6:[2,83],25:[2,83],26:[2,83],27:182,28:[1,71],40:[2,83],49:[2,83],54:[2,83],57:[2,83],66:[2,83],67:[2,83],68:[2,83],69:[2,83],71:[2,83],73:[2,83],74:[2,83],78:[2,83],80:[2,83],84:[2,83],85:[2,83],86:[2,83],91:[2,83],93:[2,83],102:[2,83],104:[2,83],105:[2,83],106:[2,83],110:[2,83],118:[2,83],126:[2,83],128:[2,83],129:[2,83],130:[2,83],131:[2,83],132:[2,83],133:[2,83],134:[2,83],135:[2,83
 ],136:[2,83],137:[2,83],138:[2,83]},{27:183,28:[1,71]},{1:[2,84],6:[2,84],25:[2,84],26:[2,84],40:[2,84],49:[2,84],54:[2,84],57:[2,84],66:[2,84],67:[2,84],68:[2,84],69:[2,84],71:[2,84],73:[2,84],74:[2,84],78:[2,84],80:[2,84],84:[2,84],85:[2,84],86:[2,84],91:[2,84],93:[2,84],102:[2,84],104:[2,84],105:[2,84],106:[2,84],110:[2,84],118:[2,84],126:[2,84],128:[2,84],129:[2,84],130:[2,84],131:[2,84],132:[2,84],133:[2,84],134:[2,84],135:[2,84],136:[2,84],137:[2,84],138:[2,84]},{7:185,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],57:[1,189],58:45,59:46,61:34,63:23,64:24,65:25,72:184,75:186,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],92:187,93:[1,188],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119
 :[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{70:190,71:[1,95],74:[1,96]},{82:191,85:[1,101]},{1:[2,69],6:[2,69],25:[2,69],26:[2,69],40:[2,69],49:[2,69],54:[2,69],57:[2,69],66:[2,69],67:[2,69],68:[2,69],69:[2,69],71:[2,69],73:[2,69],74:[2,69],78:[2,69],80:[2,69],84:[2,69],85:[2,69],86:[2,69],91:[2,69],93:[2,69],102:[2,69],104:[2,69],105:[2,69],106:[2,69],110:[2,69],118:[2,69],126:[2,69],128:[2,69],129:[2,69],130:[2,69],131:[2,69],132:[2,69],133:[2,69],134:[2,69],135:[2,69],136:[2,69],137:[2,69],138:[2,69]},{6:[1,193],7:192,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,194],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106
 :[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,106],6:[2,106],25:[2,106],26:[2,106],49:[2,106],54:[2,106],57:[2,106],66:[2,106],67:[2,106],68:[2,106],69:[2,106],71:[2,106],73:[2,106],74:[2,106],78:[2,106],84:[2,106],85:[2,106],86:[2,106],91:[2,106],93:[2,106],102:[2,106],104:[2,106],105:[2,106],106:[2,106],110:[2,106],118:[2,106],126:[2,106],128:[2,106],129:[2,106],132:[2,106],133:[2,106],134:[2,106],135:[2,106],136:[2,106],137:[2,106]},{7:197,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,143],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,60:144,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],86:[1,195],87:196,88:[1,56],89:[1,57],90:[1,55],94:142,96:[1,36],100:[1,42],101:[1,54],103:37,104:[
 1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[2,52],25:[2,52],49:[1,198],53:200,54:[1,199]},{6:[2,55],25:[2,55],26:[2,55],49:[2,55],54:[2,55]},{6:[2,59],25:[2,59],26:[2,59],40:[1,202],49:[2,59],54:[2,59],57:[1,201]},{6:[2,62],25:[2,62],26:[2,62],40:[2,62],49:[2,62],54:[2,62],57:[2,62]},{6:[2,63],25:[2,63],26:[2,63],40:[2,63],49:[2,63],54:[2,63],57:[2,63]},{6:[2,64],25:[2,64],26:[2,64],40:[2,64],49:[2,64],54:[2,64],57:[2,64]},{6:[2,65],25:[2,65],26:[2,65],40:[2,65],49:[2,65],54:[2,65],57:[2,65]},{27:145,28:[1,71]},{7:197,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,143],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,60:144,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],87:141,88:[1,
 56],89:[1,57],90:[1,55],91:[1,140],94:142,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,49],6:[2,49],25:[2,49],26:[2,49],49:[2,49],54:[2,49],57:[2,49],73:[2,49],78:[2,49],86:[2,49],91:[2,49],93:[2,49],102:[2,49],104:[2,49],105:[2,49],106:[2,49],110:[2,49],118:[2,49],126:[2,49],128:[2,49],129:[2,49],132:[2,49],133:[2,49],134:[2,49],135:[2,49],136:[2,49],137:[2,49]},{4:204,5:3,7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,26:[1,203],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:
 [1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,186],6:[2,186],25:[2,186],26:[2,186],49:[2,186],54:[2,186],57:[2,186],73:[2,186],78:[2,186],86:[2,186],91:[2,186],93:[2,186],102:[2,186],103:82,104:[2,186],105:[2,186],106:[2,186],109:83,110:[2,186],111:67,118:[2,186],126:[2,186],128:[2,186],129:[2,186],132:[1,73],133:[2,186],134:[2,186],135:[2,186],136:[2,186],137:[2,186]},{103:85,104:[1,63],106:[1,64],109:86,110:[1,66],111:67,126:[1,84]},{1:[2,187],6:[2,187],25:[2,187],26:[2,187],49:[2,187],54:[2,187],57:[2,187],73:[2,187],78:[2,187],86:[2,187],91:[2,187],93:[2,187],102:[2,187],103:82,104:[2,187],105:[2,187],106:[2,187],109:83,110:[2,187],111:67,118:[2,187],126:[2,187],128:[2,187],129:[2,187],132:[1,73],133:[2,187],134:[2,187],135:[2,187],136:[2,187],137:[2,187]},{1:[2,188],6:[2,188],25:[2,188],26:[2,188],49:[2,188],54:[2,188],57:[2,188],73:[2,188],78:[2,188],86:[2,188],91:[2,188],93:[2,188],102:[2,188],103:82,104:[2,188],105:[
 2,188],106:[2,188],109:83,110:[2,188],111:67,118:[2,188],126:[2,188],128:[2,188],129:[2,188],132:[1,73],133:[2,188],134:[2,188],135:[2,188],136:[2,188],137:[2,188]},{1:[2,189],6:[2,189],25:[2,189],26:[2,189],49:[2,189],54:[2,189],57:[2,189],66:[2,71],67:[2,71],68:[2,71],69:[2,71],71:[2,71],73:[2,189],74:[2,71],78:[2,189],84:[2,71],85:[2,71],86:[2,189],91:[2,189],93:[2,189],102:[2,189],104:[2,189],105:[2,189],106:[2,189],110:[2,189],118:[2,189],126:[2,189],128:[2,189],129:[2,189],132:[2,189],133:[2,189],134:[2,189],135:[2,189],136:[2,189],137:[2,189]},{62:88,66:[1,90],67:[1,91],68:[1,92],69:[1,93],70:94,71:[1,95],74:[1,96],81:87,84:[1,89],85:[2,107]},{62:98,66:[1,90],67:[1,91],68:[1,92],69:[1,93],70:94,71:[1,95],74:[1,96],81:97,84:[1,89],85:[2,107]},{66:[2,74],67:[2,74],68:[2,74],69:[2,74],71:[2,74],74:[2,74],84:[2,74],85:[2,74]},{1:[2,190],6:[2,190],25:[2,190],26:[2,190],49:[2,190],54:[2,190],57:[2,190],66:[2,71],67:[2,71],68:[2,71],69:[2,71],71:[2,71],73:[2,190],74:[2,71],78:[2,190
 ],84:[2,71],85:[2,71],86:[2,190],91:[2,190],93:[2,190],102:[2,190],104:[2,190],105:[2,190],106:[2,190],110:[2,190],118:[2,190],126:[2,190],128:[2,190],129:[2,190],132:[2,190],133:[2,190],134:[2,190],135:[2,190],136:[2,190],137:[2,190]},{1:[2,191],6:[2,191],25:[2,191],26:[2,191],49:[2,191],54:[2,191],57:[2,191],73:[2,191],78:[2,191],86:[2,191],91:[2,191],93:[2,191],102:[2,191],104:[2,191],105:[2,191],106:[2,191],110:[2,191],118:[2,191],126:[2,191],128:[2,191],129:[2,191],132:[2,191],133:[2,191],134:[2,191],135:[2,191],136:[2,191],137:[2,191]},{1:[2,192],6:[2,192],25:[2,192],26:[2,192],49:[2,192],54:[2,192],57:[2,192],73:[2,192],78:[2,192],86:[2,192],91:[2,192],93:[2,192],102:[2,192],104:[2,192],105:[2,192],106:[2,192],110:[2,192],118:[2,192],126:[2,192],128:[2,192],129:[2,192],132:[2,192],133:[2,192],134:[2,192],135:[2,192],136:[2,192],137:[2,192]},{6:[1,207],7:205,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,206],27:60,28:[1,71
 ],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:208,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32]
 ,131:[1,33]},{24:209,25:[1,112],125:[1,210]},{1:[2,132],6:[2,132],25:[2,132],26:[2,132],49:[2,132],54:[2,132],57:[2,132],73:[2,132],78:[2,132],86:[2,132],91:[2,132],93:[2,132],97:211,98:[1,212],99:[1,213],102:[2,132],104:[2,132],105:[2,132],106:[2,132],110:[2,132],118:[2,132],126:[2,132],128:[2,132],129:[2,132],132:[2,132],133:[2,132],134:[2,132],135:[2,132],136:[2,132],137:[2,132]},{1:[2,146],6:[2,146],25:[2,146],26:[2,146],49:[2,146],54:[2,146],57:[2,146],73:[2,146],78:[2,146],86:[2,146],91:[2,146],93:[2,146],102:[2,146],104:[2,146],105:[2,146],106:[2,146],110:[2,146],118:[2,146],126:[2,146],128:[2,146],129:[2,146],132:[2,146],133:[2,146],134:[2,146],135:[2,146],136:[2,146],137:[2,146]},{1:[2,154],6:[2,154],25:[2,154],26:[2,154],49:[2,154],54:[2,154],57:[2,154],73:[2,154],78:[2,154],86:[2,154],91:[2,154],93:[2,154],102:[2,154],104:[2,154],105:[2,154],106:[2,154],110:[2,154],118:[2,154],126:[2,154],128:[2,154],129:[2,154],132:[2,154],133:[2,154],134:[2,154],135:[2,154],136:[2,154],
 137:[2,154]},{25:[1,214],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{120:215,122:216,123:[1,217]},{1:[2,96],6:[2,96],25:[2,96],26:[2,96],49:[2,96],54:[2,96],57:[2,96],73:[2,96],78:[2,96],86:[2,96],91:[2,96],93:[2,96],102:[2,96],104:[2,96],105:[2,96],106:[2,96],110:[2,96],118:[2,96],126:[2,96],128:[2,96],129:[2,96],132:[2,96],133:[2,96],134:[2,96],135:[2,96],136:[2,96],137:[2,96]},{7:218,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,
 62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,99],6:[2,99],24:219,25:[1,112],26:[2,99],49:[2,99],54:[2,99],57:[2,99],66:[2,71],67:[2,71],68:[2,71],69:[2,71],71:[2,71],73:[2,99],74:[2,71],78:[2,99],80:[1,220],84:[2,71],85:[2,71],86:[2,99],91:[2,99],93:[2,99],102:[2,99],104:[2,99],105:[2,99],106:[2,99],110:[2,99],118:[2,99],126:[2,99],128:[2,99],129:[2,99],132:[2,99],133:[2,99],134:[2,99],135:[2,99],136:[2,99],137:[2,99]},{1:[2,139],6:[2,139],25:[2,139],26:[2,139],49:[2,139],54:[2,139],57:[2,139],73:[2,139],78:[2,139],86:[2,139],91:[2,139],93:[2,139],102:[2,139],103:82,104:[2,139],105:[2,139],106:[2,139],109:83,110:[2,139],111:67,118:[2,139],126:[2,139],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,45],6:[2,45],26:[2,45],102:[2,45],103:82,104:[2,45],106:[2,45],109:83,110:[2,45],111:67,126:[2,45],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{6:[1,72],102:[1,221]},{4:222,5:3,
 7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[2,128],25:[2,128],54:[2,128],57:[1,224],91:[2,128],92:223,93:[1,188],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,114],6:[2,114],25:[2,114],26:[2,114],40:[2,114],49:[2,114],54:[2,114],57:[2,114],66:[2,114],67:[2,114],68:[2,114],69:[2,114],71:[2,114],73:[2,114],74:[2,114],78:[2,114],84:[2,114],85:[2,114],86:[2,114],91:[
 2,114],93:[2,114],102:[2,114],104:[2,114],105:[2,114],106:[2,114],110:[2,114],116:[2,114],117:[2,114],118:[2,114],126:[2,114],128:[2,114],129:[2,114],132:[2,114],133:[2,114],134:[2,114],135:[2,114],136:[2,114],137:[2,114]},{6:[2,52],25:[2,52],53:225,54:[1,226],91:[2,52]},{6:[2,123],25:[2,123],26:[2,123],54:[2,123],86:[2,123],91:[2,123]},{7:197,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,143],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,60:144,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],87:227,88:[1,56],89:[1,57],90:[1,55],94:142,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[2,129],25:[2,129],26:[2,129],54:[2,129],86:[2,129],91:[2,12
 9]},{1:[2,113],6:[2,113],25:[2,113],26:[2,113],40:[2,113],43:[2,113],49:[2,113],54:[2,113],57:[2,113],66:[2,113],67:[2,113],68:[2,113],69:[2,113],71:[2,113],73:[2,113],74:[2,113],78:[2,113],80:[2,113],84:[2,113],85:[2,113],86:[2,113],91:[2,113],93:[2,113],102:[2,113],104:[2,113],105:[2,113],106:[2,113],110:[2,113],116:[2,113],117:[2,113],118:[2,113],126:[2,113],128:[2,113],129:[2,113],130:[2,113],131:[2,113],132:[2,113],133:[2,113],134:[2,113],135:[2,113],136:[2,113],137:[2,113],138:[2,113]},{24:228,25:[1,112],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,142],6:[2,142],25:[2,142],26:[2,142],49:[2,142],54:[2,142],57:[2,142],73:[2,142],78:[2,142],86:[2,142],91:[2,142],93:[2,142],102:[2,142],103:82,104:[1,63],105:[1,229],106:[1,64],109:83,110:[1,66],111:67,118:[2,142],126:[2,142],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2
 ,144],6:[2,144],25:[2,144],26:[2,144],49:[2,144],54:[2,144],57:[2,144],73:[2,144],78:[2,144],86:[2,144],91:[2,144],93:[2,144],102:[2,144],103:82,104:[1,63],105:[1,230],106:[1,64],109:83,110:[1,66],111:67,118:[2,144],126:[2,144],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,150],6:[2,150],25:[2,150],26:[2,150],49:[2,150],54:[2,150],57:[2,150],73:[2,150],78:[2,150],86:[2,150],91:[2,150],93:[2,150],102:[2,150],104:[2,150],105:[2,150],106:[2,150],110:[2,150],118:[2,150],126:[2,150],128:[2,150],129:[2,150],132:[2,150],133:[2,150],134:[2,150],135:[2,150],136:[2,150],137:[2,150]},{1:[2,151],6:[2,151],25:[2,151],26:[2,151],49:[2,151],54:[2,151],57:[2,151],73:[2,151],78:[2,151],86:[2,151],91:[2,151],93:[2,151],102:[2,151],103:82,104:[1,63],105:[2,151],106:[1,64],109:83,110:[1,66],111:67,118:[2,151],126:[2,151],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,155],6:[2,155],25:[2,155],26:[2,155],49:
 [2,155],54:[2,155],57:[2,155],73:[2,155],78:[2,155],86:[2,155],91:[2,155],93:[2,155],102:[2,155],104:[2,155],105:[2,155],106:[2,155],110:[2,155],118:[2,155],126:[2,155],128:[2,155],129:[2,155],132:[2,155],133:[2,155],134:[2,155],135:[2,155],136:[2,155],137:[2,155]},{116:[2,157],117:[2,157]},{27:155,28:[1,71],44:156,58:157,59:158,76:[1,68],89:[1,109],90:[1,110],113:231,115:154},{54:[1,232],116:[2,163],117:[2,163]},{54:[2,159],116:[2,159],117:[2,159]},{54:[2,160],116:[2,160],117:[2,160]},{54:[2,161],116:[2,161],117:[2,161]},{54:[2,162],116:[2,162],117:[2,162]},{1:[2,156],6:[2,156],25:[2,156],26:[2,156],49:[2,156],54:[2,156],57:[2,156],73:[2,156],78:[2,156],86:[2,156],91:[2,156],93:[2,156],102:[2,156],104:[2,156],105:[2,156],106:[2,156],110:[2,156],118:[2,156],126:[2,156],128:[2,156],129:[2,156],132:[2,156],133:[2,156],134:[2,156],135:[2,156],136:[2,156],137:[2,156]},{7:233,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29
 :47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:234,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131
 :[1,33]},{6:[2,52],25:[2,52],53:235,54:[1,236],78:[2,52]},{6:[2,91],25:[2,91],26:[2,91],54:[2,91],78:[2,91]},{6:[2,38],25:[2,38],26:[2,38],43:[1,237],54:[2,38],78:[2,38]},{6:[2,41],25:[2,41],26:[2,41],54:[2,41],78:[2,41]},{6:[2,42],25:[2,42],26:[2,42],43:[2,42],54:[2,42],78:[2,42]},{6:[2,43],25:[2,43],26:[2,43],43:[2,43],54:[2,43],78:[2,43]},{6:[2,44],25:[2,44],26:[2,44],43:[2,44],54:[2,44],78:[2,44]},{1:[2,4],6:[2,4],26:[2,4],102:[2,4]},{1:[2,194],6:[2,194],25:[2,194],26:[2,194],49:[2,194],54:[2,194],57:[2,194],73:[2,194],78:[2,194],86:[2,194],91:[2,194],93:[2,194],102:[2,194],103:82,104:[2,194],105:[2,194],106:[2,194],109:83,110:[2,194],111:67,118:[2,194],126:[2,194],128:[2,194],129:[2,194],132:[1,73],133:[1,76],134:[2,194],135:[2,194],136:[2,194],137:[2,194]},{1:[2,195],6:[2,195],25:[2,195],26:[2,195],49:[2,195],54:[2,195],57:[2,195],73:[2,195],78:[2,195],86:[2,195],91:[2,195],93:[2,195],102:[2,195],103:82,104:[2,195],105:[2,195],106:[2,195],109:83,110:[2,195],111:67,118:[2,195],
 126:[2,195],128:[2,195],129:[2,195],132:[1,73],133:[1,76],134:[2,195],135:[2,195],136:[2,195],137:[2,195]},{1:[2,196],6:[2,196],25:[2,196],26:[2,196],49:[2,196],54:[2,196],57:[2,196],73:[2,196],78:[2,196],86:[2,196],91:[2,196],93:[2,196],102:[2,196],103:82,104:[2,196],105:[2,196],106:[2,196],109:83,110:[2,196],111:67,118:[2,196],126:[2,196],128:[2,196],129:[2,196],132:[1,73],133:[2,196],134:[2,196],135:[2,196],136:[2,196],137:[2,196]},{1:[2,197],6:[2,197],25:[2,197],26:[2,197],49:[2,197],54:[2,197],57:[2,197],73:[2,197],78:[2,197],86:[2,197],91:[2,197],93:[2,197],102:[2,197],103:82,104:[2,197],105:[2,197],106:[2,197],109:83,110:[2,197],111:67,118:[2,197],126:[2,197],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[2,197],135:[2,197],136:[2,197],137:[2,197]},{1:[2,198],6:[2,198],25:[2,198],26:[2,198],49:[2,198],54:[2,198],57:[2,198],73:[2,198],78:[2,198],86:[2,198],91:[2,198],93:[2,198],102:[2,198],103:82,104:[2,198],105:[2,198],106:[2,198],109:83,110:[2,198],111:67,118:[2,198],126:[
 2,198],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[2,198],136:[2,198],137:[1,80]},{1:[2,199],6:[2,199],25:[2,199],26:[2,199],49:[2,199],54:[2,199],57:[2,199],73:[2,199],78:[2,199],86:[2,199],91:[2,199],93:[2,199],102:[2,199],103:82,104:[2,199],105:[2,199],106:[2,199],109:83,110:[2,199],111:67,118:[2,199],126:[2,199],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[2,199],137:[1,80]},{1:[2,200],6:[2,200],25:[2,200],26:[2,200],49:[2,200],54:[2,200],57:[2,200],73:[2,200],78:[2,200],86:[2,200],91:[2,200],93:[2,200],102:[2,200],103:82,104:[2,200],105:[2,200],106:[2,200],109:83,110:[2,200],111:67,118:[2,200],126:[2,200],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[2,200],136:[2,200],137:[2,200]},{1:[2,185],6:[2,185],25:[2,185],26:[2,185],49:[2,185],54:[2,185],57:[2,185],73:[2,185],78:[2,185],86:[2,185],91:[2,185],93:[2,185],102:[2,185],103:82,104:[1,63],105:[2,185],106:[1,64],109:83,110:[1,66],111:67,118:[2,185],126:[1,81],128:[1,75],12
 9:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,184],6:[2,184],25:[2,184],26:[2,184],49:[2,184],54:[2,184],57:[2,184],73:[2,184],78:[2,184],86:[2,184],91:[2,184],93:[2,184],102:[2,184],103:82,104:[1,63],105:[2,184],106:[1,64],109:83,110:[1,66],111:67,118:[2,184],126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,103],6:[2,103],25:[2,103],26:[2,103],49:[2,103],54:[2,103],57:[2,103],66:[2,103],67:[2,103],68:[2,103],69:[2,103],71:[2,103],73:[2,103],74:[2,103],78:[2,103],84:[2,103],85:[2,103],86:[2,103],91:[2,103],93:[2,103],102:[2,103],104:[2,103],105:[2,103],106:[2,103],110:[2,103],118:[2,103],126:[2,103],128:[2,103],129:[2,103],132:[2,103],133:[2,103],134:[2,103],135:[2,103],136:[2,103],137:[2,103]},{1:[2,79],6:[2,79],25:[2,79],26:[2,79],40:[2,79],49:[2,79],54:[2,79],57:[2,79],66:[2,79],67:[2,79],68:[2,79],69:[2,79],71:[2,79],73:[2,79],74:[2,79],78:[2,79],80:[2,79],84:[2,79],85:[2,79],86:[2,79],9
 1:[2,79],93:[2,79],102:[2,79],104:[2,79],105:[2,79],106:[2,79],110:[2,79],118:[2,79],126:[2,79],128:[2,79],129:[2,79],130:[2,79],131:[2,79],132:[2,79],133:[2,79],134:[2,79],135:[2,79],136:[2,79],137:[2,79],138:[2,79]},{1:[2,80],6:[2,80],25:[2,80],26:[2,80],40:[2,80],49:[2,80],54:[2,80],57:[2,80],66:[2,80],67:[2,80],68:[2,80],69:[2,80],71:[2,80],73:[2,80],74:[2,80],78:[2,80],80:[2,80],84:[2,80],85:[2,80],86:[2,80],91:[2,80],93:[2,80],102:[2,80],104:[2,80],105:[2,80],106:[2,80],110:[2,80],118:[2,80],126:[2,80],128:[2,80],129:[2,80],130:[2,80],131:[2,80],132:[2,80],133:[2,80],134:[2,80],135:[2,80],136:[2,80],137:[2,80],138:[2,80]},{1:[2,81],6:[2,81],25:[2,81],26:[2,81],40:[2,81],49:[2,81],54:[2,81],57:[2,81],66:[2,81],67:[2,81],68:[2,81],69:[2,81],71:[2,81],73:[2,81],74:[2,81],78:[2,81],80:[2,81],84:[2,81],85:[2,81],86:[2,81],91:[2,81],93:[2,81],102:[2,81],104:[2,81],105:[2,81],106:[2,81],110:[2,81],118:[2,81],126:[2,81],128:[2,81],129:[2,81],130:[2,81],131:[2,81],132:[2,81],133:[2,81]
 ,134:[2,81],135:[2,81],136:[2,81],137:[2,81],138:[2,81]},{1:[2,82],6:[2,82],25:[2,82],26:[2,82],40:[2,82],49:[2,82],54:[2,82],57:[2,82],66:[2,82],67:[2,82],68:[2,82],69:[2,82],71:[2,82],73:[2,82],74:[2,82],78:[2,82],80:[2,82],84:[2,82],85:[2,82],86:[2,82],91:[2,82],93:[2,82],102:[2,82],104:[2,82],105:[2,82],106:[2,82],110:[2,82],118:[2,82],126:[2,82],128:[2,82],129:[2,82],130:[2,82],131:[2,82],132:[2,82],133:[2,82],134:[2,82],135:[2,82],136:[2,82],137:[2,82],138:[2,82]},{73:[1,238]},{57:[1,189],73:[2,87],92:239,93:[1,188],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{73:[2,88]},{7:240,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,6
 4:24,65:25,73:[2,122],76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{11:[2,116],28:[2,116],30:[2,116],31:[2,116],33:[2,116],34:[2,116],35:[2,116],36:[2,116],37:[2,116],38:[2,116],45:[2,116],46:[2,116],47:[2,116],51:[2,116],52:[2,116],73:[2,116],76:[2,116],79:[2,116],83:[2,116],88:[2,116],89:[2,116],90:[2,116],96:[2,116],100:[2,116],101:[2,116],104:[2,116],106:[2,116],108:[2,116],110:[2,116],119:[2,116],125:[2,116],127:[2,116],128:[2,116],129:[2,116],130:[2,116],131:[2,116]},{11:[2,117],28:[2,117],30:[2,117],31:[2,117],33:[2,117],34:[2,117],35:[2,117],36:[2,117],37:[2,117],38:[2,117],45:[2,117],46:[2,117],47:[2,117],51:[2,117],52:[2,117],73:[2,117],76:[2,117],79:[2,117],83:[2,117],88:[2,117],89:[2,117],90:[2,117],96:[2,117],100:[2,117],101:[2,117],104:[2,117],106:[2,117],108:[2,117],1
 10:[2,117],119:[2,117],125:[2,117],127:[2,117],128:[2,117],129:[2,117],130:[2,117],131:[2,117]},{1:[2,86],6:[2,86],25:[2,86],26:[2,86],40:[2,86],49:[2,86],54:[2,86],57:[2,86],66:[2,86],67:[2,86],68:[2,86],69:[2,86],71:[2,86],73:[2,86],74:[2,86],78:[2,86],80:[2,86],84:[2,86],85:[2,86],86:[2,86],91:[2,86],93:[2,86],102:[2,86],104:[2,86],105:[2,86],106:[2,86],110:[2,86],118:[2,86],126:[2,86],128:[2,86],129:[2,86],130:[2,86],131:[2,86],132:[2,86],133:[2,86],134:[2,86],135:[2,86],136:[2,86],137:[2,86],138:[2,86]},{1:[2,104],6:[2,104],25:[2,104],26:[2,104],49:[2,104],54:[2,104],57:[2,104],66:[2,104],67:[2,104],68:[2,104],69:[2,104],71:[2,104],73:[2,104],74:[2,104],78:[2,104],84:[2,104],85:[2,104],86:[2,104],91:[2,104],93:[2,104],102:[2,104],104:[2,104],105:[2,104],106:[2,104],110:[2,104],118:[2,104],126:[2,104],128:[2,104],129:[2,104],132:[2,104],133:[2,104],134:[2,104],135:[2,104],136:[2,104],137:[2,104]},{1:[2,35],6:[2,35],25:[2,35],26:[2,35],49:[2,35],54:[2,35],57:[2,35],73:[2,35],78:[
 2,35],86:[2,35],91:[2,35],93:[2,35],102:[2,35],103:82,104:[2,35],105:[2,35],106:[2,35],109:83,110:[2,35],111:67,118:[2,35],126:[2,35],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{7:241,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:242,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],3
 9:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,109],6:[2,109],25:[2,109],26:[2,109],49:[2,109],54:[2,109],57:[2,109],66:[2,109],67:[2,109],68:[2,109],69:[2,109],71:[2,109],73:[2,109],74:[2,109],78:[2,109],84:[2,109],85:[2,109],86:[2,109],91:[2,109],93:[2,109],102:[2,109],104:[2,109],105:[2,109],106:[2,109],110:[2,109],118:[2,109],126:[2,109],128:[2,109],129:[2,109],132:[2,109],133:[2,109],134:[2,109],135:[2,109],136:[2,109],137:[2,109]},{6:[2,52],25:[2,52],53:243,54:[1,226],86:[2,52]},{6:[2,128],25:[2,128],26:[2,128],54:[2,128],57:[1,244],86:[2,128],91:[2,128],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77]
 ,135:[1,78],136:[1,79],137:[1,80]},{50:245,51:[1,58],52:[1,59]},{6:[2,53],25:[2,53],26:[2,53],27:105,28:[1,71],44:106,55:246,56:104,58:107,59:108,76:[1,68],89:[1,109],90:[1,110]},{6:[1,247],25:[1,248]},{6:[2,60],25:[2,60],26:[2,60],49:[2,60],54:[2,60]},{7:249,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,23],6:[2,23],25:[2,23],26:[2,23],49:[2,23],54:[2,23],57:[2,23],73:[2,23],78:[2,23],86:[2,23],91:[2,23],93:[2,23],98:[2,23],99:[2,23],102:[2,23],104:[2,23],105:[2,23],106:[2,23
 ],110:[2,23],118:[2,23],121:[2,23],123:[2,23],126:[2,23],128:[2,23],129:[2,23],132:[2,23],133:[2,23],134:[2,23],135:[2,23],136:[2,23],137:[2,23]},{6:[1,72],26:[1,250]},{1:[2,201],6:[2,201],25:[2,201],26:[2,201],49:[2,201],54:[2,201],57:[2,201],73:[2,201],78:[2,201],86:[2,201],91:[2,201],93:[2,201],102:[2,201],103:82,104:[2,201],105:[2,201],106:[2,201],109:83,110:[2,201],111:67,118:[2,201],126:[2,201],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{7:251,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,6
 2],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:252,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,204],6:[2,204],25:[2,204],26:[2,204],49:[2,204],54:[2,204],57:[2,204],73:[2,204],78:[2,204],86:[2,204],91:[2,204],93:[2,204],102:[2,204],103:82,104:[2,204],105:[2,204],106:[2,204],109:83,110:[2,204],111:67,118:[2,204],126:[2,204],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,183],6:[2,183],25:[2,183],26:[2,183],49:[2,1
 83],54:[2,183],57:[2,183],73:[2,183],78:[2,183],86:[2,183],91:[2,183],93:[2,183],102:[2,183],104:[2,183],105:[2,183],106:[2,183],110:[2,183],118:[2,183],126:[2,183],128:[2,183],129:[2,183],132:[2,183],133:[2,183],134:[2,183],135:[2,183],136:[2,183],137:[2,183]},{7:253,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,

<TRUNCATED>

[34/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_liquid.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_liquid.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_liquid.json
new file mode 100644
index 0000000..a87c051
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_liquid.json
@@ -0,0 +1,551 @@
+[[
+   "start",
+  ["text","The following examples can be found in full at http://liquidmarkup.org/"]
+],[
+   "start"
+],[
+   "start",
+  ["text","Liquid is an extraction from the e-commerce system Shopify."]
+],[
+   "start",
+  ["text","Shopify powers many thousands of e-commerce stores which all call for unique designs."]
+],[
+   "start",
+  ["text","For this we developed Liquid which allows our customers complete design freedom while"]
+],[
+   "start",
+  ["text","maintaining the integrity of our servers."]
+],[
+   "start"
+],[
+   "start",
+  ["text","Liquid has been in production use since June 2006 and is now used by many other"]
+],[
+   "start",
+  ["text","hosted web applications."]
+],[
+   "start"
+],[
+   "start",
+  ["text","It was developed for usage in Ruby on Rails web applications and integrates seamlessly"]
+],[
+   "start",
+  ["text","as a plugin but it also works excellently as a stand alone library."]
+],[
+   "start"
+],[
+   "start",
+  ["text","Here's what it looks like:"]
+],[
+   "start"
+],[
+   "start",
+  ["text","  "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","ul"],
+  ["text"," "],
+  ["entity.other.attribute-name","id"],
+  ["keyword.operator.separator","="],
+  ["string","\"products\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["variable","{%"],
+  ["text"," "],
+  ["keyword","for"],
+  ["text"," "],
+  ["identifier","product"],
+  ["text"," "],
+  ["keyword","in"],
+  ["text"," "],
+  ["identifier","products"],
+  ["text"," "],
+  ["variable","%}"]
+],[
+   "start",
+  ["text","      "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","li"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","h2"],
+  ["meta.tag.punctuation.end",">"],
+  ["variable","{{"],
+  ["text"," "],
+  ["identifier","product"],
+  ["text","."],
+  ["identifier","title"],
+  ["text"," "],
+  ["variable","}}"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","h2"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        Only "],
+  ["variable","{{"],
+  ["text"," "],
+  ["identifier","product"],
+  ["text","."],
+  ["identifier","price"],
+  ["text"," | "],
+  ["identifier","format_as_money"],
+  ["text"," "],
+  ["variable","}}"]
+],[
+   "start"
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"],
+  ["variable","{{"],
+  ["text"," "],
+  ["identifier","product"],
+  ["text","."],
+  ["identifier","description"],
+  ["text"," | "],
+  ["identifier","prettyprint"],
+  ["text"," | "],
+  ["support.function","truncate"],
+  ["text",": "],
+  ["constant.numeric","200"],
+  ["text","  "],
+  ["variable","}}"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start",
+  ["text","      "],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","li"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["variable","{%"],
+  ["text"," "],
+  ["keyword","endfor"],
+  ["text"," "],
+  ["variable","%}"]
+],[
+   "start",
+  ["text","  "],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","ul"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["text","Some more features include:"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","h2"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","Filters"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","h2"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"],
+  ["text"," The word \"tobi\" in uppercase: "],
+  ["variable","{{"],
+  ["text"," "],
+  ["string","'tobi'"],
+  ["text"," | "],
+  ["support.function","upcase"],
+  ["text"," "],
+  ["variable","}}"],
+  ["text"," "],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","The word \"tobi\" has "],
+  ["variable","{{"],
+  ["text"," "],
+  ["string","'tobi'"],
+  ["text"," | "],
+  ["support.function","size"],
+  ["text"," "],
+  ["variable","}}"],
+  ["text"," letters! "],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","Change \"Hello world\" to \"Hi world\": "],
+  ["variable","{{"],
+  ["text"," "],
+  ["string","'Hello world'"],
+  ["text"," | "],
+  ["support.function","replace"],
+  ["text",": "],
+  ["string","'Hello'"],
+  ["text",", "],
+  ["string","'Hi'"],
+  ["text"," "],
+  ["variable","}}"],
+  ["text"," "],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","The date today is "],
+  ["variable","{{"],
+  ["text"," "],
+  ["string","'now'"],
+  ["text"," | "],
+  ["support.function","date"],
+  ["text",": "],
+  ["string","\"%Y %b %d\""],
+  ["text"," "],
+  ["variable","}}"],
+  ["text"," "],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","h2"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","If"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","h2"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","  "],
+  ["variable","{%"],
+  ["text"," "],
+  ["keyword","if"],
+  ["text"," "],
+  ["identifier","user"],
+  ["text","."],
+  ["identifier","name"],
+  ["text"," "],
+  ["keyword.operator","=="],
+  ["text"," "],
+  ["string","'tobi'"],
+  ["text"," "],
+  ["identifier","or"],
+  ["text"," "],
+  ["identifier","user"],
+  ["text","."],
+  ["identifier","name"],
+  ["text"," "],
+  ["keyword.operator","=="],
+  ["text"," "],
+  ["string","'marc'"],
+  ["text"," "],
+  ["variable","%}"],
+  ["text"," "]
+],[
+   "start",
+  ["text","    hi marc or tobi"]
+],[
+   "start",
+  ["text","  "],
+  ["variable","{%"],
+  ["text"," "],
+  ["keyword","endif"],
+  ["text"," "],
+  ["variable","%}"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","h2"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","Case"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","h2"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","  "],
+  ["variable","{%"],
+  ["text"," "],
+  ["keyword","case"],
+  ["text"," "],
+  ["identifier","template"],
+  ["text"," "],
+  ["variable","%}"]
+],[
+   "start",
+  ["text","    "],
+  ["variable","{%"],
+  ["text"," "],
+  ["keyword","when"],
+  ["text"," "],
+  ["string","'index'"],
+  ["text"," "],
+  ["variable","%}"]
+],[
+   "start",
+  ["text","       Welcome"]
+],[
+   "start",
+  ["text","    "],
+  ["variable","{%"],
+  ["text"," "],
+  ["keyword","when"],
+  ["text"," "],
+  ["string","'product'"],
+  ["text"," "],
+  ["variable","%}"]
+],[
+   "start",
+  ["text","       "],
+  ["variable","{{"],
+  ["text"," "],
+  ["identifier","product"],
+  ["text","."],
+  ["identifier","vendor"],
+  ["text"," | "],
+  ["identifier","link_to_vendor"],
+  ["text"," "],
+  ["variable","}}"],
+  ["text"," / "],
+  ["variable","{{"],
+  ["text"," "],
+  ["identifier","product"],
+  ["text","."],
+  ["identifier","title"],
+  ["text"," "],
+  ["variable","}}"]
+],[
+   "start",
+  ["text","    "],
+  ["variable","{%"],
+  ["text"," "],
+  ["keyword","else"],
+  ["text"," "],
+  ["variable","%}"]
+],[
+   "start",
+  ["text","       "],
+  ["variable","{{"],
+  ["text"," "],
+  ["identifier","page_title"],
+  ["text"," "],
+  ["variable","}}"]
+],[
+   "start",
+  ["text","  "],
+  ["variable","{%"],
+  ["text"," "],
+  ["keyword","endcase"],
+  ["text"," "],
+  ["variable","%}"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","h2"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","For Loops"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","h2"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","  "],
+  ["variable","{%"],
+  ["text"," "],
+  ["keyword","for"],
+  ["text"," "],
+  ["identifier","item"],
+  ["text"," "],
+  ["keyword","in"],
+  ["text"," "],
+  ["identifier","array"],
+  ["text"," "],
+  ["variable","%}"],
+  ["text"," "]
+],[
+   "start",
+  ["text","    "],
+  ["variable","{{"],
+  ["text"," "],
+  ["identifier","item"],
+  ["text"," "],
+  ["variable","}}"]
+],[
+   "start",
+  ["text","  "],
+  ["variable","{%"],
+  ["text"," "],
+  ["keyword","endfor"],
+  ["text"," "],
+  ["variable","%}"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","h2"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","Tables"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","h2"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","  "],
+  ["variable","{%"],
+  ["text"," "],
+  ["keyword","tablerow"],
+  ["text"," "],
+  ["identifier","item"],
+  ["text"," "],
+  ["keyword","in"],
+  ["text"," "],
+  ["identifier","items"],
+  ["text"," "],
+  ["identifier","cols"],
+  ["text",": "],
+  ["constant.numeric","3"],
+  ["text"," "],
+  ["variable","%}"]
+],[
+   "start",
+  ["text","    "],
+  ["variable","{%"],
+  ["text"," "],
+  ["keyword","if"],
+  ["text"," "],
+  ["variable.language","tablerowloop"],
+  ["text","."],
+  ["identifier","col_first"],
+  ["text"," "],
+  ["variable","%}"]
+],[
+   "start",
+  ["text","      First column: "],
+  ["variable","{{"],
+  ["text"," "],
+  ["identifier","item"],
+  ["text","."],
+  ["identifier","variable"],
+  ["text"," "],
+  ["variable","}}"]
+],[
+   "start",
+  ["text","    "],
+  ["variable","{%"],
+  ["text"," "],
+  ["keyword","else"],
+  ["text"," "],
+  ["variable","%}"]
+],[
+   "start",
+  ["text","      Different column: "],
+  ["variable","{{"],
+  ["text"," "],
+  ["identifier","item"],
+  ["text","."],
+  ["identifier","variable"],
+  ["text"," "],
+  ["variable","}}"]
+],[
+   "start",
+  ["text","    "],
+  ["variable","{%"],
+  ["text"," "],
+  ["keyword","endif"],
+  ["text"," "],
+  ["variable","%}"]
+],[
+   "start",
+  ["text","  "],
+  ["variable","{%"],
+  ["text"," "],
+  ["keyword","endtablerow"],
+  ["text"," "],
+  ["variable","%}"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_lisp.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_lisp.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_lisp.json
new file mode 100644
index 0000000..2e70a55
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_lisp.json
@@ -0,0 +1,248 @@
+[[
+   "start",
+  ["text","("],
+  ["storage.type.function-type.lisp","defun"],
+  ["text"," "],
+  ["entity.name.function.lisp","prompt-for-cd"],
+  ["text"," ()"]
+],[
+   "start",
+  ["text","   "],
+  ["string","\"Prompts"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","for"],
+  ["text"," "],
+  ["identifier","CD"],
+  ["text","\""]
+],[
+   "start",
+  ["text","   ("],
+  ["identifier","prompt"],
+  ["text","-"],
+  ["identifier","read"],
+  ["text"," "],
+  ["string","\"Title\""],
+  ["text"," "],
+  ["constant.numeric","1.53"],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["text","/"],
+  ["constant.numeric","4"],
+  ["text"," "],
+  ["constant.numeric","1.7"],
+  ["text"," "],
+  ["constant.numeric","1.7e0"],
+  ["text"," "],
+  ["constant.numeric","2.9E-4"],
+  ["text"," "],
+  ["constant.numeric","+42"],
+  ["text"," "],
+  ["constant.numeric","-7"],
+  ["text"," "],
+  ["punctuation.definition.constant.character.lisp","#"],
+  ["constant.character.lisp","b001"],
+  ["text"," "],
+  ["punctuation.definition.constant.character.lisp","#"],
+  ["constant.character.lisp","b001/100"],
+  ["text"," "],
+  ["punctuation.definition.constant.character.lisp","#"],
+  ["constant.character.lisp","o777"],
+  ["text"," "],
+  ["punctuation.definition.constant.character.lisp","#"],
+  ["constant.character.lisp","O777"],
+  ["text"," "],
+  ["punctuation.definition.constant.character.lisp","#"],
+  ["constant.character.lisp","xabc55"],
+  ["text"," "],
+  ["punctuation.definition.constant.character.lisp","#"],
+  ["constant.character.lisp","c"],
+  ["text","("],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["constant.numeric","-5.6"],
+  ["text","))"]
+],[
+   "start",
+  ["text","   ("],
+  ["identifier","prompt"],
+  ["text","-"],
+  ["identifier","read"],
+  ["text"," "],
+  ["string","\"Artist\""],
+  ["text"," &"],
+  ["identifier","rest"],
+  ["text",")"]
+],[
+   "start",
+  ["text","   ("],
+  ["keyword.operator","or"],
+  ["text"," ("],
+  ["identifier","parse"],
+  ["text","-"],
+  ["identifier","integer"],
+  ["text"," ("],
+  ["identifier","prompt"],
+  ["text","-"],
+  ["identifier","read"],
+  ["text"," "],
+  ["string","\"Rating\""],
+  ["text",") :"],
+  ["identifier","junk"],
+  ["text","-"],
+  ["identifier","allowed"],
+  ["text"," "],
+  ["support.function","t"],
+  ["text",") "],
+  ["constant.numeric","0"],
+  ["text",")"]
+],[
+   "start",
+  ["text","  ("],
+  ["keyword.control","if"],
+  ["text"," "],
+  ["identifier","x"],
+  ["text"," ("],
+  ["support.function","format"],
+  ["text"," "],
+  ["support.function","t"],
+  ["text"," "],
+  ["string","\"yes\""],
+  ["text",") ("],
+  ["support.function","format"],
+  ["text"," "],
+  ["support.function","t"],
+  ["text"," "],
+  ["string","\"no\""],
+  ["text"," "],
+  ["constant.language","nil"],
+  ["text",") "],
+  ["comment",";and here comment"]
+],[
+   "start",
+  ["text","  ) "],
+  ["constant.numeric","0xFFLL"],
+  ["text"," "],
+  ["constant.numeric","-23ull"]
+],[
+   "start",
+  ["text","  "],
+  ["comment",";; second line comment"]
+],[
+   "start",
+  ["text","  '(+ "],
+  ["constant.numeric","1"],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["text",")"]
+],[
+   "start",
+  ["text","  ("],
+  ["identifier","defvar"],
+  ["text"," "],
+  ["punctuation.definition.variable.lisp","*"],
+  ["variable.other.global.lisp","lines"],
+  ["punctuation.definition.variable.lisp","*"],
+  ["text",")                "],
+  ["comment","; list of all lines"]
+],[
+   "start",
+  ["text","  ("],
+  ["identifier","position"],
+  ["text","-"],
+  ["keyword.control","if"],
+  ["text","-"],
+  ["identifier","not"],
+  ["text"," "],
+  ["punctuation.definition.constant.character.lisp","#"],
+  ["constant.character.lisp","'sys::whitespacep"],
+  ["text"," "],
+  ["identifier","line"],
+  ["text"," :"],
+  ["identifier","start"],
+  ["text"," "],
+  ["identifier","beg"],
+  ["text","))"]
+],[
+   "start",
+  ["text","  ("],
+  ["support.function","quote"],
+  ["text"," ("],
+  ["identifier","privet"],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["text"," "],
+  ["constant.numeric","3"],
+  ["text","))"]
+],[
+   "start",
+  ["text","  '("],
+  ["identifier","hello"],
+  ["text"," "],
+  ["identifier","world"],
+  ["text",")"]
+],[
+   "start",
+  ["text","  (* "],
+  ["constant.numeric","5"],
+  ["text"," "],
+  ["constant.numeric","7"],
+  ["text",")"]
+],[
+   "start",
+  ["text","  ("],
+  ["constant.numeric","1"],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["text"," "],
+  ["constant.numeric","34"],
+  ["text"," "],
+  ["constant.numeric","5"],
+  ["text",")"]
+],[
+   "start",
+  ["text","  (:"],
+  ["identifier","use"],
+  ["text"," "],
+  ["string","\"aaaa\""],
+  ["text",")"]
+],[
+   "start",
+  ["text","  ("],
+  ["keyword.control","let"],
+  ["text"," (("],
+  ["identifier","x"],
+  ["text"," "],
+  ["constant.numeric","10"],
+  ["text",") ("],
+  ["identifier","y"],
+  ["text"," "],
+  ["constant.numeric","20"],
+  ["text","))"]
+],[
+   "start",
+  ["text","    ("],
+  ["identifier","print"],
+  ["text"," (+ "],
+  ["identifier","x"],
+  ["text"," "],
+  ["identifier","y"],
+  ["text","))"]
+],[
+   "start",
+  ["text","  ) "],
+  ["support.function","LAmbDa"]
+],[
+   "start"
+],[
+   "start",
+  ["text","  "],
+  ["string","\"asdad"],
+  ["constant.character.escape.lisp","\\0"],
+  ["string","eqweqe\""]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_livescript.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_livescript.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_livescript.json
new file mode 100644
index 0000000..c2bd83d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_livescript.json
@@ -0,0 +1,6 @@
+[[
+   "start",
+  ["comment","# comment"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_logiql.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_logiql.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_logiql.json
new file mode 100644
index 0000000..5f7eda4
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_logiql.json
@@ -0,0 +1,190 @@
+[[
+   "start",
+  ["comment.single","// ancestors"]
+],[
+   "start",
+  ["entity.name","parentof"],
+  ["text","("],
+  ["string","\"douglas\""],
+  ["keyword.other",","],
+  ["text"," "],
+  ["string","\"john\""],
+  ["text",")"],
+  ["keyword.end","."]
+],[
+   "start",
+  ["entity.name","parentof"],
+  ["text","("],
+  ["string","\"john\""],
+  ["keyword.other",","],
+  ["text"," "],
+  ["string","\"bob\""],
+  ["text",")"],
+  ["keyword.end","."]
+],[
+   "start",
+  ["entity.name","parentof"],
+  ["text","("],
+  ["string","\"bob\""],
+  ["keyword.other",","],
+  ["text"," "],
+  ["string","\"ebbon\""],
+  ["text",")"],
+  ["keyword.end","."]
+],[
+   "start"
+],[
+   "start",
+  ["entity.name","parentof"],
+  ["text","("],
+  ["string","\"douglas\""],
+  ["keyword.other",","],
+  ["text"," "],
+  ["string","\"jane\""],
+  ["text",")"],
+  ["keyword.end","."]
+],[
+   "start",
+  ["entity.name","parentof"],
+  ["text","("],
+  ["string","\"jane\""],
+  ["keyword.other",","],
+  ["text"," "],
+  ["string","\"jan\""],
+  ["text",")"],
+  ["keyword.end","."]
+],[
+   "start"
+],[
+   "start",
+  ["entity.name","ancestorof"],
+  ["text","("],
+  ["variable.parameter","A"],
+  ["keyword.other",","],
+  ["text"," "],
+  ["variable.parameter","B"],
+  ["text",") "],
+  ["keyword.start","<-"],
+  ["text"," "],
+  ["entity.name","parentof"],
+  ["text","("],
+  ["variable.parameter","A"],
+  ["keyword.other",","],
+  ["text"," "],
+  ["variable.parameter","B"],
+  ["text",")"],
+  ["keyword.end","."]
+],[
+   "start",
+  ["entity.name","ancestorof"],
+  ["text","("],
+  ["variable.parameter","A"],
+  ["keyword.other",","],
+  ["text"," "],
+  ["variable.parameter","C"],
+  ["text",") "],
+  ["keyword.start","<-"],
+  ["text"," "],
+  ["entity.name","ancestorof"],
+  ["text","("],
+  ["variable.parameter","A"],
+  ["keyword.other",","],
+  ["text"," "],
+  ["variable.parameter","B"],
+  ["text",")"],
+  ["keyword.other",","],
+  ["text"," "],
+  ["entity.name","parentof"],
+  ["text","("],
+  ["variable.parameter","B"],
+  ["keyword.other",","],
+  ["variable.parameter","C"],
+  ["text",")"],
+  ["keyword.end","."]
+],[
+   "start"
+],[
+   "start",
+  ["entity.name","grandparentof"],
+  ["text","("],
+  ["variable.parameter","A"],
+  ["keyword.other",","],
+  ["text"," "],
+  ["variable.parameter","B"],
+  ["text",") "],
+  ["keyword.start","<-"],
+  ["text"," "],
+  ["entity.name","parentof"],
+  ["text","("],
+  ["variable.parameter","A"],
+  ["keyword.other",","],
+  ["text"," "],
+  ["variable.parameter","C"],
+  ["text",")"],
+  ["keyword.other",","],
+  ["text"," "],
+  ["entity.name","parentof"],
+  ["text","("],
+  ["variable.parameter","C"],
+  ["keyword.other",","],
+  ["text"," "],
+  ["variable.parameter","B"],
+  ["text",")"],
+  ["keyword.end","."]
+],[
+   "start"
+],[
+   "start",
+  ["entity.name","cousins"],
+  ["text","("],
+  ["variable.parameter","A"],
+  ["keyword.other",","],
+  ["variable.parameter","B"],
+  ["text",") "],
+  ["keyword.start","<-"],
+  ["text"," "],
+  ["entity.name","grandparentof"],
+  ["text","("],
+  ["variable.parameter","C"],
+  ["keyword.other",","],
+  ["variable.parameter","A"],
+  ["text",")"],
+  ["keyword.other",","],
+  ["text"," "],
+  ["entity.name","grandparentof"],
+  ["text","("],
+  ["variable.parameter","C"],
+  ["keyword.other",","],
+  ["variable.parameter","B"],
+  ["text",")"],
+  ["keyword.end","."]
+],[
+   "start"
+],[
+   "start",
+  ["entity.name","parentof"],
+  ["text","["],
+  ["entity.name.type.logicblox","`arg"],
+  ["text","]("],
+  ["variable.parameter","A"],
+  ["keyword.other",","],
+  ["text"," "],
+  ["variable.parameter","B"],
+  ["text",") "],
+  ["keyword.start","->"],
+  ["text"," "],
+  ["entity.name","int"],
+  ["text","["],
+  ["constant.numeric","32"],
+  ["text","]("],
+  ["variable.parameter","A"],
+  ["text",")"],
+  ["keyword.other",","],
+  ["text"," "],
+  ["keyword.other","!"],
+  ["entity.name","string"],
+  ["text","("],
+  ["variable.parameter","B"],
+  ["text",")"],
+  ["keyword.end","."]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_lsl.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_lsl.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_lsl.json
new file mode 100644
index 0000000..83b7352
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_lsl.json
@@ -0,0 +1,495 @@
+[[
+   "comment",
+  ["comment.block.lsl","/*"]
+],[
+   "comment",
+  ["comment.block.lsl","    Testing syntax highlighting"]
+],[
+   "comment",
+  ["comment.block.lsl","    of Ace Editor"]
+],[
+   "comment",
+  ["comment.block.lsl","    for the Linden Scripting Language"]
+],[
+   "start",
+  ["comment.block.lsl","*/"]
+],[
+   "start"
+],[
+   "start",
+  ["storage.type.lsl","integer"],
+  ["text.lsl"," "],
+  ["identifier","someIntNormal"],
+  ["text.lsl","       "],
+  ["keyword.operator.lsl","="],
+  ["text.lsl"," "],
+  ["constant.numeric.lsl","3672"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start",
+  ["storage.type.lsl","integer"],
+  ["text.lsl"," "],
+  ["identifier","someIntHex"],
+  ["text.lsl","          "],
+  ["keyword.operator.lsl","="],
+  ["text.lsl"," "],
+  ["constant.numeric.lsl","0x00000000"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start",
+  ["storage.type.lsl","integer"],
+  ["text.lsl"," "],
+  ["identifier","someIntMath"],
+  ["text.lsl","         "],
+  ["keyword.operator.lsl","="],
+  ["text.lsl"," "],
+  ["constant.language.float.lsl","PI_BY_TWO"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start"
+],[
+   "start",
+  ["storage.type.lsl","integer"],
+  ["text.lsl"," "],
+  ["invalid.unimplemented.lsl","event"],
+  ["text.lsl","               "],
+  ["keyword.operator.lsl","="],
+  ["text.lsl"," "],
+  ["constant.numeric.lsl","5673"],
+  ["punctuation.operator.lsl",";"],
+  ["text.lsl","                                             "],
+  ["comment.line.double-slash.lsl","// unimplemented reserved keyword!"]
+],[
+   "start"
+],[
+   "start",
+  ["storage.type.lsl","key"],
+  ["text.lsl"," "],
+  ["identifier","someKeyTexture"],
+  ["text.lsl","          "],
+  ["keyword.operator.lsl","="],
+  ["text.lsl"," "],
+  ["constant.language.string.lsl","TEXTURE_DEFAULT"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start",
+  ["storage.type.lsl","string"],
+  ["text.lsl"," "],
+  ["identifier","someStringSpecial"],
+  ["text.lsl","    "],
+  ["keyword.operator.lsl","="],
+  ["text.lsl"," "],
+  ["constant.language.string.lsl","EOF"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start"
+],[
+   "start",
+  ["identifier","some_user_defined_function_without_return_type"],
+  ["paren.lparen.lsl","("],
+  ["storage.type.lsl","string"],
+  ["text.lsl"," "],
+  ["identifier","inputAsString"],
+  ["paren.rparen.lsl",")"]
+],[
+   "start",
+  ["paren.lparen.lsl","{"]
+],[
+   "start",
+  ["text.lsl","    "],
+  ["support.function.lsl","llSay"],
+  ["paren.lparen.lsl","("],
+  ["constant.language.integer.lsl","PUBLIC_CHANNEL"],
+  ["punctuation.operator.lsl",","],
+  ["text.lsl"," "],
+  ["identifier","inputAsString"],
+  ["paren.rparen.lsl",")"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start",
+  ["paren.rparen.lsl","}"]
+],[
+   "start"
+],[
+   "start",
+  ["storage.type.lsl","string"],
+  ["text.lsl"," "],
+  ["identifier","user_defined_function_returning_a_string"],
+  ["paren.lparen.lsl","("],
+  ["storage.type.lsl","key"],
+  ["text.lsl"," "],
+  ["identifier","inputAsKey"],
+  ["paren.rparen.lsl",")"]
+],[
+   "start",
+  ["paren.lparen.lsl","{"]
+],[
+   "start",
+  ["text.lsl","    "],
+  ["keyword.control.lsl","return"],
+  ["text.lsl"," "],
+  ["paren.lparen.lsl","("],
+  ["storage.type.lsl","string"],
+  ["paren.rparen.lsl",")"],
+  ["identifier","inputAsKey"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start",
+  ["paren.rparen.lsl","}"]
+],[
+   "start"
+],[
+   "start",
+  ["entity.name.state.lsl","default"]
+],[
+   "start",
+  ["paren.lparen.lsl","{"]
+],[
+   "start",
+  ["text.lsl","    "],
+  ["support.function.event.lsl","state_entry"],
+  ["paren.lparen.lsl","("],
+  ["paren.rparen.lsl",")"]
+],[
+   "start",
+  ["text.lsl","    "],
+  ["paren.lparen.lsl","{"]
+],[
+   "start",
+  ["text.lsl","        "],
+  ["storage.type.lsl","key"],
+  ["text.lsl"," "],
+  ["identifier","someKey"],
+  ["text.lsl"," "],
+  ["keyword.operator.lsl","="],
+  ["text.lsl"," "],
+  ["constant.language.string.lsl","NULL_KEY"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start",
+  ["text.lsl","        "],
+  ["identifier","someKey"],
+  ["text.lsl"," "],
+  ["keyword.operator.lsl","="],
+  ["text.lsl"," "],
+  ["support.function.lsl","llGetOwner"],
+  ["paren.lparen.lsl","("],
+  ["paren.rparen.lsl",")"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start"
+],[
+   "start",
+  ["text.lsl","        "],
+  ["storage.type.lsl","string"],
+  ["text.lsl"," "],
+  ["identifier","someString"],
+  ["text.lsl"," "],
+  ["keyword.operator.lsl","="],
+  ["text.lsl"," "],
+  ["identifier","user_defined_function_returning_a_string"],
+  ["paren.lparen.lsl","("],
+  ["identifier","someKey"],
+  ["paren.rparen.lsl",")"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start"
+],[
+   "start",
+  ["text.lsl","        "],
+  ["identifier","some_user_defined_function_without_return_type"],
+  ["paren.lparen.lsl","("],
+  ["identifier","someString"],
+  ["paren.rparen.lsl",")"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start",
+  ["text.lsl","    "],
+  ["paren.rparen.lsl","}"]
+],[
+   "start"
+],[
+   "start",
+  ["text.lsl","    "],
+  ["support.function.event.lsl","touch_start"],
+  ["paren.lparen.lsl","("],
+  ["storage.type.lsl","integer"],
+  ["text.lsl"," "],
+  ["identifier","num_detected"],
+  ["paren.rparen.lsl",")"]
+],[
+   "start",
+  ["text.lsl","    "],
+  ["paren.lparen.lsl","{"]
+],[
+   "start",
+  ["text.lsl","        "],
+  ["storage.type.lsl","list"],
+  ["text.lsl"," "],
+  ["identifier","agentsInRegion"],
+  ["text.lsl"," "],
+  ["keyword.operator.lsl","="],
+  ["text.lsl"," "],
+  ["support.function.lsl","llGetAgentList"],
+  ["paren.lparen.lsl","("],
+  ["constant.language.integer.lsl","AGENT_LIST_REGION"],
+  ["punctuation.operator.lsl",","],
+  ["text.lsl"," "],
+  ["paren.lparen.lsl","["],
+  ["paren.rparen.lsl","])"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start",
+  ["text.lsl","        "],
+  ["storage.type.lsl","integer"],
+  ["text.lsl"," "],
+  ["identifier","numOfAgents"],
+  ["text.lsl"," "],
+  ["keyword.operator.lsl","="],
+  ["text.lsl"," "],
+  ["support.function.lsl","llGetListLength"],
+  ["paren.lparen.lsl","("],
+  ["identifier","agentsInRegion"],
+  ["paren.rparen.lsl",")"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start"
+],[
+   "start",
+  ["text.lsl","        "],
+  ["storage.type.lsl","integer"],
+  ["text.lsl"," "],
+  ["identifier","index"],
+  ["punctuation.operator.lsl",";"],
+  ["text.lsl","                                                          "],
+  ["comment.line.double-slash.lsl","// defaults to 0"]
+],[
+   "start",
+  ["text.lsl","        "],
+  ["keyword.control.lsl","for"],
+  ["text.lsl"," "],
+  ["paren.lparen.lsl","("],
+  ["punctuation.operator.lsl",";"],
+  ["text.lsl"," "],
+  ["identifier","index"],
+  ["text.lsl"," "],
+  ["keyword.operator.lsl","<="],
+  ["text.lsl"," "],
+  ["identifier","numOfAgents"],
+  ["text.lsl"," "],
+  ["keyword.operator.lsl","-"],
+  ["text.lsl"," "],
+  ["constant.numeric.lsl","1"],
+  ["punctuation.operator.lsl",";"],
+  ["text.lsl"," "],
+  ["identifier","index"],
+  ["keyword.operator.lsl","++"],
+  ["paren.rparen.lsl",")"],
+  ["text.lsl","                               "],
+  ["comment.line.double-slash.lsl","// for each agent in region"]
+],[
+   "start",
+  ["text.lsl","        "],
+  ["paren.lparen.lsl","{"]
+],[
+   "start",
+  ["text.lsl","            "],
+  ["support.function.lsl","llRegionSayTo"],
+  ["paren.lparen.lsl","("],
+  ["support.function.lsl","llList2Key"],
+  ["paren.lparen.lsl","("],
+  ["identifier","agentsInRegion"],
+  ["punctuation.operator.lsl",","],
+  ["text.lsl"," "],
+  ["identifier","index"],
+  ["paren.rparen.lsl",")"],
+  ["punctuation.operator.lsl",","],
+  ["text.lsl"," "],
+  ["constant.language.integer.lsl","PUBLIC_CHANNEL"],
+  ["punctuation.operator.lsl",","],
+  ["text.lsl"," "],
+  ["string.quoted.double.lsl.start","\""],
+  ["string.quoted.double.lsl","Hello, Avatar!"],
+  ["string.quoted.double.lsl.end","\""],
+  ["paren.rparen.lsl",")"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start",
+  ["text.lsl","        "],
+  ["paren.rparen.lsl","}"]
+],[
+   "start",
+  ["text.lsl","    "],
+  ["paren.rparen.lsl","}"]
+],[
+   "start"
+],[
+   "start",
+  ["text.lsl","    "],
+  ["support.function.event.lsl","touch_end"],
+  ["paren.lparen.lsl","("],
+  ["storage.type.lsl","integer"],
+  ["text.lsl"," "],
+  ["identifier","num_detected"],
+  ["paren.rparen.lsl",")"]
+],[
+   "start",
+  ["text.lsl","    "],
+  ["paren.lparen.lsl","{"]
+],[
+   "start",
+  ["text.lsl","        "],
+  ["identifier","someIntNormal"],
+  ["text.lsl","       "],
+  ["keyword.operator.lsl","="],
+  ["text.lsl"," "],
+  ["constant.numeric.lsl","3672"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start",
+  ["text.lsl","        "],
+  ["identifier","someIntHex"],
+  ["text.lsl","          "],
+  ["keyword.operator.lsl","="],
+  ["text.lsl"," "],
+  ["constant.numeric.lsl","0x00000000"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start",
+  ["text.lsl","        "],
+  ["identifier","someIntMath"],
+  ["text.lsl","         "],
+  ["keyword.operator.lsl","="],
+  ["text.lsl"," "],
+  ["constant.language.float.lsl","PI_BY_TWO"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start"
+],[
+   "start",
+  ["text.lsl","        "],
+  ["invalid.unimplemented.lsl","event"],
+  ["text.lsl","               "],
+  ["keyword.operator.lsl","="],
+  ["text.lsl"," "],
+  ["constant.numeric.lsl","5673"],
+  ["punctuation.operator.lsl",";"],
+  ["text.lsl","                                             "],
+  ["comment.line.double-slash.lsl","// unimplemented reserved keyword!"]
+],[
+   "start"
+],[
+   "start",
+  ["text.lsl","        "],
+  ["identifier","someKeyTexture"],
+  ["text.lsl","      "],
+  ["keyword.operator.lsl","="],
+  ["text.lsl"," "],
+  ["constant.language.string.lsl","TEXTURE_DEFAULT"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start",
+  ["text.lsl","        "],
+  ["identifier","someStringSpecial"],
+  ["text.lsl","   "],
+  ["keyword.operator.lsl","="],
+  ["text.lsl"," "],
+  ["constant.language.string.lsl","EOF"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start"
+],[
+   "start",
+  ["text.lsl","        "],
+  ["invalid.deprecated.lsl","llCloud"],
+  ["paren.lparen.lsl","("],
+  ["constant.language.vector.lsl","ZERO_VECTOR"],
+  ["paren.rparen.lsl",")"],
+  ["punctuation.operator.lsl",";"],
+  ["text.lsl","                                                   "],
+  ["comment.line.double-slash.lsl","// invalid deprecated function!"]
+],[
+   "start"
+],[
+   "start",
+  ["text.lsl","        "],
+  ["support.function.lsl","llWhisper"],
+  ["paren.lparen.lsl","("],
+  ["constant.language.integer.lsl","PUBLIC_CHANNEL"],
+  ["punctuation.operator.lsl",","],
+  ["text.lsl"," "],
+  ["string.quoted.double.lsl.start","\""],
+  ["string.quoted.double.lsl","Leaving "],
+  ["constant.language.escape.lsl","\\\""],
+  ["string.quoted.double.lsl","default"],
+  ["constant.language.escape.lsl","\\\""],
+  ["string.quoted.double.lsl"," now..."],
+  ["string.quoted.double.lsl.end","\""],
+  ["paren.rparen.lsl",")"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start",
+  ["text.lsl","        "],
+  ["entity.name.state.lsl","state other"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start",
+  ["text.lsl","    "],
+  ["paren.rparen.lsl","}"]
+],[
+   "start",
+  ["paren.rparen.lsl","}"]
+],[
+   "start"
+],[
+   "start",
+  ["entity.name.state.lsl","state other"]
+],[
+   "start",
+  ["paren.lparen.lsl","{"]
+],[
+   "start",
+  ["text.lsl","    "],
+  ["support.function.event.lsl","state_entry"],
+  ["paren.lparen.lsl","("],
+  ["paren.rparen.lsl",")"]
+],[
+   "start",
+  ["text.lsl","    "],
+  ["paren.lparen.lsl","{"]
+],[
+   "start",
+  ["text.lsl","        "],
+  ["support.function.lsl","llWhisper"],
+  ["paren.lparen.lsl","("],
+  ["constant.language.integer.lsl","PUBLIC_CHANNEL"],
+  ["punctuation.operator.lsl",","],
+  ["text.lsl"," "],
+  ["string.quoted.double.lsl.start","\""],
+  ["string.quoted.double.lsl","Entered "],
+  ["constant.language.escape.lsl","\\\""],
+  ["string.quoted.double.lsl","state other"],
+  ["constant.language.escape.lsl","\\\""],
+  ["string.quoted.double.lsl",", returning to "],
+  ["constant.language.escape.lsl","\\\""],
+  ["string.quoted.double.lsl","default"],
+  ["constant.language.escape.lsl","\\\""],
+  ["string.quoted.double.lsl"," again..."],
+  ["string.quoted.double.lsl.end","\""],
+  ["paren.rparen.lsl",")"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start",
+  ["text.lsl","        "],
+  ["entity.name.state.lsl","state default"],
+  ["punctuation.operator.lsl",";"]
+],[
+   "start",
+  ["text.lsl","    "],
+  ["paren.rparen.lsl","}"]
+],[
+   "start",
+  ["paren.rparen.lsl","}"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_lua.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_lua.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_lua.json
new file mode 100644
index 0000000..276b3ff
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_lua.json
@@ -0,0 +1,348 @@
+[[
+   ["bracketedComment",2,"start"],
+  ["comment","--[[--"]
+],[
+   ["bracketedComment",2,"start"],
+  ["comment","num_args takes in 5.1 byte code and extracts the number of arguments"]
+],[
+   ["bracketedComment",2,"start"],
+  ["comment","from its function header."]
+],[
+   "start",
+  ["comment","--]]--"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","function"],
+  ["text"," "],
+  ["identifier","int"],
+  ["paren.lparen","("],
+  ["identifier","t"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword","return"],
+  ["text"," "],
+  ["identifier","t"],
+  ["keyword.operator",":"],
+  ["support.function","byte"],
+  ["paren.lparen","("],
+  ["constant.numeric","1"],
+  ["paren.rparen",")"],
+  ["keyword.operator","+"],
+  ["identifier","t"],
+  ["keyword.operator",":"],
+  ["support.function","byte"],
+  ["paren.lparen","("],
+  ["constant.numeric","2"],
+  ["paren.rparen",")"],
+  ["keyword.operator","*"],
+  ["constant.numeric","0x100"],
+  ["keyword.operator","+"],
+  ["identifier","t"],
+  ["keyword.operator",":"],
+  ["support.function","byte"],
+  ["paren.lparen","("],
+  ["constant.numeric","3"],
+  ["paren.rparen",")"],
+  ["keyword.operator","*"],
+  ["constant.numeric","0x10000"],
+  ["keyword.operator","+"],
+  ["identifier","t"],
+  ["keyword.operator",":"],
+  ["support.function","byte"],
+  ["paren.lparen","("],
+  ["constant.numeric","4"],
+  ["paren.rparen",")"],
+  ["keyword.operator","*"],
+  ["constant.numeric","0x1000000"]
+],[
+   "start",
+  ["keyword","end"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","function"],
+  ["text"," "],
+  ["identifier","num_args"],
+  ["paren.lparen","("],
+  ["identifier","func"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword","local"],
+  ["text"," "],
+  ["support.function","dump"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.library","string"],
+  ["text","."],
+  ["support.function","dump"],
+  ["paren.lparen","("],
+  ["identifier","func"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword","local"],
+  ["text"," "],
+  ["identifier","offset"],
+  ["text",", "],
+  ["identifier","cursor"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","int"],
+  ["paren.lparen","("],
+  ["support.function","dump"],
+  ["keyword.operator",":"],
+  ["support.function","sub"],
+  ["paren.lparen","("],
+  ["constant.numeric","13"],
+  ["paren.rparen","))"],
+  ["text",", "],
+  ["identifier","offset"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["constant.numeric","26"]
+],[
+   "start",
+  ["text","\t"],
+  ["comment","--Get the params and var flag (whether there's a ... in the param)"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword","return"],
+  ["text"," "],
+  ["support.function","dump"],
+  ["keyword.operator",":"],
+  ["support.function","sub"],
+  ["paren.lparen","("],
+  ["identifier","cursor"],
+  ["paren.rparen",")"],
+  ["keyword.operator",":"],
+  ["support.function","byte"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text",", "],
+  ["support.function","dump"],
+  ["keyword.operator",":"],
+  ["support.function","sub"],
+  ["paren.lparen","("],
+  ["identifier","cursor"],
+  ["keyword.operator","+"],
+  ["constant.numeric","1"],
+  ["paren.rparen",")"],
+  ["keyword.operator",":"],
+  ["support.function","byte"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["keyword","end"]
+],[
+   "start"
+],[
+   "start",
+  ["comment","-- Usage:"]
+],[
+   "start",
+  ["identifier","num_args"],
+  ["paren.lparen","("],
+  ["keyword","function"],
+  ["paren.lparen","("],
+  ["identifier","a"],
+  ["text",","],
+  ["identifier","b"],
+  ["text",","],
+  ["identifier","c"],
+  ["text",","],
+  ["identifier","d"],
+  ["text",", "],
+  ["keyword.operator","..."],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["keyword","end"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["comment","-- return 4, 7"]
+],[
+   "start"
+],[
+   "start",
+  ["comment","-- Python styled string format operator"]
+],[
+   "start",
+  ["keyword","local"],
+  ["text"," "],
+  ["identifier","gm"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.library","debug"],
+  ["text","."],
+  ["support.function","getmetatable"],
+  ["paren.lparen","("],
+  ["string","\"\""],
+  ["paren.rparen",")"]
+],[
+   "start"
+],[
+   "start",
+  ["identifier","gm"],
+  ["text","."],
+  ["support.function","__mod"],
+  ["keyword.operator","="],
+  ["keyword","function"],
+  ["paren.lparen","("],
+  ["identifier","self"],
+  ["text",", "],
+  ["identifier","other"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","if"],
+  ["text"," "],
+  ["support.function","type"],
+  ["paren.lparen","("],
+  ["identifier","other"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["keyword.operator","~="],
+  ["text"," "],
+  ["string","\"table\""],
+  ["text"," "],
+  ["keyword","then"],
+  ["text"," "],
+  ["identifier","other"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","{"],
+  ["identifier","other"],
+  ["paren.rparen","}"],
+  ["text"," "],
+  ["keyword","end"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","for"],
+  ["text"," "],
+  ["identifier","i"],
+  ["text",","],
+  ["identifier","v"],
+  ["text"," "],
+  ["keyword","in"],
+  ["text"," "],
+  ["support.function","ipairs"],
+  ["paren.lparen","("],
+  ["identifier","other"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["keyword","do"],
+  ["text"," "],
+  ["identifier","other"],
+  ["paren.lparen","["],
+  ["identifier","i"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["support.function","tostring"],
+  ["paren.lparen","("],
+  ["identifier","v"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["keyword","end"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","return"],
+  ["text"," "],
+  ["identifier","self"],
+  ["keyword.operator",":"],
+  ["support.function","format"],
+  ["paren.lparen","("],
+  ["support.function","unpack"],
+  ["paren.lparen","("],
+  ["identifier","other"],
+  ["paren.rparen","))"]
+],[
+   "start",
+  ["keyword","end"]
+],[
+   "start"
+],[
+   ["bracketedString",5,"start"],
+  ["support.function","print"],
+  ["paren.lparen","("],
+  ["comment","[===["]
+],[
+   ["bracketedString",5,"start"],
+  ["comment","    blah blah %s, (%d %d)"]
+],[
+   "start",
+  ["comment","]===]"],
+  ["keyword.operator","%"],
+  ["paren.lparen","{"],
+  ["string","\"blah\""],
+  ["text",", "],
+  ["identifier","num_args"],
+  ["paren.lparen","("],
+  ["identifier","int"],
+  ["paren.rparen",")})"]
+],[
+   "start"
+],[
+   ["bracketedComment",3,"start"],
+  ["comment","--[=[--"]
+],[
+   ["bracketedComment",3,"start"],
+  ["comment","table.maxn is deprecated, use # instead."]
+],[
+   "start",
+  ["comment","--]=]--"]
+],[
+   "start",
+  ["support.function","print"],
+  ["paren.lparen","("],
+  ["constant.library","table"],
+  ["text","."],
+  ["invalid.deprecated","maxn"],
+  ["paren.lparen","{"],
+  ["constant.numeric","1"],
+  ["text",","],
+  ["constant.numeric","2"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["constant.numeric","4"],
+  ["paren.rparen","]"],
+  ["keyword.operator","="],
+  ["constant.numeric","4"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["constant.numeric","8"],
+  ["paren.rparen","]"],
+  ["keyword.operator","="],
+  ["constant.numeric","8"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["comment","-- outputs 8 instead of 2"]
+],[
+   "start"
+],[
+   "start",
+  ["support.function","print"],
+  ["paren.lparen","("],
+  ["constant.numeric","5"],
+  ["text"," "],
+  ["comment","--[[ blah ]]"],
+  ["paren.rparen",")"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_luapage.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_luapage.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_luapage.json
new file mode 100644
index 0000000..3cee081
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_luapage.json
@@ -0,0 +1,633 @@
+[[
+   "doctype",
+  ["text",""],
+  ["punctuation.doctype.begin","<!"],
+  ["meta.tag.doctype","DOCTYPE"],
+  ["text"," "],
+  ["xml-pe","html"],
+  ["text"," "],
+  ["xml-pe","PUBLIC"],
+  ["text"," "],
+  ["string","\"-//W3C//DTD XHTML 1.0 Strict//EN\""]
+],[
+   "start",
+  ["text","   "],
+  ["string","\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\""],
+  ["punctuation.doctype.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","html"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   ["lua-bracketedComment",2,"lua-start"],
+  ["keyword","<%"],
+  ["text"," "],
+  ["comment","--[[--"]
+],[
+   ["lua-bracketedComment",2,"lua-start"],
+  ["comment","    index.lp from the Kepler Project's LuaDoc HTML doclet."]
+],[
+   ["lua-bracketedComment",2,"lua-start"],
+  ["comment","    http://keplerproject.github.com/luadoc/"]
+],[
+   "start",
+  ["comment","--]]"],
+  ["text"," "],
+  ["keyword","%>"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","head"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","title"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","Reference"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","title"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","link"],
+  ["text"," "],
+  ["entity.other.attribute-name","rel"],
+  ["keyword.operator.separator","="],
+  ["string","\"stylesheet\""],
+  ["text"," "],
+  ["entity.other.attribute-name","href"],
+  ["keyword.operator.separator","="],
+  ["string","\""],
+  ["keyword","<%="],
+  ["identifier","luadoc"],
+  ["text","."],
+  ["identifier","doclet"],
+  ["text","."],
+  ["identifier","html"],
+  ["text","."],
+  ["identifier","link"],
+  ["paren.lparen","("],
+  ["string","\"luadoc.css\""],
+  ["paren.rparen",")"],
+  ["keyword","%>"],
+  ["string","\""],
+  ["text"," "],
+  ["entity.other.attribute-name","type"],
+  ["keyword.operator.separator","="],
+  ["string","\"text/css\""],
+  ["text"," "],
+  ["meta.tag.punctuation.end","/>"]
+],[
+   "start",
+  ["text","\t"],
+  ["comment","<!--meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/-->"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","head"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","body"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","div"],
+  ["text"," "],
+  ["entity.other.attribute-name","id"],
+  ["keyword.operator.separator","="],
+  ["string","\"container\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","div"],
+  ["text"," "],
+  ["entity.other.attribute-name","id"],
+  ["keyword.operator.separator","="],
+  ["string","\"product\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","\t"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","div"],
+  ["text"," "],
+  ["entity.other.attribute-name","id"],
+  ["keyword.operator.separator","="],
+  ["string","\"product_logo\""],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","div"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","\t"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","div"],
+  ["text"," "],
+  ["entity.other.attribute-name","id"],
+  ["keyword.operator.separator","="],
+  ["string","\"product_name\""],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","big"],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","b"],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","b"],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","big"],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","div"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","\t"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","div"],
+  ["text"," "],
+  ["entity.other.attribute-name","id"],
+  ["keyword.operator.separator","="],
+  ["string","\"product_description\""],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","div"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","div"],
+  ["meta.tag.punctuation.end",">"],
+  ["text"," "],
+  ["comment","<!-- id=\"product\" -->"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","div"],
+  ["text"," "],
+  ["entity.other.attribute-name","id"],
+  ["keyword.operator.separator","="],
+  ["string","\"main\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","div"],
+  ["text"," "],
+  ["entity.other.attribute-name","id"],
+  ["keyword.operator.separator","="],
+  ["string","\"navigation\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["keyword","<%="],
+  ["identifier","luadoc"],
+  ["text","."],
+  ["identifier","doclet"],
+  ["text","."],
+  ["identifier","html"],
+  ["text","."],
+  ["identifier","include"],
+  ["paren.lparen","("],
+  ["string","\"menu.lp\""],
+  ["text",", "],
+  ["paren.lparen","{"],
+  ["text"," "],
+  ["identifier","doc"],
+  ["keyword.operator","="],
+  ["identifier","doc"],
+  ["text"," "],
+  ["paren.rparen","})"],
+  ["keyword","%>"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","div"],
+  ["meta.tag.punctuation.end",">"],
+  ["text"," "],
+  ["comment","<!-- id=\"navigation\" -->"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","div"],
+  ["text"," "],
+  ["entity.other.attribute-name","id"],
+  ["keyword.operator.separator","="],
+  ["string","\"content\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["keyword","<%if"],
+  ["text"," "],
+  ["keyword","not"],
+  ["text"," "],
+  ["identifier","options"],
+  ["text","."],
+  ["identifier","nomodules"],
+  ["text"," "],
+  ["keyword","and"],
+  ["text"," "],
+  ["keyword.operator","#"],
+  ["identifier","doc"],
+  ["text","."],
+  ["identifier","modules"],
+  ["text"," "],
+  ["keyword.operator",">"],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["keyword","then%>"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","h2"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","Modules"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","h2"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","table"],
+  ["text"," "],
+  ["entity.other.attribute-name","class"],
+  ["keyword.operator.separator","="],
+  ["string","\"module_list\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["comment","<!--<tr><td colspan=\"2\">Modules</td></tr>-->"]
+],[
+   "start",
+  ["keyword","<%for"],
+  ["text"," "],
+  ["identifier","_"],
+  ["text",", "],
+  ["identifier","modulename"],
+  ["text"," "],
+  ["keyword","in"],
+  ["text"," "],
+  ["support.function","ipairs"],
+  ["paren.lparen","("],
+  ["identifier","doc"],
+  ["text","."],
+  ["identifier","modules"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["keyword","do%>"]
+],[
+   "start",
+  ["text","\t"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","tr"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","td"],
+  ["text"," "],
+  ["entity.other.attribute-name","class"],
+  ["keyword.operator.separator","="],
+  ["string","\"name\""],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.anchor","a"],
+  ["text"," "],
+  ["entity.other.attribute-name","href"],
+  ["keyword.operator.separator","="],
+  ["string","\""],
+  ["keyword","<%="],
+  ["identifier","luadoc"],
+  ["text","."],
+  ["identifier","doclet"],
+  ["text","."],
+  ["identifier","html"],
+  ["text","."],
+  ["identifier","module_link"],
+  ["paren.lparen","("],
+  ["identifier","modulename"],
+  ["text",", "],
+  ["identifier","doc"],
+  ["paren.rparen",")"],
+  ["keyword","%>"],
+  ["string","\""],
+  ["meta.tag.punctuation.end",">"],
+  ["keyword","<%="],
+  ["identifier","modulename"],
+  ["keyword","%>"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.anchor","a"],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","td"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","td"],
+  ["text"," "],
+  ["entity.other.attribute-name","class"],
+  ["keyword.operator.separator","="],
+  ["string","\"summary\""],
+  ["meta.tag.punctuation.end",">"],
+  ["keyword","<%="],
+  ["identifier","doc"],
+  ["text","."],
+  ["identifier","modules"],
+  ["paren.lparen","["],
+  ["identifier","modulename"],
+  ["paren.rparen","]"],
+  ["text","."],
+  ["identifier","summary"],
+  ["keyword","%>"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","td"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","\t"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","tr"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["keyword","<%end%>"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","table"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["keyword","<%end%>"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["keyword","<%if"],
+  ["text"," "],
+  ["keyword","not"],
+  ["text"," "],
+  ["identifier","options"],
+  ["text","."],
+  ["identifier","nofiles"],
+  ["text"," "],
+  ["keyword","and"],
+  ["text"," "],
+  ["keyword.operator","#"],
+  ["identifier","doc"],
+  ["text","."],
+  ["identifier","files"],
+  ["text"," "],
+  ["keyword.operator",">"],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["keyword","then%>"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","h2"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","Files"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","h2"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","table"],
+  ["text"," "],
+  ["entity.other.attribute-name","class"],
+  ["keyword.operator.separator","="],
+  ["string","\"file_list\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["comment","<!--<tr><td colspan=\"2\">Files</td></tr>-->"]
+],[
+   "start",
+  ["keyword","<%for"],
+  ["text"," "],
+  ["identifier","_"],
+  ["text",", "],
+  ["identifier","filepath"],
+  ["text"," "],
+  ["keyword","in"],
+  ["text"," "],
+  ["support.function","ipairs"],
+  ["paren.lparen","("],
+  ["identifier","doc"],
+  ["text","."],
+  ["identifier","files"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["keyword","do%>"]
+],[
+   "start",
+  ["text","\t"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","tr"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","td"],
+  ["text"," "],
+  ["entity.other.attribute-name","class"],
+  ["keyword.operator.separator","="],
+  ["string","\"name\""],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.anchor","a"],
+  ["text"," "],
+  ["entity.other.attribute-name","href"],
+  ["keyword.operator.separator","="],
+  ["string","\""],
+  ["keyword","<%="],
+  ["identifier","luadoc"],
+  ["text","."],
+  ["identifier","doclet"],
+  ["text","."],
+  ["identifier","html"],
+  ["text","."],
+  ["identifier","file_link"],
+  ["paren.lparen","("],
+  ["identifier","filepath"],
+  ["paren.rparen",")"],
+  ["keyword","%>"],
+  ["string","\""],
+  ["meta.tag.punctuation.end",">"],
+  ["keyword","<%="],
+  ["identifier","filepath"],
+  ["keyword","%>"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.anchor","a"],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","td"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","td"],
+  ["text"," "],
+  ["entity.other.attribute-name","class"],
+  ["keyword.operator.separator","="],
+  ["string","\"summary\""],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","td"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","\t"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","tr"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["keyword","<%end%>"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","table"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["keyword","<%end%>"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","div"],
+  ["meta.tag.punctuation.end",">"],
+  ["text"," "],
+  ["comment","<!-- id=\"content\" -->"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","div"],
+  ["meta.tag.punctuation.end",">"],
+  ["text"," "],
+  ["comment","<!-- id=\"main\" -->"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","div"],
+  ["text"," "],
+  ["entity.other.attribute-name","id"],
+  ["keyword.operator.separator","="],
+  ["string","\"about\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","\t"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.anchor","a"],
+  ["text"," "],
+  ["entity.other.attribute-name","href"],
+  ["keyword.operator.separator","="],
+  ["string","\"http://validator.w3.org/check?uri=referer\""],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.image","img"],
+  ["text"," "],
+  ["entity.other.attribute-name","src"],
+  ["keyword.operator.separator","="],
+  ["string","\"http://www.w3.org/Icons/valid-xhtml10\""],
+  ["text"," "],
+  ["entity.other.attribute-name","alt"],
+  ["keyword.operator.separator","="],
+  ["string","\"Valid XHTML 1.0!\""],
+  ["text"," "],
+  ["entity.other.attribute-name","height"],
+  ["keyword.operator.separator","="],
+  ["string","\"31\""],
+  ["text"," "],
+  ["entity.other.attribute-name","width"],
+  ["keyword.operator.separator","="],
+  ["string","\"88\""],
+  ["text"," "],
+  ["meta.tag.punctuation.end","/>"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.anchor","a"],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","div"],
+  ["meta.tag.punctuation.end",">"],
+  ["text"," "],
+  ["comment","<!-- id=\"about\" -->"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","div"],
+  ["meta.tag.punctuation.end",">"],
+  ["text"," "],
+  ["comment","<!-- id=\"container\" -->"],
+  ["text","\t"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","body"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","html"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_lucene.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_lucene.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_lucene.json
new file mode 100644
index 0000000..1f6d298
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_lucene.json
@@ -0,0 +1,92 @@
+[[
+   "start",
+  ["keyword","test:"],
+  ["text"," recognises "],
+  ["keyword.operator","AND"],
+  ["text"," as keyword"]
+],[
+   "start",
+  ["keyword","test:"],
+  ["text"," recognises "],
+  ["keyword.operator","OR"],
+  ["text"," as keyword"]
+],[
+   "start",
+  ["keyword","test:"],
+  ["text"," recognises "],
+  ["keyword.operator","NOT"],
+  ["text"," as keyword"]
+],[
+   "start",
+  ["keyword","test:"],
+  ["text"," recognises "],
+  ["string","\"hello this is dog\""],
+  ["text"," as string"]
+],[
+   "start",
+  ["keyword","test:"],
+  ["text"," recognises "],
+  ["constant.character.negation","-"],
+  ["string","\"hello this is dog\""],
+  ["text"," as negation with string"]
+],[
+   "start",
+  ["keyword","test:"],
+  ["text"," recognises "],
+  ["constant.character.proximity","~100"],
+  ["text"," as text with proximity"]
+],[
+   "start",
+  ["keyword","test:"],
+  ["text"," recognises "],
+  ["string","\"hello this is dog\""],
+  ["constant.character.proximity","~100"],
+  ["text"," as string with proximity"]
+],[
+   "start",
+  ["keyword","test:"],
+  ["text"," recognises "],
+  ["keyword","raw:"],
+  ["string","\"hello this is dog\""],
+  ["text"," as keyword"]
+],[
+   "start",
+  ["keyword","test:"],
+  ["text"," recognises "],
+  ["keyword","raw:"],
+  ["text","foo as\"keyword'"]
+],[
+   "start",
+  ["keyword","test:"],
+  ["text"," recognises "],
+  ["string","\"(\""],
+  ["text"," as opening parenthesis"]
+],[
+   "start",
+  ["keyword","test:"],
+  ["text"," recognises "],
+  ["string","\")\""],
+  ["text"," as closing parenthesis"]
+],[
+   "start",
+  ["keyword","test:"],
+  ["text"," recognises foo"],
+  ["constant.character.asterisk","*"],
+  ["text"," as text with asterisk"]
+],[
+   "start",
+  ["keyword","test:"],
+  ["text"," recognises foo"],
+  ["constant.character.interro","?"],
+  ["text"," as text with interro"]
+],[
+   "start",
+  ["keyword","test:"],
+  ["text"," recognises single word as text"]
+],[
+   "start",
+  ["text"," foo"]
+],[
+   "start",
+  ["text"," "]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_markdown.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_markdown.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_markdown.json
new file mode 100644
index 0000000..3c0db62
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_markdown.json
@@ -0,0 +1,114 @@
+[[
+   "start",
+  ["text","test: header 1 "]
+],[
+   "start",
+  ["markup.heading.1","#"],
+  ["heading","f"]
+],[
+   "start",
+  ["text","test: header 2"]
+],[
+   "start",
+  ["markup.heading.2","##"],
+  ["heading"," foo"]
+],[
+   "start",
+  ["text","test: header ends with ' #'"]
+],[
+   "start",
+  ["markup.heading.1","#"],
+  ["heading"," # # "]
+],[
+   "start",
+  ["text","test: header ends with '#'"]
+],[
+   "start",
+  ["markup.heading.1","#"],
+  ["heading","foo# "]
+],[
+   "start",
+  ["text","test: 6+ #s is not a valid header"]
+],[
+   "start",
+  ["text","####### foo"]
+],[
+   "start",
+  ["text","test: # followed be only space is not a valid header"]
+],[
+   "start",
+  ["text","# "]
+],[
+   "start",
+  ["text","test: only space between #s is not a valid header"]
+],[
+   "start",
+  ["text","#  #"]
+],[
+   "allowBlock"
+],[
+   "start",
+  ["markup.heading.1","#"],
+  ["heading"," test links  "],
+  ["text","["],
+  ["string","Cloud9 IDE"],
+  ["text","]("],
+  ["markup.underline","http://www.c9.io/"],
+  ["text",")"],
+  ["heading"," #"]
+],[
+   "listblock",
+  ["markup.list","* "],
+  ["text","["],
+  ["string","demo"],
+  ["text","]("],
+  ["markup.underline","http://ajaxorg.github.com/ace/"],
+  ["text",")"],
+  ["list"," "],
+  ["text","["],
+  ["string","+"],
+  ["text","]("],
+  ["markup.underline","escape(\\) "],
+  ["text",")"],
+  ["list"," "],
+  ["text","["],
+  ["string","+"],
+  ["text","]("],
+  ["markup.underline","a"],
+  ["string"," \"title\""],
+  ["text",")"],
+  ["list"," "],
+  ["text","["],
+  ["string","+"],
+  ["text","]("],
+  ["markup.underline","a"],
+  ["string"," \"space\" "],
+  ["text",")"]
+],[
+   "listblock",
+  ["markup.list","* "],
+  ["list","usually "],
+  ["string","*work*"],
+  ["list"," fine ("],
+  ["string","_em_"],
+  ["list",")"]
+],[
+   "listblock",
+  ["list","in lists"]
+],[
+   "start"
+],[
+   "start",
+  ["text","in plain text "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","b"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","http://ace.ajaxorg.com"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","b"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "allowBlock"
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_mushcode.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_mushcode.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_mushcode.json
new file mode 100644
index 0000000..9f8e7cc
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_mushcode.json
@@ -0,0 +1,790 @@
+[[
+   "start",
+  ["text","@"],
+  ["support.function","create"],
+  ["text"," "],
+  ["identifier","phone"]
+],[
+   "start",
+  ["text","&"],
+  ["identifier","pickup"],
+  ["text"," "],
+  ["identifier","phone"],
+  ["keyword.operator","="],
+  ["identifier","$pick"],
+  ["text"," "],
+  ["identifier","up"],
+  ["text",":@"],
+  ["support.function","ifelse"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["identifier","is"],
+  ["text",","],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["identifier","mode"],
+  ["paren.rparen",")"],
+  ["text",","],
+  ["identifier","ICC"],
+  ["paren.rparen",")]"],
+  ["keyword.operator","="],
+  ["paren.lparen","{"],
+  ["text","@"],
+  ["support.function","pemit"],
+  ["text"," "],
+  ["keyword.operator","%#="],
+  ["identifier","You"],
+  ["text"," "],
+  ["support.function","pick"],
+  ["text"," "],
+  ["identifier","up"],
+  ["text"," "],
+  ["identifier","the"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["support.function","fullname"],
+  ["paren.lparen","("],
+  ["identifier","me"],
+  ["paren.rparen",")]"],
+  ["text","."],
+  ["paren.lparen","["],
+  ["support.function","set"],
+  ["paren.lparen","("],
+  ["identifier","me"],
+  ["text",","],
+  ["identifier","PHONER"],
+  ["text",":"],
+  ["keyword.operator","%#"],
+  ["paren.rparen",")]"],
+  ["paren.lparen","["],
+  ["support.function","set"],
+  ["paren.lparen","("],
+  ["identifier","me"],
+  ["text",","],
+  ["identifier","MODE"],
+  ["text",":"],
+  ["identifier","CIP"],
+  ["paren.rparen",")]"],
+  ["paren.lparen","["],
+  ["support.function","set"],
+  ["paren.lparen","(["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["identifier","INCOMING"],
+  ["paren.rparen",")]"],
+  ["text",","],
+  ["identifier","CONNECTED"],
+  ["text",":"],
+  ["paren.lparen","["],
+  ["support.function","num"],
+  ["paren.lparen","("],
+  ["identifier","me"],
+  ["paren.rparen",")])]"],
+  ["paren.lparen","["],
+  ["support.function","set"],
+  ["paren.lparen","("],
+  ["identifier","me"],
+  ["text",","],
+  ["identifier","CONNECTED"],
+  ["text",":"],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["identifier","INCOMING"],
+  ["paren.rparen",")])]"],
+  ["variable","%r"],
+  ["paren.lparen","["],
+  ["support.function","showpicture"],
+  ["paren.lparen","("],
+  ["identifier","PICPICKUP"],
+  ["paren.rparen",")]"],
+  ["variable","%r"],
+  ["identifier","Use"],
+  ["text"," '"],
+  ["paren.lparen","["],
+  ["identifier","color"],
+  ["paren.lparen","("],
+  ["identifier","green"],
+  ["text",","],
+  ["identifier","black"],
+  ["text",","],
+  ["identifier","psay"],
+  ["text"," "],
+  ["keyword.operator","<"],
+  ["identifier","message"],
+  ["keyword.operator",">"],
+  ["paren.rparen",")]"],
+  ["text","' "],
+  ["paren.lparen","("],
+  ["support.function","or"],
+  ["text"," '"],
+  ["paren.lparen","["],
+  ["identifier","color"],
+  ["paren.lparen","("],
+  ["identifier","green"],
+  ["text",","],
+  ["identifier","black"],
+  ["text",","],
+  ["identifier","p"],
+  ["text"," "],
+  ["keyword.operator","<"],
+  ["identifier","message"],
+  ["keyword.operator",">"],
+  ["paren.rparen",")]"],
+  ["text","'"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["identifier","to"],
+  ["text"," "],
+  ["identifier","talk"],
+  ["text"," "],
+  ["identifier","into"],
+  ["text"," "],
+  ["identifier","the"],
+  ["text"," "],
+  ["identifier","phone"],
+  ["text",".;@"],
+  ["support.function","oemit"],
+  ["text"," "],
+  ["keyword.operator","%#="],
+  ["variable","%N"],
+  ["text"," "],
+  ["identifier","picks"],
+  ["text"," "],
+  ["identifier","up"],
+  ["text"," "],
+  ["identifier","the"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["support.function","fullname"],
+  ["paren.lparen","("],
+  ["identifier","me"],
+  ["paren.rparen",")]"],
+  ["text","."],
+  ["paren.rparen","}"],
+  ["text",","],
+  ["paren.lparen","{"],
+  ["text","@"],
+  ["support.function","pemit"],
+  ["text"," "],
+  ["keyword.operator","%#="],
+  ["identifier","You"],
+  ["text"," "],
+  ["support.function","pick"],
+  ["text"," "],
+  ["identifier","up"],
+  ["text"," "],
+  ["identifier","the"],
+  ["text"," "],
+  ["identifier","phone"],
+  ["text"," "],
+  ["identifier","but"],
+  ["text"," "],
+  ["identifier","no"],
+  ["text"," "],
+  ["identifier","one"],
+  ["text"," "],
+  ["identifier","is"],
+  ["text"," "],
+  ["identifier","there"],
+  ["text",". "],
+  ["identifier","You"],
+  ["text"," "],
+  ["identifier","hear"],
+  ["text"," "],
+  ["identifier","a"],
+  ["text"," "],
+  ["identifier","dialtone"],
+  ["text"," "],
+  ["support.function","and"],
+  ["text"," "],
+  ["identifier","then"],
+  ["text"," "],
+  ["identifier","hang"],
+  ["text"," "],
+  ["identifier","up"],
+  ["text",". "],
+  ["paren.lparen","["],
+  ["support.function","play"],
+  ["paren.lparen","("],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["identifier","DIALTONE"],
+  ["paren.rparen","))]"],
+  ["text",";@"],
+  ["support.function","oemit"],
+  ["text"," "],
+  ["keyword.operator","%#="],
+  ["variable","%N"],
+  ["text"," "],
+  ["identifier","picks"],
+  ["text"," "],
+  ["identifier","up"],
+  ["text"," "],
+  ["identifier","the"],
+  ["text"," "],
+  ["identifier","phone"],
+  ["text",", "],
+  ["identifier","but"],
+  ["text"," "],
+  ["identifier","no"],
+  ["text"," "],
+  ["identifier","one"],
+  ["text"," "],
+  ["identifier","is"],
+  ["text"," "],
+  ["identifier","on"],
+  ["text"," "],
+  ["identifier","the"],
+  ["text"," "],
+  ["identifier","other"],
+  ["text"," "],
+  ["identifier","end"],
+  ["text","."],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","&"],
+  ["identifier","ringfun"],
+  ["text"," "],
+  ["identifier","phone"],
+  ["keyword.operator","="],
+  ["paren.lparen","["],
+  ["support.function","ifelse"],
+  ["paren.lparen","("],
+  ["support.function","eq"],
+  ["paren.lparen","("],
+  ["support.function","comp"],
+  ["paren.lparen","(["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%0"],
+  ["keyword.operator","/"],
+  ["identifier","ringtone"],
+  ["paren.rparen",")]"],
+  ["text",","],
+  ["identifier","off"],
+  ["paren.rparen",")"],
+  ["text",","],
+  ["constant.numeric","0"],
+  ["paren.rparen",")"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["identifier","color"],
+  ["paren.lparen","("],
+  ["identifier","black"],
+  ["text",","],
+  ["identifier","cyan"],
+  ["text",","],
+  ["identifier","INCOMING"],
+  ["text"," "],
+  ["identifier","CALL"],
+  ["text"," "],
+  ["identifier","FROM"],
+  ["text"," "],
+  ["variable","%1"],
+  ["paren.rparen",")]"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["support.function","play"],
+  ["paren.lparen","(["],
+  ["support.function","switch"],
+  ["paren.lparen","(["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%0"],
+  ["keyword.operator","/"],
+  ["identifier","ringtone"],
+  ["paren.rparen",")]"],
+  ["text",","],
+  ["constant.numeric","1"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%0"],
+  ["keyword.operator","/"],
+  ["identifier","ringtone1"],
+  ["paren.rparen",")]"],
+  ["text",","],
+  ["constant.numeric","2"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%0"],
+  ["keyword.operator","/"],
+  ["identifier","ringtone2"],
+  ["paren.rparen",")]"],
+  ["text",","],
+  ["constant.numeric","3"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%0"],
+  ["keyword.operator","/"],
+  ["identifier","ringtone3"],
+  ["paren.rparen",")]"],
+  ["text",","],
+  ["constant.numeric","4"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%0"],
+  ["keyword.operator","/"],
+  ["identifier","ringtone4"],
+  ["paren.rparen",")]"],
+  ["text",","],
+  ["constant.numeric","5"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%0"],
+  ["keyword.operator","/"],
+  ["identifier","ringtone5"],
+  ["paren.rparen",")]"],
+  ["text",","],
+  ["constant.numeric","6"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%0"],
+  ["keyword.operator","/"],
+  ["identifier","ringtone6"],
+  ["paren.rparen",")]"],
+  ["text",","],
+  ["constant.numeric","7"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%0"],
+  ["keyword.operator","/"],
+  ["identifier","ringtone7"],
+  ["paren.rparen",")]"],
+  ["text",","],
+  ["constant.numeric","8"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%0"],
+  ["keyword.operator","/"],
+  ["identifier","ringtone8"],
+  ["paren.rparen",")]"],
+  ["text",","],
+  ["constant.numeric","9"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%0"],
+  ["keyword.operator","/"],
+  ["identifier","ringtone9"],
+  ["paren.rparen",")]"],
+  ["text",","],
+  ["identifier","custom"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%0"],
+  ["keyword.operator","/"],
+  ["identifier","customtone"],
+  ["paren.rparen",")]"],
+  ["text",","],
+  ["identifier","vibrate"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%0"],
+  ["keyword.operator","/"],
+  ["identifier","vibrate"],
+  ["paren.rparen",")])])]"]
+],[
+   "start",
+  ["text","&"],
+  ["identifier","ringloop"],
+  ["text"," "],
+  ["identifier","phone"],
+  ["keyword.operator","="],
+  ["text","@"],
+  ["support.function","switch"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["identifier","ringstate"],
+  ["paren.rparen",")]"],
+  ["keyword.operator","="],
+  ["constant.numeric","1"],
+  ["text",","],
+  ["paren.lparen","{"],
+  ["text","@"],
+  ["support.function","emit"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["support.function","setq"],
+  ["paren.lparen","("],
+  ["identifier","q"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["identifier","connecting"],
+  ["paren.rparen",")])]"],
+  ["paren.lparen","["],
+  ["support.function","set"],
+  ["paren.lparen","("],
+  ["variable","%qq"],
+  ["text",","],
+  ["identifier","rangs"],
+  ["text",":"],
+  ["constant.numeric","0"],
+  ["paren.rparen",")]"],
+  ["paren.lparen","["],
+  ["support.function","set"],
+  ["paren.lparen","("],
+  ["variable","%qq"],
+  ["text",","],
+  ["identifier","mode"],
+  ["text",":"],
+  ["identifier","WFC"],
+  ["paren.rparen",")]"],
+  ["paren.lparen","["],
+  ["support.function","set"],
+  ["paren.lparen","("],
+  ["variable","%qq"],
+  ["text",","],
+  ["identifier","INCOMING"],
+  ["text",":"],
+  ["paren.rparen",")]"],
+  ["text",";@"],
+  ["support.function","ifelse"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%qq"],
+  ["keyword.operator","/"],
+  ["identifier","HASVMB"],
+  ["paren.rparen",")]"],
+  ["keyword.operator","="],
+  ["paren.lparen","{"],
+  ["text","@"],
+  ["support.function","tr"],
+  ["text"," "],
+  ["identifier","me"],
+  ["keyword.operator","/"],
+  ["identifier","ROUTEVMB"],
+  ["keyword.operator","="],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["identifier","connecting"],
+  ["paren.rparen",")]"],
+  ["text",";"],
+  ["paren.rparen","}"],
+  ["text",","],
+  ["paren.lparen","{"],
+  ["text","@"],
+  ["support.function","pemit"],
+  ["text"," "],
+  ["keyword.operator","%#="],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["identifier","MSGCNC"],
+  ["paren.rparen",")]"],
+  ["text",";"],
+  ["paren.rparen","}}"],
+  ["text",","],
+  ["constant.numeric","2"],
+  ["text",","],
+  ["paren.lparen","{"],
+  ["text","@"],
+  ["support.function","pemit"],
+  ["text"," "],
+  ["keyword.operator","%#="],
+  ["identifier","The"],
+  ["text"," "],
+  ["identifier","call"],
+  ["text"," "],
+  ["identifier","is"],
+  ["text"," "],
+  ["identifier","connected"],
+  ["text","."],
+  ["paren.lparen","["],
+  ["support.function","setq"],
+  ["paren.lparen","("],
+  ["identifier","q"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["identifier","CONNECTING"],
+  ["paren.rparen",")])]"],
+  ["paren.lparen","["],
+  ["support.function","set"],
+  ["paren.lparen","("],
+  ["identifier","me"],
+  ["text",","],
+  ["identifier","CONNECTED"],
+  ["text",":"],
+  ["variable","%qq"],
+  ["paren.rparen",")]"],
+  ["paren.lparen","["],
+  ["support.function","set"],
+  ["paren.lparen","("],
+  ["variable","%qq"],
+  ["text",","],
+  ["identifier","CONNECTED"],
+  ["text",":"],
+  ["paren.lparen","["],
+  ["support.function","num"],
+  ["paren.lparen","("],
+  ["identifier","me"],
+  ["paren.rparen",")])]"],
+  ["paren.lparen","["],
+  ["support.function","set"],
+  ["paren.lparen","("],
+  ["variable","%qq"],
+  ["text",","],
+  ["identifier","MODE"],
+  ["text",":"],
+  ["identifier","CIP"],
+  ["paren.rparen",")]"],
+  ["text",";@"],
+  ["support.function","tr"],
+  ["text"," "],
+  ["identifier","me"],
+  ["keyword.operator","/"],
+  ["identifier","ciploop"],
+  ["text",";@"],
+  ["support.function","tr"],
+  ["text"," "],
+  ["variable","%qq"],
+  ["keyword.operator","/"],
+  ["identifier","ciploop"],
+  ["text",";"],
+  ["paren.rparen","}"],
+  ["text",","],
+  ["constant.numeric","3"],
+  ["text",","],
+  ["paren.lparen","{"],
+  ["text","@"],
+  ["support.function","emit"],
+  ["text"," "],
+  ["identifier","On"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["support.function","fullname"],
+  ["paren.lparen","("],
+  ["identifier","me"],
+  ["paren.rparen",")]"],
+  ["text","'"],
+  ["support.function","s"],
+  ["text"," "],
+  ["identifier","earpiece"],
+  ["text"," "],
+  ["identifier","you"],
+  ["text"," "],
+  ["identifier","hear"],
+  ["text"," "],
+  ["identifier","a"],
+  ["text"," "],
+  ["identifier","ringing"],
+  ["text"," "],
+  ["identifier","sound"],
+  ["text","."],
+  ["paren.lparen","["],
+  ["support.function","play"],
+  ["paren.lparen","("],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["identifier","LINETONE"],
+  ["paren.rparen","))]"],
+  ["text",";@"],
+  ["support.function","tr"],
+  ["text"," "],
+  ["identifier","me"],
+  ["keyword.operator","/"],
+  ["identifier","ringhere"],
+  ["text",";@"],
+  ["identifier","increment"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["identifier","connecting"],
+  ["paren.rparen",")]"],
+  ["keyword.operator","/"],
+  ["identifier","RANGS"],
+  ["text",";@"],
+  ["identifier","wait"],
+  ["text"," "],
+  ["constant.numeric","5"],
+  ["keyword.operator","="],
+  ["paren.lparen","{"],
+  ["text","@"],
+  ["support.function","tr"],
+  ["text"," "],
+  ["identifier","me"],
+  ["keyword.operator","/"],
+  ["identifier","ringloop"],
+  ["paren.rparen","}"],
+  ["text",";"],
+  ["paren.rparen","}"],
+  ["text",","],
+  ["constant.numeric","4"],
+  ["text",","],
+  ["paren.lparen","{"],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","&"],
+  ["identifier","ringstate"],
+  ["text"," "],
+  ["identifier","phone"],
+  ["keyword.operator","="],
+  ["paren.lparen","["],
+  ["support.function","setq"],
+  ["paren.lparen","("],
+  ["identifier","q"],
+  ["text",","],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["identifier","connecting"],
+  ["paren.rparen","))]"],
+  ["paren.lparen","["],
+  ["support.function","setq"],
+  ["paren.lparen","("],
+  ["constant.numeric","1"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["support.function","gt"],
+  ["paren.lparen","("],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%qq"],
+  ["keyword.operator","/"],
+  ["identifier","rangs"],
+  ["paren.rparen",")"],
+  ["text",","],
+  ["support.function","sub"],
+  ["paren.lparen","("],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%qq"],
+  ["keyword.operator","/"],
+  ["identifier","rings"],
+  ["paren.rparen",")"],
+  ["text",","],
+  ["constant.numeric","1"],
+  ["paren.rparen","))])]"],
+  ["paren.lparen","["],
+  ["support.function","setq"],
+  ["paren.lparen","("],
+  ["constant.numeric","2"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["support.function","and"],
+  ["paren.lparen","("],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["identifier","is"],
+  ["text",","],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%qq"],
+  ["keyword.operator","/"],
+  ["identifier","MODE"],
+  ["paren.rparen",")"],
+  ["text",","],
+  ["identifier","CIP"],
+  ["paren.rparen",")"],
+  ["text",","],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["identifier","is"],
+  ["text",","],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%qq"],
+  ["keyword.operator","/"],
+  ["identifier","INCOMING"],
+  ["paren.rparen",")"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["support.function","num"],
+  ["paren.lparen","("],
+  ["identifier","me"],
+  ["paren.rparen",")]))]"],
+  ["paren.lparen","["],
+  ["support.function","setq"],
+  ["paren.lparen","("],
+  ["constant.numeric","3"],
+  ["text",","],
+  ["paren.lparen","["],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["identifier","is"],
+  ["text",","],
+  ["support.function","u"],
+  ["paren.lparen","("],
+  ["variable","%qq"],
+  ["keyword.operator","/"],
+  ["identifier","MODE"],
+  ["paren.rparen",")"],
+  ["text",","],
+  ["identifier","ICC"],
+  ["paren.rparen",")])]"],
+  ["paren.lparen","["],
+  ["support.function","ifelse"],
+  ["paren.lparen","("],
+  ["variable","%q1"],
+  ["text",","],
+  ["constant.numeric","1"],
+  ["text",","],
+  ["support.function","ifelse"],
+  ["paren.lparen","("],
+  ["variable","%q2"],
+  ["text",","],
+  ["constant.numeric","2"],
+  ["text",","],
+  ["support.function","ifelse"],
+  ["paren.lparen","("],
+  ["variable","%q3"],
+  ["text",","],
+  ["constant.numeric","3"],
+  ["text",","],
+  ["constant.numeric","4"],
+  ["paren.rparen",")))]"]
+],[
+   "start",
+  ["text",";"],
+  ["identifier","comment"]
+],[
+   "start",
+  ["text","@@"],
+  ["paren.lparen","("],
+  ["identifier","comment"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["keyword","say"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["support.function","time"],
+  ["paren.lparen","("],
+  ["paren.rparen",")]"]
+],[
+   "start"
+]]
\ No newline at end of file


[29/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/autohotkey_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/autohotkey_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/autohotkey_highlight_rules.js
new file mode 100644
index 0000000..4519399
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/autohotkey_highlight_rules.js
@@ -0,0 +1,107 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* This file was autogenerated from C:\Users\LED\Desktop\AutoHotKey.tmLanguage (uuid: ) */
+/****************************************************************************************
+ * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
+ * fileTypes                                                                            *
+ ****************************************************************************************/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var AutoHotKeyHighlightRules = function() {
+    var autoItKeywords = 'And|ByRef|Case|Const|ContinueCase|ContinueLoop|Default|Dim|Do|Else|ElseIf|EndFunc|EndIf|EndSelect|EndSwitch|EndWith|Enum|Exit|ExitLoop|False|For|Func|Global|If|In|Local|Next|Not|Or|ReDim|Return|Select|Step|Switch|Then|To|True|Until|WEnd|While|With|' +       
+        'Abs|ACos|AdlibDisable|AdlibEnable|Asc|AscW|ASin|Assign|ATan|AutoItSetOption|AutoItWinGetTitle|AutoItWinSetTitle|Beep|Binary|BinaryLen|BinaryMid|BinaryToString|BitAND|BitNOT|BitOR|BitRotate|BitShift|BitXOR|BlockInput|Break|Call|CDTray|Ceiling|Chr|ChrW|ClipGet|ClipPut|ConsoleRead|ConsoleWrite|ConsoleWriteError|ControlClick|ControlCommand|ControlDisable|ControlEnable|ControlFocus|ControlGetFocus|ControlGetHandle|ControlGetPos|ControlGetText|ControlHide|ControlListView|ControlMove|ControlSend|ControlSetText|ControlShow|ControlTreeView|Cos|Dec|DirCopy|DirCreate|DirGetSize|DirMove|DirRemove|DllCall|DllCallbackFree|DllCallbackGetPtr|DllCallbackRegister|DllClose|DllOpen|DllStructCreate|DllStructGetData|DllStructGetPtr|DllStructGetSize|DllStructSetData|DriveGetDrive|DriveGetFileSystem|DriveGetLabel|DriveGetSerial|DriveGetType|DriveMapAdd|DriveMapDel|DriveMapGet|DriveSetLabel|DriveSpaceFree|DriveSpaceTotal|DriveStatus|EnvGet|EnvSet|EnvUpdate|Eval|Execute|Exp|FileChangeDir|FileClose|F
 ileCopy|FileCreateNTFSLink|FileCreateShortcut|FileDelete|FileExists|FileFindFirstFile|FileFindNextFile|FileGetAttrib|FileGetLongName|FileGetShortcut|FileGetShortName|FileGetSize|FileGetTime|FileGetVersion|FileInstall|FileMove|FileOpen|FileOpenDialog|FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|FileSaveDialog|FileSelectFolder|FileSetAttrib|FileSetTime|FileWrite|FileWriteLine|Floor|FtpSetProxy|GUICreate|GUICtrlCreateAvi|GUICtrlCreateButton|GUICtrlCreateCheckbox|GUICtrlCreateCombo|GUICtrlCreateContextMenu|GUICtrlCreateDate|GUICtrlCreateDummy|GUICtrlCreateEdit|GUICtrlCreateGraphic|GUICtrlCreateGroup|GUICtrlCreateIcon|GUICtrlCreateInput|GUICtrlCreateLabel|GUICtrlCreateList|GUICtrlCreateListView|GUICtrlCreateListViewItem|GUICtrlCreateMenu|GUICtrlCreateMenuItem|GUICtrlCreateMonthCal|GUICtrlCreateObj|GUICtrlCreatePic|GUICtrlCreateProgress|GUICtrlCreateRadio|GUICtrlCreateSlider|GUICtrlCreateTab|GUICtrlCreateTabItem|GUICtrlCreateTreeView|GUICtrlCreateTreeViewItem|GUICtrlCreateUpdown|GUI
 CtrlDelete|GUICtrlGetHandle|GUICtrlGetState|GUICtrlRead|GUICtrlRecvMsg|GUICtrlRegisterListViewSort|GUICtrlSendMsg|GUICtrlSendToDummy|GUICtrlSetBkColor|GUICtrlSetColor|GUICtrlSetCursor|GUICtrlSetData|GUICtrlSetFont|GUICtrlSetDefColor|GUICtrlSetDefBkColor|GUICtrlSetGraphic|GUICtrlSetImage|GUICtrlSetLimit|GUICtrlSetOnEvent|GUICtrlSetPos|GUICtrlSetResizing|GUICtrlSetState|GUICtrlSetStyle|GUICtrlSetTip|GUIDelete|GUIGetCursorInfo|GUIGetMsg|GUIGetStyle|GUIRegisterMsg|GUISetAccelerators()|GUISetBkColor|GUISetCoord|GUISetCursor|GUISetFont|GUISetHelp|GUISetIcon|GUISetOnEvent|GUISetState|GUISetStyle|GUIStartGroup|GUISwitch|Hex|HotKeySet|HttpSetProxy|HWnd|InetGet|InetGetSize|IniDelete|IniRead|IniReadSection|IniReadSectionNames|IniRenameSection|IniWrite|IniWriteSection|InputBox|Int|IsAdmin|IsArray|IsBinary|IsBool|IsDeclared|IsDllStruct|IsFloat|IsHWnd|IsInt|IsKeyword|IsNumber|IsObj|IsPtr|IsString|Log|MemGetStats|Mod|MouseClick|MouseClickDrag|MouseDown|MouseGetCursor|MouseGetPos|MouseMove|MouseUp|
 MouseWheel|MsgBox|Number|ObjCreate|ObjEvent|ObjGet|ObjName|Opt|Ping|PixelChecksum|PixelGetColor|PixelSearch|PluginClose|PluginOpen|ProcessClose|ProcessExists|ProcessGetStats|ProcessList|ProcessSetPriority|ProcessWait|ProcessWaitClose|ProgressOff|ProgressOn|ProgressSet|Ptr|Random|RegDelete|RegEnumKey|RegEnumVal|RegRead|RegWrite|Round|Run|RunAs|RunAsWait|RunWait|Send|SendKeepActive|SetError|SetExtended|ShellExecute|ShellExecuteWait|Shutdown|Sin|Sleep|SoundPlay|SoundSetWaveVolume|SplashImageOn|SplashOff|SplashTextOn|Sqrt|SRandom|StatusbarGetText|StderrRead|StdinWrite|StdioClose|StdoutRead|String|StringAddCR|StringCompare|StringFormat|StringInStr|StringIsAlNum|StringIsAlpha|StringIsASCII|StringIsDigit|StringIsFloat|StringIsInt|StringIsLower|StringIsSpace|StringIsUpper|StringIsXDigit|StringLeft|StringLen|StringLower|StringMid|StringRegExp|StringRegExpReplace|StringReplace|StringRight|StringSplit|StringStripCR|StringStripWS|StringToBinary|StringTrimLeft|StringTrimRight|StringUpper|Tan|TCP
 Accept|TCPCloseSocket|TCPConnect|TCPListen|TCPNameToIP|TCPRecv|TCPSend|TCPShutdown|TCPStartup|TimerDiff|TimerInit|ToolTip|TrayCreateItem|TrayCreateMenu|TrayGetMsg|TrayItemDelete|TrayItemGetHandle|TrayItemGetState|TrayItemGetText|TrayItemSetOnEvent|TrayItemSetState|TrayItemSetText|TraySetClick|TraySetIcon|TraySetOnEvent|TraySetPauseIcon|TraySetState|TraySetToolTip|TrayTip|UBound|UDPBind|UDPCloseSocket|UDPOpen|UDPRecv|UDPSend|UDPShutdown|UDPStartup|VarGetType|WinActivate|WinActive|WinClose|WinExists|WinFlash|WinGetCaretPos|WinGetClassList|WinGetClientSize|WinGetHandle|WinGetPos|WinGetProcess|WinGetState|WinGetText|WinGetTitle|WinKill|WinList|WinMenuSelectItem|WinMinimizeAll|WinMinimizeAllUndo|WinMove|WinSetOnTop|WinSetState|WinSetTitle|WinSetTrans|WinWait|WinWaitActive|WinWaitClose|WinWaitNotActive|' +
+        'ArrayAdd|ArrayBinarySearch|ArrayConcatenate|ArrayDelete|ArrayDisplay|ArrayFindAll|ArrayInsert|ArrayMax|ArrayMaxIndex|ArrayMin|ArrayMinIndex|ArrayPop|ArrayPush|ArrayReverse|ArraySearch|ArraySort|ArraySwap|ArrayToClip|ArrayToString|ArrayTrim|ChooseColor|ChooseFont|ClipBoard_ChangeChain|ClipBoard_Close|ClipBoard_CountFormats|ClipBoard_Empty|ClipBoard_EnumFormats|ClipBoard_FormatStr|ClipBoard_GetData|ClipBoard_GetDataEx|ClipBoard_GetFormatName|ClipBoard_GetOpenWindow|ClipBoard_GetOwner|ClipBoard_GetPriorityFormat|ClipBoard_GetSequenceNumber|ClipBoard_GetViewer|ClipBoard_IsFormatAvailable|ClipBoard_Open|ClipBoard_RegisterFormat|ClipBoard_SetData|ClipBoard_SetDataEx|ClipBoard_SetViewer|ClipPutFile|ColorConvertHSLtoRGB|ColorConvertRGBtoHSL|ColorGetBlue|ColorGetGreen|ColorGetRed|Date_Time_CompareFileTime|Date_Time_DOSDateTimeToArray|Date_Time_DOSDateTimeToFileTime|Date_Time_DOSDateTimeToStr|Date_Time_DOSDateToArray|Date_Time_DOSDateToStr|Date_Time_DOSTimeToArray|Date_Time_DOSTimeTo
 Str|Date_Time_EncodeFileTime|Date_Time_EncodeSystemTime|Date_Time_FileTimeToArray|Date_Time_FileTimeToDOSDateTime|Date_Time_FileTimeToLocalFileTime|Date_Time_FileTimeToStr|Date_Time_FileTimeToSystemTime|Date_Time_GetFileTime|Date_Time_GetLocalTime|Date_Time_GetSystemTime|Date_Time_GetSystemTimeAdjustment|Date_Time_GetSystemTimeAsFileTime|Date_Time_GetSystemTimes|Date_Time_GetTickCount|Date_Time_GetTimeZoneInformation|Date_Time_LocalFileTimeToFileTime|Date_Time_SetFileTime|Date_Time_SetLocalTime|Date_Time_SetSystemTime|Date_Time_SetSystemTimeAdjustment|Date_Time_SetTimeZoneInformation|Date_Time_SystemTimeToArray|Date_Time_SystemTimeToDateStr|Date_Time_SystemTimeToDateTimeStr|Date_Time_SystemTimeToFileTime|Date_Time_SystemTimeToTimeStr|Date_Time_SystemTimeToTzSpecificLocalTime|Date_Time_TzSpecificLocalTimeToSystemTime|DateAdd|DateDayOfWeek|DateDaysInMonth|DateDiff|DateIsLeapYear|DateIsValid|DateTimeFormat|DateTimeSplit|DateToDayOfWeek|DateToDayOfWeekISO|DateToDayValue|DateToMonth|DayV
 alueToDate|DebugBugReportEnv|DebugOut|DebugSetup|Degree|EventLog__Backup|EventLog__Clear|EventLog__Close|EventLog__Count|EventLog__DeregisterSource|EventLog__Full|EventLog__Notify|EventLog__Oldest|EventLog__Open|EventLog__OpenBackup|EventLog__Read|EventLog__RegisterSource|EventLog__Report|FileCountLines|FileCreate|FileListToArray|FilePrint|FileReadToArray|FileWriteFromArray|FileWriteLog|FileWriteToLine|GDIPlus_ArrowCapCreate|GDIPlus_ArrowCapDispose|GDIPlus_ArrowCapGetFillState|GDIPlus_ArrowCapGetHeight|GDIPlus_ArrowCapGetMiddleInset|GDIPlus_ArrowCapGetWidth|GDIPlus_ArrowCapSetFillState|GDIPlus_ArrowCapSetHeight|GDIPlus_ArrowCapSetMiddleInset|GDIPlus_ArrowCapSetWidth|GDIPlus_BitmapCloneArea|GDIPlus_BitmapCreateFromFile|GDIPlus_BitmapCreateFromGraphics|GDIPlus_BitmapCreateFromHBITMAP|GDIPlus_BitmapCreateHBITMAPFromBitmap|GDIPlus_BitmapDispose|GDIPlus_BitmapLockBits|GDIPlus_BitmapUnlockBits|GDIPlus_BrushClone|GDIPlus_BrushCreateSolid|GDIPlus_BrushDispose|GDIPlus_BrushGetType|GDIPlus_Cu
 stomLineCapDispose|GDIPlus_Decoders|GDIPlus_DecodersGetCount|GDIPlus_DecodersGetSize|GDIPlus_Encoders|GDIPlus_EncodersGetCLSID|GDIPlus_EncodersGetCount|GDIPlus_EncodersGetParamList|GDIPlus_EncodersGetParamListSize|GDIPlus_EncodersGetSize|GDIPlus_FontCreate|GDIPlus_FontDispose|GDIPlus_FontFamilyCreate|GDIPlus_FontFamilyDispose|GDIPlus_GraphicsClear|GDIPlus_GraphicsCreateFromHDC|GDIPlus_GraphicsCreateFromHWND|GDIPlus_GraphicsDispose|GDIPlus_GraphicsDrawArc|GDIPlus_GraphicsDrawBezier|GDIPlus_GraphicsDrawClosedCurve|GDIPlus_GraphicsDrawCurve|GDIPlus_GraphicsDrawEllipse|GDIPlus_GraphicsDrawImage|GDIPlus_GraphicsDrawImageRect|GDIPlus_GraphicsDrawImageRectRect|GDIPlus_GraphicsDrawLine|GDIPlus_GraphicsDrawPie|GDIPlus_GraphicsDrawPolygon|GDIPlus_GraphicsDrawRect|GDIPlus_GraphicsDrawString|GDIPlus_GraphicsDrawStringEx|GDIPlus_GraphicsFillClosedCurve|GDIPlus_GraphicsFillEllipse|GDIPlus_GraphicsFillPie|GDIPlus_GraphicsFillRect|GDIPlus_GraphicsGetDC|GDIPlus_GraphicsGetSmoothingMode|GDIPlus_Graph
 icsMeasureString|GDIPlus_GraphicsReleaseDC|GDIPlus_GraphicsSetSmoothingMode|GDIPlus_GraphicsSetTransform|GDIPlus_ImageDispose|GDIPlus_ImageGetGraphicsContext|GDIPlus_ImageGetHeight|GDIPlus_ImageGetWidth|GDIPlus_ImageLoadFromFile|GDIPlus_ImageSaveToFile|GDIPlus_ImageSaveToFileEx|GDIPlus_MatrixCreate|GDIPlus_MatrixDispose|GDIPlus_MatrixRotate|GDIPlus_ParamAdd|GDIPlus_ParamInit|GDIPlus_PenCreate|GDIPlus_PenDispose|GDIPlus_PenGetAlignment|GDIPlus_PenGetColor|GDIPlus_PenGetCustomEndCap|GDIPlus_PenGetDashCap|GDIPlus_PenGetDashStyle|GDIPlus_PenGetEndCap|GDIPlus_PenGetWidth|GDIPlus_PenSetAlignment|GDIPlus_PenSetColor|GDIPlus_PenSetCustomEndCap|GDIPlus_PenSetDashCap|GDIPlus_PenSetDashStyle|GDIPlus_PenSetEndCap|GDIPlus_PenSetWidth|GDIPlus_RectFCreate|GDIPlus_Shutdown|GDIPlus_Startup|GDIPlus_StringFormatCreate|GDIPlus_StringFormatDispose|GetIP|GUICtrlAVI_Close|GUICtrlAVI_Create|GUICtrlAVI_Destroy|GUICtrlAVI_Open|GUICtrlAVI_OpenEx|GUICtrlAVI_Play|GUICtrlAVI_Seek|GUICtrlAVI_Show|GUICtrlAVI_Stop|
 GUICtrlButton_Click|GUICtrlButton_Create|GUICtrlButton_Destroy|GUICtrlButton_Enable|GUICtrlButton_GetCheck|GUICtrlButton_GetFocus|GUICtrlButton_GetIdealSize|GUICtrlButton_GetImage|GUICtrlButton_GetImageList|GUICtrlButton_GetState|GUICtrlButton_GetText|GUICtrlButton_GetTextMargin|GUICtrlButton_SetCheck|GUICtrlButton_SetFocus|GUICtrlButton_SetImage|GUICtrlButton_SetImageList|GUICtrlButton_SetSize|GUICtrlButton_SetState|GUICtrlButton_SetStyle|GUICtrlButton_SetText|GUICtrlButton_SetTextMargin|GUICtrlButton_Show|GUICtrlComboBox_AddDir|GUICtrlComboBox_AddString|GUICtrlComboBox_AutoComplete|GUICtrlComboBox_BeginUpdate|GUICtrlComboBox_Create|GUICtrlComboBox_DeleteString|GUICtrlComboBox_Destroy|GUICtrlComboBox_EndUpdate|GUICtrlComboBox_FindString|GUICtrlComboBox_FindStringExact|GUICtrlComboBox_GetComboBoxInfo|GUICtrlComboBox_GetCount|GUICtrlComboBox_GetCurSel|GUICtrlComboBox_GetDroppedControlRect|GUICtrlComboBox_GetDroppedControlRectEx|GUICtrlComboBox_GetDroppedState|GUICtrlComboBox_GetDropp
 edWidth|GUICtrlComboBox_GetEditSel|GUICtrlComboBox_GetEditText|GUICtrlComboBox_GetExtendedUI|GUICtrlComboBox_GetHorizontalExtent|GUICtrlComboBox_GetItemHeight|GUICtrlComboBox_GetLBText|GUICtrlComboBox_GetLBTextLen|GUICtrlComboBox_GetList|GUICtrlComboBox_GetListArray|GUICtrlComboBox_GetLocale|GUICtrlComboBox_GetLocaleCountry|GUICtrlComboBox_GetLocaleLang|GUICtrlComboBox_GetLocalePrimLang|GUICtrlComboBox_GetLocaleSubLang|GUICtrlComboBox_GetMinVisible|GUICtrlComboBox_GetTopIndex|GUICtrlComboBox_InitStorage|GUICtrlComboBox_InsertString|GUICtrlComboBox_LimitText|GUICtrlComboBox_ReplaceEditSel|GUICtrlComboBox_ResetContent|GUICtrlComboBox_SelectString|GUICtrlComboBox_SetCurSel|GUICtrlComboBox_SetDroppedWidth|GUICtrlComboBox_SetEditSel|GUICtrlComboBox_SetEditText|GUICtrlComboBox_SetExtendedUI|GUICtrlComboBox_SetHorizontalExtent|GUICtrlComboBox_SetItemHeight|GUICtrlComboBox_SetMinVisible|GUICtrlComboBox_SetTopIndex|GUICtrlComboBox_ShowDropDown|GUICtrlComboBoxEx_AddDir|GUICtrlComboBoxEx_AddSt
 ring|GUICtrlComboBoxEx_BeginUpdate|GUICtrlComboBoxEx_Create|GUICtrlComboBoxEx_CreateSolidBitMap|GUICtrlComboBoxEx_DeleteString|GUICtrlComboBoxEx_Destroy|GUICtrlComboBoxEx_EndUpdate|GUICtrlComboBoxEx_FindStringExact|GUICtrlComboBoxEx_GetComboBoxInfo|GUICtrlComboBoxEx_GetComboControl|GUICtrlComboBoxEx_GetCount|GUICtrlComboBoxEx_GetCurSel|GUICtrlComboBoxEx_GetDroppedControlRect|GUICtrlComboBoxEx_GetDroppedControlRectEx|GUICtrlComboBoxEx_GetDroppedState|GUICtrlComboBoxEx_GetDroppedWidth|GUICtrlComboBoxEx_GetEditControl|GUICtrlComboBoxEx_GetEditSel|GUICtrlComboBoxEx_GetEditText|GUICtrlComboBoxEx_GetExtendedStyle|GUICtrlComboBoxEx_GetExtendedUI|GUICtrlComboBoxEx_GetImageList|GUICtrlComboBoxEx_GetItem|GUICtrlComboBoxEx_GetItemEx|GUICtrlComboBoxEx_GetItemHeight|GUICtrlComboBoxEx_GetItemImage|GUICtrlComboBoxEx_GetItemIndent|GUICtrlComboBoxEx_GetItemOverlayImage|GUICtrlComboBoxEx_GetItemParam|GUICtrlComboBoxEx_GetItemSelectedImage|GUICtrlComboBoxEx_GetItemText|GUICtrlComboBoxEx_GetItemTextLen
 |GUICtrlComboBoxEx_GetList|GUICtrlComboBoxEx_GetListArray|GUICtrlComboBoxEx_GetLocale|GUICtrlComboBoxEx_GetLocaleCountry|GUICtrlComboBoxEx_GetLocaleLang|GUICtrlComboBoxEx_GetLocalePrimLang|GUICtrlComboBoxEx_GetLocaleSubLang|GUICtrlComboBoxEx_GetMinVisible|GUICtrlComboBoxEx_GetTopIndex|GUICtrlComboBoxEx_InitStorage|GUICtrlComboBoxEx_InsertString|GUICtrlComboBoxEx_LimitText|GUICtrlComboBoxEx_ReplaceEditSel|GUICtrlComboBoxEx_ResetContent|GUICtrlComboBoxEx_SetCurSel|GUICtrlComboBoxEx_SetDroppedWidth|GUICtrlComboBoxEx_SetEditSel|GUICtrlComboBoxEx_SetEditText|GUICtrlComboBoxEx_SetExtendedStyle|GUICtrlComboBoxEx_SetExtendedUI|GUICtrlComboBoxEx_SetImageList|GUICtrlComboBoxEx_SetItem|GUICtrlComboBoxEx_SetItemEx|GUICtrlComboBoxEx_SetItemHeight|GUICtrlComboBoxEx_SetItemImage|GUICtrlComboBoxEx_SetItemIndent|GUICtrlComboBoxEx_SetItemOverlayImage|GUICtrlComboBoxEx_SetItemParam|GUICtrlComboBoxEx_SetItemSelectedImage|GUICtrlComboBoxEx_SetMinVisible|GUICtrlComboBoxEx_SetTopIndex|GUICtrlComboBoxEx_Sh
 owDropDown|GUICtrlDTP_Create|GUICtrlDTP_Destroy|GUICtrlDTP_GetMCColor|GUICtrlDTP_GetMCFont|GUICtrlDTP_GetMonthCal|GUICtrlDTP_GetRange|GUICtrlDTP_GetRangeEx|GUICtrlDTP_GetSystemTime|GUICtrlDTP_GetSystemTimeEx|GUICtrlDTP_SetFormat|GUICtrlDTP_SetMCColor|GUICtrlDTP_SetMCFont|GUICtrlDTP_SetRange|GUICtrlDTP_SetRangeEx|GUICtrlDTP_SetSystemTime|GUICtrlDTP_SetSystemTimeEx|GUICtrlEdit_AppendText|GUICtrlEdit_BeginUpdate|GUICtrlEdit_CanUndo|GUICtrlEdit_CharFromPos|GUICtrlEdit_Create|GUICtrlEdit_Destroy|GUICtrlEdit_EmptyUndoBuffer|GUICtrlEdit_EndUpdate|GUICtrlEdit_Find|GUICtrlEdit_FmtLines|GUICtrlEdit_GetFirstVisibleLine|GUICtrlEdit_GetLimitText|GUICtrlEdit_GetLine|GUICtrlEdit_GetLineCount|GUICtrlEdit_GetMargins|GUICtrlEdit_GetModify|GUICtrlEdit_GetPasswordChar|GUICtrlEdit_GetRECT|GUICtrlEdit_GetRECTEx|GUICtrlEdit_GetSel|GUICtrlEdit_GetText|GUICtrlEdit_GetTextLen|GUICtrlEdit_HideBalloonTip|GUICtrlEdit_InsertText|GUICtrlEdit_LineFromChar|GUICtrlEdit_LineIndex|GUICtrlEdit_LineLength|GUICtrlEdit_Li
 neScroll|GUICtrlEdit_PosFromChar|GUICtrlEdit_ReplaceSel|GUICtrlEdit_Scroll|GUICtrlEdit_SetLimitText|GUICtrlEdit_SetMargins|GUICtrlEdit_SetModify|GUICtrlEdit_SetPasswordChar|GUICtrlEdit_SetReadOnly|GUICtrlEdit_SetRECT|GUICtrlEdit_SetRECTEx|GUICtrlEdit_SetRECTNP|GUICtrlEdit_SetRectNPEx|GUICtrlEdit_SetSel|GUICtrlEdit_SetTabStops|GUICtrlEdit_SetText|GUICtrlEdit_ShowBalloonTip|GUICtrlEdit_Undo|GUICtrlHeader_AddItem|GUICtrlHeader_ClearFilter|GUICtrlHeader_ClearFilterAll|GUICtrlHeader_Create|GUICtrlHeader_CreateDragImage|GUICtrlHeader_DeleteItem|GUICtrlHeader_Destroy|GUICtrlHeader_EditFilter|GUICtrlHeader_GetBitmapMargin|GUICtrlHeader_GetImageList|GUICtrlHeader_GetItem|GUICtrlHeader_GetItemAlign|GUICtrlHeader_GetItemBitmap|GUICtrlHeader_GetItemCount|GUICtrlHeader_GetItemDisplay|GUICtrlHeader_GetItemFlags|GUICtrlHeader_GetItemFormat|GUICtrlHeader_GetItemImage|GUICtrlHeader_GetItemOrder|GUICtrlHeader_GetItemParam|GUICtrlHeader_GetItemRect|GUICtrlHeader_GetItemRectEx|GUICtrlHeader_GetItemText
 |GUICtrlHeader_GetItemWidth|GUICtrlHeader_GetOrderArray|GUICtrlHeader_GetUnicodeFormat|GUICtrlHeader_HitTest|GUICtrlHeader_InsertItem|GUICtrlHeader_Layout|GUICtrlHeader_OrderToIndex|GUICtrlHeader_SetBitmapMargin|GUICtrlHeader_SetFilterChangeTimeout|GUICtrlHeader_SetHotDivider|GUICtrlHeader_SetImageList|GUICtrlHeader_SetItem|GUICtrlHeader_SetItemAlign|GUICtrlHeader_SetItemBitmap|GUICtrlHeader_SetItemDisplay|GUICtrlHeader_SetItemFlags|GUICtrlHeader_SetItemFormat|GUICtrlHeader_SetItemImage|GUICtrlHeader_SetItemOrder|GUICtrlHeader_SetItemParam|GUICtrlHeader_SetItemText|GUICtrlHeader_SetItemWidth|GUICtrlHeader_SetOrderArray|GUICtrlHeader_SetUnicodeFormat|GUICtrlIpAddress_ClearAddress|GUICtrlIpAddress_Create|GUICtrlIpAddress_Destroy|GUICtrlIpAddress_Get|GUICtrlIpAddress_GetArray|GUICtrlIpAddress_GetEx|GUICtrlIpAddress_IsBlank|GUICtrlIpAddress_Set|GUICtrlIpAddress_SetArray|GUICtrlIpAddress_SetEx|GUICtrlIpAddress_SetFocus|GUICtrlIpAddress_SetFont|GUICtrlIpAddress_SetRange|GUICtrlIpAddress_S
 howHide|GUICtrlListBox_AddFile|GUICtrlListBox_AddString|GUICtrlListBox_BeginUpdate|GUICtrlListBox_Create|GUICtrlListBox_DeleteString|GUICtrlListBox_Destroy|GUICtrlListBox_Dir|GUICtrlListBox_EndUpdate|GUICtrlListBox_FindInText|GUICtrlListBox_FindString|GUICtrlListBox_GetAnchorIndex|GUICtrlListBox_GetCaretIndex|GUICtrlListBox_GetCount|GUICtrlListBox_GetCurSel|GUICtrlListBox_GetHorizontalExtent|GUICtrlListBox_GetItemData|GUICtrlListBox_GetItemHeight|GUICtrlListBox_GetItemRect|GUICtrlListBox_GetItemRectEx|GUICtrlListBox_GetListBoxInfo|GUICtrlListBox_GetLocale|GUICtrlListBox_GetLocaleCountry|GUICtrlListBox_GetLocaleLang|GUICtrlListBox_GetLocalePrimLang|GUICtrlListBox_GetLocaleSubLang|GUICtrlListBox_GetSel|GUICtrlListBox_GetSelCount|GUICtrlListBox_GetSelItems|GUICtrlListBox_GetSelItemsText|GUICtrlListBox_GetText|GUICtrlListBox_GetTextLen|GUICtrlListBox_GetTopIndex|GUICtrlListBox_InitStorage|GUICtrlListBox_InsertString|GUICtrlListBox_ItemFromPoint|GUICtrlListBox_ReplaceString|GUICtrlListBo
 x_ResetContent|GUICtrlListBox_SelectString|GUICtrlListBox_SelItemRange|GUICtrlListBox_SelItemRangeEx|GUICtrlListBox_SetAnchorIndex|GUICtrlListBox_SetCaretIndex|GUICtrlListBox_SetColumnWidth|GUICtrlListBox_SetCurSel|GUICtrlListBox_SetHorizontalExtent|GUICtrlListBox_SetItemData|GUICtrlListBox_SetItemHeight|GUICtrlListBox_SetLocale|GUICtrlListBox_SetSel|GUICtrlListBox_SetTabStops|GUICtrlListBox_SetTopIndex|GUICtrlListBox_Sort|GUICtrlListBox_SwapString|GUICtrlListBox_UpdateHScroll|GUICtrlListView_AddArray|GUICtrlListView_AddColumn|GUICtrlListView_AddItem|GUICtrlListView_AddSubItem|GUICtrlListView_ApproximateViewHeight|GUICtrlListView_ApproximateViewRect|GUICtrlListView_ApproximateViewWidth|GUICtrlListView_Arrange|GUICtrlListView_BeginUpdate|GUICtrlListView_CancelEditLabel|GUICtrlListView_ClickItem|GUICtrlListView_CopyItems|GUICtrlListView_Create|GUICtrlListView_CreateDragImage|GUICtrlListView_CreateSolidBitMap|GUICtrlListView_DeleteAllItems|GUICtrlListView_DeleteColumn|GUICtrlListView_D
 eleteItem|GUICtrlListView_DeleteItemsSelected|GUICtrlListView_Destroy|GUICtrlListView_DrawDragImage|GUICtrlListView_EditLabel|GUICtrlListView_EnableGroupView|GUICtrlListView_EndUpdate|GUICtrlListView_EnsureVisible|GUICtrlListView_FindInText|GUICtrlListView_FindItem|GUICtrlListView_FindNearest|GUICtrlListView_FindParam|GUICtrlListView_FindText|GUICtrlListView_GetBkColor|GUICtrlListView_GetBkImage|GUICtrlListView_GetCallbackMask|GUICtrlListView_GetColumn|GUICtrlListView_GetColumnCount|GUICtrlListView_GetColumnOrder|GUICtrlListView_GetColumnOrderArray|GUICtrlListView_GetColumnWidth|GUICtrlListView_GetCounterPage|GUICtrlListView_GetEditControl|GUICtrlListView_GetExtendedListViewStyle|GUICtrlListView_GetGroupInfo|GUICtrlListView_GetGroupViewEnabled|GUICtrlListView_GetHeader|GUICtrlListView_GetHotCursor|GUICtrlListView_GetHotItem|GUICtrlListView_GetHoverTime|GUICtrlListView_GetImageList|GUICtrlListView_GetISearchString|GUICtrlListView_GetItem|GUICtrlListView_GetItemChecked|GUICtrlListView
 _GetItemCount|GUICtrlListView_GetItemCut|GUICtrlListView_GetItemDropHilited|GUICtrlListView_GetItemEx|GUICtrlListView_GetItemFocused|GUICtrlListView_GetItemGroupID|GUICtrlListView_GetItemImage|GUICtrlListView_GetItemIndent|GUICtrlListView_GetItemParam|GUICtrlListView_GetItemPosition|GUICtrlListView_GetItemPositionX|GUICtrlListView_GetItemPositionY|GUICtrlListView_GetItemRect|GUICtrlListView_GetItemRectEx|GUICtrlListView_GetItemSelected|GUICtrlListView_GetItemSpacing|GUICtrlListView_GetItemSpacingX|GUICtrlListView_GetItemSpacingY|GUICtrlListView_GetItemState|GUICtrlListView_GetItemStateImage|GUICtrlListView_GetItemText|GUICtrlListView_GetItemTextArray|GUICtrlListView_GetItemTextString|GUICtrlListView_GetNextItem|GUICtrlListView_GetNumberOfWorkAreas|GUICtrlListView_GetOrigin|GUICtrlListView_GetOriginX|GUICtrlListView_GetOriginY|GUICtrlListView_GetOutlineColor|GUICtrlListView_GetSelectedColumn|GUICtrlListView_GetSelectedCount|GUICtrlListView_GetSelectedIndices|GUICtrlListView_GetSelect
 ionMark|GUICtrlListView_GetStringWidth|GUICtrlListView_GetSubItemRect|GUICtrlListView_GetTextBkColor|GUICtrlListView_GetTextColor|GUICtrlListView_GetToolTips|GUICtrlListView_GetTopIndex|GUICtrlListView_GetUnicodeFormat|GUICtrlListView_GetView|GUICtrlListView_GetViewDetails|GUICtrlListView_GetViewLarge|GUICtrlListView_GetViewList|GUICtrlListView_GetViewRect|GUICtrlListView_GetViewSmall|GUICtrlListView_GetViewTile|GUICtrlListView_HideColumn|GUICtrlListView_HitTest|GUICtrlListView_InsertColumn|GUICtrlListView_InsertGroup|GUICtrlListView_InsertItem|GUICtrlListView_JustifyColumn|GUICtrlListView_MapIDToIndex|GUICtrlListView_MapIndexToID|GUICtrlListView_RedrawItems|GUICtrlListView_RegisterSortCallBack|GUICtrlListView_RemoveAllGroups|GUICtrlListView_RemoveGroup|GUICtrlListView_Scroll|GUICtrlListView_SetBkColor|GUICtrlListView_SetBkImage|GUICtrlListView_SetCallBackMask|GUICtrlListView_SetColumn|GUICtrlListView_SetColumnOrder|GUICtrlListView_SetColumnOrderArray|GUICtrlListView_SetColumnWidth|
 GUICtrlListView_SetExtendedListViewStyle|GUICtrlListView_SetGroupInfo|GUICtrlListView_SetHotItem|GUICtrlListView_SetHoverTime|GUICtrlListView_SetIconSpacing|GUICtrlListView_SetImageList|GUICtrlListView_SetItem|GUICtrlListView_SetItemChecked|GUICtrlListView_SetItemCount|GUICtrlListView_SetItemCut|GUICtrlListView_SetItemDropHilited|GUICtrlListView_SetItemEx|GUICtrlListView_SetItemFocused|GUICtrlListView_SetItemGroupID|GUICtrlListView_SetItemImage|GUICtrlListView_SetItemIndent|GUICtrlListView_SetItemParam|GUICtrlListView_SetItemPosition|GUICtrlListView_SetItemPosition32|GUICtrlListView_SetItemSelected|GUICtrlListView_SetItemState|GUICtrlListView_SetItemStateImage|GUICtrlListView_SetItemText|GUICtrlListView_SetOutlineColor|GUICtrlListView_SetSelectedColumn|GUICtrlListView_SetSelectionMark|GUICtrlListView_SetTextBkColor|GUICtrlListView_SetTextColor|GUICtrlListView_SetToolTips|GUICtrlListView_SetUnicodeFormat|GUICtrlListView_SetView|GUICtrlListView_SetWorkAreas|GUICtrlListView_SimpleSort|
 GUICtrlListView_SortItems|GUICtrlListView_SubItemHitTest|GUICtrlListView_UnRegisterSortCallBack|GUICtrlMenu_AddMenuItem|GUICtrlMenu_AppendMenu|GUICtrlMenu_CheckMenuItem|GUICtrlMenu_CheckRadioItem|GUICtrlMenu_CreateMenu|GUICtrlMenu_CreatePopup|GUICtrlMenu_DeleteMenu|GUICtrlMenu_DestroyMenu|GUICtrlMenu_DrawMenuBar|GUICtrlMenu_EnableMenuItem|GUICtrlMenu_FindItem|GUICtrlMenu_FindParent|GUICtrlMenu_GetItemBmp|GUICtrlMenu_GetItemBmpChecked|GUICtrlMenu_GetItemBmpUnchecked|GUICtrlMenu_GetItemChecked|GUICtrlMenu_GetItemCount|GUICtrlMenu_GetItemData|GUICtrlMenu_GetItemDefault|GUICtrlMenu_GetItemDisabled|GUICtrlMenu_GetItemEnabled|GUICtrlMenu_GetItemGrayed|GUICtrlMenu_GetItemHighlighted|GUICtrlMenu_GetItemID|GUICtrlMenu_GetItemInfo|GUICtrlMenu_GetItemRect|GUICtrlMenu_GetItemRectEx|GUICtrlMenu_GetItemState|GUICtrlMenu_GetItemStateEx|GUICtrlMenu_GetItemSubMenu|GUICtrlMenu_GetItemText|GUICtrlMenu_GetItemType|GUICtrlMenu_GetMenu|GUICtrlMenu_GetMenuBackground|GUICtrlMenu_GetMenuBarInfo|GUICtrlMenu_
 GetMenuContextHelpID|GUICtrlMenu_GetMenuData|GUICtrlMenu_GetMenuDefaultItem|GUICtrlMenu_GetMenuHeight|GUICtrlMenu_GetMenuInfo|GUICtrlMenu_GetMenuStyle|GUICtrlMenu_GetSystemMenu|GUICtrlMenu_InsertMenuItem|GUICtrlMenu_InsertMenuItemEx|GUICtrlMenu_IsMenu|GUICtrlMenu_LoadMenu|GUICtrlMenu_MapAccelerator|GUICtrlMenu_MenuItemFromPoint|GUICtrlMenu_RemoveMenu|GUICtrlMenu_SetItemBitmaps|GUICtrlMenu_SetItemBmp|GUICtrlMenu_SetItemBmpChecked|GUICtrlMenu_SetItemBmpUnchecked|GUICtrlMenu_SetItemChecked|GUICtrlMenu_SetItemData|GUICtrlMenu_SetItemDefault|GUICtrlMenu_SetItemDisabled|GUICtrlMenu_SetItemEnabled|GUICtrlMenu_SetItemGrayed|GUICtrlMenu_SetItemHighlighted|GUICtrlMenu_SetItemID|GUICtrlMenu_SetItemInfo|GUICtrlMenu_SetItemState|GUICtrlMenu_SetItemSubMenu|GUICtrlMenu_SetItemText|GUICtrlMenu_SetItemType|GUICtrlMenu_SetMenu|GUICtrlMenu_SetMenuBackground|GUICtrlMenu_SetMenuContextHelpID|GUICtrlMenu_SetMenuData|GUICtrlMenu_SetMenuDefaultItem|GUICtrlMenu_SetMenuHeight|GUICtrlMenu_SetMenuInfo|GUICtrlM
 enu_SetMenuStyle|GUICtrlMenu_TrackPopupMenu|GUICtrlMonthCal_Create|GUICtrlMonthCal_Destroy|GUICtrlMonthCal_GetColor|GUICtrlMonthCal_GetColorArray|GUICtrlMonthCal_GetCurSel|GUICtrlMonthCal_GetCurSelStr|GUICtrlMonthCal_GetFirstDOW|GUICtrlMonthCal_GetFirstDOWStr|GUICtrlMonthCal_GetMaxSelCount|GUICtrlMonthCal_GetMaxTodayWidth|GUICtrlMonthCal_GetMinReqHeight|GUICtrlMonthCal_GetMinReqRect|GUICtrlMonthCal_GetMinReqRectArray|GUICtrlMonthCal_GetMinReqWidth|GUICtrlMonthCal_GetMonthDelta|GUICtrlMonthCal_GetMonthRange|GUICtrlMonthCal_GetMonthRangeMax|GUICtrlMonthCal_GetMonthRangeMaxStr|GUICtrlMonthCal_GetMonthRangeMin|GUICtrlMonthCal_GetMonthRangeMinStr|GUICtrlMonthCal_GetMonthRangeSpan|GUICtrlMonthCal_GetRange|GUICtrlMonthCal_GetRangeMax|GUICtrlMonthCal_GetRangeMaxStr|GUICtrlMonthCal_GetRangeMin|GUICtrlMonthCal_GetRangeMinStr|GUICtrlMonthCal_GetSelRange|GUICtrlMonthCal_GetSelRangeMax|GUICtrlMonthCal_GetSelRangeMaxStr|GUICtrlMonthCal_GetSelRangeMin|GUICtrlMonthCal_GetSelRangeMinStr|GUICtrlMonth
 Cal_GetToday|GUICtrlMonthCal_GetTodayStr|GUICtrlMonthCal_GetUnicodeFormat|GUICtrlMonthCal_HitTest|GUICtrlMonthCal_SetColor|GUICtrlMonthCal_SetCurSel|GUICtrlMonthCal_SetDayState|GUICtrlMonthCal_SetFirstDOW|GUICtrlMonthCal_SetMaxSelCount|GUICtrlMonthCal_SetMonthDelta|GUICtrlMonthCal_SetRange|GUICtrlMonthCal_SetSelRange|GUICtrlMonthCal_SetToday|GUICtrlMonthCal_SetUnicodeFormat|GUICtrlRebar_AddBand|GUICtrlRebar_AddToolBarBand|GUICtrlRebar_BeginDrag|GUICtrlRebar_Create|GUICtrlRebar_DeleteBand|GUICtrlRebar_Destroy|GUICtrlRebar_DragMove|GUICtrlRebar_EndDrag|GUICtrlRebar_GetBandBackColor|GUICtrlRebar_GetBandBorders|GUICtrlRebar_GetBandBordersEx|GUICtrlRebar_GetBandChildHandle|GUICtrlRebar_GetBandChildSize|GUICtrlRebar_GetBandCount|GUICtrlRebar_GetBandForeColor|GUICtrlRebar_GetBandHeaderSize|GUICtrlRebar_GetBandID|GUICtrlRebar_GetBandIdealSize|GUICtrlRebar_GetBandLength|GUICtrlRebar_GetBandLParam|GUICtrlRebar_GetBandMargins|GUICtrlRebar_GetBandMarginsEx|GUICtrlRebar_GetBandRect|GUICtrlRebar_
 GetBandRectEx|GUICtrlRebar_GetBandStyle|GUICtrlRebar_GetBandStyleBreak|GUICtrlRebar_GetBandStyleChildEdge|GUICtrlRebar_GetBandStyleFixedBMP|GUICtrlRebar_GetBandStyleFixedSize|GUICtrlRebar_GetBandStyleGripperAlways|GUICtrlRebar_GetBandStyleHidden|GUICtrlRebar_GetBandStyleHideTitle|GUICtrlRebar_GetBandStyleNoGripper|GUICtrlRebar_GetBandStyleTopAlign|GUICtrlRebar_GetBandStyleUseChevron|GUICtrlRebar_GetBandStyleVariableHeight|GUICtrlRebar_GetBandText|GUICtrlRebar_GetBarHeight|GUICtrlRebar_GetBKColor|GUICtrlRebar_GetColorScheme|GUICtrlRebar_GetRowCount|GUICtrlRebar_GetRowHeight|GUICtrlRebar_GetTextColor|GUICtrlRebar_GetToolTips|GUICtrlRebar_GetUnicodeFormat|GUICtrlRebar_HitTest|GUICtrlRebar_IDToIndex|GUICtrlRebar_MaximizeBand|GUICtrlRebar_MinimizeBand|GUICtrlRebar_MoveBand|GUICtrlRebar_SetBandBackColor|GUICtrlRebar_SetBandForeColor|GUICtrlRebar_SetBandHeaderSize|GUICtrlRebar_SetBandID|GUICtrlRebar_SetBandIdealSize|GUICtrlRebar_SetBandLength|GUICtrlRebar_SetBandLParam|GUICtrlRebar_SetBand
 Style|GUICtrlRebar_SetBandStyleBreak|GUICtrlRebar_SetBandStyleChildEdge|GUICtrlRebar_SetBandStyleFixedBMP|GUICtrlRebar_SetBandStyleFixedSize|GUICtrlRebar_SetBandStyleGripperAlways|GUICtrlRebar_SetBandStyleHidden|GUICtrlRebar_SetBandStyleHideTitle|GUICtrlRebar_SetBandStyleNoGripper|GUICtrlRebar_SetBandStyleTopAlign|GUICtrlRebar_SetBandStyleUseChevron|GUICtrlRebar_SetBandStyleVariableHeight|GUICtrlRebar_SetBandText|GUICtrlRebar_SetBKColor|GUICtrlRebar_SetColorScheme|GUICtrlRebar_SetTextColor|GUICtrlRebar_SetToolTips|GUICtrlRebar_SetUnicodeFormat|GUICtrlRebar_ShowBand|GUICtrlSlider_ClearSel|GUICtrlSlider_ClearTics|GUICtrlSlider_Create|GUICtrlSlider_Destroy|GUICtrlSlider_GetBuddy|GUICtrlSlider_GetChannelRect|GUICtrlSlider_GetLineSize|GUICtrlSlider_GetNumTics|GUICtrlSlider_GetPageSize|GUICtrlSlider_GetPos|GUICtrlSlider_GetPTics|GUICtrlSlider_GetRange|GUICtrlSlider_GetRangeMax|GUICtrlSlider_GetRangeMin|GUICtrlSlider_GetSel|GUICtrlSlider_GetSelEnd|GUICtrlSlider_GetSelStart|GUICtrlSlider_Ge
 tThumbLength|GUICtrlSlider_GetThumbRect|GUICtrlSlider_GetThumbRectEx|GUICtrlSlider_GetTic|GUICtrlSlider_GetTicPos|GUICtrlSlider_GetToolTips|GUICtrlSlider_GetUnicodeFormat|GUICtrlSlider_SetBuddy|GUICtrlSlider_SetLineSize|GUICtrlSlider_SetPageSize|GUICtrlSlider_SetPos|GUICtrlSlider_SetRange|GUICtrlSlider_SetRangeMax|GUICtrlSlider_SetRangeMin|GUICtrlSlider_SetSel|GUICtrlSlider_SetSelEnd|GUICtrlSlider_SetSelStart|GUICtrlSlider_SetThumbLength|GUICtrlSlider_SetTic|GUICtrlSlider_SetTicFreq|GUICtrlSlider_SetTipSide|GUICtrlSlider_SetToolTips|GUICtrlSlider_SetUnicodeFormat|GUICtrlStatusBar_Create|GUICtrlStatusBar_Destroy|GUICtrlStatusBar_EmbedControl|GUICtrlStatusBar_GetBorders|GUICtrlStatusBar_GetBordersHorz|GUICtrlStatusBar_GetBordersRect|GUICtrlStatusBar_GetBordersVert|GUICtrlStatusBar_GetCount|GUICtrlStatusBar_GetHeight|GUICtrlStatusBar_GetIcon|GUICtrlStatusBar_GetParts|GUICtrlStatusBar_GetRect|GUICtrlStatusBar_GetRectEx|GUICtrlStatusBar_GetText|GUICtrlStatusBar_GetTextFlags|GUICtrlStatus
 Bar_GetTextLength|GUICtrlStatusBar_GetTextLengthEx|GUICtrlStatusBar_GetTipText|GUICtrlStatusBar_GetUnicodeFormat|GUICtrlStatusBar_GetWidth|GUICtrlStatusBar_IsSimple|GUICtrlStatusBar_Resize|GUICtrlStatusBar_SetBkColor|GUICtrlStatusBar_SetIcon|GUICtrlStatusBar_SetMinHeight|GUICtrlStatusBar_SetParts|GUICtrlStatusBar_SetSimple|GUICtrlStatusBar_SetText|GUICtrlStatusBar_SetTipText|GUICtrlStatusBar_SetUnicodeFormat|GUICtrlStatusBar_ShowHide|GUICtrlTab_Create|GUICtrlTab_DeleteAllItems|GUICtrlTab_DeleteItem|GUICtrlTab_DeselectAll|GUICtrlTab_Destroy|GUICtrlTab_FindTab|GUICtrlTab_GetCurFocus|GUICtrlTab_GetCurSel|GUICtrlTab_GetDisplayRect|GUICtrlTab_GetDisplayRectEx|GUICtrlTab_GetExtendedStyle|GUICtrlTab_GetImageList|GUICtrlTab_GetItem|GUICtrlTab_GetItemCount|GUICtrlTab_GetItemImage|GUICtrlTab_GetItemParam|GUICtrlTab_GetItemRect|GUICtrlTab_GetItemRectEx|GUICtrlTab_GetItemState|GUICtrlTab_GetItemText|GUICtrlTab_GetRowCount|GUICtrlTab_GetToolTips|GUICtrlTab_GetUnicodeFormat|GUICtrlTab_HighlightIt
 em|GUICtrlTab_HitTest|GUICtrlTab_InsertItem|GUICtrlTab_RemoveImage|GUICtrlTab_SetCurFocus|GUICtrlTab_SetCurSel|GUICtrlTab_SetExtendedStyle|GUICtrlTab_SetImageList|GUICtrlTab_SetItem|GUICtrlTab_SetItemImage|GUICtrlTab_SetItemParam|GUICtrlTab_SetItemSize|GUICtrlTab_SetItemState|GUICtrlTab_SetItemText|GUICtrlTab_SetMinTabWidth|GUICtrlTab_SetPadding|GUICtrlTab_SetToolTips|GUICtrlTab_SetUnicodeFormat|GUICtrlToolbar_AddBitmap|GUICtrlToolbar_AddButton|GUICtrlToolbar_AddButtonSep|GUICtrlToolbar_AddString|GUICtrlToolbar_ButtonCount|GUICtrlToolbar_CheckButton|GUICtrlToolbar_ClickAccel|GUICtrlToolbar_ClickButton|GUICtrlToolbar_ClickIndex|GUICtrlToolbar_CommandToIndex|GUICtrlToolbar_Create|GUICtrlToolbar_Customize|GUICtrlToolbar_DeleteButton|GUICtrlToolbar_Destroy|GUICtrlToolbar_EnableButton|GUICtrlToolbar_FindToolbar|GUICtrlToolbar_GetAnchorHighlight|GUICtrlToolbar_GetBitmapFlags|GUICtrlToolbar_GetButtonBitmap|GUICtrlToolbar_GetButtonInfo|GUICtrlToolbar_GetButtonInfoEx|GUICtrlToolbar_GetButton
 Param|GUICtrlToolbar_GetButtonRect|GUICtrlToolbar_GetButtonRectEx|GUICtrlToolbar_GetButtonSize|GUICtrlToolbar_GetButtonState|GUICtrlToolbar_GetButtonStyle|GUICtrlToolbar_GetButtonText|GUICtrlToolbar_GetColorScheme|GUICtrlToolbar_GetDisabledImageList|GUICtrlToolbar_GetExtendedStyle|GUICtrlToolbar_GetHotImageList|GUICtrlToolbar_GetHotItem|GUICtrlToolbar_GetImageList|GUICtrlToolbar_GetInsertMark|GUICtrlToolbar_GetInsertMarkColor|GUICtrlToolbar_GetMaxSize|GUICtrlToolbar_GetMetrics|GUICtrlToolbar_GetPadding|GUICtrlToolbar_GetRows|GUICtrlToolbar_GetString|GUICtrlToolbar_GetStyle|GUICtrlToolbar_GetStyleAltDrag|GUICtrlToolbar_GetStyleCustomErase|GUICtrlToolbar_GetStyleFlat|GUICtrlToolbar_GetStyleList|GUICtrlToolbar_GetStyleRegisterDrop|GUICtrlToolbar_GetStyleToolTips|GUICtrlToolbar_GetStyleTransparent|GUICtrlToolbar_GetStyleWrapable|GUICtrlToolbar_GetTextRows|GUICtrlToolbar_GetToolTips|GUICtrlToolbar_GetUnicodeFormat|GUICtrlToolbar_HideButton|GUICtrlToolbar_HighlightButton|GUICtrlToolbar_Hi
 tTest|GUICtrlToolbar_IndexToCommand|GUICtrlToolbar_InsertButton|GUICtrlToolbar_InsertMarkHitTest|GUICtrlToolbar_IsButtonChecked|GUICtrlToolbar_IsButtonEnabled|GUICtrlToolbar_IsButtonHidden|GUICtrlToolbar_IsButtonHighlighted|GUICtrlToolbar_IsButtonIndeterminate|GUICtrlToolbar_IsButtonPressed|GUICtrlToolbar_LoadBitmap|GUICtrlToolbar_LoadImages|GUICtrlToolbar_MapAccelerator|GUICtrlToolbar_MoveButton|GUICtrlToolbar_PressButton|GUICtrlToolbar_SetAnchorHighlight|GUICtrlToolbar_SetBitmapSize|GUICtrlToolbar_SetButtonBitMap|GUICtrlToolbar_SetButtonInfo|GUICtrlToolbar_SetButtonInfoEx|GUICtrlToolbar_SetButtonParam|GUICtrlToolbar_SetButtonSize|GUICtrlToolbar_SetButtonState|GUICtrlToolbar_SetButtonStyle|GUICtrlToolbar_SetButtonText|GUICtrlToolbar_SetButtonWidth|GUICtrlToolbar_SetCmdID|GUICtrlToolbar_SetColorScheme|GUICtrlToolbar_SetDisabledImageList|GUICtrlToolbar_SetDrawTextFlags|GUICtrlToolbar_SetExtendedStyle|GUICtrlToolbar_SetHotImageList|GUICtrlToolbar_SetHotItem|GUICtrlToolbar_SetImageList
 |GUICtrlToolbar_SetIndent|GUICtrlToolbar_SetIndeterminate|GUICtrlToolbar_SetInsertMark|GUICtrlToolbar_SetInsertMarkColor|GUICtrlToolbar_SetMaxTextRows|GUICtrlToolbar_SetMetrics|GUICtrlToolbar_SetPadding|GUICtrlToolbar_SetParent|GUICtrlToolbar_SetRows|GUICtrlToolbar_SetStyle|GUICtrlToolbar_SetStyleAltDrag|GUICtrlToolbar_SetStyleCustomErase|GUICtrlToolbar_SetStyleFlat|GUICtrlToolbar_SetStyleList|GUICtrlToolbar_SetStyleRegisterDrop|GUICtrlToolbar_SetStyleToolTips|GUICtrlToolbar_SetStyleTransparent|GUICtrlToolbar_SetStyleWrapable|GUICtrlToolbar_SetToolTips|GUICtrlToolbar_SetUnicodeFormat|GUICtrlToolbar_SetWindowTheme|GUICtrlTreeView_Add|GUICtrlTreeView_AddChild|GUICtrlTreeView_AddChildFirst|GUICtrlTreeView_AddFirst|GUICtrlTreeView_BeginUpdate|GUICtrlTreeView_ClickItem|GUICtrlTreeView_Create|GUICtrlTreeView_CreateDragImage|GUICtrlTreeView_CreateSolidBitMap|GUICtrlTreeView_Delete|GUICtrlTreeView_DeleteAll|GUICtrlTreeView_DeleteChildren|GUICtrlTreeView_Destroy|GUICtrlTreeView_DisplayRect|G
 UICtrlTreeView_DisplayRectEx|GUICtrlTreeView_EditText|GUICtrlTreeView_EndEdit|GUICtrlTreeView_EndUpdate|GUICtrlTreeView_EnsureVisible|GUICtrlTreeView_Expand|GUICtrlTreeView_ExpandedOnce|GUICtrlTreeView_FindItem|GUICtrlTreeView_FindItemEx|GUICtrlTreeView_GetBkColor|GUICtrlTreeView_GetBold|GUICtrlTreeView_GetChecked|GUICtrlTreeView_GetChildCount|GUICtrlTreeView_GetChildren|GUICtrlTreeView_GetCount|GUICtrlTreeView_GetCut|GUICtrlTreeView_GetDropTarget|GUICtrlTreeView_GetEditControl|GUICtrlTreeView_GetExpanded|GUICtrlTreeView_GetFirstChild|GUICtrlTreeView_GetFirstItem|GUICtrlTreeView_GetFirstVisible|GUICtrlTreeView_GetFocused|GUICtrlTreeView_GetHeight|GUICtrlTreeView_GetImageIndex|GUICtrlTreeView_GetImageListIconHandle|GUICtrlTreeView_GetIndent|GUICtrlTreeView_GetInsertMarkColor|GUICtrlTreeView_GetISearchString|GUICtrlTreeView_GetItemByIndex|GUICtrlTreeView_GetItemHandle|GUICtrlTreeView_GetItemParam|GUICtrlTreeView_GetLastChild|GUICtrlTreeView_GetLineColor|GUICtrlTreeView_GetNext|GUICtrl
 TreeView_GetNextChild|GUICtrlTreeView_GetNextSibling|GUICtrlTreeView_GetNextVisible|GUICtrlTreeView_GetNormalImageList|GUICtrlTreeView_GetParentHandle|GUICtrlTreeView_GetParentParam|GUICtrlTreeView_GetPrev|GUICtrlTreeView_GetPrevChild|GUICtrlTreeView_GetPrevSibling|GUICtrlTreeView_GetPrevVisible|GUICtrlTreeView_GetScrollTime|GUICtrlTreeView_GetSelected|GUICtrlTreeView_GetSelectedImageIndex|GUICtrlTreeView_GetSelection|GUICtrlTreeView_GetSiblingCount|GUICtrlTreeView_GetState|GUICtrlTreeView_GetStateImageIndex|GUICtrlTreeView_GetStateImageList|GUICtrlTreeView_GetText|GUICtrlTreeView_GetTextColor|GUICtrlTreeView_GetToolTips|GUICtrlTreeView_GetTree|GUICtrlTreeView_GetUnicodeFormat|GUICtrlTreeView_GetVisible|GUICtrlTreeView_GetVisibleCount|GUICtrlTreeView_HitTest|GUICtrlTreeView_HitTestEx|GUICtrlTreeView_HitTestItem|GUICtrlTreeView_Index|GUICtrlTreeView_InsertItem|GUICtrlTreeView_IsFirstItem|GUICtrlTreeView_IsParent|GUICtrlTreeView_Level|GUICtrlTreeView_SelectItem|GUICtrlTreeView_SelectI
 temByIndex|GUICtrlTreeView_SetBkColor|GUICtrlTreeView_SetBold|GUICtrlTreeView_SetChecked|GUICtrlTreeView_SetCheckedByIndex|GUICtrlTreeView_SetChildren|GUICtrlTreeView_SetCut|GUICtrlTreeView_SetDropTarget|GUICtrlTreeView_SetFocused|GUICtrlTreeView_SetHeight|GUICtrlTreeView_SetIcon|GUICtrlTreeView_SetImageIndex|GUICtrlTreeView_SetIndent|GUICtrlTreeView_SetInsertMark|GUICtrlTreeView_SetInsertMarkColor|GUICtrlTreeView_SetItemHeight|GUICtrlTreeView_SetItemParam|GUICtrlTreeView_SetLineColor|GUICtrlTreeView_SetNormalImageList|GUICtrlTreeView_SetScrollTime|GUICtrlTreeView_SetSelected|GUICtrlTreeView_SetSelectedImageIndex|GUICtrlTreeView_SetState|GUICtrlTreeView_SetStateImageIndex|GUICtrlTreeView_SetStateImageList|GUICtrlTreeView_SetText|GUICtrlTreeView_SetTextColor|GUICtrlTreeView_SetToolTips|GUICtrlTreeView_SetUnicodeFormat|GUICtrlTreeView_Sort|GUIImageList_Add|GUIImageList_AddBitmap|GUIImageList_AddIcon|GUIImageList_AddMasked|GUIImageList_BeginDrag|GUIImageList_Copy|GUIImageList_Create|GU
 IImageList_Destroy|GUIImageList_DestroyIcon|GUIImageList_DragEnter|GUIImageList_DragLeave|GUIImageList_DragMove|GUIImageList_Draw|GUIImageList_DrawEx|GUIImageList_Duplicate|GUIImageList_EndDrag|GUIImageList_GetBkColor|GUIImageList_GetIcon|GUIImageList_GetIconHeight|GUIImageList_GetIconSize|GUIImageList_GetIconSizeEx|GUIImageList_GetIconWidth|GUIImageList_GetImageCount|GUIImageList_GetImageInfoEx|GUIImageList_Remove|GUIImageList_ReplaceIcon|GUIImageList_SetBkColor|GUIImageList_SetIconSize|GUIImageList_SetImageCount|GUIImageList_Swap|GUIScrollBars_EnableScrollBar|GUIScrollBars_GetScrollBarInfoEx|GUIScrollBars_GetScrollBarRect|GUIScrollBars_GetScrollBarRGState|GUIScrollBars_GetScrollBarXYLineButton|GUIScrollBars_GetScrollBarXYThumbBottom|GUIScrollBars_GetScrollBarXYThumbTop|GUIScrollBars_GetScrollInfo|GUIScrollBars_GetScrollInfoEx|GUIScrollBars_GetScrollInfoMax|GUIScrollBars_GetScrollInfoMin|GUIScrollBars_GetScrollInfoPage|GUIScrollBars_GetScrollInfoPos|GUIScrollBars_GetScrollInfoTrack
 Pos|GUIScrollBars_GetScrollPos|GUIScrollBars_GetScrollRange|GUIScrollBars_Init|GUIScrollBars_ScrollWindow|GUIScrollBars_SetScrollInfo|GUIScrollBars_SetScrollInfoMax|GUIScrollBars_SetScrollInfoMin|GUIScrollBars_SetScrollInfoPage|GUIScrollBars_SetScrollInfoPos|GUIScrollBars_SetScrollRange|GUIScrollBars_ShowScrollBar|GUIToolTip_Activate|GUIToolTip_AddTool|GUIToolTip_AdjustRect|GUIToolTip_BitsToTTF|GUIToolTip_Create|GUIToolTip_DelTool|GUIToolTip_Destroy|GUIToolTip_EnumTools|GUIToolTip_GetBubbleHeight|GUIToolTip_GetBubbleSize|GUIToolTip_GetBubbleWidth|GUIToolTip_GetCurrentTool|GUIToolTip_GetDelayTime|GUIToolTip_GetMargin|GUIToolTip_GetMarginEx|GUIToolTip_GetMaxTipWidth|GUIToolTip_GetText|GUIToolTip_GetTipBkColor|GUIToolTip_GetTipTextColor|GUIToolTip_GetTitleBitMap|GUIToolTip_GetTitleText|GUIToolTip_GetToolCount|GUIToolTip_GetToolInfo|GUIToolTip_HitTest|GUIToolTip_NewToolRect|GUIToolTip_Pop|GUIToolTip_PopUp|GUIToolTip_SetDelayTime|GUIToolTip_SetMargin|GUIToolTip_SetMaxTipWidth|GUIToolTip_
 SetTipBkColor|GUIToolTip_SetTipTextColor|GUIToolTip_SetTitle|GUIToolTip_SetToolInfo|GUIToolTip_SetWindowTheme|GUIToolTip_ToolExists|GUIToolTip_ToolToArray|GUIToolTip_TrackActivate|GUIToolTip_TrackPosition|GUIToolTip_TTFToBits|GUIToolTip_Update|GUIToolTip_UpdateTipText|HexToString|IE_Example|IE_Introduction|IE_VersionInfo|IEAction|IEAttach|IEBodyReadHTML|IEBodyReadText|IEBodyWriteHTML|IECreate|IECreateEmbedded|IEDocGetObj|IEDocInsertHTML|IEDocInsertText|IEDocReadHTML|IEDocWriteHTML|IEErrorHandlerDeRegister|IEErrorHandlerRegister|IEErrorNotify|IEFormElementCheckBoxSelect|IEFormElementGetCollection|IEFormElementGetObjByName|IEFormElementGetValue|IEFormElementOptionSelect|IEFormElementRadioSelect|IEFormElementSetValue|IEFormGetCollection|IEFormGetObjByName|IEFormImageClick|IEFormReset|IEFormSubmit|IEFrameGetCollection|IEFrameGetObjByName|IEGetObjById|IEGetObjByName|IEHeadInsertEventScript|IEImgClick|IEImgGetCollection|IEIsFrameSet|IELinkClickByIndex|IELinkClickByText|IELinkGetCollection
 |IELoadWait|IELoadWaitTimeout|IENavigate|IEPropertyGet|IEPropertySet|IEQuit|IETableGetCollection|IETableWriteToArray|IETagNameAllGetCollection|IETagNameGetCollection|Iif|INetExplorerCapable|INetGetSource|INetMail|INetSmtpMail|IsPressed|MathCheckDiv|Max|MemGlobalAlloc|MemGlobalFree|MemGlobalLock|MemGlobalSize|MemGlobalUnlock|MemMoveMemory|MemMsgBox|MemShowError|MemVirtualAlloc|MemVirtualAllocEx|MemVirtualFree|MemVirtualFreeEx|Min|MouseTrap|NamedPipes_CallNamedPipe|NamedPipes_ConnectNamedPipe|NamedPipes_CreateNamedPipe|NamedPipes_CreatePipe|NamedPipes_DisconnectNamedPipe|NamedPipes_GetNamedPipeHandleState|NamedPipes_GetNamedPipeInfo|NamedPipes_PeekNamedPipe|NamedPipes_SetNamedPipeHandleState|NamedPipes_TransactNamedPipe|NamedPipes_WaitNamedPipe|Net_Share_ConnectionEnum|Net_Share_FileClose|Net_Share_FileEnum|Net_Share_FileGetInfo|Net_Share_PermStr|Net_Share_ResourceStr|Net_Share_SessionDel|Net_Share_SessionEnum|Net_Share_SessionGetInfo|Net_Share_ShareAdd|Net_Share_ShareCheck|Net_Share_
 ShareDel|Net_Share_ShareEnum|Net_Share_ShareGetInfo|Net_Share_ShareSetInfo|Net_Share_StatisticsGetSvr|Net_Share_StatisticsGetWrk|Now|NowCalc|NowCalcDate|NowDate|NowTime|PathFull|PathMake|PathSplit|ProcessGetName|ProcessGetPriority|Radian|ReplaceStringInFile|RunDOS|ScreenCapture_Capture|ScreenCapture_CaptureWnd|ScreenCapture_SaveImage|ScreenCapture_SetBMPFormat|ScreenCapture_SetJPGQuality|ScreenCapture_SetTIFColorDepth|ScreenCapture_SetTIFCompression|Security__AdjustTokenPrivileges|Security__GetAccountSid|Security__GetLengthSid|Security__GetTokenInformation|Security__ImpersonateSelf|Security__IsValidSid|Security__LookupAccountName|Security__LookupAccountSid|Security__LookupPrivilegeValue|Security__OpenProcessToken|Security__OpenThreadToken|Security__OpenThreadTokenEx|Security__SetPrivilege|Security__SidToStringSid|Security__SidTypeStr|Security__StringSidToSid|SendMessage|SendMessageA|SetDate|SetTime|Singleton|SoundClose|SoundLength|SoundOpen|SoundPause|SoundPlay|SoundPos|SoundResume|
 SoundSeek|SoundStatus|SoundStop|SQLite_Changes|SQLite_Close|SQLite_Display2DResult|SQLite_Encode|SQLite_ErrCode|SQLite_ErrMsg|SQLite_Escape|SQLite_Exec|SQLite_FetchData|SQLite_FetchNames|SQLite_GetTable|SQLite_GetTable2d|SQLite_LastInsertRowID|SQLite_LibVersion|SQLite_Open|SQLite_Query|SQLite_QueryFinalize|SQLite_QueryReset|SQLite_QuerySingleRow|SQLite_SaveMode|SQLite_SetTimeout|SQLite_Shutdown|SQLite_SQLiteExe|SQLite_Startup|SQLite_TotalChanges|StringAddComma|StringBetween|StringEncrypt|StringInsert|StringProper|StringRepeat|StringReverse|StringSplit|StringToHex|TCPIpToName|TempFile|TicksToTime|Timer_Diff|Timer_GetTimerID|Timer_Init|Timer_KillAllTimers|Timer_KillTimer|Timer_SetTimer|TimeToTicks|VersionCompare|viClose|viExecCommand|viFindGpib|viGpibBusReset|viGTL|viOpen|viSetAttribute|viSetTimeout|WeekNumberISO|WinAPI_AttachConsole|WinAPI_AttachThreadInput|WinAPI_Beep|WinAPI_BitBlt|WinAPI_CallNextHookEx|WinAPI_Check|WinAPI_ClientToScreen|WinAPI_CloseHandle|WinAPI_CommDlgExtendedErro
 r|WinAPI_CopyIcon|WinAPI_CreateBitmap|WinAPI_CreateCompatibleBitmap|WinAPI_CreateCompatibleDC|WinAPI_CreateEvent|WinAPI_CreateFile|WinAPI_CreateFont|WinAPI_CreateFontIndirect|WinAPI_CreateProcess|WinAPI_CreateSolidBitmap|WinAPI_CreateSolidBrush|WinAPI_CreateWindowEx|WinAPI_DefWindowProc|WinAPI_DeleteDC|WinAPI_DeleteObject|WinAPI_DestroyIcon|WinAPI_DestroyWindow|WinAPI_DrawEdge|WinAPI_DrawFrameControl|WinAPI_DrawIcon|WinAPI_DrawIconEx|WinAPI_DrawText|WinAPI_EnableWindow|WinAPI_EnumDisplayDevices|WinAPI_EnumWindows|WinAPI_EnumWindowsPopup|WinAPI_EnumWindowsTop|WinAPI_ExpandEnvironmentStrings|WinAPI_ExtractIconEx|WinAPI_FatalAppExit|WinAPI_FillRect|WinAPI_FindExecutable|WinAPI_FindWindow|WinAPI_FlashWindow|WinAPI_FlashWindowEx|WinAPI_FloatToInt|WinAPI_FlushFileBuffers|WinAPI_FormatMessage|WinAPI_FrameRect|WinAPI_FreeLibrary|WinAPI_GetAncestor|WinAPI_GetAsyncKeyState|WinAPI_GetClassName|WinAPI_GetClientHeight|WinAPI_GetClientRect|WinAPI_GetClientWidth|WinAPI_GetCurrentProcess|WinAPI_Get
 CurrentProcessID|WinAPI_GetCurrentThread|WinAPI_GetCurrentThreadId|WinAPI_GetCursorInfo|WinAPI_GetDC|WinAPI_GetDesktopWindow|WinAPI_GetDeviceCaps|WinAPI_GetDIBits|WinAPI_GetDlgCtrlID|WinAPI_GetDlgItem|WinAPI_GetFileSizeEx|WinAPI_GetFocus|WinAPI_GetForegroundWindow|WinAPI_GetIconInfo|WinAPI_GetLastError|WinAPI_GetLastErrorMessage|WinAPI_GetModuleHandle|WinAPI_GetMousePos|WinAPI_GetMousePosX|WinAPI_GetMousePosY|WinAPI_GetObject|WinAPI_GetOpenFileName|WinAPI_GetOverlappedResult|WinAPI_GetParent|WinAPI_GetProcessAffinityMask|WinAPI_GetSaveFileName|WinAPI_GetStdHandle|WinAPI_GetStockObject|WinAPI_GetSysColor|WinAPI_GetSysColorBrush|WinAPI_GetSystemMetrics|WinAPI_GetTextExtentPoint32|WinAPI_GetWindow|WinAPI_GetWindowDC|WinAPI_GetWindowHeight|WinAPI_GetWindowLong|WinAPI_GetWindowRect|WinAPI_GetWindowText|WinAPI_GetWindowThreadProcessId|WinAPI_GetWindowWidth|WinAPI_GetXYFromPoint|WinAPI_GlobalMemStatus|WinAPI_GUIDFromString|WinAPI_GUIDFromStringEx|WinAPI_HiWord|WinAPI_InProcess|WinAPI_IntTo
 Float|WinAPI_InvalidateRect|WinAPI_IsClassName|WinAPI_IsWindow|WinAPI_IsWindowVisible|WinAPI_LoadBitmap|WinAPI_LoadImage|WinAPI_LoadLibrary|WinAPI_LoadLibraryEx|WinAPI_LoadShell32Icon|WinAPI_LoadString|WinAPI_LocalFree|WinAPI_LoWord|WinAPI_MakeDWord|WinAPI_MAKELANGID|WinAPI_MAKELCID|WinAPI_MakeLong|WinAPI_MessageBeep|WinAPI_Mouse_Event|WinAPI_MoveWindow|WinAPI_MsgBox|WinAPI_MulDiv|WinAPI_MultiByteToWideChar|WinAPI_MultiByteToWideCharEx|WinAPI_OpenProcess|WinAPI_PointFromRect|WinAPI_PostMessage|WinAPI_PrimaryLangId|WinAPI_PtInRect|WinAPI_ReadFile|WinAPI_ReadProcessMemory|WinAPI_RectIsEmpty|WinAPI_RedrawWindow|WinAPI_RegisterWindowMessage|WinAPI_ReleaseCapture|WinAPI_ReleaseDC|WinAPI_ScreenToClient|WinAPI_SelectObject|WinAPI_SetBkColor|WinAPI_SetCapture|WinAPI_SetCursor|WinAPI_SetDefaultPrinter|WinAPI_SetDIBits|WinAPI_SetEvent|WinAPI_SetFocus|WinAPI_SetFont|WinAPI_SetHandleInformation|WinAPI_SetLastError|WinAPI_SetParent|WinAPI_SetProcessAffinityMask|WinAPI_SetSysColors|WinAPI_SetText
 Color|WinAPI_SetWindowLong|WinAPI_SetWindowPos|WinAPI_SetWindowsHookEx|WinAPI_SetWindowText|WinAPI_ShowCursor|WinAPI_ShowError|WinAPI_ShowMsg|WinAPI_ShowWindow|WinAPI_StringFromGUID|WinAPI_SubLangId|WinAPI_SystemParametersInfo|WinAPI_TwipsPerPixelX|WinAPI_TwipsPerPixelY|WinAPI_UnhookWindowsHookEx|WinAPI_UpdateLayeredWindow|WinAPI_UpdateWindow|WinAPI_ValidateClassName|WinAPI_WaitForInputIdle|WinAPI_WaitForMultipleObjects|WinAPI_WaitForSingleObject|WinAPI_WideCharToMultiByte|WinAPI_WindowFromPoint|WinAPI_WriteConsole|WinAPI_WriteFile|WinAPI_WriteProcessMemory|WinNet_AddConnection|WinNet_AddConnection2|WinNet_AddConnection3|WinNet_CancelConnection|WinNet_CancelConnection2|WinNet_CloseEnum|WinNet_ConnectionDialog|WinNet_ConnectionDialog1|WinNet_DisconnectDialog|WinNet_DisconnectDialog1|WinNet_EnumResource|WinNet_GetConnection|WinNet_GetConnectionPerformance|WinNet_GetLastError|WinNet_GetNetworkInformation|WinNet_GetProviderName|WinNet_GetResourceInformation|WinNet_GetResourceParent|WinN
 et_GetUniversalName|WinNet_GetUser|WinNet_OpenEnum|WinNet_RestoreConnection|WinNet_UseConnection|Word_VersionInfo|WordAttach|WordCreate|WordDocAdd|WordDocAddLink|WordDocAddPicture|WordDocClose|WordDocFindReplace|WordDocGetCollection|WordDocLinkGetCollection|WordDocOpen|WordDocPrint|WordDocPropertyGet|WordDocPropertySet|WordDocSave|WordDocSaveAs|WordErrorHandlerDeRegister|WordErrorHandlerRegister|WordErrorNotify|WordMacroRun|WordPropertyGet|WordPropertySet|WordQuit|' +
+        'ce|comments-end|comments-start|cs|include|include-once|NoTrayIcon|RequireAdmin|' +
+        'AutoIt3Wrapper_Au3Check_Parameters|AutoIt3Wrapper_Au3Check_Stop_OnWarning|AutoIt3Wrapper_Change2CUI|AutoIt3Wrapper_Compression|AutoIt3Wrapper_cvsWrapper_Parameters|AutoIt3Wrapper_Icon|AutoIt3Wrapper_Outfile|AutoIt3Wrapper_Outfile_Type|AutoIt3Wrapper_Plugin_Funcs|AutoIt3Wrapper_Res_Comment|AutoIt3Wrapper_Res_Description|AutoIt3Wrapper_Res_Field|AutoIt3Wrapper_Res_File_Add|AutoIt3Wrapper_Res_Fileversion|AutoIt3Wrapper_Res_FileVersion_AutoIncrement|AutoIt3Wrapper_Res_Icon_Add|AutoIt3Wrapper_Res_Language|AutoIt3Wrapper_Res_LegalCopyright|AutoIt3Wrapper_res_requestedExecutionLevel|AutoIt3Wrapper_Res_SaveSource|AutoIt3Wrapper_Run_After|AutoIt3Wrapper_Run_Au3check|AutoIt3Wrapper_Run_Before|AutoIt3Wrapper_Run_cvsWrapper|AutoIt3Wrapper_Run_Debug_Mode|AutoIt3Wrapper_Run_Obfuscator|AutoIt3Wrapper_Run_Tidy|AutoIt3Wrapper_Tidy_Stop_OnError|AutoIt3Wrapper_UseAnsi|AutoIt3Wrapper_UseUpx|AutoIt3Wrapper_UseX64|AutoIt3Wrapper_Version|EndRegion|forceref|Obfuscator_Ignore_Funcs|Obfuscator_Ignor
 e_Variables|Obfuscator_Parameters|Region|Tidy_Parameters'
+    var atKeywords = 'AppDataCommonDir|AppDataDir|AutoItExe|AutoItPID|AutoItUnicode|AutoItVersion|AutoItX64|COM_EventObj|CommonFilesDir|Compiled|ComputerName|ComSpec|CR|CRLF|DesktopCommonDir|DesktopDepth|DesktopDir|DesktopHeight|DesktopRefresh|DesktopWidth|DocumentsCommonDir|error|exitCode|exitMethod|extended|FavoritesCommonDir|FavoritesDir|GUI_CtrlHandle|GUI_CtrlId|GUI_DragFile|GUI_DragId|GUI_DropId|GUI_WinHandle|HomeDrive|HomePath|HomeShare|HotKeyPressed|HOUR|InetGetActive|InetGetBytesRead|IPAddress1|IPAddress2|IPAddress3|IPAddress4|KBLayout|LF|LogonDNSDomain|LogonDomain|LogonServer|MDAY|MIN|MON|MyDocumentsDir|NumParams|OSBuild|OSLang|OSServicePack|OSTYPE|OSVersion|ProcessorArch|ProgramFilesDir|ProgramsCommonDir|ProgramsDir|ScriptDir|ScriptFullPath|ScriptLineNumber|ScriptName|SEC|StartMenuCommonDir|StartMenuDir|StartupCommonDir|StartupDir|SW_DISABLE|SW_ENABLE|SW_HIDE|SW_LOCK|SW_MAXIMIZE|SW_MINIMIZE|SW_RESTORE|SW_SHOW|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWMINNOACT
 IVE|SW_SHOWNA|SW_SHOWNOACTIVATE|SW_SHOWNORMAL|SW_UNLOCK|SystemDir|TAB|TempDir|TRAY_ID|TrayIconFlashing|TrayIconVisible|UserName|UserProfileDir|WDAY|WindowsDir|WorkingDir|YDAY|YEAR'
+    
+    this.$rules = { start: 
+       [ { token: 'comment.line.ahk', regex: '(?:^| );.*$' },
+         { token: 'comment.block.ahk',
+           regex: '/\\*', push: 
+            [ { token: 'comment.block.ahk', regex: '\\*/', next: 'pop' },
+              { defaultToken: 'comment.block.ahk' } ] },
+         { token: 'doc.comment.ahk',
+           regex: '#cs', push: 
+            [ { token: 'doc.comment.ahk', regex: '#ce', next: 'pop' },
+              { defaultToken: 'doc.comment.ahk' } ] },
+         { token: 'keyword.command.ahk',
+           regex: '(?:\\b|^)(?:allowsamelinecomments|clipboardtimeout|commentflag|errorstdout|escapechar|hotkeyinterval|hotkeymodifiertimeout|hotstring|include|includeagain|installkeybdhook|installmousehook|keyhistory|ltrim|maxhotkeysperinterval|maxmem|maxthreads|maxthreadsbuffer|maxthreadsperhotkey|noenv|notrayicon|persistent|singleinstance|usehook|winactivateforce|autotrim|blockinput|click|clipwait|continue|control|controlclick|controlfocus|controlget|controlgetfocus|controlgetpos|controlgettext|controlmove|controlsend|controlsendraw|controlsettext|coordmode|critical|detecthiddentext|detecthiddenwindows|drive|driveget|drivespacefree|edit|endrepeat|envadd|envdiv|envget|envmult|envset|envsub|envupdate|exit|exitapp|fileappend|filecopy|filecopydir|filecreatedir|filecreateshortcut|filedelete|filegetattrib|filegetshortcut|filegetsize|filegettime|filegetversion|fileinstall|filemove|filemovedir|fileread|filereadline|filerecycle|filerecycleempty|fileremovedir|fileselectfile|fileselectfolde
 r|filesetattrib|filesettime|formattime|getkeystate|gosub|goto|groupactivate|groupadd|groupclose|groupdeactivate|gui|guicontrol|guicontrolget|hideautoitwin|hotkey|ifequal|ifexist|ifgreater|ifgreaterorequal|ifinstring|ifless|iflessorequal|ifmsgbox|ifnotequal|ifnotexist|ifnotinstring|ifwinactive|ifwinexist|ifwinnotactive|ifwinnotexist|imagesearch|inidelete|iniread|iniwrite|input|inputbox|keyhistory|keywait|listhotkeys|listlines|listvars|menu|mouseclick|mouseclickdrag|mousegetpos|mousemove|msgbox|onexit|outputdebug|pause|pixelgetcolor|pixelsearch|postmessage|process|progress|random|regdelete|regread|regwrite|reload|repeat|run|runas|runwait|send|sendevent|sendinput|sendmode|sendplay|sendmessage|sendraw|setbatchlines|setcapslockstate|setcontroldelay|setdefaultmousespeed|setenv|setformat|setkeydelay|setmousedelay|setnumlockstate|setscrolllockstate|setstorecapslockmode|settimer|settitlematchmode|setwindelay|setworkingdir|shutdown|sleep|sort|soundbeep|soundget|soundgetwavevolume|soundplay|so
 undset|soundsetwavevolume|splashimage|splashtextoff|splashtexton|splitpath|statusbargettext|statusbarwait|stringcasesense|stringgetpos|stringleft|stringlen|stringlower|stringmid|stringreplace|stringright|stringsplit|stringtrimleft|stringtrimright|stringupper|suspend|sysget|thread|tooltip|transform|traytip|urldownloadtofile|while|winactivate|winactivatebottom|winclose|winget|wingetactivestats|wingetactivetitle|wingetclass|wingetpos|wingettext|wingettitle|winhide|winkill|winmaximize|winmenuselectitem|winminimize|winminimizeall|winminimizeallundo|winmove|winrestore|winset|winsettitle|winshow|winwait|winwaitactive|winwaitclose|winwaitnotactive)\\b',
+           caseInsensitive: true },
+         { token: 'keyword.control.ahk',
+           regex: '(?:\\b|^)(?:if|else|return|loop|break|for|while|global|local|byref)\\b',
+           caseInsensitive: true },
+         { token: 'support.function.ahk',
+           regex: '(?:\\b|^)(?:abs|acos|asc|asin|atan|ceil|chr|cos|dllcall|exp|fileexist|floor|getkeystate|il_add|il_create|il_destroy|instr|substr|isfunc|islabel|ln|log|lv_add|lv_delete|lv_deletecol|lv_getcount|lv_getnext|lv_gettext|lv_insert|lv_insertcol|lv_modify|lv_modifycol|lv_setimagelist|mod|onmessage|numget|numput|registercallback|regexmatch|regexreplace|round|sin|tan|sqrt|strlen|sb_seticon|sb_setparts|sb_settext|tv_add|tv_delete|tv_getchild|tv_getcount|tv_getnext|tv_get|tv_getparent|tv_getprev|tv_getselection|tv_gettext|tv_modify|varsetcapacity|winactive|winexist)\\b',
+           caseInsensitive: true },
+         { token: 'variable.predefined.ahk',
+           regex: '(?:\\b|^)(?:a_ahkpath|a_ahkversion|a_appdata|a_appdatacommon|a_autotrim|a_batchlines|a_caretx|a_carety|a_computername|a_controldelay|a_cursor|a_dd|a_ddd|a_dddd|a_defaultmousespeed|a_desktop|a_desktopcommon|a_detecthiddentext|a_detecthiddenwindows|a_endchar|a_eventinfo|a_exitreason|a_formatfloat|a_formatinteger|a_gui|a_guievent|a_guicontrol|a_guicontrolevent|a_guiheight|a_guiwidth|a_guix|a_guiy|a_hour|a_iconfile|a_iconhidden|a_iconnumber|a_icontip|a_index|a_ipaddress1|a_ipaddress2|a_ipaddress3|a_ipaddress4|a_isadmin|a_iscompiled|a_iscritical|a_ispaused|a_issuspended|a_keydelay|a_language|a_lasterror|a_linefile|a_linenumber|a_loopfield|a_loopfileattrib|a_loopfiledir|a_loopfileext|a_loopfilefullpath|a_loopfilelongpath|a_loopfilename|a_loopfileshortname|a_loopfileshortpath|a_loopfilesize|a_loopfilesizekb|a_loopfilesizemb|a_loopfiletimeaccessed|a_loopfiletimecreated|a_loopfiletimemodified|a_loopreadline|a_loopregkey|a_loopregname|a_loopregsubkey|a_loopregtimemodified|a
 _loopregtype|a_mday|a_min|a_mm|a_mmm|a_mmmm|a_mon|a_mousedelay|a_msec|a_mydocuments|a_now|a_nowutc|a_numbatchlines|a_ostype|a_osversion|a_priorhotkey|programfiles|a_programfiles|a_programs|a_programscommon|a_screenheight|a_screenwidth|a_scriptdir|a_scriptfullpath|a_scriptname|a_sec|a_space|a_startmenu|a_startmenucommon|a_startup|a_startupcommon|a_stringcasesense|a_tab|a_temp|a_thisfunc|a_thishotkey|a_thislabel|a_thismenu|a_thismenuitem|a_thismenuitempos|a_tickcount|a_timeidle|a_timeidlephysical|a_timesincepriorhotkey|a_timesincethishotkey|a_titlematchmode|a_titlematchmodespeed|a_username|a_wday|a_windelay|a_windir|a_workingdir|a_yday|a_year|a_yweek|a_yyyy|clipboard|clipboardall|comspec|errorlevel)\\b',
+           caseInsensitive: true },
+         { token: 'support.constant.ahk',
+           regex: '(?:\\b|^)(?:shift|lshift|rshift|alt|lalt|ralt|control|lcontrol|rcontrol|ctrl|lctrl|rctrl|lwin|rwin|appskey|altdown|altup|shiftdown|shiftup|ctrldown|ctrlup|lwindown|lwinup|rwindown|rwinup|lbutton|rbutton|mbutton|wheelup|wheelleft|wheelright|wheeldown|xbutton1|xbutton2|joy1|joy2|joy3|joy4|joy5|joy6|joy7|joy8|joy9|joy10|joy11|joy12|joy13|joy14|joy15|joy16|joy17|joy18|joy19|joy20|joy21|joy22|joy23|joy24|joy25|joy26|joy27|joy28|joy29|joy30|joy31|joy32|joyx|joyy|joyz|joyr|joyu|joyv|joypov|joyname|joybuttons|joyaxes|joyinfo|space|tab|enter|escape|esc|backspace|bs|delete|del|insert|ins|pgup|pgdn|home|end|up|down|left|right|printscreen|ctrlbreak|pause|scrolllock|capslock|numlock|numpad0|numpad1|numpad2|numpad3|numpad4|numpad5|numpad6|numpad7|numpad8|numpad9|numpadmult|numpadadd|numpadsub|numpaddiv|numpaddot|numpaddel|numpadins|numpadclear|numpadup|numpaddown|numpadleft|numpadright|numpadhome|numpadend|numpadpgup|numpadpgdn|numpadenter|f1|f2|f3|f4|f5|f6|f7|f8|f9|f10|f11|f12
 |f13|f14|f15|f16|f17|f18|f19|f20|f21|f22|f23|f24|browser_back|browser_forward|browser_refresh|browser_stop|browser_search|browser_favorites|browser_home|volume_mute|volume_down|volume_up|media_next|media_prev|media_stop|media_play_pause|launch_mail|launch_media|launch_app1|launch_app2)\\b',
+           caseInsensitive: true },
+         { token: 'variable.parameter',
+           regex: '(?:\\b|^)(?:pixel|mouse|screen|relative|rgb|ltrim|rtrim|join|low|belownormal|normal|abovenormal|high|realtime|ahk_id|ahk_pid|ahk_class|ahk_group|between|contains|in|is|integer|float|integerfast|floatfast|number|digit|xdigit|alpha|upper|lower|alnum|time|date|not|or|and|alwaysontop|topmost|top|bottom|transparent|transcolor|redraw|region|id|idlast|processname|minmax|controllist|count|list|capacity|statuscd|eject|lock|unlock|label|filesystem|label|setlabel|serial|type|status|static|seconds|minutes|hours|days|read|parse|logoff|close|error|single|tray|add|rename|check|uncheck|togglecheck|enable|disable|toggleenable|default|nodefault|standard|nostandard|color|delete|deleteall|icon|noicon|tip|click|show|mainwindow|nomainwindow|useerrorlevel|text|picture|pic|groupbox|button|checkbox|radio|dropdownlist|ddl|combobox|listbox|listview|datetime|monthcal|updown|slider|tab|tab2|statusbar|treeview|iconsmall|tile|report|sortdesc|nosort|nosorthdr|grid|hdr|autosize|range|xm|ym|ys|xs|
 xp|yp|font|resize|owner|submit|nohide|minimize|maximize|restore|noactivate|na|cancel|destroy|center|margin|maxsize|minsize|owndialogs|guiescape|guiclose|guisize|guicontextmenu|guidropfiles|tabstop|section|altsubmit|wrap|hscroll|vscroll|border|top|bottom|buttons|expand|first|imagelist|lines|wantctrla|wantf2|vis|visfirst|number|uppercase|lowercase|limit|password|multi|wantreturn|group|background|bold|italic|strike|underline|norm|backgroundtrans|theme|caption|delimiter|minimizebox|maximizebox|sysmenu|toolwindow|flash|style|exstyle|check3|checked|checkedgray|readonly|password|hidden|left|right|center|notab|section|move|focus|hide|choose|choosestring|text|pos|enabled|disabled|visible|lastfound|lastfoundexist|alttab|shiftalttab|alttabmenu|alttabandmenu|alttabmenudismiss|notimers|interrupt|priority|waitclose|blind|raw|unicode|deref|pow|bitnot|bitand|bitor|bitxor|bitshiftleft|bitshiftright|yes|no|ok|cancel|abort|retry|ignore|tryagain|on|off|all|hkey_local_machine|hkey_users|hkey_current_use
 r|hkey_classes_root|hkey_current_config|hklm|hku|hkcu|hkcr|hkcc|reg_sz|reg_expand_sz|reg_multi_sz|reg_dword|reg_qword|reg_binary|reg_link|reg_resource_list|reg_full_resource_descriptor|reg_resource_requirements_list|reg_dword_big_endian)\\b',
+           caseInsensitive: true },
+         { keywordMap: {"constant.language": autoItKeywords}, regex: '\\w+\\b'},
+         { keywordMap: {"variable.function": atKeywords}, regex: '@\\w+\\b'},
+         { token : "constant.numeric", regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},
+         { token: 'keyword.operator.ahk',
+           regex: '=|==|<>|:=|<|>|\\*|\\/|\\+|:|\\?|\\-' },
+         { token: 'punctuation.ahk',
+           regex: '#|`|::|,|\\{|\\}|\\(|\\)|\\%' },
+         { token: 
+            [ 'punctuation.quote.double',
+              'string.quoted.ahk',
+              'punctuation.quote.double' ],
+           regex: '(")((?:[^"]|"")*)(")' },
+         { token: [ 'label.ahk', 'punctuation.definition.label.ahk' ],
+           regex: '^([^: ]+)(:)(?!:)' } ] }
+    
+    this.normalizeRules();
+};
+
+AutoHotKeyHighlightRules.metaData = { name: 'AutoHotKey',
+      scopeName: 'source.ahk',
+      fileTypes: [ 'ahk' ],
+      foldingStartMarker: '^\\s*/\\*|^(?![^{]*?;|[^{]*?/\\*(?!.*?\\*/.*?\\{)).*?\\{\\s*($|;|/\\*(?!.*?\\*/.*\\S))',
+      foldingStopMarker: '^\\s*\\*/|^\\s*\\}' }
+
+
+oop.inherits(AutoHotKeyHighlightRules, TextHighlightRules);
+
+exports.AutoHotKeyHighlightRules = AutoHotKeyHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/batchfile.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/batchfile.js b/src/fauxton/assets/js/libs/ace/mode/batchfile.js
new file mode 100644
index 0000000..2f10957
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/batchfile.js
@@ -0,0 +1,61 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ *
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var BatchFileHighlightRules = require("./batchfile_highlight_rules").BatchFileHighlightRules;
+var FoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = BatchFileHighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = "::";
+    this.blockComment = "";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/batchfile_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/batchfile_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/batchfile_highlight_rules.js
new file mode 100644
index 0000000..be0380d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/batchfile_highlight_rules.js
@@ -0,0 +1,97 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* This file was autogenerated from C:\Users\LED\AppData\Roaming\Sublime Text 2\Packages\Batch File\Batch File.tmLanguage (uuid: ) */
+/****************************************************************************************
+ * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
+ * fileTypes                                                                            *
+ ****************************************************************************************/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var BatchFileHighlightRules = function() {
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = { start: 
+       [ { token: 'keyword.command.dosbatch',
+           regex: '\\b(?:append|assoc|at|attrib|break|cacls|cd|chcp|chdir|chkdsk|chkntfs|cls|cmd|color|comp|compact|convert|copy|date|del|dir|diskcomp|diskcopy|doskey|echo|endlocal|erase|fc|find|findstr|format|ftype|graftabl|help|keyb|label|md|mkdir|mode|more|move|path|pause|popd|print|prompt|pushd|rd|recover|ren|rename|replace|restore|rmdir|set|setlocal|shift|sort|start|subst|time|title|tree|type|ver|verify|vol|xcopy)\\b',
+           caseInsensitive: true },
+         { token: 'keyword.control.statement.dosbatch',
+           regex: '\\b(?:goto|call|exit)\\b',
+           caseInsensitive: true },
+         { token: 'keyword.control.conditional.if.dosbatch',
+           regex: '\\bif\\s+not\\s+(?:exist|defined|errorlevel|cmdextversion)\\b',
+           caseInsensitive: true },
+         { token: 'keyword.control.conditional.dosbatch',
+           regex: '\\b(?:if|else)\\b',
+           caseInsensitive: true },
+         { token: 'keyword.control.repeat.dosbatch',
+           regex: '\\bfor\\b',
+           caseInsensitive: true },
+         { token: 'keyword.operator.dosbatch',
+           regex: '\\b(?:EQU|NEQ|LSS|LEQ|GTR|GEQ)\\b' },
+         { token: ['doc.comment', 'comment'],
+           regex: '(?:^|\\b)(rem)($|\\s.*$)',
+           caseInsensitive: true },
+         { token: 'comment.line.colons.dosbatch',
+           regex: '::.*$' },
+         { include: 'variable' },
+         { token: 'punctuation.definition.string.begin.shell',
+           regex: '"',
+           push: [ 
+              { token: 'punctuation.definition.string.end.shell', regex: '"', next: 'pop' },
+              { include: 'variable' },
+              { defaultToken: 'string.quoted.double.dosbatch' } ] },
+         { token: 'keyword.operator.pipe.dosbatch', regex: '[|]' },
+         { token: 'keyword.operator.redirect.shell',
+           regex: '&>|\\d*>&\\d*|\\d*(?:>>|>|<)|\\d*<&|\\d*<>' } ],
+        variable: [
+         { token: 'constant.numeric', regex: '%%\\w+|%[*\\d]|%\\w+%'},
+         { token: 'constant.numeric', regex: '%~\\d+'},
+         { token: ['markup.list', 'constant.other', 'markup.list'],
+            regex: '(%)(\\w+)(%?)' }]}
+    
+    this.normalizeRules();
+};
+
+BatchFileHighlightRules.metaData = { name: 'Batch File',
+      scopeName: 'source.dosbatch',
+      fileTypes: [ 'bat' ] }
+
+
+oop.inherits(BatchFileHighlightRules, TextHighlightRules);
+
+exports.BatchFileHighlightRules = BatchFileHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/behaviour.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/behaviour.js b/src/fauxton/assets/js/libs/ace/mode/behaviour.js
new file mode 100644
index 0000000..c1c6cb1
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/behaviour.js
@@ -0,0 +1,90 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var Behaviour = function() {
+   this.$behaviours = {};
+};
+
+(function () {
+
+    this.add = function (name, action, callback) {
+        switch (undefined) {
+          case this.$behaviours:
+              this.$behaviours = {};
+          case this.$behaviours[name]:
+              this.$behaviours[name] = {};
+        }
+        this.$behaviours[name][action] = callback;
+    }
+    
+    this.addBehaviours = function (behaviours) {
+        for (var key in behaviours) {
+            for (var action in behaviours[key]) {
+                this.add(key, action, behaviours[key][action]);
+            }
+        }
+    }
+    
+    this.remove = function (name) {
+        if (this.$behaviours && this.$behaviours[name]) {
+            delete this.$behaviours[name];
+        }
+    }
+    
+    this.inherit = function (mode, filter) {
+        if (typeof mode === "function") {
+            var behaviours = new mode().getBehaviours(filter);
+        } else {
+            var behaviours = mode.getBehaviours(filter);
+        }
+        this.addBehaviours(behaviours);
+    }
+    
+    this.getBehaviours = function (filter) {
+        if (!filter) {
+            return this.$behaviours;
+        } else {
+            var ret = {}
+            for (var i = 0; i < filter.length; i++) {
+                if (this.$behaviours[filter[i]]) {
+                    ret[filter[i]] = this.$behaviours[filter[i]];
+                }
+            }
+            return ret;
+        }
+    }
+
+}).call(Behaviour.prototype);
+
+exports.Behaviour = Behaviour;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/behaviour/css.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/behaviour/css.js b/src/fauxton/assets/js/libs/ace/mode/behaviour/css.js
new file mode 100644
index 0000000..1c35f74
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/behaviour/css.js
@@ -0,0 +1,108 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var Behaviour = require("../behaviour").Behaviour;
+var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
+var TokenIterator = require("../../token_iterator").TokenIterator;
+
+var CssBehaviour = function () {
+
+    this.inherit(CstyleBehaviour);
+
+    this.add("colon", "insertion", function (state, action, editor, session, text) {
+        if (text === ':') {
+            var cursor = editor.getCursorPosition();
+            var iterator = new TokenIterator(session, cursor.row, cursor.column);
+            var token = iterator.getCurrentToken();
+            if (token && token.value.match(/\s+/)) {
+                token = iterator.stepBackward();
+            }
+            if (token && token.type === 'support.type') {
+                var line = session.doc.getLine(cursor.row);
+                var rightChar = line.substring(cursor.column, cursor.column + 1);
+                if (rightChar === ':') {
+                    return {
+                       text: '',
+                       selection: [1, 1]
+                    }
+                }
+                if (!line.substring(cursor.column).match(/^\s*;/)) {
+                    return {
+                       text: ':;',
+                       selection: [1, 1]
+                    }
+                }
+            }
+        }
+    });
+
+    this.add("colon", "deletion", function (state, action, editor, session, range) {
+        var selected = session.doc.getTextRange(range);
+        if (!range.isMultiLine() && selected === ':') {
+            var cursor = editor.getCursorPosition();
+            var iterator = new TokenIterator(session, cursor.row, cursor.column);
+            var token = iterator.getCurrentToken();
+            if (token && token.value.match(/\s+/)) {
+                token = iterator.stepBackward();
+            }
+            if (token && token.type === 'support.type') {
+                var line = session.doc.getLine(range.start.row);
+                var rightChar = line.substring(range.end.column, range.end.column + 1);
+                if (rightChar === ';') {
+                    range.end.column ++;
+                    return range;
+                }
+            }
+        }
+    });
+
+    this.add("semicolon", "insertion", function (state, action, editor, session, text) {
+        if (text === ';') {
+            var cursor = editor.getCursorPosition();
+            var line = session.doc.getLine(cursor.row);
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
+            if (rightChar === ';') {
+                return {
+                   text: '',
+                   selection: [1, 1]
+                }
+            }
+        }
+    });
+
+}
+oop.inherits(CssBehaviour, CstyleBehaviour);
+
+exports.CssBehaviour = CssBehaviour;
+});


[21/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/dot_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/dot_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/dot_highlight_rules.js
new file mode 100644
index 0000000..a4fe3b0
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/dot_highlight_rules.js
@@ -0,0 +1,126 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
+
+var DotHighlightRules = function() {
+
+   var keywords = lang.arrayToMap(
+        ("strict|node|edge|graph|digraph|subgraph").split("|")
+   );
+
+   var attributes = lang.arrayToMap(
+        ("damping|k|url|area|arrowhead|arrowsize|arrowtail|aspect|bb|bgcolor|center|charset|clusterrank|color|colorscheme|comment|compound|concentrate|constraint|decorate|defaultdist|dim|dimen|dir|diredgeconstraints|distortion|dpi|edgeurl|edgehref|edgetarget|edgetooltip|epsilon|esep|fillcolor|fixedsize|fontcolor|fontname|fontnames|fontpath|fontsize|forcelabels|gradientangle|group|headurl|head_lp|headclip|headhref|headlabel|headport|headtarget|headtooltip|height|href|id|image|imagepath|imagescale|label|labelurl|label_scheme|labelangle|labeldistance|labelfloat|labelfontcolor|labelfontname|labelfontsize|labelhref|labeljust|labelloc|labeltarget|labeltooltip|landscape|layer|layerlistsep|layers|layerselect|layersep|layout|len|levels|levelsgap|lhead|lheight|lp|ltail|lwidth|margin|maxiter|mclimit|mindist|minlen|mode|model|mosek|nodesep|nojustify|normalize|nslimit|nslimit1|ordering|orientation|outputorder|overlap|overlap_scaling|pack|packmode|pad|page|pagedir|pencolor|penwidth|peripheries|pi
 n|pos|quadtree|quantum|rank|rankdir|ranksep|ratio|rects|regular|remincross|repulsiveforce|resolution|root|rotate|rotation|samehead|sametail|samplepoints|scale|searchsize|sep|shape|shapefile|showboxes|sides|size|skew|smoothing|sortv|splines|start|style|stylesheet|tailurl|tail_lp|tailclip|tailhref|taillabel|tailport|tailtarget|tailtooltip|target|tooltip|truecolor|vertices|viewport|voro_margin|weight|width|xlabel|xlp|z").split("|")
+   );
+
+   this.$rules = {
+        "start" : [
+            {
+                token : "comment",
+                regex : /\/\/.*$/
+            }, {
+                token : "comment",
+                regex : /#.*$/
+            }, {
+                token : "comment", // multi line comment
+                merge : true,
+                regex : /\/\*/,
+                next : "comment"
+            }, {
+                token : "string",
+                regex : "'(?=.)",
+                next  : "qstring"
+            }, {
+                token : "string",
+                regex : '"(?=.)',
+                next  : "qqstring"
+            }, {
+                token : "constant.numeric",
+                regex : /[+\-]?\d+(?:(?:\.\d*)?(?:[eE][+\-]?\d+)?)?\b/
+            }, {
+                token : "keyword.operator",
+                regex : /\+|=|\->/
+            }, {
+                token : "punctuation.operator",
+                regex : /,|;/
+            }, {
+                token : "paren.lparen",
+                regex : /[\[{]/
+            }, {
+                token : "paren.rparen",
+                regex : /[\]}]/
+            }, {
+                token: "comment",
+                regex: /^#!.*$/
+            }, {
+                token: function(value) {
+                    if (keywords.hasOwnProperty(value.toLowerCase())) {
+                        return "keyword";
+                    }
+                    else if (attributes.hasOwnProperty(value.toLowerCase())) {
+                        return "variable";
+                    }
+                    else {
+                        return "text";
+                    }
+                },
+                regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
+           }
+        ],
+        "comment" : [
+            {
+                token : "comment", // closing comment
+                regex : ".*?\\*\\/",
+                merge : true,
+                next : "start"
+            }, {
+                token : "comment", // comment spanning whole line
+                merge : true,
+                regex : ".+"
+            }
+        ],
+        "qqstring" : [
+            {
+                token : "string",
+                regex : '[^"\\\\]+',
+                merge : true
+            }, {
+                token : "string",
+                regex : "\\\\$",
+                next  : "qqstring",
+                merge : true
+            }, {
+                token : "string",
+                regex : '"|$',
+                next  : "start",
+                merge : true
+            }
+        ],
+        "qstring" : [
+            {
+                token : "string",
+                regex : "[^'\\\\]+",
+                merge : true
+            }, {
+                token : "string",
+                regex : "\\\\$",
+                next  : "qstring",
+                merge : true
+            }, {
+                token : "string",
+                regex : "'|$",
+                next  : "start",
+                merge : true
+            }
+        ]
+   };
+};
+
+oop.inherits(DotHighlightRules, TextHighlightRules);
+
+exports.DotHighlightRules = DotHighlightRules;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/ejs.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/ejs.js b/src/fauxton/assets/js/libs/ace/mode/ejs.js
new file mode 100644
index 0000000..50293e9
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/ejs.js
@@ -0,0 +1,109 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
+
+var EjsHighlightRules = function(start, end) {
+    HtmlHighlightRules.call(this);
+    
+    if (!start)
+        start = "(?:<%|<\\?|{{)";
+    if (!end)
+        end = "(?:%>|\\?>|}})";
+
+    for (var i in this.$rules) {
+        this.$rules[i].unshift({
+            token : "markup.list.meta.tag",
+            regex : start + "(?![>}])[-=]?",
+            push  : "ejs-start"
+        });
+    }
+    
+    this.embedRules(JavaScriptHighlightRules, "ejs-");
+    
+    this.$rules["ejs-start"].unshift({
+        token : "markup.list.meta.tag",
+        regex : "-?" + end,
+        next  : "pop"
+    }, {
+        token: "comment",
+        regex: "//.*?" + end,
+        next: "pop"
+    });
+
+    this.$rules["ejs-no_regex"].unshift({
+        token : "markup.list.meta.tag",
+        regex : "-?" + end,
+        next  : "pop"
+    }, {
+        token: "comment",
+        regex: "//.*?" + end,
+        next: "pop"
+    });
+    
+    this.normalizeRules();
+};
+
+
+oop.inherits(EjsHighlightRules, HtmlHighlightRules);
+
+exports.EjsHighlightRules = EjsHighlightRules;
+
+
+var oop = require("../lib/oop");
+var Tokenizer = require("../tokenizer").Tokenizer;
+var HtmlMode = require("./html").Mode;
+var JavaScriptMode = require("./javascript").Mode;
+var CssMode = require("./css").Mode;
+var RubyMode = require("./ruby").Mode;
+
+var Mode = function() {
+    HtmlMode.call(this);
+    this.HighlightRules = EjsHighlightRules;    
+    this.createModeDelegates({
+        "js-": JavaScriptMode,
+        "css-": CssMode,
+        "ejs-": JavaScriptMode
+    });
+};
+oop.inherits(Mode, HtmlMode);
+
+(function() {
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/erlang.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/erlang.js b/src/fauxton/assets/js/libs/ace/mode/erlang.js
new file mode 100644
index 0000000..d3d2e42
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/erlang.js
@@ -0,0 +1,57 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var ErlangHighlightRules = require("./erlang_highlight_rules").ErlangHighlightRules;
+// TODO: pick appropriate fold mode
+var FoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = ErlangHighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = "%";
+    this.blockComment = {start: "/*", end: "*/"};
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/erlang_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/erlang_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/erlang_highlight_rules.js
new file mode 100644
index 0000000..5ee7bfb
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/erlang_highlight_rules.js
@@ -0,0 +1,876 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* This file was autogenerated from tm bundles\erlang.tmbundle\Syntaxes\Erlang.plist (uuid: ) */
+/****************************************************************************************
+ * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
+ * fileTypes                                                                            *
+ ****************************************************************************************/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var ErlangHighlightRules = function() {
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = { start: 
+       [ { include: '#module-directive' },
+         { include: '#import-export-directive' },
+         { include: '#behaviour-directive' },
+         { include: '#record-directive' },
+         { include: '#define-directive' },
+         { include: '#macro-directive' },
+         { include: '#directive' },
+         { include: '#function' },
+         { include: '#everything-else' } ],
+      '#atom': 
+       [ { token: 'punctuation.definition.symbol.begin.erlang',
+           regex: '\'',
+           push: 
+            [ { token: 'punctuation.definition.symbol.end.erlang',
+                regex: '\'',
+                next: 'pop' },
+              { token: 
+                 [ 'punctuation.definition.escape.erlang',
+                   'constant.other.symbol.escape.erlang',
+                   'punctuation.definition.escape.erlang',
+                   'constant.other.symbol.escape.erlang',
+                   'constant.other.symbol.escape.erlang' ],
+                regex: '(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' },
+              { token: 'invalid.illegal.atom.erlang', regex: '\\\\\\^?.?' },
+              { defaultToken: 'constant.other.symbol.quoted.single.erlang' } ] },
+         { token: 'constant.other.symbol.unquoted.erlang',
+           regex: '[a-z][a-zA-Z\\d@_]*' } ],
+      '#behaviour-directive': 
+       [ { token: 
+            [ 'meta.directive.behaviour.erlang',
+              'punctuation.section.directive.begin.erlang',
+              'meta.directive.behaviour.erlang',
+              'keyword.control.directive.behaviour.erlang',
+              'meta.directive.behaviour.erlang',
+              'punctuation.definition.parameters.begin.erlang',
+              'meta.directive.behaviour.erlang',
+              'entity.name.type.class.behaviour.definition.erlang',
+              'meta.directive.behaviour.erlang',
+              'punctuation.definition.parameters.end.erlang',
+              'meta.directive.behaviour.erlang',
+              'punctuation.section.directive.end.erlang' ],
+           regex: '^(\\s*)(-)(\\s*)(behaviour)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\))(\\s*)(\\.)' } ],
+      '#binary': 
+       [ { token: 'punctuation.definition.binary.begin.erlang',
+           regex: '<<',
+           push: 
+            [ { token: 'punctuation.definition.binary.end.erlang',
+                regex: '>>',
+                next: 'pop' },
+              { token: 
+                 [ 'punctuation.separator.binary.erlang',
+                   'punctuation.separator.value-size.erlang' ],
+                regex: '(,)|(:)' },
+              { include: '#internal-type-specifiers' },
+              { include: '#everything-else' },
+              { defaultToken: 'meta.structure.binary.erlang' } ] } ],
+      '#character': 
+       [ { token: 
+            [ 'punctuation.definition.character.erlang',
+              'punctuation.definition.escape.erlang',
+              'constant.character.escape.erlang',
+              'punctuation.definition.escape.erlang',
+              'constant.character.escape.erlang',
+              'constant.character.escape.erlang' ],
+           regex: '(\\$)(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' },
+         { token: 'invalid.illegal.character.erlang',
+           regex: '\\$\\\\\\^?.?' },
+         { token: 
+            [ 'punctuation.definition.character.erlang',
+              'constant.character.erlang' ],
+           regex: '(\\$)(\\S)' },
+         { token: 'invalid.illegal.character.erlang', regex: '\\$.?' } ],
+      '#comment': 
+       [ { token: 'punctuation.definition.comment.erlang',
+           regex: '%.*$',
+           push_: 
+            [ { token: 'comment.line.percentage.erlang',
+                regex: '$',
+                next: 'pop' },
+              { defaultToken: 'comment.line.percentage.erlang' } ] } ],
+      '#define-directive': 
+       [ { token: 
+            [ 'meta.directive.define.erlang',
+              'punctuation.section.directive.begin.erlang',
+              'meta.directive.define.erlang',
+              'keyword.control.directive.define.erlang',
+              'meta.directive.define.erlang',
+              'punctuation.definition.parameters.begin.erlang',
+              'meta.directive.define.erlang',
+              'entity.name.function.macro.definition.erlang',
+              'meta.directive.define.erlang',
+              'punctuation.separator.parameters.erlang' ],
+           regex: '^(\\s*)(-)(\\s*)(define)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(,)',
+           push: 
+            [ { token: 
+                 [ 'punctuation.definition.parameters.end.erlang',
+                   'meta.directive.define.erlang',
+                   'punctuation.section.directive.end.erlang' ],
+                regex: '(\\))(\\s*)(\\.)',
+                next: 'pop' },
+              { include: '#everything-else' },
+              { defaultToken: 'meta.directive.define.erlang' } ] },
+         { token: 'meta.directive.define.erlang',
+           regex: '(?=^\\s*-\\s*define\\s*\\(\\s*[a-zA-Z\\d@_]+\\s*\\()',
+           push: 
+            [ { token: 
+                 [ 'punctuation.definition.parameters.end.erlang',
+                   'meta.directive.define.erlang',
+                   'punctuation.section.directive.end.erlang' ],
+                regex: '(\\))(\\s*)(\\.)',
+                next: 'pop' },
+              { token: 
+                 [ 'text',
+                   'punctuation.section.directive.begin.erlang',
+                   'text',
+                   'keyword.control.directive.define.erlang',
+                   'text',
+                   'punctuation.definition.parameters.begin.erlang',
+                   'text',
+                   'entity.name.function.macro.definition.erlang',
+                   'text',
+                   'punctuation.definition.parameters.begin.erlang' ],
+                regex: '^(\\s*)(-)(\\s*)(define)(\\s*)(\\()(\\s*)([a-zA-Z\\d@_]+)(\\s*)(\\()',
+                push: 
+                 [ { token: 
+                      [ 'punctuation.definition.parameters.end.erlang',
+                        'text',
+                        'punctuation.separator.parameters.erlang' ],
+                     regex: '(\\))(\\s*)(,)',
+                     next: 'pop' },
+                   { token: 'punctuation.separator.parameters.erlang', regex: ',' },
+                   { include: '#everything-else' } ] },
+              { token: 'punctuation.separator.define.erlang',
+                regex: '\\|\\||\\||:|;|,|\\.|->' },
+              { include: '#everything-else' },
+              { defaultToken: 'meta.directive.define.erlang' } ] } ],
+      '#directive': 
+       [ { token: 
+            [ 'meta.directive.erlang',
+              'punctuation.section.directive.begin.erlang',
+              'meta.directive.erlang',
+              'keyword.control.directive.erlang',
+              'meta.directive.erlang',
+              'punctuation.definition.parameters.begin.erlang' ],
+           regex: '^(\\s*)(-)(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\(?)',
+           push: 
+            [ { token: 
+                 [ 'punctuation.definition.parameters.end.erlang',
+                   'meta.directive.erlang',
+                   'punctuation.section.directive.end.erlang' ],
+                regex: '(\\)?)(\\s*)(\\.)',
+                next: 'pop' },
+              { include: '#everything-else' },
+              { defaultToken: 'meta.directive.erlang' } ] },
+         { token: 
+            [ 'meta.directive.erlang',
+              'punctuation.section.directive.begin.erlang',
+              'meta.directive.erlang',
+              'keyword.control.directive.erlang',
+              'meta.directive.erlang',
+              'punctuation.section.directive.end.erlang' ],
+           regex: '^(\\s*)(-)(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\.)' } ],
+      '#everything-else': 
+       [ { include: '#comment' },
+         { include: '#record-usage' },
+         { include: '#macro-usage' },
+         { include: '#expression' },
+         { include: '#keyword' },
+         { include: '#textual-operator' },
+         { include: '#function-call' },
+         { include: '#tuple' },
+         { include: '#list' },
+         { include: '#binary' },
+         { include: '#parenthesized-expression' },
+         { include: '#character' },
+         { include: '#number' },
+         { include: '#atom' },
+         { include: '#string' },
+         { include: '#symbolic-operator' },
+         { include: '#variable' } ],
+      '#expression': 
+       [ { token: 'keyword.control.if.erlang',
+           regex: '\\bif\\b',
+           push: 
+            [ { token: 'keyword.control.end.erlang',
+                regex: '\\bend\\b',
+                next: 'pop' },
+              { include: '#internal-expression-punctuation' },
+              { include: '#everything-else' },
+              { defaultToken: 'meta.expression.if.erlang' } ] },
+         { token: 'keyword.control.case.erlang',
+           regex: '\\bcase\\b',
+           push: 
+            [ { token: 'keyword.control.end.erlang',
+                regex: '\\bend\\b',
+                next: 'pop' },
+              { include: '#internal-expression-punctuation' },
+              { include: '#everything-else' },
+              { defaultToken: 'meta.expression.case.erlang' } ] },
+         { token: 'keyword.control.receive.erlang',
+           regex: '\\breceive\\b',
+           push: 
+            [ { token: 'keyword.control.end.erlang',
+                regex: '\\bend\\b',
+                next: 'pop' },
+              { include: '#internal-expression-punctuation' },
+              { include: '#everything-else' },
+              { defaultToken: 'meta.expression.receive.erlang' } ] },
+         { token: 
+            [ 'keyword.control.fun.erlang',
+              'text',
+              'entity.name.type.class.module.erlang',
+              'text',
+              'punctuation.separator.module-function.erlang',
+              'text',
+              'entity.name.function.erlang',
+              'text',
+              'punctuation.separator.function-arity.erlang' ],
+           regex: '\\b(fun)(\\s*)(?:([a-z][a-zA-Z\\d@_]*)(\\s*)(:)(\\s*))?([a-z][a-zA-Z\\d@_]*)(\\s*)(/)' },
+         { token: 'keyword.control.fun.erlang',
+           regex: '\\bfun\\b',
+           push: 
+            [ { token: 'keyword.control.end.erlang',
+                regex: '\\bend\\b',
+                next: 'pop' },
+              { token: 'text',
+                regex: '(?=\\()',
+                push: 
+                 [ { token: 'punctuation.separator.clauses.erlang',
+                     regex: ';|(?=\\bend\\b)',
+                     next: 'pop' },
+                   { include: '#internal-function-parts' } ] },
+              { include: '#everything-else' },
+              { defaultToken: 'meta.expression.fun.erlang' } ] },
+         { token: 'keyword.control.try.erlang',
+           regex: '\\btry\\b',
+           push: 
+            [ { token: 'keyword.control.end.erlang',
+                regex: '\\bend\\b',
+                next: 'pop' },
+              { include: '#internal-expression-punctuation' },
+              { include: '#everything-else' },
+              { defaultToken: 'meta.expression.try.erlang' } ] },
+         { token: 'keyword.control.begin.erlang',
+           regex: '\\bbegin\\b',
+           push: 
+            [ { token: 'keyword.control.end.erlang',
+                regex: '\\bend\\b',
+                next: 'pop' },
+              { include: '#internal-expression-punctuation' },
+              { include: '#everything-else' },
+              { defaultToken: 'meta.expression.begin.erlang' } ] },
+         { token: 'keyword.control.query.erlang',
+           regex: '\\bquery\\b',
+           push: 
+            [ { token: 'keyword.control.end.erlang',
+                regex: '\\bend\\b',
+                next: 'pop' },
+              { include: '#everything-else' },
+              { defaultToken: 'meta.expression.query.erlang' } ] } ],
+      '#function': 
+       [ { token: 
+            [ 'meta.function.erlang',
+              'entity.name.function.definition.erlang',
+              'meta.function.erlang' ],
+           regex: '^(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(?=\\()',
+           push: 
+            [ { token: 'punctuation.terminator.function.erlang',
+                regex: '\\.',
+                next: 'pop' },
+              { token: [ 'text', 'entity.name.function.erlang', 'text' ],
+                regex: '^(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(?=\\()' },
+              { token: 'text',
+                regex: '(?=\\()',
+                push: 
+                 [ { token: 'punctuation.separator.clauses.erlang',
+                     regex: ';|(?=\\.)',
+                     next: 'pop' },
+                   { include: '#parenthesized-expression' },
+                   { include: '#internal-function-parts' } ] },
+              { include: '#everything-else' },
+              { defaultToken: 'meta.function.erlang' } ] } ],
+      '#function-call': 
+       [ { token: 'meta.function-call.erlang',
+           regex: '(?=(?:[a-z][a-zA-Z\\d@_]*|\'[^\']*\')\\s*(?:\\(|:\\s*(?:[a-z][a-zA-Z\\d@_]*|\'[^\']*\')\\s*\\())',
+           push: 
+            [ { token: 'punctuation.definition.parameters.end.erlang',
+                regex: '\\)',
+                next: 'pop' },
+              { token: 
+                 [ 'entity.name.type.class.module.erlang',
+                   'text',
+                   'punctuation.separator.module-function.erlang',
+                   'text',
+                   'entity.name.function.guard.erlang',
+                   'text',
+                   'punctuation.definition.parameters.begin.erlang' ],
+                regex: '(?:(erlang)(\\s*)(:)(\\s*))?(is_atom|is_binary|is_constant|is_float|is_function|is_integer|is_list|is_number|is_pid|is_port|is_reference|is_tuple|is_record|abs|element|hd|length|node|round|self|size|tl|trunc)(\\s*)(\\()',
+                push: 
+                 [ { token: 'text', regex: '(?=\\))', next: 'pop' },
+                   { token: 'punctuation.separator.parameters.erlang', regex: ',' },
+                   { include: '#everything-else' } ] },
+              { token: 
+                 [ 'entity.name.type.class.module.erlang',
+                   'text',
+                   'punctuation.separator.module-function.erlang',
+                   'text',
+                   'entity.name.function.erlang',
+                   'text',
+                   'punctuation.definition.parameters.begin.erlang' ],
+                regex: '(?:([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(:)(\\s*))?([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(\\()',
+                push: 
+                 [ { token: 'text', regex: '(?=\\))', next: 'pop' },
+                   { token: 'punctuation.separator.parameters.erlang', regex: ',' },
+                   { include: '#everything-else' } ] },
+              { defaultToken: 'meta.function-call.erlang' } ] } ],
+      '#import-export-directive': 
+       [ { token: 
+            [ 'meta.directive.import.erlang',
+              'punctuation.section.directive.begin.erlang',
+              'meta.directive.import.erlang',
+              'keyword.control.directive.import.erlang',
+              'meta.directive.import.erlang',
+              'punctuation.definition.parameters.begin.erlang',
+              'meta.directive.import.erlang',
+              'entity.name.type.class.module.erlang',
+              'meta.directive.import.erlang',
+              'punctuation.separator.parameters.erlang' ],
+           regex: '^(\\s*)(-)(\\s*)(import)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(,)',
+           push: 
+            [ { token: 
+                 [ 'punctuation.definition.parameters.end.erlang',
+                   'meta.directive.import.erlang',
+                   'punctuation.section.directive.end.erlang' ],
+                regex: '(\\))(\\s*)(\\.)',
+                next: 'pop' },
+              { include: '#internal-function-list' },
+              { defaultToken: 'meta.directive.import.erlang' } ] },
+         { token: 
+            [ 'meta.directive.export.erlang',
+              'punctuation.section.directive.begin.erlang',
+              'meta.directive.export.erlang',
+              'keyword.control.directive.export.erlang',
+              'meta.directive.export.erlang',
+              'punctuation.definition.parameters.begin.erlang' ],
+           regex: '^(\\s*)(-)(\\s*)(export)(\\s*)(\\()',
+           push: 
+            [ { token: 
+                 [ 'punctuation.definition.parameters.end.erlang',
+                   'meta.directive.export.erlang',
+                   'punctuation.section.directive.end.erlang' ],
+                regex: '(\\))(\\s*)(\\.)',
+                next: 'pop' },
+              { include: '#internal-function-list' },
+              { defaultToken: 'meta.directive.export.erlang' } ] } ],
+      '#internal-expression-punctuation': 
+       [ { token: 
+            [ 'punctuation.separator.clause-head-body.erlang',
+              'punctuation.separator.clauses.erlang',
+              'punctuation.separator.expressions.erlang' ],
+           regex: '(->)|(;)|(,)' } ],
+      '#internal-function-list': 
+       [ { token: 'punctuation.definition.list.begin.erlang',
+           regex: '\\[',
+           push: 
+            [ { token: 'punctuation.definition.list.end.erlang',
+                regex: '\\]',
+                next: 'pop' },
+              { token: 
+                 [ 'entity.name.function.erlang',
+                   'text',
+                   'punctuation.separator.function-arity.erlang' ],
+                regex: '([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(/)',
+                push: 
+                 [ { token: 'punctuation.separator.list.erlang',
+                     regex: ',|(?=\\])',
+                     next: 'pop' },
+                   { include: '#everything-else' } ] },
+              { include: '#everything-else' },
+              { defaultToken: 'meta.structure.list.function.erlang' } ] } ],
+      '#internal-function-parts': 
+       [ { token: 'text',
+           regex: '(?=\\()',
+           push: 
+            [ { token: 'punctuation.separator.clause-head-body.erlang',
+                regex: '->',
+                next: 'pop' },
+              { token: 'punctuation.definition.parameters.begin.erlang',
+                regex: '\\(',
+                push: 
+                 [ { token: 'punctuation.definition.parameters.end.erlang',
+                     regex: '\\)',
+                     next: 'pop' },
+                   { token: 'punctuation.separator.parameters.erlang', regex: ',' },
+                   { include: '#everything-else' } ] },
+              { token: 'punctuation.separator.guards.erlang', regex: ',|;' },
+              { include: '#everything-else' } ] },
+         { token: 'punctuation.separator.expressions.erlang',
+           regex: ',' },
+         { include: '#everything-else' } ],
+      '#internal-record-body': 
+       [ { token: 'punctuation.definition.class.record.begin.erlang',
+           regex: '\\{',
+           push: 
+            [ { token: 'meta.structure.record.erlang',
+                regex: '(?=\\})',
+                next: 'pop' },
+              { token: 
+                 [ 'variable.other.field.erlang',
+                   'variable.language.omitted.field.erlang',
+                   'text',
+                   'keyword.operator.assignment.erlang' ],
+                regex: '(?:([a-z][a-zA-Z\\d@_]*|\'[^\']*\')|(_))(\\s*)(=|::)',
+                push: 
+                 [ { token: 'punctuation.separator.class.record.erlang',
+                     regex: ',|(?=\\})',
+                     next: 'pop' },
+                   { include: '#everything-else' } ] },
+              { token: 
+                 [ 'variable.other.field.erlang',
+                   'text',
+                   'punctuation.separator.class.record.erlang' ],
+                regex: '([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)((?:,)?)' },
+              { include: '#everything-else' },
+              { defaultToken: 'meta.structure.record.erlang' } ] } ],
+      '#internal-type-specifiers': 
+       [ { token: 'punctuation.separator.value-type.erlang',
+           regex: '/',
+           push: 
+            [ { token: 'text', regex: '(?=,|:|>>)', next: 'pop' },
+              { token: 
+                 [ 'storage.type.erlang',
+                   'storage.modifier.signedness.erlang',
+                   'storage.modifier.endianness.erlang',
+                   'storage.modifier.unit.erlang',
+                   'punctuation.separator.type-specifiers.erlang' ],
+                regex: '(integer|float|binary|bytes|bitstring|bits)|(signed|unsigned)|(big|little|native)|(unit)|(-)' } ] } ],
+      '#keyword': 
+       [ { token: 'keyword.control.erlang',
+           regex: '\\b(?:after|begin|case|catch|cond|end|fun|if|let|of|query|try|receive|when)\\b' } ],
+      '#list': 
+       [ { token: 'punctuation.definition.list.begin.erlang',
+           regex: '\\[',
+           push: 
+            [ { token: 'punctuation.definition.list.end.erlang',
+                regex: '\\]',
+                next: 'pop' },
+              { token: 'punctuation.separator.list.erlang',
+                regex: '\\||\\|\\||,' },
+              { include: '#everything-else' },
+              { defaultToken: 'meta.structure.list.erlang' } ] } ],
+      '#macro-directive': 
+       [ { token: 
+            [ 'meta.directive.ifdef.erlang',
+              'punctuation.section.directive.begin.erlang',
+              'meta.directive.ifdef.erlang',
+              'keyword.control.directive.ifdef.erlang',
+              'meta.directive.ifdef.erlang',
+              'punctuation.definition.parameters.begin.erlang',
+              'meta.directive.ifdef.erlang',
+              'entity.name.function.macro.erlang',
+              'meta.directive.ifdef.erlang',
+              'punctuation.definition.parameters.end.erlang',
+              'meta.directive.ifdef.erlang',
+              'punctuation.section.directive.end.erlang' ],
+           regex: '^(\\s*)(-)(\\s*)(ifdef)(\\s*)(\\()(\\s*)([a-zA-z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' },
+         { token: 
+            [ 'meta.directive.ifndef.erlang',
+              'punctuation.section.directive.begin.erlang',
+              'meta.directive.ifndef.erlang',
+              'keyword.control.directive.ifndef.erlang',
+              'meta.directive.ifndef.erlang',
+              'punctuation.definition.parameters.begin.erlang',
+              'meta.directive.ifndef.erlang',
+              'entity.name.function.macro.erlang',
+              'meta.directive.ifndef.erlang',
+              'punctuation.definition.parameters.end.erlang',
+              'meta.directive.ifndef.erlang',
+              'punctuation.section.directive.end.erlang' ],
+           regex: '^(\\s*)(-)(\\s*)(ifndef)(\\s*)(\\()(\\s*)([a-zA-z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' },
+         { token: 
+            [ 'meta.directive.undef.erlang',
+              'punctuation.section.directive.begin.erlang',
+              'meta.directive.undef.erlang',
+              'keyword.control.directive.undef.erlang',
+              'meta.directive.undef.erlang',
+              'punctuation.definition.parameters.begin.erlang',
+              'meta.directive.undef.erlang',
+              'entity.name.function.macro.erlang',
+              'meta.directive.undef.erlang',
+              'punctuation.definition.parameters.end.erlang',
+              'meta.directive.undef.erlang',
+              'punctuation.section.directive.end.erlang' ],
+           regex: '^(\\s*)(-)(\\s*)(undef)(\\s*)(\\()(\\s*)([a-zA-z\\d@_]+)(\\s*)(\\))(\\s*)(\\.)' } ],
+      '#macro-usage': 
+       [ { token: 
+            [ 'keyword.operator.macro.erlang',
+              'meta.macro-usage.erlang',
+              'entity.name.function.macro.erlang' ],
+           regex: '(\\?\\??)(\\s*)([a-zA-Z\\d@_]+)' } ],
+      '#module-directive': 
+       [ { token: 
+            [ 'meta.directive.module.erlang',
+              'punctuation.section.directive.begin.erlang',
+              'meta.directive.module.erlang',
+              'keyword.control.directive.module.erlang',
+              'meta.directive.module.erlang',
+              'punctuation.definition.parameters.begin.erlang',
+              'meta.directive.module.erlang',
+              'entity.name.type.class.module.definition.erlang',
+              'meta.directive.module.erlang',
+              'punctuation.definition.parameters.end.erlang',
+              'meta.directive.module.erlang',
+              'punctuation.section.directive.end.erlang' ],
+           regex: '^(\\s*)(-)(\\s*)(module)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*)(\\s*)(\\))(\\s*)(\\.)' } ],
+      '#number': 
+       [ { token: 'text',
+           regex: '(?=\\d)',
+           push: 
+            [ { token: 'text', regex: '(?!\\d)', next: 'pop' },
+              { token: 
+                 [ 'constant.numeric.float.erlang',
+                   'punctuation.separator.integer-float.erlang',
+                   'constant.numeric.float.erlang',
+                   'punctuation.separator.float-exponent.erlang' ],
+                regex: '(\\d+)(\\.)(\\d+)((?:[eE][\\+\\-]?\\d+)?)' },
+              { token: 
+                 [ 'constant.numeric.integer.binary.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.binary.erlang' ],
+                regex: '(2)(#)([0-1]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-3.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-3.erlang' ],
+                regex: '(3)(#)([0-2]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-4.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-4.erlang' ],
+                regex: '(4)(#)([0-3]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-5.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-5.erlang' ],
+                regex: '(5)(#)([0-4]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-6.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-6.erlang' ],
+                regex: '(6)(#)([0-5]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-7.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-7.erlang' ],
+                regex: '(7)(#)([0-6]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.octal.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.octal.erlang' ],
+                regex: '(8)(#)([0-7]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-9.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-9.erlang' ],
+                regex: '(9)(#)([0-8]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.decimal.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.decimal.erlang' ],
+                regex: '(10)(#)(\\d+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-11.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-11.erlang' ],
+                regex: '(11)(#)([\\daA]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-12.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-12.erlang' ],
+                regex: '(12)(#)([\\da-bA-B]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-13.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-13.erlang' ],
+                regex: '(13)(#)([\\da-cA-C]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-14.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-14.erlang' ],
+                regex: '(14)(#)([\\da-dA-D]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-15.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-15.erlang' ],
+                regex: '(15)(#)([\\da-eA-E]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.hexadecimal.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.hexadecimal.erlang' ],
+                regex: '(16)(#)([\\da-fA-F]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-17.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-17.erlang' ],
+                regex: '(17)(#)([\\da-gA-G]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-18.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-18.erlang' ],
+                regex: '(18)(#)([\\da-hA-H]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-19.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-19.erlang' ],
+                regex: '(19)(#)([\\da-iA-I]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-20.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-20.erlang' ],
+                regex: '(20)(#)([\\da-jA-J]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-21.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-21.erlang' ],
+                regex: '(21)(#)([\\da-kA-K]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-22.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-22.erlang' ],
+                regex: '(22)(#)([\\da-lA-L]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-23.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-23.erlang' ],
+                regex: '(23)(#)([\\da-mA-M]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-24.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-24.erlang' ],
+                regex: '(24)(#)([\\da-nA-N]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-25.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-25.erlang' ],
+                regex: '(25)(#)([\\da-oA-O]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-26.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-26.erlang' ],
+                regex: '(26)(#)([\\da-pA-P]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-27.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-27.erlang' ],
+                regex: '(27)(#)([\\da-qA-Q]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-28.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-28.erlang' ],
+                regex: '(28)(#)([\\da-rA-R]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-29.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-29.erlang' ],
+                regex: '(29)(#)([\\da-sA-S]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-30.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-30.erlang' ],
+                regex: '(30)(#)([\\da-tA-T]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-31.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-31.erlang' ],
+                regex: '(31)(#)([\\da-uA-U]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-32.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-32.erlang' ],
+                regex: '(32)(#)([\\da-vA-V]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-33.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-33.erlang' ],
+                regex: '(33)(#)([\\da-wA-W]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-34.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-34.erlang' ],
+                regex: '(34)(#)([\\da-xA-X]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-35.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-35.erlang' ],
+                regex: '(35)(#)([\\da-yA-Y]+)' },
+              { token: 
+                 [ 'constant.numeric.integer.base-36.erlang',
+                   'punctuation.separator.base-integer.erlang',
+                   'constant.numeric.integer.base-36.erlang' ],
+                regex: '(36)(#)([\\da-zA-Z]+)' },
+              { token: 'invalid.illegal.integer.erlang',
+                regex: '\\d+#[\\da-zA-Z]+' },
+              { token: 'constant.numeric.integer.decimal.erlang',
+                regex: '\\d+' } ] } ],
+      '#parenthesized-expression': 
+       [ { token: 'punctuation.section.expression.begin.erlang',
+           regex: '\\(',
+           push: 
+            [ { token: 'punctuation.section.expression.end.erlang',
+                regex: '\\)',
+                next: 'pop' },
+              { include: '#everything-else' },
+              { defaultToken: 'meta.expression.parenthesized' } ] } ],
+      '#record-directive': 
+       [ { token: 
+            [ 'meta.directive.record.erlang',
+              'punctuation.section.directive.begin.erlang',
+              'meta.directive.record.erlang',
+              'keyword.control.directive.import.erlang',
+              'meta.directive.record.erlang',
+              'punctuation.definition.parameters.begin.erlang',
+              'meta.directive.record.erlang',
+              'entity.name.type.class.record.definition.erlang',
+              'meta.directive.record.erlang',
+              'punctuation.separator.parameters.erlang' ],
+           regex: '^(\\s*)(-)(\\s*)(record)(\\s*)(\\()(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(,)',
+           push: 
+            [ { token: 
+                 [ 'punctuation.definition.class.record.end.erlang',
+                   'meta.directive.record.erlang',
+                   'punctuation.definition.parameters.end.erlang',
+                   'meta.directive.record.erlang',
+                   'punctuation.section.directive.end.erlang' ],
+                regex: '(\\})(\\s*)(\\))(\\s*)(\\.)',
+                next: 'pop' },
+              { include: '#internal-record-body' },
+              { defaultToken: 'meta.directive.record.erlang' } ] } ],
+      '#record-usage': 
+       [ { token: 
+            [ 'keyword.operator.record.erlang',
+              'meta.record-usage.erlang',
+              'entity.name.type.class.record.erlang',
+              'meta.record-usage.erlang',
+              'punctuation.separator.record-field.erlang',
+              'meta.record-usage.erlang',
+              'variable.other.field.erlang' ],
+           regex: '(#)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')(\\s*)(\\.)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')' },
+         { token: 
+            [ 'keyword.operator.record.erlang',
+              'meta.record-usage.erlang',
+              'entity.name.type.class.record.erlang' ],
+           regex: '(#)(\\s*)([a-z][a-zA-Z\\d@_]*|\'[^\']*\')',
+           push: 
+            [ { token: 'punctuation.definition.class.record.end.erlang',
+                regex: '\\}',
+                next: 'pop' },
+              { include: '#internal-record-body' },
+              { defaultToken: 'meta.record-usage.erlang' } ] } ],
+      '#string': 
+       [ { token: 'punctuation.definition.string.begin.erlang',
+           regex: '"',
+           push: 
+            [ { token: 'punctuation.definition.string.end.erlang',
+                regex: '"',
+                next: 'pop' },
+              { token: 
+                 [ 'punctuation.definition.escape.erlang',
+                   'constant.character.escape.erlang',
+                   'punctuation.definition.escape.erlang',
+                   'constant.character.escape.erlang',
+                   'constant.character.escape.erlang' ],
+                regex: '(\\\\)(?:([bdefnrstv\\\\\'"])|(\\^)([@-_])|([0-7]{1,3}))' },
+              { token: 'invalid.illegal.string.erlang', regex: '\\\\\\^?.?' },
+              { token: 
+                 [ 'punctuation.definition.placeholder.erlang',
+                   'punctuation.separator.placeholder-parts.erlang',
+                   'constant.other.placeholder.erlang',
+                   'punctuation.separator.placeholder-parts.erlang',
+                   'punctuation.separator.placeholder-parts.erlang',
+                   'constant.other.placeholder.erlang',
+                   'punctuation.separator.placeholder-parts.erlang',
+                   'punctuation.separator.placeholder-parts.erlang',
+                   'punctuation.separator.placeholder-parts.erlang',
+                   'constant.other.placeholder.erlang',
+                   'constant.other.placeholder.erlang' ],
+                regex: '(~)(?:((?:\\-)?)(\\d+)|(\\*))?(?:(\\.)(?:(\\d+)|(\\*)))?(?:(\\.)(?:(\\*)|(.)))?([~cfegswpWPBX#bx\\+ni])' },
+              { token: 
+                 [ 'punctuation.definition.placeholder.erlang',
+                   'punctuation.separator.placeholder-parts.erlang',
+                   'constant.other.placeholder.erlang',
+                   'constant.other.placeholder.erlang' ],
+                regex: '(~)((?:\\*)?)((?:\\d+)?)([~du\\-#fsacl])' },
+              { token: 'invalid.illegal.string.erlang', regex: '~.?' },
+              { defaultToken: 'string.quoted.double.erlang' } ] } ],
+      '#symbolic-operator': 
+       [ { token: 'keyword.operator.symbolic.erlang',
+           regex: '\\+\\+|\\+|--|-|\\*|/=|/|=/=|=:=|==|=<|=|<-|<|>=|>|!|::' } ],
+      '#textual-operator': 
+       [ { token: 'keyword.operator.textual.erlang',
+           regex: '\\b(?:andalso|band|and|bxor|xor|bor|orelse|or|bnot|not|bsl|bsr|div|rem)\\b' } ],
+      '#tuple': 
+       [ { token: 'punctuation.definition.tuple.begin.erlang',
+           regex: '\\{',
+           push: 
+            [ { token: 'punctuation.definition.tuple.end.erlang',
+                regex: '\\}',
+                next: 'pop' },
+              { token: 'punctuation.separator.tuple.erlang', regex: ',' },
+              { include: '#everything-else' },
+              { defaultToken: 'meta.structure.tuple.erlang' } ] } ],
+      '#variable': 
+       [ { token: [ 'variable.other.erlang', 'variable.language.omitted.erlang' ],
+           regex: '(_[a-zA-Z\\d@_]+|[A-Z][a-zA-Z\\d@_]*)|(_)' } ] }
+    
+    this.normalizeRules();
+};
+
+ErlangHighlightRules.metaData = { comment: 'The recognition of function definitions and compiler directives (such as module, record and macro definitions) requires that each of the aforementioned constructs must be the first string inside a line (except for whitespace).  Also, the function/module/record/macro names must be given unquoted.  -- desp',
+      fileTypes: [ 'erl', 'hrl' ],
+      keyEquivalent: '^~E',
+      name: 'Erlang',
+      scopeName: 'source.erlang' }
+
+
+oop.inherits(ErlangHighlightRules, TextHighlightRules);
+
+exports.ErlangHighlightRules = ErlangHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/asciidoc.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/asciidoc.js b/src/fauxton/assets/js/libs/ace/mode/folding/asciidoc.js
new file mode 100644
index 0000000..d684917
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/asciidoc.js
@@ -0,0 +1,142 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var BaseFoldMode = require("./fold_mode").FoldMode;
+var Range = require("../../range").Range;
+
+var FoldMode = exports.FoldMode = function() {};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+    this.foldingStartMarker = /^(?:\|={10,}|[\.\/=\-~^+]{4,}\s*$|={1,5} )/;
+    this.singleLineHeadingRe = /^={1,5}(?=\s+\S)/;
+
+    this.getFoldWidget = function(session, foldStyle, row) {
+        var line = session.getLine(row);
+        if (!this.foldingStartMarker.test(line))
+            return ""
+
+        if (line[0] == "=") {
+            if (this.singleLineHeadingRe.test(line))
+                return "start";
+            if (session.getLine(row - 1).length != session.getLine(row).length)
+                return "";
+            return "start";
+        }
+        if (session.bgTokenizer.getState(row) == "dissallowDelimitedBlock")
+            return "end";
+        return "start";
+    };
+
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
+        var line = session.getLine(row);
+        var startColumn = line.length;
+        var maxRow = session.getLength();
+        var startRow = row;
+        var endRow = row;
+        if (!line.match(this.foldingStartMarker))
+            return;
+
+        var token;
+        function getTokenType(row) {
+            token = session.getTokens(row)[0];
+            return token && token.type;
+        }
+
+        var levels = ["=","-","~","^","+"];
+        var heading = "markup.heading";
+        var singleLineHeadingRe = this.singleLineHeadingRe;
+        function getLevel() {
+            var match = token.value.match(singleLineHeadingRe);
+            if (match)
+                return match[0].length;
+            var level = levels.indexOf(token.value[0]) + 1;
+            if (level == 1) {
+                if (session.getLine(row - 1).length != session.getLine(row).length)
+                    return Infinity;
+            }
+            return level;
+        }
+
+        if (getTokenType(row) == heading) {
+            var startHeadingLevel = getLevel();
+            while (++row < maxRow) {
+                if (getTokenType(row) != heading)
+                    continue;
+                var level = getLevel();
+                if (level <= startHeadingLevel)
+                    break;
+            }
+
+            var isSingleLineHeading = token && token.value.match(this.singleLineHeadingRe);
+            endRow = isSingleLineHeading ? row - 1 : row - 2;
+
+            if (endRow > startRow) {
+                while (endRow > startRow && (!getTokenType(endRow) || token.value[0] == "["))
+                    endRow--;
+            }
+
+            if (endRow > startRow) {
+                var endColumn = session.getLine(endRow).length;
+                return new Range(startRow, startColumn, endRow, endColumn);
+            }
+        } else {
+            var state = session.bgTokenizer.getState(row);
+            if (state == "dissallowDelimitedBlock") {
+                while (row -- > 0) {
+                    if (session.bgTokenizer.getState(row).lastIndexOf("Block") == -1)
+                        break;
+                }
+                endRow = row + 1;
+                if (endRow < startRow) {
+                    var endColumn = session.getLine(row).length;
+                    return new Range(endRow, 5, startRow, startColumn - 5);
+                }
+            } else {
+                while (++row < maxRow) {
+                    if (session.bgTokenizer.getState(row) == "dissallowDelimitedBlock")
+                        break;
+                }
+                endRow = row;
+                if (endRow > startRow) {
+                    var endColumn = session.getLine(row).length;
+                    return new Range(startRow, 5, endRow, endColumn - 5);
+                }
+            }
+        }
+    };
+
+}).call(FoldMode.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/c9search.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/c9search.js b/src/fauxton/assets/js/libs/ace/mode/folding/c9search.js
new file mode 100644
index 0000000..dd6a0b4
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/c9search.js
@@ -0,0 +1,77 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var Range = require("../../range").Range;
+var BaseFoldMode = require("./fold_mode").FoldMode;
+
+var FoldMode = exports.FoldMode = function() {};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+    this.foldingStartMarker = /^(\S.*\:|Searching for.*)$/;
+    this.foldingStopMarker = /^(\s+|Found.*)$/;
+    
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
+        var lines = session.doc.getAllLines(row);
+        var line = lines[row];
+        var level1 = /^(Found.*|Searching for.*)$/;
+        var level2 = /^(\S.*\:|\s*)$/;
+        var re = level1.test(line) ? level1 : level2;
+
+        if (this.foldingStartMarker.test(line)) {            
+            for (var i = row + 1, l = session.getLength(); i < l; i++) {
+                if (re.test(lines[i]))
+                    break;
+            }
+
+            return new Range(row, line.length, i, 0);
+        }
+
+        if (this.foldingStopMarker.test(line)) {
+            for (var i = row - 1; i >= 0; i--) {
+                line = lines[i];
+                if (re.test(line))
+                    break;
+            }
+
+            return new Range(i, line.length, row, 0);
+        }
+    };
+    
+}).call(FoldMode.prototype);
+
+});
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/coffee.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/coffee.js b/src/fauxton/assets/js/libs/ace/mode/folding/coffee.js
new file mode 100644
index 0000000..fe03a56
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/coffee.js
@@ -0,0 +1,120 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var BaseFoldMode = require("./fold_mode").FoldMode;
+var Range = require("../../range").Range;
+
+var FoldMode = exports.FoldMode = function() {};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
+        var range = this.indentationBlock(session, row);
+        if (range)
+            return range;
+
+        var re = /\S/;
+        var line = session.getLine(row);
+        var startLevel = line.search(re);
+        if (startLevel == -1 || line[startLevel] != "#")
+            return;
+
+        var startColumn = line.length;
+        var maxRow = session.getLength();
+        var startRow = row;
+        var endRow = row;
+
+        while (++row < maxRow) {
+            line = session.getLine(row);
+            var level = line.search(re);
+
+            if (level == -1)
+                continue;
+
+            if (line[level] != "#")
+                break;
+
+            endRow = row;
+        }
+
+        if (endRow > startRow) {
+            var endColumn = session.getLine(endRow).length;
+            return new Range(startRow, startColumn, endRow, endColumn);
+        }
+    };
+
+    // must return "" if there's no fold, to enable caching
+    this.getFoldWidget = function(session, foldStyle, row) {
+        var line = session.getLine(row);
+        var indent = line.search(/\S/);
+        var next = session.getLine(row + 1);
+        var prev = session.getLine(row - 1);
+        var prevIndent = prev.search(/\S/);
+        var nextIndent = next.search(/\S/);
+
+        if (indent == -1) {
+            session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
+            return "";
+        }
+
+        // documentation comments
+        if (prevIndent == -1) {
+            if (indent == nextIndent && line[indent] == "#" && next[indent] == "#") {
+                session.foldWidgets[row - 1] = "";
+                session.foldWidgets[row + 1] = "";
+                return "start";
+            }
+        } else if (prevIndent == indent && line[indent] == "#" && prev[indent] == "#") {
+            if (session.getLine(row - 2).search(/\S/) == -1) {
+                session.foldWidgets[row - 1] = "start";
+                session.foldWidgets[row + 1] = "";
+                return "";
+            }
+        }
+
+        if (prevIndent!= -1 && prevIndent < indent)
+            session.foldWidgets[row - 1] = "start";
+        else
+            session.foldWidgets[row - 1] = "";
+
+        if (indent < nextIndent)
+            return "start";
+        else
+            return "";
+    };
+
+}).call(FoldMode.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/coffee_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/coffee_test.js b/src/fauxton/assets/js/libs/ace/mode/folding/coffee_test.js
new file mode 100644
index 0000000..2abd1fe
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/coffee_test.js
@@ -0,0 +1,101 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined")
+    require("amd-loader");
+
+define(function(require, exports, module) {
+"use strict";
+
+var CoffeeMode = require("../coffee").Mode;
+var EditSession = require("../../edit_session").EditSession;
+var assert = require("../../test/assertions");
+function testFoldWidgets(array) {
+    var session = array.filter(function(_, i){return i % 2 == 1});
+    session = new EditSession(session);
+    var mode = new CoffeeMode();
+    session.setFoldStyle("markbeginend");
+    session.setMode(mode);
+
+    var widgets = array.filter(function(_, i){return i % 2 == 0});
+    widgets.forEach(function(w, i){
+        session.foldWidgets[i] = session.getFoldWidget(i);
+    })
+    widgets.forEach(function(w, i){
+        w = w.split(",");
+        var type = w[0] == ">" ? "start" : w[0] == "<" ? "end" : "";
+        assert.equal(session.foldWidgets[i], type);
+        if (!type)
+            return;
+        var range = session.getFoldWidgetRange(i);
+        if (!w[1]) {
+            assert.equal(range, null);
+            return;
+        }
+        assert.equal(range.start.row, i);
+        assert.equal(range.end.row - range.start.row, parseInt(w[1]));
+        testColumn(w[2], range.start);
+        testColumn(w[3], range.end);
+    });
+
+    function testColumn(w, pos) {
+        if (!w)
+            return;
+        if (w == "l")
+            w = session.getLine(pos.row).length;
+        else
+            w = parseInt(w);
+        assert.equal(pos.column, w);
+    }
+}
+module.exports = {
+    "test: coffee script indentation based folding": function() {
+       testFoldWidgets([
+            '>,1,l,l',         ' ## indented comment',
+            '',                '  # ',
+            '',                '',
+            '>,1,l,l',         ' # plain comment',
+            '',                ' # ',
+            '>,2',             ' function (x)=>',
+            '',                '  ',
+            '',                '  x++',
+            '',                '  ',
+            '',                '  ',
+            '>,2',             ' bar = ',
+            '',                '   foo: 1',
+            '',                '   baz: lighter'
+        ]);
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main)
+    require("asyncjs").test.testcase(module.exports).exec();

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/csharp.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/csharp.js b/src/fauxton/assets/js/libs/ace/mode/folding/csharp.js
new file mode 100644
index 0000000..c450753
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/csharp.js
@@ -0,0 +1,138 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var Range = require("../../range").Range;
+var CFoldMode = require("./cstyle").FoldMode;
+
+var FoldMode = exports.FoldMode = function(commentRegex) {
+    if (commentRegex) {
+        this.foldingStartMarker = new RegExp(
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
+        );
+        this.foldingStopMarker = new RegExp(
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
+        );
+    }
+};
+oop.inherits(FoldMode, CFoldMode);
+
+(function() {
+    this.usingRe = /^\s*using \S/;
+
+    this.getFoldWidgetRangeBase = this.getFoldWidgetRange;
+    this.getFoldWidgetBase = this.getFoldWidget;
+    
+    this.getFoldWidget = function(session, foldStyle, row) {
+        var fw = this.getFoldWidgetBase(session, foldStyle, row);
+        if (!fw) {
+            var line = session.getLine(row);
+            if (/^\s*#region\b/.test(line)) 
+                return "start";
+            var usingRe = this.usingRe;
+            if (usingRe.test(line)) {
+                var prev = session.getLine(row - 1);
+                var next = session.getLine(row + 1);
+                if (!usingRe.test(prev) && usingRe.test(next))
+                    return "start"
+            }
+        }
+        return fw;
+    };
+    
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
+        var range = this.getFoldWidgetRangeBase(session, foldStyle, row);
+        if (range)
+            return range;
+
+        var line = session.getLine(row);
+        if (this.usingRe.test(line))
+            return this.getUsingStatementBlock(session, line, row);
+            
+        if (/^\s*#region\b/.test(line))
+            return this.getRegionBlock(session, line, row);
+    };
+    
+    this.getUsingStatementBlock = function(session, line, row) {
+        var startColumn = line.match(this.usingRe)[0].length - 1;
+        var maxRow = session.getLength();
+        var startRow = row;
+        var endRow = row;
+
+        while (++row < maxRow) {
+            line = session.getLine(row);
+            if (/^\s*$/.test(line))
+                continue;
+            if (!this.usingRe.test(line))
+                break;
+
+            endRow = row;
+        }
+
+        if (endRow > startRow) {
+            var endColumn = session.getLine(endRow).length;
+            return new Range(startRow, startColumn, endRow, endColumn);
+        }
+    };
+    
+    this.getRegionBlock = function(session, line, row) {
+        var startColumn = line.search(/\s*$/);
+        var maxRow = session.getLength();
+        var startRow = row;
+        
+        var re = /^\s*#(end)?region\b/
+        var depth = 1
+        while (++row < maxRow) {
+            line = session.getLine(row);
+            var m = re.exec(line);
+            if (!m)
+                continue;
+            if (m[1])
+                depth--;
+            else
+                depth++;
+
+            if (!depth)
+                break;
+        }
+
+        var endRow = row;
+        if (endRow > startRow) {
+            var endColumn = line.search(/\S/);
+            return new Range(startRow, startColumn, endRow, endColumn);
+        }
+    };
+
+}).call(FoldMode.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/cstyle.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/cstyle.js b/src/fauxton/assets/js/libs/ace/mode/folding/cstyle.js
new file mode 100644
index 0000000..8be20d2
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/cstyle.js
@@ -0,0 +1,83 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var Range = require("../../range").Range;
+var BaseFoldMode = require("./fold_mode").FoldMode;
+
+var FoldMode = exports.FoldMode = function(commentRegex) {
+    if (commentRegex) {
+        this.foldingStartMarker = new RegExp(
+            this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
+        );
+        this.foldingStopMarker = new RegExp(
+            this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
+        );
+    }
+};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
+    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
+
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
+        var line = session.getLine(row);
+        var match = line.match(this.foldingStartMarker);
+        if (match) {
+            var i = match.index;
+
+            if (match[1])
+                return this.openingBracketBlock(session, match[1], row, i);
+
+            return session.getCommentFoldRange(row, i + match[0].length, 1);
+        }
+
+        if (foldStyle !== "markbeginend")
+            return;
+
+        var match = line.match(this.foldingStopMarker);
+        if (match) {
+            var i = match.index + match[0].length;
+
+            if (match[1])
+                return this.closingBracketBlock(session, match[1], row, i);
+
+            return session.getCommentFoldRange(row, i, -1);
+        }
+    };
+
+}).call(FoldMode.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/cstyle_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/cstyle_test.js b/src/fauxton/assets/js/libs/ace/mode/folding/cstyle_test.js
new file mode 100644
index 0000000..e007c79
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/cstyle_test.js
@@ -0,0 +1,85 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined")
+    require("amd-loader");
+
+define(function(require, exports, module) {
+"use strict";
+
+var JavaScriptMode = require("../javascript").Mode;
+var EditSession = require("../../edit_session").EditSession;
+var assert = require("../../test/assertions");
+
+module.exports = {
+
+    "test: fold comments": function() {
+        var session = new EditSession([
+            '/*',
+            'stuff',
+            '*/'
+        ]);
+        
+        var mode = new JavaScriptMode();
+        session.setFoldStyle("markbeginend");
+        session.setMode(mode);
+        
+        assert.equal(session.getFoldWidget(0), "start");
+        assert.equal(session.getFoldWidget(1), "");
+        assert.equal(session.getFoldWidget(2), "end");
+        
+        assert.range(session.getFoldWidgetRange(0), 0, 2, 2, 0);
+        assert.range(session.getFoldWidgetRange(2), 0, 2, 2, 0);
+    },
+    
+    "test: fold doc style comments": function() {
+        var session = new EditSession([
+            '/**',
+            ' * stuff',
+            ' * *** */'
+        ]);
+        
+        var mode = new JavaScriptMode();
+        session.setFoldStyle("markbeginend");
+        session.setMode(mode);
+        
+        assert.equal(session.getFoldWidget(0), "start");
+        assert.equal(session.getFoldWidget(1), "");
+        assert.equal(session.getFoldWidget(2), "end");
+        
+        assert.range(session.getFoldWidgetRange(0), 0, 2, 2, 7);
+        assert.range(session.getFoldWidgetRange(2), 0, 2, 2, 7);
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main)
+    require("asyncjs").test.testcase(module.exports).exec();


[04/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/text.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/text.js b/src/fauxton/assets/js/libs/ace/mode/text.js
new file mode 100644
index 0000000..b853c52
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/text.js
@@ -0,0 +1,384 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var Tokenizer = require("../tokenizer").Tokenizer;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var Behaviour = require("./behaviour").Behaviour;
+var unicode = require("../unicode");
+var lang = require("../lib/lang");
+var TokenIterator = require("../token_iterator").TokenIterator;
+var Range = require("../range").Range;
+
+var Mode = function() {
+    this.HighlightRules = TextHighlightRules;
+    this.$behaviour = new Behaviour();
+};
+
+(function() {
+
+    this.tokenRe = new RegExp("^["
+        + unicode.packages.L
+        + unicode.packages.Mn + unicode.packages.Mc
+        + unicode.packages.Nd
+        + unicode.packages.Pc + "\\$_]+", "g"
+    );
+
+    this.nonTokenRe = new RegExp("^(?:[^"
+        + unicode.packages.L
+        + unicode.packages.Mn + unicode.packages.Mc
+        + unicode.packages.Nd
+        + unicode.packages.Pc + "\\$_]|\s])+", "g"
+    );
+
+    this.getTokenizer = function() {
+        if (!this.$tokenizer) {
+            this.$highlightRules = new this.HighlightRules();
+            this.$tokenizer = new Tokenizer(this.$highlightRules.getRules());
+        }
+        return this.$tokenizer;
+    };
+
+    this.lineCommentStart = "";
+    this.blockComment = "";
+
+    this.toggleCommentLines = function(state, session, startRow, endRow) {
+        var doc = session.doc;
+
+        var ignoreBlankLines = true;
+        var shouldRemove = true;
+        var minIndent = Infinity;
+        var tabSize = session.getTabSize();
+        var insertAtTabStop = false;
+
+        if (!this.lineCommentStart) {
+            if (!this.blockComment)
+                return false;
+            var lineCommentStart = this.blockComment.start;
+            var lineCommentEnd = this.blockComment.end;
+            var regexpStart = new RegExp("^(\\s*)(?:" + lang.escapeRegExp(lineCommentStart) + ")");
+            var regexpEnd = new RegExp("(?:" + lang.escapeRegExp(lineCommentEnd) + ")\\s*$");
+
+            var comment = function(line, i) {
+                if (testRemove(line, i))
+                    return;
+                if (!ignoreBlankLines || /\S/.test(line)) {
+                    doc.insertInLine({row: i, column: line.length}, lineCommentEnd);
+                    doc.insertInLine({row: i, column: minIndent}, lineCommentStart);
+                }
+            };
+
+            var uncomment = function(line, i) {
+                var m;
+                if (m = line.match(regexpEnd))
+                    doc.removeInLine(i, line.length - m[0].length, line.length);
+                if (m = line.match(regexpStart))
+                    doc.removeInLine(i, m[1].length, m[0].length);
+            };
+
+            var testRemove = function(line, row) {
+                if (regexpStart.test(line))
+                    return true;
+                var tokens = session.getTokens(row);
+                for (var i = 0; i < tokens.length; i++) {
+                    if (tokens[i].type === 'comment')
+                        return true;
+                }
+            };
+        } else {
+            if (Array.isArray(this.lineCommentStart)) {
+                var regexpStart = this.lineCommentStart.map(lang.escapeRegExp).join("|");
+                var lineCommentStart = this.lineCommentStart[0];
+            } else {
+                var regexpStart = lang.escapeRegExp(this.lineCommentStart);
+                var lineCommentStart = this.lineCommentStart;
+            }
+            regexpStart = new RegExp("^(\\s*)(?:" + regexpStart + ") ?");
+            
+            insertAtTabStop = session.getUseSoftTabs();
+
+            var uncomment = function(line, i) {
+                var m = line.match(regexpStart);
+                if (!m) return;
+                var start = m[1].length, end = m[0].length;
+                if (!shouldInsertSpace(line, start, end) && m[0][end - 1] == " ")
+                    end--;
+                doc.removeInLine(i, start, end);
+            };
+            var commentWithSpace = lineCommentStart + " ";
+            var comment = function(line, i) {
+                if (!ignoreBlankLines || /\S/.test(line)) {
+                    if (shouldInsertSpace(line, minIndent, minIndent))
+                        doc.insertInLine({row: i, column: minIndent}, commentWithSpace);
+                    else
+                        doc.insertInLine({row: i, column: minIndent}, lineCommentStart);
+                }
+            };
+            var testRemove = function(line, i) {
+                return regexpStart.test(line);
+            };
+            
+            var shouldInsertSpace = function(line, before, after) {
+                var spaces = 0;
+                while (before-- && line.charAt(before) == " ")
+                    spaces++;
+                if (spaces % tabSize != 0)
+                    return false;
+                var spaces = 0;
+                while (line.charAt(after++) == " ")
+                    spaces++;
+                if (tabSize > 2)
+                    return spaces % tabSize != tabSize - 1;
+                else
+                    return spaces % tabSize == 0;
+                return true;
+            };
+        }
+
+        function iter(fun) {
+            for (var i = startRow; i <= endRow; i++)
+                fun(doc.getLine(i), i);
+        }
+
+
+        var minEmptyLength = Infinity;
+        iter(function(line, i) {
+            var indent = line.search(/\S/);
+            if (indent !== -1) {
+                if (indent < minIndent)
+                    minIndent = indent;
+                if (shouldRemove && !testRemove(line, i))
+                    shouldRemove = false;
+            } else if (minEmptyLength > line.length) {
+                minEmptyLength = line.length;
+            }
+        });
+
+        if (minIndent == Infinity) {
+            minIndent = minEmptyLength;
+            ignoreBlankLines = false;
+            shouldRemove = false;
+        }
+
+        if (insertAtTabStop && minIndent % tabSize != 0)
+            minIndent = Math.floor(minIndent / tabSize) * tabSize;
+
+        iter(shouldRemove ? uncomment : comment);
+    };
+
+    this.toggleBlockComment = function(state, session, range, cursor) {
+        var comment = this.blockComment;
+        if (!comment)
+            return;
+        if (!comment.start && comment[0])
+            comment = comment[0];
+
+        var iterator = new TokenIterator(session, cursor.row, cursor.column);
+        var token = iterator.getCurrentToken();
+
+        var sel = session.selection;
+        var initialRange = session.selection.toOrientedRange();
+        var startRow, colDiff;
+
+        if (token && /comment/.test(token.type)) {
+            var startRange, endRange;
+            while (token && /comment/.test(token.type)) {
+                var i = token.value.indexOf(comment.start);
+                if (i != -1) {
+                    var row = iterator.getCurrentTokenRow();
+                    var column = iterator.getCurrentTokenColumn() + i;
+                    startRange = new Range(row, column, row, column + comment.start.length);
+                    break
+                }
+                token = iterator.stepBackward();
+            };
+
+            var iterator = new TokenIterator(session, cursor.row, cursor.column);
+            var token = iterator.getCurrentToken();
+            while (token && /comment/.test(token.type)) {
+                var i = token.value.indexOf(comment.end);
+                if (i != -1) {
+                    var row = iterator.getCurrentTokenRow();
+                    var column = iterator.getCurrentTokenColumn() + i;
+                    endRange = new Range(row, column, row, column + comment.end.length);
+                    break;
+                }
+                token = iterator.stepForward();
+            }
+            if (endRange)
+                session.remove(endRange);
+            if (startRange) {
+                session.remove(startRange);
+                startRow = startRange.start.row;
+                colDiff = -comment.start.length
+            }
+        } else {
+            colDiff = comment.start.length
+            startRow = range.start.row;
+            session.insert(range.end, comment.end);
+            session.insert(range.start, comment.start);
+        }
+        // todo: selection should have ended up in the right place automatically!
+        if (initialRange.start.row == startRow)
+            initialRange.start.column += colDiff;
+        if (initialRange.end.row == startRow)
+            initialRange.end.column += colDiff;
+        session.selection.fromOrientedRange(initialRange);
+    };
+
+    this.getNextLineIndent = function(state, line, tab) {
+        return this.$getIndent(line);
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return false;
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+    };
+
+    this.$getIndent = function(line) {
+        return line.match(/^\s*/)[0];
+    };
+
+    this.createWorker = function(session) {
+        return null;
+    };
+
+    this.createModeDelegates = function (mapping) {
+        this.$embeds = [];
+        this.$modes = {};
+        for (var i in mapping) {
+            if (mapping[i]) {
+                this.$embeds.push(i);
+                this.$modes[i] = new mapping[i]();
+            }
+        }
+
+        var delegations = ['toggleCommentLines', 'getNextLineIndent', 'checkOutdent', 'autoOutdent', 'transformAction', 'getCompletions'];
+
+        for (var i = 0; i < delegations.length; i++) {
+            (function(scope) {
+              var functionName = delegations[i];
+              var defaultHandler = scope[functionName];
+              scope[delegations[i]] = function() {
+                  return this.$delegator(functionName, arguments, defaultHandler);
+              }
+            } (this));
+        }
+    };
+
+    this.$delegator = function(method, args, defaultHandler) {
+        var state = args[0];
+        if (typeof state != "string")
+            state = state[0];
+        for (var i = 0; i < this.$embeds.length; i++) {
+            if (!this.$modes[this.$embeds[i]]) continue;
+
+            var split = state.split(this.$embeds[i]);
+            if (!split[0] && split[1]) {
+                args[0] = split[1];
+                var mode = this.$modes[this.$embeds[i]];
+                return mode[method].apply(mode, args);
+            }
+        }
+        var ret = defaultHandler.apply(this, args);
+        return defaultHandler ? ret : undefined;
+    };
+
+    this.transformAction = function(state, action, editor, session, param) {
+        if (this.$behaviour) {
+            var behaviours = this.$behaviour.getBehaviours();
+            for (var key in behaviours) {
+                if (behaviours[key][action]) {
+                    var ret = behaviours[key][action].apply(this, arguments);
+                    if (ret) {
+                        return ret;
+                    }
+                }
+            }
+        }
+    };
+    
+    this.getKeywords = function(append) {
+        // this is for autocompletion to pick up regexp'ed keywords
+        if (!this.completionKeywords) {
+            var rules = this.$tokenizer.rules;
+            var completionKeywords = [];
+            for (var rule in rules) {
+                var ruleItr = rules[rule];
+                for (var r = 0, l = ruleItr.length; r < l; r++) {
+                    if (typeof ruleItr[r].token === "string") {
+                        if (/keyword|support|storage/.test(ruleItr[r].token))
+                            completionKeywords.push(ruleItr[r].regex);
+                    }
+                    else if (typeof ruleItr[r].token === "object") {
+                        for (var a = 0, aLength = ruleItr[r].token.length; a < aLength; a++) {    
+                            if (/keyword|support|storage/.test(ruleItr[r].token[a])) {
+                                // drop surrounding parens
+                                var rule = ruleItr[r].regex.match(/\(.+?\)/g)[a];
+                                completionKeywords.push(rule.substr(1, rule.length - 2));
+                            }
+                        }
+                    }
+                }
+            }
+            this.completionKeywords = completionKeywords;
+        }
+        // this is for highlighting embed rules, like HAML/Ruby or Obj-C/C
+        if (!append)
+            return this.$keywordList;
+        return completionKeywords.concat(this.$keywordList || []);
+    };
+    
+    this.$createKeywordList = function() {
+        if (!this.$highlightRules)
+            this.getTokenizer();
+        return this.$keywordList = this.$highlightRules.$keywordList || [];
+    }
+
+    this.getCompletions = function(state, session, pos, prefix) {
+        var keywords = this.$keywordList || this.$createKeywordList();
+        return keywords.map(function(word) {
+            return {
+                name: word,
+                value: word,
+                score: 0,
+                meta: "keyword"
+            };
+        });
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/text_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/text_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/text_highlight_rules.js
new file mode 100644
index 0000000..48e016b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/text_highlight_rules.js
@@ -0,0 +1,234 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var lang = require("../lib/lang");
+
+var TextHighlightRules = function() {
+
+    // regexp must not have capturing parentheses
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "start" : [{
+            token : "empty_line",
+            regex : '^$'
+        }, {
+            defaultToken : "text"
+        }]
+    };
+};
+
+(function() {
+
+    this.addRules = function(rules, prefix) {
+        if (!prefix) {
+            for (var key in rules)
+                this.$rules[key] = rules[key];
+            return;
+        }
+        for (var key in rules) {
+            var state = rules[key];
+            for (var i = 0; i < state.length; i++) {
+                var rule = state[i];
+                if (rule.next) {
+                    if (typeof rule.next != "string") {
+                        if (rule.nextState && rule.nextState.indexOf(prefix) !== 0)
+                            rule.nextState = prefix + rule.nextState;
+                    } else {
+                        if (rule.next.indexOf(prefix) !== 0)
+                            rule.next = prefix + rule.next;
+                    }
+
+                }
+            }
+            this.$rules[prefix + key] = state;
+        }
+    };
+
+    this.getRules = function() {
+        return this.$rules;
+    };
+
+    this.embedRules = function (HighlightRules, prefix, escapeRules, states, append) {
+        var embedRules = new HighlightRules().getRules();
+        if (states) {
+            for (var i = 0; i < states.length; i++)
+                states[i] = prefix + states[i];
+        } else {
+            states = [];
+            for (var key in embedRules)
+                states.push(prefix + key);
+        }
+
+        this.addRules(embedRules, prefix);
+
+        if (escapeRules) {
+            var addRules = Array.prototype[append ? "push" : "unshift"];
+            for (var i = 0; i < states.length; i++)
+                addRules.apply(this.$rules[states[i]], lang.deepCopy(escapeRules));
+        }
+
+        if (!this.$embeds)
+            this.$embeds = [];
+        this.$embeds.push(prefix);
+    };
+
+    this.getEmbeds = function() {
+        return this.$embeds;
+    };
+
+    var pushState = function(currentState, stack) {
+        if (currentState != "start")
+            stack.unshift(this.nextState, currentState);
+        return this.nextState;
+    };
+    var popState = function(currentState, stack) {
+        if (stack[0] !== currentState)
+            return "start";
+        stack.shift();
+        return stack.shift();
+    };
+
+    this.normalizeRules = function() {
+        var id = 0;
+        var rules = this.$rules;
+        function processState(key) {
+            var state = rules[key];
+            state.processed = true;
+            for (var i = 0; i < state.length; i++) {
+                var rule = state[i];
+                if (!rule.regex && rule.start) {
+                    rule.regex = rule.start;
+                    if (!rule.next)
+                        rule.next = [];
+                    rule.next.push({
+                        defaultToken: rule.token
+                    }, {
+                        token: rule.token + ".end",
+                        regex: rule.end || rule.start,
+                        next: "pop"
+                    });
+                    rule.token = rule.token + ".start";
+                    rule.push = true;
+                }
+                var next = rule.next || rule.push;
+                if (next && Array.isArray(next)) {
+                    var stateName = rule.stateName;
+                    if (!stateName)  {
+                        stateName = rule.token;
+                        if (typeof stateName != "string")
+                            stateName = stateName[0] || "";
+                        if (rules[stateName])
+                            stateName += id++;
+                    }
+                    rules[stateName] = next;
+                    rule.next = stateName;
+                    processState(stateName);
+                } else if (next == "pop") {
+                    rule.next = popState;
+                }
+
+                if (rule.push) {
+                    rule.nextState = rule.next || rule.push;
+                    rule.next = pushState;
+                    delete rule.push;
+                }
+
+                if (rule.rules) {
+                    for (var r in rule.rules) {
+                        if (rules[r]) {
+                            if (rules[r].push)
+                                rules[r].push.apply(rules[r], rule.rules[r]);
+                        } else {
+                            rules[r] = rule.rules[r];
+                        }
+                    }
+                }
+                if (rule.include || typeof rule == "string") {
+                    var includeName = rule.include || rule;
+                    var toInsert = rules[includeName];
+                } else if (Array.isArray(rule))
+                    toInsert = rule;
+
+                if (toInsert) {
+                    var args = [i, 1].concat(toInsert);
+                    if (rule.noEscape)
+                        args = args.filter(function(x) {return !x.next;});
+                    state.splice.apply(state, args);
+                    // skip included rules since they are already processed
+                    //i += args.length - 3;
+                    i--;
+                    toInsert = null
+                }
+                
+                if (rule.keywordMap) {
+                    rule.token = this.createKeywordMapper(
+                        rule.keywordMap, rule.defaultToken || "text", rule.caseInsensitive
+                    );
+                    delete rule.defaultToken;
+                }
+            }
+        };
+        Object.keys(rules).forEach(processState, this);
+    };
+
+    this.createKeywordMapper = function(map, defaultToken, ignoreCase, splitChar) {
+        var keywords = Object.create(null);
+        Object.keys(map).forEach(function(className) {
+            var a = map[className];
+            if (ignoreCase)
+                a = a.toLowerCase();
+            var list = a.split(splitChar || "|");
+            for (var i = list.length; i--; )
+                keywords[list[i]] = className;
+        });
+        // in old versions of opera keywords["__proto__"] sets prototype
+        // even on objects with __proto__=null
+        if (Object.getPrototypeOf(keywords)) {
+            keywords.__proto__ = null;
+        }
+        this.$keywordList = Object.keys(keywords);
+        map = null;
+        return ignoreCase
+            ? function(value) {return keywords[value.toLowerCase()] || defaultToken }
+            : function(value) {return keywords[value] || defaultToken };
+    }
+
+    this.getKeywords = function() {
+        return this.$keywords;
+    };
+
+}).call(TextHighlightRules.prototype);
+
+exports.TextHighlightRules = TextHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/text_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/text_test.js b/src/fauxton/assets/js/libs/ace/mode/text_test.js
new file mode 100644
index 0000000..e856e66
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/text_test.js
@@ -0,0 +1,64 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("../edit_session").EditSession;
+var TextMode = require("./text").Mode;
+var assert = require("../test/assertions");
+
+module.exports = {
+    setUp : function() {
+        this.mode = new TextMode();
+    },
+
+    "test: toggle comment lines should not do anything" : function() {
+        var session = new EditSession(["  abc", "cde", "fg"]);
+
+        this.mode.toggleCommentLines("start", session, 0, 1);
+        assert.equal(["  abc", "cde", "fg"].join("\n"), session.toString());
+    },
+
+
+    "test: lines should be indented" : function() {
+        assert.equal("   ", this.mode.getNextLineIndent("start", "   abc", "  "));
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/textile.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/textile.js b/src/fauxton/assets/js/libs/ace/mode/textile.js
new file mode 100644
index 0000000..0c9a86b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/textile.js
@@ -0,0 +1,66 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var TextileHighlightRules = require("./textile_highlight_rules").TextileHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+
+var Mode = function() {
+    this.HighlightRules = TextileHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.getNextLineIndent = function(state, line, tab) {
+        if (state == "intag")
+            return tab;
+        
+        return "";
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+    
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/textile_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/textile_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/textile_highlight_rules.js
new file mode 100644
index 0000000..5edb845
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/textile_highlight_rules.js
@@ -0,0 +1,93 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var TextileHighlightRules = function() {
+    this.$rules = {
+        "start" : [
+            {
+                token : function(value) {
+                    if (value.charAt(0) == "h")
+                        return "markup.heading." + value.charAt(1);
+                    else
+                        return "markup.heading";
+                },
+                regex : "h1|h2|h3|h4|h5|h6|bq|p|bc|pre",
+                next  : "blocktag"
+            },
+            {
+                token : "keyword",
+                regex : "[\\*]+|[#]+"
+            },
+            {
+                token : "text",
+                regex : ".+"
+            }
+        ],
+        "blocktag" : [
+            {
+                token : "keyword",
+                regex : "\\. ",
+                next  : "start"
+            },
+            {
+                token : "keyword",
+                regex : "\\(",
+                next  : "blocktagproperties"
+            }
+        ],
+        "blocktagproperties" : [
+            {
+                token : "keyword",
+                regex : "\\)",
+                next  : "blocktag"
+            },
+            {
+                token : "string",
+                regex : "[a-zA-Z0-9\\-_]+"
+            },
+            {
+                token : "keyword",
+                regex : "#"
+            }
+        ]
+    };
+};
+
+oop.inherits(TextileHighlightRules, TextHighlightRules);
+
+exports.TextileHighlightRules = TextileHighlightRules;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/toml.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/toml.js b/src/fauxton/assets/js/libs/ace/mode/toml.js
new file mode 100644
index 0000000..c277b84
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/toml.js
@@ -0,0 +1,56 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2013, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ *
+ * Garen J. Torikian
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var TomlHighlightRules = require("./toml_highlight_rules").TomlHighlightRules;
+var FoldMode = require("./folding/ini").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = TomlHighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = "#";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/toml_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/toml_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/toml_highlight_rules.js
new file mode 100644
index 0000000..686ffae
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/toml_highlight_rules.js
@@ -0,0 +1,103 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2013, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ *
+ * Garen J. Torikian
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var TomlHighlightRules = function() {
+    var keywordMapper = this.createKeywordMapper({
+        "constant.language.boolean": "true|false"
+    }, "identifier");
+
+    var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b";
+
+    this.$rules = {
+    "start": [
+        {
+            token: "comment.toml",
+            regex: /#.*$/
+        },
+        {
+            token : "string",
+            regex : '"(?=.)',
+            next  : "qqstring"
+        },
+        {
+            token: ["variable.keygroup.toml"],
+            regex: "(?:^\\s*)(\\[([^\\]]+)\\])"
+        },
+        {
+            token : keywordMapper,
+            regex : identifierRe
+        },
+        {
+           token : "support.date.toml",
+           regex: "\\d{4}-\\d{2}-\\d{2}(T)\\d{2}:\\d{2}:\\d{2}(Z)"
+        },
+        {
+           token: "constant.numeric.toml",
+           regex: "-?\\d+(\\.?\\d+)?"
+        }
+    ],
+    "qqstring" : [
+        {
+            token : "string",
+            regex : "\\\\$",
+            next  : "qqstring"
+        },
+        {
+            token : "constant.language.escape",
+            regex : '\\\\[0tnr"\\\\]'
+        },
+        {
+            token : "string",
+            regex : '"|$',
+            next  : "start"
+        },
+        {
+            defaultToken: "string"
+        }
+    ]
+    }
+
+};
+
+oop.inherits(TomlHighlightRules, TextHighlightRules);
+
+exports.TomlHighlightRules = TomlHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/twig.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/twig.js b/src/fauxton/assets/js/libs/ace/mode/twig.js
new file mode 100644
index 0000000..06e4faa
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/twig.js
@@ -0,0 +1,92 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2013, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var JavaScriptMode = require("./javascript").Mode;
+var CssMode = require("./css").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var TwigHighlightRules = require("./twig_highlight_rules").TwigHighlightRules;
+var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour;
+var HtmlFoldMode = require("./folding/html").FoldMode;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+
+var Mode = function() {
+    this.HighlightRules = TwigHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new HtmlBehaviour();
+
+    this.createModeDelegates({
+        "js-": JavaScriptMode,
+        "css-": CssMode
+    });
+
+    this.foldingRules = new HtmlFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.blockComment = {start: "{#", end: "#}"};
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+        var endState = tokenizedLine.state;
+
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+
+        if (state == "start") {
+            var match = line.match(/^.*[\{\(\[]\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/twig_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/twig_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/twig_highlight_rules.js
new file mode 100644
index 0000000..dcd37a5
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/twig_highlight_rules.js
@@ -0,0 +1,166 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2013, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var TwigHighlightRules = function() {
+    // inherit from html
+    HtmlHighlightRules.call(this);
+
+    var tags = "autoescape|block|do|embed|extends|filter|flush|for|from|if|import|include|macro|sandbox|set|spaceless|use|verbatim";
+    tags = tags + "|end" + tags.replace(/\|/g, "|end");
+    var filters = "abs|batch|capitalize|convert_encoding|date|date_modify|default|e|escape|first|format|join|json_encode|keys|last|length|lower|merge|nl2br|number_format|raw|replace|reverse|slice|sort|split|striptags|title|trim|upper|url_encode";
+    var functions = "attribute|constant|cycle|date|dump|parent|random|range|template_from_string";
+    var tests = "constant|divisibleby|sameas|defined|empty|even|iterable|odd";
+    var constants = "null|none|true|false";
+    var operators = "b-and|b-xor|b-or|in|is|and|or|not"
+
+    var keywordMapper = this.createKeywordMapper({
+        "keyword.control.twig": tags,
+        "support.function.twig": [filters, functions, tests].join("|"),
+        "keyword.operator.twig":  operators,
+        "constant.language.twig": constants
+    }, "identifier");
+
+    // add twig start tags to the HTML start tags
+    for (var rule in this.$rules) {
+        this.$rules[rule].unshift({
+            token : "variable.other.readwrite.local.twig",
+            regex : "\\{\\{-?",
+            push : "twig-start"
+        }, {
+            token : "meta.tag.twig",
+            regex : "\\{%-?",
+            push : "twig-start"
+        }, {
+            token : "comment.block.twig",
+            regex : "\\{#-?",
+            push : "twig-comment"
+        });
+    }
+
+    // add twig closing comment to HTML comments
+    this.$rules["twig-comment"] = [{
+        token : "comment.block.twig",
+        regex : ".*-?#\\}",
+        next : "pop"
+    }];
+
+    this.$rules["twig-start"] = [{
+        token : "variable.other.readwrite.local.twig",
+        regex : "-?\\}\\}",
+        next : "pop"
+    }, {
+        token : "meta.tag.twig",
+        regex : "-?%\\}",
+        next : "pop"
+    }, {
+        token : "string",
+        regex : "'",
+        next  : "twig-qstring"
+    }, {
+        token : "string",
+        regex : '"',
+        next  : "twig-qqstring"
+    }, {
+        token : "constant.numeric", // hex
+        regex : "0[xX][0-9a-fA-F]+\\b"
+    }, {
+        token : "constant.numeric", // float
+        regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+    }, {
+        token : "constant.language.boolean",
+        regex : "(?:true|false)\\b"
+    }, {
+        token : keywordMapper,
+        regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+    }, {
+        token : "keyword.operator.assignment",
+        regex : "=|~"
+    }, {
+        token : "keyword.operator.comparison",
+        regex : "==|!=|<|>|>=|<=|==="
+    }, {
+        token : "keyword.operator.arithmetic",
+        regex : "\\+|-|/|%|//|\\*|\\*\\*"
+    }, {
+        token : "keyword.operator.other",
+        regex : "\\.\\.|\\|"
+    }, {
+        token : "punctuation.operator",
+        regex : /\?|\:|\,|\;|\./
+    }, {
+        token : "paren.lparen",
+        regex : /[\[\({]/
+    }, {
+        token : "paren.rparen",
+        regex : /[\])}]/
+    }, {
+        token : "text",
+        regex : "\\s+"
+    } ];
+
+    this.$rules["twig-qqstring"] = [{
+            token : "constant.language.escape",
+            regex : /\\[\\"$#ntr]|#{[^"}]*}/
+        }, {
+            token : "string",
+            regex : '"',
+            next  : "twig-start"
+        }, {
+            defaultToken : "string"
+        }
+    ];
+
+    this.$rules["twig-qstring"] = [{
+            token : "constant.language.escape",
+            regex : /\\[\\'ntr]}/
+        }, {
+            token : "string",
+            regex : "'",
+            next  : "twig-start"
+        }, {
+            defaultToken : "string"
+        }
+    ];
+
+    this.normalizeRules();
+};
+
+oop.inherits(TwigHighlightRules, TextHighlightRules);
+
+exports.TwigHighlightRules = TwigHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/typescript.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/typescript.js b/src/fauxton/assets/js/libs/ace/mode/typescript.js
new file mode 100644
index 0000000..32d24c3
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/typescript.js
@@ -0,0 +1,62 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var jsMode = require("./javascript").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var TypeScriptHighlightRules = require("./typescript_highlight_rules").TypeScriptHighlightRules;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+
+var Mode = function() {
+    this.HighlightRules = TypeScriptHighlightRules;
+    
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new CstyleBehaviour();
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, jsMode);
+
+(function() {
+    this.createWorker = function(session) {
+        return null;
+    };
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/typescript_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/typescript_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/typescript_highlight_rules.js
new file mode 100644
index 0000000..da6a533
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/typescript_highlight_rules.js
@@ -0,0 +1,98 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE    
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ *
+ * Garen J. Torikian <gjtorikian AT gmail DOT com>
+ * 
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode_highlight_rules.tmpl.js (UUID: 21e323af-f665-4161-96e7-5087d262557e) */
+
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
+
+var TypeScriptHighlightRules = function() {
+
+    var tsRules =  [
+        // Match stuff like: module name {...}
+        {
+            token: ["keyword.operator.ts", "text", "variable.parameter.function.ts", "text"],
+            regex: "\\b(module)(\\s*)([a-zA-Z0-9_?.$][\\w?.$]*)(\\s*\\{)"
+        }, 
+        // Match stuff like: super(argument, list)
+        {
+            token: ["storage.type.variable.ts", "text", "keyword.other.ts", "text"],
+            regex: "(super)(\\s*\\()([a-zA-Z0-9,_?.$\\s]+\\s*)(\\))"
+        },
+        // Match stuff like: function() {...}
+        {
+            token: ["entity.name.function.ts","paren.lparen", "paren.rparen"],
+            regex: "([a-zA-Z_?.$][\\w?.$]*)(\\()(\\))"
+        },
+        // Match stuff like: (function: return type)
+        {
+            token: ["variable.parameter.function.ts", "text", "variable.parameter.function.ts"],
+            regex: "([a-zA-Z0-9_?.$][\\w?.$]*)(\\s*:\\s*)([a-zA-Z0-9_?.$][\\w?.$]*)"
+        },  
+        {
+            token: ["keyword.operator.ts"],
+            regex: "(?:\\b(constructor|declare|interface|as|AS|public|private|class|extends|export|super)\\b)"
+        }, 
+        {
+            token: ["storage.type.variable.ts"],
+            regex: "(?:\\b(this\\.|string\\b|bool\\b|number)\\b)"
+        }, 
+        {
+            token: ["keyword.operator.ts", "storage.type.variable.ts", "keyword.operator.ts", "storage.type.variable.ts"],
+            regex: "(class)(\\s+[a-zA-Z0-9_?.$][\\w?.$]*\\s+)(extends)(\\s+[a-zA-Z0-9_?.$][\\w?.$]*\\s+)?"
+        },
+        {
+            token: "keyword",
+            regex: "(?:super|export|class|extends|import)\\b"
+        }
+    ];
+
+    var JSRules = new JavaScriptHighlightRules().getRules();
+    
+    JSRules.start = tsRules.concat(JSRules.start);
+    this.$rules = JSRules;
+};
+
+oop.inherits(TypeScriptHighlightRules, JavaScriptHighlightRules);
+
+exports.TypeScriptHighlightRules = TypeScriptHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/vbscript.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/vbscript.js b/src/fauxton/assets/js/libs/ace/mode/vbscript.js
new file mode 100644
index 0000000..8060445
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/vbscript.js
@@ -0,0 +1,60 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ * 
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var VBScriptHighlightRules = require("./vbscript_highlight_rules").VBScriptHighlightRules;
+
+var Mode = function() {
+    this.HighlightRules = VBScriptHighlightRules;
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+       
+    this.lineCommentStart = ["'", "REM"];
+    
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/vbscript_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/vbscript_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/vbscript_highlight_rules.js
new file mode 100644
index 0000000..a3323b4
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/vbscript_highlight_rules.js
@@ -0,0 +1,276 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode_highlight_rules.tmpl.js (UUID: 7F9C9343-D48E-4E7D-BFE8-F680714DCD3E) */
+
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var VBScriptHighlightRules = function() {
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+    "start": [
+        {
+            token: [
+                "meta.ending-space"
+            ],
+            regex: "$"
+        },
+//        {
+//            token: [
+//                "#round-brackets"
+//            ],
+//            regex: ""
+//        },
+        {
+            token: [
+                null
+            ],
+            regex: "^(?=\\t)",
+            next: "state_3"
+        },
+        {
+            token: [null],
+            regex: "^(?= )",
+            next: "state_4"
+        },
+        {
+            token: [
+                "storage.type.function.asp",
+                "text",
+                "entity.name.function.asp",
+                "text",
+                "punctuation.definition.parameters.asp",
+                "variable.parameter.function.asp",
+                "punctuation.definition.parameters.asp"
+            ],
+            regex: "^\\s*((?:Function|Sub))(\\s*)([a-zA-Z_]\\w*)(\\s*)(\\()([^)]*)(\\)).*\\n?"
+        },
+        {
+            token: "punctuation.definition.comment.asp",
+            regex: "'|REM",
+            next: "comment"
+        },
+        {
+            token: [
+                "keyword.control.asp"
+            ],
+            regex: "(?:\\b(If|Then|Else|ElseIf|Else If|End If|While|Wend|For|To|Each|Case|Select|End Select|Return|Continue|Do|Until|Loop|Next|With|Exit Do|Exit For|Exit Function|Exit Property|Exit Sub|IIf)\\b)"
+        },
+        {
+            token: [
+                "keyword.operator.asp"
+            ],
+            regex: "(?:\\b(Mod|And|Not|Or|Xor|as)\\b)"
+        },
+        {
+            token: [
+                "storage.type.asp"
+            ],
+            regex: "Dim|Call|Class|Const|Dim|Redim|Function|Sub|Private Sub|Public Sub|End sub|End Function|Set|Let|Get|New|Randomize|Option Explicit|On Error Resume Next|On Error GoTo"
+        },
+        {
+            token: [
+                "storage.modifier.asp"
+            ],
+            regex: "(?:\\b(Private|Public|Default)\\b)"
+        },
+        {
+            token: [
+                "constant.language.asp"
+            ],
+            regex: "(?:\\s*\\b(Empty|False|Nothing|Null|True)\\b)"
+        },
+        {
+            token: [
+                "punctuation.definition.string.begin.asp"
+            ],
+            regex: '"',
+            next: "string"
+        },
+        {
+            token: [
+                "punctuation.definition.variable.asp"
+            ],
+            regex: "(\\$)[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*?\\b\\s*"
+        },
+        {
+            token: [
+                "support.class.asp"
+            ],
+            regex: "(?:\\b(Application|ObjectContext|Request|Response|Server|Session)\\b)"
+        },
+        {
+            token: [
+                "support.class.collection.asp"
+            ],
+            regex: "(?:\\b(Contents|StaticObjects|ClientCertificate|Cookies|Form|QueryString|ServerVariables)\\b)"
+        },
+        {
+            token: [
+                "support.constant.asp"
+            ],
+            regex: "(?:\\b(TotalBytes|Buffer|CacheControl|Charset|ContentType|Expires|ExpiresAbsolute|IsClientConnected|PICS|Status|ScriptTimeout|CodePage|LCID|SessionID|Timeout)\\b)"
+        },
+        {
+            token: [
+                "support.function.asp"
+            ],
+            regex: "(?:\\b(Lock|Unlock|SetAbort|SetComplete|BinaryRead|AddHeader|AppendToLog|BinaryWrite|Clear|End|Flush|Redirect|Write|CreateObject|HTMLEncode|MapPath|URLEncode|Abandon|Convert|Regex)\\b)"
+        },
+        {
+            token: [
+                "support.function.event.asp"
+            ],
+            regex: "(?:\\b(Application_OnEnd|Application_OnStart|OnTransactionAbort|OnTransactionCommit|Session_OnEnd|Session_OnStart)\\b)"
+        },
+//        {
+//            token: [
+//                "support.type.vb.asp"
+//            ],
+//            regex: "(?:(?<=as )(\\b[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*?\\b))", // ERROR: This contains a lookbehind, which JS does not support :("
+//        },
+        {
+            token: [
+                "support.function.vb.asp"
+            ],
+            regex: "(?:\\b(Array|Add|Asc|Atn|CBool|CByte|CCur|CDate|CDbl|Chr|CInt|CLng|Conversions|Cos|CreateObject|CSng|CStr|Date|DateAdd|DateDiff|DatePart|DateSerial|DateValue|Day|Derived|Math|Escape|Eval|Exists|Exp|Filter|FormatCurrency|FormatDateTime|FormatNumber|FormatPercent|GetLocale|GetObject|GetRef|Hex|Hour|InputBox|InStr|InStrRev|Int|Fix|IsArray|IsDate|IsEmpty|IsNull|IsNumeric|IsObject|Item|Items|Join|Keys|LBound|LCase|Left|Len|LoadPicture|Log|LTrim|RTrim|Trim|Maths|Mid|Minute|Month|MonthName|MsgBox|Now|Oct|Remove|RemoveAll|Replace|RGB|Right|Rnd|Round|ScriptEngine|ScriptEngineBuildVersion|ScriptEngineMajorVersion|ScriptEngineMinorVersion|Second|SetLocale|Sgn|Sin|Space|Split|Sqr|StrComp|String|StrReverse|Tan|Time|Timer|TimeSerial|TimeValue|TypeName|UBound|UCase|Unescape|VarType|Weekday|WeekdayName|Year)\\b)"
+        },
+        {
+            token: [
+                "constant.numeric.asp"
+            ],
+            regex: "-?\\b(?:(?:0(?:x|X)[0-9a-fA-F]*)|(?:(?:[0-9]+\\.?[0-9]*)|(?:\\.[0-9]+))(?:(?:e|E)(?:\\+|-)?[0-9]+)?)(?:L|l|UL|ul|u|U|F|f)?\\b"
+        },
+        {
+            token: [
+                "support.type.vb.asp"
+            ],
+            regex: "(?:\\b(vbtrue|vbfalse|vbcr|vbcrlf|vbformfeed|vblf|vbnewline|vbnullchar|vbnullstring|int32|vbtab|vbverticaltab|vbbinarycompare|vbtextcomparevbsunday|vbmonday|vbtuesday|vbwednesday|vbthursday|vbfriday|vbsaturday|vbusesystemdayofweek|vbfirstjan1|vbfirstfourdays|vbfirstfullweek|vbgeneraldate|vblongdate|vbshortdate|vblongtime|vbshorttime|vbobjecterror|vbEmpty|vbNull|vbInteger|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant|vbDataObject|vbDecimal|vbByte|vbArray)\\b)"
+        },
+        {
+            token: [
+                "entity.name.function.asp"
+            ],
+            regex: "(?:(\\b[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*?\\b)(?=\\(\\)?))"
+        },
+//        {
+//            token: [
+//                "variable.other.asp"
+//            ],
+//            regex: "(?:((?<=(\\+|=|-|\\&|\\\\|/|<|>|\\(|,))\\s*\\b([a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*?)\\b(?!(\\(|\\.))|\\b([a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*?)\\b(?=\\s*(\\+|=|-|\\&|\\\\|/|<|>|\\(|\\)))))", // ERROR: This contains a lookbehind, which JS does not support :("
+//        },
+        {
+            token: [
+                "keyword.operator.asp"
+            ],
+            regex: "\\-|\\+|\\*\\\/|\\>|\\<|\\=|\\&"
+        }
+    ],
+    "state_3": [
+        {
+            token: [
+                "meta.odd-tab.tabs",
+                "meta.even-tab.tabs"
+            ],
+            regex: "(\\t)(\\t)?"
+        },
+        {
+            token: "meta.leading-space",
+            regex: "(?=[^\\t])",
+            next: "start"
+        },
+        {
+            token: "meta.leading-space",
+            regex: ".",
+            next: "state_3"
+        }
+    ],
+    "state_4": [
+        {
+            token: [
+                "meta.odd-tab.spaces",
+                "meta.even-tab.spaces"
+            ],
+            regex: "(  )(  )?"
+        },
+        {
+            token: "meta.leading-space",
+            regex: "(?=[^ ])",
+            next: "start"
+        },
+        {
+            token: "meta.leading-space",
+            regex: ".",
+            next: "state_4"
+        }
+    ],
+    "comment": [
+        {
+            token: "comment.line.apostrophe.asp",
+            regex: "$|(?=(?:%>))",
+            next: "start"
+        },
+        {
+            token: "comment.line.apostrophe.asp",
+            regex: "."
+        }
+    ],
+    "string": [
+        {
+            token: "constant.character.escape.apostrophe.asp",
+            regex: '""'
+        },
+        {
+            token: "string.quoted.double.asp",
+            regex: '"',
+            next: "start"
+        },
+        {
+            token: "string.quoted.double.asp",
+            regex: "."
+        }
+    ]
+}
+
+};
+
+oop.inherits(VBScriptHighlightRules, TextHighlightRules);
+
+exports.VBScriptHighlightRules = VBScriptHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/velocity.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/velocity.js b/src/fauxton/assets/js/libs/ace/mode/velocity.js
new file mode 100644
index 0000000..c76859f
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/velocity.js
@@ -0,0 +1,59 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var VelocityHighlightRules = require("./velocity_highlight_rules").VelocityHighlightRules;
+var FoldMode = require("./folding/velocity").FoldMode;
+var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour;
+
+var Mode = function() {
+    this.HighlightRules = VelocityHighlightRules;
+    this.foldingRules = new FoldMode();
+    this.$behaviour = new HtmlBehaviour();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = "##";
+    this.blockComment = {start: "#*", end: "*#"};
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/velocity_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/velocity_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/velocity_highlight_rules.js
new file mode 100644
index 0000000..506a583
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/velocity_highlight_rules.js
@@ -0,0 +1,177 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+
+var VelocityHighlightRules = function() {
+    HtmlHighlightRules.call(this);
+
+    var builtinConstants = lang.arrayToMap(
+        ('true|false|null').split('|')
+    );
+
+    var builtinFunctions = lang.arrayToMap(
+        ("_DateTool|_DisplayTool|_EscapeTool|_FieldTool|_MathTool|_NumberTool|_SerializerTool|_SortTool|_StringTool|_XPathTool").split('|')
+    );
+
+    var builtinVariables = lang.arrayToMap(
+        ('$contentRoot|$foreach').split('|')
+    );
+
+    var keywords = lang.arrayToMap(
+        ("#set|#macro|#include|#parse|" +
+        "#if|#elseif|#else|#foreach|" +
+        "#break|#end|#stop"
+        ).split('|')
+    );
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules.start.push(
+        {
+            token : "comment",
+            regex : "##.*$"
+        },{
+            token : "comment.block", // multi line comment
+            regex : "#\\*",
+            next : "vm_comment"
+        }, {
+            token : "string.regexp",
+            regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
+        }, {
+            token : "string", // single line
+            regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+        }, {
+            token : "string", // single line
+            regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+        }, {
+            token : "constant.numeric", // hex
+            regex : "0[xX][0-9a-fA-F]+\\b"
+        }, {
+            token : "constant.numeric", // float
+            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+        }, {
+            token : "constant.language.boolean",
+            regex : "(?:true|false)\\b"
+        }, {
+            token : function(value) {
+                if (keywords.hasOwnProperty(value))
+                    return "keyword";
+                else if (builtinConstants.hasOwnProperty(value))
+                    return "constant.language";
+                else if (builtinVariables.hasOwnProperty(value))
+                    return "variable.language";
+                else if (builtinFunctions.hasOwnProperty(value) || builtinFunctions.hasOwnProperty(value.substring(1)))
+                    return "support.function";
+                else if (value == "debugger")
+                    return "invalid.deprecated";
+                else
+                    if(value.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*)$/))
+                        return "variable";
+                    return "identifier";
+            },
+            // TODO: Unicode escape sequences
+            // TODO: Unicode identifiers
+            regex : "[a-zA-Z$#][a-zA-Z0-9_]*\\b"
+        }, {
+            token : "keyword.operator",
+            regex : "!|&|\\*|\\-|\\+|=|!=|<=|>=|<|>|&&|\\|\\|"
+        }, {
+            token : "lparen",
+            regex : "[[({]"
+        }, {
+            token : "rparen",
+            regex : "[\\])}]"
+        }, {
+            token : "text",
+            regex : "\\s+"
+        }
+    );
+
+    this.$rules["vm_comment"] = [
+        {
+            token : "comment", // closing comment
+            regex : "\\*#|-->",
+            next : "start"
+        }, {
+            defaultToken: "comment"
+        }
+    ];
+
+    this.$rules["vm_start"] = [
+        {
+            token: "variable",
+            regex: "}",
+            next: "pop"
+        }, {
+            token : "string.regexp",
+            regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
+        }, {
+            token : "string", // single line
+            regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+        }, {
+            token : "string", // single line
+            regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+        }, {
+            token : "constant.numeric", // hex
+            regex : "0[xX][0-9a-fA-F]+\\b"
+        }, {
+            token : "constant.numeric", // float
+            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+        }, {
+            token : "constant.language.boolean",
+            regex : "(?:true|false)\\b"
+        }, {
+            token : function(value) {
+                if (keywords.hasOwnProperty(value))
+                    return "keyword";
+                else if (builtinConstants.hasOwnProperty(value))
+                    return "constant.language";
+                else if (builtinVariables.hasOwnProperty(value))
+                    return "variable.language";
+                else if (builtinFunctions.hasOwnProperty(value) || builtinFunctions.hasOwnProperty(value.substring(1)))
+                    return "support.function";
+                else if (value == "debugger")
+                    return "invalid.deprecated";
+                else
+                    if(value.match(/^(\$[a-zA-Z_$][a-zA-Z0-9_]*)$/))
+                        return "variable";
+                    return "identifier";
+            },
+            // TODO: Unicode escape sequences
+            // TODO: Unicode identifiers
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        }, {
+            token : "keyword.operator",
+            regex : "!|&|\\*|\\-|\\+|=|!=|<=|>=|<|>|&&|\\|\\|"
+        }, {
+            token : "lparen",
+            regex : "[[({]"
+        }, {
+            token : "rparen",
+            regex : "[\\])}]"
+        }, {
+            token : "text",
+            regex : "\\s+"
+        }
+    ];
+
+    for (var i in this.$rules) {
+        this.$rules[i].unshift({
+            token: "variable",
+            regex: "\\${",
+            push: "vm_start"
+        });
+    }
+
+    this.normalizeRules();
+};
+
+oop.inherits(VelocityHighlightRules, TextHighlightRules);
+
+exports.VelocityHighlightRules = VelocityHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/verilog.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/verilog.js b/src/fauxton/assets/js/libs/ace/mode/verilog.js
new file mode 100644
index 0000000..67e9049
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/verilog.js
@@ -0,0 +1,54 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var VerilogHighlightRules = require("./verilog_highlight_rules").VerilogHighlightRules;
+var Range = require("../range").Range;
+
+var Mode = function() {
+    this.HighlightRules = VerilogHighlightRules;
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = "//";
+    this.blockComment = {start: "/*", end: "*/"};
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+
+});


[18/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/html_ruby_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/html_ruby_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/html_ruby_highlight_rules.js
new file mode 100644
index 0000000..47f113c
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/html_ruby_highlight_rules.js
@@ -0,0 +1,84 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+    "use strict";
+
+    var oop = require("../lib/oop");
+    var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+    var RubyHighlightRules = require("./ruby_highlight_rules").RubyHighlightRules;
+
+    var HtmlRubyHighlightRules = function() {
+        HtmlHighlightRules.call(this);
+
+        var startRules = [
+            {
+                regex: "<%%|%%>",
+                token: "constant.language.escape"
+            }, {
+                token : "comment.start.erb",
+                regex : "<%#",
+                push  : [{
+                    token : "comment.end.erb",
+                    regex: "%>",
+                    next: "pop",
+                    defaultToken:"comment"
+                }]
+            }, {
+                token : "support.ruby_tag",
+                regex : "<%+(?!>)[-=]?",
+                push  : "ruby-start"
+            }
+        ];
+
+        var endRules = [
+            {
+                token : "support.ruby_tag",
+                regex : "%>",
+                next  : "pop"
+            }, {
+                token: "comment",
+                regex: "#(?:[^%]|%[^>])*"
+            }
+        ];
+
+        for (var key in this.$rules)
+            this.$rules[key].unshift.apply(this.$rules[key], startRules);
+
+        this.embedRules(RubyHighlightRules, "ruby-", endRules, ["start"]);
+
+        this.normalizeRules();
+    };
+
+
+    oop.inherits(HtmlRubyHighlightRules, HtmlHighlightRules);
+
+    exports.HtmlRubyHighlightRules = HtmlRubyHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/html_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/html_test.js b/src/fauxton/assets/js/libs/ace/mode/html_test.js
new file mode 100644
index 0000000..1649d01
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/html_test.js
@@ -0,0 +1,67 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("../edit_session").EditSession;
+var Range = require("../range").Range;
+var HtmlMode = require("./html").Mode;
+var assert = require("../test/assertions");
+
+module.exports = {
+    setUp : function() {    
+        this.mode = new HtmlMode();
+    },
+
+    "test: toggle comment lines" : function() {
+        var session = new EditSession(["  abc", "", "fg"]);
+
+        var range = new Range(0, 3, 1, 1);
+        var comment = this.mode.toggleCommentLines("start", session, 0, 1);
+        assert.equal(["  <!--abc-->", "", "fg"].join("\n"), session.toString());
+    },
+
+    "test: next line indent should be the same as the current line indent" : function() {
+        assert.equal("     ", this.mode.getNextLineIndent("start", "     abc"));
+        assert.equal("", this.mode.getNextLineIndent("start", "abc"));
+        assert.equal("\t", this.mode.getNextLineIndent("start", "\tabc"));
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/ini.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/ini.js b/src/fauxton/assets/js/libs/ace/mode/ini.js
new file mode 100644
index 0000000..f5eae3a
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/ini.js
@@ -0,0 +1,53 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var IniHighlightRules = require("./ini_highlight_rules").IniHighlightRules;
+// TODO: pick appropriate fold mode
+var FoldMode = require("./folding/ini").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = IniHighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = ";";
+    this.blockComment = {start: "/*", end: "*/"};
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/ini_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/ini_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/ini_highlight_rules.js
new file mode 100644
index 0000000..8ce3d94
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/ini_highlight_rules.js
@@ -0,0 +1,112 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* This file was autogenerated from tool\tm bundles\ini.tmbundle\Syntaxes\Ini.plist (uuid: ) */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var escapeRe = "\\\\(?:[\\\\0abtrn;#=:]|x[a-fA-F\\d]{4})";
+
+var IniHighlightRules = function() {
+    this.$rules = {
+        start: [{
+            token: 'punctuation.definition.comment.ini',
+            regex: '#.*',
+            push_: [{
+                token: 'comment.line.number-sign.ini',
+                regex: '$|^',
+                next: 'pop'
+            }, {
+                defaultToken: 'comment.line.number-sign.ini'
+            }]
+        }, {
+            token: 'punctuation.definition.comment.ini',
+            regex: ';.*',
+            push_: [{
+                token: 'comment.line.semicolon.ini',
+                regex: '$|^',
+                next: 'pop'
+            }, {
+                defaultToken: 'comment.line.semicolon.ini'
+            }]
+        }, {
+            token: ['keyword.other.definition.ini', 'text', 'punctuation.separator.key-value.ini'],
+            regex: '\\b([a-zA-Z0-9_.-]+)\\b(\\s*)(=)'
+        }, {
+            token: ['punctuation.definition.entity.ini', 'constant.section.group-title.ini', 'punctuation.definition.entity.ini'],
+            regex: '^(\\[)(.*?)(\\])'
+        }, {
+            token: 'punctuation.definition.string.begin.ini',
+            regex: "'",
+            push: [{
+                token: 'punctuation.definition.string.end.ini',
+                regex: "'",
+                next: 'pop'
+            }, {
+                token: "constant.language.escape",
+                regex: escapeRe
+            }, {
+                defaultToken: 'string.quoted.single.ini'
+            }]
+        }, {
+            token: 'punctuation.definition.string.begin.ini',
+            regex: '"',
+            push: [{
+                token: "constant.language.escape",
+                regex: escapeRe
+            }, {
+                token: 'punctuation.definition.string.end.ini',
+                regex: '"',
+                next: 'pop'
+            }, {
+                defaultToken: 'string.quoted.double.ini'
+            }]
+        }]
+    };
+
+    this.normalizeRules();
+};
+
+IniHighlightRules.metaData = {
+    fileTypes: ['ini', 'conf'],
+    keyEquivalent: '^~I',
+    name: 'Ini',
+    scopeName: 'source.ini'
+};
+
+
+oop.inherits(IniHighlightRules, TextHighlightRules);
+
+exports.IniHighlightRules = IniHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/jack.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/jack.js b/src/fauxton/assets/js/libs/ace/mode/jack.js
new file mode 100644
index 0000000..1ea02c2
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/jack.js
@@ -0,0 +1,79 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var HighlightRules = require("./jack_highlight_rules").JackHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = HighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new CstyleBehaviour();
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = "--";
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        if (state == "start") {
+            var match = line.match(/^.*[\{\(\[]\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/jack_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/jack_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/jack_highlight_rules.js
new file mode 100644
index 0000000..edf7c85
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/jack_highlight_rules.js
@@ -0,0 +1,142 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var JackHighlightRules = function() {
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+    this.$rules = {
+        "start" : [
+            {
+                token : "string",
+                regex : '"',
+                next  : "string2"
+            }, {
+                token : "string",
+                regex : "'",
+                next  : "string1"
+            }, {
+                token : "constant.numeric", // hex
+                regex: "-?0[xX][0-9a-fA-F]+\\b"
+            }, {
+                token : "constant.numeric", // float
+                regex : "(?:0|[-+]?[1-9][0-9]*)\\b"
+            }, {
+                token : "constant.binary",
+                regex : "<[0-9A-Fa-f][0-9A-Fa-f](\\s+[0-9A-Fa-f][0-9A-Fa-f])*>"
+            }, {
+                token : "constant.language.boolean",
+                regex : "(?:true|false)\\b"
+            }, {
+                token : "constant.language.null",
+                regex : "null\\b"
+            }, {
+                token : "storage.type",
+                regex: "(?:Integer|Boolean|Null|String|Buffer|Tuple|List|Object|Function|Coroutine|Form)\\b"
+            }, {
+                token : "keyword",
+                regex : "(?:return|abort|vars|for|delete|in|is|escape|exec|split|and|if|elif|else|while)\\b"
+            }, {
+                token : "language.builtin",
+                regex : "(?:lines|source|parse|read-stream|interval|substr|parseint|write|print|range|rand|inspect|bind|i-values|i-pairs|i-map|i-filter|i-chunk|i-all\\?|i-any\\?|i-collect|i-zip|i-merge|i-each)\\b"
+            }, {
+                token : "comment",
+                regex : "--.*$"
+            }, {
+                token : "paren.lparen",
+                regex : "[[({]"
+            }, {
+                token : "paren.rparen",
+                regex : "[\\])}]"
+            }, {
+                token : "storage.form",
+                regex : "@[a-z]+"
+            }, {
+                token : "constant.other.symbol",
+                regex : ':+[a-zA-Z_]([-]?[a-zA-Z0-9_])*[?!]?'
+            }, {
+                token : "variable",
+                regex : '[a-zA-Z_]([-]?[a-zA-Z0-9_])*[?!]?'
+            }, {
+                token : "keyword.operator",
+                regex : "\\|\\||\\^\\^|&&|!=|==|<=|<|>=|>|\\+|-|\\*|\\/|\\^|\\%|\\#|\\!"
+            }, {
+                token : "text",
+                regex : "\\s+"
+            }
+        ],
+        "string1" : [
+            {
+                token : "constant.language.escape",
+                regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|['"\\\/bfnrt])/
+            }, {
+                token : "string",
+                regex : "[^'\\\\]+"
+            }, {
+                token : "string",
+                regex : "'",
+                next  : "start"
+            }, {
+                token : "string",
+                regex : "",
+                next  : "start"
+            }
+        ],
+        "string2" : [
+            {
+                token : "constant.language.escape",
+                regex : /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|['"\\\/bfnrt])/
+            }, {
+                token : "string",
+                regex : '[^"\\\\]+'
+            }, {
+                token : "string",
+                regex : '"',
+                next  : "start"
+            }, {
+                token : "string",
+                regex : "",
+                next  : "start"
+            }
+        ]
+    };
+    
+};
+
+oop.inherits(JackHighlightRules, TextHighlightRules);
+
+exports.JackHighlightRules = JackHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/jade.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/jade.js b/src/fauxton/assets/js/libs/ace/mode/jade.js
new file mode 100644
index 0000000..7402563
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/jade.js
@@ -0,0 +1,57 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ * 
+ * Garen J. Torikian <gjtorikian @ gmail DOT com>
+ *
+ * ***** END LICENSE BLOCK ***** */
+ 
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var JadeHighlightRules = require("./jade_highlight_rules").JadeHighlightRules;
+var FoldMode = require("./folding/coffee").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = JadeHighlightRules;
+    
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() { 
+	this.lineCommentStart = "//";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/jade_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/jade_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/jade_highlight_rules.js
new file mode 100644
index 0000000..c46c0be
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/jade_highlight_rules.js
@@ -0,0 +1,341 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ * 
+ * Garen J. Torikian <gjtorikian @ gmail DOT com>
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode_highlight_rules.tmpl.js (UUID: C5B73B98-5F2A-42E3-9F0E-028A74A9FE4B)
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var MarkdownHighlightRules = require("./markdown_highlight_rules").MarkdownHighlightRules;
+var SassHighlightRules = require("./scss_highlight_rules").ScssHighlightRules;
+var LessHighlightRules = require("./less_highlight_rules").LessHighlightRules;
+var CoffeeHighlightRules = require("./coffee_highlight_rules").CoffeeHighlightRules;
+var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
+
+function mixin_embed(tag, prefix) {
+    return { 
+        token : "entity.name.function.jade",
+        regex : "^\\s*\\:" + tag,
+        next  : prefix + "start"
+    };
+}
+
+var JadeHighlightRules = function() {
+
+    var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
+        "u[0-9a-fA-F]{4}|" + // unicode
+        "[0-2][0-7]{0,2}|" + // oct
+        "3[0-6][0-7]?|" + // oct
+        "37[0-7]?|" + // oct
+        "[4-7][0-7]?|" + //oct
+        ".)";
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = 
+        {
+    "start": [
+        {
+            token: "keyword.control.import.include.jade",
+            regex: "\\s*\\binclude\\b"
+        },
+        {
+            token: "keyword.other.doctype.jade",
+            regex: "^!!!\\s*(?:[a-zA-Z0-9-_]+)?"
+        },
+        {
+            token : "punctuation.section.comment",
+            regex : "^\\s*\/\/(?:\\s*[^-\\s]|\\s+\\S)(?:.*$)"
+        },
+        {
+            onMatch: function(value, currentState, stack) {
+                stack.unshift(this.next, value.length - 2, currentState);
+                return "comment";
+            },
+            regex: /^\s*\/\//,
+            next: "comment_block"
+        },
+        mixin_embed("markdown", "markdown-"),
+        mixin_embed("sass", "sass-"),
+        mixin_embed("less", "less-"),
+        mixin_embed("coffee", "coffee-"),
+        /*
+        {
+            token: {
+                "2": {
+                    "name": "entity.name.function.jade"
+                }
+            },
+            regex: "^(\\s*)(\\:cdata)",
+            next: "state_9"
+        },*/
+        // match stuff like: mixin dialog-title-desc(title, desc)
+        {
+            token: [ "storage.type.function.jade",
+                       "entity.name.function.jade",
+                       "punctuation.definition.parameters.begin.jade",
+                       "variable.parameter.function.jade",
+                       "punctuation.definition.parameters.end.jade"
+                    ],
+            regex: "^(\\s*mixin)( [\\w\\-]+)(\\s*\\()(.*?)(\\))"
+        },
+        // match stuff like: mixin dialog-title-desc
+        {
+            token: [ "storage.type.function.jade", "entity.name.function.jade"],
+            regex: "^(\\s*mixin)( [\\w\\-]+)"
+        },
+        {
+            token: "source.js.embedded.jade",
+            regex: "^\\s*(?:-|=|!=)",
+            next: "js-start"
+        },
+        /*{
+            token: "entity.name.tag.script.jade",
+            regex: "^\\s*script",
+            next: "js_code_tag"
+        },*/
+        {
+            token: "string.interpolated.jade",
+            regex: "[#!]\\{[^\\}]+\\}"
+        },
+        // Match any tag, id or class. skip AST filters
+        {
+            token: "meta.tag.any.jade",
+            regex: /^\s*(?!\w+\:)(?:[\w]+|(?=\.|#)])/,
+            next: "tag_single"
+        },
+        {
+            token: "suport.type.attribute.id.jade",
+            regex: "#\\w+"
+        },
+        {
+            token: "suport.type.attribute.class.jade",
+            regex: "\\.\\w+"
+        },
+        {
+            token: "punctuation",
+            regex: "\\s*(?:\\()",
+            next: "tag_attributes"
+        }
+    ],
+    "comment_block": [
+        {regex: /^\s*/, onMatch: function(value, currentState, stack) {
+            if (value.length <= stack[1]) {
+                stack.shift();
+                stack.shift();
+                this.next = stack.shift();
+                return "text";
+            } else {
+                this.next = "";
+                return "comment";
+            }
+        }, next: "start"},
+        {defaultToken: "comment"}
+    ],
+    /*
+    
+    "state_9": [
+        {
+            token: "TODO",
+            regex: "^(?!\\1\\s+)",
+            next: "start"
+        },
+        {
+            token: "TODO",
+            regex: ".+",
+            next: "state_9"
+        }
+    ],*/
+    /*"js_code": [
+        {
+            token: "keyword.control.js",
+            regex: "\\beach\\b"
+        },
+        {
+            token: "text",
+            regex: "$",
+            next: "start"
+        }
+    ],*/
+    /*"js_code_tag": [
+        {
+            "include": "source.js"
+        },
+        {
+            token: "TODO",
+            regex: "^((?=(\\1)([\\w#\\.]|$\\n?))|^$\\n?)",
+            next: "start"
+        }
+    ],*/
+    "tag_single": [
+        {
+            token: "entity.other.attribute-name.class.jade",
+            regex: "\\.[\\w-]+"
+        },
+        {
+            token: "entity.other.attribute-name.id.jade",
+            regex: "#[\\w-]+"
+        },
+        {
+            token: ["text", "punctuation"],
+            regex: "($)|((?!\\.|#|=|-))",
+            next: "start"
+        }
+    ],
+    "tag_attributes": [ 
+        {
+            token : "string",
+            regex : "'(?=.)",
+            next  : "qstring"
+        }, 
+        {
+            token : "string",
+            regex : '"(?=.)',
+            next  : "qqstring"
+        },
+        {
+            token: "entity.other.attribute-name.jade",
+            regex: "\\b[a-zA-Z\\-:]+"
+        },
+        {
+            token: ["entity.other.attribute-name.jade", "punctuation"],
+            regex: "\\b([a-zA-Z:\\.-]+)(=)",
+            next: "attribute_strings"
+        },
+        {
+            token: "punctuation",
+            regex: "\\)",
+            next: "start"
+        }
+    ],
+    "attribute_strings": [
+        {
+            token : "string",
+            regex : "'(?=.)",
+            next  : "qstring"
+        }, 
+        {
+            token : "string",
+            regex : '"(?=.)',
+            next  : "qqstring"
+        }
+    ],
+    "qqstring" : [
+        {
+            token : "constant.language.escape",
+            regex : escapedRe
+        }, {
+            token : "string",
+            regex : '[^"\\\\]+'
+        }, {
+            token : "string",
+            regex : "\\\\$",
+            next  : "qqstring"
+        }, {
+            token : "string",
+            regex : '"|$',
+            next  : "tag_attributes"
+        }
+    ],
+    "qstring" : [
+        {
+            token : "constant.language.escape",
+            regex : escapedRe
+        }, {
+            token : "string",
+            regex : "[^'\\\\]+"
+        }, {
+            token : "string",
+            regex : "\\\\$",
+            next  : "qstring"
+        }, {
+            token : "string",
+            regex : "'|$",
+            next  : "tag_attributes"
+        }
+    ]
+};
+
+    this.embedRules(JavaScriptHighlightRules, "js-", [{
+        token: "text",
+        regex: ".$",
+        next: "start"
+    }]);
+/*
+    this.embedRules(MarkdownHighlightRules, "markdown-", [{
+       token : "support.function",
+       regex : "^\\1\\s+",
+       captures: "1",
+       next  : "start"
+    }]);
+
+    this.embedRules(SassHighlightRules, "sass-", [{
+       token : "support.function",
+       regex : "^(?!\\1\\s+)",
+       captures: "1",
+       next  : "start"
+    }]);
+
+    this.embedRules(LessHighlightRules, "less-", [{
+       token : "support.function",
+       regex : "^(?!\\1\\s+)",
+       captures: "1",
+       next  : "start"
+    }]);
+
+    this.embedRules(CoffeeHighlightRules, "coffee-", [{
+       token : "support.function",
+       regex : "^(?!\\1\\s+)",
+       captures: "1",
+       next  : "start"
+    }]);
+
+    this.embedRules(JavaScriptHighlightRules, "js-", [{
+       token : "support.function",
+       regex : "$",
+       captures: "1",
+       next  : "start"
+    }]); */
+};
+
+oop.inherits(JadeHighlightRules, TextHighlightRules);
+
+exports.JadeHighlightRules = JadeHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/java.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/java.js b/src/fauxton/assets/js/libs/ace/mode/java.js
new file mode 100644
index 0000000..8d37e00
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/java.js
@@ -0,0 +1,24 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var JavaScriptMode = require("./javascript").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var JavaHighlightRules = require("./java_highlight_rules").JavaHighlightRules;
+
+var Mode = function() {
+    JavaScriptMode.call(this);
+    this.HighlightRules = JavaHighlightRules;
+};
+oop.inherits(Mode, JavaScriptMode);
+
+(function() {
+    
+    this.createWorker = function(session) {
+        return null;
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/java_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/java_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/java_highlight_rules.js
new file mode 100644
index 0000000..8cba835
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/java_highlight_rules.js
@@ -0,0 +1,131 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var JavaHighlightRules = function() {
+
+    // taken from http://download.oracle.com/javase/tutorial/java/nutsandbolts/_keywords.html
+    var keywords = (
+    "abstract|continue|for|new|switch|" +
+    "assert|default|goto|package|synchronized|" +
+    "boolean|do|if|private|this|" +
+    "break|double|implements|protected|throw|" +
+    "byte|else|import|public|throws|" +
+    "case|enum|instanceof|return|transient|" +
+    "catch|extends|int|short|try|" +
+    "char|final|interface|static|void|" +
+    "class|finally|long|strictfp|volatile|" +
+    "const|float|native|super|while"
+    );
+
+    var buildinConstants = ("null|Infinity|NaN|undefined");
+
+
+    var langClasses = (
+        "AbstractMethodError|AssertionError|ClassCircularityError|"+
+        "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+
+        "ExceptionInInitializerError|IllegalAccessError|"+
+        "IllegalThreadStateException|InstantiationError|InternalError|"+
+        "NegativeArraySizeException|NoSuchFieldError|Override|Process|"+
+        "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+
+        "SuppressWarnings|TypeNotPresentException|UnknownError|"+
+        "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+
+        "InstantiationException|IndexOutOfBoundsException|"+
+        "ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+
+        "NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+
+        "SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+
+        "InterruptedException|NoSuchMethodException|IllegalAccessException|"+
+        "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+
+        "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+
+        "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+
+        "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+
+        "Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+
+        "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+
+        "StackOverflowError|OutOfMemoryError|VirtualMachineError|"+
+        "ArrayStoreException|ClassCastException|LinkageError|"+
+        "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+
+        "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+
+        "Cloneable|Class|CharSequence|Comparable|String|Object"
+    );
+
+    var keywordMapper = this.createKeywordMapper({
+        "variable.language": "this",
+        "keyword": keywords,
+        "constant.language": buildinConstants,
+        "support.function": langClasses
+    }, "identifier");
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "start" : [
+            {
+                token : "comment",
+                regex : "\\/\\/.*$"
+            },
+            DocCommentHighlightRules.getStartRule("doc-start"),
+            {
+                token : "comment", // multi line comment
+                regex : "\\/\\*",
+                next : "comment"
+            }, {
+                token : "string.regexp",
+                regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
+            }, {
+                token : "string", // single line
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+            }, {
+                token : "string", // single line
+                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+            }, {
+                token : "constant.numeric", // hex
+                regex : "0[xX][0-9a-fA-F]+\\b"
+            }, {
+                token : "constant.numeric", // float
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+            }, {
+                token : "constant.language.boolean",
+                regex : "(?:true|false)\\b"
+            }, {
+                token : keywordMapper,
+                // TODO: Unicode escape sequences
+                // TODO: Unicode identifiers
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+            }, {
+                token : "keyword.operator",
+                regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
+            }, {
+                token : "lparen",
+                regex : "[[({]"
+            }, {
+                token : "rparen",
+                regex : "[\\])}]"
+            }, {
+                token : "text",
+                regex : "\\s+"
+            }
+        ],
+        "comment" : [
+            {
+                token : "comment", // closing comment
+                regex : ".*?\\*\\/",
+                next : "start"
+            }, {
+                token : "comment", // comment spanning whole line
+                regex : ".+"
+            }
+        ]
+    };
+
+    this.embedRules(DocCommentHighlightRules, "doc-",
+        [ DocCommentHighlightRules.getEndRule("start") ]);
+};
+
+oop.inherits(JavaHighlightRules, TextHighlightRules);
+
+exports.JavaHighlightRules = JavaHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/javascript.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/javascript.js b/src/fauxton/assets/js/libs/ace/mode/javascript.js
new file mode 100644
index 0000000..7bfce44
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/javascript.js
@@ -0,0 +1,116 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var Range = require("../range").Range;
+var WorkerClient = require("../worker/worker_client").WorkerClient;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = JavaScriptHighlightRules;
+    
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new CstyleBehaviour();
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = "//";
+    this.blockComment = {start: "/*", end: "*/"};
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+        var endState = tokenizedLine.state;
+
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+
+        if (state == "start" || state == "no_regex") {
+            var match = line.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        } else if (state == "doc-start") {
+            if (endState == "start" || endState == "no_regex") {
+                return "";
+            }
+            var match = line.match(/^\s*(\/?)\*/);
+            if (match) {
+                if (match[1]) {
+                    indent += " ";
+                }
+                indent += "* ";
+            }
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+    this.createWorker = function(session) {
+        var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
+        worker.attachToDocument(session.getDocument());
+
+        worker.on("jslint", function(results) {
+            session.setAnnotations(results.data);
+        });
+
+        worker.on("terminate", function() {
+            session.clearAnnotations();
+        });
+
+        return worker;
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});


[14/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/lsl_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/lsl_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/lsl_highlight_rules.js
new file mode 100644
index 0000000..752abc2
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/lsl_highlight_rules.js
@@ -0,0 +1,363 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2013, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+oop.inherits(LSLHighlightRules, TextHighlightRules);
+
+function LSLHighlightRules() {
+    var keywordMapper = this.createKeywordMapper({
+        "constant.language.float.lsl" : "DEG_TO_RAD|PI|PI_BY_TWO|RAD_TO_DEG|SQRT2|TWO_PI",
+        "constant.language.integer.lsl": "ACTIVE|AGENT|AGENT_ALWAYS_RUN|AGENT_ATTACHMENTS|" +
+            "AGENT_AUTOPILOT|AGENT_AWAY|AGENT_BUSY|AGENT_BY_LEGACY_NAME|AGENT_BY_USERNAME|" +
+            "AGENT_CROUCHING|AGENT_FLYING|AGENT_IN_AIR|AGENT_LIST_PARCEL|AGENT_LIST_PARCEL_OWNER|" +
+            "AGENT_LIST_REGION|AGENT_MOUSELOOK|AGENT_ON_OBJECT|AGENT_SCRIPTED|AGENT_SITTING|" +
+            "AGENT_TYPING|AGENT_WALKING|ALL_SIDES|ANIM_ON|ATTACH_AVATAR_CENTER|ATTACH_BACK|" +
+            "ATTACH_BELLY|ATTACH_CHEST|ATTACH_CHIN|ATTACH_HEAD|ATTACH_HUD_BOTTOM|" +
+            "ATTACH_HUD_BOTTOM_LEFT|ATTACH_HUD_BOTTOM_RIGHT|ATTACH_HUD_CENTER_1|ATTACH_HUD_CENTER_2|" +
+            "ATTACH_HUD_TOP_CENTER|ATTACH_HUD_TOP_LEFT|ATTACH_HUD_TOP_RIGHT|ATTACH_LEAR|" +
+            "ATTACH_LEFT_PEC|ATTACH_LEYE|ATTACH_LFOOT|ATTACH_LHAND|ATTACH_LHIP|ATTACH_LLARM|" +
+            "ATTACH_LLLEG|ATTACH_LSHOULDER|ATTACH_LUARM|ATTACH_LULEG|ATTACH_MOUTH|" +
+            "ATTACH_NECK|ATTACH_NOSE|ATTACH_PELVIS|ATTACH_REAR|ATTACH_REYE|ATTACH_RFOOT|" +
+            "ATTACH_RHAND|ATTACH_RHIP|ATTACH_RIGHT_PEC|ATTACH_RLARM|ATTACH_RLLEG|" +
+            "ATTACH_RSHOULDER|ATTACH_RUARM|ATTACH_RULEG|AVOID_CHARACTERS|AVOID_DYNAMIC_OBSTACLES|" +
+            "AVOID_NONE|CAMERA_ACTIVE|CAMERA_BEHINDNESS_ANGLE|CAMERA_BEHINDNESS_LAG|" +
+            "CAMERA_DISTANCE|CAMERA_FOCUS|CAMERA_FOCUS_LAG|CAMERA_FOCUS_LOCKED|CAMERA_FOCUS_OFFSET|" +
+            "CAMERA_FOCUS_THRESHOLD|CAMERA_PITCH|CAMERA_POSITION|CAMERA_POSITION_LAG|" +
+            "CAMERA_POSITION_LOCKED|CAMERA_POSITION_THRESHOLD|CHANGED_ALLOWED_DROP|" +
+            "CHANGED_COLOR|CHANGED_INVENTORY|CHANGED_LINK|CHANGED_MEDIA|CHANGED_OWNER|" +
+            "CHANGED_REGION|CHANGED_REGION_START|CHANGED_SCALE|CHANGED_SHAPE|CHANGED_TELEPORT|" +
+            "CHANGED_TEXTURE|CHARACTER_ACCOUNT_FOR_SKIPPED_FRAMES|CHARACTER_AVOIDANCE_MODE|" +
+            "CHARACTER_CMD_JUMP|CHARACTER_CMD_SMOOTH_STOP|CHARACTER_CMD_STOP|CHARACTER_DESIRED_SPEED|" +
+            "CHARACTER_DESIRED_TURN_SPEED|CHARACTER_LENGTH|CHARACTER_MAX_ACCEL|CHARACTER_MAX_DECEL|" +
+            "CHARACTER_MAX_SPEED|CHARACTER_MAX_TURN_RADIUS|CHARACTER_ORIENTATION|" +
+            "CHARACTER_RADIUS|CHARACTER_STAY_WITHIN_PARCEL|CHARACTER_TYPE|CHARACTER_TYPE_A|" +
+            "CHARACTER_TYPE_B|CHARACTER_TYPE_C|CHARACTER_TYPE_D|CHARACTER_TYPE_NONE|" +
+            "CLICK_ACTION_BUY|CLICK_ACTION_NONE|CLICK_ACTION_OPEN|CLICK_ACTION_OPEN_MEDIA|" +
+            "CLICK_ACTION_PAY|CLICK_ACTION_PLAY|CLICK_ACTION_SIT|CLICK_ACTION_TOUCH|" +
+            "CONTENT_TYPE_ATOM|CONTENT_TYPE_FORM|CONTENT_TYPE_HTML|CONTENT_TYPE_JSON|" +
+            "CONTENT_TYPE_LLSD|CONTENT_TYPE_RSS|CONTENT_TYPE_TEXT|CONTENT_TYPE_XHTML|" +
+            "CONTENT_TYPE_XML|CONTROL_BACK|CONTROL_DOWN|CONTROL_FWD|CONTROL_LBUTTON|" +
+            "CONTROL_LEFT|CONTROL_ML_LBUTTON|CONTROL_RIGHT|CONTROL_ROT_LEFT|CONTROL_ROT_RIGHT|" +
+            "CONTROL_UP|DATA_BORN|DATA_NAME|DATA_ONLINE|DATA_PAYINFO|DATA_SIM_POS|" +
+            "DATA_SIM_RATING|DATA_SIM_STATUS|DEBUG_CHANNEL|DENSITY|ERR_GENERIC|ERR_MALFORMED_PARAMS|" +
+            "ERR_PARCEL_PERMISSIONS|ERR_RUNTIME_PERMISSIONS|ERR_THROTTLED|ESTATE_ACCESS_ALLOWED_AGENT_ADD|" +
+            "ESTATE_ACCESS_ALLOWED_AGENT_REMOVE|ESTATE_ACCESS_ALLOWED_GROUP_ADD|ESTATE_ACCESS_ALLOWED_GROUP_REMOVE|" +
+            "ESTATE_ACCESS_BANNED_AGENT_ADD|ESTATE_ACCESS_BANNED_AGENT_REMOVE|FORCE_DIRECT_PATH|" +
+            "FRICTION|GCNP_RADIUS|GCNP_STATIC|GRAVITY_MULTIPLIER|HORIZONTAL|HTTP_BODY_MAXLENGTH|" +
+            "HTTP_BODY_TRUNCATED|HTTP_CUSTOM_HEADER|HTTP_METHOD|HTTP_MIMETYPE|HTTP_PRAGMA_NO_CACHE|" +
+            "HTTP_VERBOSE_THROTTLE|HTTP_VERIFY_CERT|INVENTORY_ALL|INVENTORY_ANIMATION|" +
+            "INVENTORY_BODYPART|INVENTORY_CLOTHING|INVENTORY_GESTURE|INVENTORY_LANDMARK|" +
+            "INVENTORY_NONE|INVENTORY_NOTECARD|INVENTORY_OBJECT|INVENTORY_SCRIPT|" +
+            "INVENTORY_SOUND|INVENTORY_TEXTURE|JSON_APPEND|KFM_CMD_PAUSE|KFM_CMD_PLAY|" +
+            "KFM_CMD_SET_MODE|KFM_CMD_STOP|KFM_COMMAND|KFM_DATA|KFM_FORWARD|KFM_LOOP|" +
+            "KFM_MODE|KFM_PING_PONG|KFM_REVERSE|KFM_ROTATION|KFM_TRANSLATION|LAND_LEVEL|" +
+            "LAND_LOWER|LAND_NOISE|LAND_RAISE|LAND_REVERT|LAND_SMOOTH|LINK_ALL_CHILDREN|" +
+            "LINK_ALL_OTHERS|LINK_ROOT|LINK_SET|LINK_THIS|LIST_STAT_GEOMETRIC_MEAN|" +
+            "LIST_STAT_MAX|LIST_STAT_MEAN|LIST_STAT_MEDIAN|LIST_STAT_MIN|LIST_STAT_NUM_COUNT|" +
+            "LIST_STAT_RANGE|LIST_STAT_STD_DEV|LIST_STAT_SUM|LIST_STAT_SUM_SQUARES|" +
+            "LOOP|MASK_BASE|MASK_EVERYONE|MASK_GROUP|MASK_NEXT|MASK_OWNER|OBJECT_ATTACHED_POINT|" +
+            "OBJECT_CHARACTER_TIME|OBJECT_CREATOR|OBJECT_DESC|OBJECT_GROUP|OBJECT_NAME|" +
+            "OBJECT_OWNER|OBJECT_PATHFINDING_TYPE|OBJECT_PHANTOM|OBJECT_PHYSICS|OBJECT_PHYSICS_COST|" +
+            "OBJECT_POS|OBJECT_PRIM_EQUIVALENCE|OBJECT_RETURN_PARCEL|OBJECT_RETURN_PARCEL_OWNER|" +
+            "OBJECT_RETURN_REGION|OBJECT_ROOT|OBJECT_ROT|OBJECT_RUNNING_SCRIPT_COUNT|" +
+            "OBJECT_SCRIPT_MEMORY|OBJECT_SCRIPT_TIME|OBJECT_SERVER_COST|OBJECT_STREAMING_COST|" +
+            "OBJECT_TEMP_ON_REZ|OBJECT_TOTAL_SCRIPT_COUNT|OBJECT_UNKNOWN_DETAIL|OBJECT_VELOCITY|" +
+            "OPT_AVATAR|OPT_CHARACTER|OPT_EXCLUSION_VOLUME|OPT_LEGACY_LINKSET|OPT_MATERIAL_VOLUME|" +
+            "OPT_OTHER|OPT_STATIC_OBSTACLE|OPT_WALKABLE|PARCEL_COUNT_GROUP|PARCEL_COUNT_OTHER|" +
+            "PARCEL_COUNT_OWNER|PARCEL_COUNT_SELECTED|PARCEL_COUNT_TEMP|PARCEL_COUNT_TOTAL|" +
+            "PARCEL_DETAILS_AREA|PARCEL_DETAILS_DESC|PARCEL_DETAILS_GROUP|PARCEL_DETAILS_ID|" +
+            "PARCEL_DETAILS_NAME|PARCEL_DETAILS_OWNER|PARCEL_DETAILS_SEE_AVATARS|" +
+            "PARCEL_FLAG_ALLOW_ALL_OBJECT_ENTRY|PARCEL_FLAG_ALLOW_CREATE_GROUP_OBJECTS|" +
+            "PARCEL_FLAG_ALLOW_CREATE_OBJECTS|PARCEL_FLAG_ALLOW_DAMAGE|PARCEL_FLAG_ALLOW_FLY|" +
+            "PARCEL_FLAG_ALLOW_GROUP_OBJECT_ENTRY|PARCEL_FLAG_ALLOW_GROUP_SCRIPTS|" +
+            "PARCEL_FLAG_ALLOW_LANDMARK|PARCEL_FLAG_ALLOW_SCRIPTS|PARCEL_FLAG_ALLOW_TERRAFORM|" +
+            "PARCEL_FLAG_LOCAL_SOUND_ONLY|PARCEL_FLAG_RESTRICT_PUSHOBJECT|PARCEL_FLAG_USE_ACCESS_GROUP|" +
+            "PARCEL_FLAG_USE_ACCESS_LIST|PARCEL_FLAG_USE_BAN_LIST|PARCEL_FLAG_USE_LAND_PASS_LIST|" +
+            "PARCEL_MEDIA_COMMAND_AGENT|PARCEL_MEDIA_COMMAND_AUTO_ALIGN|PARCEL_MEDIA_COMMAND_DESC|" +
+            "PARCEL_MEDIA_COMMAND_LOOP|PARCEL_MEDIA_COMMAND_LOOP_SET|PARCEL_MEDIA_COMMAND_PAUSE|" +
+            "PARCEL_MEDIA_COMMAND_PLAY|PARCEL_MEDIA_COMMAND_SIZE|PARCEL_MEDIA_COMMAND_STOP|" +
+            "PARCEL_MEDIA_COMMAND_TEXTURE|PARCEL_MEDIA_COMMAND_TIME|PARCEL_MEDIA_COMMAND_TYPE|" +
+            "PARCEL_MEDIA_COMMAND_UNLOAD|PARCEL_MEDIA_COMMAND_URL|PASSIVE|PATROL_PAUSE_AT_WAYPOINTS|" +
+            "PAY_DEFAULT|PAY_HIDE|PAYMENT_INFO_ON_FILE|PAYMENT_INFO_USED|PERM_ALL|" +
+            "PERM_COPY|PERM_MODIFY|PERM_MOVE|PERM_TRANSFER|PERMISSION_ATTACH|PERMISSION_CHANGE_LINKS|" +
+            "PERMISSION_CONTROL_CAMERA|PERMISSION_DEBIT|PERMISSION_OVERRIDE_ANIMATIONS|" +
+            "PERMISSION_RETURN_OBJECTS|PERMISSION_SILENT_ESTATE_MANAGEMENT|PERMISSION_TAKE_CONTROLS|" +
+            "PERMISSION_TELEPORT|PERMISSION_TRACK_CAMERA|PERMISSION_TRIGGER_ANIMATION|" +
+            "PING_PONG|PRIM_BUMP_BARK|PRIM_BUMP_BLOBS|PRIM_BUMP_BRICKS|PRIM_BUMP_BRIGHT|" +
+            "PRIM_BUMP_CHECKER|PRIM_BUMP_CONCRETE|PRIM_BUMP_DARK|PRIM_BUMP_DISKS|" +
+            "PRIM_BUMP_GRAVEL|PRIM_BUMP_LARGETILE|PRIM_BUMP_NONE|PRIM_BUMP_SHINY|" +
+            "PRIM_BUMP_SIDING|PRIM_BUMP_STONE|PRIM_BUMP_STUCCO|PRIM_BUMP_SUCTION|" +
+            "PRIM_BUMP_TILE|PRIM_BUMP_WEAVE|PRIM_BUMP_WOOD|PRIM_COLOR|PRIM_DESC|PRIM_FLEXIBLE|" +
+            "PRIM_FULLBRIGHT|PRIM_GLOW|PRIM_HOLE_CIRCLE|PRIM_HOLE_DEFAULT|PRIM_HOLE_SQUARE|" +
+            "PRIM_HOLE_TRIANGLE|PRIM_LINK_TARGET|PRIM_MATERIAL|PRIM_MATERIAL_FLESH|" +
+            "PRIM_MATERIAL_GLASS|PRIM_MATERIAL_METAL|PRIM_MATERIAL_PLASTIC|PRIM_MATERIAL_RUBBER|" +
+            "PRIM_MATERIAL_STONE|PRIM_MATERIAL_WOOD|PRIM_MEDIA_ALT_IMAGE_ENABLE|PRIM_MEDIA_AUTO_LOOP|" +
+            "PRIM_MEDIA_AUTO_PLAY|PRIM_MEDIA_AUTO_SCALE|PRIM_MEDIA_AUTO_ZOOM|PRIM_MEDIA_CONTROLS|" +
+            "PRIM_MEDIA_CONTROLS_MINI|PRIM_MEDIA_CONTROLS_STANDARD|PRIM_MEDIA_CURRENT_URL|" +
+            "PRIM_MEDIA_FIRST_CLICK_INTERACT|PRIM_MEDIA_HEIGHT_PIXELS|PRIM_MEDIA_HOME_URL|" +
+            "PRIM_MEDIA_MAX_HEIGHT_PIXELS|PRIM_MEDIA_MAX_URL_LENGTH|PRIM_MEDIA_MAX_WHITELIST_COUNT|" +
+            "PRIM_MEDIA_MAX_WHITELIST_SIZE|PRIM_MEDIA_MAX_WIDTH_PIXELS|PRIM_MEDIA_PARAM_MAX|" +
+            "PRIM_MEDIA_PERM_ANYONE|PRIM_MEDIA_PERM_GROUP|PRIM_MEDIA_PERM_NONE|PRIM_MEDIA_PERM_OWNER|" +
+            "PRIM_MEDIA_PERMS_CONTROL|PRIM_MEDIA_PERMS_INTERACT|PRIM_MEDIA_WHITELIST|" +
+            "PRIM_MEDIA_WHITELIST_ENABLE|PRIM_MEDIA_WIDTH_PIXELS|PRIM_NAME|PRIM_OMEGA|" +
+            "PRIM_PHANTOM|PRIM_PHYSICS|PRIM_PHYSICS_SHAPE_CONVEX|PRIM_PHYSICS_SHAPE_NONE|" +
+            "PRIM_PHYSICS_SHAPE_PRIM|PRIM_PHYSICS_SHAPE_TYPE|PRIM_POINT_LIGHT|PRIM_POS_LOCAL|" +
+            "PRIM_POSITION|PRIM_ROT_LOCAL|PRIM_ROTATION|PRIM_SCULPT_FLAG_INVERT|PRIM_SCULPT_FLAG_MIRROR|" +
+            "PRIM_SCULPT_TYPE_CYLINDER|PRIM_SCULPT_TYPE_MASK|PRIM_SCULPT_TYPE_PLANE|" +
+            "PRIM_SCULPT_TYPE_SPHERE|PRIM_SCULPT_TYPE_TORUS|PRIM_SHINY_HIGH|PRIM_SHINY_LOW|" +
+            "PRIM_SHINY_MEDIUM|PRIM_SHINY_NONE|PRIM_SIZE|PRIM_SLICE|PRIM_TEMP_ON_REZ|" +
+            "PRIM_TEXGEN|PRIM_TEXGEN_DEFAULT|PRIM_TEXGEN_PLANAR|PRIM_TEXT|PRIM_TEXTURE|" +
+            "PRIM_TYPE|PRIM_TYPE_BOX|PRIM_TYPE_CYLINDER|PRIM_TYPE_PRISM|PRIM_TYPE_RING|" +
+            "PRIM_TYPE_SCULPT|PRIM_TYPE_SPHERE|PRIM_TYPE_TORUS|PRIM_TYPE_TUBE|PROFILE_NONE|" +
+            "PROFILE_SCRIPT_MEMORY|PSYS_PART_BOUNCE_MASK|PSYS_PART_EMISSIVE_MASK|" +
+            "PSYS_PART_END_ALPHA|PSYS_PART_END_COLOR|PSYS_PART_END_SCALE|PSYS_PART_FLAGS|" +
+            "PSYS_PART_FOLLOW_SRC_MASK|PSYS_PART_FOLLOW_VELOCITY_MASK|PSYS_PART_INTERP_COLOR_MASK|" +
+            "PSYS_PART_INTERP_SCALE_MASK|PSYS_PART_MAX_AGE|PSYS_PART_START_ALPHA|" +
+            "PSYS_PART_START_COLOR|PSYS_PART_START_SCALE|PSYS_PART_TARGET_LINEAR_MASK|" +
+            "PSYS_PART_TARGET_POS_MASK|PSYS_PART_WIND_MASK|PSYS_SRC_ACCEL|PSYS_SRC_ANGLE_BEGIN|" +
+            "PSYS_SRC_ANGLE_END|PSYS_SRC_BURST_PART_COUNT|PSYS_SRC_BURST_RADIUS|PSYS_SRC_BURST_RATE|" +
+            "PSYS_SRC_BURST_SPEED_MAX|PSYS_SRC_BURST_SPEED_MIN|PSYS_SRC_MAX_AGE|PSYS_SRC_OMEGA|" +
+            "PSYS_SRC_PATTERN|PSYS_SRC_PATTERN_ANGLE|PSYS_SRC_PATTERN_ANGLE_CONE|" +
+            "PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY|PSYS_SRC_PATTERN_DROP|PSYS_SRC_PATTERN_EXPLODE|" +
+            "PSYS_SRC_TARGET_KEY|PSYS_SRC_TEXTURE|PU_EVADE_HIDDEN|PU_EVADE_SPOTTED|" +
+            "PU_FAILURE_DYNAMIC_PATHFINDING_DISABLED|PU_FAILURE_INVALID_GOAL|PU_FAILURE_INVALID_START|" +
+            "PU_FAILURE_NO_NAVMESH|PU_FAILURE_NO_VALID_DESTINATION|PU_FAILURE_OTHER|" +
+            "PU_FAILURE_PARCEL_UNREACHABLE|PU_FAILURE_TARGET_GONE|PU_FAILURE_UNREACHABLE|" +
+            "PU_GOAL_REACHED|PU_SLOWDOWN_DISTANCE_REACHED|PUBLIC_CHANNEL|PURSUIT_FUZZ_FACTOR|" +
+            "PURSUIT_GOAL_TOLERANCE|PURSUIT_INTERCEPT|PURSUIT_OFFSET|RC_DATA_FLAGS|" +
+            "RC_DETECT_PHANTOM|RC_GET_LINK_NUM|RC_GET_NORMAL|RC_GET_ROOT_KEY|RC_MAX_HITS|" +
+            "RC_REJECT_AGENTS|RC_REJECT_LAND|RC_REJECT_NONPHYSICAL|RC_REJECT_PHYSICAL|" +
+            "RC_REJECT_TYPES|RCERR_CAST_TIME_EXCEEDED|RCERR_SIM_PERF_LOW|RCERR_UNKNOWN|" +
+            "REGION_FLAG_ALLOW_DAMAGE|REGION_FLAG_ALLOW_DIRECT_TELEPORT|REGION_FLAG_BLOCK_FLY|" +
+            "REGION_FLAG_BLOCK_TERRAFORM|REGION_FLAG_DISABLE_COLLISIONS|REGION_FLAG_DISABLE_PHYSICS|" +
+            "REGION_FLAG_FIXED_SUN|REGION_FLAG_RESTRICT_PUSHOBJECT|REGION_FLAG_SANDBOX|" +
+            "REMOTE_DATA_CHANNEL|REMOTE_DATA_REPLY|REMOTE_DATA_REQUEST|REQUIRE_LINE_OF_SIGHT|" +
+            "RESTITUTION|REVERSE|ROTATE|SCALE|SCRIPTED|SIM_STAT_PCT_CHARS_STEPPED|" +
+            "SMOOTH|STATUS_BLOCK_GRAB|STATUS_BLOCK_GRAB_OBJECT|STATUS_BOUNDS_ERROR|" +
+            "STATUS_CAST_SHADOWS|STATUS_DIE_AT_EDGE|STATUS_INTERNAL_ERROR|STATUS_MALFORMED_PARAMS|" +
+            "STATUS_NOT_FOUND|STATUS_NOT_SUPPORTED|STATUS_OK|STATUS_PHANTOM|STATUS_PHYSICS|" +
+            "STATUS_RETURN_AT_EDGE|STATUS_ROTATE_X|STATUS_ROTATE_Y|STATUS_ROTATE_Z|" +
+            "STATUS_SANDBOX|STATUS_TYPE_MISMATCH|STATUS_WHITELIST_FAILED|STRING_TRIM|" +
+            "STRING_TRIM_HEAD|STRING_TRIM_TAIL|TOUCH_INVALID_FACE|TRAVERSAL_TYPE|" +
+            "TRAVERSAL_TYPE_FAST|TRAVERSAL_TYPE_NONE|TRAVERSAL_TYPE_SLOW|TYPE_FLOAT|" +
+            "TYPE_INTEGER|TYPE_INVALID|TYPE_KEY|TYPE_ROTATION|TYPE_STRING|TYPE_VECTOR|" +
+            "VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY|VEHICLE_ANGULAR_DEFLECTION_TIMESCALE|" +
+            "VEHICLE_ANGULAR_FRICTION_TIMESCALE|VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE|" +
+            "VEHICLE_ANGULAR_MOTOR_DIRECTION|VEHICLE_ANGULAR_MOTOR_TIMESCALE|VEHICLE_BANKING_EFFICIENCY|" +
+            "VEHICLE_BANKING_MIX|VEHICLE_BANKING_TIMESCALE|VEHICLE_BUOYANCY|VEHICLE_FLAG_CAMERA_DECOUPLED|" +
+            "VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT|VEHICLE_FLAG_HOVER_TERRAIN_ONLY|VEHICLE_FLAG_HOVER_UP_ONLY|" +
+            "VEHICLE_FLAG_HOVER_WATER_ONLY|VEHICLE_FLAG_LIMIT_MOTOR_UP|VEHICLE_FLAG_LIMIT_ROLL_ONLY|" +
+            "VEHICLE_FLAG_MOUSELOOK_BANK|VEHICLE_FLAG_MOUSELOOK_STEER|VEHICLE_FLAG_NO_DEFLECTION_UP|" +
+            "VEHICLE_HOVER_EFFICIENCY|VEHICLE_HOVER_HEIGHT|VEHICLE_HOVER_TIMESCALE|" +
+            "VEHICLE_LINEAR_DEFLECTION_EFFICIENCY|VEHICLE_LINEAR_DEFLECTION_TIMESCALE|" +
+            "VEHICLE_LINEAR_FRICTION_TIMESCALE|VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE|" +
+            "VEHICLE_LINEAR_MOTOR_DIRECTION|VEHICLE_LINEAR_MOTOR_OFFSET|VEHICLE_LINEAR_MOTOR_TIMESCALE|" +
+            "VEHICLE_REFERENCE_FRAME|VEHICLE_TYPE_AIRPLANE|VEHICLE_TYPE_BALLOON|VEHICLE_TYPE_BOAT|" +
+            "VEHICLE_TYPE_CAR|VEHICLE_TYPE_NONE|VEHICLE_TYPE_SLED|VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY|" +
+            "VEHICLE_VERTICAL_ATTRACTION_TIMESCALE|VERTICAL|WANDER_PAUSE_AT_WAYPOINTS",
+        "constant.language.integer.boolean.lsl" : "FALSE|TRUE",
+        "constant.language.quaternion.lsl" : "ZERO_ROTATION",
+        "constant.language.string.lsl" : "EOF|JSON_ARRAY|JSON_FALSE|JSON_INVALID|" +
+            "JSON_NULL|JSON_NUMBER|JSON_OBJECT|JSON_STRING|JSON_TRUE|NULL_KEY|" +
+            "TEXTURE_BLANK|TEXTURE_DEFAULT|TEXTURE_MEDIA|TEXTURE_PLYWOOD|" +
+            "TEXTURE_TRANSPARENT|URL_REQUEST_DENIED|URL_REQUEST_GRANTED",
+        "constant.language.vector.lsl" : "TOUCH_INVALID_TEXCOORD|TOUCH_INVALID_VECTOR|ZERO_VECTOR",
+        "invalid.broken.lsl": "LAND_LARGE_BRUSH|LAND_MEDIUM_BRUSH|LAND_SMALL_BRUSH",
+        "invalid.deprecated.lsl" : "ATTACH_LPEC|ATTACH_RPEC|CHARACTER_MAX_ANGULAR_ACCEL|" +
+            "CHARACTER_MAX_ANGULAR_SPEED|CHARACTER_TURN_SPEED_MULTIPLIER|DATA_RATING|" +
+            "PRIM_CAST_SHADOWS|PRIM_MATERIAL_LIGHT|PRIM_PHYSICS_MATERIAL|PRIM_TYPE_LEGACY|" +
+            "PSYS_SRC_INNERANGLE|PSYS_SRC_OUTERANGLE|VEHICLE_FLAG_NO_FLY_UP|llCloud|" +
+            "llGodLikeRezObject|llMakeExplosion|llMakeFire|llMakeFountain|llMakeSmoke|" +
+            "llRemoteDataSetRegion|llSetInventoryPermMask|llSetObjectPermMask|llSound|" +
+            "llSoundPreload|llXorBase64Strings|llXorBase64StringsCorrect",
+        "invalid.godmode.lsl": "llGodLikeRezObject|llSetInventoryPermMask|llSetObjectPermMask",
+        "invalid.illegal.lsl" : "print",
+        "invalid.unimplemented.lsl": "CHARACTER_MAX_ANGULAR_ACCEL|CHARACTER_MAX_ANGULAR_SPEED|" +
+            "CHARACTER_TURN_SPEED_MULTIPLIER|PERMISSION_CHANGE_JOINTS|PERMISSION_CHANGE_PERMISSIONS|" +
+            "PERMISSION_RELEASE_OWNERSHIP|PERMISSION_REMAP_CONTROLS|PRIM_PHYSICS_MATERIAL|PRIM_TYPE_LEGACY|" +
+            "PSYS_SRC_OBJ_REL_MASK|event|llCollisionSprite|llPointAt|llRefreshPrimURL|" +
+            "llReleaseCamera|llRemoteLoadScript|llSetPrimURL|llStopPointAt|llTakeCamera",
+        "keyword.control.lsl" : "do|else|for|if|jump|return|while",
+        "storage.type.lsl" : "float|integer|key|list|quaternion|rotation|string|vector",
+        "support.function.lsl": "llAbs|llAcos|llAddToLandBanList|llAddToLandPassList|" +
+            "llAdjustSoundVolume|llAllowInventoryDrop|llAngleBetween|llApplyImpulse|" +
+            "llApplyRotationalImpulse|llAsin|llAtan2|llAttachToAvatar|llAttachToAvatarTemp|" +
+            "llAvatarOnLinkSitTarget|llAvatarOnSitTarget|llAxes2Rot|llAxisAngle2Rot|" +
+            "llBase64ToInteger|llBase64ToString|llBreakAllLinks|llBreakLink|llCastRay|" +
+            "llCeil|llClearCameraParams|llClearLinkMedia|llClearPrimMedia|llCloseRemoteDataChannel|" +
+            "llCollisionFilter|llCollisionSound|llCos|llCreateCharacter|llCreateLink|" +
+            "llCSV2List|llDeleteCharacter|llDeleteSubList|llDeleteSubString|llDetachFromAvatar|" +
+            "llDetectedGrab|llDetectedGroup|llDetectedKey|llDetectedLinkNumber|llDetectedName|" +
+            "llDetectedOwner|llDetectedPos|llDetectedRot|llDetectedTouchBinormal|" +
+            "llDetectedTouchFace|llDetectedTouchNormal|llDetectedTouchPos|llDetectedTouchST|" +
+            "llDetectedTouchUV|llDetectedType|llDetectedVel|llDialog|llDie|llDumpList2String|" +
+            "llEdgeOfWorld|llEjectFromLand|llEmail|llEscapeURL|llEuler2Rot|llExecCharacterCmd|" +
+            "llEvade|llFabs|llFleeFrom|llFloor|llForceMouselook|llFrand|llGenerateKey|" +
+            "llGetAccel|llGetAgentInfo|llGetAgentLanguage|llGetAgentList|llGetAgentSize|" +
+            "llGetAlpha|llGetAndResetTime|llGetAnimation|llGetAnimationList|llGetAnimationOverride|" +
+            "llGetAttached|llGetBoundingBox|llGetCameraPos|llGetCameraRot|llGetCenterOfMass|" +
+            "llGetClosestNavPoint|llGetColor|llGetCreator|llGetDate|llGetDisplayName|" +
+            "llGetEnergy|llGetEnv|llGetForce|llGetFreeMemory|llGetFreeURLs|llGetGeometricCenter|" +
+            "llGetGMTclock|llGetHTTPHeader|llGetInventoryCreator|llGetInventoryKey|llGetInventoryName|" +
+            "llGetInventoryNumber|llGetInventoryPermMask|llGetInventoryType|llGetKey|" +
+            "llGetLandOwnerAt|llGetLinkKey|llGetLinkMedia|llGetLinkName|llGetLinkNumber|" +
+            "llGetLinkNumberOfSides|llGetLinkPrimitiveParams|llGetListEntryType|llGetListLength|" +
+            "llGetLocalPos|llGetLocalRot|llGetMass|llGetMassMKS|llGetMemoryLimit|" +
+            "llGetNextEmail|llGetNotecardLine|llGetNumberOfNotecardLines|llGetNumberOfPrims|" +
+            "llGetNumberOfSides|llGetObjectDesc|llGetObjectDetails|llGetObjectMass|" +
+            "llGetObjectName|llGetObjectPermMask|llGetObjectPrimCount|llGetOmega|" +
+            "llGetOwner|llGetOwnerKey|llGetParcelDetails|llGetParcelFlags|llGetParcelMaxPrims|" +
+            "llGetParcelMusicURL|llGetParcelPrimCount|llGetParcelPrimOwners|llGetPermissions|" +
+            "llGetPermissionsKey|llGetPhysicsMaterial|llGetPos|llGetPrimitiveParams|" +
+            "llGetPrimMediaParams|llGetRegionAgentCount|llGetRegionCorner|llGetRegionFlags|" +
+            "llGetRegionFPS|llGetRegionName|llGetRegionTimeDilation|llGetRootPosition|" +
+            "llGetRootRotation|llGetRot|llGetScale|llGetScriptName|llGetScriptState|" +
+            "llGetSimStats|llGetSimulatorHostname|llGetSPMaxMemory|llGetStartParameter|" +
+            "llGetStaticPath|llGetStatus|llGetSubString|llGetSunDirection|llGetTexture|" +
+            "llGetTextureOffset|llGetTextureRot|llGetTextureScale|llGetTime|llGetTimeOfDay|" +
+            "llGetTimestamp|llGetTorque|llGetUnixTime|llGetUsedMemory|llGetUsername|" +
+            "llGetVel|llGetWallclock|llGiveInventory|llGiveInventoryList|llGiveMoney|" +
+            "llGround|llGroundContour|llGroundNormal|llGroundRepel|llGroundSlope|" +
+            "llHTTPRequest|llHTTPResponse|llInsertString|llInstantMessage|llIntegerToBase64|" +
+            "llJson2List|llJsonGetValue|llJsonSetValue|llJsonValueType|llKey2Name|" +
+            "llLinkParticleSystem|llLinkSitTarget|llList2CSV|llList2Float|llList2Integer|" +
+            "llList2Json|llList2Key|llList2List|llList2ListStrided|llList2Rot|" +
+            "llList2String|llList2Vector|llListen|llListenControl|llListenRemove|" +
+            "llListFindList|llListInsertList|llListRandomize|llListReplaceList|llListSort|" +
+            "llListStatistics|llLoadURL|llLog|llLog10|llLookAt|llLoopSound|llLoopSoundMaster|" +
+            "llLoopSoundSlave|llManageEstateAccess|llMapDestination|llMD5String|llMessageLinked|" +
+            "llMinEventDelay|llModifyLand|llModPow|llMoveToTarget|llNavigateTo|llOffsetTexture|" +
+            "llOpenRemoteDataChannel|llOverMyLand|llOwnerSay|llParcelMediaCommandList|" +
+            "llParcelMediaQuery|llParseString2List|llParseStringKeepNulls|llParticleSystem|" +
+            "llPassCollisions|llPassTouches|llPatrolPoints|llPlaySound|llPlaySoundSlave|" +
+            "llPow|llPreloadSound|llPursue|llPushObject|llRegionSay|llRegionSayTo|" +
+            "llReleaseControls|llReleaseURL|llRemoteDataReply|llRemoteLoadScriptPin|" +
+            "llRemoveFromLandBanList|llRemoveFromLandPassList|llRemoveInventory|llRemoveVehicleFlags|" +
+            "llRequestAgentData|llRequestDisplayName|llRequestInventoryData|llRequestPermissions|" +
+            "llRequestSecureURL|llRequestSimulatorData|llRequestURL|llRequestUsername|" +
+            "llResetAnimationOverride|llResetLandBanList|llResetLandPassList|llResetOtherScript|" +
+            "llResetScript|llResetTime|llReturnObjectsByID|llReturnObjectsByOwner|" +
+            "llRezAtRoot|llRezObject|llRot2Angle|llRot2Axis|llRot2Euler|" +
+            "llRot2Fwd|llRot2Left|llRot2Up|llRotateTexture|llRotBetween|llRotLookAt|" +
+            "llRotTarget|llRotTargetRemove|llRound|llSameGroup|llSay|llScaleTexture|" +
+            "llScriptDanger|llScriptProfiler|llSendRemoteData|llSensor|llSensorRemove|" +
+            "llSensorRepeat|llSetAlpha|llSetAngularVelocity|llSetAnimationOverride|llSetBuoyancy|" +
+            "llSetCameraAtOffset|llSetCameraEyeOffset|llSetCameraParams|llSetClickAction|" +
+            "llSetColor|llSetContentType|llSetDamage|llSetForce|llSetForceAndTorque|llSetHoverHeight|" +
+            "llSetKeyframedMotion|llSetLinkAlpha|llSetLinkCamera|llSetLinkColor|llSetLinkMedia|" +
+            "llSetLinkPrimitiveParams|llSetLinkPrimitiveParamsFast|llSetLinkTexture|llSetLinkTextureAnim|" +
+            "llSetLocalRot|llSetMemoryLimit|llSetObjectDesc|llSetObjectName|llSetParcelMusicURL|" +
+            "llSetPayPrice|llSetPhysicsMaterial|llSetPos|llSetPrimitiveParams|llSetPrimMediaParams|" +
+            "llSetRegionPos|llSetRemoteScriptAccessPin|llSetRot|llSetScale|llSetScriptState|" +
+            "llSetSitText|llSetSoundQueueing|llSetSoundRadius|llSetStatus|llSetText|" +
+            "llSetTexture|llSetTextureAnim|llSetTimerEvent|llSetTorque|llSetTouchText|" +
+            "llSetVehicleFlags|llSetVehicleFloatParam|llSetVehicleRotationParam|llSetVehicleType|" +
+            "llSetVehicleVectorParam|llSetVelocity|llSHA1String|llShout|llSin|llSitTarget|" +
+            "llSleep|llSqrt|llStartAnimation|llStopAnimation|llStopHover|llStopLookAt|" +
+            "llStopMoveToTarget|llStopSound|llStringLength|llStringToBase64|llStringTrim|" +
+            "llSubStringIndex|llTakeControls|llTan|llTarget|llTargetOmega|llTargetRemove|" +
+            "llTeleportAgent|llTeleportAgentGlobalCoords|llTeleportAgentHome|llTextBox|" +
+            "llToLower|llToUpper|llTransferLindenDollars|llTriggerSound|llTriggerSoundLimited|" +
+            "llUnescapeURL|llUnSit|llUpdateCharacter|llVecDist|llVecMag|llVecNorm|" +
+            "llVolumeDetect|llWanderWithin|llWater|llWhisper|llWind|llXorBase64",
+        "support.function.event.lsl" : "at_rot_target|at_target|attach|changed|collision|" +
+            "collision_end|collision_start|control|dataserver|email|http_request|" +
+            "http_response|land_collision|land_collision_end|land_collision_start|" +
+            "link_message|listen|money|moving_end|moving_start|no_sensor|not_at_rot_target|" +
+            "not_at_target|object_rez|on_rez|path_update|remote_data|run_time_permissions|" +
+            "sensor|state_entry|state_exit|timer|touch|touch_end|touch_start|transaction_result"
+        }, "identifier");
+
+    this.$rules = {
+        "start" : [
+            {
+                token : "comment.line.double-slash.lsl",
+                regex : "\\/\\/.*$"
+            }, {
+                token : "comment.block.lsl",
+                regex : "\\/\\*",
+                next : "comment"
+            }, {
+                token : "string.quoted.double.lsl",
+                start : '"',
+                end : '"',
+                next : [{
+                    token : "constant.language.escape.lsl", regex : /\\[tn"\\]/
+                }]
+            }, {
+                token : "constant.numeric.lsl",
+                regex : "(0[xX][0-9a-fA-F]+|[+-]?[0-9]+(?:(?:\\.[0-9]*)?(?:[eE][+-]?[0-9]+)?)?)\\b"
+            }, {
+                token : "entity.name.state.lsl",
+                regex : "\\b((state)\\s+\\w+|default)\\b"
+            }, {
+                token : keywordMapper,
+                regex : "\\b[a-zA-Z_][a-zA-Z0-9_]*\\b"
+            }, {
+                token : "support.function.user-defined.lsl",
+                regex : /\b([a-zA-Z_]\w*)(?=\(.*?\))/
+            }, {
+                token : "keyword.operator.lsl",
+                regex : "\\+\\+|\\-\\-|<<|>>|&&?|\\|\\|?|\\^|~|[!%<>=*+\\-\\/]=?"
+            }, {
+                token : "punctuation.operator.lsl",
+                regex : "\\,|\\;"
+            }, {
+                token : "paren.lparen.lsl",
+                regex : "[\\[\\(\\{]"
+            }, {
+                token : "paren.rparen.lsl",
+                regex : "[\\]\\)\\}]"
+            }, {
+                token : "text.lsl",
+                regex : "\\s+"
+            }
+        ],
+        "comment" : [
+            {
+                token : "comment.block.lsl",
+                regex : ".*?\\*\\/",
+                next : "start"
+            }, {
+                token : "comment.block.lsl",
+                regex : ".+"
+            }
+        ]
+    };
+    this.normalizeRules();
+}
+
+exports.LSLHighlightRules = LSLHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/lua.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/lua.js b/src/fauxton/assets/js/libs/ace/mode/lua.js
new file mode 100644
index 0000000..9246824
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/lua.js
@@ -0,0 +1,168 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules;
+var LuaFoldMode = require("./folding/lua").FoldMode;
+var Range = require("../range").Range;
+var WorkerClient = require("../worker/worker_client").WorkerClient;
+
+var Mode = function() {
+    this.HighlightRules = LuaHighlightRules;
+    
+    this.foldingRules = new LuaFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+   
+    this.lineCommentStart = "--";
+    this.blockComment = {start: "--[", end: "]--"};
+    
+    var indentKeywords = {
+        "function": 1,
+        "then": 1,
+        "do": 1,
+        "else": 1,
+        "elseif": 1,
+        "repeat": 1,
+        "end": -1,
+        "until": -1
+    };
+    var outdentKeywords = [
+        "else",
+        "elseif",
+        "end",
+        "until"
+    ];
+
+    function getNetIndentLevel(tokens) {
+        var level = 0;
+        // Support single-line blocks by decrementing the indent level if
+        // an ending token is found
+        for (var i = 0; i < tokens.length; i++) {
+            var token = tokens[i];
+            if (token.type == "keyword") {
+                if (token.value in indentKeywords) {
+                    level += indentKeywords[token.value];
+                }
+            } else if (token.type == "paren.lparen") {
+                level ++;
+            } else if (token.type == "paren.rparen") {
+                level --;
+            }
+        }
+        // Limit the level to +/- 1 since usually users only indent one level
+        // at a time regardless of the logical nesting level
+        if (level < 0) {
+            return -1;
+        } else if (level > 0) {
+            return 1;
+        } else {
+            return 0;
+        }
+    }
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+        var level = 0;
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+
+        if (state == "start") {
+            level = getNetIndentLevel(tokens);
+        }
+        if (level > 0) {
+            return indent + tab;
+        } else if (level < 0 && indent.substr(indent.length - tab.length) == tab) {
+            // Don't do a next-line outdent if we're going to do a real outdent of this line
+            if (!this.checkOutdent(state, line, "\n")) {
+                return indent.substr(0, indent.length - tab.length);
+            }
+        }
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        if (input != "\n" && input != "\r" && input != "\r\n")
+            return false;
+
+        if (line.match(/^\s*[\)\}\]]$/))
+            return true;
+
+        var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
+
+        if (!tokens || !tokens.length)
+            return false;
+
+        return (tokens[0].type == "keyword" && outdentKeywords.indexOf(tokens[0].value) != -1);
+    };
+
+    this.autoOutdent = function(state, session, row) {
+        var prevLine = session.getLine(row - 1);
+        var prevIndent = this.$getIndent(prevLine).length;
+        var prevTokens = this.getTokenizer().getLineTokens(prevLine, "start").tokens;
+        var tabLength = session.getTabString().length;
+        var expectedIndent = prevIndent + tabLength * getNetIndentLevel(prevTokens);
+        var curIndent = this.$getIndent(session.getLine(row)).length;
+        if (curIndent < expectedIndent) {
+            // User already outdented //
+            return;
+        }
+        session.outdentRows(new Range(row, 0, row + 2, 0));
+    };
+
+    this.createWorker = function(session) {
+        var worker = new WorkerClient(["ace"], "ace/mode/lua_worker", "Worker");
+        worker.attachToDocument(session.getDocument());
+        
+        worker.on("error", function(e) {
+            session.setAnnotations([e.data]);
+        });
+        
+        worker.on("ok", function(e) {
+            session.clearAnnotations();
+        });
+        
+        return worker;
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
+
+


[09/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/php/php.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/php/php.js b/src/fauxton/assets/js/libs/ace/mode/php/php.js
new file mode 100644
index 0000000..12786ba
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/php/php.js
@@ -0,0 +1,5003 @@
+/*
+  php.js 0.1.0 <http://phpjs.hertzen.com/>
+  Copyright (c) 2013 Niklas von Hertzen
+
+  Released under MIT License
+
+  This file contains:
+  - [var PHP = {Constants:{}};]
+  - src/modules/tokenizer/constants.js
+  - src/parser/lexer.js
+  - src/parser/parser.js
+  - src/parser/yyn.js
+  - src/parser/yyn_stmt.js
+  - src/parser/yyn_expr.js
+  - src/parser/yyn_scalar.js
+*/
+
+
+
+define(function(require, exports, module) {
+
+var PHP = {Constants:{}};
+
+
+
+
+PHP.Constants.T_INCLUDE = 262;
+PHP.Constants.T_INCLUDE_ONCE = 261;
+PHP.Constants.T_EVAL = 260;
+PHP.Constants.T_REQUIRE = 259;
+PHP.Constants.T_REQUIRE_ONCE = 258;
+PHP.Constants.T_LOGICAL_OR = 263;
+PHP.Constants.T_LOGICAL_XOR = 264;
+PHP.Constants.T_LOGICAL_AND = 265;
+PHP.Constants.T_PRINT = 266;
+PHP.Constants.T_PLUS_EQUAL = 277;
+PHP.Constants.T_MINUS_EQUAL = 276;
+PHP.Constants.T_MUL_EQUAL = 275;
+PHP.Constants.T_DIV_EQUAL = 274;
+PHP.Constants.T_CONCAT_EQUAL = 273;
+PHP.Constants.T_MOD_EQUAL = 272;
+PHP.Constants.T_AND_EQUAL = 271;
+PHP.Constants.T_OR_EQUAL = 270;
+PHP.Constants.T_XOR_EQUAL = 269;
+PHP.Constants.T_SL_EQUAL = 268;
+PHP.Constants.T_SR_EQUAL = 267;
+PHP.Constants.T_BOOLEAN_OR = 278;
+PHP.Constants.T_BOOLEAN_AND = 279;
+PHP.Constants.T_IS_EQUAL = 283;
+PHP.Constants.T_IS_NOT_EQUAL = 282;
+PHP.Constants.T_IS_IDENTICAL = 281;
+PHP.Constants.T_IS_NOT_IDENTICAL = 280;
+PHP.Constants.T_IS_SMALLER_OR_EQUAL = 285;
+PHP.Constants.T_IS_GREATER_OR_EQUAL = 284;
+PHP.Constants.T_SL = 287;
+PHP.Constants.T_SR = 286;
+PHP.Constants.T_INSTANCEOF = 288;
+PHP.Constants.T_INC = 297;
+PHP.Constants.T_DEC = 296;
+PHP.Constants.T_INT_CAST = 295;
+PHP.Constants.T_DOUBLE_CAST = 294;
+PHP.Constants.T_STRING_CAST = 293;
+PHP.Constants.T_ARRAY_CAST = 292;
+PHP.Constants.T_OBJECT_CAST = 291;
+PHP.Constants.T_BOOL_CAST = 290;
+PHP.Constants.T_UNSET_CAST = 289;
+PHP.Constants.T_NEW = 299;
+PHP.Constants.T_CLONE = 298;
+PHP.Constants.T_EXIT = 300;
+PHP.Constants.T_IF = 301;
+PHP.Constants.T_ELSEIF = 302;
+PHP.Constants.T_ELSE = 303;
+PHP.Constants.T_ENDIF = 304;
+PHP.Constants.T_LNUMBER = 305;
+PHP.Constants.T_DNUMBER = 306;
+PHP.Constants.T_STRING = 307;
+PHP.Constants.T_STRING_VARNAME = 308;
+PHP.Constants.T_VARIABLE = 309;
+PHP.Constants.T_NUM_STRING = 310;
+PHP.Constants.T_INLINE_HTML = 311;
+PHP.Constants.T_CHARACTER = 312;
+PHP.Constants.T_BAD_CHARACTER = 313;
+PHP.Constants.T_ENCAPSED_AND_WHITESPACE = 314;
+PHP.Constants.T_CONSTANT_ENCAPSED_STRING = 315;
+PHP.Constants.T_ECHO = 316;
+PHP.Constants.T_DO = 317;
+PHP.Constants.T_WHILE = 318;
+PHP.Constants.T_ENDWHILE = 319;
+PHP.Constants.T_FOR = 320;
+PHP.Constants.T_ENDFOR = 321;
+PHP.Constants.T_FOREACH = 322;
+PHP.Constants.T_ENDFOREACH = 323;
+PHP.Constants.T_DECLARE = 324;
+PHP.Constants.T_ENDDECLARE = 325;
+PHP.Constants.T_AS = 326;
+PHP.Constants.T_SWITCH = 327;
+PHP.Constants.T_ENDSWITCH = 328;
+PHP.Constants.T_CASE = 329;
+PHP.Constants.T_DEFAULT = 330;
+PHP.Constants.T_BREAK = 331;
+PHP.Constants.T_CONTINUE = 332;
+PHP.Constants.T_GOTO = 333;
+PHP.Constants.T_FUNCTION = 334;
+PHP.Constants.T_CONST = 335;
+PHP.Constants.T_RETURN = 336;
+PHP.Constants.T_TRY = 337;
+PHP.Constants.T_CATCH = 338;
+PHP.Constants.T_THROW = 339;
+PHP.Constants.T_USE = 340;
+//PHP.Constants.T_INSTEADOF = ;
+PHP.Constants.T_GLOBAL = 341;
+PHP.Constants.T_STATIC = 347;
+PHP.Constants.T_ABSTRACT = 346;
+PHP.Constants.T_FINAL = 345;
+PHP.Constants.T_PRIVATE = 344;
+PHP.Constants.T_PROTECTED = 343;
+PHP.Constants.T_PUBLIC = 342;
+PHP.Constants.T_VAR = 348;
+PHP.Constants.T_UNSET = 349;
+PHP.Constants.T_ISSET = 350;
+PHP.Constants.T_EMPTY = 351;
+PHP.Constants.T_HALT_COMPILER = 352;
+PHP.Constants.T_CLASS = 353;
+PHP.Constants.T_TRAIT = 382;
+PHP.Constants.T_INTERFACE = 354;
+PHP.Constants.T_EXTENDS = 355;
+PHP.Constants.T_IMPLEMENTS = 356;
+PHP.Constants.T_OBJECT_OPERATOR = 357;
+PHP.Constants.T_DOUBLE_ARROW = 358;
+PHP.Constants.T_LIST = 359;
+PHP.Constants.T_ARRAY = 360;
+//PHP.Constants.T_CALLABLE = ;
+PHP.Constants.T_CLASS_C = 361;
+PHP.Constants.T_TRAIT_C = 381;
+PHP.Constants.T_METHOD_C = 362;
+PHP.Constants.T_FUNC_C = 363;
+PHP.Constants.T_LINE = 364;
+PHP.Constants.T_FILE = 365;
+PHP.Constants.T_COMMENT = 366;
+PHP.Constants.T_DOC_COMMENT = 367;
+PHP.Constants.T_OPEN_TAG = 368;
+PHP.Constants.T_OPEN_TAG_WITH_ECHO = 369;
+PHP.Constants.T_CLOSE_TAG = 370;
+PHP.Constants.T_WHITESPACE = 371;
+PHP.Constants.T_START_HEREDOC = 372;
+PHP.Constants.T_END_HEREDOC = 373;
+PHP.Constants.T_DOLLAR_OPEN_CURLY_BRACES = 374;
+PHP.Constants.T_CURLY_OPEN = 375;
+PHP.Constants.T_PAAMAYIM_NEKUDOTAYIM = 376;
+PHP.Constants.T_DOUBLE_COLON = 376;
+PHP.Constants.T_NAMESPACE = 377;
+PHP.Constants.T_NS_C = 378;
+PHP.Constants.T_DIR = 379;
+PHP.Constants.T_NS_SEPARATOR = 380;
+PHP.Lexer = function( src, ini ) {
+
+
+    var heredoc,
+    lineBreaker = function( result ) {
+        if (result.match(/\n/) !== null) {
+            var quote = result.substring(0, 1);
+            result = '[' + result.split(/\n/).join( quote + "," + quote ) + '].join("\\n")';
+
+        }
+
+        return result;
+    },
+    prev,
+
+    openTag = (ini === undefined || (/^(on|true|1)$/i.test(ini.short_open_tag) ) ? /(\<\?php\s|\<\?|\<\%|\<script language\=('|")?php('|")?\>)/i : /(\<\?php\s|<\?=|\<script language\=('|")?php('|")?\>)/i),
+        openTagStart = (ini === undefined || (/^(on|true|1)$/i.test(ini.short_open_tag)) ? /^(\<\?php\s|\<\?|\<\%|\<script language\=('|")?php('|")?\>)/i : /^(\<\?php\s|<\?=|\<script language\=('|")?php('|")?\>)/i),
+            tokens = [
+            {
+                value: PHP.Constants.T_NAMESPACE,
+                re: /^namespace(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_USE,
+                re: /^use(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_ABSTRACT,
+                re: /^abstract(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_IMPLEMENTS,
+                re: /^implements(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_INTERFACE,
+                re: /^interface(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_CONST,
+                re: /^const(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_STATIC,
+                re: /^static(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_FINAL,
+                re: /^final(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_VAR,
+                re: /^var(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_GLOBAL,
+                re: /^global(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_CLONE,
+                re: /^clone(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_THROW,
+                re: /^throw(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_EXTENDS,
+                re: /^extends(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_AND_EQUAL,
+                re: /^&=/
+            },
+            {
+                value: PHP.Constants.T_AS,
+                re: /^as(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_ARRAY_CAST,
+                re: /^\(array\)/i
+            },
+            {
+                value: PHP.Constants.T_BOOL_CAST,
+                re: /^\((bool|boolean)\)/i
+            },
+            {
+                value: PHP.Constants.T_DOUBLE_CAST,
+                re: /^\((real|float|double)\)/i
+            },
+            {
+                value: PHP.Constants.T_INT_CAST,
+                re: /^\((int|integer)\)/i
+            },
+            {
+                value: PHP.Constants.T_OBJECT_CAST,
+                re: /^\(object\)/i
+            },
+            {
+                value: PHP.Constants.T_STRING_CAST,
+                re: /^\(string\)/i
+            },
+            {
+                value: PHP.Constants.T_UNSET_CAST,
+                re: /^\(unset\)/i
+            },
+            {
+                value: PHP.Constants.T_TRY,
+                re: /^try(?=\s*{)/i
+            },
+            {
+                value: PHP.Constants.T_CATCH,
+                re: /^catch(?=\s*\()/i
+            },
+            {
+                value: PHP.Constants.T_INSTANCEOF,
+                re: /^instanceof(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_LOGICAL_OR,
+                re: /^or(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_LOGICAL_AND,
+                re: /^and(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_LOGICAL_XOR,
+                re: /^xor(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_BOOLEAN_AND,
+                re: /^&&/
+            },
+            {
+                value: PHP.Constants.T_BOOLEAN_OR,
+                re: /^\|\|/
+            },
+            {
+                value: PHP.Constants.T_CONTINUE,
+                re: /^continue(?=\s|;)/i
+            },
+            {
+                value: PHP.Constants.T_BREAK,
+                re: /^break(?=\s|;)/i
+            },
+            {
+                value: PHP.Constants.T_ENDDECLARE,
+                re: /^enddeclare(?=\s|;)/i
+            },
+            {
+                value: PHP.Constants.T_ENDFOR,
+                re: /^endfor(?=\s|;)/i
+            },
+            {
+                value: PHP.Constants.T_ENDFOREACH,
+                re: /^endforeach(?=\s|;)/i
+            },
+            {
+                value: PHP.Constants.T_ENDIF,
+                re: /^endif(?=\s|;)/i
+            },
+            {
+                value: PHP.Constants.T_ENDSWITCH,
+                re: /^endswitch(?=\s|;)/i
+            },
+            {
+                value: PHP.Constants.T_ENDWHILE,
+                re: /^endwhile(?=\s|;)/i
+            },
+            {
+                value: PHP.Constants.T_CASE,
+                re: /^case(?=\s)/i
+            },
+            {
+                value: PHP.Constants.T_DEFAULT,
+                re: /^default(?=\s|:)/i
+            },
+            {
+                value: PHP.Constants.T_SWITCH,
+                re: /^switch(?=[ (])/i
+            },
+            {
+                value: PHP.Constants.T_EXIT,
+                re: /^(exit|die)(?=[ \(;])/i
+            },
+            {
+                value: PHP.Constants.T_CLOSE_TAG,
+                re: /^(\?\>|\%\>|\<\/script\>)\s?\s?/i,
+                func: function( result ) {
+                    insidePHP = false;
+                    return result;
+                }
+            },
+            {
+                value: PHP.Constants.T_DOUBLE_ARROW,
+                re: /^\=\>/
+            },
+            {
+                value: PHP.Constants.T_DOUBLE_COLON,
+                re: /^\:\:/
+            },
+            {
+                value: PHP.Constants.T_METHOD_C,
+                re: /^__METHOD__/
+            },
+            {
+                value: PHP.Constants.T_LINE,
+                re: /^__LINE__/
+            },
+            {
+                value: PHP.Constants.T_FILE,
+                re: /^__FILE__/
+            },
+            {
+                value: PHP.Constants.T_FUNC_C,
+                re: /^__FUNCTION__/
+            },
+            {
+                value: PHP.Constants.T_NS_C,
+                re: /^__NAMESPACE__/
+            },
+            {
+                value: PHP.Constants.T_TRAIT_C,
+                re: /^__TRAIT__/
+            },
+            {
+                value: PHP.Constants.T_DIR,
+                re: /^__DIR__/
+            },
+            {
+                value: PHP.Constants.T_CLASS_C,
+                re: /^__CLASS__/
+            },
+            {
+                value: PHP.Constants.T_INC,
+                re: /^\+\+/
+            },
+            {
+                value: PHP.Constants.T_DEC,
+                re: /^\-\-/
+            },
+            {
+                value: PHP.Constants.T_CONCAT_EQUAL,
+                re: /^\.\=/
+            },
+            {
+                value: PHP.Constants.T_DIV_EQUAL,
+                re: /^\/\=/
+            },
+            {
+                value: PHP.Constants.T_XOR_EQUAL,
+                re: /^\^\=/
+            },
+            {
+                value: PHP.Constants.T_MUL_EQUAL,
+                re: /^\*\=/
+            },
+            {
+                value: PHP.Constants.T_MOD_EQUAL,
+                re: /^\%\=/
+            },
+            {
+                value: PHP.Constants.T_SL_EQUAL,
+                re: /^<<=/
+            },
+            {
+                value: PHP.Constants.T_START_HEREDOC,
+                re: /^<<<[A-Z_0-9]+\s/i,
+                func: function( result ){
+                    heredoc = result.substring(3, result.length - 1);
+                    return result;
+                }
+            },
+            {
+                value: PHP.Constants.T_SL,
+                re: /^<</
+            },
+            {
+                value: PHP.Constants.T_IS_SMALLER_OR_EQUAL,
+                re: /^<=/
+            },
+            {
+                value: PHP.Constants.T_SR_EQUAL,
+                re: /^>>=/
+            },
+            {
+                value: PHP.Constants.T_SR,
+                re: /^>>/
+            },
+            {
+                value: PHP.Constants.T_IS_GREATER_OR_EQUAL,
+                re: /^>=/
+            },
+            {
+                value: PHP.Constants.T_OR_EQUAL,
+                re: /^\|\=/
+            },
+            {
+                value: PHP.Constants.T_PLUS_EQUAL,
+                re: /^\+\=/
+            },
+            {
+                value: PHP.Constants.T_MINUS_EQUAL,
+                re: /^-\=/
+            },
+            {
+                value: PHP.Constants.T_OBJECT_OPERATOR,
+                re: /^\-\>/i
+            },
+            {
+                value: PHP.Constants.T_CLASS,
+                re: /^class(?=[\s\{])/i,
+                afterWhitespace: true
+            },
+            {
+                value: PHP.Constants.T_TRAIT,
+                re: /^trait(?=[\s]+[A-Za-z])/i,
+            },
+            {
+                value: PHP.Constants.T_PUBLIC,
+                re: /^public(?=[\s])/i
+            },
+            {
+                value: PHP.Constants.T_PRIVATE,
+                re: /^private(?=[\s])/i
+            },
+            {
+                value: PHP.Constants.T_PROTECTED,
+                re: /^protected(?=[\s])/i
+            },
+            {
+                value: PHP.Constants.T_ARRAY,
+                re: /^array(?=\s*?\()/i
+            },
+            {
+                value: PHP.Constants.T_EMPTY,
+                re: /^empty(?=[ \(])/i
+            },
+            {
+                value: PHP.Constants.T_ISSET,
+                re: /^isset(?=[ \(])/i
+            },
+            {
+                value: PHP.Constants.T_UNSET,
+                re: /^unset(?=[ \(])/i
+            },
+            {
+                value: PHP.Constants.T_RETURN,
+                re: /^return(?=[ "'(;])/i
+            },
+            {
+                value: PHP.Constants.T_FUNCTION,
+                re: /^function(?=[ "'(;])/i
+            },
+            {
+                value: PHP.Constants.T_ECHO,
+                re: /^echo(?=[ "'(;])/i
+            },
+            {
+                value: PHP.Constants.T_LIST,
+                re: /^list(?=\s*?\()/i
+            },
+            {
+                value: PHP.Constants.T_PRINT,
+                re: /^print(?=[ "'(;])/i
+            },
+            {
+                value: PHP.Constants.T_INCLUDE,
+                re: /^include(?=[ "'(;])/i
+            },
+            {
+                value: PHP.Constants.T_INCLUDE_ONCE,
+                re: /^include_once(?=[ "'(;])/i
+            },
+            {
+                value: PHP.Constants.T_REQUIRE,
+                re: /^require(?=[ "'(;])/i
+            },
+            {
+                value: PHP.Constants.T_REQUIRE_ONCE,
+                re: /^require_once(?=[ "'(;])/i
+            },
+            {
+                value: PHP.Constants.T_NEW,
+                re: /^new(?=[ ])/i
+            },
+            {
+                value: PHP.Constants.T_COMMENT,
+                re: /^\/\*([\S\s]*?)(?:\*\/|$)/
+            },
+            {
+                value: PHP.Constants.T_COMMENT,
+                re: /^\/\/.*(\s)?/
+            },
+            {
+                value: PHP.Constants.T_COMMENT,
+                re: /^\#.*(\s)?/
+            },
+            {
+                value: PHP.Constants.T_ELSEIF,
+                re: /^elseif(?=[\s(])/i
+            },
+            {
+                value: PHP.Constants.T_GOTO,
+                re: /^goto(?=[\s(])/i
+            },
+            {
+                value: PHP.Constants.T_ELSE,
+                re: /^else(?=[\s{:])/i
+            },
+            {
+                value: PHP.Constants.T_IF,
+                re: /^if(?=[\s(])/i
+            },
+            {
+                value: PHP.Constants.T_DO,
+                re: /^do(?=[ {])/i
+            },
+            {
+                value: PHP.Constants.T_WHILE,
+                re: /^while(?=[ (])/i
+            },
+            {
+                value: PHP.Constants.T_FOREACH,
+                re: /^foreach(?=[ (])/i
+            },
+            {
+                value: PHP.Constants.T_ISSET,
+                re: /^isset(?=[ (])/i
+            },
+            {
+                value: PHP.Constants.T_IS_IDENTICAL,
+                re: /^===/
+            },
+            {
+                value: PHP.Constants.T_IS_EQUAL,
+                re: /^==/
+            },
+            {
+                value: PHP.Constants.T_IS_NOT_IDENTICAL,
+                re: /^\!==/
+            },
+            {
+                value: PHP.Constants.T_IS_NOT_EQUAL,
+                re: /^(\!=|\<\>)/
+            },
+            {
+                value: PHP.Constants.T_FOR,
+                re: /^for(?=[ (])/i
+            },
+
+            {
+                value: PHP.Constants.T_DNUMBER,
+                re: /^[0-9]*\.[0-9]+([eE][-]?[0-9]*)?/
+            /*,
+        func: function( result ) {
+
+            // transform e to E - token_get_all_variation1.phpt
+            return (result - 0).toString().toUpperCase();
+        }*/
+
+            },
+            {
+                value: PHP.Constants.T_LNUMBER,
+                re: /^(0x[0-9A-F]+|[0-9]+)/i
+            },
+            {
+                value: PHP.Constants.T_OPEN_TAG_WITH_ECHO,
+                re: /^(\<\?=|\<\%=)/i
+            },
+            {
+                value: PHP.Constants.T_OPEN_TAG,
+                re: openTagStart
+            },
+            {
+                value: PHP.Constants.T_VARIABLE,
+                re: /^\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/
+            },
+            {
+                value: PHP.Constants.T_WHITESPACE,
+                re: /^\s+/
+            },
+            {
+                value: PHP.Constants.T_CONSTANT_ENCAPSED_STRING,
+                re: /^("(?:[^"\\]|\\[\s\S])*"|'(?:[^'\\]|\\[\s\S])*')/,
+                func: function( result, token ) {
+
+                    var curlyOpen = 0,
+                    len,
+                    bracketOpen = 0;
+
+                    if (result.substring( 0,1 ) === "'") {
+                        return result;
+                    }
+
+                    var match = result.match( /(?:[^\\]|\\.)*[^\\]\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/g );
+                    if ( match !== null ) {
+                        // string has a variable
+
+                        while( result.length > 0 ) {
+                            len = result.length;
+                            match = result.match( /^[\[\]\;\:\?\(\)\!\.\,\>\<\=\+\-\/\*\|\&\@\^\%\"\'\{\}]/ );
+
+                            if ( match !== null ) {
+
+                                results.push( match[ 0 ] );
+                                result = result.substring( 1 );
+
+                                if ( curlyOpen > 0 && match[ 0 ] === "}") {
+                                    curlyOpen--;
+                                }
+
+                                if ( match[ 0 ] === "[" ) {
+                                    bracketOpen++;
+                                }
+
+                                if ( match[ 0 ] === "]" ) {
+                                    bracketOpen--;
+                                }
+
+                            }
+
+                            match = result.match(/^\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/);
+
+
+
+                            if ( match !== null ) {
+
+                                results.push([
+                                    parseInt(PHP.Constants.T_VARIABLE, 10),
+                                    match[ 0 ],
+                                    line
+                                    ]);
+
+                                result = result.substring( match[ 0 ].length );
+
+                                match = result.match(/^(\-\>)\s*([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)\s*(\()/);
+
+                                if ( match !== null ) {
+
+                                    results.push([
+                                        parseInt(PHP.Constants.T_OBJECT_OPERATOR, 10),
+                                        match[ 1 ],
+                                        line
+                                        ]);
+                                    results.push([
+                                        parseInt(PHP.Constants.T_STRING, 10),
+                                        match[ 2 ],
+                                        line
+                                        ]);
+                                    if (match[3]) {
+                                        results.push(match[3]);
+                                    }
+                                    result = result.substring( match[ 0 ].length );
+                                }
+
+
+                                if ( result.match( /^\[/g ) !== null ) {
+                                    continue;
+                                }
+                            }
+
+                            var re;
+                            if ( curlyOpen > 0) {
+                                re = /^([^\\\$"{}\]\)]|\\.)+/g;
+                            } else {
+                                re = /^([^\\\$"{]|\\.|{[^\$]|\$(?=[^a-zA-Z_\x7f-\xff]))+/g;;
+                            }
+
+                            while(( match = result.match( re )) !== null ) {
+
+
+                                if (result.length === 1) {
+                                    throw new Error(match);
+                                }
+
+
+
+                                results.push([
+                                    parseInt(( curlyOpen > 0 ) ? PHP.Constants.T_CONSTANT_ENCAPSED_STRING : PHP.Constants.T_ENCAPSED_AND_WHITESPACE, 10),
+                                    match[ 0 ].replace(/\n/g,"\\n").replace(/\r/g,""),
+                                    line
+                                    ]);
+
+                                line += match[ 0 ].split('\n').length - 1;
+
+                                result = result.substring( match[ 0 ].length );
+
+                            }
+
+                            if( result.match(/^{\$/) !== null ) {
+
+                                results.push([
+                                    parseInt(PHP.Constants.T_CURLY_OPEN, 10),
+                                    "{",
+                                    line
+                                    ]);
+                                result = result.substring( 1 );
+                                curlyOpen++;
+                            }
+
+                            if (len === result.length) {
+                                //  nothing has been found yet
+                                if ((match =  result.match( /^(([^\\]|\\.)*?[^\\]\$[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)/g )) !== null) {
+                                    return;
+                                }
+                            }
+
+                        }
+
+                        return undefined;
+
+                    } else {
+                        result = result.replace(/\r/g,"");
+                    }
+
+                    /*
+            if (result.match(/\r\n/) !== null) {
+                var quote = result.substring(0, 1);
+
+                result = '[' + result.split(/\r\n/).join( quote + "," + quote ) + '].join("\\n")';
+
+            }
+             */
+                    return result;
+                }
+            },
+            {
+                value: PHP.Constants.T_NS_SEPARATOR,
+                re: /^\\(?=[a-zA-Z_])/
+            },
+            {
+                value: PHP.Constants.T_STRING,
+                re: /^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/
+            },
+            {
+                value: -1,
+                re: /^[\[\]\;\:\?\(\)\!\.\,\>\<\=\+\-\/\*\|\&\{\}\@\^\%\"\'\$\~]/
+            }];
+
+
+
+
+
+            var results = [],
+            line = 1,
+            insidePHP = false,
+            cancel = true;
+
+            if ( src === null ) {
+                return results;
+            }
+
+            if ( typeof src !== "string" ) {
+                src = src.toString();
+            }
+
+
+
+            while (src.length > 0 && cancel === true) {
+
+                if ( insidePHP === true ) {
+
+                    if ( heredoc !== undefined ) {
+                        // we are in a heredoc
+
+                        var regexp = new RegExp('([\\S\\s]*?)(\\r\\n|\\n|\\r)(' + heredoc + ')(;|\\r\\n|\\n)',"i");
+
+
+
+                        var result = src.match( regexp );
+                        if ( result !== null ) {
+                            // contents
+
+                            results.push([
+                                parseInt(PHP.Constants.T_ENCAPSED_AND_WHITESPACE, 10),
+                                result[ 1 ].replace(/^\n/g,"").replace(/\\\$/g,"$") + "\n",
+                                line
+                                ]);
+
+
+                            // note the no - 1 for length as regexp include one line as well
+                            line += result[ 1 ].split('\n').length;
+
+                            // heredoc end tag
+                            results.push([
+                                parseInt(PHP.Constants.T_END_HEREDOC, 10),
+                                result[ 3 ],
+                                line
+                                ]);
+
+                            src = src.substring( result[1].length + result[2].length + result[3].length );
+                            heredoc = undefined;
+                        }
+
+                        if (result === null) {
+                            throw Error("sup");
+                        }
+
+
+                    } else {
+                        cancel =  tokens.some(function( token ){
+                            if ( token.afterWhitespace === true ) {
+                                // check last
+                                var last = results[ results.length - 1 ];
+                                if ( !Array.isArray( last ) || (last[ 0 ] !== PHP.Constants.T_WHITESPACE && last[ 0 ] !== PHP.Constants.T_OPEN_TAG  && last[ 0 ] !== PHP.Constants.T_COMMENT)) {
+                                    return false;
+                                }
+                            }
+                            var result = src.match( token.re );
+
+                            if ( result !== null ) {
+                                if ( token.value !== -1) {
+                                    var resultString = result[ 0 ];
+
+
+
+                                    if (token.func !== undefined ) {
+                                        resultString = token.func( resultString, token );
+                                    }
+                                    if (resultString !== undefined ) {
+
+                                        results.push([
+                                            parseInt(token.value, 10),
+                                            resultString,
+                                            line
+                                            ]);
+                                        line += resultString.split('\n').length - 1;
+                                    }
+
+                                } else {
+                                    // character token
+                                    results.push( result[ 0 ] );
+                                }
+
+                                src = src.substring(result[ 0 ].length);
+
+                                return true;
+                            }
+                            return false;
+
+
+                        });
+                    }
+
+                } else {
+
+                    var result = openTag.exec( src );
+
+
+                    if ( result !== null ) {
+                        if ( result.index > 0 ) {
+                            var resultString = src.substring(0, result.index);
+                            results.push ([
+                                parseInt(PHP.Constants.T_INLINE_HTML, 10),
+                                resultString,
+                                line
+                                ]);
+
+                            line += resultString.split('\n').length - 1;
+
+                            src = src.substring( result.index );
+                        }
+
+                        insidePHP = true;
+                    } else {
+
+                        results.push ([
+                            parseInt(PHP.Constants.T_INLINE_HTML, 10),
+                            src.replace(/^\n/, ""),
+                            line
+                            ]);
+                        return results;
+                    }
+
+                //    src = src.substring(result[ 0 ].length);
+
+                }
+
+
+
+            }
+
+
+
+            return results;
+
+
+
+        };
+
+/*
+ * @author Niklas von Hertzen <niklas at hertzen.com>
+ * @created 15.6.2012
+ * @website http://hertzen.com
+ */
+
+/*
+ * The skeleton for this parser was written by Moriyoshi Koizumi and is based on
+ * the work by Masato Bito and is in the PUBLIC DOMAIN.
+ * Ported to JavaScript by Niklas von Hertzen
+ */
+
+
+PHP.Parser = function ( preprocessedTokens, eval ) {
+
+    var yybase = this.yybase,
+    yydefault = this.yydefault,
+    yycheck = this.yycheck,
+    yyaction = this.yyaction,
+    yylen = this.yylen,
+    yygbase = this.yygbase,
+    yygcheck = this.yygcheck,
+    yyp = this.yyp,
+    yygoto = this.yygoto,
+    yylhs = this.yylhs,
+    terminals = this.terminals,
+    translate = this.translate,
+    yygdefault = this.yygdefault;
+
+
+    this.pos = -1;
+    this.line = 1;
+
+    this.tokenMap = this.createTokenMap( );
+
+    this.dropTokens = {};
+    this.dropTokens[ PHP.Constants.T_WHITESPACE ] = 1;
+    this.dropTokens[ PHP.Constants.T_OPEN_TAG ] = 1;
+    var tokens = [];
+
+    // pre-process
+    preprocessedTokens.forEach( function( token, index ) {
+        if ( typeof token === "object" && token[ 0 ] === PHP.Constants.T_OPEN_TAG_WITH_ECHO) {
+            tokens.push([
+                PHP.Constants.T_OPEN_TAG,
+                token[ 1 ],
+                token[ 2 ]
+                ]);
+            tokens.push([
+                PHP.Constants.T_ECHO,
+                token[ 1 ],
+                token[ 2 ]
+                ]);
+        } else {
+            tokens.push( token );
+        }
+    });
+    this.tokens = tokens;
+
+    // We start off with no lookahead-token
+    var tokenId = this.TOKEN_NONE;
+
+    // The attributes for a node are taken from the first and last token of the node.
+    // From the first token only the startAttributes are taken and from the last only
+    // the endAttributes. Both are merged using the array union operator (+).
+    this.startAttributes = {
+        'startLine': 1
+    };
+
+    this.endAttributes = {};
+
+    // In order to figure out the attributes for the starting token, we have to keep
+    // them in a stack
+    var attributeStack = [ this.startAttributes ];
+
+    // Start off in the initial state and keep a stack of previous states
+    var state = 0;
+    var stateStack = [ state ];
+
+    // AST stack
+    this.yyastk = [];
+
+    // Current position in the stack(s)
+    this.stackPos  = 0;
+
+    var yyn;
+
+    var origTokenId;
+
+
+    for (;;) {
+
+        if ( yybase[ state ] === 0 ) {
+            yyn = yydefault[ state ];
+        } else {
+            if (tokenId === this.TOKEN_NONE ) {
+                // fetch the next token id from the lexer and fetch additional info by-ref
+                origTokenId = this.getNextToken( );
+
+                // map the lexer token id to the internally used token id's
+                tokenId = (origTokenId >= 0 && origTokenId < this.TOKEN_MAP_SIZE) ? translate[ origTokenId ] : this.TOKEN_INVALID;
+
+                attributeStack[ this.stackPos ] = this.startAttributes;
+            }
+
+            if (((yyn = yybase[ state ] + tokenId) >= 0
+                && yyn < this.YYLAST && yycheck[ yyn ] === tokenId
+                || (state < this.YY2TBLSTATE
+                    && (yyn = yybase[state + this.YYNLSTATES] + tokenId) >= 0
+                    && yyn < this.YYLAST
+                    && yycheck[ yyn ] === tokenId))
+            && (yyn = yyaction[ yyn ]) !== this.YYDEFAULT ) {
+                /*
+                 * >= YYNLSTATE: shift and reduce
+                 * > 0: shift
+                 * = 0: accept
+                 * < 0: reduce
+                 * = -YYUNEXPECTED: error
+                 */
+                if (yyn > 0) {
+                    /* shift */
+                    ++this.stackPos;
+
+                    stateStack[ this.stackPos ] = state = yyn;
+                    this.yyastk[ this.stackPos ] = this.tokenValue;
+                    attributeStack[ this.stackPos ] = this.startAttributes;
+                    tokenId = this.TOKEN_NONE;
+
+                    if (yyn < this.YYNLSTATES)
+                        continue;
+
+                    /* $yyn >= YYNLSTATES means shift-and-reduce */
+                    yyn -= this.YYNLSTATES;
+                } else {
+                    yyn = -yyn;
+                }
+            } else {
+                yyn = yydefault[ state ];
+            }
+        }
+
+        for (;;) {
+            /* reduce/error */
+
+            if ( yyn === 0 ) {
+                /* accept */
+                return this.yyval;
+            } else if (yyn !== this.YYUNEXPECTED ) {
+                /* reduce */
+                for (var attr in this.endAttributes) {
+                    attributeStack[ this.stackPos - yylen[ yyn ] ][ attr ] = this.endAttributes[ attr ];
+                }
+                try {
+                    this['yyn' + yyn](attributeStack[ this.stackPos - yylen[ yyn ] ]);
+                } catch (e) {
+                    /*
+                        if (-1 === $e->getRawLine()) {
+                            $e->setRawLine($startAttributes['startLine']);
+                        }
+                     */
+                    throw e;
+                }
+
+                /* Goto - shift nonterminal */
+                this.stackPos -= yylen[ yyn ];
+                yyn = yylhs[ yyn ];
+                if ((yyp = yygbase[ yyn ] + stateStack[ this.stackPos ]) >= 0
+                    && yyp < this.YYGLAST
+                    && yygcheck[ yyp ] === yyn) {
+                    state = yygoto[ yyp ];
+                } else {
+                    state = yygdefault[ yyn ];
+                }
+
+                ++this.stackPos;
+
+                stateStack[ this.stackPos ] = state;
+                this.yyastk[ this.stackPos ] = this.yyval;
+                attributeStack[ this.stackPos ] = this.startAttributes;
+            } else {
+                /* error */
+                if (eval !== true) {
+
+                    var expected = [];
+
+                    for (var i = 0; i < this.TOKEN_MAP_SIZE; ++i) {
+                        if ((yyn = yybase[ state ] + i) >= 0 && yyn < this.YYLAST && yycheck[ yyn ] == i
+                         || state < this.YY2TBLSTATE
+                            && (yyn = yybase[ state + this.YYNLSTATES] + i)
+                            && yyn < this.YYLAST && yycheck[ yyn ] == i
+                        ) {
+                            if (yyaction[ yyn ] != this.YYUNEXPECTED) {
+                                if (expected.length == 4) {
+                                    /* Too many expected tokens */
+                                    expected = [];
+                                    break;
+                                }
+
+                                expected.push( this.terminals[ i ] );
+                            }
+                        }
+                    }
+
+                    var expectedString = '';
+                    if (expected.length) {
+                        expectedString = ', expecting ' + expected.join(' or ');
+                    }
+                    throw new PHP.ParseError('syntax error, unexpected ' + terminals[ tokenId ] + expectedString, this.startAttributes['startLine']);
+                } else {
+                    return this.startAttributes['startLine'];
+                }
+
+            }
+
+            if (state < this.YYNLSTATES)
+                break;
+            /* >= YYNLSTATES means shift-and-reduce */
+            yyn = state - this.YYNLSTATES;
+        }
+    }
+};
+
+PHP.ParseError = function( msg, line ) {
+    this.message = msg;
+    this.line = line;
+};
+
+PHP.Parser.prototype.MODIFIER_PUBLIC    =  1;
+PHP.Parser.prototype.MODIFIER_PROTECTED =  2;
+PHP.Parser.prototype.MODIFIER_PRIVATE   =  4;
+PHP.Parser.prototype.MODIFIER_STATIC    =  8;
+PHP.Parser.prototype.MODIFIER_ABSTRACT  = 16;
+PHP.Parser.prototype.MODIFIER_FINAL     = 32;
+
+PHP.Parser.prototype.getNextToken = function( ) {
+
+    this.startAttributes = {};
+    this.endAttributes = {};
+
+    var token,
+    tmp;
+
+    while (this.tokens[++this.pos] !== undefined) {
+        token = this.tokens[this.pos];
+
+        if (typeof token === "string") {
+            this.startAttributes['startLine'] = this.line;
+            this.endAttributes['endLine'] = this.line;
+
+            // bug in token_get_all
+            if ('b"' === token) {
+                this.tokenValue = 'b"';
+                return '"'.charCodeAt(0);
+            } else {
+                this.tokenValue = token;
+                return token.charCodeAt(0);
+            }
+        } else {
+
+
+
+            this.line += ((tmp = token[ 1 ].match(/\n/g)) === null) ? 0 : tmp.length;
+
+            if (PHP.Constants.T_COMMENT === token[0]) {
+
+                if (!Array.isArray(this.startAttributes['comments'])) {
+                    this.startAttributes['comments'] = [];
+                }
+
+                this.startAttributes['comments'].push( {
+                    type: "comment",
+                    comment: token[1],
+                    line: token[2]
+                });
+
+            } else if (PHP.Constants.T_DOC_COMMENT === token[0]) {
+                this.startAttributes['comments'].push( new PHPParser_Comment_Doc(token[1], token[2]) );
+            } else if (this.dropTokens[token[0]] === undefined) {
+                this.tokenValue = token[1];
+                this.startAttributes['startLine'] = token[2];
+                this.endAttributes['endLine'] = this.line;
+
+                return this.tokenMap[token[0]];
+            }
+        }
+    }
+
+    this.startAttributes['startLine'] = this.line;
+
+    // 0 is the EOF token
+    return 0;
+};
+
+PHP.Parser.prototype.tokenName = function( token ) {
+    var constants = ["T_INCLUDE","T_INCLUDE_ONCE","T_EVAL","T_REQUIRE","T_REQUIRE_ONCE","T_LOGICAL_OR","T_LOGICAL_XOR","T_LOGICAL_AND","T_PRINT","T_PLUS_EQUAL","T_MINUS_EQUAL","T_MUL_EQUAL","T_DIV_EQUAL","T_CONCAT_EQUAL","T_MOD_EQUAL","T_AND_EQUAL","T_OR_EQUAL","T_XOR_EQUAL","T_SL_EQUAL","T_SR_EQUAL","T_BOOLEAN_OR","T_BOOLEAN_AND","T_IS_EQUAL","T_IS_NOT_EQUAL","T_IS_IDENTICAL","T_IS_NOT_IDENTICAL","T_IS_SMALLER_OR_EQUAL","T_IS_GREATER_OR_EQUAL","T_SL","T_SR","T_INSTANCEOF","T_INC","T_DEC","T_INT_CAST","T_DOUBLE_CAST","T_STRING_CAST","T_ARRAY_CAST","T_OBJECT_CAST","T_BOOL_CAST","T_UNSET_CAST","T_NEW","T_CLONE","T_EXIT","T_IF","T_ELSEIF","T_ELSE","T_ENDIF","T_LNUMBER","T_DNUMBER","T_STRING","T_STRING_VARNAME","T_VARIABLE","T_NUM_STRING","T_INLINE_HTML","T_CHARACTER","T_BAD_CHARACTER","T_ENCAPSED_AND_WHITESPACE","T_CONSTANT_ENCAPSED_STRING","T_ECHO","T_DO","T_WHILE","T_ENDWHILE","T_FOR","T_ENDFOR","T_FOREACH","T_ENDFOREACH","T_DECLARE","T_ENDDECLARE","T_AS","T_SWITCH","T_ENDSWITCH","T_
 CASE","T_DEFAULT","T_BREAK","T_CONTINUE","T_GOTO","T_FUNCTION","T_CONST","T_RETURN","T_TRY","T_CATCH","T_THROW","T_USE","T_INSTEADOF","T_GLOBAL","T_STATIC","T_ABSTRACT","T_FINAL","T_PRIVATE","T_PROTECTED","T_PUBLIC","T_VAR","T_UNSET","T_ISSET","T_EMPTY","T_HALT_COMPILER","T_CLASS","T_TRAIT","T_INTERFACE","T_EXTENDS","T_IMPLEMENTS","T_OBJECT_OPERATOR","T_DOUBLE_ARROW","T_LIST","T_ARRAY","T_CALLABLE","T_CLASS_C","T_TRAIT_C","T_METHOD_C","T_FUNC_C","T_LINE","T_FILE","T_COMMENT","T_DOC_COMMENT","T_OPEN_TAG","T_OPEN_TAG_WITH_ECHO","T_CLOSE_TAG","T_WHITESPACE","T_START_HEREDOC","T_END_HEREDOC","T_DOLLAR_OPEN_CURLY_BRACES","T_CURLY_OPEN","T_PAAMAYIM_NEKUDOTAYIM","T_DOUBLE_COLON","T_NAMESPACE","T_NS_C","T_DIR","T_NS_SEPARATOR"];
+    var current = "UNKNOWN";
+    constants.some(function( constant ) {
+        if (PHP.Constants[ constant ] === token) {
+            current = constant;
+            return true;
+        } else {
+            return false;
+        }
+    });
+
+    return current;
+};
+
+/**
+ * Creates the token map.
+ *
+ * The token map maps the PHP internal token identifiers
+ * to the identifiers used by the PHP.Parser. Additionally it
+ * maps T_OPEN_TAG_WITH_ECHO to T_ECHO and T_CLOSE_TAG to ';'.
+ *
+ * @return array The token map
+ */
+
+PHP.Parser.prototype.createTokenMap = function() {
+    var tokenMap = {},
+    name,
+    i;
+    var T_DOUBLE_COLON = PHP.Constants.T_PAAMAYIM_NEKUDOTAYIM;
+    // 256 is the minimum possible token number, as everything below
+    // it is an ASCII value
+    for ( i = 256; i < 1000; ++i ) {
+        // T_DOUBLE_COLON is equivalent to T_PAAMAYIM_NEKUDOTAYIM
+        if ( T_DOUBLE_COLON === i ) {
+            tokenMap[ i ] = this.T_PAAMAYIM_NEKUDOTAYIM;
+        // T_OPEN_TAG_WITH_ECHO with dropped T_OPEN_TAG results in T_ECHO
+        } else if( PHP.Constants.T_OPEN_TAG_WITH_ECHO === i ) {
+            tokenMap[ i ] = PHP.Constants.T_ECHO;
+        // T_CLOSE_TAG is equivalent to ';'
+        } else if( PHP.Constants.T_CLOSE_TAG === i ) {
+            tokenMap[ i ] = 59;
+        // and the others can be mapped directly
+        } else if ( 'UNKNOWN' !== (name = this.tokenName( i ) ) ) { 
+            tokenMap[ i ] =  this[name];
+        }
+    }
+    return tokenMap;
+};
+
+var yynStandard = function () {
+    this.yyval =  this.yyastk[ this.stackPos-(1-1) ];
+};
+// todo fix
+
+PHP.Parser.prototype.MakeArray = function( arr ) {
+    return Array.isArray( arr ) ? arr : [ arr ];
+}
+
+
+PHP.Parser.prototype.parseString = function( str ) {
+    var bLength = 0;
+    if ('b' === str[0]) {
+        bLength = 1;
+    }
+
+    if ('\'' === str[ bLength ]) {
+        str = str.replace(
+            ['\\\\', '\\\''],
+            [  '\\',   '\'']);
+    } else {
+
+        str = this.parseEscapeSequences( str, '"');
+
+    }
+
+    return str;
+
+};
+
+PHP.Parser.prototype.parseEscapeSequences = function( str, quote ) {
+
+
+
+    if (undefined !== quote) {
+        str = str.replace(new RegExp('\\' + quote, "g"), quote);
+    }
+
+    var replacements = {
+        '\\': '\\',
+        '$':  '$',
+        'n': "\n",
+        'r': "\r",
+        't': "\t",
+        'f': "\f",
+        'v': "\v",
+        'e': "\x1B"
+    };
+
+    return str.replace(
+        /~\\\\([\\\\$nrtfve]|[xX][0-9a-fA-F]{1,2}|[0-7]{1,3})~/g,
+        function ( matches ){
+            var str = matches[1];
+
+            if ( replacements[ str ] !== undefined ) {
+                return replacements[ str ];
+            } else if ('x' === str[ 0 ] || 'X' === str[ 0 ]) {
+                return chr(hexdec(str));
+            } else {
+                return chr(octdec(str));
+            }
+        }
+        );
+
+    return str;
+};
+
+/* This is an automatically GENERATED file, which should not be manually edited.
+ * Instead edit one of the following:
+ *  * the grammar file grammar/zend_language_parser.jsy
+ *  * the parser skeleton grammar/kymacc.js.parser
+ *  * the preprocessing script grammar/rebuildParser.php
+ *
+ * The skeleton for this parser was written by Moriyoshi Koizumi and is based on
+ * the work by Masato Bito and is in the PUBLIC DOMAIN.
+ * Ported to JavaScript by Niklas von Hertzen
+ */
+
+PHP.Parser.prototype.TOKEN_NONE    = -1;
+PHP.Parser.prototype.TOKEN_INVALID = 149;
+
+PHP.Parser.prototype.TOKEN_MAP_SIZE = 384;
+
+PHP.Parser.prototype.YYLAST       = 913;
+PHP.Parser.prototype.YY2TBLSTATE  = 328;
+PHP.Parser.prototype.YYGLAST      = 415;
+PHP.Parser.prototype.YYNLSTATES   = 544;
+PHP.Parser.prototype.YYUNEXPECTED = 32767;
+PHP.Parser.prototype.YYDEFAULT    = -32766;
+
+// {{{ Tokens
+PHP.Parser.prototype.YYERRTOK = 256;
+PHP.Parser.prototype.T_INCLUDE = 257;
+PHP.Parser.prototype.T_INCLUDE_ONCE = 258;
+PHP.Parser.prototype.T_EVAL = 259;
+PHP.Parser.prototype.T_REQUIRE = 260;
+PHP.Parser.prototype.T_REQUIRE_ONCE = 261;
+PHP.Parser.prototype.T_LOGICAL_OR = 262;
+PHP.Parser.prototype.T_LOGICAL_XOR = 263;
+PHP.Parser.prototype.T_LOGICAL_AND = 264;
+PHP.Parser.prototype.T_PRINT = 265;
+PHP.Parser.prototype.T_PLUS_EQUAL = 266;
+PHP.Parser.prototype.T_MINUS_EQUAL = 267;
+PHP.Parser.prototype.T_MUL_EQUAL = 268;
+PHP.Parser.prototype.T_DIV_EQUAL = 269;
+PHP.Parser.prototype.T_CONCAT_EQUAL = 270;
+PHP.Parser.prototype.T_MOD_EQUAL = 271;
+PHP.Parser.prototype.T_AND_EQUAL = 272;
+PHP.Parser.prototype.T_OR_EQUAL = 273;
+PHP.Parser.prototype.T_XOR_EQUAL = 274;
+PHP.Parser.prototype.T_SL_EQUAL = 275;
+PHP.Parser.prototype.T_SR_EQUAL = 276;
+PHP.Parser.prototype.T_BOOLEAN_OR = 277;
+PHP.Parser.prototype.T_BOOLEAN_AND = 278;
+PHP.Parser.prototype.T_IS_EQUAL = 279;
+PHP.Parser.prototype.T_IS_NOT_EQUAL = 280;
+PHP.Parser.prototype.T_IS_IDENTICAL = 281;
+PHP.Parser.prototype.T_IS_NOT_IDENTICAL = 282;
+PHP.Parser.prototype.T_IS_SMALLER_OR_EQUAL = 283;
+PHP.Parser.prototype.T_IS_GREATER_OR_EQUAL = 284;
+PHP.Parser.prototype.T_SL = 285;
+PHP.Parser.prototype.T_SR = 286;
+PHP.Parser.prototype.T_INSTANCEOF = 287;
+PHP.Parser.prototype.T_INC = 288;
+PHP.Parser.prototype.T_DEC = 289;
+PHP.Parser.prototype.T_INT_CAST = 290;
+PHP.Parser.prototype.T_DOUBLE_CAST = 291;
+PHP.Parser.prototype.T_STRING_CAST = 292;
+PHP.Parser.prototype.T_ARRAY_CAST = 293;
+PHP.Parser.prototype.T_OBJECT_CAST = 294;
+PHP.Parser.prototype.T_BOOL_CAST = 295;
+PHP.Parser.prototype.T_UNSET_CAST = 296;
+PHP.Parser.prototype.T_NEW = 297;
+PHP.Parser.prototype.T_CLONE = 298;
+PHP.Parser.prototype.T_EXIT = 299;
+PHP.Parser.prototype.T_IF = 300;
+PHP.Parser.prototype.T_ELSEIF = 301;
+PHP.Parser.prototype.T_ELSE = 302;
+PHP.Parser.prototype.T_ENDIF = 303;
+PHP.Parser.prototype.T_LNUMBER = 304;
+PHP.Parser.prototype.T_DNUMBER = 305;
+PHP.Parser.prototype.T_STRING = 306;
+PHP.Parser.prototype.T_STRING_VARNAME = 307;
+PHP.Parser.prototype.T_VARIABLE = 308;
+PHP.Parser.prototype.T_NUM_STRING = 309;
+PHP.Parser.prototype.T_INLINE_HTML = 310;
+PHP.Parser.prototype.T_CHARACTER = 311;
+PHP.Parser.prototype.T_BAD_CHARACTER = 312;
+PHP.Parser.prototype.T_ENCAPSED_AND_WHITESPACE = 313;
+PHP.Parser.prototype.T_CONSTANT_ENCAPSED_STRING = 314;
+PHP.Parser.prototype.T_ECHO = 315;
+PHP.Parser.prototype.T_DO = 316;
+PHP.Parser.prototype.T_WHILE = 317;
+PHP.Parser.prototype.T_ENDWHILE = 318;
+PHP.Parser.prototype.T_FOR = 319;
+PHP.Parser.prototype.T_ENDFOR = 320;
+PHP.Parser.prototype.T_FOREACH = 321;
+PHP.Parser.prototype.T_ENDFOREACH = 322;
+PHP.Parser.prototype.T_DECLARE = 323;
+PHP.Parser.prototype.T_ENDDECLARE = 324;
+PHP.Parser.prototype.T_AS = 325;
+PHP.Parser.prototype.T_SWITCH = 326;
+PHP.Parser.prototype.T_ENDSWITCH = 327;
+PHP.Parser.prototype.T_CASE = 328;
+PHP.Parser.prototype.T_DEFAULT = 329;
+PHP.Parser.prototype.T_BREAK = 330;
+PHP.Parser.prototype.T_CONTINUE = 331;
+PHP.Parser.prototype.T_GOTO = 332;
+PHP.Parser.prototype.T_FUNCTION = 333;
+PHP.Parser.prototype.T_CONST = 334;
+PHP.Parser.prototype.T_RETURN = 335;
+PHP.Parser.prototype.T_TRY = 336;
+PHP.Parser.prototype.T_CATCH = 337;
+PHP.Parser.prototype.T_THROW = 338;
+PHP.Parser.prototype.T_USE = 339;
+PHP.Parser.prototype.T_INSTEADOF = 340;
+PHP.Parser.prototype.T_GLOBAL = 341;
+PHP.Parser.prototype.T_STATIC = 342;
+PHP.Parser.prototype.T_ABSTRACT = 343;
+PHP.Parser.prototype.T_FINAL = 344;
+PHP.Parser.prototype.T_PRIVATE = 345;
+PHP.Parser.prototype.T_PROTECTED = 346;
+PHP.Parser.prototype.T_PUBLIC = 347;
+PHP.Parser.prototype.T_VAR = 348;
+PHP.Parser.prototype.T_UNSET = 349;
+PHP.Parser.prototype.T_ISSET = 350;
+PHP.Parser.prototype.T_EMPTY = 351;
+PHP.Parser.prototype.T_HALT_COMPILER = 352;
+PHP.Parser.prototype.T_CLASS = 353;
+PHP.Parser.prototype.T_TRAIT = 354;
+PHP.Parser.prototype.T_INTERFACE = 355;
+PHP.Parser.prototype.T_EXTENDS = 356;
+PHP.Parser.prototype.T_IMPLEMENTS = 357;
+PHP.Parser.prototype.T_OBJECT_OPERATOR = 358;
+PHP.Parser.prototype.T_DOUBLE_ARROW = 359;
+PHP.Parser.prototype.T_LIST = 360;
+PHP.Parser.prototype.T_ARRAY = 361;
+PHP.Parser.prototype.T_CALLABLE = 362;
+PHP.Parser.prototype.T_CLASS_C = 363;
+PHP.Parser.prototype.T_TRAIT_C = 364;
+PHP.Parser.prototype.T_METHOD_C = 365;
+PHP.Parser.prototype.T_FUNC_C = 366;
+PHP.Parser.prototype.T_LINE = 367;
+PHP.Parser.prototype.T_FILE = 368;
+PHP.Parser.prototype.T_COMMENT = 369;
+PHP.Parser.prototype.T_DOC_COMMENT = 370;
+PHP.Parser.prototype.T_OPEN_TAG = 371;
+PHP.Parser.prototype.T_OPEN_TAG_WITH_ECHO = 372;
+PHP.Parser.prototype.T_CLOSE_TAG = 373;
+PHP.Parser.prototype.T_WHITESPACE = 374;
+PHP.Parser.prototype.T_START_HEREDOC = 375;
+PHP.Parser.prototype.T_END_HEREDOC = 376;
+PHP.Parser.prototype.T_DOLLAR_OPEN_CURLY_BRACES = 377;
+PHP.Parser.prototype.T_CURLY_OPEN = 378;
+PHP.Parser.prototype.T_PAAMAYIM_NEKUDOTAYIM = 379;
+PHP.Parser.prototype.T_NAMESPACE = 380;
+PHP.Parser.prototype.T_NS_C = 381;
+PHP.Parser.prototype.T_DIR = 382;
+PHP.Parser.prototype.T_NS_SEPARATOR = 383;
+// }}}
+
+/* @var array Map of token ids to their respective names */
+PHP.Parser.prototype.terminals = [
+    "$EOF",
+    "error",
+    "T_INCLUDE",
+    "T_INCLUDE_ONCE",
+    "T_EVAL",
+    "T_REQUIRE",
+    "T_REQUIRE_ONCE",
+    "','",
+    "T_LOGICAL_OR",
+    "T_LOGICAL_XOR",
+    "T_LOGICAL_AND",
+    "T_PRINT",
+    "'='",
+    "T_PLUS_EQUAL",
+    "T_MINUS_EQUAL",
+    "T_MUL_EQUAL",
+    "T_DIV_EQUAL",
+    "T_CONCAT_EQUAL",
+    "T_MOD_EQUAL",
+    "T_AND_EQUAL",
+    "T_OR_EQUAL",
+    "T_XOR_EQUAL",
+    "T_SL_EQUAL",
+    "T_SR_EQUAL",
+    "'?'",
+    "':'",
+    "T_BOOLEAN_OR",
+    "T_BOOLEAN_AND",
+    "'|'",
+    "'^'",
+    "'&'",
+    "T_IS_EQUAL",
+    "T_IS_NOT_EQUAL",
+    "T_IS_IDENTICAL",
+    "T_IS_NOT_IDENTICAL",
+    "'<'",
+    "T_IS_SMALLER_OR_EQUAL",
+    "'>'",
+    "T_IS_GREATER_OR_EQUAL",
+    "T_SL",
+    "T_SR",
+    "'+'",
+    "'-'",
+    "'.'",
+    "'*'",
+    "'/'",
+    "'%'",
+    "'!'",
+    "T_INSTANCEOF",
+    "'~'",
+    "T_INC",
+    "T_DEC",
+    "T_INT_CAST",
+    "T_DOUBLE_CAST",
+    "T_STRING_CAST",
+    "T_ARRAY_CAST",
+    "T_OBJECT_CAST",
+    "T_BOOL_CAST",
+    "T_UNSET_CAST",
+    "'@'",
+    "'['",
+    "T_NEW",
+    "T_CLONE",
+    "T_EXIT",
+    "T_IF",
+    "T_ELSEIF",
+    "T_ELSE",
+    "T_ENDIF",
+    "T_LNUMBER",
+    "T_DNUMBER",
+    "T_STRING",
+    "T_STRING_VARNAME",
+    "T_VARIABLE",
+    "T_NUM_STRING",
+    "T_INLINE_HTML",
+    "T_ENCAPSED_AND_WHITESPACE",
+    "T_CONSTANT_ENCAPSED_STRING",
+    "T_ECHO",
+    "T_DO",
+    "T_WHILE",
+    "T_ENDWHILE",
+    "T_FOR",
+    "T_ENDFOR",
+    "T_FOREACH",
+    "T_ENDFOREACH",
+    "T_DECLARE",
+    "T_ENDDECLARE",
+    "T_AS",
+    "T_SWITCH",
+    "T_ENDSWITCH",
+    "T_CASE",
+    "T_DEFAULT",
+    "T_BREAK",
+    "T_CONTINUE",
+    "T_GOTO",
+    "T_FUNCTION",
+    "T_CONST",
+    "T_RETURN",
+    "T_TRY",
+    "T_CATCH",
+    "T_THROW",
+    "T_USE",
+    "T_INSTEADOF",
+    "T_GLOBAL",
+    "T_STATIC",
+    "T_ABSTRACT",
+    "T_FINAL",
+    "T_PRIVATE",
+    "T_PROTECTED",
+    "T_PUBLIC",
+    "T_VAR",
+    "T_UNSET",
+    "T_ISSET",
+    "T_EMPTY",
+    "T_HALT_COMPILER",
+    "T_CLASS",
+    "T_TRAIT",
+    "T_INTERFACE",
+    "T_EXTENDS",
+    "T_IMPLEMENTS",
+    "T_OBJECT_OPERATOR",
+    "T_DOUBLE_ARROW",
+    "T_LIST",
+    "T_ARRAY",
+    "T_CALLABLE",
+    "T_CLASS_C",
+    "T_TRAIT_C",
+    "T_METHOD_C",
+    "T_FUNC_C",
+    "T_LINE",
+    "T_FILE",
+    "T_START_HEREDOC",
+    "T_END_HEREDOC",
+    "T_DOLLAR_OPEN_CURLY_BRACES",
+    "T_CURLY_OPEN",
+    "T_PAAMAYIM_NEKUDOTAYIM",
+    "T_NAMESPACE",
+    "T_NS_C",
+    "T_DIR",
+    "T_NS_SEPARATOR",
+    "';'",
+    "'{'",
+    "'}'",
+    "'('",
+    "')'",
+    "'$'",
+    "']'",
+    "'`'",
+    "'\"'"
+    , "???"
+];
+
+/* @var Map which translates lexer tokens to internal tokens */
+PHP.Parser.prototype.translate = [
+        0,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  149,  149,   47,  148,  149,  145,   46,   30,  149,
+      143,  144,   44,   41,    7,   42,   43,   45,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,   25,  140,
+       35,   12,   37,   24,   59,  149,  149,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,   60,  149,  146,   29,  149,  147,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  149,  149,  141,   28,  142,   49,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,  149,  149,  149,  149,
+      149,  149,  149,  149,  149,  149,    1,    2,    3,    4,
+        5,    6,    8,    9,   10,   11,   13,   14,   15,   16,
+       17,   18,   19,   20,   21,   22,   23,   26,   27,   31,
+       32,   33,   34,   36,   38,   39,   40,   48,   50,   51,
+       52,   53,   54,   55,   56,   57,   58,   61,   62,   63,
+       64,   65,   66,   67,   68,   69,   70,   71,   72,   73,
+       74,  149,  149,   75,   76,   77,   78,   79,   80,   81,
+       82,   83,   84,   85,   86,   87,   88,   89,   90,   91,
+       92,   93,   94,   95,   96,   97,   98,   99,  100,  101,
+      102,  103,  104,  105,  106,  107,  108,  109,  110,  111,
+      112,  113,  114,  115,  116,  117,  118,  119,  120,  121,
+      122,  123,  124,  125,  126,  127,  128,  129,  130,  149,
+      149,  149,  149,  149,  149,  131,  132,  133,  134,  135,
+      136,  137,  138,  139
+];
+
+PHP.Parser.prototype.yyaction = [
+       61,   62,  363,   63,   64,-32766,-32766,-32766,  509,   65,
+      708,  709,  710,  707,  706,  705,-32766,-32766,-32766,-32766,
+    -32766,-32766,  132,-32766,-32766,-32766,-32766,-32766,-32767,-32767,
+    -32767,-32767,-32766,  335,-32766,-32766,-32766,-32766,-32766,   66,
+       67,  351,  663,  664,   40,   68,  548,   69,  232,  233,
+       70,   71,   72,   73,   74,   75,   76,   77,   30,  246,
+       78,  336,  364, -112,    0,  469,  833,  834,  365,  641,
+      890,  436,  590,   41,  835,   53,   27,  366,  294,  367,
+      687,  368,  921,  369,  923,  922,  370,-32766,-32766,-32766,
+       42,   43,  371,  339,  126,   44,  372,  337,   79,  297,
+      349,  292,  293,-32766,  918,-32766,-32766,  373,  374,  375,
+      376,  377,  391,  199,  361,  338,  573,  613,  378,  379,
+      380,  381,  845,  839,  840,  841,  842,  836,  837,  253,
+    -32766,   87,   88,   89,  391,  843,  838,  338,  597,  519,
+      128,   80,  129,  273,  332,  257,  261,   47,  673,   90,
+       91,   92,   93,   94,   95,   96,   97,   98,   99,  100,
+      101,  102,  103,  104,  105,  106,  107,  108,  109,  110,
+      799,  247,  884,  108,  109,  110,  226,  247,   21,-32766,
+      310,-32766,-32766,-32766,  642,  548,-32766,-32766,-32766,-32766,
+       56,  353,-32766,-32766,-32766,   55,-32766,-32766,-32766,-32766,
+    -32766,   58,-32766,-32766,-32766,-32766,-32766,-32766,-32766,-32766,
+    -32766,  557,-32766,-32766,  518,-32766,  548,  890,-32766,  390,
+    -32766,  228,  252,-32766,-32766,-32766,-32766,-32766,  275,-32766,
+      234,-32766,  587,  588,-32766,-32766,-32766,-32766,-32766,-32766,
+    -32766,   46,  236,-32766,-32766,  281,-32766,  682,  348,-32766,
+      390,-32766,  346,  333,  521,-32766,-32766,-32766,  271,  911,
+      262,  237,  446,  911,-32766,  894,   59,  700,  358,  135,
+      548,  123,  538,   35,-32766,  333,  122,-32766,-32766,-32766,
+      271,-32766,  124,-32766,  692,-32766,-32766,-32766,-32766,  700,
+      273,   22,-32766,-32766,-32766,-32766,  239,-32766,-32766,  612,
+    -32766,  548,  134,-32766,  390,-32766,  462,  354,-32766,-32766,
+    -32766,-32766,-32766,  227,-32766,  238,-32766,  845,  542,-32766,
+      856,  611,  200,-32766,-32766,-32766,  259,  280,-32766,-32766,
+      201,-32766,  855,  129,-32766,  390,  130,  202,  333,  206,
+    -32766,-32766,-32766,  271,-32766,-32766,-32766,  125,  601,-32766,
+      136,  299,  700,  489,   28,  548,  105,  106,  107,-32766,
+      498,  499,-32766,-32766,-32766,  207,-32766,  133,-32766,  525,
+    -32766,-32766,-32766,-32766,  663,  664,  527,-32766,-32766,-32766,
+    -32766,  528,-32766,-32766,  610,-32766,  548,  427,-32766,  390,
+    -32766,  532,  539,-32766,-32766,-32766,-32766,-32766,  240,-32766,
+      247,-32766,  697,  543,-32766,  554,  523,  608,-32766,-32766,
+    -32766,  686,  535,-32766,-32766,   54,-32766,   57,   60,-32766,
+      390,  246, -155,  278,  345,-32766,-32766,-32766,  506,  347,
+     -152,  471,  402,  403,-32766,  405,  404,  272,  493,  416,
+      548,  318,  417,  505,-32766,  517,  548,-32766,-32766,-32766,
+      549,-32766,  562,-32766,  916,-32766,-32766,-32766,-32766,  564,
+      826,  848,-32766,-32766,-32766,-32766,  694,-32766,-32766,  485,
+    -32766,  548,  487,-32766,  390,-32766,  504,  802,-32766,-32766,
+    -32766,-32766,-32766,  279,-32766,  911,-32766,  502,  492,-32766,
+      413,  483,  269,-32766,-32766,-32766,  243,  337,-32766,-32766,
+      418,-32766,  454,  229,-32766,  390,  274,  373,  374,  344,
+    -32766,-32766,-32766,  360,  614,-32766,  573,  613,  378,  379,
+     -274,  548,  615, -332,  844,-32766,  258,   51,-32766,-32766,
+    -32766,  270,-32766,  346,-32766,   52,-32766,  260,    0,-32766,
+     -333,-32766,-32766,-32766,-32766,-32766,-32766,  205,-32766,-32766,
+       49,-32766,  548,  424,-32766,  390,-32766, -266,  264,-32766,
+    -32766,-32766,-32766,-32766,  409,-32766,  343,-32766,  265,  312,
+    -32766,  470,  513, -275,-32766,-32766,-32766,  920,  337,-32766,
+    -32766,  530,-32766,  531,  600,-32766,  390,  592,  373,  374,
+      578,  581,-32766,-32766,  644,  629,-32766,  573,  613,  378,
+      379,  635,  548,  636,  576,  627,-32766,  625,  693,-32766,
+    -32766,-32766,  691,-32766,  591,-32766,  582,-32766,  203,  204,
+    -32766,  584,  583,-32766,-32766,-32766,-32766,  586,  599,-32766,
+    -32766,  589,-32766,  690,  558,-32766,  390,  197,  683,  919,
+       86,  520,  522,-32766,  524,  833,  834,  529,  533,-32766,
+      534,  537,  541,  835,   48,  111,  112,  113,  114,  115,
+      116,  117,  118,  119,  120,  121,  127,   31,  633,  337,
+      330,  634,  585,-32766,   32,  291,  337,  330,  478,  373,
+      374,  917,  291,  891,  889,  875,  373,  374,  553,  613,
+      378,  379,  737,  739,  887,  553,  613,  378,  379,  824,
+      451,  675,  839,  840,  841,  842,  836,  837,  320,  895,
+      277,  885,   23,   33,  843,  838,  556,  277,  337,  330,
+    -32766,   34,-32766,  555,  291,   36,   37,   38,  373,  374,
+       39,   45,   50,   81,   82,   83,   84,  553,  613,  378,
+      379,-32767,-32767,-32767,-32767,  103,  104,  105,  106,  107,
+      337,   85,  131,  137,  337,  138,  198,  224,  225,  277,
+      373,  374, -332,  230,  373,  374,   24,  337,  231,  573,
+      613,  378,  379,  573,  613,  378,  379,  373,  374,  235,
+      248,  249,  250,  337,  251,    0,  573,  613,  378,  379,
+      276,  329,  331,  373,  374,-32766,  337,  574,  490,  792,
+      337,  609,  573,  613,  378,  379,  373,  374,   25,  300,
+      373,  374,  319,  337,  795,  573,  613,  378,  379,  573,
+      613,  378,  379,  373,  374,  516,  355,  359,  445,  482,
+      796,  507,  573,  613,  378,  379,  508,  548,  337,  890,
+      775,  791,  337,  604,  803,  808,  806,  698,  373,  374,
+      888,  807,  373,  374,-32766,-32766,-32766,  573,  613,  378,
+      379,  573,  613,  378,  379,  873,  832,  804,  872,  851,
+    -32766,  809,-32766,-32766,-32766,-32766,  805,   20,   26,   29,
+      298,  480,  515,  770,  778,  827,  457,    0,  900,  455,
+      774,    0,    0,    0,  874,  870,  886,  823,  915,  852,
+      869,  488,    0,  391,  793,    0,  338,    0,    0,    0,
+      340,    0,  273
+];
+
+PHP.Parser.prototype.yycheck = [
+        2,    3,    4,    5,    6,    8,    9,   10,   70,   11,
+      104,  105,  106,  107,  108,  109,    8,    9,   10,    8,
+        9,   24,   60,   26,   27,   28,   29,   30,   31,   32,
+       33,   34,   24,    7,   26,   27,   28,   29,   30,   41,
+       42,    7,  123,  124,    7,   47,   70,   49,   50,   51,
+       52,   53,   54,   55,   56,   57,   58,   59,   60,   61,
+       62,   63,   64,  144,    0,   75,   68,   69,   70,   25,
+       72,   70,   74,    7,   76,   77,   78,   79,    7,   81,
+      142,   83,   70,   85,   72,   73,   88,    8,    9,   10,
+       92,   93,   94,   95,    7,   97,   98,   95,  100,    7,
+        7,  103,  104,   24,  142,   26,   27,  105,  106,  111,
+      112,  113,  136,    7,    7,  139,  114,  115,  116,  117,
+      122,  123,  132,  125,  126,  127,  128,  129,  130,  131,
+        8,    8,    9,   10,  136,  137,  138,  139,  140,  141,
+       25,  143,  141,  145,  142,  147,  148,   24,   72,   26,
+       27,   28,   29,   30,   31,   32,   33,   34,   35,   36,
+       37,   38,   39,   40,   41,   42,   43,   44,   45,   46,
+      144,   48,   72,   44,   45,   46,   30,   48,  144,   64,
+       72,    8,    9,   10,  140,   70,    8,    9,   10,   74,
+       60,   25,   77,   78,   79,   60,   81,   24,   83,   26,
+       85,   60,   24,   88,   26,   27,   28,   92,   93,   94,
+       64,  140,   97,   98,   70,  100,   70,   72,  103,  104,
+       74,  145,    7,   77,   78,   79,  111,   81,    7,   83,
+       30,   85,  140,  140,   88,    8,    9,   10,   92,   93,
+       94,  133,  134,   97,   98,  145,  100,  140,    7,  103,
+      104,   24,  139,   96,  141,  140,  141,  111,  101,   75,
+       75,   30,   70,   75,   64,   70,   60,  110,  121,   12,
+       70,  141,   25,  143,   74,   96,  141,   77,   78,   79,
+      101,   81,  141,   83,  140,   85,  140,  141,   88,  110,
+      145,  144,   92,   93,   94,   64,    7,   97,   98,  142,
+      100,   70,  141,  103,  104,   74,  145,  141,   77,   78,
+       79,  111,   81,    7,   83,   30,   85,  132,   25,   88,
+      132,  142,   12,   92,   93,   94,  120,   60,   97,   98,
+       12,  100,  148,  141,  103,  104,  141,   12,   96,   12,
+      140,  141,  111,  101,    8,    9,   10,  141,   25,   64,
+       90,   91,  110,   65,   66,   70,   41,   42,   43,   74,
+       65,   66,   77,   78,   79,   12,   81,   25,   83,   25,
+       85,  140,  141,   88,  123,  124,   25,   92,   93,   94,
+       64,   25,   97,   98,  142,  100,   70,  120,  103,  104,
+       74,   25,   25,   77,   78,   79,  111,   81,   30,   83,
+       48,   85,  140,  141,   88,  140,  141,   30,   92,   93,
+       94,  140,  141,   97,   98,   60,  100,   60,   60,  103,
+      104,   61,   72,   75,   70,  140,  141,  111,   67,   70,
+       87,   99,   70,   70,   64,   70,   72,  102,   89,   70,
+       70,   71,   70,   70,   74,   70,   70,   77,   78,   79,
+       70,   81,   70,   83,   70,   85,  140,  141,   88,   70,
+      144,   70,   92,   93,   94,   64,   70,   97,   98,   72,
+      100,   70,   72,  103,  104,   74,   72,   72,   77,   78,
+       79,  111,   81,   75,   83,   75,   85,   89,   86,   88,
+       79,  101,  118,   92,   93,   94,   87,   95,   97,   98,
+       87,  100,   87,   87,  103,  104,  118,  105,  106,   95,
+      140,  141,  111,   95,  115,   64,  114,  115,  116,  117,
+      135,   70,  115,  120,  132,   74,  120,  140,   77,   78,
+       79,  119,   81,  139,   83,  140,   85,  120,   -1,   88,
+      120,  140,  141,   92,   93,   94,   64,  121,   97,   98,
+      121,  100,   70,  122,  103,  104,   74,  135,  135,   77,
+       78,   79,  111,   81,  139,   83,  139,   85,  135,  135,
+       88,  135,  135,  135,   92,   93,   94,  142,   95,   97,
+       98,  140,  100,  140,  140,  103,  104,  140,  105,  106,
+      140,  140,  141,  111,  140,  140,   64,  114,  115,  116,
+      117,  140,   70,  140,  140,  140,   74,  140,  140,   77,
+       78,   79,  140,   81,  140,   83,  140,   85,   41,   42,
+       88,  140,  140,  141,   92,   93,   94,  140,  140,   97,
+       98,  140,  100,  140,  140,  103,  104,   60,  140,  142,
+      141,  141,  141,  111,  141,   68,   69,  141,  141,   72,
+      141,  141,  141,   76,   12,   13,   14,   15,   16,   17,
+       18,   19,   20,   21,   22,   23,  141,  143,  142,   95,
+       96,  142,  140,  141,  143,  101,   95,   96,  142,  105,
+      106,  142,  101,  142,  142,  142,  105,  106,  114,  115,
+      116,  117,   50,   51,  142,  114,  115,  116,  117,  142,
+      123,  142,  125,  126,  127,  128,  129,  130,  131,  142,
+      136,  142,  144,  143,  137,  138,  142,  136,   95,   96,
+      143,  143,  145,  142,  101,  143,  143,  143,  105,  106,
+      143,  143,  143,  143,  143,  143,  143,  114,  115,  116,
+      117,   35,   36,   37,   38,   39,   40,   41,   42,   43,
+       95,  143,  143,  143,   95,  143,  143,  143,  143,  136,
+      105,  106,  120,  143,  105,  106,  144,   95,  143,  114,
+      115,  116,  117,  114,  115,  116,  117,  105,  106,  143,
+      143,  143,  143,   95,  143,   -1,  114,  115,  116,  117,
+      143,  143,  143,  105,  106,  143,   95,  142,   80,  146,
+       95,  142,  114,  115,  116,  117,  105,  106,  144,  144,
+      105,  106,  144,   95,  142,  114,  115,  116,  117,  114,
+      115,  116,  117,  105,  106,   82,  144,  144,  144,  144,
+      142,   84,  114,  115,  116,  117,  144,   70,   95,   72,
+      144,  144,   95,  142,  144,  146,  144,  142,  105,  106,
+      146,  144,  105,  106,    8,    9,   10,  114,  115,  116,
+      117,  114,  115,  116,  117,  144,  144,  144,  144,  144,
+       24,  104,   26,   27,   28,   29,  144,  144,  144,  144,
+      144,  144,  144,  144,  144,  144,  144,   -1,  144,  144,
+      144,   -1,   -1,   -1,  146,  146,  146,  146,  146,  146,
+      146,  146,   -1,  136,  147,   -1,  139,   -1,   -1,   -1,
+      143,   -1,  145
+];
+
+PHP.Parser.prototype.yybase = [
+        0,  574,  581,  623,  655,    2,  718,  402,  747,  659,
+      672,  688,  743,  701,  705,  483,  483,  483,  483,  483,
+      351,  356,  366,  366,  367,  366,  344,   -2,   -2,   -2,
+      200,  200,  231,  231,  231,  231,  231,  231,  231,  231,
+      200,  231,  451,  482,  532,  316,  370,  115,  146,  285,
+      401,  401,  401,  401,  401,  401,  401,  401,  401,  401,
+      401,  401,  401,  401,  401,  401,  401,  401,  401,  401,
+      401,  401,  401,  401,  401,  401,  401,  401,  401,  401,
+      401,  401,  401,  401,  401,  401,  401,  401,  401,  401,
+      401,  401,  401,  401,  401,  401,  401,  401,  401,  401,
+      401,  401,  401,  401,  401,  401,  401,  401,  401,  401,
+      401,  401,  401,  401,  401,  401,  401,  401,  401,  401,
+      401,  401,  401,  401,  401,  401,  401,  401,  401,  401,
+      401,  401,  401,  401,  401,  401,  401,  401,  401,   44,
+      474,  429,  476,  481,  487,  488,  739,  740,  741,  734,
+      733,  416,  736,  539,  541,  342,  542,  543,  552,  557,
+      559,  536,  567,  737,  755,  569,  735,  738,  123,  123,
+      123,  123,  123,  123,  123,  123,  123,  122,   11,  336,
+      336,  336,  336,  336,  336,  336,  336,  336,  336,  336,
+      336,  336,  336,  336,  227,  227,  173,  577,  577,  577,
+      577,  577,  577,  577,  577,  577,  577,  577,   79,  178,
+      846,    8,   -3,   -3,   -3,   -3,  642,  706,  706,  706,
+      706,  157,  179,  242,  431,  431,  360,  431,  525,  368,
+      767,  767,  767,  767,  767,  767,  767,  767,  767,  767,
+      767,  767,  350,  375,  315,  315,  652,  652,  -81,  -81,
+      -81,  -81,  251,  185,  188,  184,  -62,  348,  195,  195,
+      195,  408,  392,  410,    1,  192,  129,  129,  129,  -24,
+      -24,  -24,  -24,  499,  -24,  -24,  -24,  113,  108,  108,
+       12,  161,  349,  526,  271,  398,  529,  438,  130,  206,
+      265,  427,   76,  414,  427,  288,  295,   76,  166,   44,
+      262,  422,  141,  491,  372,  494,  413,   71,   92,   93,
+      267,  135,  100,   34,  415,  745,  746,  742,  -38,  420,
+      -10,  135,  147,  744,  498,  107,   26,  493,  144,  377,
+      363,  369,  332,  363,  400,  377,  588,  377,  376,  377,
+      360,   37,  582,  376,  377,  374,  376,  388,  363,  364,
+      412,  369,  377,  441,  443,  390,  106,  332,  377,  390,
+      377,  400,   64,  590,  591,  323,  592,  589,  593,  649,
+      608,  362,  500,  399,  407,  620,  625,  636,  365,  354,
+      614,  524,  425,  359,  355,  423,  570,  578,  357,  406,
+      414,  394,  352,  403,  531,  433,  403,  653,  434,  385,
+      417,  411,  444,  310,  318,  501,  425,  668,  757,  380,
+      637,  684,  403,  609,  387,   87,  325,  638,  382,  403,
+      639,  403,  696,  503,  615,  403,  697,  384,  435,  425,
+      352,  352,  352,  700,   66,  699,  583,  702,  707,  704,
+      748,  721,  749,  584,  750,  358,  583,  722,  751,  682,
+      215,  613,  422,  436,  389,  447,  221,  257,  752,  403,
+      403,  506,  499,  403,  395,  685,  397,  426,  753,  392,
+      391,  647,  683,  403,  418,  754,  221,  723,  587,  724,
+      450,  568,  507,  648,  509,  327,  725,  353,  497,  610,
+      454,  622,  455,  461,  404,  510,  373,  732,  612,  247,
+      361,  664,  463,  405,  692,  641,  464,  465,  511,  343,
+      437,  335,  409,  396,  665,  293,  467,  468,  472,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,   -2,   -2,   -2,   -2,   -2,
+       -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,
+       -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,
+       -2,    0,    0,    0,   -2,   -2,   -2,   -2,   -2,   -2,
+       -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,
+       -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,
+       -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,
+       -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,
+       -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,
+       -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,
+       -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,
+       -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,
+       -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,
+       -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,   -2,
+       -2,   -2,   -2,  123,  123,  123,  123,  123,  123,  123,
+      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,
+      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,
+      123,  123,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,  123,  123,  123,  123,  123,  123,  123,  123,  123,
+      123,  123,  123,  123,  123,  123,  123,  123,  123,  123,
+      123,  767,  767,  767,  767,  767,  767,  767,  767,  767,
+      767,  767,  123,  123,  123,  123,  123,  123,  123,  123,
+        0,  129,  129,  129,  129,  -94,  -94,  -94,  767,  767,
+      767,  767,  767,  767,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,  -94,  -94,  129,  129,
+      767,  767,  -24,  -24,  -24,  -24,  -24,  108,  108,  108,
+      -24,  108,  145,  145,  145,  108,  108,  108,  100,  100,
+        0,    0,    0,    0,    0,    0,    0,  145,    0,    0,
+        0,  376,    0,    0,    0,  145,  260,  260,  221,  260,
+      260,  135,    0,    0,  425,  376,    0,  364,  376,    0,
+        0,    0,    0,    0,    0,  531,    0,   87,  637,  241,
+      425,    0,    0,    0,    0,    0,    0,    0,  425,  289,
+      289,  306,    0,  358,    0,    0,    0,  306,  241,    0,
+        0,  221
+];
+
+PHP.Parser.prototype.yydefault = [
+        3,32767,32767,    1,32767,32767,32767,32767,32767,32767,
+    32767,32767,32767,32767,32767,  104,   96,  110,   95,  106,
+    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
+      358,  358,  122,  122,  122,  122,  122,  122,  122,  122,
+      316,32767,32767,32767,32767,32767,32767,32767,32767,32767,
+      173,  173,  173,32767,  348,  348,  348,  348,  348,  348,
+      348,32767,32767,32767,32767,32767,32767,32767,32767,32767,
+    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
+    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
+    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
+    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
+    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
+    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
+    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
+    32767,  363,32767,32767,32767,32767,32767,32767,32767,32767,
+    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
+    32767,32767,32767,32767,32767,32767,32767,32767,  232,  233,
+      235,  236,  172,  125,  349,  362,  171,  199,  201,  250,
+      200,  177,  182,  183,  184,  185,  186,  187,  188,  189,
+      190,  191,  192,  176,  229,  228,  197,  313,  313,  316,
+    32767,32767,32767,32767,32767,32767,32767,32767,  198,  202,
+      204,  203,  219,  220,  217,  218,  175,  221,  222,  223,
+      224,  157,  157,  157,  357,  357,32767,  357,32767,32767,
+    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
+    32767,32767,  158,32767,  211,  212,  276,  276,  117,  117,
+      117,  117,  117,32767,32767,32767,32767,  284,32767,32767,
+    32767,32767,32767,  286,32767,32767,  206,  207,  205,32767,
+    32767,32767,32767,32767,32767,32767,32767,32767,  285,32767,
+    32767,32767,32767,32767,32767,32767,32767,  334,  321,  272,
+    32767,32767,32767,  265,32767,  107,  109,32767,32767,32767,
+    32767,  302,  339,32767,32767,32767,   17,32767,32767,32767,
+      370,  334,32767,32767,   19,32767,32767,32767,32767,  227,
+    32767,  338,  332,32767,32767,32767,32767,32767,32767,   63,
+    32767,32767,32767,32767,32767,   63,  281,   63,32767,   63,
+    32767,  315,  287,32767,   63,   74,32767,   72,32767,32767,
+       76,32767,   63,   93,   93,  254,  315,   54,   63,  254,
+       63,32767,32767,32767,32767,    4,32767,32767,32767,32767,
+    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
+    32767,32767,  267,32767,  323,32767,  337,  336,  324,32767,
+      265,32767,  215,  194,  266,32767,  196,32767,32767,  270,
+      273,32767,32767,32767,  134,32767,  268,  180,32767,32767,
+    32767,32767,  365,32767,32767,  174,32767,32767,32767,  130,
+    32767,   61,  332,32767,32767,  355,32767,32767,  332,  269,
+      208,  209,  210,32767,  121,32767,  310,32767,32767,32767,
+    32767,32767,32767,  327,32767,  333,32767,32767,32767,32767,
+      111,32767,  302,32767,32767,32767,   75,32767,32767,  178,
+      126,32767,32767,  364,32767,32767,32767,  320,32767,32767,
+    32767,32767,32767,   62,32767,32767,   77,32767,32767,32767,
+    32767,  332,32767,32767,32767,  115,32767,  169,32767,32767,
+    32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,
+    32767,  332,32767,32767,32767,32767,32767,32767,32767,    4,
+    32767,  151,32767,32767,32767,32767,32767,32767,32767,   25,
+       25,    3,  137,    3,  137,   25,  101,   25,   25,  137,
+       93,   93,   25,   25,   25,  144,   25,   25,   25,   25,
+       25,   25,   25,   25
+];
+
+PHP.Parser.prototype.yygoto = [
+      141,  141,  173,  173,  173,  173,  173,  173,  173,  173,
+      141,  173,  142,  143,  144,  148,  153,  155,  181,  175,
+      172,  172,  172,  172,  174,  174,  174,  174,  174,  174,
+      174,  168,  169,  170,  171,  179,  757,  758,  392,  760,
+      781,  782,  783,  784,  785,  786,  787,  789,  725,  145,
+      146,  147,  149,  150,  151,  152,  154,  177,  178,  180,
+      196,  208,  209,  210,  211,  212,  213,  214,  215,  217,
+      218,  219,  220,  244,  245,  266,  267,  268,  430,  431,
+      432,  182,  183,  184,  185,  186,  187,  188,  189,  190,
+      191,  192,  156,  157,  158,  159,  176,  160,  194,  161,
+      162,  163,  164,  195,  165,  193,  139,  166,  167,  452,
+      452,  452,  452,  452,  452,  452,  452,  452,  452,  452,
+      453,  453,  453,  453,  453,  453,  453,  453,  453,  453,
+      453,  551,  551,  551,  464,  491,  394,  394,  394,  394,
+      394,  394,  394,  394,  394,  394,  394,  394,  394,  394,
+      394,  394,  394,  394,  407,  552,  552,  552,  810,  810,
+      662,  662,  662,  662,  662,  594,  283,  595,  510,  399,
+      399,  567,  679,  632,  849,  850,  863,  660,  714,  426,
+      222,  622,  622,  622,  622,  223,  617,  623,  494,  395,
+      395,  395,  395,  395,  395,  395,  395,  395,  395,  395,
+      395,  395,  395,  395,  395,  395,  395,  465,  472,  514,
+      904,  398,  398,  425,  425,  459,  425,  419,  322,  421,
+      421,  393,  396,  412,  422,  428,  460,  463,  473,  481,
+      501,    5,  476,  284,  327,    1,   15,    2,    6,    7,
+      550,  550,  550,    8,    9,   10,  668,   16,   11,   17,
+       12,   18,   13,   19,   14,  704,  328,  881,  881,  643,
+      628,  626,  626,  624,  626,  526,  401,  652,  647,  847,
+      847,  847,  847,  847,  847,  847,  847,  847,  847,  847,
+      437,  438,  441,  447,  477,  479,  497,  290,  910,  910,
+      400,  400,  486,  880,  880,  263,  913,  910,  303,  255,
+      723,  306,  822,  821,  306,  896,  896,  896,  861,  304,
+      323,  410,  913,  913,  897,  316,  420,  769,  658,  559,
+      879,  671,  536,  324,  466,  565,  311,  311,  311,  801,
+      241,  676,  496,  439,  440,  442,  444,  448,  475,  631,
+      858,  311,  285,  286,  603,  495,  712,    0,  406,  321,
+        0,    0,    0,  314,    0,    0,  429,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,    0,  411
+];
+
+PHP.Parser.prototype.yygcheck = [
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   35,
+       35,   35,   35,   35,   35,   35,   35,   35,   35,   35,
+       86,   86,   86,   86,   86,   86,   86,   86,   86,   86,
+       86,    6,    6,    6,   21,   21,   35,   35,   35,   35,
+       35,   35,   35,   35,   35,   35,   35,   35,   35,   35,
+       35,   35,   35,   35,   71,    7,    7,    7,   35,   35,
+       35,   35,   35,   35,   35,   29,   44,   29,   35,   86,
+       86,   12,   12,   12,   12,   12,   12,   12,   12,   75,
+       40,   35,   35,   35,   35,   40,   35,   35,   35,   82,
+       82,   82,   82,   82,   82,   82,   82,   82,   82,   82,
+       82,   82,   82,   82,   82,   82,   82,   36,   36,   36,
+      104,   82,   82,   28,   28,   28,   28,   28,   28,   28,
+       28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
+       28,   13,   42,   42,   42,    2,   13,    2,   13,   13,
+        5,    5,    5,   13,   13,   13,   54,   13,   13,   13,
+       13,   13,   13,   13,   13,   67,   67,   83,   83,    5,
+        5,    5,    5,    5,    5,    5,    5,    5,    5,   93,
+       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,
+       52,   52,   52,   52,   52,   52,   52,    4,  105,  105,
+       89,   89,   94,   84,   84,   92,  105,  105,   26,   92,
+       71,    4,   91,   91,    4,   84,   84,   84,   97,   30,
+       70,   30,  105,  105,  102,   27,   30,   72,   50,   10,
+       84,   55,   46,    9,   30,   11,   90,   90,   90,   80,
+       30,   56,   30,   85,   85,   85,   85,   85,   85,   43,
+       96,   90,   44,   44,   34,   77,   69,   -1,    4,   90,
+       -1,   -1,   -1,    4,   -1,   -1,    4,   -1,   -1,   -1,
+       -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+       -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+       -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+       -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+       -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+       -1,   -1,   -1,   -1,   71
+];
+
+PHP.Parser.prototype.yygbase = [
+        0,    0, -286,    0,   10,  239,  130,  154,    0,  -10,
+       25,  -23,  -29, -289,    0,  -30,    0,    0,    0,    0,
+        0,   83,    0,    0,    0,    0,  245,   84,  -11,  142,
+      -28,    0,    0,    0,  -13,  -88,  -42,    0,    0,    0,
+     -344,    0,  -38,  -12, -188,    0,   23,    0,    0,    0,
+       66,    0,  247,    0,  205,   24,  -18,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,   13,    0,  -15,
+       85,   74,   70,    0,    0,  148,    0,  -14,    0,    0,
+       -6,    0,  -35,   11,   47,  278,  -77,    0,    0,   44,
+       68,   43,   38,   72,   94,    0,  -16,  109,    0,    0,
+        0,    0,   87,    0,  170,   34,    0
+];
+
+PHP.Parser.prototype.yygdefault = [
+    -32768,  362,    3,  546,  382,  570,  571,  572,  307,  305,
+      560,  566,  467,    4,  568,  140,  295,  575,  296,  500,
+      577,  414,  579,  580,  308,  309,  415,  315,  216,  593,
+      503,  313,  596,  357,  602,  301,  449,  383,  350,  461,
+      221,  423,  456,  630,  282,  638,  540,  646,  649,  450,
+      657,  352,  433,  434,  667,  672,  677,  680,  334,  325,
+      474,  684,  685,  256,  689,  511,  512,  703,  242,  711,
+      317,  724,  342,  788,  790,  397,  408,  484,  797,  326,
+      800,  384,  385,  386,  387,  435,  818,  815,  289,  866,
+      287,  443,  254,  853,  468,  356,  903,  862,  288,  388,
+      389,  302,  898,  341,  905,  912,  458
+];
+
+PHP.Parser.prototype.yylhs = [
+        0,    1,    2,    2,    4,    4,    3,    3,    3,    3,
+        3,    3,    3,    3,    3,    8,    8,   10,   10,   10,
+       10,    9,    9,   11,   13,   13,   14,   14,   14,   14,
+        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
+        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
+        5,    5,    5,    5,    5,    5,    5,    5,   33,   33,
+       34,   27,   27,   30,   30,    6,    7,    7,    7,   37,
+       37,   37,   38,   38,   41,   41,   39,   39,   42,   42,
+       22,   22,   29,   29,   32,   32,   31,   31,   43,   23,
+       23,   23,   23,   44,   44,   45,   45,   46,   46,   20,
+       20,   16,   16,   47,   18,   18,   48,   17,   17,   19,
+       19,   36,   36,   49,   49,   50,   50,   51,   51,   51,
+       51,   52,   52,   53,   53,   54,   54,   24,   24,   55,
+       55,   55,   25,   25,   56,   56,   40,   40,   57,   57,
+       57,   57,   62,   62,   63,   63,   64,   64,   64,   64,
+       65,   66,   66,   61,   61,   58,   58,   60,   60,   68,
+       68,   67,   67,   67,   67,   67,   67,   59,   59,   69,
+       69,   26,   26,   21,   21,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   15,   15,   15,   15,   15,   15,   15,
+       15,   15,   15,   71,   77,   77,   79,   79,   80,   81,
+       81,   81,   81,   81,   81,   86,   86,   35,   35,   35,
+       72,   72,   87,   87,   82,   82,   88,   88,   88,   88,
+       88,   73,   73,   73,   76,   76,   76,   78,   78,   93,
+       93,   93,   93,   93,   93,   93,   93,   93,   93,   93,
+       93,   93,   93,   12,   12,   12,   12,   12,   12,   74,
+       74,   74,   74,   94,   94,   96,   96,   95,   95,   97,
+       97,   28,   28,   28,   28,   99,   99,   98,   98,   98,
+       98,   98,  100,  100,   84,   84,   89,   89,   83,   83,
+      101,  101,  101,  101,   90,   90,   90,   90,   85,   85,
+       91,   91,   91,   70,   70,  102,  102,  102,   75,   75,
+      103,  103,  104,  104,  104,  104,   92,   92,   92,   92,
+      105,  105,  105,  105,  105,  105,  105,  106,  106,  106
+];
+
+PHP.Parser.prototype.yylen = [
+        1,    1,    2,    0,    1,    3,    1,    1,    1,    1,
+        3,    5,    4,    3,    3,    3,    1,    1,    3,    2,
+        4,    3,    1,    3,    2,    0,    1,    1,    1,    1,
+        3,    7,   10,    5,    7,    9,    5,    2,    3,    2,
+        3,    2,    3,    3,    3,    3,    1,    2,    5,    7,
+        8,   10,    5,    1,    5,    3,    3,    2,    1,    2,
+        8,    1,    3,    0,    1,    9,    7,    6,    5,    1,
+        2,    2,    0,    2,    0,    2,    0,    2,    1,    3,
+        1,    4,    1,    4,    1,    4,    1,    3,    3,    3,
+        4,    4,    5,    0,    2,    4,    3,    1,    1,    1,
+        4,    0,    2,    5,    0,    2,    6,    0,    2,    0,
+        3,    1,    0,    1,    3,    3,    5,    0,    1,    1,
+        1,    1,    0,    1,    3,    1,    2,    3,    1,    1,
+        2,    4,    3,    1,    1,    3,    2,    0,    3,    3,
+        8,    3,    1,    3,    0,    2,    4,    5,    4,    4,
+        3,    1,    1,    

<TRUNCATED>

[26/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/coffee/nodes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/coffee/nodes.js b/src/fauxton/assets/js/libs/ace/mode/coffee/nodes.js
new file mode 100644
index 0000000..b97dd58
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/coffee/nodes.js
@@ -0,0 +1,3080 @@
+/**
+ * Copyright (c) 2009-2013 Jeremy Ashkenas
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ */
+
+define(function(require, exports, module) {
+// Generated by CoffeeScript 1.6.3
+
+  var Access, Arr, Assign, Base, Block, Call, Class, Closure, Code, CodeFragment, Comment, Existence, Extends, For, IDENTIFIER, IDENTIFIER_STR, IS_STRING, If, In, Index, LEVEL_ACCESS, LEVEL_COND, LEVEL_LIST, LEVEL_OP, LEVEL_PAREN, LEVEL_TOP, Literal, METHOD_DEF, NEGATE, NO, Obj, Op, Param, Parens, RESERVED, Range, Return, SIMPLENUM, STRICT_PROSCRIBED, Scope, Slice, Splat, Switch, TAB, THIS, Throw, Try, UTILITIES, Value, While, YES, addLocationDataFn, compact, del, ends, extend, flatten, fragmentsToText, last, locationDataToString, merge, multident, some, starts, throwSyntaxError, unfoldSoak, utility, _ref, _ref1, _ref2, _ref3,
+    __hasProp = {}.hasOwnProperty,
+    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
+    __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
+    __slice = [].slice;
+
+  Error.stackTraceLimit = Infinity;
+
+  Scope = require('./scope').Scope;
+
+  _ref = require('./lexer'), RESERVED = _ref.RESERVED, STRICT_PROSCRIBED = _ref.STRICT_PROSCRIBED;
+
+  _ref1 = require('./helpers'), compact = _ref1.compact, flatten = _ref1.flatten, extend = _ref1.extend, merge = _ref1.merge, del = _ref1.del, starts = _ref1.starts, ends = _ref1.ends, last = _ref1.last, some = _ref1.some, addLocationDataFn = _ref1.addLocationDataFn, locationDataToString = _ref1.locationDataToString, throwSyntaxError = _ref1.throwSyntaxError;
+
+  exports.extend = extend;
+
+  exports.addLocationDataFn = addLocationDataFn;
+
+  YES = function() {
+    return true;
+  };
+
+  NO = function() {
+    return false;
+  };
+
+  THIS = function() {
+    return this;
+  };
+
+  NEGATE = function() {
+    this.negated = !this.negated;
+    return this;
+  };
+
+  exports.CodeFragment = CodeFragment = (function() {
+    function CodeFragment(parent, code) {
+      var _ref2;
+      this.code = "" + code;
+      this.locationData = parent != null ? parent.locationData : void 0;
+      this.type = (parent != null ? (_ref2 = parent.constructor) != null ? _ref2.name : void 0 : void 0) || 'unknown';
+    }
+
+    CodeFragment.prototype.toString = function() {
+      return "" + this.code + (this.locationData ? ": " + locationDataToString(this.locationData) : '');
+    };
+
+    return CodeFragment;
+
+  })();
+
+  fragmentsToText = function(fragments) {
+    var fragment;
+    return ((function() {
+      var _i, _len, _results;
+      _results = [];
+      for (_i = 0, _len = fragments.length; _i < _len; _i++) {
+        fragment = fragments[_i];
+        _results.push(fragment.code);
+      }
+      return _results;
+    })()).join('');
+  };
+
+  exports.Base = Base = (function() {
+    function Base() {}
+
+    Base.prototype.compile = function(o, lvl) {
+      return fragmentsToText(this.compileToFragments(o, lvl));
+    };
+
+    Base.prototype.compileToFragments = function(o, lvl) {
+      var node;
+      o = extend({}, o);
+      if (lvl) {
+        o.level = lvl;
+      }
+      node = this.unfoldSoak(o) || this;
+      node.tab = o.indent;
+      if (o.level === LEVEL_TOP || !node.isStatement(o)) {
+        return node.compileNode(o);
+      } else {
+        return node.compileClosure(o);
+      }
+    };
+
+    Base.prototype.compileClosure = function(o) {
+      var jumpNode;
+      if (jumpNode = this.jumps()) {
+        jumpNode.error('cannot use a pure statement in an expression');
+      }
+      o.sharedScope = true;
+      return Closure.wrap(this).compileNode(o);
+    };
+
+    Base.prototype.cache = function(o, level, reused) {
+      var ref, sub;
+      if (!this.isComplex()) {
+        ref = level ? this.compileToFragments(o, level) : this;
+        return [ref, ref];
+      } else {
+        ref = new Literal(reused || o.scope.freeVariable('ref'));
+        sub = new Assign(ref, this);
+        if (level) {
+          return [sub.compileToFragments(o, level), [this.makeCode(ref.value)]];
+        } else {
+          return [sub, ref];
+        }
+      }
+    };
+
+    Base.prototype.cacheToCodeFragments = function(cacheValues) {
+      return [fragmentsToText(cacheValues[0]), fragmentsToText(cacheValues[1])];
+    };
+
+    Base.prototype.makeReturn = function(res) {
+      var me;
+      me = this.unwrapAll();
+      if (res) {
+        return new Call(new Literal("" + res + ".push"), [me]);
+      } else {
+        return new Return(me);
+      }
+    };
+
+    Base.prototype.contains = function(pred) {
+      var node;
+      node = void 0;
+      this.traverseChildren(false, function(n) {
+        if (pred(n)) {
+          node = n;
+          return false;
+        }
+      });
+      return node;
+    };
+
+    Base.prototype.lastNonComment = function(list) {
+      var i;
+      i = list.length;
+      while (i--) {
+        if (!(list[i] instanceof Comment)) {
+          return list[i];
+        }
+      }
+      return null;
+    };
+
+    Base.prototype.toString = function(idt, name) {
+      var tree;
+      if (idt == null) {
+        idt = '';
+      }
+      if (name == null) {
+        name = this.constructor.name;
+      }
+      tree = '\n' + idt + name;
+      if (this.soak) {
+        tree += '?';
+      }
+      this.eachChild(function(node) {
+        return tree += node.toString(idt + TAB);
+      });
+      return tree;
+    };
+
+    Base.prototype.eachChild = function(func) {
+      var attr, child, _i, _j, _len, _len1, _ref2, _ref3;
+      if (!this.children) {
+        return this;
+      }
+      _ref2 = this.children;
+      for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+        attr = _ref2[_i];
+        if (this[attr]) {
+          _ref3 = flatten([this[attr]]);
+          for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
+            child = _ref3[_j];
+            if (func(child) === false) {
+              return this;
+            }
+          }
+        }
+      }
+      return this;
+    };
+
+    Base.prototype.traverseChildren = function(crossScope, func) {
+      return this.eachChild(function(child) {
+        var recur;
+        recur = func(child);
+        if (recur !== false) {
+          return child.traverseChildren(crossScope, func);
+        }
+      });
+    };
+
+    Base.prototype.invert = function() {
+      return new Op('!', this);
+    };
+
+    Base.prototype.unwrapAll = function() {
+      var node;
+      node = this;
+      while (node !== (node = node.unwrap())) {
+        continue;
+      }
+      return node;
+    };
+
+    Base.prototype.children = [];
+
+    Base.prototype.isStatement = NO;
+
+    Base.prototype.jumps = NO;
+
+    Base.prototype.isComplex = YES;
+
+    Base.prototype.isChainable = NO;
+
+    Base.prototype.isAssignable = NO;
+
+    Base.prototype.unwrap = THIS;
+
+    Base.prototype.unfoldSoak = NO;
+
+    Base.prototype.assigns = NO;
+
+    Base.prototype.updateLocationDataIfMissing = function(locationData) {
+      if (this.locationData) {
+        return this;
+      }
+      this.locationData = locationData;
+      return this.eachChild(function(child) {
+        return child.updateLocationDataIfMissing(locationData);
+      });
+    };
+
+    Base.prototype.error = function(message) {
+      return throwSyntaxError(message, this.locationData);
+    };
+
+    Base.prototype.makeCode = function(code) {
+      return new CodeFragment(this, code);
+    };
+
+    Base.prototype.wrapInBraces = function(fragments) {
+      return [].concat(this.makeCode('('), fragments, this.makeCode(')'));
+    };
+
+    Base.prototype.joinFragmentArrays = function(fragmentsList, joinStr) {
+      var answer, fragments, i, _i, _len;
+      answer = [];
+      for (i = _i = 0, _len = fragmentsList.length; _i < _len; i = ++_i) {
+        fragments = fragmentsList[i];
+        if (i) {
+          answer.push(this.makeCode(joinStr));
+        }
+        answer = answer.concat(fragments);
+      }
+      return answer;
+    };
+
+    return Base;
+
+  })();
+
+  exports.Block = Block = (function(_super) {
+    __extends(Block, _super);
+
+    function Block(nodes) {
+      this.expressions = compact(flatten(nodes || []));
+    }
+
+    Block.prototype.children = ['expressions'];
+
+    Block.prototype.push = function(node) {
+      this.expressions.push(node);
+      return this;
+    };
+
+    Block.prototype.pop = function() {
+      return this.expressions.pop();
+    };
+
+    Block.prototype.unshift = function(node) {
+      this.expressions.unshift(node);
+      return this;
+    };
+
+    Block.prototype.unwrap = function() {
+      if (this.expressions.length === 1) {
+        return this.expressions[0];
+      } else {
+        return this;
+      }
+    };
+
+    Block.prototype.isEmpty = function() {
+      return !this.expressions.length;
+    };
+
+    Block.prototype.isStatement = function(o) {
+      var exp, _i, _len, _ref2;
+      _ref2 = this.expressions;
+      for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+        exp = _ref2[_i];
+        if (exp.isStatement(o)) {
+          return true;
+        }
+      }
+      return false;
+    };
+
+    Block.prototype.jumps = function(o) {
+      var exp, _i, _len, _ref2;
+      _ref2 = this.expressions;
+      for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+        exp = _ref2[_i];
+        if (exp.jumps(o)) {
+          return exp;
+        }
+      }
+    };
+
+    Block.prototype.makeReturn = function(res) {
+      var expr, len;
+      len = this.expressions.length;
+      while (len--) {
+        expr = this.expressions[len];
+        if (!(expr instanceof Comment)) {
+          this.expressions[len] = expr.makeReturn(res);
+          if (expr instanceof Return && !expr.expression) {
+            this.expressions.splice(len, 1);
+          }
+          break;
+        }
+      }
+      return this;
+    };
+
+    Block.prototype.compileToFragments = function(o, level) {
+      if (o == null) {
+        o = {};
+      }
+      if (o.scope) {
+        return Block.__super__.compileToFragments.call(this, o, level);
+      } else {
+        return this.compileRoot(o);
+      }
+    };
+
+    Block.prototype.compileNode = function(o) {
+      var answer, compiledNodes, fragments, index, node, top, _i, _len, _ref2;
+      this.tab = o.indent;
+      top = o.level === LEVEL_TOP;
+      compiledNodes = [];
+      _ref2 = this.expressions;
+      for (index = _i = 0, _len = _ref2.length; _i < _len; index = ++_i) {
+        node = _ref2[index];
+        node = node.unwrapAll();
+        node = node.unfoldSoak(o) || node;
+        if (node instanceof Block) {
+          compiledNodes.push(node.compileNode(o));
+        } else if (top) {
+          node.front = true;
+          fragments = node.compileToFragments(o);
+          if (!node.isStatement(o)) {
+            fragments.unshift(this.makeCode("" + this.tab));
+            fragments.push(this.makeCode(";"));
+          }
+          compiledNodes.push(fragments);
+        } else {
+          compiledNodes.push(node.compileToFragments(o, LEVEL_LIST));
+        }
+      }
+      if (top) {
+        if (this.spaced) {
+          return [].concat(this.joinFragmentArrays(compiledNodes, '\n\n'), this.makeCode("\n"));
+        } else {
+          return this.joinFragmentArrays(compiledNodes, '\n');
+        }
+      }
+      if (compiledNodes.length) {
+        answer = this.joinFragmentArrays(compiledNodes, ', ');
+      } else {
+        answer = [this.makeCode("void 0")];
+      }
+      if (compiledNodes.length > 1 && o.level >= LEVEL_LIST) {
+        return this.wrapInBraces(answer);
+      } else {
+        return answer;
+      }
+    };
+
+    Block.prototype.compileRoot = function(o) {
+      var exp, fragments, i, name, prelude, preludeExps, rest, _i, _len, _ref2;
+      o.indent = o.bare ? '' : TAB;
+      o.level = LEVEL_TOP;
+      this.spaced = true;
+      o.scope = new Scope(null, this, null);
+      _ref2 = o.locals || [];
+      for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
+        name = _ref2[_i];
+        o.scope.parameter(name);
+      }
+      prelude = [];
+      if (!o.bare) {
+        preludeExps = (function() {
+          var _j, _len1, _ref3, _results;
+          _ref3 = this.expressions;
+          _results = [];
+          for (i = _j = 0, _len1 = _ref3.length; _j < _len1; i = ++_j) {
+            exp = _ref3[i];
+            if (!(exp.unwrap() instanceof Comment)) {
+              break;
+            }
+            _results.push(exp);
+          }
+          return _results;
+        }).call(this);
+        rest = this.expressions.slice(preludeExps.length);
+        this.expressions = preludeExps;
+        if (preludeExps.length) {
+          prelude = this.compileNode(merge(o, {
+            indent: ''
+          }));
+          prelude.push(this.makeCode("\n"));
+        }
+        this.expressions = rest;
+      }
+      fragments = this.compileWithDeclarations(o);
+      if (o.bare) {
+        return fragments;
+      }
+      return [].concat(prelude, this.makeCode("(function() {\n"), fragments, this.makeCode("\n}).call(this);\n"));
+    };
+
+    Block.prototype.compileWithDeclarations = function(o) {
+      var assigns, declars, exp, fragments, i, post, rest, scope, spaced, _i, _len, _ref2, _ref3, _ref4;
+      fragments = [];
+      post = [];
+      _ref2 = this.expressions;
+      for (i = _i = 0, _len = _ref2.length; _i < _len; i = ++_i) {
+        exp = _ref2[i];
+        exp = exp.unwrap();
+        if (!(exp instanceof Comment || exp instanceof Literal)) {
+          break;
+        }
+      }
+      o = merge(o, {
+        level: LEVEL_TOP
+      });
+      if (i) {
+        rest = this.expressions.splice(i, 9e9);
+        _ref3 = [this.spaced, false], spaced = _ref3[0], this.spaced = _ref3[1];
+        _ref4 = [this.compileNode(o), spaced], fragments = _ref4[0], this.spaced = _ref4[1];
+        this.expressions = rest;
+      }
+      post = this.compileNode(o);
+      scope = o.scope;
+      if (scope.expressions === this) {
+        declars = o.scope.hasDeclarations();
+        assigns = scope.hasAssignments;
+        if (declars || assigns) {
+          if (i) {
+            fragments.push(this.makeCode('\n'));
+          }
+          fragments.push(this.makeCode("" + this.tab + "var "));
+          if (declars) {
+            fragments.push(this.makeCode(scope.declaredVariables().join(', ')));
+          }
+          if (assigns) {
+            if (declars) {
+              fragments.push(this.makeCode(",\n" + (this.tab + TAB)));
+            }
+            fragments.push(this.makeCode(scope.assignedVariables().join(",\n" + (this.tab + TAB))));
+          }
+          fragments.push(this.makeCode(";\n" + (this.spaced ? '\n' : '')));
+        } else if (fragments.length && post.length) {
+          fragments.push(this.makeCode("\n"));
+        }
+      }
+      return fragments.concat(post);
+    };
+
+    Block.wrap = function(nodes) {
+      if (nodes.length === 1 && nodes[0] instanceof Block) {
+        return nodes[0];
+      }
+      return new Block(nodes);
+    };
+
+    return Block;
+
+  })(Base);
+
+  exports.Literal = Literal = (function(_super) {
+    __extends(Literal, _super);
+
+    function Literal(value) {
+      this.value = value;
+    }
+
+    Literal.prototype.makeReturn = function() {
+      if (this.isStatement()) {
+        return this;
+      } else {
+        return Literal.__super__.makeReturn.apply(this, arguments);
+      }
+    };
+
+    Literal.prototype.isAssignable = function() {
+      return IDENTIFIER.test(this.value);
+    };
+
+    Literal.prototype.isStatement = function() {
+      var _ref2;
+      return (_ref2 = this.value) === 'break' || _ref2 === 'continue' || _ref2 === 'debugger';
+    };
+
+    Literal.prototype.isComplex = NO;
+
+    Literal.prototype.assigns = function(name) {
+      return name === this.value;
+    };
+
+    Literal.prototype.jumps = function(o) {
+      if (this.value === 'break' && !((o != null ? o.loop : void 0) || (o != null ? o.block : void 0))) {
+        return this;
+      }
+      if (this.value === 'continue' && !(o != null ? o.loop : void 0)) {
+        return this;
+      }
+    };
+
+    Literal.prototype.compileNode = function(o) {
+      var answer, code, _ref2;
+      code = this.value === 'this' ? ((_ref2 = o.scope.method) != null ? _ref2.bound : void 0) ? o.scope.method.context : this.value : this.value.reserved ? "\"" + this.value + "\"" : this.value;
+      answer = this.isStatement() ? "" + this.tab + code + ";" : code;
+      return [this.makeCode(answer)];
+    };
+
+    Literal.prototype.toString = function() {
+      return ' "' + this.value + '"';
+    };
+
+    return Literal;
+
+  })(Base);
+
+  exports.Undefined = (function(_super) {
+    __extends(Undefined, _super);
+
+    function Undefined() {
+      _ref2 = Undefined.__super__.constructor.apply(this, arguments);
+      return _ref2;
+    }
+
+    Undefined.prototype.isAssignable = NO;
+
+    Undefined.prototype.isComplex = NO;
+
+    Undefined.prototype.compileNode = function(o) {
+      return [this.makeCode(o.level >= LEVEL_ACCESS ? '(void 0)' : 'void 0')];
+    };
+
+    return Undefined;
+
+  })(Base);
+
+  exports.Null = (function(_super) {
+    __extends(Null, _super);
+
+    function Null() {
+      _ref3 = Null.__super__.constructor.apply(this, arguments);
+      return _ref3;
+    }
+
+    Null.prototype.isAssignable = NO;
+
+    Null.prototype.isComplex = NO;
+
+    Null.prototype.compileNode = function() {
+      return [this.makeCode("null")];
+    };
+
+    return Null;
+
+  })(Base);
+
+  exports.Bool = (function(_super) {
+    __extends(Bool, _super);
+
+    Bool.prototype.isAssignable = NO;
+
+    Bool.prototype.isComplex = NO;
+
+    Bool.prototype.compileNode = function() {
+      return [this.makeCode(this.val)];
+    };
+
+    function Bool(val) {
+      this.val = val;
+    }
+
+    return Bool;
+
+  })(Base);
+
+  exports.Return = Return = (function(_super) {
+    __extends(Return, _super);
+
+    function Return(expr) {
+      if (expr && !expr.unwrap().isUndefined) {
+        this.expression = expr;
+      }
+    }
+
+    Return.prototype.children = ['expression'];
+
+    Return.prototype.isStatement = YES;
+
+    Return.prototype.makeReturn = THIS;
+
+    Return.prototype.jumps = THIS;
+
+    Return.prototype.compileToFragments = function(o, level) {
+      var expr, _ref4;
+      expr = (_ref4 = this.expression) != null ? _ref4.makeReturn() : void 0;
+      if (expr && !(expr instanceof Return)) {
+        return expr.compileToFragments(o, level);
+      } else {
+        return Return.__super__.compileToFragments.call(this, o, level);
+      }
+    };
+
+    Return.prototype.compileNode = function(o) {
+      var answer;
+      answer = [];
+      answer.push(this.makeCode(this.tab + ("return" + (this.expression ? " " : ""))));
+      if (this.expression) {
+        answer = answer.concat(this.expression.compileToFragments(o, LEVEL_PAREN));
+      }
+      answer.push(this.makeCode(";"));
+      return answer;
+    };
+
+    return Return;
+
+  })(Base);
+
+  exports.Value = Value = (function(_super) {
+    __extends(Value, _super);
+
+    function Value(base, props, tag) {
+      if (!props && base instanceof Value) {
+        return base;
+      }
+      this.base = base;
+      this.properties = props || [];
+      if (tag) {
+        this[tag] = true;
+      }
+      return this;
+    }
+
+    Value.prototype.children = ['base', 'properties'];
+
+    Value.prototype.add = function(props) {
+      this.properties = this.properties.concat(props);
+      return this;
+    };
+
+    Value.prototype.hasProperties = function() {
+      return !!this.properties.length;
+    };
+
+    Value.prototype.isArray = function() {
+      return !this.properties.length && this.base instanceof Arr;
+    };
+
+    Value.prototype.isComplex = function() {
+      return this.hasProperties() || this.base.isComplex();
+    };
+
+    Value.prototype.isAssignable = function() {
+      return this.hasProperties() || this.base.isAssignable();
+    };
+
+    Value.prototype.isSimpleNumber = function() {
+      return this.base instanceof Literal && SIMPLENUM.test(this.base.value);
+    };
+
+    Value.prototype.isString = function() {
+      return this.base instanceof Literal && IS_STRING.test(this.base.value);
+    };
+
+    Value.prototype.isAtomic = function() {
+      var node, _i, _len, _ref4;
+      _ref4 = this.properties.concat(this.base);
+      for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
+        node = _ref4[_i];
+        if (node.soak || node instanceof Call) {
+          return false;
+        }
+      }
+      return true;
+    };
+
+    Value.prototype.isStatement = function(o) {
+      return !this.properties.length && this.base.isStatement(o);
+    };
+
+    Value.prototype.assigns = function(name) {
+      return !this.properties.length && this.base.assigns(name);
+    };
+
+    Value.prototype.jumps = function(o) {
+      return !this.properties.length && this.base.jumps(o);
+    };
+
+    Value.prototype.isObject = function(onlyGenerated) {
+      if (this.properties.length) {
+        return false;
+      }
+      return (this.base instanceof Obj) && (!onlyGenerated || this.base.generated);
+    };
+
+    Value.prototype.isSplice = function() {
+      return last(this.properties) instanceof Slice;
+    };
+
+    Value.prototype.unwrap = function() {
+      if (this.properties.length) {
+        return this;
+      } else {
+        return this.base;
+      }
+    };
+
+    Value.prototype.cacheReference = function(o) {
+      var base, bref, name, nref;
+      name = last(this.properties);
+      if (this.properties.length < 2 && !this.base.isComplex() && !(name != null ? name.isComplex() : void 0)) {
+        return [this, this];
+      }
+      base = new Value(this.base, this.properties.slice(0, -1));
+      if (base.isComplex()) {
+        bref = new Literal(o.scope.freeVariable('base'));
+        base = new Value(new Parens(new Assign(bref, base)));
+      }
+      if (!name) {
+        return [base, bref];
+      }
+      if (name.isComplex()) {
+        nref = new Literal(o.scope.freeVariable('name'));
+        name = new Index(new Assign(nref, name.index));
+        nref = new Index(nref);
+      }
+      return [base.add(name), new Value(bref || base.base, [nref || name])];
+    };
+
+    Value.prototype.compileNode = function(o) {
+      var fragments, prop, props, _i, _len;
+      this.base.front = this.front;
+      props = this.properties;
+      fragments = this.base.compileToFragments(o, (props.length ? LEVEL_ACCESS : null));
+      if ((this.base instanceof Parens || props.length) && SIMPLENUM.test(fragmentsToText(fragments))) {
+        fragments.push(this.makeCode('.'));
+      }
+      for (_i = 0, _len = props.length; _i < _len; _i++) {
+        prop = props[_i];
+        fragments.push.apply(fragments, prop.compileToFragments(o));
+      }
+      return fragments;
+    };
+
+    Value.prototype.unfoldSoak = function(o) {
+      var _this = this;
+      return this.unfoldedSoak != null ? this.unfoldedSoak : this.unfoldedSoak = (function() {
+        var fst, i, ifn, prop, ref, snd, _i, _len, _ref4, _ref5;
+        if (ifn = _this.base.unfoldSoak(o)) {
+          (_ref4 = ifn.body.properties).push.apply(_ref4, _this.properties);
+          return ifn;
+        }
+        _ref5 = _this.properties;
+        for (i = _i = 0, _len = _ref5.length; _i < _len; i = ++_i) {
+          prop = _ref5[i];
+          if (!prop.soak) {
+            continue;
+          }
+          prop.soak = false;
+          fst = new Value(_this.base, _this.properties.slice(0, i));
+          snd = new Value(_this.base, _this.properties.slice(i));
+          if (fst.isComplex()) {
+            ref = new Literal(o.scope.freeVariable('ref'));
+            fst = new Parens(new Assign(ref, fst));
+            snd.base = ref;
+          }
+          return new If(new Existence(fst), snd, {
+            soak: true
+          });
+        }
+        return false;
+      })();
+    };
+
+    return Value;
+
+  })(Base);
+
+  exports.Comment = Comment = (function(_super) {
+    __extends(Comment, _super);
+
+    function Comment(comment) {
+      this.comment = comment;
+    }
+
+    Comment.prototype.isStatement = YES;
+
+    Comment.prototype.makeReturn = THIS;
+
+    Comment.prototype.compileNode = function(o, level) {
+      var code;
+      code = "/*" + (multident(this.comment, this.tab)) + (__indexOf.call(this.comment, '\n') >= 0 ? "\n" + this.tab : '') + "*/";
+      if ((level || o.level) === LEVEL_TOP) {
+        code = o.indent + code;
+      }
+      return [this.makeCode("\n"), this.makeCode(code)];
+    };
+
+    return Comment;
+
+  })(Base);
+
+  exports.Call = Call = (function(_super) {
+    __extends(Call, _super);
+
+    function Call(variable, args, soak) {
+      this.args = args != null ? args : [];
+      this.soak = soak;
+      this.isNew = false;
+      this.isSuper = variable === 'super';
+      this.variable = this.isSuper ? null : variable;
+    }
+
+    Call.prototype.children = ['variable', 'args'];
+
+    Call.prototype.newInstance = function() {
+      var base, _ref4;
+      base = ((_ref4 = this.variable) != null ? _ref4.base : void 0) || this.variable;
+      if (base instanceof Call && !base.isNew) {
+        base.newInstance();
+      } else {
+        this.isNew = true;
+      }
+      return this;
+    };
+
+    Call.prototype.superReference = function(o) {
+      var accesses, method;
+      method = o.scope.namedMethod();
+      if (method != null ? method.klass : void 0) {
+        accesses = [new Access(new Literal('__super__'))];
+        if (method["static"]) {
+          accesses.push(new Access(new Literal('constructor')));
+        }
+        accesses.push(new Access(new Literal(method.name)));
+        return (new Value(new Literal(method.klass), accesses)).compile(o);
+      } else if (method != null ? method.ctor : void 0) {
+        return "" + method.name + ".__super__.constructor";
+      } else {
+        return this.error('cannot call super outside of an instance method.');
+      }
+    };
+
+    Call.prototype.superThis = function(o) {
+      var method;
+      method = o.scope.method;
+      return (method && !method.klass && method.context) || "this";
+    };
+
+    Call.prototype.unfoldSoak = function(o) {
+      var call, ifn, left, list, rite, _i, _len, _ref4, _ref5;
+      if (this.soak) {
+        if (this.variable) {
+          if (ifn = unfoldSoak(o, this, 'variable')) {
+            return ifn;
+          }
+          _ref4 = new Value(this.variable).cacheReference(o), left = _ref4[0], rite = _ref4[1];
+        } else {
+          left = new Literal(this.superReference(o));
+          rite = new Value(left);
+        }
+        rite = new Call(rite, this.args);
+        rite.isNew = this.isNew;
+        left = new Literal("typeof " + (left.compile(o)) + " === \"function\"");
+        return new If(left, new Value(rite), {
+          soak: true
+        });
+      }
+      call = this;
+      list = [];
+      while (true) {
+        if (call.variable instanceof Call) {
+          list.push(call);
+          call = call.variable;
+          continue;
+        }
+        if (!(call.variable instanceof Value)) {
+          break;
+        }
+        list.push(call);
+        if (!((call = call.variable.base) instanceof Call)) {
+          break;
+        }
+      }
+      _ref5 = list.reverse();
+      for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
+        call = _ref5[_i];
+        if (ifn) {
+          if (call.variable instanceof Call) {
+            call.variable = ifn;
+          } else {
+            call.variable.base = ifn;
+          }
+        }
+        ifn = unfoldSoak(o, call, 'variable');
+      }
+      return ifn;
+    };
+
+    Call.prototype.compileNode = function(o) {
+      var arg, argIndex, compiledArgs, compiledArray, fragments, preface, _i, _len, _ref4, _ref5;
+      if ((_ref4 = this.variable) != null) {
+        _ref4.front = this.front;
+      }
+      compiledArray = Splat.compileSplattedArray(o, this.args, true);
+      if (compiledArray.length) {
+        return this.compileSplat(o, compiledArray);
+      }
+      compiledArgs = [];
+      _ref5 = this.args;
+      for (argIndex = _i = 0, _len = _ref5.length; _i < _len; argIndex = ++_i) {
+        arg = _ref5[argIndex];
+        if (argIndex) {
+          compiledArgs.push(this.makeCode(", "));
+        }
+        compiledArgs.push.apply(compiledArgs, arg.compileToFragments(o, LEVEL_LIST));
+      }
+      fragments = [];
+      if (this.isSuper) {
+        preface = this.superReference(o) + (".call(" + (this.superThis(o)));
+        if (compiledArgs.length) {
+          preface += ", ";
+        }
+        fragments.push(this.makeCode(preface));
+      } else {
+        if (this.isNew) {
+          fragments.push(this.makeCode('new '));
+        }
+        fragments.push.apply(fragments, this.variable.compileToFragments(o, LEVEL_ACCESS));
+        fragments.push(this.makeCode("("));
+      }
+      fragments.push.apply(fragments, compiledArgs);
+      fragments.push(this.makeCode(")"));
+      return fragments;
+    };
+
+    Call.prototype.compileSplat = function(o, splatArgs) {
+      var answer, base, fun, idt, name, ref;
+      if (this.isSuper) {
+        return [].concat(this.makeCode("" + (this.superReference(o)) + ".apply(" + (this.superThis(o)) + ", "), splatArgs, this.makeCode(")"));
+      }
+      if (this.isNew) {
+        idt = this.tab + TAB;
+        return [].concat(this.makeCode("(function(func, args, ctor) {\n" + idt + "ctor.prototype = func.prototype;\n" + idt + "var child = new ctor, result = func.apply(child, args);\n" + idt + "return Object(result) === result ? result : child;\n" + this.tab + "})("), this.variable.compileToFragments(o, LEVEL_LIST), this.makeCode(", "), splatArgs, this.makeCode(", function(){})"));
+      }
+      answer = [];
+      base = new Value(this.variable);
+      if ((name = base.properties.pop()) && base.isComplex()) {
+        ref = o.scope.freeVariable('ref');
+        answer = answer.concat(this.makeCode("(" + ref + " = "), base.compileToFragments(o, LEVEL_LIST), this.makeCode(")"), name.compileToFragments(o));
+      } else {
+        fun = base.compileToFragments(o, LEVEL_ACCESS);
+        if (SIMPLENUM.test(fragmentsToText(fun))) {
+          fun = this.wrapInBraces(fun);
+        }
+        if (name) {
+          ref = fragmentsToText(fun);
+          fun.push.apply(fun, name.compileToFragments(o));
+        } else {
+          ref = 'null';
+        }
+        answer = answer.concat(fun);
+      }
+      return answer = answer.concat(this.makeCode(".apply(" + ref + ", "), splatArgs, this.makeCode(")"));
+    };
+
+    return Call;
+
+  })(Base);
+
+  exports.Extends = Extends = (function(_super) {
+    __extends(Extends, _super);
+
+    function Extends(child, parent) {
+      this.child = child;
+      this.parent = parent;
+    }
+
+    Extends.prototype.children = ['child', 'parent'];
+
+    Extends.prototype.compileToFragments = function(o) {
+      return new Call(new Value(new Literal(utility('extends'))), [this.child, this.parent]).compileToFragments(o);
+    };
+
+    return Extends;
+
+  })(Base);
+
+  exports.Access = Access = (function(_super) {
+    __extends(Access, _super);
+
+    function Access(name, tag) {
+      this.name = name;
+      this.name.asKey = true;
+      this.soak = tag === 'soak';
+    }
+
+    Access.prototype.children = ['name'];
+
+    Access.prototype.compileToFragments = function(o) {
+      var name;
+      name = this.name.compileToFragments(o);
+      if (IDENTIFIER.test(fragmentsToText(name))) {
+        name.unshift(this.makeCode("."));
+      } else {
+        name.unshift(this.makeCode("["));
+        name.push(this.makeCode("]"));
+      }
+      return name;
+    };
+
+    Access.prototype.isComplex = NO;
+
+    return Access;
+
+  })(Base);
+
+  exports.Index = Index = (function(_super) {
+    __extends(Index, _super);
+
+    function Index(index) {
+      this.index = index;
+    }
+
+    Index.prototype.children = ['index'];
+
+    Index.prototype.compileToFragments = function(o) {
+      return [].concat(this.makeCode("["), this.index.compileToFragments(o, LEVEL_PAREN), this.makeCode("]"));
+    };
+
+    Index.prototype.isComplex = function() {
+      return this.index.isComplex();
+    };
+
+    return Index;
+
+  })(Base);
+
+  exports.Range = Range = (function(_super) {
+    __extends(Range, _super);
+
+    Range.prototype.children = ['from', 'to'];
+
+    function Range(from, to, tag) {
+      this.from = from;
+      this.to = to;
+      this.exclusive = tag === 'exclusive';
+      this.equals = this.exclusive ? '' : '=';
+    }
+
+    Range.prototype.compileVariables = function(o) {
+      var step, _ref4, _ref5, _ref6, _ref7;
+      o = merge(o, {
+        top: true
+      });
+      _ref4 = this.cacheToCodeFragments(this.from.cache(o, LEVEL_LIST)), this.fromC = _ref4[0], this.fromVar = _ref4[1];
+      _ref5 = this.cacheToCodeFragments(this.to.cache(o, LEVEL_LIST)), this.toC = _ref5[0], this.toVar = _ref5[1];
+      if (step = del(o, 'step')) {
+        _ref6 = this.cacheToCodeFragments(step.cache(o, LEVEL_LIST)), this.step = _ref6[0], this.stepVar = _ref6[1];
+      }
+      _ref7 = [this.fromVar.match(SIMPLENUM), this.toVar.match(SIMPLENUM)], this.fromNum = _ref7[0], this.toNum = _ref7[1];
+      if (this.stepVar) {
+        return this.stepNum = this.stepVar.match(SIMPLENUM);
+      }
+    };
+
+    Range.prototype.compileNode = function(o) {
+      var cond, condPart, from, gt, idx, idxName, known, lt, namedIndex, stepPart, to, varPart, _ref4, _ref5;
+      if (!this.fromVar) {
+        this.compileVariables(o);
+      }
+      if (!o.index) {
+        return this.compileArray(o);
+      }
+      known = this.fromNum && this.toNum;
+      idx = del(o, 'index');
+      idxName = del(o, 'name');
+      namedIndex = idxName && idxName !== idx;
+      varPart = "" + idx + " = " + this.fromC;
+      if (this.toC !== this.toVar) {
+        varPart += ", " + this.toC;
+      }
+      if (this.step !== this.stepVar) {
+        varPart += ", " + this.step;
+      }
+      _ref4 = ["" + idx + " <" + this.equals, "" + idx + " >" + this.equals], lt = _ref4[0], gt = _ref4[1];
+      condPart = this.stepNum ? +this.stepNum > 0 ? "" + lt + " " + this.toVar : "" + gt + " " + this.toVar : known ? ((_ref5 = [+this.fromNum, +this.toNum], from = _ref5[0], to = _ref5[1], _ref5), from <= to ? "" + lt + " " + to : "" + gt + " " + to) : (cond = this.stepVar ? "" + this.stepVar + " > 0" : "" + this.fromVar + " <= " + this.toVar, "" + cond + " ? " + lt + " " + this.toVar + " : " + gt + " " + this.toVar);
+      stepPart = this.stepVar ? "" + idx + " += " + this.stepVar : known ? namedIndex ? from <= to ? "++" + idx : "--" + idx : from <= to ? "" + idx + "++" : "" + idx + "--" : namedIndex ? "" + cond + " ? ++" + idx + " : --" + idx : "" + cond + " ? " + idx + "++ : " + idx + "--";
+      if (namedIndex) {
+        varPart = "" + idxName + " = " + varPart;
+      }
+      if (namedIndex) {
+        stepPart = "" + idxName + " = " + stepPart;
+      }
+      return [this.makeCode("" + varPart + "; " + condPart + "; " + stepPart)];
+    };
+
+    Range.prototype.compileArray = function(o) {
+      var args, body, cond, hasArgs, i, idt, post, pre, range, result, vars, _i, _ref4, _ref5, _results;
+      if (this.fromNum && this.toNum && Math.abs(this.fromNum - this.toNum) <= 20) {
+        range = (function() {
+          _results = [];
+          for (var _i = _ref4 = +this.fromNum, _ref5 = +this.toNum; _ref4 <= _ref5 ? _i <= _ref5 : _i >= _ref5; _ref4 <= _ref5 ? _i++ : _i--){ _results.push(_i); }
+          return _results;
+        }).apply(this);
+        if (this.exclusive) {
+          range.pop();
+        }
+        return [this.makeCode("[" + (range.join(', ')) + "]")];
+      }
+      idt = this.tab + TAB;
+      i = o.scope.freeVariable('i');
+      result = o.scope.freeVariable('results');
+      pre = "\n" + idt + result + " = [];";
+      if (this.fromNum && this.toNum) {
+        o.index = i;
+        body = fragmentsToText(this.compileNode(o));
+      } else {
+        vars = ("" + i + " = " + this.fromC) + (this.toC !== this.toVar ? ", " + this.toC : '');
+        cond = "" + this.fromVar + " <= " + this.toVar;
+        body = "var " + vars + "; " + cond + " ? " + i + " <" + this.equals + " " + this.toVar + " : " + i + " >" + this.equals + " " + this.toVar + "; " + cond + " ? " + i + "++ : " + i + "--";
+      }
+      post = "{ " + result + ".push(" + i + "); }\n" + idt + "return " + result + ";\n" + o.indent;
+      hasArgs = function(node) {
+        return node != null ? node.contains(function(n) {
+          return n instanceof Literal && n.value === 'arguments' && !n.asKey;
+        }) : void 0;
+      };
+      if (hasArgs(this.from) || hasArgs(this.to)) {
+        args = ', arguments';
+      }
+      return [this.makeCode("(function() {" + pre + "\n" + idt + "for (" + body + ")" + post + "}).apply(this" + (args != null ? args : '') + ")")];
+    };
+
+    return Range;
+
+  })(Base);
+
+  exports.Slice = Slice = (function(_super) {
+    __extends(Slice, _super);
+
+    Slice.prototype.children = ['range'];
+
+    function Slice(range) {
+      this.range = range;
+      Slice.__super__.constructor.call(this);
+    }
+
+    Slice.prototype.compileNode = function(o) {
+      var compiled, compiledText, from, fromCompiled, to, toStr, _ref4;
+      _ref4 = this.range, to = _ref4.to, from = _ref4.from;
+      fromCompiled = from && from.compileToFragments(o, LEVEL_PAREN) || [this.makeCode('0')];
+      if (to) {
+        compiled = to.compileToFragments(o, LEVEL_PAREN);
+        compiledText = fragmentsToText(compiled);
+        if (!(!this.range.exclusive && +compiledText === -1)) {
+          toStr = ', ' + (this.range.exclusive ? compiledText : SIMPLENUM.test(compiledText) ? "" + (+compiledText + 1) : (compiled = to.compileToFragments(o, LEVEL_ACCESS), "+" + (fragmentsToText(compiled)) + " + 1 || 9e9"));
+        }
+      }
+      return [this.makeCode(".slice(" + (fragmentsToText(fromCompiled)) + (toStr || '') + ")")];
+    };
+
+    return Slice;
+
+  })(Base);
+
+  exports.Obj = Obj = (function(_super) {
+    __extends(Obj, _super);
+
+    function Obj(props, generated) {
+      this.generated = generated != null ? generated : false;
+      this.objects = this.properties = props || [];
+    }
+
+    Obj.prototype.children = ['properties'];
+
+    Obj.prototype.compileNode = function(o) {
+      var answer, i, idt, indent, join, lastNoncom, node, prop, props, _i, _j, _len, _len1;
+      props = this.properties;
+      if (!props.length) {
+        return [this.makeCode(this.front ? '({})' : '{}')];
+      }
+      if (this.generated) {
+        for (_i = 0, _len = props.length; _i < _len; _i++) {
+          node = props[_i];
+          if (node instanceof Value) {
+            node.error('cannot have an implicit value in an implicit object');
+          }
+        }
+      }
+      idt = o.indent += TAB;
+      lastNoncom = this.lastNonComment(this.properties);
+      answer = [];
+      for (i = _j = 0, _len1 = props.length; _j < _len1; i = ++_j) {
+        prop = props[i];
+        join = i === props.length - 1 ? '' : prop === lastNoncom || prop instanceof Comment ? '\n' : ',\n';
+        indent = prop instanceof Comment ? '' : idt;
+        if (prop instanceof Assign && prop.variable instanceof Value && prop.variable.hasProperties()) {
+          prop.variable.error('Invalid object key');
+        }
+        if (prop instanceof Value && prop["this"]) {
+          prop = new Assign(prop.properties[0].name, prop, 'object');
+        }
+        if (!(prop instanceof Comment)) {
+          if (!(prop instanceof Assign)) {
+            prop = new Assign(prop, prop, 'object');
+          }
+          (prop.variable.base || prop.variable).asKey = true;
+        }
+        if (indent) {
+          answer.push(this.makeCode(indent));
+        }
+        answer.push.apply(answer, prop.compileToFragments(o, LEVEL_TOP));
+        if (join) {
+          answer.push(this.makeCode(join));
+        }
+      }
+      answer.unshift(this.makeCode("{" + (props.length && '\n')));
+      answer.push(this.makeCode("" + (props.length && '\n' + this.tab) + "}"));
+      if (this.front) {
+        return this.wrapInBraces(answer);
+      } else {
+        return answer;
+      }
+    };
+
+    Obj.prototype.assigns = function(name) {
+      var prop, _i, _len, _ref4;
+      _ref4 = this.properties;
+      for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
+        prop = _ref4[_i];
+        if (prop.assigns(name)) {
+          return true;
+        }
+      }
+      return false;
+    };
+
+    return Obj;
+
+  })(Base);
+
+  exports.Arr = Arr = (function(_super) {
+    __extends(Arr, _super);
+
+    function Arr(objs) {
+      this.objects = objs || [];
+    }
+
+    Arr.prototype.children = ['objects'];
+
+    Arr.prototype.compileNode = function(o) {
+      var answer, compiledObjs, fragments, index, obj, _i, _len;
+      if (!this.objects.length) {
+        return [this.makeCode('[]')];
+      }
+      o.indent += TAB;
+      answer = Splat.compileSplattedArray(o, this.objects);
+      if (answer.length) {
+        return answer;
+      }
+      answer = [];
+      compiledObjs = (function() {
+        var _i, _len, _ref4, _results;
+        _ref4 = this.objects;
+        _results = [];
+        for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
+          obj = _ref4[_i];
+          _results.push(obj.compileToFragments(o, LEVEL_LIST));
+        }
+        return _results;
+      }).call(this);
+      for (index = _i = 0, _len = compiledObjs.length; _i < _len; index = ++_i) {
+        fragments = compiledObjs[index];
+        if (index) {
+          answer.push(this.makeCode(", "));
+        }
+        answer.push.apply(answer, fragments);
+      }
+      if (fragmentsToText(answer).indexOf('\n') >= 0) {
+        answer.unshift(this.makeCode("[\n" + o.indent));
+        answer.push(this.makeCode("\n" + this.tab + "]"));
+      } else {
+        answer.unshift(this.makeCode("["));
+        answer.push(this.makeCode("]"));
+      }
+      return answer;
+    };
+
+    Arr.prototype.assigns = function(name) {
+      var obj, _i, _len, _ref4;
+      _ref4 = this.objects;
+      for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
+        obj = _ref4[_i];
+        if (obj.assigns(name)) {
+          return true;
+        }
+      }
+      return false;
+    };
+
+    return Arr;
+
+  })(Base);
+
+  exports.Class = Class = (function(_super) {
+    __extends(Class, _super);
+
+    function Class(variable, parent, body) {
+      this.variable = variable;
+      this.parent = parent;
+      this.body = body != null ? body : new Block;
+      this.boundFuncs = [];
+      this.body.classBody = true;
+    }
+
+    Class.prototype.children = ['variable', 'parent', 'body'];
+
+    Class.prototype.determineName = function() {
+      var decl, tail;
+      if (!this.variable) {
+        return null;
+      }
+      decl = (tail = last(this.variable.properties)) ? tail instanceof Access && tail.name.value : this.variable.base.value;
+      if (__indexOf.call(STRICT_PROSCRIBED, decl) >= 0) {
+        this.variable.error("class variable name may not be " + decl);
+      }
+      return decl && (decl = IDENTIFIER.test(decl) && decl);
+    };
+
+    Class.prototype.setContext = function(name) {
+      return this.body.traverseChildren(false, function(node) {
+        if (node.classBody) {
+          return false;
+        }
+        if (node instanceof Literal && node.value === 'this') {
+          return node.value = name;
+        } else if (node instanceof Code) {
+          node.klass = name;
+          if (node.bound) {
+            return node.context = name;
+          }
+        }
+      });
+    };
+
+    Class.prototype.addBoundFunctions = function(o) {
+      var bvar, lhs, _i, _len, _ref4;
+      _ref4 = this.boundFuncs;
+      for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
+        bvar = _ref4[_i];
+        lhs = (new Value(new Literal("this"), [new Access(bvar)])).compile(o);
+        this.ctor.body.unshift(new Literal("" + lhs + " = " + (utility('bind')) + "(" + lhs + ", this)"));
+      }
+    };
+
+    Class.prototype.addProperties = function(node, name, o) {
+      var assign, base, exprs, func, props;
+      props = node.base.properties.slice(0);
+      exprs = (function() {
+        var _results;
+        _results = [];
+        while (assign = props.shift()) {
+          if (assign instanceof Assign) {
+            base = assign.variable.base;
+            delete assign.context;
+            func = assign.value;
+            if (base.value === 'constructor') {
+              if (this.ctor) {
+                assign.error('cannot define more than one constructor in a class');
+              }
+              if (func.bound) {
+                assign.error('cannot define a constructor as a bound function');
+              }
+              if (func instanceof Code) {
+                assign = this.ctor = func;
+              } else {
+                this.externalCtor = o.scope.freeVariable('class');
+                assign = new Assign(new Literal(this.externalCtor), func);
+              }
+            } else {
+              if (assign.variable["this"]) {
+                func["static"] = true;
+                if (func.bound) {
+                  func.context = name;
+                }
+              } else {
+                assign.variable = new Value(new Literal(name), [new Access(new Literal('prototype')), new Access(base)]);
+                if (func instanceof Code && func.bound) {
+                  this.boundFuncs.push(base);
+                  func.bound = false;
+                }
+              }
+            }
+          }
+          _results.push(assign);
+        }
+        return _results;
+      }).call(this);
+      return compact(exprs);
+    };
+
+    Class.prototype.walkBody = function(name, o) {
+      var _this = this;
+      return this.traverseChildren(false, function(child) {
+        var cont, exps, i, node, _i, _len, _ref4;
+        cont = true;
+        if (child instanceof Class) {
+          return false;
+        }
+        if (child instanceof Block) {
+          _ref4 = exps = child.expressions;
+          for (i = _i = 0, _len = _ref4.length; _i < _len; i = ++_i) {
+            node = _ref4[i];
+            if (node instanceof Value && node.isObject(true)) {
+              cont = false;
+              exps[i] = _this.addProperties(node, name, o);
+            }
+          }
+          child.expressions = exps = flatten(exps);
+        }
+        return cont && !(child instanceof Class);
+      });
+    };
+
+    Class.prototype.hoistDirectivePrologue = function() {
+      var expressions, index, node;
+      index = 0;
+      expressions = this.body.expressions;
+      while ((node = expressions[index]) && node instanceof Comment || node instanceof Value && node.isString()) {
+        ++index;
+      }
+      return this.directives = expressions.splice(0, index);
+    };
+
+    Class.prototype.ensureConstructor = function(name, o) {
+      var missing, ref, superCall;
+      missing = !this.ctor;
+      this.ctor || (this.ctor = new Code);
+      this.ctor.ctor = this.ctor.name = name;
+      this.ctor.klass = null;
+      this.ctor.noReturn = true;
+      if (missing) {
+        if (this.parent) {
+          superCall = new Literal("" + name + ".__super__.constructor.apply(this, arguments)");
+        }
+        if (this.externalCtor) {
+          superCall = new Literal("" + this.externalCtor + ".apply(this, arguments)");
+        }
+        if (superCall) {
+          ref = new Literal(o.scope.freeVariable('ref'));
+          this.ctor.body.unshift(new Assign(ref, superCall));
+        }
+        this.addBoundFunctions(o);
+        if (superCall) {
+          this.ctor.body.push(ref);
+          this.ctor.body.makeReturn();
+        }
+        return this.body.expressions.unshift(this.ctor);
+      } else {
+        return this.addBoundFunctions(o);
+      }
+    };
+
+    Class.prototype.compileNode = function(o) {
+      var call, decl, klass, lname, name, params, _ref4;
+      decl = this.determineName();
+      name = decl || '_Class';
+      if (name.reserved) {
+        name = "_" + name;
+      }
+      lname = new Literal(name);
+      this.hoistDirectivePrologue();
+      this.setContext(name);
+      this.walkBody(name, o);
+      this.ensureConstructor(name, o);
+      this.body.spaced = true;
+      if (!(this.ctor instanceof Code)) {
+        this.body.expressions.unshift(this.ctor);
+      }
+      this.body.expressions.push(lname);
+      (_ref4 = this.body.expressions).unshift.apply(_ref4, this.directives);
+      call = Closure.wrap(this.body);
+      if (this.parent) {
+        this.superClass = new Literal(o.scope.freeVariable('super', false));
+        this.body.expressions.unshift(new Extends(lname, this.superClass));
+        call.args.push(this.parent);
+        params = call.variable.params || call.variable.base.params;
+        params.push(new Param(this.superClass));
+      }
+      klass = new Parens(call, true);
+      if (this.variable) {
+        klass = new Assign(this.variable, klass);
+      }
+      return klass.compileToFragments(o);
+    };
+
+    return Class;
+
+  })(Base);
+
+  exports.Assign = Assign = (function(_super) {
+    __extends(Assign, _super);
+
+    function Assign(variable, value, context, options) {
+      var forbidden, name, _ref4;
+      this.variable = variable;
+      this.value = value;
+      this.context = context;
+      this.param = options && options.param;
+      this.subpattern = options && options.subpattern;
+      forbidden = (_ref4 = (name = this.variable.unwrapAll().value), __indexOf.call(STRICT_PROSCRIBED, _ref4) >= 0);
+      if (forbidden && this.context !== 'object') {
+        this.variable.error("variable name may not be \"" + name + "\"");
+      }
+    }
+
+    Assign.prototype.children = ['variable', 'value'];
+
+    Assign.prototype.isStatement = function(o) {
+      return (o != null ? o.level : void 0) === LEVEL_TOP && (this.context != null) && __indexOf.call(this.context, "?") >= 0;
+    };
+
+    Assign.prototype.assigns = function(name) {
+      return this[this.context === 'object' ? 'value' : 'variable'].assigns(name);
+    };
+
+    Assign.prototype.unfoldSoak = function(o) {
+      return unfoldSoak(o, this, 'variable');
+    };
+
+    Assign.prototype.compileNode = function(o) {
+      var answer, compiledName, isValue, match, name, val, varBase, _ref4, _ref5, _ref6, _ref7;
+      if (isValue = this.variable instanceof Value) {
+        if (this.variable.isArray() || this.variable.isObject()) {
+          return this.compilePatternMatch(o);
+        }
+        if (this.variable.isSplice()) {
+          return this.compileSplice(o);
+        }
+        if ((_ref4 = this.context) === '||=' || _ref4 === '&&=' || _ref4 === '?=') {
+          return this.compileConditional(o);
+        }
+      }
+      compiledName = this.variable.compileToFragments(o, LEVEL_LIST);
+      name = fragmentsToText(compiledName);
+      if (!this.context) {
+        varBase = this.variable.unwrapAll();
+        if (!varBase.isAssignable()) {
+          this.variable.error("\"" + (this.variable.compile(o)) + "\" cannot be assigned");
+        }
+        if (!(typeof varBase.hasProperties === "function" ? varBase.hasProperties() : void 0)) {
+          if (this.param) {
+            o.scope.add(name, 'var');
+          } else {
+            o.scope.find(name);
+          }
+        }
+      }
+      if (this.value instanceof Code && (match = METHOD_DEF.exec(name))) {
+        if (match[1]) {
+          this.value.klass = match[1];
+        }
+        this.value.name = (_ref5 = (_ref6 = (_ref7 = match[2]) != null ? _ref7 : match[3]) != null ? _ref6 : match[4]) != null ? _ref5 : match[5];
+      }
+      val = this.value.compileToFragments(o, LEVEL_LIST);
+      if (this.context === 'object') {
+        return compiledName.concat(this.makeCode(": "), val);
+      }
+      answer = compiledName.concat(this.makeCode(" " + (this.context || '=') + " "), val);
+      if (o.level <= LEVEL_LIST) {
+        return answer;
+      } else {
+        return this.wrapInBraces(answer);
+      }
+    };
+
+    Assign.prototype.compilePatternMatch = function(o) {
+      var acc, assigns, code, fragments, i, idx, isObject, ivar, name, obj, objects, olen, ref, rest, splat, top, val, value, vvar, vvarText, _i, _len, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9;
+      top = o.level === LEVEL_TOP;
+      value = this.value;
+      objects = this.variable.base.objects;
+      if (!(olen = objects.length)) {
+        code = value.compileToFragments(o);
+        if (o.level >= LEVEL_OP) {
+          return this.wrapInBraces(code);
+        } else {
+          return code;
+        }
+      }
+      isObject = this.variable.isObject();
+      if (top && olen === 1 && !((obj = objects[0]) instanceof Splat)) {
+        if (obj instanceof Assign) {
+          _ref4 = obj, (_ref5 = _ref4.variable, idx = _ref5.base), obj = _ref4.value;
+        } else {
+          idx = isObject ? obj["this"] ? obj.properties[0].name : obj : new Literal(0);
+        }
+        acc = IDENTIFIER.test(idx.unwrap().value || 0);
+        value = new Value(value);
+        value.properties.push(new (acc ? Access : Index)(idx));
+        if (_ref6 = obj.unwrap().value, __indexOf.call(RESERVED, _ref6) >= 0) {
+          obj.error("assignment to a reserved word: " + (obj.compile(o)));
+        }
+        return new Assign(obj, value, null, {
+          param: this.param
+        }).compileToFragments(o, LEVEL_TOP);
+      }
+      vvar = value.compileToFragments(o, LEVEL_LIST);
+      vvarText = fragmentsToText(vvar);
+      assigns = [];
+      splat = false;
+      if (!IDENTIFIER.test(vvarText) || this.variable.assigns(vvarText)) {
+        assigns.push([this.makeCode("" + (ref = o.scope.freeVariable('ref')) + " = ")].concat(__slice.call(vvar)));
+        vvar = [this.makeCode(ref)];
+        vvarText = ref;
+      }
+      for (i = _i = 0, _len = objects.length; _i < _len; i = ++_i) {
+        obj = objects[i];
+        idx = i;
+        if (isObject) {
+          if (obj instanceof Assign) {
+            _ref7 = obj, (_ref8 = _ref7.variable, idx = _ref8.base), obj = _ref7.value;
+          } else {
+            if (obj.base instanceof Parens) {
+              _ref9 = new Value(obj.unwrapAll()).cacheReference(o), obj = _ref9[0], idx = _ref9[1];
+            } else {
+              idx = obj["this"] ? obj.properties[0].name : obj;
+            }
+          }
+        }
+        if (!splat && obj instanceof Splat) {
+          name = obj.name.unwrap().value;
+          obj = obj.unwrap();
+          val = "" + olen + " <= " + vvarText + ".length ? " + (utility('slice')) + ".call(" + vvarText + ", " + i;
+          if (rest = olen - i - 1) {
+            ivar = o.scope.freeVariable('i');
+            val += ", " + ivar + " = " + vvarText + ".length - " + rest + ") : (" + ivar + " = " + i + ", [])";
+          } else {
+            val += ") : []";
+          }
+          val = new Literal(val);
+          splat = "" + ivar + "++";
+        } else {
+          name = obj.unwrap().value;
+          if (obj instanceof Splat) {
+            obj.error("multiple splats are disallowed in an assignment");
+          }
+          if (typeof idx === 'number') {
+            idx = new Literal(splat || idx);
+            acc = false;
+          } else {
+            acc = isObject && IDENTIFIER.test(idx.unwrap().value || 0);
+          }
+          val = new Value(new Literal(vvarText), [new (acc ? Access : Index)(idx)]);
+        }
+        if ((name != null) && __indexOf.call(RESERVED, name) >= 0) {
+          obj.error("assignment to a reserved word: " + (obj.compile(o)));
+        }
+        assigns.push(new Assign(obj, val, null, {
+          param: this.param,
+          subpattern: true
+        }).compileToFragments(o, LEVEL_LIST));
+      }
+      if (!(top || this.subpattern)) {
+        assigns.push(vvar);
+      }
+      fragments = this.joinFragmentArrays(assigns, ', ');
+      if (o.level < LEVEL_LIST) {
+        return fragments;
+      } else {
+        return this.wrapInBraces(fragments);
+      }
+    };
+
+    Assign.prototype.compileConditional = function(o) {
+      var left, right, _ref4;
+      _ref4 = this.variable.cacheReference(o), left = _ref4[0], right = _ref4[1];
+      if (!left.properties.length && left.base instanceof Literal && left.base.value !== "this" && !o.scope.check(left.base.value)) {
+        this.variable.error("the variable \"" + left.base.value + "\" can't be assigned with " + this.context + " because it has not been declared before");
+      }
+      if (__indexOf.call(this.context, "?") >= 0) {
+        o.isExistentialEquals = true;
+      }
+      return new Op(this.context.slice(0, -1), left, new Assign(right, this.value, '=')).compileToFragments(o);
+    };
+
+    Assign.prototype.compileSplice = function(o) {
+      var answer, exclusive, from, fromDecl, fromRef, name, to, valDef, valRef, _ref4, _ref5, _ref6;
+      _ref4 = this.variable.properties.pop().range, from = _ref4.from, to = _ref4.to, exclusive = _ref4.exclusive;
+      name = this.variable.compile(o);
+      if (from) {
+        _ref5 = this.cacheToCodeFragments(from.cache(o, LEVEL_OP)), fromDecl = _ref5[0], fromRef = _ref5[1];
+      } else {
+        fromDecl = fromRef = '0';
+      }
+      if (to) {
+        if ((from != null ? from.isSimpleNumber() : void 0) && to.isSimpleNumber()) {
+          to = +to.compile(o) - +fromRef;
+          if (!exclusive) {
+            to += 1;
+          }
+        } else {
+          to = to.compile(o, LEVEL_ACCESS) + ' - ' + fromRef;
+          if (!exclusive) {
+            to += ' + 1';
+          }
+        }
+      } else {
+        to = "9e9";
+      }
+      _ref6 = this.value.cache(o, LEVEL_LIST), valDef = _ref6[0], valRef = _ref6[1];
+      answer = [].concat(this.makeCode("[].splice.apply(" + name + ", [" + fromDecl + ", " + to + "].concat("), valDef, this.makeCode(")), "), valRef);
+      if (o.level > LEVEL_TOP) {
+        return this.wrapInBraces(answer);
+      } else {
+        return answer;
+      }
+    };
+
+    return Assign;
+
+  })(Base);
+
+  exports.Code = Code = (function(_super) {
+    __extends(Code, _super);
+
+    function Code(params, body, tag) {
+      this.params = params || [];
+      this.body = body || new Block;
+      this.bound = tag === 'boundfunc';
+      if (this.bound) {
+        this.context = '_this';
+      }
+    }
+
+    Code.prototype.children = ['params', 'body'];
+
+    Code.prototype.isStatement = function() {
+      return !!this.ctor;
+    };
+
+    Code.prototype.jumps = NO;
+
+    Code.prototype.compileNode = function(o) {
+      var answer, code, exprs, i, idt, lit, p, param, params, ref, splats, uniqs, val, wasEmpty, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref4, _ref5, _ref6, _ref7, _ref8;
+      o.scope = new Scope(o.scope, this.body, this);
+      o.scope.shared = del(o, 'sharedScope');
+      o.indent += TAB;
+      delete o.bare;
+      delete o.isExistentialEquals;
+      params = [];
+      exprs = [];
+      this.eachParamName(function(name) {
+        if (!o.scope.check(name)) {
+          return o.scope.parameter(name);
+        }
+      });
+      _ref4 = this.params;
+      for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
+        param = _ref4[_i];
+        if (!param.splat) {
+          continue;
+        }
+        _ref5 = this.params;
+        for (_j = 0, _len1 = _ref5.length; _j < _len1; _j++) {
+          p = _ref5[_j].name;
+          if (p["this"]) {
+            p = p.properties[0].name;
+          }
+          if (p.value) {
+            o.scope.add(p.value, 'var', true);
+          }
+        }
+        splats = new Assign(new Value(new Arr((function() {
+          var _k, _len2, _ref6, _results;
+          _ref6 = this.params;
+          _results = [];
+          for (_k = 0, _len2 = _ref6.length; _k < _len2; _k++) {
+            p = _ref6[_k];
+            _results.push(p.asReference(o));
+          }
+          return _results;
+        }).call(this))), new Value(new Literal('arguments')));
+        break;
+      }
+      _ref6 = this.params;
+      for (_k = 0, _len2 = _ref6.length; _k < _len2; _k++) {
+        param = _ref6[_k];
+        if (param.isComplex()) {
+          val = ref = param.asReference(o);
+          if (param.value) {
+            val = new Op('?', ref, param.value);
+          }
+          exprs.push(new Assign(new Value(param.name), val, '=', {
+            param: true
+          }));
+        } else {
+          ref = param;
+          if (param.value) {
+            lit = new Literal(ref.name.value + ' == null');
+            val = new Assign(new Value(param.name), param.value, '=');
+            exprs.push(new If(lit, val));
+          }
+        }
+        if (!splats) {
+          params.push(ref);
+        }
+      }
+      wasEmpty = this.body.isEmpty();
+      if (splats) {
+        exprs.unshift(splats);
+      }
+      if (exprs.length) {
+        (_ref7 = this.body.expressions).unshift.apply(_ref7, exprs);
+      }
+      for (i = _l = 0, _len3 = params.length; _l < _len3; i = ++_l) {
+        p = params[i];
+        params[i] = p.compileToFragments(o);
+        o.scope.parameter(fragmentsToText(params[i]));
+      }
+      uniqs = [];
+      this.eachParamName(function(name, node) {
+        if (__indexOf.call(uniqs, name) >= 0) {
+          node.error("multiple parameters named '" + name + "'");
+        }
+        return uniqs.push(name);
+      });
+      if (!(wasEmpty || this.noReturn)) {
+        this.body.makeReturn();
+      }
+      if (this.bound) {
+        if ((_ref8 = o.scope.parent.method) != null ? _ref8.bound : void 0) {
+          this.bound = this.context = o.scope.parent.method.context;
+        } else if (!this["static"]) {
+          o.scope.parent.assign('_this', 'this');
+        }
+      }
+      idt = o.indent;
+      code = 'function';
+      if (this.ctor) {
+        code += ' ' + this.name;
+      }
+      code += '(';
+      answer = [this.makeCode(code)];
+      for (i = _m = 0, _len4 = params.length; _m < _len4; i = ++_m) {
+        p = params[i];
+        if (i) {
+          answer.push(this.makeCode(", "));
+        }
+        answer.push.apply(answer, p);
+      }
+      answer.push(this.makeCode(') {'));
+      if (!this.body.isEmpty()) {
+        answer = answer.concat(this.makeCode("\n"), this.body.compileWithDeclarations(o), this.makeCode("\n" + this.tab));
+      }
+      answer.push(this.makeCode('}'));
+      if (this.ctor) {
+        return [this.makeCode(this.tab)].concat(__slice.call(answer));
+      }
+      if (this.front || (o.level >= LEVEL_ACCESS)) {
+        return this.wrapInBraces(answer);
+      } else {
+        return answer;
+      }
+    };
+
+    Code.prototype.eachParamName = function(iterator) {
+      var param, _i, _len, _ref4, _results;
+      _ref4 = this.params;
+      _results = [];
+      for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
+        param = _ref4[_i];
+        _results.push(param.eachName(iterator));
+      }
+      return _results;
+    };
+
+    Code.prototype.traverseChildren = function(crossScope, func) {
+      if (crossScope) {
+        return Code.__super__.traverseChildren.call(this, crossScope, func);
+      }
+    };
+
+    return Code;
+
+  })(Base);
+
+  exports.Param = Param = (function(_super) {
+    __extends(Param, _super);
+
+    function Param(name, value, splat) {
+      var _ref4;
+      this.name = name;
+      this.value = value;
+      this.splat = splat;
+      if (_ref4 = (name = this.name.unwrapAll().value), __indexOf.call(STRICT_PROSCRIBED, _ref4) >= 0) {
+        this.name.error("parameter name \"" + name + "\" is not allowed");
+      }
+    }
+
+    Param.prototype.children = ['name', 'value'];
+
+    Param.prototype.compileToFragments = function(o) {
+      return this.name.compileToFragments(o, LEVEL_LIST);
+    };
+
+    Param.prototype.asReference = function(o) {
+      var node;
+      if (this.reference) {
+        return this.reference;
+      }
+      node = this.name;
+      if (node["this"]) {
+        node = node.properties[0].name;
+        if (node.value.reserved) {
+          node = new Literal(o.scope.freeVariable(node.value));
+        }
+      } else if (node.isComplex()) {
+        node = new Literal(o.scope.freeVariable('arg'));
+      }
+      node = new Value(node);
+      if (this.splat) {
+        node = new Splat(node);
+      }
+      return this.reference = node;
+    };
+
+    Param.prototype.isComplex = function() {
+      return this.name.isComplex();
+    };
+
+    Param.prototype.eachName = function(iterator, name) {
+      var atParam, node, obj, _i, _len, _ref4;
+      if (name == null) {
+        name = this.name;
+      }
+      atParam = function(obj) {
+        var node;
+        node = obj.properties[0].name;
+        if (!node.value.reserved) {
+          return iterator(node.value, node);
+        }
+      };
+      if (name instanceof Literal) {
+        return iterator(name.value, name);
+      }
+      if (name instanceof Value) {
+        return atParam(name);
+      }
+      _ref4 = name.objects;
+      for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
+        obj = _ref4[_i];
+        if (obj instanceof Assign) {
+          this.eachName(iterator, obj.value.unwrap());
+        } else if (obj instanceof Splat) {
+          node = obj.name.unwrap();
+          iterator(node.value, node);
+        } else if (obj instanceof Value) {
+          if (obj.isArray() || obj.isObject()) {
+            this.eachName(iterator, obj.base);
+          } else if (obj["this"]) {
+            atParam(obj);
+          } else {
+            iterator(obj.base.value, obj.base);
+          }
+        } else {
+          obj.error("illegal parameter " + (obj.compile()));
+        }
+      }
+    };
+
+    return Param;
+
+  })(Base);
+
+  exports.Splat = Splat = (function(_super) {
+    __extends(Splat, _super);
+
+    Splat.prototype.children = ['name'];
+
+    Splat.prototype.isAssignable = YES;
+
+    function Splat(name) {
+      this.name = name.compile ? name : new Literal(name);
+    }
+
+    Splat.prototype.assigns = function(name) {
+      return this.name.assigns(name);
+    };
+
+    Splat.prototype.compileToFragments = function(o) {
+      return this.name.compileToFragments(o);
+    };
+
+    Splat.prototype.unwrap = function() {
+      return this.name;
+    };
+
+    Splat.compileSplattedArray = function(o, list, apply) {
+      var args, base, compiledNode, concatPart, fragments, i, index, node, _i, _len;
+      index = -1;
+      while ((node = list[++index]) && !(node instanceof Splat)) {
+        continue;
+      }
+      if (index >= list.length) {
+        return [];
+      }
+      if (list.length === 1) {
+        node = list[0];
+        fragments = node.compileToFragments(o, LEVEL_LIST);
+        if (apply) {
+          return fragments;
+        }
+        return [].concat(node.makeCode("" + (utility('slice')) + ".call("), fragments, node.makeCode(")"));
+      }
+      args = list.slice(index);
+      for (i = _i = 0, _len = args.length; _i < _len; i = ++_i) {
+        node = args[i];
+        compiledNode = node.compileToFragments(o, LEVEL_LIST);
+        args[i] = node instanceof Splat ? [].concat(node.makeCode("" + (utility('slice')) + ".call("), compiledNode, node.makeCode(")")) : [].concat(node.makeCode("["), compiledNode, node.makeCode("]"));
+      }
+      if (index === 0) {
+        node = list[0];
+        concatPart = node.joinFragmentArrays(args.slice(1), ', ');
+        return args[0].concat(node.makeCode(".concat("), concatPart, node.makeCode(")"));
+      }
+      base = (function() {
+        var _j, _len1, _ref4, _results;
+        _ref4 = list.slice(0, index);
+        _results = [];
+        for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
+          node = _ref4[_j];
+          _results.push(node.compileToFragments(o, LEVEL_LIST));
+        }
+        return _results;
+      })();
+      base = list[0].joinFragmentArrays(base, ', ');
+      concatPart = list[index].joinFragmentArrays(args, ', ');
+      return [].concat(list[0].makeCode("["), base, list[index].makeCode("].concat("), concatPart, (last(list)).makeCode(")"));
+    };
+
+    return Splat;
+
+  })(Base);
+
+  exports.While = While = (function(_super) {
+    __extends(While, _super);
+
+    function While(condition, options) {
+      this.condition = (options != null ? options.invert : void 0) ? condition.invert() : condition;
+      this.guard = options != null ? options.guard : void 0;
+    }
+
+    While.prototype.children = ['condition', 'guard', 'body'];
+
+    While.prototype.isStatement = YES;
+
+    While.prototype.makeReturn = function(res) {
+      if (res) {
+        return While.__super__.makeReturn.apply(this, arguments);
+      } else {
+        this.returns = !this.jumps({
+          loop: true
+        });
+        return this;
+      }
+    };
+
+    While.prototype.addBody = function(body) {
+      this.body = body;
+      return this;
+    };
+
+    While.prototype.jumps = function() {
+      var expressions, node, _i, _len;
+      expressions = this.body.expressions;
+      if (!expressions.length) {
+        return false;
+      }
+      for (_i = 0, _len = expressions.length; _i < _len; _i++) {
+        node = expressions[_i];
+        if (node.jumps({
+          loop: true
+        })) {
+          return node;
+        }
+      }
+      return false;
+    };
+
+    While.prototype.compileNode = function(o) {
+      var answer, body, rvar, set;
+      o.indent += TAB;
+      set = '';
+      body = this.body;
+      if (body.isEmpty()) {
+        body = this.makeCode('');
+      } else {
+        if (this.returns) {
+          body.makeReturn(rvar = o.scope.freeVariable('results'));
+          set = "" + this.tab + rvar + " = [];\n";
+        }
+        if (this.guard) {
+          if (body.expressions.length > 1) {
+            body.expressions.unshift(new If((new Parens(this.guard)).invert(), new Literal("continue")));
+          } else {
+            if (this.guard) {
+              body = Block.wrap([new If(this.guard, body)]);
+            }
+          }
+        }
+        body = [].concat(this.makeCode("\n"), body.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab));
+      }
+      answer = [].concat(this.makeCode(set + this.tab + "while ("), this.condition.compileToFragments(o, LEVEL_PAREN), this.makeCode(") {"), body, this.makeCode("}"));
+      if (this.returns) {
+        answer.push(this.makeCode("\n" + this.tab + "return " + rvar + ";"));
+      }
+      return answer;
+    };
+
+    return While;
+
+  })(Base);
+
+  exports.Op = Op = (function(_super) {
+    var CONVERSIONS, INVERSIONS;
+
+    __extends(Op, _super);
+
+    function Op(op, first, second, flip) {
+      if (op === 'in') {
+        return new In(first, second);
+      }
+      if (op === 'do') {
+        return this.generateDo(first);
+      }
+      if (op === 'new') {
+        if (first instanceof Call && !first["do"] && !first.isNew) {
+          return first.newInstance();
+        }
+        if (first instanceof Code && first.bound || first["do"]) {
+          first = new Parens(first);
+        }
+      }
+      this.operator = CONVERSIONS[op] || op;
+      this.first = first;
+      this.second = second;
+      this.flip = !!flip;
+      return this;
+    }
+
+    CONVERSIONS = {
+      '==': '===',
+      '!=': '!==',
+      'of': 'in'
+    };
+
+    INVERSIONS = {
+      '!==': '===',
+      '===': '!=='
+    };
+
+    Op.prototype.children = ['first', 'second'];
+
+    Op.prototype.isSimpleNumber = NO;
+
+    Op.prototype.isUnary = function() {
+      return !this.second;
+    };
+
+    Op.prototype.isComplex = function() {
+      var _ref4;
+      return !(this.isUnary() && ((_ref4 = this.operator) === '+' || _ref4 === '-')) || this.first.isComplex();
+    };
+
+    Op.prototype.isChainable = function() {
+      var _ref4;
+      return (_ref4 = this.operator) === '<' || _ref4 === '>' || _ref4 === '>=' || _ref4 === '<=' || _ref4 === '===' || _ref4 === '!==';
+    };
+
+    Op.prototype.invert = function() {
+      var allInvertable, curr, fst, op, _ref4;
+      if (this.isChainable() && this.first.isChainable()) {
+        allInvertable = true;
+        curr = this;
+        while (curr && curr.operator) {
+          allInvertable && (allInvertable = curr.operator in INVERSIONS);
+          curr = curr.first;
+        }
+        if (!allInvertable) {
+          return new Parens(this).invert();
+        }
+        curr = this;
+        while (curr && curr.operator) {
+          curr.invert = !curr.invert;
+          curr.operator = INVERSIONS[curr.operator];
+          curr = curr.first;
+        }
+        return this;
+      } else if (op = INVERSIONS[this.operator]) {
+        this.operator = op;
+        if (this.first.unwrap() instanceof Op) {
+          this.first.invert();
+        }
+        return this;
+      } else if (this.second) {
+        return new Parens(this).invert();
+      } else if (this.operator === '!' && (fst = this.first.unwrap()) instanceof Op && ((_ref4 = fst.operator) === '!' || _ref4 === 'in' || _ref4 === 'instanceof')) {
+        return fst;
+      } else {
+        return new Op('!', this);
+      }
+    };
+
+    Op.prototype.unfoldSoak = function(o) {
+      var _ref4;
+      return ((_ref4 = this.operator) === '++' || _ref4 === '--' || _ref4 === 'delete') && unfoldSoak(o, this, 'first');
+    };
+
+    Op.prototype.generateDo = function(exp) {
+      var call, func, param, passedParams, ref, _i, _len, _ref4;
+      passedParams = [];
+      func = exp instanceof Assign && (ref = exp.value.unwrap()) instanceof Code ? ref : exp;
+      _ref4 = func.params || [];
+      for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
+        param = _ref4[_i];
+        if (param.value) {
+          passedParams.push(param.value);
+          delete param.value;
+        } else {
+          passedParams.push(param);
+        }
+      }
+      call = new Call(exp, passedParams);
+      call["do"] = true;
+      return call;
+    };
+
+    Op.prototype.compileNode = function(o) {
+      var answer, isChain, _ref4, _ref5;
+      isChain = this.isChainable() && this.first.isChainable();
+      if (!isChain) {
+        this.first.front = this.front;
+      }
+      if (this.operator === 'delete' && o.scope.check(this.first.unwrapAll().value)) {
+        this.error('delete operand may not be argument or var');
+      }
+      if (((_ref4 = this.operator) === '--' || _ref4 === '++') && (_ref5 = this.first.unwrapAll().value, __indexOf.call(STRICT_PROSCRIBED, _ref5) >= 0)) {
+        this.error("cannot increment/decrement \"" + (this.first.unwrapAll().value) + "\"");
+      }
+      if (this.isUnary()) {
+        return this.compileUnary(o);
+      }
+      if (isChain) {
+        return this.compileChain(o);
+      }
+      if (this.operator === '?') {
+        return this.compileExistence(o);
+      }
+      answer = [].concat(this.first.compileToFragments(o, LEVEL_OP), this.makeCode(' ' + this.operator + ' '), this.second.compileToFragments(o, LEVEL_OP));
+      if (o.level <= LEVEL_OP) {
+        return answer;
+      } else {
+        return this.wrapInBraces(answer);
+      }
+    };
+
+    Op.prototype.compileChain = function(o) {
+      var fragments, fst, shared, _ref4;
+      _ref4 = this.first.second.cache(o), this.first.second = _ref4[0], shared = _ref4[1];
+      fst = this.first.compileToFragments(o, LEVEL_OP);
+      fragments = fst.concat(this.makeCode(" " + (this.invert ? '&&' : '||') + " "), shared.compileToFragments(o), this.makeCode(" " + this.operator + " "), this.second.compileToFragments(o, LEVEL_OP));
+      return this.wrapInBraces(fragments);
+    };
+
+    Op.prototype.compileExistence = function(o) {
+      var fst, ref;
+      if (!o.isExistentialEquals && this.first.isComplex()) {
+        ref = new Literal(o.scope.freeVariable('ref'));
+        fst = new Parens(new Assign(ref, this.first));
+      } else {
+        fst = this.first;
+        ref = fst;
+      }
+      return new If(new Existence(fst), ref, {
+        type: 'if'
+      }).addElse(this.second).compileToFragments(o);
+    };
+
+    Op.prototype.compileUnary = function(o) {
+      var op, parts, plusMinus;
+      parts = [];
+      op = this.operator;
+      parts.push([this.makeCode(op)]);
+      if (op === '!' && this.first instanceof Existence) {
+        this.first.negated = !this.first.negated;
+        return this.first.compileToFragments(o);
+      }
+      if (o.level >= LEVEL_ACCESS) {
+        return (new Parens(this)).compileToFragments(o);
+      }
+      plusMinus = op === '+' || op === '-';
+      if ((op === 'new' || op === 'typeof' || op === 'delete') || plusMinus && this.first instanceof Op && this.first.operator === op) {
+        parts.push([this.makeCode(' ')]);
+      }
+      if ((plusMinus && this.first instanceof Op) || (op === 'new' && this.first.isStatement(o))) {
+        this.first = new Parens(this.first);
+      }
+      parts.push(this.first.compileToFragments(o, LEVEL_OP));
+      if (this.flip) {
+        parts.reverse();
+      }
+      return this.joinFragmentArrays(parts, '');
+    };
+
+    Op.prototype.toString = function(idt) {
+      return Op.__super__.toString.call(this, idt, this.constructor.name + ' ' + this.operator);
+    };
+
+    return Op;
+
+  })(Base);
+
+  exports.In = In = (function(_super) {
+    __extends(In, _super);
+
+    function In(object, array) {
+      this.object = object;
+      this.array = array;
+    }
+
+    In.prototype.children = ['object', 'array'];
+
+    In.prototype.invert = NEGATE;
+
+    In.prototype.compileNode = function(o) {
+      var hasSplat, obj, _i, _len, _ref4;
+      if (this.array instanceof Value && this.array.isArray()) {
+        _ref4 = this.array.base.objects;
+        for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
+          obj = _ref4[_i];
+          if (!(obj instanceof Splat)) {
+            continue;
+          }
+          hasSplat = true;
+          break;
+        }
+        if (!hasSplat) {
+          return this.compileOrTest(o);
+        }
+      }
+      return this.compileLoopTest(o);
+    };
+
+    In.prototype.compileOrTest = function(o) {
+      var cmp, cnj, i, item, ref, sub, tests, _i, _len, _ref4, _ref5, _ref6;
+      if (this.array.base.objects.length === 0) {
+        return [this.makeCode("" + (!!this.negated))];
+      }
+      _ref4 = this.object.cache(o, LEVEL_OP), sub = _ref4[0], ref = _ref4[1];
+      _ref5 = this.negated ? [' !== ', ' && '] : [' === ', ' || '], cmp = _ref5[0], cnj = _ref5[1];
+      tests = [];
+      _ref6 = this.array.base.objects;
+      for (i = _i = 0, _len = _ref6.length; _i < _len; i = ++_i) {
+        item = _ref6[i];
+        if (i) {
+          tests.push(this.makeCode(cnj));
+        }
+        tests = tests.concat((i ? ref : sub), this.makeCode(cmp), item.compileToFragments(o, LEVEL_ACCESS));
+      }
+      if (o.level < LEVEL_OP) {
+        return tests;
+      } else {
+        return this.wrapInBraces(tests);
+      }
+    };
+
+    In.prototype.compileLoopTest = function(o) {
+      var fragments, ref, sub, _ref4;
+      _ref4 = this.object.cache(o, LEVEL_LIST), sub = _ref4[0], ref = _ref4[1];
+      fragments = [].concat(this.makeCode(utility('indexOf') + ".call("), this.array.compileToFragments(o, LEVEL_LIST), this.makeCode(", "), ref, this.makeCode(") " + (this.negated ? '< 0' : '>= 0')));
+      if (fragmentsToText(sub) === fragmentsToText(ref)) {
+        return fragments;
+      }
+      fragments = sub.concat(this.makeCode(', '), fragments);
+      if (o.level < LEVEL_LIST) {
+        return fragments;
+      } else {
+        return this.wrapInBraces(fragments);
+      }
+    };
+
+    In.prototype.toString = function(idt) {
+      return In.__super__.toString.call(this, idt, this.constructor.name + (this.negated ? '!' : ''));
+    };
+
+    return In;
+
+  })(Base);
+
+  exports.Try = Try = (function(_super) {
+    __extends(Try, _super);
+
+    function Try(attempt, errorVariable, recovery, ensure) {
+      this.attempt = attempt;
+      this.errorVariable = errorVariable;
+      this.recovery = recovery;
+      this.ensure = ensure;
+    }
+
+    Try.prototype.children = ['attempt', 'recovery', 'ensure'];
+
+    Try.prototype.isStatement = YES;
+
+    Try.prototype.jumps = function(o) {
+      var _ref4;
+      return this.attempt.jumps(o) || ((_ref4 = this.recovery) != null ? _ref4.jumps(o) : void 0);
+    };
+
+    Try.prototype.makeReturn = function(res) {
+      if (this.attempt) {
+        this.attempt = this.attempt.makeReturn(res);
+      }
+      if (this.recovery) {
+        this.recovery = this.recovery.makeReturn(res);
+      }
+      return this;
+    };
+
+    Try.prototype.compileNode = function(o) {
+      var catchPart, ensurePart, placeholder, tryPart;
+      o.indent += TAB;
+      tryPart = this.attempt.compileToFragments(o, LEVEL_TOP);
+      catchPart = this.recovery ? (placeholder = new Literal('_error'), this.errorVariable ? this.recovery.unshift(new Assign(this.errorVariable, placeholder)) : void 0, [].concat(this.makeCode(" catch ("), placeholder.compileToFragments(o), this.makeCode(") {\n"), this.recovery.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab + "}"))) : !(this.ensure || this.recovery) ? [this.makeCode(' catch (_error) {}')] : [];
+      ensurePart = this.ensure ? [].concat(this.makeCode(" finally {\n"), this.ensure.compileToFragments(o, LEVEL_TOP), this.makeCode("\n" + this.tab + "}")) : [];
+      return [].concat(this.makeCode("" + this.tab + "try {\n"), tryPart, this.makeCode("\n" + this.tab + "}"), catchPart, ensurePart);
+    };
+
+    return Try;
+
+  })(Base);
+
+  exports.Throw = Throw = (function(_super) {
+    __extends(Throw, _super);
+
+    function Throw(expression) {
+      this.expression = expression;
+    }
+
+    Throw.prototype.children = ['expression'];
+
+    Throw.prototype.isStatement = YES;
+
+    Throw.prototype.jumps = NO;
+
+    Throw.prototype.makeReturn = THIS;
+
+    Throw.prototype.compileNode = function(o) {
+      return [].concat(this.makeCode(this.tab + "throw "), this.expression.compileToFragments(o), this.makeCode(";"));
+    };
+
+    return Throw;
+
+  })(Base);
+
+  exports.Existence = Existence = (function(_super) {
+    __extends(Existence, _super);
+
+    function Existence(expression) {
+      this.expression = expression;
+    }
+
+    Existence.prototype.children = ['expression'];
+
+    Existence.prototype.invert = NEGATE;
+
+    Existence.prototype.compileNode = function(o) {
+      var cmp, cnj, code, _ref4;
+      this.expression.front = this.front;
+      code = this.expression.compile(o, LEVEL_OP);
+      if (IDENTIFIER.test(code) && !o.scope.check(code)) {
+        _ref4 = this.negated ? ['===', '||'] : ['!==', '&&'], cmp = _ref4[0], cnj = _ref4[1];
+        code = "typeof " + code + " " + cmp + " \"undefined\" " + cnj + " " + code + " " + cmp + " null";
+      } else {
+        code = "" + code + " " + (this.negated ? '==' : '!=') + " null";
+      }
+      return [this.makeCode(o.level <= LEVEL_COND ? code : "(" + code + ")")];
+    };
+
+    return Existence;
+
+  })(Base);
+
+  exports.Parens = Parens = (function(_super) {
+    __extends(Parens, _super);
+
+    function Parens(body) {
+      this.body = body;
+    }
+
+    Parens.prototype.children = ['body'];
+
+    Parens.prototype.unwrap = function() {
+      return this.body;
+    };
+
+    Parens.prototype.isComplex = function() {
+      return this.body.isComplex();
+    };
+
+    Parens.prototype.compileNode = function(o) {
+      var bare, expr, fragments;
+      expr = this.body.unwrap();
+      if (expr instanceof Value && expr.isAtomic()) {
+        expr.front = this.front;
+        return expr.compileToFragments(o);
+      }
+      fragments = expr.compileToFragments(o, LEVEL_PAREN);
+      bare = o.level < LEVEL_OP && (expr instanceof Op || expr instanceof Call || (expr instanceof For && expr.returns));
+      if (bare) {
+        return fragments;
+      } else {
+        return this.wrapInBraces(fragments);
+      }
+    };
+
+    return Parens;
+
+  })(Base);
+
+  exports.For = For = (function(_super) {
+    __extends(For, _super);
+
+    function For(body, source) {
+      var _ref4;
+      this.source = source.source, this.guard = source.guard, this.step = source.step, this.name = source.name, this.index = source.index;
+      this.body = Block.wrap([body]);
+      this.own = !!source.own;
+      this.object = !!source.object;
+      if (this.object) {
+        _ref4 = [this.index, this.name], this.name = _ref4[0], this.index = _ref4[1];
+      }
+      if (this.index instanceof Value) {
+        this.index.error('index cannot be a pattern matching expression');
+      }
+      this.range = this.source instanceof Value && this.source.base instanceof Range && !this.source.properties.length;
+      this.pattern = this.name instanceof Value;
+      if (this.range && this.index) {
+        this.index.error('indexes do not apply to range loops');
+      }
+      if (this.range && this.pattern) {
+        this.name.error('cannot pattern match over range loops');
+      }
+      if (this.own && !this.object) {
+        this.index.error('cannot use own with for-in');
+      }
+      this.returns = false;
+    }
+
+    For.prototype.children = ['body', 'source', 'guard', 'step'];
+
+    For.prototype.compileNode = function(o) {
+      var body, bodyFragments, compare, compareDown, declare, declareDown, defPart, defPartFragments, down, forPartFragments, guardPart, idt1, increment, index, ivar, kvar, kvarAssign, lastJumps, lvar, name, namePart, ref, resultPart, returnResult, rvar, scope, source, step, stepNum, stepVar, svar, varPart, _ref4, _ref5;
+      body = Block.wrap([this.body]);
+      lastJumps = (_ref4 = last(body.expressions)) != null ? _ref4.jumps() : void 0;
+      if (lastJumps && lastJumps instanceof Return) {
+        this.returns = false;
+      }
+      source = this.range ? this.source.base : this.source;
+      scope = o.scope;
+      name = this.name && (this.name.compile(o, LEVEL_LIST));
+      index = this.index && (this.index.compile(o, LEVEL_LIST));
+      if (name && !this.pattern) {
+        scope.find(name);
+      }
+      if (index) {
+        scope.find(index);
+      }
+      if (this.returns) {
+        rvar = scope.freeVariable('results');
+      }
+      ivar = (this.object && index) || scope.freeVariable('i');
+      kvar = (this.range && name) || index || ivar;
+      kvarAssign = kvar !== ivar ? "" + kvar + " = " : "";
+     

<TRUNCATED>

[42/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/searchbox.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/searchbox.js b/src/fauxton/assets/js/libs/ace/ext/searchbox.js
new file mode 100644
index 0000000..fbbaa8f
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/searchbox.js
@@ -0,0 +1,286 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var dom = require("../lib/dom");
+var lang = require("../lib/lang");
+var event = require("../lib/event");
+var searchboxCss = require("../requirejs/text!./searchbox.css");
+var HashHandler = require("../keyboard/hash_handler").HashHandler;
+var keyUtil = require("../lib/keys");
+
+dom.importCssString(searchboxCss, "ace_searchbox");
+
+var html = '<div class="ace_search right">\
+    <button type="button" action="hide" class="ace_searchbtn_close"></button>\
+    <div class="ace_search_form">\
+        <input class="ace_search_field" placeholder="Search for" spellcheck="false"></input>\
+        <button type="button" action="findNext" class="ace_searchbtn next"></button>\
+        <button type="button" action="findPrev" class="ace_searchbtn prev"></button>\
+    </div>\
+    <div class="ace_replace_form">\
+        <input class="ace_search_field" placeholder="Replace with" spellcheck="false"></input>\
+        <button type="button" action="replaceAndFindNext" class="ace_replacebtn">Replace</button>\
+        <button type="button" action="replaceAll" class="ace_replacebtn">All</button>\
+    </div>\
+    <div class="ace_search_options">\
+        <span action="toggleRegexpMode" class="ace_button" title="RegExp Search">.*</span>\
+        <span action="toggleCaseSensitive" class="ace_button" title="CaseSensitive Search">Aa</span>\
+        <span action="toggleWholeWords" class="ace_button" title="Whole Word Search">\\b</span>\
+    </div>\
+</div>'.replace(/>\s+/g, ">");
+
+var SearchBox = function(editor, range, showReplaceForm) {
+    var div = dom.createElement("div");
+    div.innerHTML = html;
+    this.element = div.firstChild;
+
+    this.$init();
+    this.setEditor(editor);
+};
+
+(function() {
+    this.setEditor = function(editor) {
+        editor.searchBox = this;
+        editor.container.appendChild(this.element);
+        this.editor = editor;
+    };
+
+    this.$initElements = function(sb) {
+        this.searchBox = sb.querySelector(".ace_search_form");
+        this.replaceBox = sb.querySelector(".ace_replace_form");
+        this.searchOptions = sb.querySelector(".ace_search_options");
+        this.regExpOption = sb.querySelector("[action=toggleRegexpMode]");
+        this.caseSensitiveOption = sb.querySelector("[action=toggleCaseSensitive]");
+        this.wholeWordOption = sb.querySelector("[action=toggleWholeWords]");
+        this.searchInput = this.searchBox.querySelector(".ace_search_field");
+        this.replaceInput = this.replaceBox.querySelector(".ace_search_field");
+    };
+    
+    this.$init = function() {
+        var sb = this.element;
+        
+        this.$initElements(sb);
+        
+        var _this = this;
+        event.addListener(sb, "mousedown", function(e) {
+            setTimeout(function(){
+                _this.activeInput.focus();
+            }, 0);
+            event.stopPropagation(e);
+        });
+        event.addListener(sb, "click", function(e) {
+            var t = e.target || e.srcElement;
+            var action = t.getAttribute("action");
+            if (action && _this[action])
+                _this[action]();
+            else if (_this.$searchBarKb.commands[action])
+                _this.$searchBarKb.commands[action].exec(_this);
+            event.stopPropagation(e);
+        });
+
+        event.addCommandKeyListener(sb, function(e, hashId, keyCode) {
+            var keyString = keyUtil.keyCodeToString(keyCode);
+            var command = _this.$searchBarKb.findKeyCommand(hashId, keyString);
+            if (command && command.exec) {
+                command.exec(_this);
+                event.stopEvent(e);
+            }
+        });
+
+        this.$onChange = lang.delayedCall(function() {
+            _this.find(false, false);
+        });
+
+        event.addListener(this.searchInput, "input", function() {
+            _this.$onChange.schedule(20);
+        });
+        event.addListener(this.searchInput, "focus", function() {
+            _this.activeInput = _this.searchInput;
+            _this.searchInput.value && _this.highlight();
+        });
+        event.addListener(this.replaceInput, "focus", function() {
+            _this.activeInput = _this.replaceInput;
+            _this.searchInput.value && _this.highlight();
+        });
+    };
+
+    //keybinging outsite of the searchbox
+    this.$closeSearchBarKb = new HashHandler([{
+        bindKey: "Esc",
+        name: "closeSearchBar",
+        exec: function(editor) {
+            editor.searchBox.hide();
+        }
+    }]);
+
+    //keybinging outsite of the searchbox
+    this.$searchBarKb = new HashHandler();
+    this.$searchBarKb.bindKeys({
+        "Ctrl-f|Command-f|Ctrl-H|Command-Option-F": function(sb) {
+            var isReplace = sb.isReplace = !sb.isReplace;
+            sb.replaceBox.style.display = isReplace ? "" : "none";
+            sb[isReplace ? "replaceInput" : "searchInput"].focus();
+        },
+        "Ctrl-G|Command-G": function(sb) {
+            sb.findNext();
+        },
+        "Ctrl-Shift-G|Command-Shift-G": function(sb) {
+            sb.findPrev();
+        },
+        "esc": function(sb) {
+            setTimeout(function() { sb.hide();});
+        },
+        "Return": function(sb) {
+            if (sb.activeInput == sb.replaceInput)
+                sb.replace();
+            sb.findNext();
+        },
+        "Shift-Return": function(sb) {
+            if (sb.activeInput == sb.replaceInput)
+                sb.replace();
+            sb.findPrev();
+        },
+        "Tab": function(sb) {
+            (sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus();
+        }
+    });
+
+    this.$searchBarKb.addCommands([{
+        name: "toggleRegexpMode",
+        bindKey: {win: "Alt-R|Alt-/", mac: "Ctrl-Alt-R|Ctrl-Alt-/"},
+        exec: function(sb) {
+            sb.regExpOption.checked = !sb.regExpOption.checked;
+            sb.$syncOptions();
+        }
+    }, {
+        name: "toggleCaseSensitive",
+        bindKey: {win: "Alt-C|Alt-I", mac: "Ctrl-Alt-R|Ctrl-Alt-I"},
+        exec: function(sb) {
+            sb.caseSensitiveOption.checked = !sb.caseSensitiveOption.checked;
+            sb.$syncOptions();
+        }
+    }, {
+        name: "toggleWholeWords",
+        bindKey: {win: "Alt-B|Alt-W", mac: "Ctrl-Alt-B|Ctrl-Alt-W"},
+        exec: function(sb) {
+            sb.wholeWordOption.checked = !sb.wholeWordOption.checked;
+            sb.$syncOptions();
+        }
+    }]);
+
+    this.$syncOptions = function() {
+        dom.setCssClass(this.regExpOption, "checked", this.regExpOption.checked);
+        dom.setCssClass(this.wholeWordOption, "checked", this.wholeWordOption.checked);
+        dom.setCssClass(this.caseSensitiveOption, "checked", this.caseSensitiveOption.checked);
+        this.find(false, false);
+    };
+
+    this.highlight = function(re) {
+        this.editor.session.highlight(re || this.editor.$search.$options.re);
+        this.editor.renderer.updateBackMarkers()
+    };
+    this.find = function(skipCurrent, backwards) {
+        var range = this.editor.find(this.searchInput.value, {
+            skipCurrent: skipCurrent,
+            backwards: backwards,
+            wrap: true,
+            regExp: this.regExpOption.checked,
+            caseSensitive: this.caseSensitiveOption.checked,
+            wholeWord: this.wholeWordOption.checked
+        });
+        var noMatch = !range && this.searchInput.value;
+        dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
+        this.editor._emit("findSearchBox", { match: !noMatch });
+        this.highlight();
+    };
+    this.findNext = function() {
+        this.find(true, false);
+    };
+    this.findPrev = function() {
+        this.find(true, true);
+    };
+    this.replace = function() {
+        if (!this.editor.getReadOnly())
+            this.editor.replace(this.replaceInput.value);
+    };    
+    this.replaceAndFindNext = function() {
+        if (!this.editor.getReadOnly()) {
+            this.editor.replace(this.replaceInput.value);
+            this.findNext()
+        }
+    };
+    this.replaceAll = function() {
+        if (!this.editor.getReadOnly())
+            this.editor.replaceAll(this.replaceInput.value);
+    };
+
+    this.hide = function() {
+        this.element.style.display = "none";
+        this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb);
+        this.editor.focus();
+    };
+    this.show = function(value, isReplace) {
+        this.element.style.display = "";
+        this.replaceBox.style.display = isReplace ? "" : "none";
+
+        this.isReplace = isReplace;
+
+        if (value)
+            this.searchInput.value = value;
+        this.searchInput.focus();
+        this.searchInput.select();
+
+        this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb);
+    };
+
+}).call(SearchBox.prototype);
+
+exports.SearchBox = SearchBox;
+
+exports.Search = function(editor, isReplace) {
+    var sb = editor.searchBox || new SearchBox(editor);
+    sb.show(editor.session.getTextRange(), isReplace);
+};
+
+});
+
+
+/* ------------------------------------------------------------------------------------------
+ * TODO
+ * --------------------------------------------------------------------------------------- */
+/*
+- move search form to the left if it masks current word
+- includ all options that search has. ex: regex
+- searchbox.searchbox is not that pretty. we should have just searchbox
+- disable prev button if it makes sence
+*/

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/settings_menu.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/settings_menu.js b/src/fauxton/assets/js/libs/ace/ext/settings_menu.js
new file mode 100644
index 0000000..44f6d6a
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/settings_menu.js
@@ -0,0 +1,76 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl
+ * All rights reserved.
+ *
+ * Contributed to Ajax.org under the BSD license.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/
+/*global define, require */
+
+/**
+ * Show Settings Menu
+ * @fileOverview Show Settings Menu <br />
+ * Displays an interactive settings menu mostly generated on the fly based on
+ *  the current state of the editor.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ */
+
+define(function(require, exports, module) {
+"use strict";
+var generateSettingsMenu = require('./menu_tools/generate_settings_menu').generateSettingsMenu;
+var overlayPage = require('./menu_tools/overlay_page').overlayPage;
+/**
+ * This displays the settings menu if it is not already being shown.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ * @param {ace.Editor} editor An instance of the ace editor.
+ */
+function showSettingsMenu(editor) {
+    // make sure the menu isn't open already.
+    var sm = document.getElementById('ace_settingsmenu');
+    if (!sm)    
+        overlayPage(editor, generateSettingsMenu(editor), '0', '0', '0');
+}
+
+/**
+ * Initializes the settings menu extension. It adds the showSettingsMenu
+ *  method to the given editor object and adds the showSettingsMenu command
+ *  to the editor with appropriate keyboard shortcuts.
+ * @param {ace.Editor} editor An instance of the Editor.
+ */
+module.exports.init = function(editor) {
+    var Editor = require("ace/editor").Editor;
+    Editor.prototype.showSettingsMenu = function() {
+        showSettingsMenu(this);
+    };
+};
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/spellcheck.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/spellcheck.js b/src/fauxton/assets/js/libs/ace/ext/spellcheck.js
new file mode 100644
index 0000000..08bf218
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/spellcheck.js
@@ -0,0 +1,69 @@
+define(function(require, exports, module) {
+"use strict";
+var event = require("../lib/event");
+
+exports.contextMenuHandler = function(e){
+    var host = e.target;
+    var text = host.textInput.getElement();
+    if (!host.selection.isEmpty())
+        return;
+    var c = host.getCursorPosition();
+    var r = host.session.getWordRange(c.row, c.column);
+    var w = host.session.getTextRange(r);
+
+    host.session.tokenRe.lastIndex = 0;
+    if (!host.session.tokenRe.test(w))
+        return;
+    var PLACEHOLDER = "\x01\x01";
+    var value = w + " " + PLACEHOLDER;
+    text.value = value;
+    text.setSelectionRange(w.length, w.length + 1);
+    text.setSelectionRange(0, 0);
+    text.setSelectionRange(0, w.length);
+
+    var afterKeydown = false;
+    event.addListener(text, "keydown", function onKeydown() {
+        event.removeListener(text, "keydown", onKeydown);
+        afterKeydown = true;
+    });
+
+    host.textInput.setInputHandler(function(newVal) {
+        console.log(newVal , value, text.selectionStart, text.selectionEnd)
+        if (newVal == value)
+            return '';
+        if (newVal.lastIndexOf(value, 0) === 0)
+            return newVal.slice(value.length);
+        if (newVal.substr(text.selectionEnd) == value)
+            return newVal.slice(0, -value.length);
+        if (newVal.slice(-2) == PLACEHOLDER) {
+            var val = newVal.slice(0, -2);
+            if (val.slice(-1) == " ") {
+                if (afterKeydown)
+                    return val.substring(0, text.selectionEnd);
+                val = val.slice(0, -1);
+                host.session.replace(r, val);
+                return "";
+            }
+        }
+
+        return newVal;
+    });
+};
+// todo support highlighting with typo.js
+var Editor = require("../editor").Editor;
+require("../config").defineOptions(Editor.prototype, "editor", {
+    spellcheck: {
+        set: function(val) {
+            var text = this.textInput.getElement();
+            text.spellcheck = !!val;
+            if (!val)
+                this.removeListener("nativecontextmenu", exports.contextMenuHandler);
+            else
+                this.on("nativecontextmenu", exports.contextMenuHandler);
+        },
+        value: true
+    }
+});
+
+});
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/split.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/split.js b/src/fauxton/assets/js/libs/ace/ext/split.js
new file mode 100644
index 0000000..8316562
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/split.js
@@ -0,0 +1,40 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+/**
+ * this is experimental, and subject to change, use at your own risk!
+ */
+module.exports = require("../split");
+
+});
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/static.css
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/static.css b/src/fauxton/assets/js/libs/ace/ext/static.css
new file mode 100644
index 0000000..bd47978
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/static.css
@@ -0,0 +1,23 @@
+.ace_static_highlight {
+   font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', 'Droid Sans Mono', monospace;
+   font-size: 12px;
+}
+
+.ace_static_highlight .ace_gutter {
+    width: 25px !important;
+    display: block;
+    float: left;
+    text-align: right;
+    padding: 0 3px 0 0;
+    margin-right: 3px;
+    position: static !important;
+}
+
+.ace_static_highlight .ace_line { clear: both; }
+
+.ace_static_highlight .ace_gutter-cell {
+  -moz-user-select: -moz-none;
+  -khtml-user-select: none;
+  -webkit-user-select: none;
+  user-select: none;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/static_highlight.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/static_highlight.js b/src/fauxton/assets/js/libs/ace/ext/static_highlight.js
new file mode 100644
index 0000000..2119653
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/static_highlight.js
@@ -0,0 +1,180 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("../edit_session").EditSession;
+var TextLayer = require("../layer/text").Text;
+var baseStyles = require("../requirejs/text!./static.css");
+var config = require("../config");
+var dom = require("../lib/dom");
+/**
+ * Transforms a given input code snippet into HTML using the given mode
+ *
+ * @param {string} input Code snippet
+ * @param {string|mode} mode String specifying the mode to load such as
+ *  `ace/mode/javascript` or, a mode loaded from `/ace/mode`
+ *  (use 'ServerSideHiglighter.getMode').
+ * @param {string|theme} theme String specifying the theme to load such as
+ *  `ace/theme/twilight` or, a theme loaded from `/ace/theme`.
+ * @param {number} lineStart A number indicating the first line number. Defaults
+ *  to 1.
+ * @param {boolean} disableGutter Specifies whether or not to disable the gutter.
+ *  `true` disables the gutter, `false` enables the gutter. Defaults to `false`.
+ * @param {function} callback When specifying the mode or theme as a string,
+ *  this method has no return value and you must specify a callback function. The
+ *  callback will receive the rendered object containing the properties `html`
+ *  and `css`.
+ * @returns {object} An object containing the properties `html` and `css`.
+ */
+
+exports.render = function(input, mode, theme, lineStart, disableGutter, callback) {
+    var waiting = 0;
+    var modeCache = EditSession.prototype.$modes;
+
+    // if either the theme or the mode were specified as objects
+    // then we need to lazily load them.
+    if (typeof theme == "string") {
+        waiting++;
+        config.loadModule(['theme', theme], function(m) {
+            theme = m;
+            --waiting || done();
+        });
+    }
+
+    if (typeof mode == "string") {
+        waiting++;
+        config.loadModule(['mode', mode], function(m) {
+            if (!modeCache[mode]) modeCache[mode] = new m.Mode();
+            mode = modeCache[mode];
+            --waiting || done();
+        });
+    }
+
+    // loads or passes the specified mode module then calls renderer
+    function done() {
+        var result = exports.renderSync(input, mode, theme, lineStart, disableGutter);
+        return callback ? callback(result) : result;
+    }
+    return waiting || done();
+};
+
+/* 
+ * Transforms a given input code snippet into HTML using the given mode
+ * @param {string} input Code snippet
+ * @param {mode} mode Mode loaded from /ace/mode (use 'ServerSideHiglighter.getMode')
+ * @param {string} r Code snippet
+ * @returns {object} An object containing: html, css
+ */
+
+exports.renderSync = function(input, mode, theme, lineStart, disableGutter) {
+    lineStart = parseInt(lineStart || 1, 10);
+
+    var session = new EditSession("");
+    session.setUseWorker(false);
+    session.setMode(mode);
+
+    var textLayer = new TextLayer(document.createElement("div"));
+    textLayer.setSession(session);
+    textLayer.config = {
+        characterWidth: 10,
+        lineHeight: 20
+    };
+
+    session.setValue(input);
+
+    var stringBuilder = [];
+    var length =  session.getLength();
+
+    for(var ix = 0; ix < length; ix++) {
+        stringBuilder.push("<div class='ace_line'>");
+        if (!disableGutter)
+            stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix + lineStart) + "</span>");
+        textLayer.$renderLine(stringBuilder, ix, true, false);
+        stringBuilder.push("</div>");
+    }
+
+    // let's prepare the whole html
+    var html = "<div class='" + theme.cssClass + "'>" +
+        "<div class='ace_static_highlight'>" +
+            stringBuilder.join("") +
+        "</div>" +
+    "</div>";
+
+    textLayer.destroy();
+
+    return {
+        css: baseStyles + theme.cssText,
+        html: html
+    };
+};
+
+
+
+exports.highlight = function(el, opts, callback) {
+    var m = el.className.match(/lang-(\w+)/);
+    var mode = opts.mode || m && ("ace/mode/" + m[1]);
+    if (!mode)
+        return false;
+    var theme = opts.theme || "ace/theme/textmate";
+    
+    var data = "";
+    var nodes = [];
+
+    if (el.firstElementChild) {
+        var textLen = 0;
+        for (var i = 0; i < el.childNodes.length; i++) {
+            var ch = el.childNodes[i];
+            if (ch.nodeType == 3) {
+                textLen += ch.data.length;
+                data += ch.data;
+            } else {
+                nodes.push(textLen, ch);
+            }
+        }
+    } else {
+        data = dom.getInnerText(el);
+    }
+    
+    exports.render(data, mode, theme, 1, true, function (highlighted) {
+        dom.importCssString(highlighted.css, "ace_highlight");
+        el.innerHTML = highlighted.html;
+        var container = el.firstChild.firstChild
+        for (var i = 0; i < nodes.length; i += 2) {
+            var pos = highlighted.session.doc.indexToPosition(nodes[i])
+            var node = nodes[i + 1];
+            var lineEl = container.children[pos.row];
+            lineEl && lineEl.appendChild(nodes[i+1]);
+        }
+        callback && callback();
+    });
+};
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/static_highlight_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/static_highlight_test.js b/src/fauxton/assets/js/libs/ace/ext/static_highlight_test.js
new file mode 100644
index 0000000..bdbecbf
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/static_highlight_test.js
@@ -0,0 +1,89 @@
+if (typeof process !== "undefined") {
+    require("amd-loader");
+    require("../test/mockdom");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var assert = require("assert");
+var highlighter = require("./static_highlight");
+var JavaScriptMode = require("../mode/javascript").Mode;
+var TextMode = require("../mode/text").Mode;
+
+// Execution ORDER: test.setUpSuite, setUp, testFn, tearDown, test.tearDownSuite
+module.exports = {
+    timeout: 10000,
+
+    "test simple snippet": function(next) {
+        var theme = require("../theme/tomorrow");
+        var snippet = [
+            "/** this is a function",
+            "*",
+            "*/",
+            "function hello (a, b, c) {",
+            "    console.log(a * b + c + 'sup$');",
+            "}"
+        ].join("\n");
+        var mode = new JavaScriptMode();
+
+        var result = highlighter.render(snippet, mode, theme);
+        assert.equal(result.html, "<div class='ace-tomorrow'><div class='ace_static_highlight'><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>1</span><span class='ace_comment ace_doc'>/**\xa0this\xa0is\xa0a\xa0function</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>2</span><span class='ace_comment ace_doc'>*</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>3</span><span class='ace_comment ace_doc'>*/</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>4</span><span class='ace_storage ace_type'>function</span>\xa0<span class='ace_entity ace_name ace_function'>hello</span>\xa0<span class='ace_paren ace_lparen'>(</span><span class='ace_variable ace_parameter'>a</span><span class='ace_punctuation ace_operator'>,\xa0</span><span class='ace_variable ace_parameter'>b</span><span class='ace_punctuation ace_operator'>,\xa0</span>
 <span class='ace_variable ace_parameter'>c</span><span class='ace_paren ace_rparen'>)</span>\xa0<span class='ace_paren ace_lparen'>{</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>5</span>\xa0\xa0\xa0\xa0<span class='ace_storage ace_type'>console</span><span class='ace_punctuation ace_operator'>.</span><span class='ace_support ace_function ace_firebug'>log</span><span class='ace_paren ace_lparen'>(</span><span class='ace_identifier'>a</span>\xa0<span class='ace_keyword ace_operator'>*</span>\xa0<span class='ace_identifier'>b</span>\xa0<span class='ace_keyword ace_operator'>+</span>\xa0<span class='ace_identifier'>c</span>\xa0<span class='ace_keyword ace_operator'>+</span>\xa0<span class='ace_string'>'sup$'</span><span class='ace_paren ace_rparen'>)</span><span class='ace_punctuation ace_operator'>;</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>6</span><span class='ace_paren ace_rparen'>}</sp
 an></div></div></div>");
+        assert.ok(!!result.css);
+        next();
+    },
+
+    "test css from theme is used": function(next) {
+        var theme = require("../theme/tomorrow");
+        var snippet = [
+            "/** this is a function",
+            "*",
+            "*/",
+            "function hello (a, b, c) {",
+            "    console.log(a * b + c + 'sup?');",
+            "}"
+        ].join("\n");
+        var mode = new JavaScriptMode();
+
+        var result = highlighter.render(snippet, mode, theme);
+
+        assert.ok(result.css.indexOf(theme.cssText) !== -1);
+
+        next();
+    },
+
+    "test theme classname should be in output html": function(next) {
+        var theme = require("../theme/tomorrow");
+        var snippet = [
+            "/** this is a function",
+            "*",
+            "*/",
+            "function hello (a, b, c) {",
+            "    console.log(a * b + c + 'sup?');",
+            "}"
+        ].join("\n");
+        var mode = new JavaScriptMode();
+
+        var result = highlighter.render(snippet, mode, theme);
+        assert.equal(!!result.html.match(/<div class='ace-tomorrow'>/), true);
+
+        next();
+    },
+    
+    "test js string replace specials": function(next) {
+        var theme = require("../theme/tomorrow");
+        var snippet = "$'$1$2$$$&";
+        var mode = new TextMode();
+
+        var result = highlighter.render(snippet, mode, theme);
+        assert.ok(result.html.indexOf(snippet) != -1);
+
+        next();
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec();
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/statusbar.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/statusbar.js b/src/fauxton/assets/js/libs/ace/ext/statusbar.js
new file mode 100644
index 0000000..666febf
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/statusbar.js
@@ -0,0 +1,49 @@
+define(function(require, exports, module) {
+"use strict";
+/** simple statusbar **/
+var dom = require("ace/lib/dom");
+var lang = require("ace/lib/lang");
+
+var StatusBar = function(editor, parentNode) {
+    this.element = dom.createElement("div");
+    this.element.className = "ace_status-indicator";
+    this.element.style.cssText = "display: inline-block;";
+    parentNode.appendChild(this.element);
+
+    var statusUpdate = lang.delayedCall(function(){
+        this.updateStatus(editor)
+    }.bind(this));
+    editor.on("changeStatus", function() {
+        statusUpdate.schedule(100);
+    });
+    editor.on("changeSelection", function() {
+        statusUpdate.schedule(100);
+    });
+};
+
+(function(){
+    this.updateStatus = function(editor) {
+        var status = [];
+        function add(str, separator) {
+            str && status.push(str, separator || "|");
+        }
+
+        if (editor.$vimModeHandler)
+            add(editor.$vimModeHandler.getStatusText());
+        else if (editor.commands.recording)
+            add("REC");
+
+        var c = editor.selection.lead;
+        add(c.row + ":" + c.column, " ");
+        if (!editor.selection.isEmpty()) {
+            var r = editor.getSelectionRange();
+            add("(" + (r.end.row - r.start.row) + ":"  +(r.end.column - r.start.column) + ")");
+        }
+        status.pop();
+        this.element.textContent = status.join("");
+    };
+}).call(StatusBar.prototype);
+
+exports.StatusBar = StatusBar;
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/textarea.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/textarea.js b/src/fauxton/assets/js/libs/ace/ext/textarea.js
new file mode 100644
index 0000000..86b299e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/textarea.js
@@ -0,0 +1,547 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var event = require("../lib/event");
+var UA = require("../lib/useragent");
+var net = require("../lib/net");
+var ace = require("../ace");
+
+require("../theme/textmate");
+
+module.exports = exports = ace;
+
+/*
+ * Returns the CSS property of element.
+ *   1) If the CSS property is on the style object of the element, use it, OR
+ *   2) Compute the CSS property
+ *
+ * If the property can't get computed, is 'auto' or 'intrinsic', the former
+ * calculated property is used (this can happen in cases where the textarea
+ * is hidden and has no dimension styles).
+ */
+var getCSSProperty = function(element, container, property) {
+    var ret = element.style[property];
+
+    if (!ret) {
+        if (window.getComputedStyle) {
+            ret = window.getComputedStyle(element, '').getPropertyValue(property);
+        } else {
+            ret = element.currentStyle[property];
+        }
+    }
+
+    if (!ret || ret == 'auto' || ret == 'intrinsic') {
+        ret = container.style[property];
+    }
+    return ret;
+};
+
+function applyStyles(elm, styles) {
+    for (var style in styles) {
+        elm.style[style] = styles[style];
+    }
+}
+
+function setupContainer(element, getValue) {
+    if (element.type != 'textarea') {
+        throw new Error("Textarea required!");
+    }
+
+    var parentNode = element.parentNode;
+
+    // This will hold the editor.
+    var container = document.createElement('div');
+
+    // To put Ace in the place of the textarea, we have to copy a few of the
+    // textarea's style attributes to the div container.
+    //
+    // The problem is that the properties have to get computed (they might be
+    // defined by a CSS file on the page - you can't access such rules that
+    // apply to an element via elm.style). Computed properties are converted to
+    // pixels although the dimension might be given as percentage. When the
+    // window resizes, the dimensions defined by percentages changes, so the
+    // properties have to get recomputed to get the new/true pixels.
+    var resizeEvent = function() {
+        var style = 'position:relative;';
+        [
+            'margin-top', 'margin-left', 'margin-right', 'margin-bottom'
+        ].forEach(function(item) {
+            style += item + ':' +
+                        getCSSProperty(element, container, item) + ';';
+        });
+
+        // Calculating the width/height of the textarea is somewhat tricky. To
+        // do it right, you have to include the paddings to the sides as well
+        // (eg. width = width + padding-left, -right).  This works well, as
+        // long as the width of the element is not set or given in pixels. In
+        // this case and after the textarea is hidden, getCSSProperty(element,
+        // container, 'width') will still return pixel value. If the element
+        // has realtiv dimensions (e.g. width='95<percent>')
+        // getCSSProperty(...) will return pixel values only as long as the
+        // textarea is visible. After it is hidden getCSSProperty will return
+        // the relative dimensions as they are set on the element (in the case
+        // of width, 95<percent>).
+        // Making the sum of pixel vaules (e.g. padding) and realtive values
+        // (e.g. <percent>) is not possible. As such the padding styles are
+        // ignored.
+
+        // The complete width is the width of the textarea + the padding
+        // to the left and right.
+        var width = getCSSProperty(element, container, 'width') || (element.clientWidth + "px");
+        var height = getCSSProperty(element, container, 'height')  || (element.clientHeight + "px");
+        style += 'height:' + height + ';width:' + width + ';';
+
+        // Set the display property to 'inline-block'.
+        style += 'display:inline-block;';
+        container.setAttribute('style', style);
+    };
+    event.addListener(window, 'resize', resizeEvent);
+
+    // Call the resizeEvent once, so that the size of the container is
+    // calculated.
+    resizeEvent();
+
+    // Insert the div container after the element.
+    parentNode.insertBefore(container, element.nextSibling);
+
+    // Override the forms onsubmit function. Set the innerHTML and value
+    // of the textarea before submitting.
+    while (parentNode !== document) {
+        if (parentNode.tagName.toUpperCase() === 'FORM') {
+            var oldSumit = parentNode.onsubmit;
+            // Override the onsubmit function of the form.
+            parentNode.onsubmit = function(evt) {
+                element.value = getValue();
+                // If there is a onsubmit function already, then call
+                // it with the current context and pass the event.
+                if (oldSumit) {
+                    oldSumit.call(this, evt);
+                }
+            };
+            break;
+        }
+        parentNode = parentNode.parentNode;
+    }
+    return container;
+}
+
+exports.transformTextarea = function(element, loader) {
+    var session;
+    var container = setupContainer(element, function() {
+        return session.getValue();
+    });
+
+    // Hide the element.
+    element.style.display = 'none';
+    container.style.background = 'white';
+
+    //
+    var editorDiv = document.createElement("div");
+    applyStyles(editorDiv, {
+        top: "0px",
+        left: "0px",
+        right: "0px",
+        bottom: "0px",
+        border: "1px solid gray",
+        position: "absolute"
+    });
+    container.appendChild(editorDiv);
+
+    var settingOpener = document.createElement("div");
+    applyStyles(settingOpener, {
+        position: "absolute",
+        right: "0px",
+        bottom: "0px",
+        background: "red",
+        cursor: "nw-resize",
+        borderStyle: "solid",
+        borderWidth: "9px 8px 10px 9px",
+        width: "2px",
+        borderColor: "lightblue gray gray lightblue",
+        zIndex: 101
+    });
+
+    var settingDiv = document.createElement("div");
+    var settingDivStyles = {
+        top: "0px",
+        left: "20%",
+        right: "0px",
+        bottom: "0px",
+        position: "absolute",
+        padding: "5px",
+        zIndex: 100,
+        color: "white",
+        display: "none",
+        overflow: "auto",
+        fontSize: "14px",
+        boxShadow: "-5px 2px 3px gray"
+    };
+    if (!UA.isOldIE) {
+        settingDivStyles.backgroundColor = "rgba(0, 0, 0, 0.6)";
+    } else {
+        settingDivStyles.backgroundColor = "#333";
+    }
+
+    applyStyles(settingDiv, settingDivStyles);
+    container.appendChild(settingDiv);
+
+    // Power up ace on the textarea:
+    var options = {};
+
+    var editor = ace.edit(editorDiv);
+    session = editor.getSession();
+
+    session.setValue(element.value || element.innerHTML);
+    editor.focus();
+
+    // Add the settingPanel opener to the editor's div.
+    container.appendChild(settingOpener);
+
+    // Create the API.
+    setupApi(editor, editorDiv, settingDiv, ace, options, loader);
+
+    // Create the setting's panel.
+    setupSettingPanel(settingDiv, settingOpener, editor, options);
+
+    var state = "";
+    event.addListener(settingOpener, "mousemove", function(e) {
+        var rect = this.getBoundingClientRect();
+        var x = e.clientX - rect.left, y = e.clientY - rect.top;
+        if (x + y < (rect.width + rect.height)/2) {
+            this.style.cursor = "pointer";
+            state = "toggle";
+        } else {
+            state = "resize";
+            this.style.cursor = "nw-resize";
+        }
+    });
+
+    event.addListener(settingOpener, "mousedown", function(e) {
+        if (state == "toggle") {
+            editor.setDisplaySettings();
+            return;
+        }
+        container.style.zIndex = 100000;
+        var rect = container.getBoundingClientRect();
+        var startX = rect.width  + rect.left - e.clientX;
+        var startY = rect.height  + rect.top - e.clientY;
+        event.capture(settingOpener, function(e) {
+            container.style.width = e.clientX - rect.left + startX + "px";
+            container.style.height = e.clientY - rect.top + startY + "px";
+            editor.resize();
+        }, function() {});
+    });
+
+    return editor;
+};
+
+function load(url, module, callback) {
+    net.loadScript(url, function() {
+        require([module], callback);
+    });
+}
+
+function setupApi(editor, editorDiv, settingDiv, ace, options, loader) {
+    var session = editor.getSession();
+    var renderer = editor.renderer;
+    loader = loader || load;
+
+    function toBool(value) {
+        return value === "true" || value == true;
+    }
+
+    editor.setDisplaySettings = function(display) {
+        if (display == null)
+            display = settingDiv.style.display == "none";
+        if (display) {
+            settingDiv.style.display = "block";
+            settingDiv.hideButton.focus();
+            editor.on("focus", function onFocus() {
+                editor.removeListener("focus", onFocus);
+                settingDiv.style.display = "none";
+            });
+        } else {
+            editor.focus();
+        }
+    };
+
+    editor.$setOption = editor.setOption;
+    editor.setOption = function(key, value) {
+        if (options[key] == value) return;
+
+        switch (key) {
+            case "mode":
+                if (value != "text") {
+                    // Load the required mode file. Files get loaded only once.
+                    loader("mode-" + value + ".js", "ace/mode/" + value, function() {
+                        var aceMode = require("../mode/" + value).Mode;
+                        session.setMode(new aceMode());
+                    });
+                } else {
+                    session.setMode(new (require("../mode/text").Mode));
+                }
+            break;
+
+            case "theme":
+                if (value != "textmate") {
+                    // Load the required theme file. Files get loaded only once.
+                    loader("theme-" + value + ".js", "ace/theme/" + value, function() {
+                        editor.setTheme("ace/theme/" + value);
+                    });
+                } else {
+                    editor.setTheme("ace/theme/textmate");
+                }
+            break;
+
+            case "fontSize":
+                editorDiv.style.fontSize = value;
+            break;
+
+            case "keybindings":
+                switch (value) {
+                    case "vim":
+                        editor.setKeyboardHandler("ace/keyboard/vim");
+                        break;
+                    case "emacs":
+                        editor.setKeyboardHandler("ace/keyboard/emacs");
+                        break;
+                    default:
+                        editor.setKeyboardHandler(null);
+                }
+            break;
+
+            case "softWrap":
+                switch (value) {
+                    case "off":
+                        session.setUseWrapMode(false);
+                        renderer.setPrintMarginColumn(80);
+                    break;
+                    case "40":
+                        session.setUseWrapMode(true);
+                        session.setWrapLimitRange(40, 40);
+                        renderer.setPrintMarginColumn(40);
+                    break;
+                    case "80":
+                        session.setUseWrapMode(true);
+                        session.setWrapLimitRange(80, 80);
+                        renderer.setPrintMarginColumn(80);
+                    break;
+                    case "free":
+                        session.setUseWrapMode(true);
+                        session.setWrapLimitRange(null, null);
+                        renderer.setPrintMarginColumn(80);
+                    break;
+                }
+            break;
+            
+            default:
+                editor.$setOption(key, toBool(value));
+        }
+
+        options[key] = value;
+    };
+
+    editor.getOption = function(key) {
+        return options[key];
+    };
+
+    editor.getOptions = function() {
+        return options;
+    };
+
+    editor.setOptions(exports.options);
+
+    return editor;
+}
+
+function setupSettingPanel(settingDiv, settingOpener, editor, options) {
+    var BOOL = null;
+
+    var desc = {
+        mode:            "Mode:",
+        gutter:          "Display Gutter:",
+        theme:           "Theme:",
+        fontSize:        "Font Size:",
+        softWrap:        "Soft Wrap:",
+        keybindings:     "Keyboard",
+        showPrintMargin: "Show Print Margin:",
+        useSoftTabs:     "Use Soft Tabs:",
+        showInvisibles:  "Show Invisibles"
+    };
+
+    var optionValues = {
+        mode: {
+            text:       "Plain",
+            javascript: "JavaScript",
+            xml:        "XML",
+            html:       "HTML",
+            css:        "CSS",
+            scss:       "SCSS",
+            python:     "Python",
+            php:        "PHP",
+            java:       "Java",
+            ruby:       "Ruby",
+            c_cpp:      "C/C++",
+            coffee:     "CoffeeScript",
+            json:       "json",
+            perl:       "Perl",
+            clojure:    "Clojure",
+            ocaml:      "OCaml",
+            csharp:     "C#",
+            haxe:       "haXe",
+            svg:        "SVG",
+            textile:    "Textile",
+            groovy:     "Groovy",
+            liquid:     "Liquid",
+            Scala:      "Scala"
+        },
+        theme: {
+            clouds:           "Clouds",
+            clouds_midnight:  "Clouds Midnight",
+            cobalt:           "Cobalt",
+            crimson_editor:   "Crimson Editor",
+            dawn:             "Dawn",
+            eclipse:          "Eclipse",
+            idle_fingers:     "Idle Fingers",
+            kr_theme:         "Kr Theme",
+            merbivore:        "Merbivore",
+            merbivore_soft:   "Merbivore Soft",
+            mono_industrial:  "Mono Industrial",
+            monokai:          "Monokai",
+            pastel_on_dark:   "Pastel On Dark",
+            solarized_dark:   "Solarized Dark",
+            solarized_light:  "Solarized Light",
+            textmate:         "Textmate",
+            twilight:         "Twilight",
+            vibrant_ink:      "Vibrant Ink"
+        },
+        gutter: BOOL,
+        fontSize: {
+            "10px": "10px",
+            "11px": "11px",
+            "12px": "12px",
+            "14px": "14px",
+            "16px": "16px"
+        },
+        softWrap: {
+            off:    "Off",
+            40:     "40",
+            80:     "80",
+            free:   "Free"
+        },
+        keybindings: {
+            ace: "ace",
+            vim: "vim",
+            emacs: "emacs"
+        },
+        showPrintMargin:    BOOL,
+        useSoftTabs:        BOOL,
+        showInvisibles:     BOOL
+    };
+
+    var table = [];
+    table.push("<table><tr><th>Setting</th><th>Value</th></tr>");
+
+    function renderOption(builder, option, obj, cValue) {
+        if (!obj) {
+            builder.push(
+                "<input type='checkbox' title='", option, "' ",
+                    cValue == "true" ? "checked='true'" : "",
+               "'></input>"
+            );
+            return;
+        }
+        builder.push("<select title='" + option + "'>");
+        for (var value in obj) {
+            builder.push("<option value='" + value + "' ");
+
+            if (cValue == value) {
+                builder.push(" selected ");
+            }
+
+            builder.push(">",
+                obj[value],
+                "</option>");
+        }
+        builder.push("</select>");
+    }
+
+    for (var option in options) {
+        table.push("<tr><td>", desc[option], "</td>");
+        table.push("<td>");
+        renderOption(table, option, optionValues[option], options[option]);
+        table.push("</td></tr>");
+    }
+    table.push("</table>");
+    settingDiv.innerHTML = table.join("");
+
+    var onChange = function(e) {
+        var select = e.currentTarget;
+        editor.setOption(select.title, select.value);
+    };
+    var onClick = function(e) {
+        var cb = e.currentTarget;
+        editor.setOption(cb.title, cb.checked);
+    };
+    var selects = settingDiv.getElementsByTagName("select");
+    for (var i = 0; i < selects.length; i++)
+        selects[i].onchange = onChange;
+    var cbs = settingDiv.getElementsByTagName("input");
+    for (var i = 0; i < cbs.length; i++)
+        cbs[i].onclick = onClick;
+
+
+    var button = document.createElement("input");
+    button.type = "button";
+    button.value = "Hide";
+    event.addListener(button, "click", function() {
+        editor.setDisplaySettings(false);
+    });
+    settingDiv.appendChild(button);
+    settingDiv.hideButton = button;
+}
+
+// Default startup options.
+exports.options = {
+    mode:               "text",
+    theme:              "textmate",
+    gutter:             "false",
+    fontSize:           "12px",
+    softWrap:           "off",
+    keybindings:        "ace",
+    showPrintMargin:    "false",
+    useSoftTabs:        "true",
+    showInvisibles:     "false"
+};
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/themelist.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/themelist.js b/src/fauxton/assets/js/libs/ace/ext/themelist.js
new file mode 100644
index 0000000..1032f72
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/themelist.js
@@ -0,0 +1,79 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl
+ * All rights reserved.
+ *
+ * Contributed to Ajax.org under the BSD license.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/
+/*global define, require */
+
+/**
+ * Generates a list of themes available when ace was built.
+ * @fileOverview Generates a list of themes available when ace was built.
+ * @author <a href="mailto:matthewkastor@gmail.com">
+ *  Matthew Christopher Kastor-Inare III </a><br />
+ *  ☭ Hial Atropa!! ☭
+ */
+
+define(function(require, exports, module) {
+"use strict";
+
+/**
+ * An array containing information about available themes.
+ */
+module.exports.themes = require('ace/ext/themelist_utils/themes').themes;
+
+/**
+ * Creates a theme description.
+ * @param {string} name The file name of the theme.
+ * @returns {ThemeDescription} Returns a theme description object which has
+ *  three properties: the name gives the filename, the desc gives a menu
+ *  friendly name, and the theme gives the string to set the theme with
+ *  `setTheme`
+ */
+module.exports.ThemeDescription = function(name) {
+    this.name = name;
+    this.desc = name.split('_'
+        ).map(
+            function(namePart) {
+                return namePart[0].toUpperCase() + namePart.slice(1);
+            }
+        ).join(' ');
+    this.theme = "ace/theme/" + name;
+};
+
+module.exports.themesByName = {};
+
+module.exports.themes = module.exports.themes.map(function(name) {
+    module.exports.themesByName[name] = new module.exports.ThemeDescription(name);
+    return module.exports.themesByName[name];
+});
+
+});
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/themelist_utils/themes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/themelist_utils/themes.js b/src/fauxton/assets/js/libs/ace/ext/themelist_utils/themes.js
new file mode 100644
index 0000000..2e490c9
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/themelist_utils/themes.js
@@ -0,0 +1,36 @@
+define(function(require, exports, module) {
+
+module.exports.themes = [
+    "ambiance",
+    "chaos",
+    "chrome",
+    "clouds",
+    "clouds_midnight",
+    "cobalt",
+    "crimson_editor",
+    "dawn",
+    "dreamweaver",
+    "eclipse",
+    "github",
+    "idle_fingers",
+    "kr_theme",
+    "merbivore",
+    "merbivore_soft",
+    "mono_industrial",
+    "monokai",
+    "pastel_on_dark",
+    "solarized_dark",
+    "solarized_light",
+    "terminal",
+    "textmate",
+    "tomorrow",
+    "tomorrow_night",
+    "tomorrow_night_blue",
+    "tomorrow_night_bright",
+    "tomorrow_night_eighties",
+    "twilight",
+    "vibrant_ink",
+    "xcode"
+];
+
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/ext/whitespace.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/ext/whitespace.js b/src/fauxton/assets/js/libs/ace/ext/whitespace.js
new file mode 100644
index 0000000..83486fb
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/ext/whitespace.js
@@ -0,0 +1,212 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var lang = require("../lib/lang");
+
+// based on http://www.freehackers.org/Indent_Finder
+exports.$detectIndentation = function(lines, fallback) {
+    var stats = [];
+    var changes = [];
+    var tabIndents = 0;
+    var prevSpaces = 0;
+    var max = Math.min(lines.length, 1000);
+    for (var i = 0; i < max; i++) {
+        var line = lines[i];
+        // ignore empty and comment lines
+        if (!/^\s*[^*+\-\s]/.test(line))
+            continue;
+
+        var tabs = line.match(/^\t*/)[0].length;
+        if (line[0] == "\t")
+            tabIndents++;
+
+        var spaces = line.match(/^ */)[0].length;
+        if (spaces && line[spaces] != "\t") {
+            var diff = spaces - prevSpaces;
+            if (diff > 0 && !(prevSpaces%diff) && !(spaces%diff))
+                changes[diff] = (changes[diff] || 0) + 1;
+
+            stats[spaces] = (stats[spaces] || 0) + 1;
+        }
+        prevSpaces = spaces;
+
+        // ignore lines ending with backslash
+        while (line[line.length - 1] == "\\")
+            line = lines[i++];
+    }
+
+    function getScore(indent) {
+        var score = 0;
+        for (var i = indent; i < stats.length; i += indent)
+            score += stats[i] || 0;
+        return score;
+    }
+
+    var changesTotal = changes.reduce(function(a,b){return a+b}, 0);
+
+    var first = {score: 0, length: 0};
+    var spaceIndents = 0;
+    for (var i = 1; i < 12; i++) {
+        if (i == 1) {
+            spaceIndents = getScore(i);
+            var score = 1;
+        } else
+            var score = getScore(i) / spaceIndents;
+
+        if (changes[i]) {
+            score += changes[i] / changesTotal;
+        }
+
+        if (score > first.score)
+            first = {score: score, length: i};
+    }
+
+    if (first.score && first.score > 1.4)
+        var tabLength = first.length;
+
+    if (tabIndents > spaceIndents + 1)
+        return {ch: "\t", length: tabLength};
+
+    if (spaceIndents + 1 > tabIndents)
+        return {ch: " ", length: tabLength};
+};
+
+exports.detectIndentation = function(session) {
+    var lines = session.getLines(0, 1000);
+    var indent = exports.$detectIndentation(lines) || {};
+
+    if (indent.ch)
+        session.setUseSoftTabs(indent.ch == " ");
+
+    if (indent.length)
+        session.setTabSize(indent.length);
+    return indent;
+};
+
+exports.trimTrailingSpace = function(session, trimEmpty) {
+    var doc = session.getDocument();
+    var lines = doc.getAllLines();
+    
+    var min = trimEmpty ? -1 : 0;
+
+    for (var i = 0, l=lines.length; i < l; i++) {
+        var line = lines[i];
+        var index = line.search(/\s+$/);
+
+        if (index > min)
+            doc.removeInLine(i, index, line.length);
+    }
+};
+
+exports.convertIndentation = function(session, ch, len) {
+    var oldCh = session.getTabString()[0];
+    var oldLen = session.getTabSize();
+    if (!len) len = oldLen;
+    if (!ch) ch = oldCh;
+
+    var tab = ch == "\t" ? ch: lang.stringRepeat(ch, len);
+
+    var doc = session.doc;
+    var lines = doc.getAllLines();
+
+    var cache = {};
+    var spaceCache = {};
+    for (var i = 0, l=lines.length; i < l; i++) {
+        var line = lines[i];
+        var match = line.match(/^\s*/)[0];
+        if (match) {
+            var w = session.$getStringScreenWidth(match)[0];
+            var tabCount = Math.floor(w/oldLen);
+            var reminder = w%oldLen;
+            var toInsert = cache[tabCount] || (cache[tabCount] = lang.stringRepeat(tab, tabCount));
+            toInsert += spaceCache[reminder] || (spaceCache[reminder] = lang.stringRepeat(" ", reminder));
+
+            if (toInsert != match) {
+                doc.removeInLine(i, 0, match.length);
+                doc.insertInLine({row: i, column: 0}, toInsert);
+            }
+        }
+    }
+    session.setTabSize(len);
+    session.setUseSoftTabs(ch == " ");
+};
+
+exports.$parseStringArg = function(text) {
+    var indent = {};
+    if (/t/.test(text))
+        indent.ch = "\t";
+    else if (/s/.test(text))
+        indent.ch = " ";
+    var m = text.match(/\d+/);
+    if (m)
+        indent.length = parseInt(m[0], 10);
+    return indent;
+};
+
+exports.$parseArg = function(arg) {
+    if (!arg)
+        return {};
+    if (typeof arg == "string")
+        return exports.$parseStringArg(arg);
+    if (typeof arg.text == "string")
+        return exports.$parseStringArg(arg.text);
+    return arg;
+};
+
+exports.commands = [{
+    name: "detectIndentation",
+    exec: function(editor) {
+        exports.detectIndentation(editor.session);
+        // todo show message?
+    }
+}, {
+    name: "trimTrailingSpace",
+    exec: function(editor) {
+        exports.trimTrailingSpace(editor.session);
+    }
+}, {
+    name: "convertIndentation",
+    exec: function(editor, arg) {
+        var indent = exports.$parseArg(arg);
+        exports.convertIndentation(editor.session, indent.ch, indent.length);
+    }
+}, {
+    name: "setIndentation",
+    exec: function(editor, arg) {
+        var indent = exports.$parseArg(arg);
+        indent.length && editor.session.setTabSize(indent.length);
+        indent.ch && editor.session.setUseSoftTabs(indent.ch == " ");
+    }
+}];
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/incremental_search.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/incremental_search.js b/src/fauxton/assets/js/libs/ace/incremental_search.js
new file mode 100644
index 0000000..e6fa892
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/incremental_search.js
@@ -0,0 +1,259 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("./lib/oop");
+var Range = require("./range").Range;
+var Search = require("./search").Search;
+var SearchHighlight = require("./search_highlight").SearchHighlight;
+var iSearchCommandModule = require("./commands/incremental_search_commands");
+var ISearchKbd = iSearchCommandModule.IncrementalSearchKeyboardHandler;
+
+/**
+ * @class IncrementalSearch
+ *
+ * Implements immediate searching while the user is typing. When incremental
+ * search is activated, keystrokes into the editor will be used for composing
+ * a search term. Immediately after every keystroke the search is updated:
+ * - so-far-matching characters are highlighted
+ * - the cursor is moved to the next match
+ *
+ **/
+
+
+/**
+ *
+ *
+ * Creates a new `IncrementalSearch` object.
+ *
+ * @constructor
+ **/
+function IncrementalSearch() {
+    this.$options = {wrap: false, skipCurrent: false};
+    this.$keyboardHandler = new ISearchKbd(this);
+}
+
+oop.inherits(IncrementalSearch, Search);
+
+;(function() {
+
+    this.activate = function(ed, backwards) {
+        this.$editor = ed;
+        this.$startPos = this.$currentPos = ed.getCursorPosition();
+        this.$options.needle = '';
+        this.$options.backwards = backwards;
+        ed.keyBinding.addKeyboardHandler(this.$keyboardHandler);
+        this.$mousedownHandler = ed.addEventListener('mousedown', this.onMouseDown.bind(this));
+        this.selectionFix(ed);
+        this.statusMessage(true);
+    }
+
+    this.deactivate = function(reset) {
+        this.cancelSearch(reset);
+        this.$editor.keyBinding.removeKeyboardHandler(this.$keyboardHandler);
+        if (this.$mousedownHandler) {
+            this.$editor.removeEventListener('mousedown', this.$mousedownHandler);
+            delete this.$mousedownHandler;
+        }
+        this.message('');
+    }
+
+    this.selectionFix = function(editor) {
+        // Fix selection bug: When clicked inside the editor
+        // editor.selection.$isEmpty is false even if the mouse click did not
+        // open a selection. This is interpreted by the move commands to
+        // extend the selection. To only extend the selection when there is
+        // one, we clear it here
+        if (editor.selection.isEmpty() && !editor.session.$emacsMark) {
+            editor.clearSelection();
+        }
+    }
+
+    this.highlight = function(regexp) {
+        var sess = this.$editor.session,
+            hl = sess.$isearchHighlight = sess.$isearchHighlight || sess.addDynamicMarker(
+                new SearchHighlight(null, "ace_isearch-result", "text"));
+        hl.setRegexp(regexp);
+        sess._emit("changeBackMarker"); // force highlight layer redraw
+    }
+
+    this.cancelSearch = function(reset) {
+        var e = this.$editor;
+        this.$prevNeedle = this.$options.needle;
+        this.$options.needle = '';
+        if (reset) {
+            e.moveCursorToPosition(this.$startPos);
+            this.$currentPos = this.$startPos;
+        } else {
+            e.pushEmacsMark && e.pushEmacsMark(this.$startPos, false);
+        }
+        this.highlight(null);
+        return Range.fromPoints(this.$currentPos, this.$currentPos);
+    }
+
+    this.highlightAndFindWithNeedle = function(moveToNext, needleUpdateFunc) {
+        if (!this.$editor) return null;
+        var options = this.$options;
+
+        // get search term
+        if (needleUpdateFunc) {
+            options.needle = needleUpdateFunc.call(this, options.needle || '') || '';
+        }
+        if (options.needle.length === 0) {
+            this.statusMessage(true);
+            return this.cancelSearch(true);
+        };
+
+        // try to find the next occurence and enable  highlighting marker
+        options.start = this.$currentPos;
+        var session = this.$editor.session,
+            found = this.find(session);
+        if (found) {
+            if (options.backwards) found = Range.fromPoints(found.end, found.start);
+            this.$editor.moveCursorToPosition(found.end);
+            if (moveToNext) this.$currentPos = found.end;
+            // highlight after cursor move, so selection works properly
+            this.highlight(options.re)
+        }
+
+        this.statusMessage(found);
+
+        return found;
+    }
+
+    this.addChar = function(c) {
+        return this.highlightAndFindWithNeedle(false, function(needle) {
+            return needle + c;
+        });
+    }
+
+    this.removeChar = function(c) {
+        return this.highlightAndFindWithNeedle(false, function(needle) {
+            return needle.length > 0 ? needle.substring(0, needle.length-1) : needle;
+        });
+    }
+
+    this.next = function(options) {
+        // try to find the next occurence of whatever we have searched for
+        // earlier.
+        // options = {[backwards: BOOL], [useCurrentOrPrevSearch: BOOL]}
+        options = options || {};
+        this.$options.backwards = !!options.backwards;
+        this.$currentPos = this.$editor.getCursorPosition();
+        return this.highlightAndFindWithNeedle(true, function(needle) {
+            return options.useCurrentOrPrevSearch && needle.length === 0 ?
+                this.$prevNeedle || '' : needle;
+        });
+    }
+
+    this.onMouseDown = function(evt) {
+        // when mouse interaction happens then we quit incremental search
+        this.deactivate();
+        return true;
+    }
+
+    this.statusMessage = function(found) {
+        var options = this.$options, msg = '';
+        msg += options.backwards ? 'reverse-' : '';
+        msg += 'isearch: ' + options.needle;
+        msg += found ? '' : ' (not found)';
+        this.message(msg);
+    }
+
+    this.message = function(msg) {
+        if (this.$editor.showCommandLine) {
+            this.$editor.showCommandLine(msg);
+            this.$editor.focus();
+        } else {
+            console.log(msg);
+        }
+    }
+
+}).call(IncrementalSearch.prototype);
+
+
+exports.IncrementalSearch = IncrementalSearch;
+
+
+/**
+ *
+ * Config settings for enabling/disabling [[IncrementalSearch `IncrementalSearch`]].
+ *
+ **/
+
+var dom = require('./lib/dom');
+dom.importCssString && dom.importCssString("\
+.ace_marker-layer .ace_isearch-result {\
+  position: absolute;\
+  z-index: 6;\
+  -moz-box-sizing: border-box;\
+  -webkit-box-sizing: border-box;\
+  box-sizing: border-box;\
+}\
+div.ace_isearch-result {\
+  border-radius: 4px;\
+  background-color: rgba(255, 200, 0, 0.5);\
+  box-shadow: 0 0 4px rgb(255, 200, 0);\
+}\
+.ace_dark div.ace_isearch-result {\
+  background-color: rgb(100, 110, 160);\
+  box-shadow: 0 0 4px rgb(80, 90, 140);\
+}", "incremental-search-highlighting");
+
+// support for default keyboard handler
+var commands = require("./commands/command_manager");
+(function() {
+    this.setupIncrementalSearch = function(editor, val) {
+        if (this.usesIncrementalSearch == val) return;
+        this.usesIncrementalSearch = val;
+        var iSearchCommands = iSearchCommandModule.iSearchStartCommands;
+        var method = val ? 'addCommands' : 'removeCommands';
+        this[method](iSearchCommands);
+    };
+}).call(commands.CommandManager.prototype);
+
+// incremental search config option
+var Editor = require("./editor").Editor;
+require("./config").defineOptions(Editor.prototype, "editor", {
+    useIncrementalSearch: {
+        set: function(val) {
+            this.keyBinding.$handlers.forEach(function(handler) {
+                if (handler.setupIncrementalSearch) {
+                    handler.setupIncrementalSearch(this, val);
+                }
+            });
+            this._emit('incrementalSearchSettingChanged', {isEnabled: val});
+        }
+    }
+});
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/incremental_search_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/incremental_search_test.js b/src/fauxton/assets/js/libs/ace/incremental_search_test.js
new file mode 100644
index 0000000..c351d8e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/incremental_search_test.js
@@ -0,0 +1,208 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("./edit_session").EditSession;
+var Editor = require("./editor").Editor;
+var MockRenderer = require("./test/mockrenderer").MockRenderer;
+var Range = require("./range").Range;
+var assert = require("./test/assertions");
+var IncrementalSearch = require("./incremental_search").IncrementalSearch;
+
+var editor, iSearch;
+function testRanges(str, ranges) {
+    ranges = ranges || editor.selection.getAllRanges();
+    assert.equal(ranges + "", str + "");
+}
+
+// force "rerender"
+function callHighlighterUpdate() {
+    var session = editor.session,
+        ranges = [],
+        mockMarkerLayer = {
+            drawSingleLineMarker: function(_, markerRanges) {
+                ranges = ranges.concat(markerRanges);
+            }
+        }
+    session.$isearchHighlight.update([], mockMarkerLayer, session, {
+        firstRow: 0, lastRow: session.getRowLength()});
+    return ranges;
+}
+
+module.exports = {
+
+    name: "ACE incremental_search.js",
+
+    setUp: function() {
+        var session = new EditSession(["abc123", "xyz124"]);
+        editor = new Editor(new MockRenderer(), session);
+        iSearch = new IncrementalSearch();
+    },
+
+    "test: keyboard handler setup" : function() {
+        iSearch.activate(editor);
+        assert.equal(editor.getKeyboardHandler(), iSearch.$keyboardHandler);
+        iSearch.deactivate();
+        assert.notEqual(editor.getKeyboardHandler(), iSearch.$keyboardHandler);
+    },
+
+    "test: isearch highlight setup" : function() {
+        var sess = editor.session;
+        iSearch.activate(editor);
+        iSearch.highlight('foo');
+        var highl = sess.$isearchHighlight.id;
+        assert.ok(sess.$isearchHighlight, 'session has no isearch highlighter');
+        assert.equal(sess.getMarkers()[highl.id], highl.id, 'isearch highlight not in markers');
+        iSearch.deactivate();
+        iSearch.activate(editor);
+        iSearch.highlight('bar');
+        var highl2 = sess.$isearchHighlight.id;
+        assert.equal(highl2, highl, 'multiple isearch highlights');
+    },
+
+    "test: find simple text incrementally" : function() {
+        iSearch.activate(editor);
+        var range = iSearch.addChar('1'), // "1"
+            highlightRanges = callHighlighterUpdate(editor.session);
+        testRanges("Range: [0/3] -> [0/4]", [range], "range");
+        testRanges("Range: [0/3] -> [0/4],Range: [1/3] -> [1/4]", highlightRanges, "highlight");
+
+        range = iSearch.addChar('2'); // "12"
+        highlightRanges = callHighlighterUpdate(editor.session);
+        testRanges("Range: [0/3] -> [0/5]", [range], "range");
+        testRanges("Range: [0/3] -> [0/5],Range: [1/3] -> [1/5]", highlightRanges, "highlight");
+
+        range = iSearch.addChar('3'); // "123"
+        highlightRanges = callHighlighterUpdate(editor.session);
+        testRanges("Range: [0/3] -> [0/6]", [range], "range");
+        testRanges("Range: [0/3] -> [0/6]", highlightRanges, "highlight");
+
+        range = iSearch.removeChar(); // "12"
+        highlightRanges = callHighlighterUpdate(editor.session);
+        testRanges("Range: [0/3] -> [0/5]", [range], "range");
+        testRanges("Range: [0/3] -> [0/5],Range: [1/3] -> [1/5]", highlightRanges, "highlight");
+    },
+
+    "test: forward / backward" : function() {
+        iSearch.activate(editor);
+        iSearch.addChar('1'); iSearch.addChar('2');
+        var range = iSearch.next();
+        testRanges("Range: [1/3] -> [1/5]", [range], "range");
+
+        range = iSearch.next(); // nothing to find
+        testRanges("", [range], "range");
+
+        range = iSearch.next({backwards: true}); // backwards
+        testRanges("Range: [1/5] -> [1/3]", [range], "range");
+    },
+
+    "test: cancelSearch" : function() {
+        iSearch.activate(editor);
+        iSearch.addChar('1'); iSearch.addChar('2');
+        var range = iSearch.cancelSearch(true);
+        testRanges("Range: [0/0] -> [0/0]", [range], "range");
+
+        iSearch.addChar('1'); range = iSearch.addChar('2');
+        testRanges("Range: [0/3] -> [0/5]", [range], "range");
+    },
+
+    "test: failing search keeps pos" : function() {
+        iSearch.activate(editor);
+        iSearch.addChar('1'); iSearch.addChar('2');
+        var range = iSearch.addChar('x');
+        testRanges("", [range], "range");
+        assert.position(editor.getCursorPosition(), 0, 5);
+    },
+
+    "test: backwards search" : function() {
+        editor.moveCursorTo(1,0);
+        iSearch.activate(editor, true);
+        iSearch.addChar('1'); var range = iSearch.addChar('2');;
+        testRanges("Range: [0/5] -> [0/3]", [range], "range");
+        assert.position(editor.getCursorPosition(), 0, 3);
+    },
+
+    "test: forwards then backwards, same result, reoriented range" : function() {
+        iSearch.activate(editor);
+        iSearch.addChar('1'); var range = iSearch.addChar('2');;
+        testRanges("Range: [0/3] -> [0/5]", [range], "range");
+        assert.position(editor.getCursorPosition(), 0, 5);
+
+        range = iSearch.next({backwards: true});
+        testRanges("Range: [0/5] -> [0/3]", [range], "range");
+        assert.position(editor.getCursorPosition(), 0, 3);
+    },
+
+    "test: reuse prev search via option" : function() {
+        iSearch.activate(editor);
+        iSearch.addChar('1'); iSearch.addChar('2');;
+        assert.position(editor.getCursorPosition(), 0, 5);
+        iSearch.deactivate();
+
+        iSearch.activate(editor);
+        iSearch.next({backwards: false, useCurrentOrPrevSearch: true});
+        assert.position(editor.getCursorPosition(), 1, 5);
+    },
+
+    "test: don't extend selection range if selection is empty" : function() {
+        iSearch.activate(editor);
+        iSearch.addChar('1'); iSearch.addChar('2');;
+        testRanges("Range: [0/5] -> [0/5]", [editor.getSelectionRange()], "sel range");
+    },
+
+    "test: extend selection range if selection exists" : function() {
+        iSearch.activate(editor);
+        editor.selection.selectTo(0, 1);
+        iSearch.addChar('1'); iSearch.addChar('2');;
+        testRanges("Range: [0/0] -> [0/5]", [editor.getSelectionRange()], "sel range");
+    },
+
+    "test: extend selection in emacs mark mode" : function() {
+        var emacs = require('./keyboard/emacs');
+        editor.keyBinding.addKeyboardHandler(emacs.handler);
+        emacs.handler.commands.setMark.exec(editor);
+        iSearch.activate(editor);
+        iSearch.addChar('1'); iSearch.addChar('2');;
+        testRanges("Range: [0/0] -> [0/5]", [editor.getSelectionRange()], "sel range");
+    }
+
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}


[37/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_autohotkey.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_autohotkey.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_autohotkey.json
new file mode 100644
index 0000000..374310f
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_autohotkey.json
@@ -0,0 +1,261 @@
+[[
+   "start",
+  ["punctuation.ahk","#"],
+  ["keyword.command.ahk","NoEnv"]
+],[
+   "start",
+  ["keyword.command.ahk","SetBatchLines"],
+  ["text"," "],
+  ["constant.numeric","-1"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword.command.ahk","CoordMode"],
+  ["text"," "],
+  ["variable.parameter","Mouse"],
+  ["punctuation.ahk",","],
+  ["text"," "],
+  ["variable.parameter","Screen"]
+],[
+   "start",
+  ["keyword.command.ahk","OnExit"],
+  ["text"," "],
+  ["variable.parameter","GuiClose"]
+],[
+   "start"
+],[
+   "start",
+  ["text","zoom "],
+  ["keyword.operator.ahk",":="],
+  ["text"," 9"]
+],[
+   "start"
+],[
+   "start",
+  ["text","computeSize"],
+  ["punctuation.ahk","(){"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword.control.ahk","global"],
+  ["text"," as_x"]
+],[
+   "start",
+  ["text","\tas_x "],
+  ["keyword.operator.ahk",":="],
+  ["text"," "],
+  ["support.function.ahk","Round"],
+  ["punctuation.ahk","("],
+  ["text","ws_x"],
+  ["keyword.operator.ahk","/"],
+  ["text","zoom"],
+  ["keyword.operator.ahk","/"],
+  ["text","2 "],
+  ["keyword.operator.ahk","-"],
+  ["text"," 0.5"],
+  ["punctuation.ahk",")"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword.control.ahk","if"],
+  ["text"," "],
+  ["punctuation.ahk","("],
+  ["text","zoom"],
+  ["keyword.operator.ahk",">"],
+  ["text","1"],
+  ["punctuation.ahk",")"],
+  ["text"," "],
+  ["punctuation.ahk","{"]
+],[
+   "start",
+  ["text","\t\tpix "],
+  ["keyword.operator.ahk",":="],
+  ["text"," "],
+  ["support.function.ahk","Round"],
+  ["punctuation.ahk","("],
+  ["text","zoom"],
+  ["punctuation.ahk",")"]
+],[
+   "start",
+  ["text","\t"],
+  ["punctuation.ahk","}"],
+  ["text"," ele "],
+  ["punctuation.ahk","{"]
+],[
+   "start",
+  ["text","\t\tpix "],
+  ["keyword.operator.ahk",":="],
+  ["text"," 1"]
+],[
+   "start",
+  ["text","\t"],
+  ["punctuation.ahk","}"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword.command.ahk","ToolTip"],
+  ["text"," Message "],
+  ["punctuation.ahk","%"],
+  ["text","as_x"],
+  ["punctuation.ahk","%"],
+  ["text"," "],
+  ["punctuation.ahk","%"],
+  ["text","zoom"],
+  ["punctuation.ahk","%"],
+  ["text"," "],
+  ["punctuation.ahk","%"],
+  ["text","ws_x"],
+  ["punctuation.ahk","%"],
+  ["text"," "],
+  ["punctuation.ahk","%"],
+  ["text","hws_x"],
+  ["punctuation.ahk","%"],
+  ["text"," "]
+],[
+   "start",
+  ["punctuation.ahk","}"]
+],[
+   "start"
+],[
+   "start",
+  ["text","hdc_frame "],
+  ["keyword.operator.ahk",":="],
+  ["text"," "],
+  ["support.function.ahk","DllCall"],
+  ["punctuation.ahk","("],
+  ["punctuation.quote.double","\""],
+  ["string.quoted.ahk","GetDC"],
+  ["punctuation.quote.double","\""],
+  ["punctuation.ahk",","],
+  ["text"," UInt"],
+  ["punctuation.ahk",","],
+  ["text"," MagnifierID"],
+  ["punctuation.ahk",")"]
+],[
+   "start"
+],[
+   "start",
+  ["comment.line.ahk","; comment"]
+],[
+   "start",
+  ["text","DrawCross"],
+  ["punctuation.ahk","("],
+  ["keyword.control.ahk","byRef"],
+  ["text"," x"],
+  ["keyword.operator.ahk","="],
+  ["punctuation.quote.double","\""],
+  ["punctuation.quote.double","\""],
+  ["punctuation.ahk",","],
+  ["text"," rX"],
+  ["punctuation.ahk",","],
+  ["text","rY"],
+  ["punctuation.ahk",","],
+  ["text","z"],
+  ["punctuation.ahk",","],
+  ["text"," dc"],
+  ["punctuation.ahk","){"]
+],[
+   "start",
+  ["text","       "],
+  ["comment.line.ahk"," ;specify the style, thickness and color of the cross lines"]
+],[
+   "start",
+  ["text","    h_pen "],
+  ["keyword.operator.ahk",":="],
+  ["text"," "],
+  ["support.function.ahk","DllCall"],
+  ["punctuation.ahk","("],
+  ["text"," "],
+  ["punctuation.quote.double","\""],
+  ["string.quoted.ahk","gdi32.dll\\CreatePen"],
+  ["punctuation.quote.double","\""],
+  ["punctuation.ahk",","],
+  ["text"," "],
+  ["constant.language","Int"],
+  ["punctuation.ahk",","],
+  ["text"," 0"],
+  ["punctuation.ahk",","],
+  ["text"," "],
+  ["constant.language","Int"],
+  ["punctuation.ahk",","],
+  ["text"," 1"],
+  ["punctuation.ahk",","],
+  ["text"," UInt"],
+  ["punctuation.ahk",","],
+  ["text"," 0x0000FF"],
+  ["punctuation.ahk",")"]
+],[
+   "start",
+  ["punctuation.ahk","}"]
+],[
+   "start"
+],[
+   "start",
+  ["comment.line.ahk",";Ctrl ^; Shift +; Win #; Alt !"]
+],[
+   "start",
+  ["text","^"],
+  ["support.constant.ahk","NumPadAdd"],
+  ["keyword.operator.ahk","::"]
+],[
+   "start",
+  ["text","^"],
+  ["support.constant.ahk","WheelUp"],
+  ["keyword.operator.ahk","::"],
+  ["text","   "]
+],[
+   "start",
+  ["text","^;"],
+  ["keyword.operator.ahk","::"],
+  ["text","  "],
+  ["comment.line.ahk"," ;comment"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword.control.ahk","If"],
+  ["punctuation.ahk","("],
+  ["text","zoom "],
+  ["keyword.operator.ahk","<"],
+  ["text"," ws_x "],
+  ["variable.parameter","and"],
+  ["text"," "],
+  ["punctuation.ahk","("],
+  ["text"," "],
+  ["variable.predefined.ahk","A_ThisHotKey"],
+  ["text"," "],
+  ["keyword.operator.ahk","="],
+  ["text"," "],
+  ["punctuation.quote.double","\""],
+  ["string.quoted.ahk","^WheelUp"],
+  ["punctuation.quote.double","\""],
+  ["text"," "],
+  ["variable.parameter","or"],
+  ["text"," "],
+  ["variable.predefined.ahk","A_ThisHotKey"],
+  ["text"," "],
+  ["keyword.operator.ahk","="],
+  ["punctuation.quote.double","\""],
+  ["string.quoted.ahk","^NumPadAdd"],
+  ["punctuation.quote.double","\""],
+  ["punctuation.ahk",")"],
+  ["text"," "],
+  ["punctuation.ahk",")"]
+],[
+   "start",
+  ["text","\t\tzoom "],
+  ["keyword.operator.ahk","*="],
+  ["text"," 1.189207115        "],
+  ["comment.line.ahk"," ; sqrt(sqrt(2))"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword.command.ahk","Gosub"],
+  ["punctuation.ahk",","],
+  ["text","setZoom"]
+],[
+   "start",
+  ["keyword.control.ahk","return"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_batchfile.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_batchfile.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_batchfile.json
new file mode 100644
index 0000000..0f1f138
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_batchfile.json
@@ -0,0 +1,70 @@
+[[
+   "start",
+  ["comment.line.colons.dosbatch",":: batch file highlighting in Ace!"]
+],[
+   "start",
+  ["text","@"],
+  ["keyword.command.dosbatch","echo"],
+  ["text"," off"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword.control.statement.dosbatch","CALL"],
+  ["text"," "],
+  ["keyword.command.dosbatch","set"],
+  ["text"," var1="],
+  ["constant.numeric","%cd%"]
+],[
+   "start",
+  ["keyword.command.dosbatch","echo"],
+  ["text"," unhide everything in "],
+  ["constant.numeric","%var1%"],
+  ["text","!"]
+],[
+   "start"
+],[
+   "start",
+  ["comment.line.colons.dosbatch",":: FOR loop in bat is super strange!"]
+],[
+   "start",
+  ["keyword.control.repeat.dosbatch","FOR"],
+  ["text"," /f "],
+  ["punctuation.definition.string.begin.shell","\""],
+  ["string.quoted.double.dosbatch","tokens=*"],
+  ["punctuation.definition.string.end.shell","\""],
+  ["text"," "],
+  ["constant.numeric","%%G"],
+  ["text"," IN ('"],
+  ["keyword.command.dosbatch","dir"],
+  ["text"," /A:D /b') DO ("]
+],[
+   "start",
+  ["keyword.command.dosbatch","echo"],
+  ["text"," "],
+  ["constant.numeric","%var1%%%G"]
+],[
+   "start",
+  ["keyword.command.dosbatch","attrib"],
+  ["text"," -r -a -h -s "],
+  ["punctuation.definition.string.begin.shell","\""],
+  ["constant.numeric","%var1%%%G"],
+  ["punctuation.definition.string.end.shell","\""],
+  ["text"," /D /S"]
+],[
+   "start",
+  ["text",")"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword.command.dosbatch","pause"]
+],[
+   "start"
+],[
+   "start",
+  ["doc.comment","REM"],
+  ["comment"," that's all"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_c9search.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_c9search.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_c9search.json
new file mode 100644
index 0000000..9805274
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_c9search.json
@@ -0,0 +1,104 @@
+[[
+   "start",
+  ["text","Searching for 'var' in /workspace/configs"]
+],[
+   "start"
+],[
+   "start",
+  ["string","configs/default.js"],
+  ["text",":"]
+],[
+   "start",
+  ["c9searchresults.constant.numeric","    1"],
+  ["c9searchresults.text",": "],
+  ["c9searchresults.text","var fs = require(\"fs\");"]
+],[
+   "start",
+  ["c9searchresults.constant.numeric","\t2"],
+  ["c9searchresults.text",": "],
+  ["c9searchresults.text","var argv = require('optimist').argv;"]
+],[
+   "start",
+  ["c9searchresults.constant.numeric","\t3"],
+  ["c9searchresults.text",": "],
+  ["c9searchresults.text","var path = require(\"path\");"]
+],[
+   "start",
+  ["c9searchresults.constant.numeric","\t5"],
+  ["c9searchresults.text",": "],
+  ["c9searchresults.text","var clientExtensions = {};"]
+],[
+   "start",
+  ["c9searchresults.constant.numeric","\t6"],
+  ["c9searchresults.text",": "],
+  ["c9searchresults.text","var clientDirs = fs.readdirSync(__dirname + \"/../plugins-client\");"]
+],[
+   "start",
+  ["c9searchresults.constant.numeric","\t7"],
+  ["c9searchresults.text",": "],
+  ["c9searchresults.text","for (var i = 0; i < clientDirs.length; i++) {"]
+],[
+   "start",
+  ["c9searchresults.constant.numeric","\t8"],
+  ["c9searchresults.text",":     "],
+  ["c9searchresults.text","var dir = clientDirs[i];"]
+],[
+   "start",
+  ["c9searchresults.constant.numeric","\t12"],
+  ["c9searchresults.text",":     "],
+  ["c9searchresults.text","var name = dir.split(\".\")[1];"]
+],[
+   "start",
+  ["c9searchresults.constant.numeric","\t16"],
+  ["c9searchresults.text",": "],
+  ["c9searchresults.text","var projectDir = (argv.w && path.resolve(process.cwd(), argv.w)) || process.cwd();"]
+],[
+   "start",
+  ["c9searchresults.constant.numeric","\t17"],
+  ["c9searchresults.text",": "],
+  ["c9searchresults.text","var fsUrl = \"/workspace\";"]
+],[
+   "start",
+  ["c9searchresults.constant.numeric","\t19"],
+  ["c9searchresults.text",": "],
+  ["c9searchresults.text","var port = argv.p || process.env.PORT || 3131;"]
+],[
+   "start",
+  ["c9searchresults.constant.numeric","\t20"],
+  ["c9searchresults.text",": "],
+  ["c9searchresults.text","var host = argv.l || \"localhost\";"]
+],[
+   "start",
+  ["c9searchresults.constant.numeric","\t22"],
+  ["c9searchresults.text",": "],
+  ["c9searchresults.text","var config = {"]
+],[
+   "start"
+],[
+   "start",
+  ["string","configs/local.js"],
+  ["text",":"]
+],[
+   "start",
+  ["c9searchresults.constant.numeric","\t2"],
+  ["c9searchresults.text",": "],
+  ["c9searchresults.text","var config = require(\"./default\");"]
+],[
+   "start"
+],[
+   "start",
+  ["string","configs/packed.js"],
+  ["text",":"]
+],[
+   "start",
+  ["c9searchresults.constant.numeric","\t1"],
+  ["c9searchresults.text",": "],
+  ["c9searchresults.text","var config = require(\"./default\");"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["text","Found 15 matches in 3 files"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_c_cpp.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_c_cpp.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_c_cpp.json
new file mode 100644
index 0000000..2818526
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_c_cpp.json
@@ -0,0 +1,185 @@
+[[
+   "start",
+  ["comment","// compound assignment operators"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","#include"],
+  ["constant.other"," <iostream>"]
+],[
+   "start"
+],[
+   "directive",
+  ["keyword","#include"],
+  ["constant.other.multiline"," \\"]
+],[
+   "start",
+  ["constant.other","   <iostream>"]
+],[
+   "start"
+],[
+   "directive",
+  ["keyword","#include"],
+  ["constant.other.multiline"," \\"]
+],[
+   "directive",
+  ["constant.other.multiline","   \\"]
+],[
+   "start",
+  ["constant.other","   <iostream>"]
+],[
+   "start"
+],[
+   "directive",
+  ["keyword","#include"],
+  ["constant.other.multiline"," \\"]
+],[
+   "directive",
+  ["constant.other.multiline","   \\"]
+],[
+   "start",
+  ["constant.other","   \"iostream\""]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","#include"],
+  ["constant.other"," <boost/asio/io_service.hpp>"]
+],[
+   "start",
+  ["keyword","#include"],
+  ["constant.other"," \"boost/asio/io_service.hpp\""]
+],[
+   "start"
+],[
+   "directive",
+  ["keyword","#include"],
+  ["constant.other.multiline"," \\"]
+],[
+   "directive",
+  ["constant.other.multiline","   \\"]
+],[
+   "directive",
+  ["constant.other.multiline","   \"iostream\" \\"]
+],[
+   "directive",
+  ["constant.other.multiline","   \"string\" \\"]
+],[
+   "start",
+  ["constant.other","   <vector>"]
+],[
+   "start",
+  ["text","   "]
+],[
+   "start",
+  ["keyword.control","using"],
+  ["text"," "],
+  ["keyword.operator","namespace"],
+  ["text"," "],
+  ["identifier","std"],
+  ["punctuation.operator",";"]
+],[
+   "start"
+],[
+   "start",
+  ["storage.type","int"],
+  ["text"," "],
+  ["identifier","main"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["storage.type","int"],
+  ["text"," "],
+  ["identifier","a"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["identifier","b"],
+  ["keyword.operator","="],
+  ["constant.numeric","3"],
+  ["punctuation.operator",";"],
+  ["text"," "],
+  ["comment","/* foobar */"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","a"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","b"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","a"],
+  ["keyword.operator","+="],
+  ["constant.numeric","2"],
+  ["punctuation.operator",";"],
+  ["text"," "],
+  ["comment","// equivalent to a=a+2"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","cout"],
+  ["text"," "],
+  ["keyword.operator","<<"],
+  ["text"," "],
+  ["identifier","a"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","#if"],
+  ["constant.other"," VERBOSE >= 2"]
+],[
+   "start",
+  ["text","        "],
+  ["identifier","prints"],
+  ["paren.lparen","("],
+  ["string","\"trace message\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","#endif"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword.control","return"],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["comment","/* Print an error message and get out */"]
+],[
+   "directive",
+  ["keyword","#define"],
+  ["constant.other.multiline"," ABORT                             \\"]
+],[
+   "directive",
+  ["constant.other.multiline","    do {                                  \\"]
+],[
+   "directive",
+  ["constant.other.multiline","        print( \"Abort\\n\" );                \\"]
+],[
+   "directive",
+  ["constant.other.multiline","        exit(8);                          \\"]
+],[
+   "start",
+  ["constant.other","} while (0)                      "],
+  ["comment","/* Note: No semicolon */"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_clojure.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_clojure.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_clojure.json
new file mode 100644
index 0000000..824cba5
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_clojure.json
@@ -0,0 +1,162 @@
+[[
+   "start",
+  ["keyword","("],
+  ["support.function","defn"],
+  ["text"," "],
+  ["identifier","parting"]
+],[
+   "start",
+  ["text","  "],
+  ["string","\"returns a String parting in a given language\""]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","([]"],
+  ["text"," "],
+  ["keyword","("],
+  ["identifier","parting"],
+  ["text"," "],
+  ["string","\"World\""],
+  ["keyword","))"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","(["],
+  ["support.function","name"],
+  ["keyword","]"],
+  ["text"," "],
+  ["keyword","("],
+  ["identifier","parting"],
+  ["text"," "],
+  ["support.function","name"],
+  ["text"," "],
+  ["string","\"en\""],
+  ["keyword","))"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","(["],
+  ["support.function","name"],
+  ["text"," "],
+  ["identifier","language"],
+  ["keyword","]"]
+],[
+   "start",
+  ["text","    "],
+  ["comment","; condp is similar to a case statement in other languages."]
+],[
+   "start",
+  ["text","    "],
+  ["comment","; It is described in more detail later."]
+],[
+   "start",
+  ["text","    "],
+  ["comment","; It is used here to take different actions based on whether the"]
+],[
+   "start",
+  ["text","    "],
+  ["comment","; parameter \"language\" is set to \"en\", \"es\" or something else."]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","("],
+  ["support.function","condp"],
+  ["text"," "],
+  ["constant.language","="],
+  ["text"," "],
+  ["identifier","language"]
+],[
+   "start",
+  ["text","      "],
+  ["string","\"en\""],
+  ["text"," "],
+  ["keyword","("],
+  ["support.function","str"],
+  ["text"," "],
+  ["string","\"Goodbye, \""],
+  ["text"," "],
+  ["support.function","name"],
+  ["keyword",")"]
+],[
+   "start",
+  ["text","      "],
+  ["string","\"es\""],
+  ["text"," "],
+  ["keyword","("],
+  ["support.function","str"],
+  ["text"," "],
+  ["string","\"Adios, \""],
+  ["text"," "],
+  ["support.function","name"],
+  ["keyword",")"]
+],[
+   "start",
+  ["text","      "],
+  ["keyword","(throw"],
+  ["text"," "],
+  ["keyword","("],
+  ["identifier","IllegalArgumentException"],
+  ["text","."]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","("],
+  ["support.function","str"],
+  ["text"," "],
+  ["string","\"unsupported language \""],
+  ["text"," "],
+  ["identifier","language"],
+  ["keyword","))))))"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","("],
+  ["support.function","println"],
+  ["text"," "],
+  ["keyword","("],
+  ["identifier","parting"],
+  ["keyword","))"],
+  ["text"," "],
+  ["comment","; -> Goodbye, World"]
+],[
+   "start",
+  ["keyword","("],
+  ["support.function","println"],
+  ["text"," "],
+  ["keyword","("],
+  ["identifier","parting"],
+  ["text"," "],
+  ["string","\"Mark\""],
+  ["keyword","))"],
+  ["text"," "],
+  ["comment","; -> Goodbye, Mark"]
+],[
+   "start",
+  ["keyword","("],
+  ["support.function","println"],
+  ["text"," "],
+  ["keyword","("],
+  ["identifier","parting"],
+  ["text"," "],
+  ["string","\"Mark\""],
+  ["text"," "],
+  ["string","\"es\""],
+  ["keyword","))"],
+  ["text"," "],
+  ["comment","; -> Adios, Mark"]
+],[
+   "start",
+  ["keyword","("],
+  ["support.function","println"],
+  ["text"," "],
+  ["keyword","("],
+  ["identifier","parting"],
+  ["text"," "],
+  ["string","\"Mark\""],
+  ["text",", "],
+  ["string","\"xy\""],
+  ["keyword","))"],
+  ["text"," "],
+  ["comment","; -> java.lang.IllegalArgumentException: unsupported language xy"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_coffee.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_coffee.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_coffee.json
new file mode 100644
index 0000000..9c3967e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_coffee.json
@@ -0,0 +1,528 @@
+[[
+   "start",
+  ["comment","#test: tokenize keyword"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","for"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["identifier","i"],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["punctuation.operator","."],
+  ["constant.numeric",".2"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["comment","#test: tokenize regexp"]
+],[
+   "start",
+  ["string.regex","/\"[a]/"]
+],[
+   "start",
+  ["comment","#test: tokenize functions"]
+],[
+   "start",
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","{args}"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","{a1, a2}"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","{@a1, a2}"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator",":"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","{args}"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","{args}"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","{0abc}"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["paren","{"],
+  ["keyword.operator","/"],
+  ["identifier","abc"],
+  ["paren","}"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","=>"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["paren","{"],
+  ["identifier","abc"],
+  ["keyword.operator","/"],
+  ["paren","}"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","{#abc}"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","{abc#}"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["paren","{"],
+  ["paren.rparen",")"],
+  ["identifier","abc"],
+  ["paren","}"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["paren","{"],
+  ["identifier","abc"],
+  ["paren.rparen",")"],
+  ["paren","}"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","{a{bc}"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","{}"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","{ }"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator",":"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","{}"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","args"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","arg1, arg2"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","arg1 = 1, arg2 = 'name'"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","@arg1 = /abc/, arg2 = 'name'"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["comment","#test: tokenize function: invalid case:"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","foo"],
+  ["keyword.operator","="],
+  ["paren.lparen","("],
+  ["keyword.operator","/"],
+  ["identifier","args"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter"," "],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator",":"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter"," "],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["variable.language","window"],
+  ["punctuation.operator","."],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","args"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["entity.name.function","foo"],
+  ["text"," "],
+  ["keyword.operator",":"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["comment","#test: tokenize callback function"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","foo"],
+  ["text"," "],
+  ["identifier","bar"],
+  ["keyword.operator",":"],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","args"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","foo"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["variable.parameter","x"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "start",
+  ["comment","#test: tokenize class"]
+],[
+   "start",
+  ["keyword","class"],
+  ["text"," "],
+  ["language.support.class","Foo"]
+],[
+   "start",
+  ["keyword","class"],
+  ["text"," "],
+  ["language.support.class","Foo"],
+  ["text"," "],
+  ["keyword","extends"],
+  ["text"," "],
+  ["language.support.class","Bar"]
+],[
+   "start",
+  ["comment","#test: tokenize illegal name property"]
+],[
+   "start",
+  ["identifier","foo"],
+  ["punctuation.operator","."],
+  ["identifier","static"],
+  ["punctuation.operator","."],
+  ["identifier","function"]
+],[
+   "start",
+  ["comment","#!test tokenize string with interpolation"]
+],[
+   "start",
+  ["identifier","a"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["string.start","\""],
+  ["paren.string","#{"],
+  ["text"," "],
+  ["constant.numeric","22"],
+  ["text"," "],
+  ["keyword.operator","/"],
+  ["text"," "],
+  ["constant.numeric","7"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["paren","{"],
+  ["identifier","x"],
+  ["keyword.operator",":"],
+  ["text"," "],
+  ["string.start","\""],
+  ["paren.string","#{"],
+  ["identifier","a"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["identifier","b"],
+  ["paren.string","}"],
+  ["string.end","\""],
+  ["paren","}"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["paren.string","}"],
+  ["string.end","\""]
+],[
+   "qqdoc",
+  ["string","\"\"\"heredoc"]
+],[
+   "start",
+  ["string","   \"\"\""]
+],[
+   "start",
+  ["keyword","do"],
+  ["text"," "],
+  ["storage.type","->"]
+],[
+   "comment",
+  ["text","    "],
+  ["comment","###"]
+],[
+   "comment",
+  ["comment","    herecomment"]
+],[
+   "start",
+  ["comment","    ###"]
+],[
+   "heregex",
+  ["text","    "],
+  ["identifier","re"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["string.regex","/regex/imgy"],
+  ["punctuation.operator","."],
+  ["identifier","test"],
+  ["text"," "],
+  ["string.regex","///"]
+],[
+   "heregex",
+  ["comment.regex","        "],
+  ["string.regex","heregex"],
+  ["comment.regex","  # comment"]
+],[
+   "start",
+  ["string.regex","    ///imgy"]
+],[
+   "js",
+  ["text","    "],
+  ["keyword","this"],
+  ["text"," "],
+  ["keyword","isnt"],
+  ["keyword.operator",":"],
+  ["text"," "],
+  ["string","`just "]
+],[
+   "start",
+  ["string","       JavaScript`"]
+],[
+   "start",
+  ["text","    "],
+  ["constant.language","undefined"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_coldfusion.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_coldfusion.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_coldfusion.json
new file mode 100644
index 0000000..02f2c3f
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_coldfusion.json
@@ -0,0 +1,26 @@
+[[
+   "start",
+  ["comment","<!--- hello world --->"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","cfset"],
+  ["text"," "],
+  ["entity.other.attribute-name","welcome"],
+  ["keyword.operator.separator","="],
+  ["string","\"Hello World!\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","cfoutput"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","#welcome#"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","cfoutput"],
+  ["meta.tag.punctuation.end",">"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_csharp.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_csharp.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_csharp.json
new file mode 100644
index 0000000..dcc6d0e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_csharp.json
@@ -0,0 +1,31 @@
+[[
+   "start",
+  ["keyword","public"],
+  ["text"," "],
+  ["keyword","void"],
+  ["text"," "],
+  ["identifier","HelloWorld"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["comment","//Say Hello!"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","Console"],
+  ["punctuation.operator","."],
+  ["identifier","WriteLine"],
+  ["paren.lparen","("],
+  ["string.start","\""],
+  ["string","Hello World"],
+  ["string.end","\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["paren.rparen","}"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_css.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_css.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_css.json
new file mode 100644
index 0000000..e1a7ba0
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_css.json
@@ -0,0 +1,148 @@
+[[
+   "ruleset",
+  ["variable",".text-layer"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "ruleset",
+  ["text","    "],
+  ["support.type","font-family"],
+  ["text",": Monaco, "],
+  ["string","\"Courier New\""],
+  ["text",", "],
+  ["support.constant.fonts","monospace"],
+  ["text",";"]
+],[
+   "ruleset",
+  ["text","    "],
+  ["support.type","font-size"],
+  ["text",": "],
+  ["constant.numeric","12"],
+  ["keyword","pX"],
+  ["text",";"]
+],[
+   "ruleset",
+  ["text","    "],
+  ["support.type","cursor"],
+  ["text",": "],
+  ["support.constant","text"],
+  ["text",";"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start"
+],[
+   "ruleset",
+  ["variable",".blinker"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "ruleset",
+  ["text","    "],
+  ["support.type","animation-duration"],
+  ["text",": "],
+  ["constant.numeric","1"],
+  ["keyword","s"],
+  ["text",";"]
+],[
+   "ruleset",
+  ["text","    "],
+  ["support.type","animation-name"],
+  ["text",": blink;"]
+],[
+   "ruleset",
+  ["text","    "],
+  ["support.type","animation-iteration-count"],
+  ["text",": infinite;"]
+],[
+   "ruleset",
+  ["text","    "],
+  ["support.type","animation-direction"],
+  ["text",": alternate;"]
+],[
+   "ruleset",
+  ["text","    "],
+  ["support.type","animation-timing-function"],
+  ["text",": "],
+  ["support.constant","linear"],
+  ["text",";"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start"
+],[
+   "media",
+  ["string","@keyframes blink {"]
+],[
+   ["ruleset","media"],
+  ["text","    "],
+  ["constant","0"],
+  ["text","% "],
+  ["paren.lparen","{"]
+],[
+   ["ruleset","media"],
+  ["text","        "],
+  ["support.type","opacity"],
+  ["text",": "],
+  ["constant.numeric","0"],
+  ["text",";"]
+],[
+   "media",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   ["ruleset","media"],
+  ["text","    "],
+  ["constant","40"],
+  ["text","% "],
+  ["paren.lparen","{"]
+],[
+   ["ruleset","media"],
+  ["text","        "],
+  ["support.type","opacity"],
+  ["text",": "],
+  ["constant.numeric","0"],
+  ["text",";"]
+],[
+   "media",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   ["ruleset","media"],
+  ["text","    "],
+  ["constant","40"],
+  ["variable",".5"],
+  ["text","% "],
+  ["paren.lparen","{"]
+],[
+   ["ruleset","media"],
+  ["text","        "],
+  ["support.type","opacity"],
+  ["text",": "],
+  ["constant.numeric","1"]
+],[
+   "media",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   ["ruleset","media"],
+  ["text","    "],
+  ["constant","100"],
+  ["text","% "],
+  ["paren.lparen","{"]
+],[
+   ["ruleset","media"],
+  ["text","        "],
+  ["support.type","opacity"],
+  ["text",": "],
+  ["constant.numeric","1"]
+],[
+   "media",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["string","}"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_curly.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_curly.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_curly.json
new file mode 100644
index 0000000..110574b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_curly.json
@@ -0,0 +1,56 @@
+[[
+   "start",
+  ["text","tokenize Curly template"],
+  ["variable","{{"],
+  ["text","test"],
+  ["variable","}}"]
+],[
+   "start",
+  ["text","tokenize embedded script"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.script","script"],
+  ["text"," "],
+  ["entity.other.attribute-name","a"],
+  ["keyword.operator.separator","="],
+  ["string","'a'"],
+  ["meta.tag.punctuation.end",">"],
+  ["storage.type","var"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.script","script"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","'123'"]
+],[
+   "start",
+  ["text","tokenize multiline attribute value with double quotes"]
+],[
+   ["qqstring_inner","start_tag_stuff"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.anchor","a"],
+  ["text"," "],
+  ["entity.other.attribute-name","href"],
+  ["keyword.operator.separator","="],
+  ["string","\"abc{{xyz}}"]
+],[
+   "start",
+  ["string","def\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","tokenize multiline attribute value with single quotes"]
+],[
+   ["qstring_inner","start_tag_stuff"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.anchor","a"],
+  ["text"," "],
+  ["entity.other.attribute-name","href"],
+  ["keyword.operator.separator","="],
+  ["string","'abc"]
+],[
+   "start",
+  ["string","def\\\"'"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_dart.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_dart.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_dart.json
new file mode 100644
index 0000000..5964791
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_dart.json
@@ -0,0 +1,368 @@
+[[
+   "start",
+  ["identifier","main"],
+  ["text","() {"]
+],[
+   "start",
+  ["text","  "],
+  ["identifier","print"],
+  ["text","("],
+  ["string","'Hello World!'"],
+  ["text",");"]
+],[
+   "start",
+  ["text","}"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["storage.type.primitive.dart","int"],
+  ["text"," "],
+  ["identifier","fib"],
+  ["text","("],
+  ["storage.type.primitive.dart","int"],
+  ["text"," "],
+  ["identifier","n"],
+  ["text",") "],
+  ["keyword.operator.assignment.dart","="],
+  ["keyword.operator.comparison.dart",">"],
+  ["text"," ("],
+  ["identifier","n"],
+  ["text"," "],
+  ["keyword.operator.comparison.dart",">"],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["text",") "],
+  ["keyword.control.ternary.dart","?"],
+  ["text"," ("],
+  ["identifier","fib"],
+  ["text","("],
+  ["identifier","n"],
+  ["text"," "],
+  ["keyword.operator.arithmetic.dart","-"],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["text",") "],
+  ["keyword.operator.arithmetic.dart","+"],
+  ["text"," "],
+  ["identifier","fib"],
+  ["text","("],
+  ["identifier","n"],
+  ["text"," "],
+  ["keyword.operator.arithmetic.dart","-"],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["text",")) "],
+  ["keyword.control.ternary.dart",":"],
+  ["text"," "],
+  ["identifier","n"],
+  ["text",";"]
+],[
+   "start",
+  ["identifier","main"],
+  ["text","() {"]
+],[
+   "start",
+  ["text","  "],
+  ["identifier","print"],
+  ["text","("],
+  ["string","'fib(20) = ${fib(20)}'"],
+  ["text",");"]
+],[
+   "start",
+  ["text","}"]
+],[
+   "comment",
+  ["comment","/*asd"]
+],[
+   "comment",
+  ["comment","asdad"]
+],[
+   "start",
+  ["comment","*/"]
+],[
+   "start",
+  ["constant.numeric","0.67"]
+],[
+   "start",
+  ["constant.numeric","77"]
+],[
+   "start",
+  ["text","."],
+  ["constant.numeric","86"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword.other.import.dart","import"],
+  ["text","("],
+  ["string","\"http://dartwatch.com/myOtherLibrary.dart\""],
+  ["text",");"]
+],[
+   "start",
+  ["keyword.other.import.dart","import"],
+  ["text","("],
+  ["string","\"myOtherLibrary.dart\""],
+  ["text",", "],
+  ["keyword.other.import.dart","prefix"],
+  ["text",":"],
+  ["string","\"lib1\""],
+  ["text",");"]
+],[
+   "start"
+],[
+   "qqdoc",
+  ["string","\"\"\"asdasdads"]
+],[
+   "qqdoc",
+  ["string","asdadsadsasd"]
+],[
+   "start",
+  ["string","asdasdasdad\"\"\""]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["string","'23424'"]
+],[
+   "start"
+],[
+   "start",
+  ["constant.numeric","0x234"]
+],[
+   "start"
+],[
+   "start",
+  ["identifier","foo"],
+  ["text"," "],
+  ["keyword.operator.dart","is"],
+  ["text"," "],
+  ["identifier","bar"]
+],[
+   "start"
+],[
+   "start",
+  ["storage.type.primitive.dart","int"],
+  ["text"," "],
+  ["identifier","x"],
+  ["text"," "],
+  ["keyword.operator.assignment.dart","="],
+  ["text"," "],
+  ["constant.numeric","4"],
+  ["text"," "],
+  ["keyword.operator.bitwise.dart","<<"],
+  ["text"," "],
+  ["constant.numeric","10"],
+  ["text"," "]
+],[
+   "start",
+  ["comment","// Create a class for Point."]
+],[
+   "start",
+  ["keyword.declaration.dart","class"],
+  ["text"," "],
+  ["identifier","Point"],
+  ["text"," {"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["text","  "],
+  ["comment","// Final variables cannot be changed once they are assigned."]
+],[
+   "start",
+  ["text","  "],
+  ["comment","// Create two instance variables."]
+],[
+   "start",
+  ["text","  "],
+  ["storage.modifier.dart","final"],
+  ["text"," "],
+  ["storage.type.primitive.dart","num"],
+  ["text"," "],
+  ["identifier","x"],
+  ["text",", "],
+  ["identifier","y"],
+  ["text",";"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["text","  "],
+  ["comment","// A constructor, with syntactic sugar for setting instance variables."]
+],[
+   "start",
+  ["text","  "],
+  ["identifier","Point"],
+  ["text","("],
+  ["variable.language.dart","this"],
+  ["text","."],
+  ["identifier","x"],
+  ["text",", "],
+  ["variable.language.dart","this"],
+  ["text","."],
+  ["identifier","y"],
+  ["text",");"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["text","  "],
+  ["comment","// A named constructor with an initializer list."]
+],[
+   "start",
+  ["text","  "],
+  ["identifier","Point"],
+  ["text","."],
+  ["identifier","origin"],
+  ["text","() "],
+  ["keyword.control.ternary.dart",":"],
+  ["text"," "],
+  ["identifier","x"],
+  ["text"," "],
+  ["keyword.operator.assignment.dart","="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["text",", "],
+  ["identifier","y"],
+  ["text"," "],
+  ["keyword.operator.assignment.dart","="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["text",";"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["text","  "],
+  ["comment","// A method."]
+],[
+   "start",
+  ["text","  "],
+  ["storage.type.primitive.dart","num"],
+  ["text"," "],
+  ["identifier","distanceTo"],
+  ["text","("],
+  ["identifier","Point"],
+  ["text"," "],
+  ["identifier","other"],
+  ["text",") {"]
+],[
+   "start",
+  ["text","    "],
+  ["storage.type.primitive.dart","var"],
+  ["text"," "],
+  ["identifier","dx"],
+  ["text"," "],
+  ["keyword.operator.assignment.dart","="],
+  ["text"," "],
+  ["identifier","x"],
+  ["text"," "],
+  ["keyword.operator.arithmetic.dart","-"],
+  ["text"," "],
+  ["identifier","other"],
+  ["text","."],
+  ["identifier","x"],
+  ["text",";"]
+],[
+   "start",
+  ["text","    "],
+  ["storage.type.primitive.dart","var"],
+  ["text"," "],
+  ["identifier","dy"],
+  ["text"," "],
+  ["keyword.operator.assignment.dart","="],
+  ["text"," "],
+  ["identifier","y"],
+  ["text"," "],
+  ["keyword.operator.arithmetic.dart","-"],
+  ["text"," "],
+  ["identifier","other"],
+  ["text","."],
+  ["identifier","y"],
+  ["text",";"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword.control.dart","return"],
+  ["text"," "],
+  ["identifier","sqrt"],
+  ["text","("],
+  ["identifier","dx"],
+  ["text"," "],
+  ["keyword.operator.arithmetic.dart","*"],
+  ["text"," "],
+  ["identifier","dx"],
+  ["text"," "],
+  ["keyword.operator.arithmetic.dart","+"],
+  ["text"," "],
+  ["identifier","dy"],
+  ["text"," "],
+  ["keyword.operator.arithmetic.dart","*"],
+  ["text"," "],
+  ["identifier","dy"],
+  ["text",");"]
+],[
+   "start",
+  ["text","  }"]
+],[
+   "start",
+  ["text","}"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["text"," "],
+  ["comment","// Check for null."]
+],[
+   "start",
+  ["storage.type.primitive.dart","var"],
+  ["text"," "],
+  ["identifier","unicorn"],
+  ["text",";"]
+],[
+   "start",
+  ["identifier","assert"],
+  ["text","("],
+  ["identifier","unicorn"],
+  ["text"," "],
+  ["keyword.operator.comparison.dart","=="],
+  ["text"," "],
+  ["constant.language.dart","null"],
+  ["text",");"]
+],[
+   "start"
+],[
+   "start",
+  ["comment","// Check for NaN."]
+],[
+   "start",
+  ["storage.type.primitive.dart","var"],
+  ["text"," "],
+  ["identifier","iMeantToDoThis"],
+  ["text"," "],
+  ["keyword.operator.assignment.dart","="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["keyword.operator.arithmetic.dart","/"],
+  ["constant.numeric","0"],
+  ["text",";"]
+],[
+   "start",
+  ["identifier","assert"],
+  ["text","("],
+  ["identifier","iMeantToDoThis"],
+  ["text","."],
+  ["identifier","isNaN"],
+  ["text","());"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_diff.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_diff.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_diff.json
new file mode 100644
index 0000000..7cf9b72
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_diff.json
@@ -0,0 +1,398 @@
+[[
+   "start",
+  ["variable","diff"],
+  ["variable"," --git"],
+  ["keyword"," a/lib/ace/edit_session.js"],
+  ["variable"," b/lib/ace/edit_session.js"]
+],[
+   "start"
+],[
+   "start",
+  ["variable","index 23fc3fc..ed3b273 100644"]
+],[
+   "start"
+],[
+   "start",
+  ["constant.numeric","---"],
+  ["meta.tag"," a/lib/ace/edit_session.js"]
+],[
+   "start"
+],[
+   "start",
+  ["constant.numeric","+++"],
+  ["meta.tag"," b/lib/ace/edit_session.js"]
+],[
+   "start"
+],[
+   "start",
+  ["constant","@@"],
+  ["constant.numeric"," -51,6 +51,7 "],
+  ["constant","@@"],
+  ["comment.doc.tag"," var TextMode = require(\"./mode/text\").Mode;"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible"," var Range = require(\"./range\").Range;"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible"," var Document = require(\"./document\").Document;"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible"," var BackgroundTokenizer = require(\"./background_tokenizer\").BackgroundTokenizer;"]
+],[
+   "start"
+],[
+   "start",
+  ["support.constant","+"],
+  ["text","var SearchHighlight = require(\"./search_highlight\").SearchHighlight;"]
+],[
+   "start"
+],[
+   "start",
+  ["text"," "]
+],[
+   "start"
+],[
+   "start",
+  ["invisible"," /**"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","  * class EditSession"]
+],[
+   "start"
+],[
+   "start",
+  ["constant","@@"],
+  ["constant.numeric"," -307,6 +308,13 "],
+  ["constant","@@"],
+  ["comment.doc.tag"," var EditSession = function(text, mode) {"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","         return token;"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","     };"]
+],[
+   "start"
+],[
+   "start",
+  ["text"," "]
+],[
+   "start"
+],[
+   "start",
+  ["support.constant","+"],
+  ["text","    this.highlight = function(re) {"]
+],[
+   "start"
+],[
+   "start",
+  ["support.constant","+"],
+  ["text","        if (!this.$searchHighlight) {"]
+],[
+   "start"
+],[
+   "start",
+  ["support.constant","+"],
+  ["text","            var highlight = new SearchHighlight(null, \"ace_selected-word\", \"text\");"]
+],[
+   "start"
+],[
+   "start",
+  ["support.constant","+"],
+  ["text","            this.$searchHighlight = this.addDynamicMarker(highlight);"]
+],[
+   "start"
+],[
+   "start",
+  ["support.constant","+"],
+  ["text","        }"]
+],[
+   "start"
+],[
+   "start",
+  ["support.constant","+"],
+  ["text","        this.$searchHighlight.setRegexp(re);"]
+],[
+   "start"
+],[
+   "start",
+  ["support.constant","+"],
+  ["text","    }"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","     /**"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","     * EditSession.setUndoManager(undoManager)"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","     * - undoManager (UndoManager): The new undo manager"]
+],[
+   "start"
+],[
+   "start",
+  ["constant","@@"],
+  ["constant.numeric"," -556,7 +564,8 "],
+  ["constant","@@"],
+  ["comment.doc.tag"," var EditSession = function(text, mode) {"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","             type : type || \"line\","]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","             renderer: typeof type == \"function\" ? type : null,"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","             clazz : clazz,"]
+],[
+   "start"
+],[
+   "start",
+  ["support.function","-"],
+  ["string","            inFront: !!inFront"]
+],[
+   "start"
+],[
+   "start",
+  ["support.constant","+"],
+  ["text","            inFront: !!inFront,"]
+],[
+   "start"
+],[
+   "start",
+  ["support.constant","+"],
+  ["text","            id: id"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","         }"]
+],[
+   "start"
+],[
+   "start",
+  ["text"," "]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","         if (inFront) {"]
+],[
+   "start"
+],[
+   "start",
+  ["variable","diff"],
+  ["variable"," --git"],
+  ["keyword"," a/lib/ace/editor.js"],
+  ["variable"," b/lib/ace/editor.js"]
+],[
+   "start"
+],[
+   "start",
+  ["variable","index 834e603..b27ec73 100644"]
+],[
+   "start"
+],[
+   "start",
+  ["constant.numeric","---"],
+  ["meta.tag"," a/lib/ace/editor.js"]
+],[
+   "start"
+],[
+   "start",
+  ["constant.numeric","+++"],
+  ["meta.tag"," b/lib/ace/editor.js"]
+],[
+   "start"
+],[
+   "start",
+  ["constant","@@"],
+  ["constant.numeric"," -494,7 +494,7 "],
+  ["constant","@@"],
+  ["comment.doc.tag"," var Editor = function(renderer, session) {"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","      * Emitted when a selection has changed."]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","      **/"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","     this.onSelectionChange = function(e) {"]
+],[
+   "start"
+],[
+   "start",
+  ["support.function","-"],
+  ["string","        var session = this.getSession();"]
+],[
+   "start"
+],[
+   "start",
+  ["support.constant","+"],
+  ["text","        var session = this.session;"]
+],[
+   "start"
+],[
+   "start",
+  ["text"," "]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","         if (session.$selectionMarker) {"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","             session.removeMarker(session.$selectionMarker);"]
+],[
+   "start"
+],[
+   "start",
+  ["constant","@@"],
+  ["constant.numeric"," -509,12 +509,40 "],
+  ["constant","@@"],
+  ["comment.doc.tag"," var Editor = function(renderer, session) {"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","             this.$updateHighlightActiveLine();"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","         }"]
+],[
+   "start"
+],[
+   "start",
+  ["text"," "]
+],[
+   "start"
+],[
+   "start",
+  ["support.function","-"],
+  ["string","        var self = this;"]
+],[
+   "start"
+],[
+   "start",
+  ["support.function","-"],
+  ["string","        if (this.$highlightSelectedWord && !this.$wordHighlightTimer)"]
+],[
+   "start"
+],[
+   "start",
+  ["support.function","-"],
+  ["string","            this.$wordHighlightTimer = setTimeout(function() {"]
+],[
+   "start"
+],[
+   "start",
+  ["support.function","-"],
+  ["string","                self.session.$mode.highlightSelection(self);"]
+],[
+   "start"
+],[
+   "start",
+  ["support.function","-"],
+  ["string","                self.$wordHighlightTimer = null;"]
+],[
+   "start"
+],[
+   "start",
+  ["support.function","-"],
+  ["string","            }, 30, this);"]
+],[
+   "start"
+],[
+   "start",
+  ["support.constant","+"],
+  ["text","        var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp()"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","     };"]
+],[
+   "start"
+],[
+   "start",
+  ["variable","diff"],
+  ["variable"," --git"],
+  ["keyword"," a/lib/ace/search_highlight.js"],
+  ["variable"," b/lib/ace/search_highlight.js"]
+],[
+   "start"
+],[
+   "start",
+  ["invisible","new file mode 100644"]
+],[
+   "start"
+],[
+   "start",
+  ["variable","index 0000000..b2df779"]
+],[
+   "start"
+],[
+   "start",
+  ["constant.numeric","---"],
+  ["meta.tag"," /dev/null"]
+],[
+   "start"
+],[
+   "start",
+  ["constant.numeric","+++"],
+  ["meta.tag"," b/lib/ace/search_highlight.js"]
+],[
+   "start"
+],[
+   "start",
+  ["constant","@@"],
+  ["constant.numeric"," -0,0 +1,3 "],
+  ["constant","@@"]
+],[
+   "start"
+],[
+   "start",
+  ["support.constant","+"],
+  ["text","new"]
+],[
+   "start"
+],[
+   "start",
+  ["support.constant","+"],
+  ["text","empty file"]
+]]
\ No newline at end of file


[07/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/php_worker.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/php_worker.js b/src/fauxton/assets/js/libs/ace/mode/php_worker.js
new file mode 100644
index 0000000..59ebcf4
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/php_worker.js
@@ -0,0 +1,76 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var Mirror = require("../worker/mirror").Mirror;
+var PHP = require("./php/php").PHP;
+
+var PhpWorker = exports.PhpWorker = function(sender) {
+    Mirror.call(this, sender);
+    this.setTimeout(500);
+};
+
+oop.inherits(PhpWorker, Mirror);
+
+(function() {
+
+    this.onUpdate = function() {
+        var value = this.doc.getValue();
+        var errors = [];
+
+        // var start = new Date();
+
+        var tokens = PHP.Lexer(value, {short_open_tag: 1});
+        try {
+            new PHP.Parser(tokens);
+        } catch(e) {
+            errors.push({
+                row: e.line - 1,
+                column: null,
+                text: e.message.charAt(0).toUpperCase() + e.message.substring(1),
+                type: "error"
+            });
+        }
+
+        // console.log("lint time: " + (new Date() - start));
+
+        if (errors.length) {
+            this.sender.emit("error", errors);
+        } else {
+            this.sender.emit("ok");
+        }
+    };
+
+}).call(PhpWorker.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/plain_text.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/plain_text.js b/src/fauxton/assets/js/libs/ace/mode/plain_text.js
new file mode 100644
index 0000000..f8e61c6
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/plain_text.js
@@ -0,0 +1,55 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var Behaviour = require("./behaviour").Behaviour;
+
+var Mode = function() {
+    this.HighlightRules = TextHighlightRules;
+    this.$behaviour = new Behaviour();
+};
+
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.type = "text";
+    this.getNextLineIndent = function(state, line, tab) {
+        return '';
+    };
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/plain_text_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/plain_text_test.js b/src/fauxton/assets/js/libs/ace/mode/plain_text_test.js
new file mode 100644
index 0000000..7e02f5d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/plain_text_test.js
@@ -0,0 +1,56 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("../edit_session").EditSession;
+var PlainTextMode = require("./plain_text").Mode;
+var assert = require("../test/assertions");
+
+module.exports = {
+    setUp : function() {
+        this.mode = new PlainTextMode();
+    },
+
+    "test: lines should not be indented" : function() {
+        assert.equal("", this.mode.getNextLineIndent("start", "   abc", "  "));
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/powershell.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/powershell.js b/src/fauxton/assets/js/libs/ace/mode/powershell.js
new file mode 100644
index 0000000..8cc5568
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/powershell.js
@@ -0,0 +1,61 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var PowershellHighlightRules = require("./powershell_highlight_rules").PowershellHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = PowershellHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new CstyleBehaviour();
+    this.foldingRules = new CStyleFoldMode({start: "^\\s*(<#)", end: "^[#\\s]>\\s*$"});
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = "#";
+    this.blockComment = {start: "<#", end: "#>"};
+    
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+      
+        if (state == "start") {
+            var match = line.match(/^.*[\{\(\[]\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+
+    this.createWorker = function(session) {
+        return null;
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/powershell_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/powershell_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/powershell_highlight_rules.js
new file mode 100644
index 0000000..6a03ac7
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/powershell_highlight_rules.js
@@ -0,0 +1,145 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var PowershellHighlightRules = function() {
+
+    var keywords = (
+      "function|if|else|elseif|switch|while|default|for|do|until|break|continue|" +
+       "foreach|return|filter|in|trap|throw|param|begin|process|end"
+    );
+
+    var builtinFunctions = (
+      "Get-Alias|Import-Alias|New-Alias|Set-Alias|Get-AuthenticodeSignature|Set-AuthenticodeSignature|" +
+       "Set-Location|Get-ChildItem|Clear-Item|Get-Command|Measure-Command|Trace-Command|" +
+       "Add-Computer|Checkpoint-Computer|Remove-Computer|Restart-Computer|Restore-Computer|Stop-Computer|" +
+       "Reset-ComputerMachinePassword|Test-ComputerSecureChannel|Add-Content|Get-Content|Set-Content|Clear-Content|" +
+       "Get-Command|Invoke-Command|Enable-ComputerRestore|Disable-ComputerRestore|Get-ComputerRestorePoint|Test-Connection|" +
+       "ConvertFrom-CSV|ConvertTo-CSV|ConvertTo-Html|ConvertTo-Xml|ConvertFrom-SecureString|ConvertTo-SecureString|" +
+       "Copy-Item|Export-Counter|Get-Counter|Import-Counter|Get-Credential|Get-Culture|" +
+       "Get-ChildItem|Get-Date|Set-Date|Remove-Item|Compare-Object|Get-Event|" +
+       "Get-WinEvent|New-Event|Remove-Event|Unregister-Event|Wait-Event|Clear-EventLog|" +
+       "Get-Eventlog|Limit-EventLog|New-Eventlog|Remove-EventLog|Show-EventLog|Write-EventLog|" +
+       "Get-EventSubscriber|Register-EngineEvent|Register-ObjectEvent|Register-WmiEvent|Get-ExecutionPolicy|Set-ExecutionPolicy|" +
+       "Export-Alias|Export-Clixml|Export-Console|Export-Csv|ForEach-Object|Format-Custom|" +
+       "Format-List|Format-Table|Format-Wide|Export-FormatData|Get-FormatData|Get-Item|" +
+       "Get-ChildItem|Get-Help|Add-History|Clear-History|Get-History|Invoke-History|" +
+       "Get-Host|Read-Host|Write-Host|Get-HotFix|Import-Clixml|Import-Csv|" +
+       "Invoke-Command|Invoke-Expression|Get-Item|Invoke-Item|New-Item|Remove-Item|" +
+       "Set-Item|Clear-ItemProperty|Copy-ItemProperty|Get-ItemProperty|Move-ItemProperty|New-ItemProperty|" +
+       "Remove-ItemProperty|Rename-ItemProperty|Set-ItemProperty|Get-Job|Receive-Job|Remove-Job|" +
+       "Start-Job|Stop-Job|Wait-Job|Stop-Process|Update-List|Get-Location|" +
+       "Pop-Location|Push-Location|Set-Location|Send-MailMessage|Add-Member|Get-Member|" +
+       "Move-Item|Compare-Object|Group-Object|Measure-Object|New-Object|Select-Object|" +
+       "Sort-Object|Where-Object|Out-Default|Out-File|Out-GridView|Out-Host|" +
+       "Out-Null|Out-Printer|Out-String|Convert-Path|Join-Path|Resolve-Path|" +
+       "Split-Path|Test-Path|Get-Pfxcertificate|Pop-Location|Push-Location|Get-Process|" +
+       "Start-Process|Stop-Process|Wait-Process|Enable-PSBreakpoint|Disable-PSBreakpoint|Get-PSBreakpoint|" +
+       "Set-PSBreakpoint|Remove-PSBreakpoint|Get-PSDrive|New-PSDrive|Remove-PSDrive|Get-PSProvider|" +
+       "Set-PSdebug|Enter-PSSession|Exit-PSSession|Export-PSSession|Get-PSSession|Import-PSSession|" +
+       "New-PSSession|Remove-PSSession|Disable-PSSessionConfiguration|Enable-PSSessionConfiguration|Get-PSSessionConfiguration|Register-PSSessionConfiguration|" +
+       "Set-PSSessionConfiguration|Unregister-PSSessionConfiguration|New-PSSessionOption|Add-PsSnapIn|Get-PsSnapin|Remove-PSSnapin|" +
+       "Get-Random|Read-Host|Remove-Item|Rename-Item|Rename-ItemProperty|Select-Object|" +
+       "Select-XML|Send-MailMessage|Get-Service|New-Service|Restart-Service|Resume-Service|" +
+       "Set-Service|Start-Service|Stop-Service|Suspend-Service|Sort-Object|Start-Sleep|" +
+       "ConvertFrom-StringData|Select-String|Tee-Object|New-Timespan|Trace-Command|Get-Tracesource|" +
+       "Set-Tracesource|Start-Transaction|Complete-Transaction|Get-Transaction|Use-Transaction|Undo-Transaction|" +
+       "Start-Transcript|Stop-Transcript|Add-Type|Update-TypeData|Get-Uiculture|Get-Unique|" +
+       "Update-Formatdata|Update-Typedata|Clear-Variable|Get-Variable|New-Variable|Remove-Variable|" +
+       "Set-Variable|New-WebServiceProxy|Where-Object|Write-Debug|Write-Error|Write-Host|" +
+       "Write-Output|Write-Progress|Write-Verbose|Write-Warning|Set-WmiInstance|Invoke-WmiMethod|" +
+       "Get-WmiObject|Remove-WmiObject|Connect-WSMan|Disconnect-WSMan|Test-WSMan|Invoke-WSManAction|" +
+       "Disable-WSManCredSSP|Enable-WSManCredSSP|Get-WSManCredSSP|New-WSManInstance|Get-WSManInstance|Set-WSManInstance|" +
+       "Remove-WSManInstance|Set-WSManQuickConfig|New-WSManSessionOption"
+       );
+
+    var keywordMapper = this.createKeywordMapper({
+        "support.function": builtinFunctions,
+        "keyword": keywords
+    }, "identifier");
+
+    var binaryOperatorsRe = "eq|ne|ge|gt|lt|le|like|notlike|match|notmatch|replace|contains|notcontains|" +
+                            "ieq|ine|ige|igt|ile|ilt|ilike|inotlike|imatch|inotmatch|ireplace|icontains|inotcontains|" +
+                            "is|isnot|as|" +
+                            "and|or|band|bor|not";
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "start" : [
+            {
+                token : "comment",
+                regex : "#.*$"
+            }, {
+                token : "comment.start",
+                regex : "<#",
+                next : "comment"
+            }, {
+                token : "string", // single line
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+            }, {
+                token : "string", // single line
+                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+            }, {
+                token : "constant.numeric", // hex
+                regex : "0[xX][0-9a-fA-F]+\\b"
+            }, {
+                token : "constant.numeric", // float
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+            }, {
+                token : "constant.language.boolean",
+                regex : "[$](?:[Tt]rue|[Ff]alse)\\b"
+            }, {
+                token : "constant.language",
+                regex : "[$][Nn]ull\\b"
+            }, {
+                token : "variable.instance",
+                regex : "[$][a-zA-Z][a-zA-Z0-9_]*\\b"
+            }, {
+                token : keywordMapper,
+                // TODO: Unicode escape sequences
+                // TODO: Unicode identifiers
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$\\-]*\\b"
+            }, {
+                token : "keyword.operator",
+                regex : "\\-(?:" + binaryOperatorsRe + ")"
+            }, {
+                token : "keyword.operator",
+                regex : "&|\\*|\\+|\\-|\\=|\\+=|\\-="
+            }, {
+                token : "lparen",
+                regex : "[[({]"
+            }, {
+                token : "rparen",
+                regex : "[\\])}]"
+            }, {
+                token : "text",
+                regex : "\\s+"
+            }
+        ],
+        "comment" : [
+            {
+                token : "comment.end",
+                regex : "#>",
+                next : "start"
+            }, {
+                token : "doc.comment.tag",
+                regex : "^\\.\\w+"
+            }, {
+                token : "comment",
+                regex : "\\w+"
+            }, {
+                token : "comment",
+                regex : "."
+            }
+        ]
+    };
+};
+
+oop.inherits(PowershellHighlightRules, TextHighlightRules);
+
+exports.PowershellHighlightRules = PowershellHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/prolog.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/prolog.js b/src/fauxton/assets/js/libs/ace/mode/prolog.js
new file mode 100644
index 0000000..6f89e92
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/prolog.js
@@ -0,0 +1,62 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ *
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var PrologHighlightRules = require("./prolog_highlight_rules").PrologHighlightRules;
+// TODO: pick appropriate fold mode
+var FoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = PrologHighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = "/\\*";
+    this.blockComment = {start: "/*", end: "*/"};
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/prolog_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/prolog_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/prolog_highlight_rules.js
new file mode 100644
index 0000000..fb3fa74
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/prolog_highlight_rules.js
@@ -0,0 +1,238 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* This file was autogenerated from https://raw.github.com/stephenroller/prolog-tmbundle/master/Syntaxes/Prolog.tmLanguage (uuid: ) */
+/****************************************************************************************
+ * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
+ * fileTypes                                                                            *
+ ****************************************************************************************/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var PrologHighlightRules = function() {
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = { start: 
+       [ { include: '#comment' },
+         { include: '#basic_fact' },
+         { include: '#rule' },
+         { include: '#directive' },
+         { include: '#fact' } ],
+      '#atom': 
+       [ { token: 'constant.other.atom.prolog',
+           regex: '\\b[a-z][a-zA-Z0-9_]*\\b' },
+         { token: 'constant.numeric.prolog',
+           regex: '-?\\d+(?:\\.\\d+)?' },
+         { include: '#string' } ],
+      '#basic_elem': 
+       [ { include: '#comment' },
+         { include: '#statement' },
+         { include: '#constants' },
+         { include: '#operators' },
+         { include: '#builtins' },
+         { include: '#list' },
+         { include: '#atom' },
+         { include: '#variable' } ],
+      '#basic_fact': 
+       [ { token: 
+            [ 'entity.name.function.fact.basic.prolog',
+              'punctuation.end.fact.basic.prolog' ],
+           regex: '([a-z]\\w*)(\\.)' } ],
+      '#builtins': 
+       [ { token: 'support.function.builtin.prolog',
+           regex: '\\b(?:\n\t\t\t\t\t\tabolish|abort|ancestors|arg|ascii|assert[az]|\n\t\t\t\t\t\tatom(?:ic)?|body|char|close|conc|concat|consult|\n\t\t\t\t\t\tdefine|definition|dynamic|dump|fail|file|free|\n\t\t\t\t\t\tfree_proc|functor|getc|goal|halt|head|head|integer|\n\t\t\t\t\t\tlength|listing|match_args|member|next_clause|nl|\n\t\t\t\t\t\tnonvar|nth|number|cvars|nvars|offset|op|\n\t\t\t\t\t\tprint?|prompt|putc|quoted|ratom|read|redefine|\n\t\t\t\t\t\trename|retract(?:all)?|see|seeing|seen|skip|spy|\n\t\t\t\t\t\tstatistics|system|tab|tell|telling|term|\n\t\t\t\t\t\ttime|told|univ|unlink_clause|unspy_predicate|\n\t\t\t\t\t\tvar|write\n\t\t\t\t\t)\\b' } ],
+      '#comment': 
+       [ { token: 
+            [ 'punctuation.definition.comment.prolog',
+              'comment.line.percentage.prolog' ],
+           regex: '(%)(.*$)' },
+         { token: 'punctuation.definition.comment.prolog',
+           regex: '/\\*',
+           push: 
+            [ { token: 'punctuation.definition.comment.prolog',
+                regex: '\\*/',
+                next: 'pop' },
+              { defaultToken: 'comment.block.prolog' } ] } ],
+      '#constants': 
+       [ { token: 'constant.language.prolog',
+           regex: '\\b(?:true|false|yes|no)\\b' } ],
+      '#directive': 
+       [ { token: 'keyword.operator.directive.prolog',
+           regex: ':-',
+           push: 
+            [ { token: 'meta.directive.prolog', regex: '\\.', next: 'pop' },
+              { include: '#comment' },
+              { include: '#statement' },
+              { defaultToken: 'meta.directive.prolog' } ] } ],
+      '#expr': 
+       [ { include: '#comments' },
+         { token: 'meta.expression.prolog',
+           regex: '\\(',
+           push: 
+            [ { token: 'meta.expression.prolog', regex: '\\)', next: 'pop' },
+              { include: '#expr' },
+              { defaultToken: 'meta.expression.prolog' } ] },
+         { token: 'keyword.control.cutoff.prolog', regex: '!' },
+         { token: 'punctuation.control.and.prolog', regex: ',' },
+         { token: 'punctuation.control.or.prolog', regex: ';' },
+         { include: '#basic_elem' } ],
+      '#fact': 
+       [ { token: 
+            [ 'entity.name.function.fact.prolog',
+              'punctuation.begin.fact.parameters.prolog' ],
+           regex: '([a-z]\\w*)(\\()(?!.*:-)',
+           push: 
+            [ { token: 
+                 [ 'punctuation.end.fact.parameters.prolog',
+                   'punctuation.end.fact.prolog' ],
+                regex: '(\\))(\\.)',
+                next: 'pop' },
+              { include: '#parameter' },
+              { defaultToken: 'meta.fact.prolog' } ] } ],
+      '#list': 
+       [ { token: 'punctuation.begin.list.prolog',
+           regex: '\\[(?=.*\\])',
+           push: 
+            [ { token: 'punctuation.end.list.prolog',
+                regex: '\\]',
+                next: 'pop' },
+              { include: '#comment' },
+              { token: 'punctuation.separator.list.prolog', regex: ',' },
+              { token: 'punctuation.concat.list.prolog',
+                regex: '\\|',
+                push: 
+                 [ { token: 'meta.list.concat.prolog',
+                     regex: '(?=\\s*\\])',
+                     next: 'pop' },
+                   { include: '#basic_elem' },
+                   { defaultToken: 'meta.list.concat.prolog' } ] },
+              { include: '#basic_elem' },
+              { defaultToken: 'meta.list.prolog' } ] } ],
+      '#operators': 
+       [ { token: 'keyword.operator.prolog',
+           regex: '\\\\\\+|\\bnot\\b|\\bis\\b|->|[><]|[><\\\\:=]?=|(?:=\\\\|\\\\=)=' } ],
+      '#parameter': 
+       [ { token: 'variable.language.anonymous.prolog',
+           regex: '\\b_\\b' },
+         { token: 'variable.parameter.prolog',
+           regex: '\\b[A-Z_]\\w*\\b' },
+         { token: 'punctuation.separator.parameters.prolog', regex: ',' },
+         { include: '#basic_elem' },
+         { token: 'invalid.illegal.invalidchar.prolog', regex: '[^\\s]' } ],
+      '#rule': 
+       [ { token: 'meta.rule.prolog',
+           regex: '(?=[a-z]\\w*.*:-)',
+           push: 
+            [ { token: 'punctuation.rule.end.prolog',
+                regex: '\\.',
+                next: 'pop' },
+              { token: 'meta.rule.signature.prolog',
+                regex: '(?=[a-z]\\w*.*:-)',
+                push: 
+                 [ { token: 'meta.rule.signature.prolog',
+                     regex: '(?=:-)',
+                     next: 'pop' },
+                   { token: 'entity.name.function.rule.prolog',
+                     regex: '[a-z]\\w*(?=\\(|\\s*:-)' },
+                   { token: 'punctuation.rule.parameters.begin.prolog',
+                     regex: '\\(',
+                     push: 
+                      [ { token: 'punctuation.rule.parameters.end.prolog',
+                          regex: '\\)',
+                          next: 'pop' },
+                        { include: '#parameter' },
+                        { defaultToken: 'meta.rule.parameters.prolog' } ] },
+                   { defaultToken: 'meta.rule.signature.prolog' } ] },
+              { token: 'keyword.operator.definition.prolog',
+                regex: ':-',
+                push: 
+                 [ { token: 'meta.rule.definition.prolog',
+                     regex: '(?=\\.)',
+                     next: 'pop' },
+                   { include: '#comment' },
+                   { include: '#expr' },
+                   { defaultToken: 'meta.rule.definition.prolog' } ] },
+              { defaultToken: 'meta.rule.prolog' } ] } ],
+      '#statement': 
+       [ { token: 'meta.statement.prolog',
+           regex: '(?=[a-z]\\w*\\()',
+           push: 
+            [ { token: 'punctuation.end.statement.parameters.prolog',
+                regex: '\\)',
+                next: 'pop' },
+              { include: '#builtins' },
+              { include: '#atom' },
+              { token: 'punctuation.begin.statement.parameters.prolog',
+                regex: '\\(',
+                push: 
+                 [ { token: 'meta.statement.parameters.prolog',
+                     regex: '(?=\\))',
+                     next: 'pop' },
+                   { token: 'punctuation.separator.statement.prolog', regex: ',' },
+                   { include: '#basic_elem' },
+                   { defaultToken: 'meta.statement.parameters.prolog' } ] },
+              { defaultToken: 'meta.statement.prolog' } ] } ],
+      '#string': 
+       [ { token: 'punctuation.definition.string.begin.prolog',
+           regex: '\'',
+           push: 
+            [ { token: 'punctuation.definition.string.end.prolog',
+                regex: '\'',
+                next: 'pop' },
+              { token: 'constant.character.escape.prolog', regex: '\\\\.' },
+              { token: 'constant.character.escape.quote.prolog',
+                regex: '\'\'' },
+              { defaultToken: 'string.quoted.single.prolog' } ] } ],
+      '#variable': 
+       [ { token: 'variable.language.anonymous.prolog',
+           regex: '\\b_\\b' },
+         { token: 'variable.other.prolog',
+           regex: '\\b[A-Z_][a-zA-Z0-9_]*\\b' } ] }
+    
+    this.normalizeRules();
+};
+
+PrologHighlightRules.metaData = { fileTypes: [ 'plg', 'prolog' ],
+      foldingStartMarker: '(%\\s*region \\w*)|([a-z]\\w*.*:- ?)',
+      foldingStopMarker: '(%\\s*end(\\s*region)?)|(?=\\.)',
+      keyEquivalent: '^~P',
+      name: 'Prolog',
+      scopeName: 'source.prolog' }
+
+
+oop.inherits(PrologHighlightRules, TextHighlightRules);
+
+exports.PrologHighlightRules = PrologHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/properties.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/properties.js b/src/fauxton/assets/js/libs/ace/mode/properties.js
new file mode 100644
index 0000000..0f89b75
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/properties.js
@@ -0,0 +1,45 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var PropertiesHighlightRules = require("./properties_highlight_rules").PropertiesHighlightRules;
+
+var Mode = function() {
+    this.HighlightRules = PropertiesHighlightRules;
+};
+oop.inherits(Mode, TextMode);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/properties_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/properties_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/properties_highlight_rules.js
new file mode 100644
index 0000000..0fbaceb
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/properties_highlight_rules.js
@@ -0,0 +1,86 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var PropertiesHighlightRules = function() {
+
+    var escapeRe = /\\u[0-9a-fA-F]{4}|\\/;
+
+    this.$rules = {
+        "start" : [
+            {
+                token : "comment",
+                regex : /[!#].*$/
+            }, {
+                // Empty value
+                token : "keyword",
+                regex : /[=:]$/
+            }, {
+                token : "keyword",
+                regex : /[=:]/,
+                next  : "value"
+            }, {
+                token : "constant.language.escape",
+                regex : escapeRe
+            }, {
+                defaultToken: "variable"
+            }
+        ],
+        "value" : [
+            {
+                // Multi-line string
+                regex : /\\$/,
+                token : "string",
+                next : "value"
+            }, {
+                regex : /$/,
+                token : "string",
+                next : "start"
+            }, {
+                token : "constant.language.escape",
+                regex : escapeRe
+            }, {
+                defaultToken: "string"
+            }
+        ]
+    };
+
+};
+
+oop.inherits(PropertiesHighlightRules, TextHighlightRules);
+
+exports.PropertiesHighlightRules = PropertiesHighlightRules;
+});
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/protobuf.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/protobuf.js b/src/fauxton/assets/js/libs/ace/mode/protobuf.js
new file mode 100644
index 0000000..a3660bd
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/protobuf.js
@@ -0,0 +1,66 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ *
+ *    Zef Hemel
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var CMode = require("./c_cpp").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var ProtobufHighlightRules = require("./protobuf_highlight_rules").ProtobufHighlightRules;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    CMode.call(this);
+    var highlighter = new ProtobufHighlightRules();
+    this.foldingRules = new CStyleFoldMode();
+
+    this.$tokenizer = new Tokenizer(highlighter.getRules());
+    this.$keywordList = highlighter.$keywordList;
+};
+oop.inherits(Mode, CMode);
+
+(function() {
+    // Extra logic goes here.
+    this.lineCommentStart = "//";
+    this.blockComment = {start: "/*", end: "*/"};
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/protobuf_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/protobuf_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/protobuf_highlight_rules.js
new file mode 100644
index 0000000..fd24154
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/protobuf_highlight_rules.js
@@ -0,0 +1,66 @@
+define(function(require, exports, module) {
+    "use strict";
+
+    var oop = require("../lib/oop");
+    var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+    var ProtobufHighlightRules = function() {
+
+        var builtinTypes = "double|float|int32|int64|uint32|uint64|sint32|" +
+                           "sint64|fixed32|fixed64|sfixed32|sfixed64|bool|" +
+                           "string|bytes";
+        var keywordDeclaration = "message|required|optional|repeated|package|" +
+                                 "import|option|enum";
+
+        var keywordMapper = this.createKeywordMapper({
+            "keyword.declaration.protobuf": keywordDeclaration,
+            "support.type": builtinTypes
+        }, "identifier");
+
+        this.$rules = {
+            "start": [{
+                    token: "comment",
+                    regex: /\/\/.*$/
+                }, {
+                    token: "comment",
+                    regex: /\/\*/,
+                    next: "comment"
+                }, {
+                    token: "constant",
+                    regex: "<[^>]+>"
+                }, {
+                    regex: "=",
+                    token: "keyword.operator.assignment.protobuf"
+                }, {
+                    token : "string", // single line
+                    regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+                }, {
+                    token : "string", // single line
+                    regex : '[\'](?:(?:\\\\.)|(?:[^\'\\\\]))*?[\']'
+                }, {
+                    token: "constant.numeric", // hex
+                    regex: "0[xX][0-9a-fA-F]+\\b"
+                }, {
+                    token: "constant.numeric", // float
+                    regex: "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+                }, {
+                    token: keywordMapper,
+                    regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+                }],
+            "comment": [{
+                    token: "comment", // closing comment
+                    regex: ".*?\\*\\/",
+                    next: "start"
+                }, {
+                    token: "comment", // comment spanning whole line
+                    regex: ".+"
+                }]
+        };
+
+        this.normalizeRules();
+    };
+
+    oop.inherits(ProtobufHighlightRules, TextHighlightRules);
+
+    exports.ProtobufHighlightRules = ProtobufHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/python.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/python.js b/src/fauxton/assets/js/libs/ace/mode/python.js
new file mode 100644
index 0000000..d561c08
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/python.js
@@ -0,0 +1,113 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var PythonHighlightRules = require("./python_highlight_rules").PythonHighlightRules;
+var PythonFoldMode = require("./folding/pythonic").FoldMode;
+var Range = require("../range").Range;
+
+var Mode = function() {
+    this.HighlightRules = PythonHighlightRules;
+    this.foldingRules = new PythonFoldMode("\\:");
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = "#";
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+
+        if (state == "start") {
+            var match = line.match(/^.*[\{\(\[\:]\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        }
+
+        return indent;
+    };
+
+    var outdents = {
+        "pass": 1,
+        "return": 1,
+        "raise": 1,
+        "break": 1,
+        "continue": 1
+    };
+    
+    this.checkOutdent = function(state, line, input) {
+        if (input !== "\r\n" && input !== "\r" && input !== "\n")
+            return false;
+
+        var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
+        
+        if (!tokens)
+            return false;
+        
+        // ignore trailing comments
+        do {
+            var last = tokens.pop();
+        } while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
+        
+        if (!last)
+            return false;
+        
+        return (last.type == "keyword" && outdents[last.value]);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        // outdenting in python is slightly different because it always applies
+        // to the next line and only of a new line is inserted
+        
+        row += 1;
+        var indent = this.$getIndent(doc.getLine(row));
+        var tab = doc.getTabString();
+        if (indent.slice(-tab.length) == tab)
+            doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/python_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/python_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/python_highlight_rules.js
new file mode 100644
index 0000000..ccb4067
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/python_highlight_rules.js
@@ -0,0 +1,191 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+/*
+ * TODO: python delimiters
+ */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var PythonHighlightRules = function() {
+
+    var keywords = (
+        "and|as|assert|break|class|continue|def|del|elif|else|except|exec|" +
+        "finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|" +
+        "raise|return|try|while|with|yield"
+    );
+
+    var builtinConstants = (
+        "True|False|None|NotImplemented|Ellipsis|__debug__"
+    );
+
+    var builtinFunctions = (
+        "abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|" +
+        "eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|" +
+        "binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|" +
+        "float|list|raw_input|unichr|callable|format|locals|reduce|unicode|" +
+        "chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|" +
+        "cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|" +
+        "__import__|complex|hash|min|set|apply|delattr|help|next|setattr|" +
+        "buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern"
+    );
+
+    //var futureReserved = "";
+    var keywordMapper = this.createKeywordMapper({
+        "invalid.deprecated": "debugger",
+        "support.function": builtinFunctions,
+        //"invalid.illegal": futureReserved,
+        "constant.language": builtinConstants,
+        "keyword": keywords
+    }, "identifier");
+
+    var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
+
+    var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
+    var octInteger = "(?:0[oO]?[0-7]+)";
+    var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
+    var binInteger = "(?:0[bB][01]+)";
+    var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
+
+    var exponent = "(?:[eE][+-]?\\d+)";
+    var fraction = "(?:\\.\\d+)";
+    var intPart = "(?:\\d+)";
+    var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
+    var exponentFloat = "(?:(?:" + pointFloat + "|" +  intPart + ")" + exponent + ")";
+    var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
+
+    var stringEscape =  "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})";
+
+    this.$rules = {
+        "start" : [ {
+            token : "comment",
+            regex : "#.*$"
+        }, {
+            token : "string",           // multi line """ string start
+            regex : strPre + '"{3}',
+            next : "qqstring3"
+        }, {
+            token : "string",           // " string
+            regex : strPre + '"(?=.)',
+            next : "qqstring"
+        }, {
+            token : "string",           // multi line ''' string start
+            regex : strPre + "'{3}",
+            next : "qstring3"
+        }, {
+            token : "string",           // ' string
+            regex : strPre + "'(?=.)",
+            next : "qstring"
+        }, {
+            token : "constant.numeric", // imaginary
+            regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
+        }, {
+            token : "constant.numeric", // float
+            regex : floatNumber
+        }, {
+            token : "constant.numeric", // long integer
+            regex : integer + "[lL]\\b"
+        }, {
+            token : "constant.numeric", // integer
+            regex : integer + "\\b"
+        }, {
+            token : keywordMapper,
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        }, {
+            token : "keyword.operator",
+            regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
+        }, {
+            token : "paren.lparen",
+            regex : "[\\[\\(\\{]"
+        }, {
+            token : "paren.rparen",
+            regex : "[\\]\\)\\}]"
+        }, {
+            token : "text",
+            regex : "\\s+"
+        } ],
+        "qqstring3" : [ {
+            token : "constant.language.escape",
+            regex : stringEscape
+        }, {
+            token : "string", // multi line """ string end
+            regex : '"{3}',
+            next : "start"
+        }, {
+            defaultToken : "string"
+        } ],
+        "qstring3" : [ {
+            token : "constant.language.escape",
+            regex : stringEscape
+        }, {
+            token : "string",  // multi line ''' string end
+            regex : "'{3}",
+            next : "start"
+        }, {
+            defaultToken : "string"
+        } ],
+        "qqstring" : [{
+            token : "constant.language.escape",
+            regex : stringEscape
+        }, {
+            token : "string",
+            regex : "\\\\$",
+            next  : "qqstring"
+        }, {
+            token : "string",
+            regex : '"|$',
+            next  : "start"
+        }, {
+            defaultToken: "string"
+        }],
+        "qstring" : [{
+            token : "constant.language.escape",
+            regex : stringEscape
+        }, {
+            token : "string",
+            regex : "\\\\$",
+            next  : "qstring"
+        }, {
+            token : "string",
+            regex : "'|$",
+            next  : "start"
+        }, {
+            defaultToken: "string"
+        }]
+    };
+};
+
+oop.inherits(PythonHighlightRules, TextHighlightRules);
+
+exports.PythonHighlightRules = PythonHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/python_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/python_test.js b/src/fauxton/assets/js/libs/ace/mode/python_test.js
new file mode 100644
index 0000000..31b343b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/python_test.js
@@ -0,0 +1,79 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("../edit_session").EditSession;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var Mode = require("./python").Mode;
+var assert = require("../test/assertions");
+
+module.exports = {
+    setUp : function() {    
+        this.mode = new Mode();
+    },
+
+    "test: getTokenizer() (smoke test)" : function() {
+        var tokenizer = this.mode.getTokenizer();
+
+        assert.ok(tokenizer instanceof Tokenizer);
+
+        var tokens = tokenizer.getLineTokens("'juhu'", "start").tokens;
+        assert.equal("string", tokens[0].type);
+    },
+
+    "test: auto outdent after 'pass', 'return' and 'raise'" : function() {
+        assert.ok(this.mode.checkOutdent("start", "        pass", "\n"));
+        assert.ok(this.mode.checkOutdent("start", "        pass  ", "\n"));
+        assert.ok(this.mode.checkOutdent("start", "        return", "\n"));
+        assert.ok(this.mode.checkOutdent("start", "        raise", "\n"));
+        assert.equal(this.mode.checkOutdent("start", "        raise", " "), false);
+        assert.ok(this.mode.checkOutdent("start", "        pass # comment", "\n"));
+        assert.equal(this.mode.checkOutdent("start", "'juhu'", "\n"), false);
+    },
+    
+    "test: auto outdent" : function() {
+        var session = new EditSession(["    if True:", "        pass", "        "]);
+        this.mode.autoOutdent("start", session, 1);
+        assert.equal("    ", session.getLine(2));
+    }
+
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/r.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/r.js b/src/fauxton/assets/js/libs/ace/mode/r.js
new file mode 100644
index 0000000..c21a16e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/r.js
@@ -0,0 +1,154 @@
+/*
+ * r.js
+ *
+ * Copyright (C) 2009-11 by RStudio, Inc.
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ *
+ */
+define(function(require, exports, module) {
+   "use strict";
+
+   var Range = require("../range").Range;
+   var oop = require("../lib/oop");
+   var TextMode = require("./text").Mode;
+   var Tokenizer = require("../tokenizer").Tokenizer;
+   var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+   var RHighlightRules = require("./r_highlight_rules").RHighlightRules;
+   var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+   var unicode = require("../unicode");
+
+   var Mode = function()
+   {
+      this.HighlightRules = RHighlightRules;
+      this.$outdent = new MatchingBraceOutdent();
+   };
+   oop.inherits(Mode, TextMode);
+
+   (function()
+   {
+      this.lineCommentStart = "#";
+      // todo import codeModel from RStudio
+      /*this.tokenRe = new RegExp("^["
+          + unicode.packages.L
+          + unicode.packages.Mn + unicode.packages.Mc
+          + unicode.packages.Nd
+          + unicode.packages.Pc + "._]+", "g"
+      );
+
+      this.nonTokenRe = new RegExp("^(?:[^"
+          + unicode.packages.L
+          + unicode.packages.Mn + unicode.packages.Mc
+          + unicode.packages.Nd
+          + unicode.packages.Pc + "._]|\s])+", "g"
+      );
+
+      this.$complements = {
+               "(": ")",
+               "[": "]",
+               '"': '"',
+               "'": "'",
+               "{": "}"
+            };
+      this.$reOpen = /^[(["'{]$/;
+      this.$reClose = /^[)\]"'}]$/;
+
+      this.getNextLineIndent = function(state, line, tab, tabSize, row)
+      {
+         return this.codeModel.getNextLineIndent(row, line, state, tab, tabSize);
+      };
+
+      this.allowAutoInsert = this.smartAllowAutoInsert;
+
+      this.checkOutdent = function(state, line, input) {
+         if (! /^\s+$/.test(line))
+            return false;
+
+         return /^\s*[\{\}\)]/.test(input);
+      };
+
+      this.getIndentForOpenBrace = function(openBracePos)
+      {
+         return this.codeModel.getIndentForOpenBrace(openBracePos);
+      };
+
+      this.autoOutdent = function(state, doc, row) {
+         if (row == 0)
+            return 0;
+
+         var line = doc.getLine(row);
+
+         var match = line.match(/^(\s*[\}\)])/);
+         if (match)
+         {
+            var column = match[1].length;
+            var openBracePos = doc.findMatchingBracket({row: row, column: column});
+
+            if (!openBracePos || openBracePos.row == row) return 0;
+
+            var indent = this.codeModel.getIndentForOpenBrace(openBracePos);
+            doc.replace(new Range(row, 0, row, column-1), indent);
+         }
+
+         match = line.match(/^(\s*\{)/);
+         if (match)
+         {
+            var column = match[1].length;
+            var indent = this.codeModel.getBraceIndent(row-1);
+            doc.replace(new Range(row, 0, row, column-1), indent);
+         }
+      };
+
+      this.$getIndent = function(line) {
+         var match = line.match(/^(\s+)/);
+         if (match) {
+            return match[1];
+         }
+
+         return "";
+      };
+
+      this.transformAction = function(state, action, editor, session, text) {
+         if (action === 'insertion' && text === "\n") {
+
+            // If newline in a doxygen comment, continue the comment
+            var pos = editor.getSelectionRange().start;
+            var match = /^((\s*#+')\s*)/.exec(session.doc.getLine(pos.row));
+            if (match && editor.getSelectionRange().start.column >= match[2].length) {
+               return {text: "\n" + match[1]};
+            }
+         }
+         return false;
+      };*/
+   }).call(Mode.prototype);
+   exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/r_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/r_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/r_highlight_rules.js
new file mode 100644
index 0000000..99a7437
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/r_highlight_rules.js
@@ -0,0 +1,188 @@
+/*
+ * r_highlight_rules.js
+ *
+ * Copyright (C) 2009-11 by RStudio, Inc.
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * This program is licensed to you under the terms of version 3 of the
+ * GNU Affero General Public License. This program is distributed WITHOUT
+ * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
+ * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
+ *
+ */
+define(function(require, exports, module)
+{
+
+   var oop = require("../lib/oop");
+   var lang = require("../lib/lang");
+   var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+   var TexHighlightRules = require("./tex_highlight_rules").TexHighlightRules;
+
+   var RHighlightRules = function()
+   {
+
+      var keywords = lang.arrayToMap(
+            ("function|if|in|break|next|repeat|else|for|return|switch|while|try|tryCatch|stop|warning|require|library|attach|detach|source|setMethod|setGeneric|setGroupGeneric|setClass")
+                  .split("|")
+            );
+
+      var buildinConstants = lang.arrayToMap(
+            ("NULL|NA|TRUE|FALSE|T|F|Inf|NaN|NA_integer_|NA_real_|NA_character_|" +
+             "NA_complex_").split("|")
+            );
+
+      // regexp must not have capturing parentheses. Use (?:) instead.
+      // regexps are ordered -> the first match is used
+
+      this.$rules = {
+         "start" : [
+            {
+               // Roxygen
+               token : "comment.sectionhead",
+               regex : "#+(?!').*(?:----|====|####)\\s*$"
+            },
+            {
+               // Roxygen
+               token : "comment",
+               regex : "#+'",
+               next : "rd-start"
+            },
+            {
+               token : "comment",
+               regex : "#.*$"
+            },
+            {
+               token : "string", // multi line string start
+               regex : '["]',
+               next : "qqstring"
+            },
+            {
+               token : "string", // multi line string start
+               regex : "[']",
+               next : "qstring"
+            },
+            {
+               token : "constant.numeric", // hex
+               regex : "0[xX][0-9a-fA-F]+[Li]?\\b"
+            },
+            {
+               token : "constant.numeric", // explicit integer
+               regex : "\\d+L\\b"
+            },
+            {
+               token : "constant.numeric", // number
+               regex : "\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b"
+            },
+            {
+               token : "constant.numeric", // number with leading decimal
+               regex : "\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b"
+            },
+            {
+               token : "constant.language.boolean",
+               regex : "(?:TRUE|FALSE|T|F)\\b"
+            },
+            {
+               token : "identifier",
+               regex : "`.*?`"
+            },
+            {
+               onMatch : function(value) {
+                  if (keywords[value])
+                     return "keyword";
+                  else if (buildinConstants[value])
+                     return "constant.language";
+                  else if (value == '...' || value.match(/^\.\.\d+$/))
+                     return "variable.language";
+                  else
+                     return "identifier";
+               },
+               regex : "[a-zA-Z.][a-zA-Z0-9._]*\\b"
+            },
+            {
+               token : "keyword.operator",
+               regex : "%%|>=|<=|==|!=|\\->|<\\-|\\|\\||&&|=|\\+|\\-|\\*|/|\\^|>|<|!|&|\\||~|\\$|:"
+            },
+            {
+               token : "keyword.operator", // infix operators
+               regex : "%.*?%"
+            },
+            {
+               // Obviously these are neither keywords nor operators, but
+               // labelling them as such was the easiest way to get them
+               // to be colored distinctly from regular text
+               token : "paren.keyword.operator",
+               regex : "[[({]"
+            },
+            {
+               // Obviously these are neither keywords nor operators, but
+               // labelling them as such was the easiest way to get them
+               // to be colored distinctly from regular text
+               token : "paren.keyword.operator",
+               regex : "[\\])}]"
+            },
+            {
+               token : "text",
+               regex : "\\s+"
+            }
+         ],
+         "qqstring" : [
+            {
+               token : "string",
+               regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
+               next : "start"
+            },
+            {
+               token : "string",
+               regex : '.+'
+            }
+         ],
+         "qstring" : [
+            {
+               token : "string",
+               regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
+               next : "start"
+            },
+            {
+               token : "string",
+               regex : '.+'
+            }
+         ]
+      };
+
+      var rdRules = new TexHighlightRules("comment").getRules();
+
+      // Make all embedded TeX virtual-comment so they don't interfere with
+      // auto-indent.
+      for (var i = 0; i < rdRules["start"].length; i++) {
+         rdRules["start"][i].token += ".virtual-comment";
+      }
+
+      this.addRules(rdRules, "rd-");
+      this.$rules["rd-start"].unshift({
+          token: "text",
+          regex: "^",
+          next: "start"
+      });
+      this.$rules["rd-start"].unshift({
+         token : "keyword",
+         regex : "@(?!@)[^ ]*"
+      });
+      this.$rules["rd-start"].unshift({
+         token : "comment",
+         regex : "@@"
+      });
+      this.$rules["rd-start"].push({
+         token : "comment",
+         regex : "[^%\\\\[({\\])}]+"
+      });
+   };
+
+   oop.inherits(RHighlightRules, TextHighlightRules);
+
+   exports.RHighlightRules = RHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/rdoc.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/rdoc.js b/src/fauxton/assets/js/libs/ace/mode/rdoc.js
new file mode 100644
index 0000000..8d3e90a
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/rdoc.js
@@ -0,0 +1,61 @@
+/*
+ * rdoc.js
+ *
+ * Copyright (C) 2009-11 by RStudio, Inc.
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ *
+ */
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var RDocHighlightRules = require("./rdoc_highlight_rules").RDocHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+
+var Mode = function(suppressHighlighting) {
+	this.HighlightRules = RDocHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.getNextLineIndent = function(state, line, tab) {
+        return this.$getIndent(line);
+    };
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/rdoc_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/rdoc_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/rdoc_highlight_rules.js
new file mode 100644
index 0000000..df511b4
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/rdoc_highlight_rules.js
@@ -0,0 +1,99 @@
+/*
+ * rdoc_highlight_rules.js
+ *
+ * Copyright (C) 2009-11 by RStudio, Inc.
+ *
+ * This program is licensed to you under the terms of version 3 of the
+ * GNU Affero General Public License. This program is distributed WITHOUT
+ * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
+ * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
+ *
+ */
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var LaTeXHighlightRules = require("./latex_highlight_rules");
+
+var RDocHighlightRules = function() {
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "start" : [
+	        {
+	            token : "comment",
+	            regex : "%.*$"
+	        }, {
+	            token : "text", // non-command
+	            regex : "\\\\[$&%#\\{\\}]"
+	        }, {
+	            token : "keyword", // command
+	            regex : "\\\\(?:name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage)\\b",
+               next : "nospell"
+	        }, {
+	            token : "keyword", // command
+	            regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])"
+	        }, {
+               // Obviously these are neither keywords nor operators, but
+               // labelling them as such was the easiest way to get them
+               // to be colored distinctly from regular text
+               token : "paren.keyword.operator",
+	            regex : "[[({]"
+	        }, {
+               // Obviously these are neither keywords nor operators, but
+               // labelling them as such was the easiest way to get them
+               // to be colored distinctly from regular text
+               token : "paren.keyword.operator",
+	            regex : "[\\])}]"
+	        }, {
+	            token : "text",
+	            regex : "\\s+"
+	        }
+        ],
+        // This mode is necessary to prevent spell checking, but to keep the
+        // same syntax highlighting behavior. 
+        "nospell" : [
+           {
+               token : "comment",
+               regex : "%.*$",
+               next : "start"
+           }, {
+               token : "nospell.text", // non-command
+               regex : "\\\\[$&%#\\{\\}]"
+           }, {
+               token : "keyword", // command
+               regex : "\\\\(?:name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage)\\b"
+           }, {
+               token : "keyword", // command
+               regex : "\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])",
+               next : "start"
+           }, {
+               token : "paren.keyword.operator",
+               regex : "[[({]"
+           }, {
+               token : "paren.keyword.operator",
+               regex : "[\\])]"
+           }, {
+               token : "paren.keyword.operator",
+               regex : "}",
+               next : "start"
+           }, {
+               token : "nospell.text",
+               regex : "\\s+"
+           }, {
+               token : "nospell.text",
+               regex : "\\w+"
+           }
+        ]
+    };
+};
+
+oop.inherits(RDocHighlightRules, TextHighlightRules);
+
+exports.RDocHighlightRules = RDocHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/rhtml.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/rhtml.js b/src/fauxton/assets/js/libs/ace/mode/rhtml.js
new file mode 100644
index 0000000..a111f93
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/rhtml.js
@@ -0,0 +1,86 @@
+/*
+ * rhtml.js
+ *
+ * Copyright (C) 2009-11 by RStudio, Inc.
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var HtmlMode = require("./html").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+
+var RHtmlHighlightRules = require("./rhtml_highlight_rules").RHtmlHighlightRules;
+/* Make life easier, don't do these right now 
+var SweaveBackgroundHighlighter = require("mode/sweave_background_highlighter").SweaveBackgroundHighlighter;
+var RCodeModel = require("mode/r_code_model").RCodeModel;
+*/
+
+var Mode = function(doc, session) {
+   this.$session = session;
+   this.HighlightRules = RHtmlHighlightRules;
+
+   /* Or these.
+   this.codeModel = new RCodeModel(doc, this.$tokenizer, /^r-/,
+                                   /^<!--\s*begin.rcode\s*(.*)/);
+   this.foldingRules = this.codeModel;
+   this.$sweaveBackgroundHighlighter = new SweaveBackgroundHighlighter(
+         session,
+         /^<!--\s*begin.rcode\s*(?:.*)/,
+         /^\s*end.rcode\s*-->/,
+         true); */
+};
+oop.inherits(Mode, HtmlMode);
+
+(function() {
+   this.insertChunkInfo = {
+      value: "<!--begin.rcode\n\nend.rcode-->\n",
+      position: {row: 0, column: 15}
+   };
+    
+   this.getLanguageMode = function(position)
+   {
+      return this.$session.getState(position.row).match(/^r-/) ? 'R' : 'HTML';
+   };
+
+   /* this.getNextLineIndent = function(state, line, tab, tabSize, row)
+   {
+      return this.codeModel.getNextLineIndent(row, line, state, tab, tabSize);
+   }; */
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/rhtml_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/rhtml_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/rhtml_highlight_rules.js
new file mode 100644
index 0000000..0ab65a9
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/rhtml_highlight_rules.js
@@ -0,0 +1,46 @@
+/*
+ * rhtml_highlight_rules.js
+ *
+ * Copyright (C) 2009-11 by RStudio, Inc.
+ *
+ * The Initial Developer of the Original Code is
+ * Ajax.org B.V.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * This program is licensed to you under the terms of version 3 of the
+ * GNU Affero General Public License. This program is distributed WITHOUT
+ * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
+ * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
+ *
+ */
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var RHighlightRules = require("./r_highlight_rules").RHighlightRules;
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var RHtmlHighlightRules = function() {
+    HtmlHighlightRules.call(this);
+
+    this.$rules["start"].unshift({
+        token: "support.function.codebegin",
+        regex: "^<" + "!--\\s*begin.rcode\\s*(?:.*)",
+        next: "r-start"
+    });
+
+    this.embedRules(RHighlightRules, "r-", [{
+        token: "support.function.codeend",
+        regex: "^\\s*end.rcode\\s*-->",
+        next: "start"
+    }], ["start"]);
+
+    this.normalizeRules();
+};
+oop.inherits(RHtmlHighlightRules, TextHighlightRules);
+
+exports.RHtmlHighlightRules = RHtmlHighlightRules;
+});


[35/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_groovy.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_groovy.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_groovy.json
new file mode 100644
index 0000000..c7dae6b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_groovy.json
@@ -0,0 +1,410 @@
+[[
+   "start",
+  ["comment","//http://groovy.codehaus.org/Martin+Fowler%27s+closure+examples+in+Groovy"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","class"],
+  ["text"," "],
+  ["identifier","Employee"],
+  ["text"," "],
+  ["lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","def"],
+  ["text"," "],
+  ["identifier","name"],
+  ["text",", "],
+  ["identifier","salary"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","boolean"],
+  ["text"," "],
+  ["identifier","manager"]
+],[
+   "start",
+  ["text","    "],
+  ["support.function","String"],
+  ["text"," "],
+  ["identifier","toString"],
+  ["lparen","("],
+  ["rparen",")"],
+  ["text"," "],
+  ["lparen","{"],
+  ["text"," "],
+  ["keyword","return"],
+  ["text"," "],
+  ["identifier","name"],
+  ["text"," "],
+  ["rparen","}"]
+],[
+   "start",
+  ["rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","def"],
+  ["text"," "],
+  ["identifier","emps"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["lparen","["],
+  ["keyword","new"],
+  ["text"," "],
+  ["identifier","Employee"],
+  ["lparen","("],
+  ["identifier","name"],
+  ["text",":"],
+  ["string","'Guillaume'"],
+  ["text",", "],
+  ["identifier","manager"],
+  ["text",":"],
+  ["constant.language.boolean","true"],
+  ["text",", "],
+  ["identifier","salary"],
+  ["text",":"],
+  ["constant.numeric","200"],
+  ["rparen",")"],
+  ["text",","]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","new"],
+  ["text"," "],
+  ["identifier","Employee"],
+  ["lparen","("],
+  ["identifier","name"],
+  ["text",":"],
+  ["string","'Graeme'"],
+  ["text",", "],
+  ["identifier","manager"],
+  ["text",":"],
+  ["constant.language.boolean","true"],
+  ["text",", "],
+  ["identifier","salary"],
+  ["text",":"],
+  ["constant.numeric","200"],
+  ["rparen",")"],
+  ["text",","]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","new"],
+  ["text"," "],
+  ["identifier","Employee"],
+  ["lparen","("],
+  ["identifier","name"],
+  ["text",":"],
+  ["string","'Dierk'"],
+  ["text",", "],
+  ["identifier","manager"],
+  ["text",":"],
+  ["constant.language.boolean","false"],
+  ["text",", "],
+  ["identifier","salary"],
+  ["text",":"],
+  ["constant.numeric","151"],
+  ["rparen",")"],
+  ["text",","]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","new"],
+  ["text"," "],
+  ["identifier","Employee"],
+  ["lparen","("],
+  ["identifier","name"],
+  ["text",":"],
+  ["string","'Bernd'"],
+  ["text",", "],
+  ["identifier","manager"],
+  ["text",":"],
+  ["constant.language.boolean","false"],
+  ["text",", "],
+  ["identifier","salary"],
+  ["text",":"],
+  ["constant.numeric","50"],
+  ["rparen",")]"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","def"],
+  ["text"," "],
+  ["identifier","managers"],
+  ["lparen","("],
+  ["identifier","emps"],
+  ["rparen",")"],
+  ["text"," "],
+  ["lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","emps"],
+  ["text","."],
+  ["identifier","findAll"],
+  ["text"," "],
+  ["lparen","{"],
+  ["text"," "],
+  ["identifier","e"],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["identifier","e"],
+  ["text","."],
+  ["identifier","isManager"],
+  ["lparen","("],
+  ["rparen",")"],
+  ["text"," "],
+  ["rparen","}"]
+],[
+   "start",
+  ["rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","assert"],
+  ["text"," "],
+  ["identifier","emps"],
+  ["lparen","["],
+  ["constant.numeric","0"],
+  ["text",".."],
+  ["constant.numeric","1"],
+  ["rparen","]"],
+  ["text"," "],
+  ["keyword.operator","=="],
+  ["text"," "],
+  ["identifier","managers"],
+  ["lparen","("],
+  ["identifier","emps"],
+  ["rparen",")"],
+  ["text"," "],
+  ["comment","// [Guillaume, Graeme]"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","def"],
+  ["text"," "],
+  ["identifier","highPaid"],
+  ["lparen","("],
+  ["identifier","emps"],
+  ["rparen",")"],
+  ["text"," "],
+  ["lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","threshold"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","150"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","emps"],
+  ["text","."],
+  ["identifier","findAll"],
+  ["text"," "],
+  ["lparen","{"],
+  ["text"," "],
+  ["identifier","e"],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["identifier","e"],
+  ["text","."],
+  ["identifier","salary"],
+  ["text"," "],
+  ["keyword.operator",">"],
+  ["text"," "],
+  ["identifier","threshold"],
+  ["text"," "],
+  ["rparen","}"]
+],[
+   "start",
+  ["rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","assert"],
+  ["text"," "],
+  ["identifier","emps"],
+  ["lparen","["],
+  ["constant.numeric","0"],
+  ["text",".."],
+  ["constant.numeric","2"],
+  ["rparen","]"],
+  ["text"," "],
+  ["keyword.operator","=="],
+  ["text"," "],
+  ["identifier","highPaid"],
+  ["lparen","("],
+  ["identifier","emps"],
+  ["rparen",")"],
+  ["text"," "],
+  ["comment","// [Guillaume, Graeme, Dierk]"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","def"],
+  ["text"," "],
+  ["identifier","paidMore"],
+  ["lparen","("],
+  ["identifier","amount"],
+  ["rparen",")"],
+  ["text"," "],
+  ["lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["lparen","{"],
+  ["text"," "],
+  ["identifier","e"],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["identifier","e"],
+  ["text","."],
+  ["identifier","salary"],
+  ["text"," "],
+  ["keyword.operator",">"],
+  ["text"," "],
+  ["identifier","amount"],
+  ["rparen","}"]
+],[
+   "start",
+  ["rparen","}"]
+],[
+   "start",
+  ["keyword","def"],
+  ["text"," "],
+  ["identifier","highPaid"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","paidMore"],
+  ["lparen","("],
+  ["constant.numeric","150"],
+  ["rparen",")"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","assert"],
+  ["text"," "],
+  ["identifier","highPaid"],
+  ["lparen","("],
+  ["identifier","emps"],
+  ["lparen","["],
+  ["constant.numeric","0"],
+  ["rparen","])"],
+  ["text"," "],
+  ["comment","// true"]
+],[
+   "start",
+  ["keyword","assert"],
+  ["text"," "],
+  ["identifier","emps"],
+  ["lparen","["],
+  ["constant.numeric","0"],
+  ["text",".."],
+  ["constant.numeric","2"],
+  ["rparen","]"],
+  ["text"," "],
+  ["keyword.operator","=="],
+  ["text"," "],
+  ["identifier","emps"],
+  ["text","."],
+  ["identifier","findAll"],
+  ["lparen","("],
+  ["identifier","highPaid"],
+  ["rparen",")"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","def"],
+  ["text"," "],
+  ["identifier","filename"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["string","'test.txt'"]
+],[
+   "start",
+  ["keyword","new"],
+  ["text"," "],
+  ["identifier","File"],
+  ["lparen","("],
+  ["identifier","filename"],
+  ["rparen",")"],
+  ["text","."],
+  ["identifier","withReader"],
+  ["lparen","{"],
+  ["text"," "],
+  ["identifier","reader"],
+  ["text"," "],
+  ["keyword.operator","->"],
+  ["text"," "],
+  ["identifier","doSomethingWith"],
+  ["lparen","("],
+  ["identifier","reader"],
+  ["rparen",")"],
+  ["text"," "],
+  ["rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","def"],
+  ["text"," "],
+  ["identifier","readersText"]
+],[
+   "start",
+  ["keyword","def"],
+  ["text"," "],
+  ["identifier","doSomethingWith"],
+  ["lparen","("],
+  ["identifier","reader"],
+  ["rparen",")"],
+  ["text"," "],
+  ["lparen","{"],
+  ["text"," "],
+  ["identifier","readersText"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","reader"],
+  ["text","."],
+  ["identifier","text"],
+  ["text"," "],
+  ["rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","assert"],
+  ["text"," "],
+  ["keyword","new"],
+  ["text"," "],
+  ["identifier","File"],
+  ["lparen","("],
+  ["identifier","filename"],
+  ["rparen",")"],
+  ["text","."],
+  ["identifier","text"],
+  ["text"," "],
+  ["keyword.operator","=="],
+  ["text"," "],
+  ["identifier","readersText"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_haml.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_haml.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_haml.json
new file mode 100644
index 0000000..423c3bd
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_haml.json
@@ -0,0 +1,174 @@
+[[
+   "start",
+  ["keyword.other.doctype","!!!5"]
+],[
+   "start"
+],[
+   "start",
+  ["punctuation.section.comment","# <!--[if lt IE 7]> <html class=\"no-js lt-ie9 lt-ie8 lt-ie7\" lang=\"en\"> <![endif]-->"]
+],[
+   "start",
+  ["punctuation.section.comment","# <!--[if IE 7]>    <html class=\"no-js lt-ie9 lt-ie8\" lang=\"en\"> <![endif]-->"]
+],[
+   "start",
+  ["punctuation.section.comment","# <!--[if IE 8]>    <html class=\"no-js lt-ie9\" lang=\"en\"> <![endif]-->"]
+],[
+   "start",
+  ["punctuation.section.comment","# <!--[if gt IE 8]><!--> <html class=\"no-js\" lang=\"en\"> <!--<![endif]-->"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["punctuation.section.comment","/adasdasdad"]
+],[
+   "start",
+  ["entity.name.tag.haml","%div"],
+  ["punctuation.section","{"],
+  ["constant.other.symbol.ruby",":id"],
+  ["text"," => "],
+  ["string","\"#{@item.type}_#{@item.number}\""],
+  ["text",", "],
+  ["constant.other.symbol.ruby",":class"],
+  ["text"," => "],
+  ["string","'#{@item.type} #{@item.urgency}'"],
+  ["text",", "],
+  ["constant.other.symbol.ruby",":phoney"],
+  ["text"," => "],
+  ["string","`asdasdasd`"],
+  ["punctuation.section","}"]
+],[
+   "start",
+  ["punctuation.section.comment","/ file: app/views/movies/index.html.haml"]
+],[
+   "start",
+  ["meta.escape.haml","\\d"]
+],[
+   "start",
+  ["entity.name.tag.haml","%ads:"],
+  ["punctuation.section","{"],
+  ["constant.other.symbol.ruby",":bleh"],
+  ["text"," => "],
+  ["constant.numeric","33"],
+  ["punctuation.section","}"]
+],[
+   "embedded_ruby",
+  ["entity.name.tag.haml","%p"],
+  ["text","==ddd=="]
+],[
+   "start",
+  ["text","  Date/Time:"]
+],[
+   "embedded_ruby",
+  ["text","  - "],
+  ["identifier","now"],
+  ["text"," = "],
+  ["support.class","DateTime"],
+  ["text","."],
+  ["identifier","now"],
+  ["text"," "]
+],[
+   "start",
+  ["entity.name.tag.haml","  %strong"],
+  ["text","= now"]
+],[
+   "embedded_ruby",
+  ["text","   = "],
+  ["keyword","if"],
+  ["text"," "],
+  ["identifier","now"],
+  ["text","  "],
+  ["support.class","DateTime"],
+  ["text","."],
+  ["identifier","parse"],
+  ["text","(\""],
+  ["support.class","December"],
+  ["text"," "],
+  ["constant.numeric","31"],
+  ["text",", "],
+  ["constant.numeric","2006"],
+  ["text","\")"]
+],[
+   "embedded_ruby",
+  ["text","    = \""],
+  ["support.class","Happy"],
+  ["text"," "],
+  ["identifier","new"],
+  ["text"," \" + \""],
+  ["identifier","year"],
+  ["text","!\""]
+],[
+   "start",
+  ["entity.name.tag.haml","%sfd"],
+  ["entity.other.attribute-name.class.haml",".dfdfg"]
+],[
+   "start",
+  ["punctuation.section.comment","#content"]
+],[
+   "start",
+  ["text"," .title"]
+],[
+   "start",
+  ["entity.name.tag.haml","   %h1"],
+  ["text","= @title"]
+],[
+   "embedded_ruby",
+  ["text","   = "],
+  ["support.function","link_to"],
+  ["text"," '"],
+  ["support.class","Home"],
+  ["text","', "],
+  ["identifier","home_url"]
+],[
+   "start"
+],[
+   "start",
+  ["punctuation.section.comment","   #contents"]
+],[
+   "start",
+  ["entity.name.tag.haml","%div"],
+  ["entity.other.attribute-name.id.haml","#content"]
+],[
+   "start",
+  ["entity.name.tag.haml","  %div"],
+  ["entity.other.attribute-name.class.haml",".articles"]
+],[
+   "start",
+  ["entity.name.tag.haml","    %div"],
+  ["entity.other.attribute-name.class.haml",".article.title"],
+  ["text"," Blah"]
+],[
+   "start",
+  ["entity.name.tag.haml","    %div"],
+  ["entity.other.attribute-name.class.haml",".article.date"],
+  ["text"," "],
+  ["constant.numeric","2006-11-05"]
+],[
+   "start",
+  ["entity.name.tag.haml","    %div"],
+  ["entity.other.attribute-name.class.haml",".article.entry"]
+],[
+   "start",
+  ["text","      Neil Patrick Harris "]
+],[
+   "start"
+],[
+   "start",
+  ["entity.name.tag.haml","%div"],
+  ["text","[@user, "],
+  ["constant.other.symbol.ruby",":greeting"],
+  ["text","]"]
+],[
+   "start",
+  ["entity.name.tag.haml","  %bar"],
+  ["text","["],
+  ["constant.numeric","290"],
+  ["text","]/"]
+],[
+   "start",
+  ["text","  "],
+  ["string.quoted.double","==Hello!=="]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_haskell.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_haskell.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_haskell.json
new file mode 100644
index 0000000..8f9a2b3
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_haskell.json
@@ -0,0 +1,156 @@
+[[
+   "start",
+  ["punctuation.definition.comment.haskell","-- Type annotation (optional)"]
+],[
+   "start",
+  ["entity.name.function.haskell","fib"],
+  ["meta.function.type-declaration.haskell"," "],
+  ["keyword.other.double-colon.haskell","::"],
+  ["meta.function.type-declaration.haskell"," "],
+  ["support.type.prelude.haskell","Int"],
+  ["meta.function.type-declaration.haskell"," "],
+  ["keyword.other.arrow.haskell","->"],
+  ["meta.function.type-declaration.haskell"," "],
+  ["support.type.prelude.haskell","Integer"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["punctuation.definition.comment.haskell","-- With self-referencing data"]
+],[
+   "start",
+  ["text","fib n "],
+  ["keyword.operator.haskell","="],
+  ["text"," fibs "],
+  ["keyword.operator.haskell","!!"],
+  ["text"," n"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword.other.haskell","where"],
+  ["text"," fibs "],
+  ["keyword.operator.haskell","="],
+  ["text"," "],
+  ["constant.numeric.haskell","0"],
+  ["text"," "],
+  ["keyword.operator.haskell",":"],
+  ["text"," "],
+  ["support.function.prelude.haskell","scanl"],
+  ["text"," "],
+  ["entity.name.function.infix.haskell","(+)"],
+  ["text"," "],
+  ["constant.numeric.haskell","1"],
+  ["text"," fibs"]
+],[
+   "start",
+  ["text","        "],
+  ["punctuation.definition.comment.haskell","-- 0,1,1,2,3,5,..."]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["punctuation.definition.comment.haskell","-- Same, coded directly"]
+],[
+   "start",
+  ["text","fib n "],
+  ["keyword.operator.haskell","="],
+  ["text"," fibs "],
+  ["keyword.operator.haskell","!!"],
+  ["text"," n"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword.other.haskell","where"],
+  ["text"," fibs "],
+  ["keyword.operator.haskell","="],
+  ["text"," "],
+  ["constant.numeric.haskell","0"],
+  ["text"," "],
+  ["keyword.operator.haskell",":"],
+  ["text"," "],
+  ["constant.numeric.haskell","1"],
+  ["text"," "],
+  ["keyword.operator.haskell",":"],
+  ["text"," next fibs"]
+],[
+   "start",
+  ["text","              next (a "],
+  ["keyword.operator.haskell",":"],
+  ["text"," t@(b"],
+  ["keyword.operator.haskell",":"],
+  ["text","_)) "],
+  ["keyword.operator.haskell","="],
+  ["text"," (a"],
+  ["keyword.operator.haskell","+"],
+  ["text","b) "],
+  ["keyword.operator.haskell",":"],
+  ["text"," next t"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["punctuation.definition.comment.haskell","-- Similar idea, using zipWith"]
+],[
+   "start",
+  ["text","fib n "],
+  ["keyword.operator.haskell","="],
+  ["text"," fibs "],
+  ["keyword.operator.haskell","!!"],
+  ["text"," n"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword.other.haskell","where"],
+  ["text"," fibs "],
+  ["keyword.operator.haskell","="],
+  ["text"," "],
+  ["constant.numeric.haskell","0"],
+  ["text"," "],
+  ["keyword.operator.haskell",":"],
+  ["text"," "],
+  ["constant.numeric.haskell","1"],
+  ["text"," "],
+  ["keyword.operator.haskell",":"],
+  ["text"," "],
+  ["support.function.prelude.haskell","zipWith"],
+  ["text"," "],
+  ["entity.name.function.infix.haskell","(+)"],
+  ["text"," fibs ("],
+  ["support.function.prelude.haskell","tail"],
+  ["text"," fibs)"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["punctuation.definition.comment.haskell","-- Using a generator function"]
+],[
+   "start",
+  ["text","fib n "],
+  ["keyword.operator.haskell","="],
+  ["text"," fibs ("],
+  ["constant.numeric.haskell","0"],
+  ["punctuation.separator.comma.haskell",","],
+  ["constant.numeric.haskell","1"],
+  ["text",") "],
+  ["keyword.operator.haskell","!!"],
+  ["text"," n"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword.other.haskell","where"],
+  ["text"," fibs (a"],
+  ["punctuation.separator.comma.haskell",","],
+  ["text","b) "],
+  ["keyword.operator.haskell","="],
+  ["text"," a "],
+  ["keyword.operator.haskell",":"],
+  ["text"," fibs (b"],
+  ["punctuation.separator.comma.haskell",","],
+  ["text","a"],
+  ["keyword.operator.haskell","+"],
+  ["text","b)"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_haxe.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_haxe.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_haxe.json
new file mode 100644
index 0000000..f0f79a4
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_haxe.json
@@ -0,0 +1,143 @@
+[[
+   "start",
+  ["keyword","class"],
+  ["text"," "],
+  ["identifier","Haxe"],
+  ["text"," "]
+],[
+   "start",
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","public"],
+  ["text"," "],
+  ["keyword","static"],
+  ["text"," "],
+  ["keyword","function"],
+  ["text"," "],
+  ["identifier","main"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "]
+],[
+   "start",
+  ["text","    "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","        "],
+  ["comment","// Say Hello!"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","var"],
+  ["text"," "],
+  ["identifier","greeting"],
+  ["punctuation.operator",":"],
+  ["keyword","String"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["string","\"Hello World\""],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","trace"],
+  ["paren.lparen","("],
+  ["identifier","greeting"],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","        "]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","var"],
+  ["text"," "],
+  ["identifier","targets"],
+  ["punctuation.operator",":"],
+  ["keyword","Array"],
+  ["keyword.operator","<"],
+  ["keyword","String"],
+  ["keyword.operator",">"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["string","\"Flash\""],
+  ["punctuation.operator",","],
+  ["string","\"Javascript\""],
+  ["punctuation.operator",","],
+  ["string","\"PHP\""],
+  ["punctuation.operator",","],
+  ["string","\"Neko\""],
+  ["punctuation.operator",","],
+  ["string","\"C++\""],
+  ["punctuation.operator",","],
+  ["string","\"iOS\""],
+  ["punctuation.operator",","],
+  ["string","\"Android\""],
+  ["punctuation.operator",","],
+  ["string","\"webOS\""],
+  ["paren.rparen","]"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","trace"],
+  ["paren.lparen","("],
+  ["string","\"Haxe is a great language that can target:\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","for"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["identifier","target"],
+  ["text"," "],
+  ["keyword","in"],
+  ["text"," "],
+  ["identifier","targets"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","        "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","            "],
+  ["keyword","trace"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["string","\" - \""],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["identifier","target"],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","        "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","trace"],
+  ["paren.lparen","("],
+  ["string","\"And many more!\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["paren.rparen","}"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_html.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_html.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_html.json
new file mode 100644
index 0000000..794ba26
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_html.json
@@ -0,0 +1,51 @@
+[[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","html"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.script","script"],
+  ["text"," "],
+  ["entity.other.attribute-name","a"],
+  ["keyword.operator.separator","="],
+  ["string","'a'"],
+  ["meta.tag.punctuation.end",">"],
+  ["storage.type","var"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.script","script"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","'123'"]
+],[
+   ["qqstring_inner","start_tag_stuff"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.anchor","a"],
+  ["text"," "],
+  ["entity.other.attribute-name","href"],
+  ["keyword.operator.separator","="],
+  ["string","\"abc"]
+],[
+   "start",
+  ["string","  def\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   ["qstring_inner","start_tag_stuff"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.anchor","a"],
+  ["text"," "],
+  ["entity.other.attribute-name","href"],
+  ["keyword.operator.separator","="],
+  ["string","'abc"]
+],[
+   "start",
+  ["string","def\\'"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","html"],
+  ["meta.tag.punctuation.end",">"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_html_ruby.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_html_ruby.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_html_ruby.json
new file mode 100644
index 0000000..619fb5d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_html_ruby.json
@@ -0,0 +1,247 @@
+[[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","h1"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","Listing Books"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","h1"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","table"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","  "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","tr"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","th"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","Title"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","th"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","th"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","Summary"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","th"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","th"],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","th"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","th"],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","th"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","th"],
+  ["meta.tag.punctuation.end",">"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","th"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","  "],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","tr"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["support.ruby_tag","<%"],
+  ["text"," "],
+  ["variable.instance","@books"],
+  ["text","."],
+  ["identifier","each"],
+  ["text"," "],
+  ["keyword","do"],
+  ["text"," |"],
+  ["identifier","book"],
+  ["text","| "],
+  ["support.ruby_tag","%>"]
+],[
+   "start",
+  ["text","  "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","tr"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["comment.start.erb","<%#"],
+  ["comment"," comment "],
+  ["comment.end.erb","%>"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","td"],
+  ["meta.tag.punctuation.end",">"],
+  ["support.ruby_tag","<%="],
+  ["text"," "],
+  ["identifier","book"],
+  ["text","."],
+  ["identifier","title"],
+  ["text"," "],
+  ["support.ruby_tag","%>"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","td"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","td"],
+  ["meta.tag.punctuation.end",">"],
+  ["support.ruby_tag","<%="],
+  ["text"," "],
+  ["identifier","book"],
+  ["text","."],
+  ["identifier","content"],
+  ["text"," "],
+  ["support.ruby_tag","%>"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","td"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","td"],
+  ["meta.tag.punctuation.end",">"],
+  ["support.ruby_tag","<%="],
+  ["text"," "],
+  ["support.function","link_to"],
+  ["text"," "],
+  ["string","'Show'"],
+  ["text",", "],
+  ["identifier","book"],
+  ["text"," "],
+  ["support.ruby_tag","%>"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","td"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","td"],
+  ["meta.tag.punctuation.end",">"],
+  ["support.ruby_tag","<%="],
+  ["text"," "],
+  ["support.function","link_to"],
+  ["text"," "],
+  ["string","'Edit'"],
+  ["text",", "],
+  ["identifier","edit_book_path"],
+  ["paren.lparen","("],
+  ["identifier","book"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["support.ruby_tag","%>"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","td"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.table","td"],
+  ["meta.tag.punctuation.end",">"],
+  ["support.ruby_tag","<%="],
+  ["text"," "],
+  ["support.function","link_to"],
+  ["text"," "],
+  ["string","'Remove'"],
+  ["text",", "],
+  ["identifier","book"],
+  ["text",", "],
+  ["constant.other.symbol.ruby",":confirm"],
+  ["text"," "],
+  ["punctuation.separator.key-value","=>"],
+  ["text"," "],
+  ["string","'Are you sure?'"],
+  ["text",", "],
+  ["constant.other.symbol.ruby",":method"],
+  ["text"," "],
+  ["punctuation.separator.key-value","=>"],
+  ["text"," "],
+  ["constant.other.symbol.ruby",":delete"],
+  ["text"," "],
+  ["support.ruby_tag","%>"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","td"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","  "],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","tr"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["support.ruby_tag","<%"],
+  ["text"," "],
+  ["keyword","end"],
+  ["text"," "],
+  ["support.ruby_tag","%>"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.table","table"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","br"],
+  ["text"," "],
+  ["meta.tag.punctuation.end","/>"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["support.ruby_tag","<%="],
+  ["text"," "],
+  ["support.function","link_to"],
+  ["text"," "],
+  ["string","'New book'"],
+  ["text",", "],
+  ["identifier","new_book_path"],
+  ["text"," "],
+  ["support.ruby_tag","%>"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_jade.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_jade.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_jade.json
new file mode 100644
index 0000000..5bf4596
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_jade.json
@@ -0,0 +1,188 @@
+[[
+   "start",
+  ["keyword.other.doctype.jade","!!!doctype"]
+],[
+   "start",
+  ["keyword.other.doctype.jade","!!!5"]
+],[
+   "start",
+  ["keyword.other.doctype.jade","!!!"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword.control.import.include.jade","include"],
+  ["text"," something"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword.control.import.include.jade","         include"],
+  ["text"," another_thing"]
+],[
+   "start"
+],[
+   "start",
+  ["punctuation.section.comment","  // let's talk about it"]
+],[
+   "start"
+],[
+   ["comment_block",0,"start"],
+  ["comment","// "]
+],[
+   ["comment_block",0,"start"],
+  ["comment","  here it is. a block comment!"]
+],[
+   ["comment_block",0,"start"],
+  ["comment"," and another row!"]
+],[
+   "start",
+  ["meta.tag.any.jade","but"],
+  ["text"," not here."]
+],[
+   "start"
+],[
+   ["comment_block",5,"start"],
+  ["comment","     // "]
+],[
+   ["comment_block",5,"start"],
+  ["comment","        a far spaced"]
+],[
+   "start",
+  ["text","    should be lack of block"]
+],[
+   "start"
+],[
+   "start",
+  ["punctuation.section.comment","   // also not a comment"]
+],[
+   "start",
+  ["meta.tag.any.jade","     div"],
+  ["entity.other.attribute-name.class.jade",".attemptAtBlock"]
+],[
+   "start",
+  ["text","  "]
+],[
+   "start",
+  ["meta.tag.any.jade","  span"],
+  ["entity.other.attribute-name.id.jade","#myName"]
+],[
+   "start"
+],[
+   "start",
+  ["text","  "],
+  ["string.interpolated.jade","#{implicit}"]
+],[
+   "start",
+  ["text","     "],
+  ["string.interpolated.jade","!{more_explicit}"]
+],[
+   "start"
+],[
+   "start",
+  ["text","  "],
+  ["suport.type.attribute.id.jade","#idDiv"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    "],
+  ["suport.type.attribute.class.jade",".idDiv"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.any.jade","    test"],
+  ["punctuation","("],
+  ["entity.other.attribute-name.jade","id"],
+  ["text","="],
+  ["string","\"tag\""],
+  ["punctuation",")"]
+],[
+   "start",
+  ["meta.tag.any.jade","    header"],
+  ["punctuation","("],
+  ["entity.other.attribute-name.jade","id"],
+  ["text","="],
+  ["string","\"tag\""],
+  ["text",", "],
+  ["entity.other.attribute-name.jade","blah"],
+  ["text","="],
+  ["string","\"foo\""],
+  ["text",", "],
+  ["entity.other.attribute-name.jade","meh"],
+  ["text","="],
+  ["string","\"aads\""],
+  ["punctuation",")"]
+],[
+   "start",
+  ["storage.type.function.jade","mixin"],
+  ["entity.name.function.jade"," article"],
+  ["punctuation.definition.parameters.begin.jade","("],
+  ["variable.parameter.function.jade","obj, parents"],
+  ["punctuation.definition.parameters.end.jade",")"]
+],[
+   "start"
+],[
+   "start",
+  ["storage.type.function.jade","  mixin"],
+  ["entity.name.function.jade"," bleh"],
+  ["punctuation.definition.parameters.begin.jade","("],
+  ["punctuation.definition.parameters.end.jade",")"]
+],[
+   "start"
+],[
+   "start",
+  ["storage.type.function.jade","    mixin"],
+  ["entity.name.function.jade"," clever-name"]
+],[
+   "start"
+],[
+   "start",
+  ["source.js.embedded.jade"," -"],
+  ["storage.type","var"],
+  ["text"," "],
+  ["identifier","x"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["string","\"0\""],
+  ["text",";"]
+],[
+   "start",
+  ["source.js.embedded.jade"," -"],
+  ["text"," "],
+  ["identifier","y"],
+  ["text"," "],
+  ["identifier","each"],
+  ["text"," z"]
+],[
+   "start"
+],[
+   "start",
+  ["source.js.embedded.jade"," -"],
+  ["text"," "],
+  ["storage.type","var"],
+  ["text"," "],
+  ["identifier","items"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["string","\"one\""],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["string","\"two\""],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["string","\"three\""],
+  ["text","]"]
+],[
+   "start",
+  ["meta.tag.any.jade","   each"],
+  ["text"," item in items"]
+],[
+   "start",
+  ["meta.tag.any.jade","    li"],
+  ["text","= item"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_java.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_java.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_java.json
new file mode 100644
index 0000000..799ebdb
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_java.json
@@ -0,0 +1,95 @@
+[[
+   "start",
+  ["keyword","public"],
+  ["text"," "],
+  ["keyword","class"],
+  ["text"," "],
+  ["identifier","InfiniteLoop"],
+  ["text"," "],
+  ["lparen","{"]
+],[
+   "start"
+],[
+   "comment",
+  ["text","    "],
+  ["comment","/*"]
+],[
+   "comment",
+  ["comment","     * This will cause the program to hang..."]
+],[
+   "comment",
+  ["comment","     *"]
+],[
+   "comment",
+  ["comment","     * Taken from:"]
+],[
+   "comment",
+  ["comment","     * http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/"]
+],[
+   "start",
+  ["comment","     */"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","public"],
+  ["text"," "],
+  ["keyword","static"],
+  ["text"," "],
+  ["keyword","void"],
+  ["text"," "],
+  ["identifier","main"],
+  ["lparen","("],
+  ["support.function","String"],
+  ["lparen","["],
+  ["rparen","]"],
+  ["text"," "],
+  ["identifier","args"],
+  ["rparen",")"],
+  ["text"," "],
+  ["lparen","{"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","double"],
+  ["text"," "],
+  ["identifier","d"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["support.function","Double"],
+  ["text","."],
+  ["identifier","parseDouble"],
+  ["lparen","("],
+  ["string","\"2.2250738585072012e-308\""],
+  ["rparen",")"],
+  ["text",";"]
+],[
+   "start"
+],[
+   "start",
+  ["text","        "],
+  ["comment","// unreachable code"]
+],[
+   "start",
+  ["text","        "],
+  ["support.function","System"],
+  ["text","."],
+  ["identifier","out"],
+  ["text","."],
+  ["identifier","println"],
+  ["lparen","("],
+  ["string","\"Value: \""],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["identifier","d"],
+  ["rparen",")"],
+  ["text",";"]
+],[
+   "start",
+  ["text","    "],
+  ["rparen","}"]
+],[
+   "start",
+  ["rparen","}"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_javascript.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_javascript.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_javascript.json
new file mode 100644
index 0000000..5044f21
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_javascript.json
@@ -0,0 +1,592 @@
+[[
+   "start",
+  ["comment","//test: tokenize 'standard' functions"]
+],[
+   "no_regex",
+  ["identifier","string"],
+  ["punctuation.operator","."],
+  ["support.function","charCodeAt"],
+  ["paren.lparen","("],
+  ["constant.numeric","23"],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"],
+  ["text"," "],
+  ["variable.language","document"],
+  ["punctuation.operator","."],
+  ["support.function.dom","getElementById"],
+  ["paren.lparen","("],
+  ["string","'test'"],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"],
+  ["text"," "],
+  ["storage.type","console"],
+  ["punctuation.operator","."],
+  ["support.function.firebug","log"],
+  ["paren.lparen","("],
+  ["string","'Here it is'"],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"],
+  ["string","\";"]
+],[
+   "no_regex",
+  ["identifier","test"],
+  ["punctuation.operator",":"],
+  ["text"," "],
+  ["comment.doc","/**tokenize doc*/"],
+  ["text"," "],
+  ["identifier","comment"]
+],[
+   "no_regex",
+  ["comment.doc","/**tokenize doc comment with "],
+  ["comment.doc.tag","@tag"],
+  ["comment.doc"," {}*/"]
+],[
+   "no_regex",
+  ["comment","//test: tokenize parens"]
+],[
+   "start",
+  ["text","    "],
+  ["storage.type","var"],
+  ["text"," "],
+  ["identifier","line"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["string","\"[{( )}]\""],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["comment","//test tokenize arithmetic expression which looks like a regexp"]
+],[
+   "no_regex",
+  ["identifier","a"],
+  ["keyword.operator","/"],
+  ["identifier","b"],
+  ["keyword.operator","/"],
+  ["identifier","c"]
+],[
+   "no_regex",
+  ["identifier","a"],
+  ["keyword.operator","/="],
+  ["identifier","b"],
+  ["keyword.operator","/"],
+  ["identifier","c"]
+],[
+   "no_regex",
+  ["comment","//test tokenize reg exps"]
+],[
+   "no_regex",
+  ["identifier","a"],
+  ["keyword.operator","="],
+  ["string.regexp","/b/g"]
+],[
+   "no_regex",
+  ["identifier","a"],
+  ["keyword.operator","+"],
+  ["string.regexp","/b/g"]
+],[
+   "no_regex",
+  ["identifier","a"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["string.regexp","/2 "],
+  ["constant.language.escape","+"],
+  ["string.regexp"," 1/b"]
+],[
+   "no_regex",
+  ["identifier","a"],
+  ["keyword.operator","="],
+  ["string.regexp","/a/"],
+  ["text"," "],
+  ["keyword.operator","/"],
+  ["text"," "],
+  ["string.regexp","/a/"]
+],[
+   "no_regex",
+  ["keyword","case"],
+  ["text"," "],
+  ["string.regexp","/a/"],
+  ["punctuation.operator","."],
+  ["support.function","test"],
+  ["paren.lparen","("],
+  ["identifier","c"],
+  ["paren.rparen",")"]
+],[
+   "no_regex",
+  ["comment","//test tokenize multi-line comment containing a single line comment"]
+],[
+   "no_regex",
+  ["identifier","noRegex"]
+],[
+   "no_regex",
+  ["comment","/* foo // bar */"]
+],[
+   "start",
+  ["identifier","canBeRegex"],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["comment","/* foo // bar */"]
+],[
+   "start",
+  ["comment","// test tokenize identifier with umlauts"]
+],[
+   "no_regex",
+  ["identifier","fu"],
+  ["punctuation.operator","?"],
+  ["identifier","e"]
+],[
+   "no_regex",
+  ["comment","// test // is not a regexp"]
+],[
+   "start",
+  ["paren.lparen","{"],
+  ["text"," "],
+  ["comment","// 123"]
+],[
+   "start",
+  ["comment","//test skipping escaped chars"]
+],[
+   "no_regex",
+  ["string","'Meh"],
+  ["constant.language.escape","\\\\"],
+  ["string","nNeh'"]
+],[
+   "no_regex",
+  ["storage.type","console"],
+  ["punctuation.operator","."],
+  ["support.function.firebug","log"],
+  ["paren.lparen","("],
+  ["string","'"],
+  ["constant.language.escape","\\\\"],
+  ["string","u1232Feh'"]
+],[
+   "qqstring",
+  ["string","\"test multiline\\"]
+],[
+   "no_regex",
+  ["string"," strings\""]
+],[
+   "no_regex",
+  ["identifier","a"],
+  ["keyword.operator","="],
+  ["text","'"]
+],[
+   "qqstring",
+  ["identifier","b"],
+  ["keyword.operator","="],
+  ["string","\"\\"]
+],[
+   "no_regex",
+  ["string","still a string"]
+],[
+   "no_regex",
+  ["text"," "]
+],[
+   "no_regex",
+  ["text"," "]
+],[
+   "start",
+  ["storage.type","function"],
+  ["text"," "],
+  ["entity.name.function","foo"],
+  ["paren.lparen","("],
+  ["variable.parameter","items"],
+  ["punctuation.operator",", "],
+  ["variable.parameter","nada"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","for"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["storage.type","var"],
+  ["text"," "],
+  ["identifier","i"],
+  ["keyword.operator","="],
+  ["constant.numeric","0"],
+  ["punctuation.operator",";"],
+  ["text"," "],
+  ["identifier","i"],
+  ["keyword.operator","<"],
+  ["identifier","items"],
+  ["punctuation.operator","."],
+  ["support.constant","length"],
+  ["punctuation.operator",";"],
+  ["text"," "],
+  ["identifier","i"],
+  ["keyword.operator","++"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","        "],
+  ["support.function","alert"],
+  ["paren.lparen","("],
+  ["identifier","items"],
+  ["paren.lparen","["],
+  ["identifier","i"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["string","\"juhu"],
+  ["constant.language.escape","\\n"],
+  ["string","\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "no_regex",
+  ["text","    "],
+  ["paren.rparen","}"],
+  ["text","\t"],
+  ["comment","// Real Tab."]
+],[
+   "no_regex",
+  ["paren.rparen","}"]
+],[
+   "no_regex"
+],[
+   "no_regex",
+  ["identifier","regexp"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["string.regexp","/p"],
+  ["constant.language.delimiter","|"],
+  ["string.regexp","p/"],
+  ["text"," "],
+  ["comment","// ends here"]
+],[
+   "no_regex"
+],[
+   "no_regex",
+  ["identifier","r"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["string.regexp","/d"],
+  ["constant.language.escape","{1,2}?"],
+  ["string.regexp","f{e}"],
+  ["invalid","++"],
+  ["string.regexp","r"],
+  ["constant.language.escape","*?"],
+  ["regexp.keyword.operator","\\d"],
+  ["constant.language.escape","+?[]"],
+  ["string.regexp","r"],
+  ["constant.language.escape","[^"],
+  ["string.regexp.charachterclass","r"],
+  ["constant.language.escape","-"],
+  ["string.regexp.charachterclass","o"],
+  ["regexp.keyword.operator","\\f\\f"],
+  ["string.regexp.charachterclass","["],
+  ["regexp.keyword.operator","\\f"],
+  ["constant.language.escape","]?"],
+  ["string.regexp","r"],
+  ["invalid","{7}+"],
+  ["string.regexp","r"],
+  ["regexp.keyword.operator","\\{"],
+  ["string.regexp","7}"],
+  ["constant.language.escape","+"],
+  ["string.regexp","rr--rr"],
+  ["constant.language.escape","$^(?:"],
+  ["string.regexp","d"],
+  ["constant.language.delimiter","|"],
+  ["string.regexp","s"],
+  ["constant.language.escape",")(?="],
+  ["string.regexp","a"],
+  ["constant.language.delimiter","|"],
+  ["constant.language.escape",")(?!"],
+  ["string.regexp","y"],
+  ["constant.language.escape",")[]"],
+  ["constant.language.delimiter","|"],
+  ["invalid","$?"],
+  ["constant.language.delimiter","|"],
+  ["invalid","^*"],
+  ["string.regexp","/"],
+  ["text"," "],
+  ["identifier","o"]
+],[
+   "no_regex",
+  ["identifier","a"],
+  ["keyword.operator","="],
+  ["string.regexp","/a/"],
+  ["text"," "],
+  ["identifier","jk"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["string.regexp","/ /"],
+  ["text"," "],
+  ["keyword.operator","/"],
+  ["text"," "],
+  ["string.regexp","/ /"]
+],[
+   "no_regex",
+  ["text"," "],
+  ["comment.doc","/************************************/"]
+],[
+   "no_regex",
+  ["comment.doc","/** total mess, tricky to highlight**/"]
+],[
+   "no_regex"
+],[
+   "start",
+  ["storage.type","function"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "doc-start",
+  ["text","\t"],
+  ["comment.doc","/**"]
+],[
+   "doc-start",
+  ["comment.doc","\t * docComment"]
+],[
+   "no_regex",
+  ["comment.doc","\t **/"]
+],[
+   "no_regex",
+  ["text","\t"],
+  ["identifier","r"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["string.regexp","/u"],
+  ["regexp.keyword.operator","\\t"],
+  ["constant.language.escape","*"],
+  ["string.regexp","/"]
+],[
+   "no_regex",
+  ["text","\t"],
+  ["identifier","g"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","1."],
+  ["text","00"],
+  ["identifier","E"],
+  ["text","^"],
+  ["constant.numeric","1"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["identifier","y"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","1.2"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["punctuation.operator","."],
+  ["constant.numeric","2"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["constant.numeric","052"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["constant.numeric","0x25"]
+],[
+   "no_regex",
+  ["text","\t"],
+  ["identifier","t"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["string","'d'"],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["string","''"],
+  ["paren.rparen","]"]
+],[
+   "no_regex",
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["storage.type","function"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","\t"],
+  ["comment","/* eee */"]
+],[
+   "no_regex",
+  ["paren.rparen","}"]
+],[
+   "no_regex"
+],[
+   "qqstring",
+  ["string","\"s\\"]
+],[
+   "no_regex",
+  ["string","s"],
+  ["constant.language.escape","\\u7824"],
+  ["string","sss"],
+  ["constant.language.escape","\\u"],
+  ["string","1\""]
+],[
+   "no_regex"
+],[
+   "qstring",
+  ["string","'\\"]
+],[
+   "no_regex",
+  ["string","string'"]
+],[
+   "no_regex"
+],[
+   "no_regex",
+  ["text","'"]
+],[
+   "no_regex",
+  ["identifier","string"],
+  ["text","'"]
+],[
+   "no_regex"
+],[
+   "no_regex",
+  ["string","\"trailing space"],
+  ["constant.language.escape","\\ "],
+  ["string","  "]
+],[
+   "no_regex",
+  ["string","\"         \""],
+  ["text","    "],
+  ["keyword.operator","/"],
+  ["identifier","not"],
+  ["text"," "],
+  ["identifier","a"],
+  ["text"," "],
+  ["identifier","regexp"],
+  ["keyword.operator","/"],
+  ["identifier","g"]
+],[
+   "no_regex"
+],[
+   "doc-start",
+  ["comment.doc","/**"]
+],[
+   "doc-start",
+  ["comment.doc"," *doc"]
+],[
+   "no_regex",
+  ["comment.doc"," */"]
+],[
+   "no_regex"
+],[
+   "start",
+  ["identifier","a"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","\t"],
+  ["string","'a'"],
+  ["punctuation.operator",":"],
+  ["text"," "],
+  ["identifier","b"],
+  ["punctuation.operator",","]
+],[
+   "no_regex",
+  ["text","\t"],
+  ["string","'g'"],
+  ["text",":"],
+  ["text"," "],
+  ["storage.type","function"],
+  ["paren.lparen","("],
+  ["variable.parameter","t"],
+  ["paren.rparen",")"]
+],[
+   "no_regex",
+  ["text","\t"],
+  ["entity.name.function","gta"],
+  ["punctuation.operator",":"],
+  ["storage.type","function"],
+  ["paren.lparen","("],
+  ["variable.parameter","a"],
+  ["punctuation.operator",","],
+  ["variable.parameter","b"],
+  ["paren.rparen",")"]
+],[
+   "no_regex",
+  ["paren.rparen","}"]
+],[
+   "no_regex"
+],[
+   "no_regex"
+],[
+   "function_arguments",
+  ["identifier","foo"],
+  ["punctuation.operator","."],
+  ["storage.type","protoype"],
+  ["punctuation.operator","."],
+  ["entity.name.function","d"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["storage.type","function"],
+  ["paren.lparen","("],
+  ["variable.parameter","a"],
+  ["punctuation.operator",", "],
+  ["variable.parameter","b"],
+  ["punctuation.operator",","]
+],[
+   "no_regex",
+  ["punctuation.operator","                          "],
+  ["variable.parameter","c"],
+  ["punctuation.operator",", "],
+  ["variable.parameter","d"],
+  ["paren.rparen",")"]
+],[
+   "no_regex",
+  ["storage.type","foo"],
+  ["punctuation.operator","."],
+  ["entity.name.function","d"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["storage.type","function"],
+  ["paren.lparen","("],
+  ["variable.parameter","a"],
+  ["punctuation.operator",",     "],
+  ["variable.parameter","b"],
+  ["paren.rparen",")"]
+],[
+   "no_regex",
+  ["storage.type","foo"],
+  ["punctuation.operator","."],
+  ["entity.name.function","d"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["storage.type","function"],
+  ["paren.lparen","("],
+  ["variable.parameter","a"],
+  ["punctuation.operator",",  "],
+  ["comment.doc","/*****/"],
+  ["text"," "],
+  ["identifier","d"],
+  ["string","\"string\""],
+  ["text","   "]
+],[
+   "no_regex"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_json.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_json.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_json.json
new file mode 100644
index 0000000..4420a74
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_json.json
@@ -0,0 +1,412 @@
+[[
+   "start",
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text"," "],
+  ["variable","\"query\""],
+  ["text",": "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","  "],
+  ["variable","\"count\""],
+  ["text",": "],
+  ["constant.numeric","10"],
+  ["text",","]
+],[
+   "start",
+  ["text","  "],
+  ["variable","\"created\""],
+  ["text",": "],
+  ["string","\"2011-06-21T08:10:46Z\""],
+  ["text",","]
+],[
+   "start",
+  ["text","  "],
+  ["variable","\"lang\""],
+  ["text",": "],
+  ["string","\"en-US\""],
+  ["text",","]
+],[
+   "start",
+  ["text","  "],
+  ["variable","\"results\""],
+  ["text",": "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","   "],
+  ["variable","\"photo\""],
+  ["text",": "],
+  ["paren.lparen","["]
+],[
+   "start",
+  ["text","    "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"farm\""],
+  ["text",": "],
+  ["string","\"6\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"id\""],
+  ["text",": "],
+  ["string","\"5855620975\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"isfamily\""],
+  ["text",": "],
+  ["string","\"0\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"isfriend\""],
+  ["text",": "],
+  ["string","\"0\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"ispublic\""],
+  ["text",": "],
+  ["string","\"1\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"owner\""],
+  ["text",": "],
+  ["string","\"32021554@N04\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"secret\""],
+  ["text",": "],
+  ["string","\"f1f5e8515d\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"server\""],
+  ["text",": "],
+  ["string","\"5110\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"title\""],
+  ["text",": "],
+  ["string","\"7087 bandit cat\""]
+],[
+   "start",
+  ["text","    "],
+  ["paren.rparen","}"],
+  ["text",","]
+],[
+   "start",
+  ["text","    "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"farm\""],
+  ["text",": "],
+  ["string","\"4\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"id\""],
+  ["text",": "],
+  ["string","\"5856170534\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"isfamily\""],
+  ["text",": "],
+  ["string","\"0\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"isfriend\""],
+  ["text",": "],
+  ["string","\"0\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"ispublic\""],
+  ["text",": "],
+  ["string","\"1\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"owner\""],
+  ["text",": "],
+  ["string","\"32021554@N04\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"secret\""],
+  ["text",": "],
+  ["string","\"ff1efb2a6f\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"server\""],
+  ["text",": "],
+  ["string","\"3217\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"title\""],
+  ["text",": "],
+  ["string","\"6975 rusty cat\""]
+],[
+   "start",
+  ["text","    "],
+  ["paren.rparen","}"],
+  ["text",","]
+],[
+   "start",
+  ["text","    "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"farm\""],
+  ["text",": "],
+  ["string","\"6\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"id\""],
+  ["text",": "],
+  ["string","\"5856172972\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"isfamily\""],
+  ["text",": "],
+  ["string","\"0\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"isfriend\""],
+  ["text",": "],
+  ["string","\"0\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"ispublic\""],
+  ["text",": "],
+  ["string","\"1\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"owner\""],
+  ["text",": "],
+  ["string","\"51249875@N03\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"secret\""],
+  ["text",": "],
+  ["string","\"6c6887347c\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"server\""],
+  ["text",": "],
+  ["string","\"5192\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"title\""],
+  ["text",": "],
+  ["string","\"watermarked-cats\""]
+],[
+   "start",
+  ["text","    "],
+  ["paren.rparen","}"],
+  ["text",","]
+],[
+   "start",
+  ["text","    "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"farm\""],
+  ["text",": "],
+  ["string","\"6\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"id\""],
+  ["text",": "],
+  ["string","\"5856168328\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"isfamily\""],
+  ["text",": "],
+  ["string","\"0\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"isfriend\""],
+  ["text",": "],
+  ["string","\"0\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"ispublic\""],
+  ["text",": "],
+  ["string","\"1\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"owner\""],
+  ["text",": "],
+  ["string","\"32021554@N04\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"secret\""],
+  ["text",": "],
+  ["string","\"0c1cfdf64c\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"server\""],
+  ["text",": "],
+  ["string","\"5078\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"title\""],
+  ["text",": "],
+  ["string","\"7020 mandy cat\""]
+],[
+   "start",
+  ["text","    "],
+  ["paren.rparen","}"],
+  ["text",","]
+],[
+   "start",
+  ["text","    "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"farm\""],
+  ["text",": "],
+  ["string","\"3\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"id\""],
+  ["text",": "],
+  ["string","\"5856171774\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"isfamily\""],
+  ["text",": "],
+  ["string","\"0\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"isfriend\""],
+  ["text",": "],
+  ["string","\"0\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"ispublic\""],
+  ["text",": "],
+  ["string","\"1\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"owner\""],
+  ["text",": "],
+  ["string","\"32021554@N04\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"secret\""],
+  ["text",": "],
+  ["string","\"7f5a3180ab\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"server\""],
+  ["text",": "],
+  ["string","\"2696\""],
+  ["text",","]
+],[
+   "start",
+  ["text","     "],
+  ["variable","\"title\""],
+  ["text",": "],
+  ["string","\"7448 bobby cat\""]
+],[
+   "start",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","   "],
+  ["paren.rparen","]"]
+],[
+   "start",
+  ["text","  "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text"," "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["paren.rparen","}"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_jsp.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_jsp.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_jsp.json
new file mode 100644
index 0000000..cd556e4
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_jsp.json
@@ -0,0 +1,435 @@
+[[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","html"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","body"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "js-start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.script","script"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "js-start",
+  ["text","        "],
+  ["storage.type","var"],
+  ["text"," "],
+  ["identifier","x"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["string","\"abc\""],
+  ["punctuation.operator",";"]
+],[
+   "js-start",
+  ["text","        "],
+  ["storage.type","function"],
+  ["text"," "],
+  ["identifier","y"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "js-no_regex",
+  ["text","        "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.script","script"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "css-start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.style","style"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   ["css-ruleset","css-start"],
+  ["text","        "],
+  ["variable",".class"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   ["css-ruleset","css-start"],
+  ["text","            "],
+  ["support.type","background"],
+  ["text",": "],
+  ["constant.numeric","#124356"],
+  ["text",";"]
+],[
+   "css-start",
+  ["text","        "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.style","style"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        Today's date: "],
+  ["meta.tag","<%"],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["lparen","("],
+  ["keyword","new"],
+  ["text"," "],
+  ["identifier","java"],
+  ["text","."],
+  ["identifier","util"],
+  ["text","."],
+  ["identifier","Date"],
+  ["lparen","("],
+  ["rparen","))"],
+  ["text","."],
+  ["identifier","toLocaleString"],
+  ["lparen","("],
+  ["rparen",")"],
+  ["meta.tag","%>"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag","<%"],
+  ["keyword.operator","!"],
+  ["text"," "],
+  ["keyword","int"],
+  ["text"," "],
+  ["identifier","i"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["text","; "],
+  ["meta.tag","%>"]
+],[
+   "jsp-start",
+  ["text","    "],
+  ["meta.tag","<jsp:declaration>"]
+],[
+   "jsp-start",
+  ["text","       "],
+  ["keyword","int"],
+  ["text"," "],
+  ["identifier","j"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","10"],
+  ["text",";"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag","</jsp:declaration>"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    "],
+  ["comment","<%-- This is JSP comment --%>"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag","<%@"],
+  ["text"," "],
+  ["identifier","directive"],
+  ["text"," "],
+  ["identifier","attribute"],
+  ["keyword.operator","="],
+  ["string","\"value\""],
+  ["text"," "],
+  ["meta.tag","%>"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","h2"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","Select Languages:"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","h2"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.form","form"],
+  ["text"," "],
+  ["entity.other.attribute-name","ACTION"],
+  ["keyword.operator.separator","="],
+  ["string","\"jspCheckBox.jsp\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.form","input"],
+  ["text"," "],
+  ["entity.other.attribute-name","type"],
+  ["keyword.operator.separator","="],
+  ["string","\"checkbox\""],
+  ["text"," "],
+  ["entity.other.attribute-name","name"],
+  ["keyword.operator.separator","="],
+  ["string","\"id\""],
+  ["text"," "],
+  ["entity.other.attribute-name","value"],
+  ["keyword.operator.separator","="],
+  ["string","\"Java\""],
+  ["meta.tag.punctuation.end",">"],
+  ["text"," Java"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","BR"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.form","input"],
+  ["text"," "],
+  ["entity.other.attribute-name","type"],
+  ["keyword.operator.separator","="],
+  ["string","\"checkbox\""],
+  ["text"," "],
+  ["entity.other.attribute-name","name"],
+  ["keyword.operator.separator","="],
+  ["string","\"id\""],
+  ["text"," "],
+  ["entity.other.attribute-name","value"],
+  ["keyword.operator.separator","="],
+  ["string","\".NET\""],
+  ["meta.tag.punctuation.end",">"],
+  ["text"," .NET"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","BR"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.form","input"],
+  ["text"," "],
+  ["entity.other.attribute-name","type"],
+  ["keyword.operator.separator","="],
+  ["string","\"checkbox\""],
+  ["text"," "],
+  ["entity.other.attribute-name","name"],
+  ["keyword.operator.separator","="],
+  ["string","\"id\""],
+  ["text"," "],
+  ["entity.other.attribute-name","value"],
+  ["keyword.operator.separator","="],
+  ["string","\"PHP\""],
+  ["meta.tag.punctuation.end",">"],
+  ["text"," PHP"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","BR"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.form","input"],
+  ["text"," "],
+  ["entity.other.attribute-name","type"],
+  ["keyword.operator.separator","="],
+  ["string","\"checkbox\""],
+  ["text"," "],
+  ["entity.other.attribute-name","name"],
+  ["keyword.operator.separator","="],
+  ["string","\"id\""],
+  ["text"," "],
+  ["entity.other.attribute-name","value"],
+  ["keyword.operator.separator","="],
+  ["string","\"C/C++\""],
+  ["meta.tag.punctuation.end",">"],
+  ["text"," C/C++"],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","BR"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.form","input"],
+  ["text"," "],
+  ["entity.other.attribute-name","type"],
+  ["keyword.operator.separator","="],
+  ["string","\"checkbox\""],
+  ["text"," "],
+  ["entity.other.attribute-name","name"],
+  ["keyword.operator.separator","="],
+  ["string","\"id\""],
+  ["text"," "],
+  ["entity.other.attribute-name","value"],
+  ["keyword.operator.separator","="],
+  ["string","\"PERL\""],
+  ["meta.tag.punctuation.end",">"],
+  ["text"," PERL "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","BR"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.form","input"],
+  ["text"," "],
+  ["entity.other.attribute-name","type"],
+  ["keyword.operator.separator","="],
+  ["string","\"submit\""],
+  ["text"," "],
+  ["entity.other.attribute-name","value"],
+  ["keyword.operator.separator","="],
+  ["string","\"Submit\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.form","form"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "jsp-start",
+  ["text","    "],
+  ["meta.tag","<%"]
+],[
+   "jsp-start",
+  ["text","    "],
+  ["support.function","String"],
+  ["text"," "],
+  ["identifier","select"],
+  ["lparen","["],
+  ["rparen","]"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["variable.language","request"],
+  ["text","."],
+  ["identifier","getParameterValues"],
+  ["lparen","("],
+  ["string","\"id\""],
+  ["rparen",")"],
+  ["text","; "]
+],[
+   "jsp-start",
+  ["text","    "],
+  ["keyword","if"],
+  ["text"," "],
+  ["lparen","("],
+  ["identifier","select"],
+  ["text"," "],
+  ["keyword.operator","!="],
+  ["text"," "],
+  ["constant.language","null"],
+  ["text"," "],
+  ["keyword.operator","&&"],
+  ["text"," "],
+  ["identifier","select"],
+  ["text","."],
+  ["identifier","length"],
+  ["text"," "],
+  ["keyword.operator","!="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["rparen",")"],
+  ["text"," "],
+  ["lparen","{"]
+],[
+   "jsp-start",
+  ["text","        "],
+  ["variable.language","out"],
+  ["text","."],
+  ["identifier","println"],
+  ["lparen","("],
+  ["string","\"You have selected: \""],
+  ["rparen",")"],
+  ["text",";"]
+],[
+   "jsp-start",
+  ["text","        "],
+  ["keyword","for"],
+  ["text"," "],
+  ["lparen","("],
+  ["keyword","int"],
+  ["text"," "],
+  ["identifier","i"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["text","; "],
+  ["identifier","i"],
+  ["text"," "],
+  ["keyword.operator","<"],
+  ["text"," "],
+  ["identifier","select"],
+  ["text","."],
+  ["identifier","length"],
+  ["text","; "],
+  ["identifier","i"],
+  ["keyword.operator","++"],
+  ["rparen",")"],
+  ["text"," "],
+  ["lparen","{"]
+],[
+   "jsp-start",
+  ["text","           "],
+  ["variable.language","out"],
+  ["text","."],
+  ["identifier","println"],
+  ["lparen","("],
+  ["identifier","select"],
+  ["lparen","["],
+  ["identifier","i"],
+  ["rparen","])"],
+  ["text","; "]
+],[
+   "jsp-start",
+  ["text","        "],
+  ["rparen","}"]
+],[
+   "jsp-start",
+  ["text","    "],
+  ["rparen","}"]
+],[
+   "start",
+  ["text","    "],
+  ["meta.tag","%>"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","body"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","html"],
+  ["meta.tag.punctuation.end",">"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_jsx.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_jsx.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_jsx.json
new file mode 100644
index 0000000..d1a740b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_jsx.json
@@ -0,0 +1,51 @@
+[[
+   "comment",
+  ["comment","/*EXPECTED"]
+],[
+   "comment",
+  ["comment","hello world!"]
+],[
+   "start",
+  ["comment","*/"]
+],[
+   "start",
+  ["keyword","class"],
+  ["text"," "],
+  ["language.support.class","Test"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","static"],
+  ["text"," "],
+  ["storage.type","function"],
+  ["text"," "],
+  ["entity.name.function","run"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["punctuation.operator",":"],
+  ["text"," "],
+  ["keyword","void"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","        "],
+  ["comment","// console.log(\"hello world!\");"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","log"],
+  ["text"," "],
+  ["string","\"hello world!\""],
+  ["punctuation.operator",";"]
+],[
+   "start",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["paren.rparen","}"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_julia.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_julia.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_julia.json
new file mode 100644
index 0000000..f4ce4ea
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_julia.json
@@ -0,0 +1,105 @@
+[[
+   "start",
+  ["keyword.control.julia","for"],
+  ["text"," op "],
+  ["keyword.operator.update.julia","="],
+  ["text"," ("],
+  ["keyword.operator.ternary.julia",":"],
+  ["keyword.operator.arithmetic.julia","+"],
+  ["text",", "],
+  ["keyword.operator.ternary.julia",":"],
+  ["keyword.operator.arithmetic.julia","*"],
+  ["text",", "],
+  ["keyword.operator.ternary.julia",":"],
+  ["keyword.operator.bitwise.julia","&"],
+  ["text",", "],
+  ["keyword.operator.ternary.julia",":"],
+  ["keyword.operator.bitwise.julia","|"],
+  ["text",", "],
+  ["keyword.operator.ternary.julia",":"],
+  ["keyword.operator.interpolation.julia","$"],
+  ["text",")"]
+],[
+   "start",
+  ["text","  "],
+  ["variable.macro.julia","@eval"],
+  ["text"," ("],
+  ["keyword.operator.interpolation.julia","$"],
+  ["text","op)(a,b,c) "],
+  ["keyword.operator.update.julia","="],
+  ["text"," ("],
+  ["keyword.operator.interpolation.julia","$"],
+  ["text","op)(("],
+  ["keyword.operator.interpolation.julia","$"],
+  ["text","op)(a,b),c)"]
+],[
+   "start",
+  ["keyword.control.julia","end"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["keyword.other.julia","function"],
+  ["meta.function.julia"," "],
+  ["entity.name.function.julia","g"],
+  ["text","("],
+  ["text","x,y)"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword.control.julia","return"],
+  ["text"," x "],
+  ["keyword.operator.arithmetic.julia","*"],
+  ["text"," y"]
+],[
+   "start",
+  ["text","  x "],
+  ["keyword.operator.arithmetic.julia","+"],
+  ["text"," y"]
+],[
+   "start",
+  ["keyword.control.julia","end"]
+],[
+   "start"
+],[
+   "start",
+  ["support.function.julia","cd"],
+  ["text","("],
+  ["punctuation.definition.string.begin.julia","\""],
+  ["string.quoted.double.julia","data"],
+  ["punctuation.definition.string.end.julia","\""],
+  ["text",") "],
+  ["keyword.control.julia","do"]
+],[
+   "start",
+  ["text","    "],
+  ["support.function.julia","open"],
+  ["text","("],
+  ["punctuation.definition.string.begin.julia","\""],
+  ["string.quoted.double.julia","outfile"],
+  ["punctuation.definition.string.end.julia","\""],
+  ["text",", "],
+  ["punctuation.definition.string.begin.julia","\""],
+  ["string.quoted.double.julia","w"],
+  ["punctuation.definition.string.end.julia","\""],
+  ["text",") "],
+  ["keyword.control.julia","do"],
+  ["text"," f"]
+],[
+   "start",
+  ["text","        "],
+  ["support.function.julia","write"],
+  ["text","("],
+  ["text","f, data)"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword.control.julia","end"]
+],[
+   "start",
+  ["keyword.control.julia","end"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_latex.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_latex.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_latex.json
new file mode 100644
index 0000000..0ac3772
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_latex.json
@@ -0,0 +1,127 @@
+[[
+   "start",
+  ["keyword","\\usepackage"],
+  ["lparen","{"],
+  ["text","amsmath"],
+  ["rparen","}"]
+],[
+   "start",
+  ["keyword","\\title"],
+  ["lparen","{"],
+  ["keyword","\\LaTeX"],
+  ["rparen","}"]
+],[
+   "start",
+  ["keyword","\\date"],
+  ["lparen","{"],
+  ["rparen","}"]
+],[
+   "start",
+  ["keyword","\\begin"],
+  ["lparen","{"],
+  ["text","document"],
+  ["rparen","}"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","\\maketitle"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","\\LaTeX"],
+  ["lparen","{"],
+  ["rparen","}"],
+  ["text"," is a document preparation system for the "],
+  ["keyword","\\TeX"],
+  ["lparen","{"],
+  ["rparen","}"]
+],[
+   "start",
+  ["text","  typesetting program. It offers programmable desktop publishing"]
+],[
+   "start",
+  ["text","  features and extensive facilities for automating most aspects of"]
+],[
+   "start",
+  ["text","  typesetting and desktop publishing, including numbering and"]
+],[
+   "start",
+  ["text","  cross-referencing, tables and figures, page layout, bibliographies,"]
+],[
+   "start",
+  ["text","  and much more. "],
+  ["keyword","\\LaTeX"],
+  ["lparen","{"],
+  ["rparen","}"],
+  ["text"," was originally written in 1984 by Leslie"]
+],[
+   "start",
+  ["text","  Lamport and has become the dominant method for using "],
+  ["keyword","\\TeX"],
+  ["text","; few"]
+],[
+   "start",
+  ["text","  people write in plain "],
+  ["keyword","\\TeX"],
+  ["lparen","{"],
+  ["rparen","}"],
+  ["text"," anymore. The current version  is"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","\\LaTeXe"],
+  ["text","."]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["text","  "],
+  ["comment","% This is a comment; it will not be shown in the final output."]
+],[
+   "start",
+  ["text","  "],
+  ["comment","% The following shows a little of the typesetting power of LaTeX:"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","\\begin"],
+  ["lparen","{"],
+  ["text","align"],
+  ["rparen","}"]
+],[
+   "start",
+  ["text","    E &= mc^2                              "],
+  ["keyword","\\\\"]
+],[
+   "start",
+  ["text","    m &= "],
+  ["keyword","\\frac"],
+  ["lparen","{"],
+  ["text","m_0"],
+  ["rparen","}"],
+  ["lparen","{"],
+  ["keyword","\\sqrt"],
+  ["lparen","{"],
+  ["text","1-"],
+  ["keyword","\\frac"],
+  ["lparen","{"],
+  ["text","v^2"],
+  ["rparen","}"],
+  ["lparen","{"],
+  ["text","c^2"],
+  ["rparen","}}}"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","\\end"],
+  ["lparen","{"],
+  ["text","align"],
+  ["rparen","}"]
+],[
+   "start",
+  ["keyword","\\end"],
+  ["lparen","{"],
+  ["text","document"],
+  ["rparen","}"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_less.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_less.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_less.json
new file mode 100644
index 0000000..81fe0c2
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_less.json
@@ -0,0 +1,204 @@
+[[
+   "start",
+  ["comment","/* styles.less */"]
+],[
+   "start"
+],[
+   "start",
+  ["variable","@base"],
+  ["text",": "],
+  ["constant.numeric","#f938ab"],
+  ["text",";"]
+],[
+   "start"
+],[
+   "start",
+  ["variable.language",".box-shadow"],
+  ["paren.lparen","("],
+  ["variable","@style"],
+  ["text",", "],
+  ["variable","@c"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["keyword","when"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["support.function","iscolor"],
+  ["paren.lparen","("],
+  ["variable","@c"],
+  ["paren.rparen","))"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    box-shadow:         "],
+  ["variable","@style"],
+  ["text"," "],
+  ["variable","@c"],
+  ["text",";"]
+],[
+   "start",
+  ["text","    -webkit-box-shadow: "],
+  ["variable","@style"],
+  ["text"," "],
+  ["variable","@c"],
+  ["text",";"]
+],[
+   "start",
+  ["text","    -moz-box-shadow:    "],
+  ["variable","@style"],
+  ["text"," "],
+  ["variable","@c"],
+  ["text",";"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["variable.language",".box-shadow"],
+  ["paren.lparen","("],
+  ["variable","@style"],
+  ["text",", "],
+  ["variable","@alpha"],
+  ["text",": "],
+  ["constant.numeric","50%"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["keyword","when"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["support.function","isnumber"],
+  ["paren.lparen","("],
+  ["variable","@alpha"],
+  ["paren.rparen","))"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["variable.language",".box-shadow"],
+  ["paren.lparen","("],
+  ["variable","@style"],
+  ["text",", "],
+  ["support.function","rgba"],
+  ["paren.lparen","("],
+  ["constant.numeric","0"],
+  ["text",", "],
+  ["constant.numeric","0"],
+  ["text",", "],
+  ["constant.numeric","0"],
+  ["text",", "],
+  ["variable","@alpha"],
+  ["paren.rparen","))"],
+  ["text",";"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["comment","// Box styles"]
+],[
+   "start",
+  ["variable.language",".box"],
+  ["text"," "],
+  ["paren.lparen","{"],
+  ["text"," "]
+],[
+   "start",
+  ["text","    "],
+  ["support.type","color"],
+  ["text",": "],
+  ["support.function","saturate"],
+  ["paren.lparen","("],
+  ["variable","@base"],
+  ["text",", "],
+  ["constant.numeric","5%"],
+  ["paren.rparen",")"],
+  ["text",";"]
+],[
+   "start",
+  ["text","    "],
+  ["support.type","border-color"],
+  ["text",": "],
+  ["support.function","lighten"],
+  ["paren.lparen","("],
+  ["variable","@base"],
+  ["text",", "],
+  ["constant.numeric","30%"],
+  ["paren.rparen",")"],
+  ["text",";"]
+],[
+   "start",
+  ["text","    "]
+],[
+   "start",
+  ["text","    "],
+  ["variable.language","div"],
+  ["text"," "],
+  ["paren.lparen","{"],
+  ["text"," "],
+  ["variable.language",".box-shadow"],
+  ["paren.lparen","("],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["constant.numeric","5px"],
+  ["text",", "],
+  ["constant.numeric","30%"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","  "]
+],[
+   "start",
+  ["text","    "],
+  ["variable.language","a"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","        "],
+  ["support.type","color"],
+  ["text",": "],
+  ["variable","@base"],
+  ["text",";"]
+],[
+   "start",
+  ["text","        "]
+],[
+   "start",
+  ["text","        &"],
+  ["variable.language",":hover"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","            "],
+  ["support.type","color"],
+  ["text",": "],
+  ["support.function","lighten"],
+  ["paren.lparen","("],
+  ["variable","@base"],
+  ["text",", "],
+  ["constant.numeric","50%"],
+  ["paren.rparen",")"],
+  ["text",";"]
+],[
+   "start",
+  ["text","        "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start"
+]]
\ No newline at end of file


[19/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/ftl_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/ftl_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/ftl_highlight_rules.js
new file mode 100644
index 0000000..0a79520
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/ftl_highlight_rules.js
@@ -0,0 +1,195 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var FtlLangHighlightRules = function () {
+
+    var stringBuiltIns = "\\?|substring|cap_first|uncap_first|capitalize|chop_linebreak|date|time|datetime|"
+        + "ends_with|html|groups|index_of|j_string|js_string|json_string|last_index_of|length|lower_case|"
+        + "left_pad|right_pad|contains|matches|number|replace|rtf|url|split|starts_with|string|trim|"
+        + "upper_case|word_list|xhtml|xml";
+    var numberBuiltIns = "c|round|floor|ceiling";
+    var dateBuiltIns = "iso_[a-z_]+";
+    var seqBuiltIns = "first|last|seq_contains|seq_index_of|seq_last_index_of|reverse|size|sort|sort_by|chunk";
+    var hashBuiltIns = "keys|values";
+    var xmlBuiltIns = "children|parent|root|ancestors|node_name|node_type|node_namespace";
+    var expertBuiltIns = "byte|double|float|int|long|short|number_to_date|number_to_time|number_to_datetime|"
+        + "eval|has_content|interpret|is_[a-z_]+|namespacenew";
+    var allBuiltIns = stringBuiltIns + numberBuiltIns + dateBuiltIns + seqBuiltIns + hashBuiltIns
+        + xmlBuiltIns + expertBuiltIns;
+
+    var deprecatedBuiltIns = "default|exists|if_exists|web_safe";
+
+    var variables = "data_model|error|globals|lang|locale|locals|main|namespace|node|current_node|"
+        + "now|output_encoding|template_name|url_escaping_charset|vars|version";
+
+    var operators = "gt|gte|lt|lte|as|in|using";
+
+    var reserved = "true|false";
+
+    var attributes = "encoding|parse|locale|number_format|date_format|time_format|datetime_format|time_zone|"
+        + "url_escaping_charset|classic_compatible|strip_whitespace|strip_text|strict_syntax|ns_prefixes|"
+        + "attributes";
+
+    this.$rules = {
+        "start" : [{
+            token : "constant.character.entity",
+            regex : /&[^;]+;/
+        }, {
+            token : "support.function",
+            regex : "\\?("+allBuiltIns+")"
+        },  {
+            token : "support.function.deprecated",
+            regex : "\\?("+deprecatedBuiltIns+")"
+        }, {
+            token : "language.variable",
+            regex : "\\.(?:"+variables+")"
+        }, {
+            token : "constant.language",
+            regex : "\\b("+reserved+")\\b"
+        }, {
+            token : "keyword.operator",
+            regex : "\\b(?:"+operators+")\\b"
+        }, {
+            token : "entity.other.attribute-name",
+            regex : attributes
+        }, {
+            token : "string", //
+            regex : /['"]/,
+            next : "qstring"
+        }, {
+            // Deal with variable names that contains number
+            // e.g. <#if var42 == 42 >
+            token : function(value) {
+                if (value.match("^[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?$")) {
+                    return "constant.numeric";
+                } else {
+                    return "variable";
+                }
+            },
+            regex : /[\w.+\-]+/
+        }, {
+            token : "keyword.operator",
+            regex : "!|\\.|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^="
+        }, {
+            token : "paren.lparen",
+            regex : "[[({]"
+        }, {
+            token : "paren.rparen",
+            regex : "[\\])}]"
+        }, {
+            token : "text",
+            regex : "\\s+"
+        }],
+
+        "qstring" : [{
+            token : "constant.character.escape",
+            regex : '\\\\[nrtvef\\\\"$]'
+        }, {
+            token : "string",
+            regex : /['"]/,
+            next : "start"
+        }, {
+            defaultToken : "string"
+        }]
+    };
+};
+
+oop.inherits(FtlLangHighlightRules, TextHighlightRules);
+
+var FtlHighlightRules = function() {
+    HtmlHighlightRules.call(this);
+
+    var directives = "assign|attempt|break|case|compress|default|elseif|else|escape|fallback|function|flush|"
+        + "ftl|global|if|import|include|list|local|lt|macro|nested|noescape|noparse|nt|recover|recurse|return|rt|"
+        + "setting|stop|switch|t|visit";
+
+    var startRules = [
+        {
+            token : "comment",
+            regex : "<#--",
+            next : "ftl-dcomment"
+        }, {
+            token : "string.interpolated",
+            regex : "\\${",
+            push  : "ftl-start"
+        }, {
+            token : "keyword.function",
+            regex :  "</?#("+directives+")",
+            push : "ftl-start"
+        }, {
+            token : "keyword.other",
+            regex : "</?@[a-zA-Z\\.]+",
+            push : "ftl-start"
+        }
+    ];
+
+    var endRules = [
+        {
+           token : "keyword",
+            regex : "/?>",
+            next  : "pop"
+        }, {
+            token : "string.interpolated",
+            regex : "}",
+            next  : "pop"
+        }
+    ];
+
+    for (var key in this.$rules)
+        this.$rules[key].unshift.apply(this.$rules[key], startRules);
+
+    this.embedRules(FtlLangHighlightRules, "ftl-", endRules, ["start"]);
+
+    this.addRules({
+        "ftl-dcomment" : [{
+            token : "comment",
+            regex : ".*?-->",
+            next : "pop"
+        }, {
+            token : "comment",
+            regex : ".+"
+        }]
+    });
+
+    this.normalizeRules();
+};
+
+oop.inherits(FtlHighlightRules, HtmlHighlightRules);
+
+exports.FtlHighlightRules = FtlHighlightRules;
+});
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/glsl.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/glsl.js b/src/fauxton/assets/js/libs/ace/mode/glsl.js
new file mode 100644
index 0000000..202ec9f
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/glsl.js
@@ -0,0 +1,53 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var CMode = require("./c_cpp").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var glslHighlightRules = require("./glsl_highlight_rules").glslHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var Range = require("../range").Range;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = glslHighlightRules;
+    
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new CstyleBehaviour();
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, CMode);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/glsl_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/glsl_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/glsl_highlight_rules.js
new file mode 100644
index 0000000..552df6c
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/glsl_highlight_rules.js
@@ -0,0 +1,81 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
+
+var glslHighlightRules = function() {
+
+    var keywords = (
+        "attribute|const|uniform|varying|break|continue|do|for|while|" +
+        "if|else|in|out|inout|float|int|void|bool|true|false|" +
+        "lowp|mediump|highp|precision|invariant|discard|return|mat2|mat3|" +
+        "mat4|vec2|vec3|vec4|ivec2|ivec3|ivec4|bvec2|bvec3|bvec4|sampler2D|" +
+        "samplerCube|struct"
+    );
+
+    var buildinConstants = (
+        "radians|degrees|sin|cos|tan|asin|acos|atan|pow|" +
+        "exp|log|exp2|log2|sqrt|inversesqrt|abs|sign|floor|ceil|fract|mod|" +
+        "min|max|clamp|mix|step|smoothstep|length|distance|dot|cross|" +
+        "normalize|faceforward|reflect|refract|matrixCompMult|lessThan|" +
+        "lessThanEqual|greaterThan|greaterThanEqual|equal|notEqual|any|all|" +
+        "not|dFdx|dFdy|fwidth|texture2D|texture2DProj|texture2DLod|" +
+        "texture2DProjLod|textureCube|textureCubeLod|" +
+        "gl_MaxVertexAttribs|gl_MaxVertexUniformVectors|gl_MaxVaryingVectors|" +
+        "gl_MaxVertexTextureImageUnits|gl_MaxCombinedTextureImageUnits|" +
+        "gl_MaxTextureImageUnits|gl_MaxFragmentUniformVectors|gl_MaxDrawBuffers|" +
+        "gl_DepthRangeParameters|gl_DepthRange|" +
+        // The following two are only for MIME x-shader/x-vertex.
+        "gl_Position|gl_PointSize|" +
+        // The following five are only for MIME x-shader/x-fragment.
+        "gl_FragCoord|gl_FrontFacing|gl_PointCoord|gl_FragColor|gl_FragData"
+    );
+
+    var keywordMapper = this.createKeywordMapper({
+        "variable.language": "this",
+        "keyword": keywords,
+        "constant.language": buildinConstants
+    }, "identifier");
+
+    this.$rules = new c_cppHighlightRules().$rules;
+    this.$rules.start.forEach(function(rule) {
+        if (typeof rule.token == "function")
+            rule.token = keywordMapper;
+    })
+};
+
+oop.inherits(glslHighlightRules, c_cppHighlightRules);
+
+exports.glslHighlightRules = glslHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/golang.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/golang.js b/src/fauxton/assets/js/libs/ace/mode/golang.js
new file mode 100644
index 0000000..62b6875
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/golang.js
@@ -0,0 +1,55 @@
+define(function(require, exports, module) {
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var GolangHighlightRules = require("./golang_highlight_rules").GolangHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = GolangHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    
+    this.lineCommentStart = "//";
+    this.blockComment = {start: "/*", end: "*/"};
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+        var endState = tokenizedLine.state;
+
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+        
+        if (state == "start") {
+            var match = line.match(/^.*[\{\(\[]\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        }
+
+        return indent;
+    };//end getNextLineIndent
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/golang_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/golang_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/golang_highlight_rules.js
new file mode 100644
index 0000000..5bd40b4
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/golang_highlight_rules.js
@@ -0,0 +1,111 @@
+define(function(require, exports, module) {
+    var oop = require("../lib/oop");
+    var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
+    var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+    var GolangHighlightRules = function() {
+        var keywords = (
+            "else|break|case|return|goto|if|const|select|" +
+            "continue|struct|default|switch|for|range|" +
+            "func|import|package|chan|defer|fallthrough|go|interface|map|range|" +
+            "select|type|var"
+        );
+        var builtinTypes = (
+            "string|uint8|uint16|uint32|uint64|int8|int16|int32|int64|float32|" +
+            "float64|complex64|complex128|byte|rune|uint|int|uintptr|bool|error"
+        );
+        var builtinFunctions = (
+            "make|close|new|panic|recover"
+        );
+        var builtinConstants = ("nil|true|false|iota");
+
+        var keywordMapper = this.createKeywordMapper({
+            "keyword": keywords,
+            "constant.language": builtinConstants,
+            "support.function": builtinFunctions,
+            "support.type": builtinTypes
+        }, "identifier");
+
+        this.$rules = {
+            "start" : [
+                {
+                    token : "comment",
+                    regex : "\\/\\/.*$"
+                },
+                DocCommentHighlightRules.getStartRule("doc-start"),
+                {
+                    token : "comment", // multi line comment
+                    regex : "\\/\\*",
+                    next : "comment"
+                }, {
+                    token : "string", // single line
+                    regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+                }, {
+                    token : "string", // single line
+                    regex : '[`](?:[^`]*)[`]'
+                }, {
+                    token : "string", // multi line string start
+                    merge : true,
+                    regex : '[`](?:[^`]*)$',
+                    next : "bqstring"
+                }, {
+                    token : "constant.numeric", // rune
+                    regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))[']"
+                }, {
+                    token : "constant.numeric", // hex
+                    regex : "0[xX][0-9a-fA-F]+\\b"
+                }, {
+                    token : "constant.numeric", // float
+                    regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+                }, {
+                    token : keywordMapper,
+                    regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+                }, {
+                    token : "keyword.operator",
+                    regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^="
+                }, {
+                    token : "punctuation.operator",
+                    regex : "\\?|\\:|\\,|\\;|\\."
+                }, {
+                    token : "paren.lparen",
+                    regex : "[[({]"
+                }, {
+                    token : "paren.rparen",
+                    regex : "[\\])}]"
+                }, {
+                    token: "invalid",
+                    regex: "\\s+$"
+                }, {
+                    token : "text",
+                    regex : "\\s+"
+                }
+            ],
+            "comment" : [
+                {
+                    token : "comment", // closing comment
+                    regex : ".*?\\*\\/",
+                    next : "start"
+                }, {
+                    token : "comment", // comment spanning whole line
+                    regex : ".+"
+                }
+            ],
+            "bqstring" : [
+                {
+                    token : "string",
+                    regex : '(?:[^`]*)`',
+                    next : "start"
+                }, {
+                    token : "string",
+                    regex : '.+'
+                }
+            ]
+        };
+
+        this.embedRules(DocCommentHighlightRules, "doc-",
+            [ DocCommentHighlightRules.getEndRule("start") ]);
+    };
+    oop.inherits(GolangHighlightRules, TextHighlightRules);
+
+    exports.GolangHighlightRules = GolangHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/groovy.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/groovy.js b/src/fauxton/assets/js/libs/ace/mode/groovy.js
new file mode 100644
index 0000000..91d88e0
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/groovy.js
@@ -0,0 +1,24 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var JavaScriptMode = require("./javascript").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var GroovyHighlightRules = require("./groovy_highlight_rules").GroovyHighlightRules;
+
+var Mode = function() {
+    JavaScriptMode.call(this);
+    this.HighlightRules = GroovyHighlightRules;
+};
+oop.inherits(Mode, JavaScriptMode);
+
+(function() {
+
+    this.createWorker = function(session) {
+        return null;
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/groovy_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/groovy_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/groovy_highlight_rules.js
new file mode 100644
index 0000000..fb3b78e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/groovy_highlight_rules.js
@@ -0,0 +1,173 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var GroovyHighlightRules = function() {
+
+    var keywords = (
+        "assert|with|abstract|continue|for|new|switch|" +
+        "assert|default|goto|package|synchronized|" +
+        "boolean|do|if|private|this|" +
+        "break|double|implements|protected|throw|" +
+        "byte|else|import|public|throws|" +
+        "case|enum|instanceof|return|transient|" +
+        "catch|extends|int|short|try|" +
+        "char|final|interface|static|void|" +
+        "class|finally|long|strictfp|volatile|" +
+        "def|float|native|super|while"
+    );
+
+    var buildinConstants = (
+        "null|Infinity|NaN|undefined"
+    );
+
+    var langClasses = (
+        "AbstractMethodError|AssertionError|ClassCircularityError|"+
+        "ClassFormatError|Deprecated|EnumConstantNotPresentException|"+
+        "ExceptionInInitializerError|IllegalAccessError|"+
+        "IllegalThreadStateException|InstantiationError|InternalError|"+
+        "NegativeArraySizeException|NoSuchFieldError|Override|Process|"+
+        "ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|"+
+        "SuppressWarnings|TypeNotPresentException|UnknownError|"+
+        "UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|"+
+        "InstantiationException|IndexOutOfBoundsException|"+
+        "ArrayIndexOutOfBoundsException|CloneNotSupportedException|"+
+        "NoSuchFieldException|IllegalArgumentException|NumberFormatException|"+
+        "SecurityException|Void|InheritableThreadLocal|IllegalStateException|"+
+        "InterruptedException|NoSuchMethodException|IllegalAccessException|"+
+        "UnsupportedOperationException|Enum|StrictMath|Package|Compiler|"+
+        "Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|"+
+        "NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|"+
+        "NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|"+
+        "Character|Boolean|StackTraceElement|Appendable|StringBuffer|"+
+        "Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|"+
+        "StackOverflowError|OutOfMemoryError|VirtualMachineError|"+
+        "ArrayStoreException|ClassCastException|LinkageError|"+
+        "NoClassDefFoundError|ClassNotFoundException|RuntimeException|"+
+        "Exception|ThreadDeath|Error|Throwable|System|ClassLoader|"+
+        "Cloneable|Class|CharSequence|Comparable|String|Object"
+    );
+
+    // TODO var importClasses = "";
+
+    var keywordMapper = this.createKeywordMapper({
+        "variable.language": "this",
+        "keyword": keywords,
+        "support.function": langClasses,
+        "constant.language": buildinConstants
+    }, "identifier");
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "start" : [
+            {
+                token : "comment",
+                regex : "\\/\\/.*$"
+            },
+            DocCommentHighlightRules.getStartRule("doc-start"),
+            {
+                token : "comment", // multi line comment
+                regex : "\\/\\*",
+                next : "comment"
+            }, {
+                token : "string.regexp",
+                regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
+            }, {
+                token : "string",
+                regex : '"""',
+                next  : "qqstring"
+            }, {
+                token : "string",
+                regex : "'''",
+                next  : "qstring"
+            }, {
+                token : "string", // single line
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+            }, {
+                token : "string", // single line
+                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+            }, {
+                token : "constant.numeric", // hex
+                regex : "0[xX][0-9a-fA-F]+\\b"
+            }, {
+                token : "constant.numeric", // float
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+            }, {
+                token : "constant.language.boolean",
+                regex : "(?:true|false)\\b"
+            }, {
+                token : keywordMapper,
+                // TODO: Unicode escape sequences
+                // TODO: Unicode identifiers
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+            }, {
+                token : "keyword.operator",
+                regex : "\\?:|\\?\\.|\\*\\.|<=>|=~|==~|\\.@|\\*\\.@|\\.&|as|in|is|!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
+            }, {
+                token : "lparen",
+                regex : "[[({]"
+            }, {
+                token : "rparen",
+                regex : "[\\])}]"
+            }, {
+                token : "text",
+                regex : "\\s+"
+            }
+        ],
+        "comment" : [
+            {
+                token : "comment", // closing comment
+                regex : ".*?\\*\\/",
+                next : "start"
+            }, {
+                token : "comment", // comment spanning whole line
+                regex : ".+"
+            }
+        ],
+        "qqstring" : [
+            {
+                token : "constant.language.escape",
+                regex : /\\(?:u[0-9A-Fa-f]{4}|.|$)/
+            }, {
+                token : "constant.language.escape",
+                regex : /\$[\w\d]+/
+            }, {
+                token : "constant.language.escape",
+                regex : /\$\{[^"\}]+\}?/
+            }, {
+                token : "string",
+                regex : '"{3,5}',
+                next : "start"
+            }, {
+                token : "string",
+                regex : '.+?'
+            }
+        ],
+        "qstring" : [
+            {
+                token : "constant.language.escape",
+                regex : /\\(?:u[0-9A-Fa-f]{4}|.|$)/
+            }, {
+                token : "string",
+                regex : "'{3,5}",
+                next : "start"
+            }, {
+                token : "string",
+                regex : ".+?"
+            }
+        ]
+    };
+
+    this.embedRules(DocCommentHighlightRules, "doc-",
+        [ DocCommentHighlightRules.getEndRule("start") ]);
+};
+
+oop.inherits(GroovyHighlightRules, TextHighlightRules);
+
+exports.GroovyHighlightRules = GroovyHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/haml.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/haml.js b/src/fauxton/assets/js/libs/ace/mode/haml.js
new file mode 100644
index 0000000..23ea9e6
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/haml.js
@@ -0,0 +1,61 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ * 
+ * Garen J. Torikian < gjtorikian AT gmail DOT com >
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var HamlHighlightRules = require("./haml_highlight_rules").HamlHighlightRules;
+var FoldMode = require("./folding/coffee").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = HamlHighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = ["//", "#"];
+    
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/haml_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/haml_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/haml_highlight_rules.js
new file mode 100644
index 0000000..6219bc7
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/haml_highlight_rules.js
@@ -0,0 +1,132 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var RubyExports = require("./ruby_highlight_rules");
+var RubyHighlightRules = RubyExports.RubyHighlightRules;
+
+var HamlHighlightRules = function() {
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = 
+        {
+    "start": [
+        {
+            token : "punctuation.section.comment",
+            regex : /^\s*\/.*/
+        },
+        {
+            token : "punctuation.section.comment",
+            regex : /^\s*#.*/
+        },
+        {
+            token: "string.quoted.double",
+            regex: "==.+?=="
+        },
+        {
+            token: "keyword.other.doctype",
+            regex: "^!!!\\s*(?:[a-zA-Z0-9-_]+)?"
+        },
+        RubyExports.qString,
+        RubyExports.qqString,
+        RubyExports.tString,
+        {
+            token: ["entity.name.tag.haml"],
+            regex: /^\s*%[\w:]+/,
+            next: "tag_single"
+        },
+        {
+            token: [ "meta.escape.haml" ],
+            regex: "^\\s*\\\\."
+        },
+        RubyExports.constantNumericHex,
+        RubyExports.constantNumericFloat,
+        
+        RubyExports.constantOtherSymbol,
+        {
+            token: "text",
+            regex: "=|-|~",
+            next: "embedded_ruby"
+        }
+    ],
+    "tag_single": [
+        {
+            token: "entity.other.attribute-name.class.haml",
+            regex: "\\.[\\w-]+"
+        },
+        {
+            token: "entity.other.attribute-name.id.haml",
+            regex: "#[\\w-]+"
+        },
+        {
+            token: "punctuation.section",
+            regex: "\\{",
+            next: "section"
+        },
+        
+        RubyExports.constantOtherSymbol,
+        
+        {
+            token: "text",
+            regex: /\s/,
+            next: "start"
+        },
+        {
+            token: "empty",
+            regex: "$|(?!\\.|#|\\{|\\[|=|-|~|\\/)",
+            next: "start"
+        }
+    ],
+    "section": [
+        RubyExports.constantOtherSymbol,
+        
+        RubyExports.qString,
+        RubyExports.qqString,
+        RubyExports.tString,
+        
+        RubyExports.constantNumericHex,
+        RubyExports.constantNumericFloat,
+        {
+            token: "punctuation.section",
+            regex: "\\}",
+            next: "start"
+        } 
+    ],
+    "embedded_ruby": [ 
+        RubyExports.constantNumericHex,
+        RubyExports.constantNumericFloat,
+        {
+                token : "support.class", // class name
+                regex : "[A-Z][a-zA-Z_\\d]+"
+        },    
+        {
+            token : new RubyHighlightRules().getKeywords(),
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        },
+        {
+            token : ["keyword", "text", "text"],
+            regex : "(?:do|\\{)(?: \\|[^|]+\\|)?$",
+            next  : "start"
+        }, 
+        {
+            token : ["text"],
+            regex : "^$",
+            next  : "start"
+        }, 
+        {
+            token : ["text"],
+            regex : "^(?!.*\\|\\s*$)",
+            next  : "start"
+        }
+    ]
+}
+
+};
+
+oop.inherits(HamlHighlightRules, TextHighlightRules);
+
+exports.HamlHighlightRules = HamlHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/handlebars.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/handlebars.js b/src/fauxton/assets/js/libs/ace/mode/handlebars.js
new file mode 100644
index 0000000..55af534
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/handlebars.js
@@ -0,0 +1,29 @@
+/* global define */
+
+define(function(require, exports, module) {
+  "use strict";
+
+var oop = require("../lib/oop");
+var HtmlMode = require("./html").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var HandlebarsHighlightRules = require("./handlebars_highlight_rules").HandlebarsHighlightRules;
+var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour;
+var HtmlFoldMode = require("./folding/html").FoldMode;
+
+var Mode = function() {
+    HtmlMode.call(this);
+    this.HighlightRules = HandlebarsHighlightRules;
+    this.$behaviour = new HtmlBehaviour();
+
+    
+    this.foldingRules = new HtmlFoldMode();
+};
+
+oop.inherits(Mode, HtmlMode);
+
+(function() {
+    
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/handlebars_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/handlebars_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/handlebars_highlight_rules.js
new file mode 100644
index 0000000..e224335
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/handlebars_highlight_rules.js
@@ -0,0 +1,72 @@
+/* global define */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+var xmlUtil = require("./xml_util");
+function pop2(currentState, stack) {
+    stack.splice(0, 3);
+    return stack.shift() || "start";
+}
+var HandlebarsHighlightRules = function() {
+    HtmlHighlightRules.call(this);
+    var hbs = {        
+        regex : "(?={{)",
+        push : "handlebars"
+    }
+    for (var key in this.$rules) {
+        this.$rules[key].unshift(hbs);
+    }
+    this.$rules.handlebars = [{
+        token : "comment.start",
+        regex : "{{!--",
+        push : [{
+            token : "comment.end",
+            regex : "--}}",
+            next : pop2
+        }, {
+            defaultToken : "comment"
+        }]
+    }, {
+        token : "comment.start",
+        regex : "{{!",
+        push : [{
+            token : "comment.end",
+            regex : "}}",
+            next : pop2
+        }, {
+            defaultToken : "comment"
+        }]
+    }, {
+        token : "storage.type.start", // begin section
+        regex : "{{[#\\^/&]?",
+        push : [{
+            token : "storage.type.end",
+            regex : "}}",
+            next : pop2
+        }, {
+            token : "variable.parameter",
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*"
+        }]
+    }, {
+        token : "support.function", // unescaped variable
+        regex : "{{{",
+        push : [{
+            token : "support.function",
+            regex : "}}}",
+            next : pop2
+        }, {
+            token : "variable.parameter",
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*"
+        }]
+    }];
+
+    this.normalizeRules();
+};
+
+oop.inherits(HandlebarsHighlightRules, HtmlHighlightRules);
+
+exports.HandlebarsHighlightRules = HandlebarsHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/haskell.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/haskell.js b/src/fauxton/assets/js/libs/ace/mode/haskell.js
new file mode 100644
index 0000000..5b36905
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/haskell.js
@@ -0,0 +1,62 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ *
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var HaskellHighlightRules = require("./haskell_highlight_rules").HaskellHighlightRules;
+// TODO: pick appropriate fold mode
+var FoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = HaskellHighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = "--";
+    this.blockComment = {start: "/*", end: "*/"};
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/haskell_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/haskell_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/haskell_highlight_rules.js
new file mode 100644
index 0000000..fdfaa53
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/haskell_highlight_rules.js
@@ -0,0 +1,246 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* This file was autogenerated from tm bundles\haskell.tmbundle\Syntaxes\Haskell.plist (uuid: ) */
+/****************************************************************************************
+ * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
+ * fileTypes                                                                            *
+ ****************************************************************************************/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var HaskellHighlightRules = function() {
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = { start: 
+       [ { token: 
+            [ 'punctuation.definition.entity.haskell',
+              'keyword.operator.function.infix.haskell',
+              'punctuation.definition.entity.haskell' ],
+           regex: '(`)([a-zA-Z_\']*?)(`)',
+           comment: 'In case this regex seems unusual for an infix operator, note that Haskell allows any ordinary function application (elem 4 [1..10]) to be rewritten as an infix expression (4 `elem` [1..10]).' },
+         { token: 'constant.language.unit.haskell', regex: '\\(\\)' },
+         { token: 'constant.language.empty-list.haskell',
+           regex: '\\[\\]' },
+         { token: 'keyword.other.haskell',
+           regex: 'module',
+           push: 
+            [ { token: 'keyword.other.haskell', regex: 'where', next: 'pop' },
+              { include: '#module_name' },
+              { include: '#module_exports' },
+              { token: 'invalid', regex: '[a-z]+' },
+              { defaultToken: 'meta.declaration.module.haskell' } ] },
+         { token: 'keyword.other.haskell',
+           regex: '\\bclass\\b',
+           push: 
+            [ { token: 'keyword.other.haskell',
+                regex: '\\bwhere\\b',
+                next: 'pop' },
+              { token: 'support.class.prelude.haskell',
+                regex: '\\b(?:Monad|Functor|Eq|Ord|Read|Show|Num|(?:Frac|Ra)tional|Enum|Bounded|Real(?:Frac|Float)?|Integral|Floating)\\b' },
+              { token: 'entity.other.inherited-class.haskell',
+                regex: '[A-Z][A-Za-z_\']*' },
+              { token: 'variable.other.generic-type.haskell',
+                regex: '\\b[a-z][a-zA-Z0-9_\']*\\b' },
+              { defaultToken: 'meta.declaration.class.haskell' } ] },
+         { token: 'keyword.other.haskell',
+           regex: '\\binstance\\b',
+           push: 
+            [ { token: 'keyword.other.haskell',
+                regex: '\\bwhere\\b|$',
+                next: 'pop' },
+              { include: '#type_signature' },
+              { defaultToken: 'meta.declaration.instance.haskell' } ] },
+         { token: 'keyword.other.haskell',
+           regex: 'import',
+           push: 
+            [ { token: 'meta.import.haskell', regex: '$|;', next: 'pop' },
+              { token: 'keyword.other.haskell', regex: 'qualified|as|hiding' },
+              { include: '#module_name' },
+              { include: '#module_exports' },
+              { defaultToken: 'meta.import.haskell' } ] },
+         { token: [ 'keyword.other.haskell', 'meta.deriving.haskell' ],
+           regex: '(deriving)(\\s*\\()',
+           push: 
+            [ { token: 'meta.deriving.haskell', regex: '\\)', next: 'pop' },
+              { token: 'entity.other.inherited-class.haskell',
+                regex: '\\b[A-Z][a-zA-Z_\']*' },
+              { defaultToken: 'meta.deriving.haskell' } ] },
+         { token: 'keyword.other.haskell',
+           regex: '\\b(?:deriving|where|data|type|case|of|let|in|newtype|default)\\b' },
+         { token: 'keyword.operator.haskell', regex: '\\binfix[lr]?\\b' },
+         { token: 'keyword.control.haskell',
+           regex: '\\b(?:do|if|then|else)\\b' },
+         { token: 'constant.numeric.float.haskell',
+           regex: '\\b(?:[0-9]+\\.[0-9]+(?:[eE][+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+)\\b',
+           comment: 'Floats are always decimal' },
+         { token: 'constant.numeric.haskell',
+           regex: '\\b(?:[0-9]+|0(?:[xX][0-9a-fA-F]+|[oO][0-7]+))\\b' },
+         { token: 
+            [ 'meta.preprocessor.c',
+              'punctuation.definition.preprocessor.c',
+              'meta.preprocessor.c' ],
+           regex: '^(\\s*)(#)(\\s*\\w+)',
+           comment: 'In addition to Haskell\'s "native" syntax, GHC permits the C preprocessor to be run on a source file.' },
+         { include: '#pragma' },
+         { token: 'punctuation.definition.string.begin.haskell',
+           regex: '"',
+           push: 
+            [ { token: 'punctuation.definition.string.end.haskell',
+                regex: '"',
+                next: 'pop' },
+              { token: 'constant.character.escape.haskell',
+                regex: '\\\\(?:NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\\\\"\'\\&])' },
+              { token: 'constant.character.escape.octal.haskell',
+                regex: '\\\\o[0-7]+|\\\\x[0-9A-Fa-f]+|\\\\[0-9]+' },
+              { token: 'constant.character.escape.control.haskell',
+                regex: '\\^[A-Z@\\[\\]\\\\\\^_]' },
+              { defaultToken: 'string.quoted.double.haskell' } ] },
+         { token: 
+            [ 'punctuation.definition.string.begin.haskell',
+              'string.quoted.single.haskell',
+              'constant.character.escape.haskell',
+              'constant.character.escape.octal.haskell',
+              'constant.character.escape.hexadecimal.haskell',
+              'constant.character.escape.control.haskell',
+              'punctuation.definition.string.end.haskell' ],
+           regex: '(\')(?:([\\ -\\[\\]-~])|(\\\\(?:NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\\\\"\'\\&]))|(\\\\o[0-7]+)|(\\\\x[0-9A-Fa-f]+)|(\\^[A-Z@\\[\\]\\\\\\^_]))(\')' },
+         { token: 
+            [ 'meta.function.type-declaration.haskell',
+              'entity.name.function.haskell',
+              'meta.function.type-declaration.haskell',
+              'keyword.other.double-colon.haskell' ],
+           regex: '^(\\s*)([a-z_][a-zA-Z0-9_\']*|\\([|!%$+\\-.,=</>]+\\))(\\s*)(::)',
+           push: 
+            [ { token: 'meta.function.type-declaration.haskell',
+                regex: '$',
+                next: 'pop' },
+              { include: '#type_signature' },
+              { defaultToken: 'meta.function.type-declaration.haskell' } ] },
+         { token: 'support.constant.haskell',
+           regex: '\\b(?:Just|Nothing|Left|Right|True|False|LT|EQ|GT|\\(\\)|\\[\\])\\b' },
+         { token: 'constant.other.haskell', regex: '\\b[A-Z]\\w*\\b' },
+         { include: '#comments' },
+         { token: 'support.function.prelude.haskell',
+           regex: '\\b(?:abs|acos|acosh|all|and|any|appendFile|applyM|asTypeOf|asin|asinh|atan|atan2|atanh|break|catch|ceiling|compare|concat|concatMap|const|cos|cosh|curry|cycle|decodeFloat|div|divMod|drop|dropWhile|elem|encodeFloat|enumFrom|enumFromThen|enumFromThenTo|enumFromTo|error|even|exp|exponent|fail|filter|flip|floatDigits|floatRadix|floatRange|floor|fmap|foldl|foldl1|foldr|foldr1|fromEnum|fromInteger|fromIntegral|fromRational|fst|gcd|getChar|getContents|getLine|head|id|init|interact|ioError|isDenormalized|isIEEE|isInfinite|isNaN|isNegativeZero|iterate|last|lcm|length|lex|lines|log|logBase|lookup|map|mapM|mapM_|max|maxBound|maximum|maybe|min|minBound|minimum|mod|negate|not|notElem|null|odd|or|otherwise|pi|pred|print|product|properFraction|putChar|putStr|putStrLn|quot|quotRem|read|readFile|readIO|readList|readLn|readParen|reads|readsPrec|realToFrac|recip|rem|repeat|replicate|return|reverse|round|scaleFloat|scanl|scanl1|scanr|scanr1|seq|sequence|sequence_|show|showChar|showL
 ist|showParen|showString|shows|showsPrec|significand|signum|sin|sinh|snd|span|splitAt|sqrt|subtract|succ|sum|tail|take|takeWhile|tan|tanh|toEnum|toInteger|toRational|truncate|uncurry|undefined|unlines|until|unwords|unzip|unzip3|userError|words|writeFile|zip|zip3|zipWith|zipWith3)\\b' },
+         { include: '#infix_op' },
+         { token: 'keyword.operator.haskell',
+           regex: '[|!%$?~+:\\-.=</>\\\\]+',
+           comment: 'In case this regex seems overly general, note that Haskell permits the definition of new operators which can be nearly any string of punctuation characters, such as $%^&*.' },
+         { token: 'punctuation.separator.comma.haskell', regex: ',' } ],
+      '#block_comment': 
+       [ { token: 'punctuation.definition.comment.haskell',
+           regex: '\\{-(?!#)',
+           push: 
+            [ { include: '#block_comment' },
+              { token: 'punctuation.definition.comment.haskell',
+                regex: '-\\}',
+                next: 'pop' },
+              { defaultToken: 'comment.block.haskell' } ] } ],
+      '#comments': 
+       [ { token: 'punctuation.definition.comment.haskell',
+           regex: '--.*',
+           push_: 
+            [ { token: 'comment.line.double-dash.haskell',
+                regex: '$',
+                next: 'pop' },
+              { defaultToken: 'comment.line.double-dash.haskell' } ] },
+         { include: '#block_comment' } ],
+      '#infix_op': 
+       [ { token: 'entity.name.function.infix.haskell',
+           regex: '\\([|!%$+:\\-.=</>]+\\)|\\(,+\\)' } ],
+      '#module_exports': 
+       [ { token: 'meta.declaration.exports.haskell',
+           regex: '\\(',
+           push: 
+            [ { token: 'meta.declaration.exports.haskell',
+                regex: '\\)',
+                next: 'pop' },
+              { token: 'entity.name.function.haskell',
+                regex: '\\b[a-z][a-zA-Z_\']*' },
+              { token: 'storage.type.haskell', regex: '\\b[A-Z][A-Za-z_\']*' },
+              { token: 'punctuation.separator.comma.haskell', regex: ',' },
+              { include: '#infix_op' },
+              { token: 'meta.other.unknown.haskell',
+                regex: '\\(.*?\\)',
+                comment: 'So named because I don\'t know what to call this.' },
+              { defaultToken: 'meta.declaration.exports.haskell' } ] } ],
+      '#module_name': 
+       [ { token: 'support.other.module.haskell',
+           regex: '[A-Z][A-Za-z._\']*' } ],
+      '#pragma': 
+       [ { token: 'meta.preprocessor.haskell',
+           regex: '\\{-#',
+           push: 
+            [ { token: 'meta.preprocessor.haskell',
+                regex: '#-\\}',
+                next: 'pop' },
+              { token: 'keyword.other.preprocessor.haskell',
+                regex: '\\b(?:LANGUAGE|UNPACK|INLINE)\\b' },
+              { defaultToken: 'meta.preprocessor.haskell' } ] } ],
+      '#type_signature': 
+       [ { token: 
+            [ 'meta.class-constraint.haskell',
+              'entity.other.inherited-class.haskell',
+              'meta.class-constraint.haskell',
+              'variable.other.generic-type.haskell',
+              'meta.class-constraint.haskell',
+              'keyword.other.big-arrow.haskell' ],
+           regex: '(\\(\\s*)([A-Z][A-Za-z]*)(\\s+)([a-z][A-Za-z_\']*)(\\)\\s*)(=>)' },
+         { include: '#pragma' },
+         { token: 'keyword.other.arrow.haskell', regex: '->' },
+         { token: 'keyword.other.big-arrow.haskell', regex: '=>' },
+         { token: 'support.type.prelude.haskell',
+           regex: '\\b(?:Int(?:eger)?|Maybe|Either|Bool|Float|Double|Char|String|Ordering|ShowS|ReadS|FilePath|IO(?:Error)?)\\b' },
+         { token: 'variable.other.generic-type.haskell',
+           regex: '\\b[a-z][a-zA-Z0-9_\']*\\b' },
+         { token: 'storage.type.haskell',
+           regex: '\\b[A-Z][a-zA-Z0-9_\']*\\b' },
+         { token: 'support.constant.unit.haskell', regex: '\\(\\)' },
+         { include: '#comments' } ] }
+    
+    this.normalizeRules();
+};
+
+HaskellHighlightRules.metaData = { fileTypes: [ 'hs' ],
+      keyEquivalent: '^~H',
+      name: 'Haskell',
+      scopeName: 'source.haskell' }
+
+
+oop.inherits(HaskellHighlightRules, TextHighlightRules);
+
+exports.HaskellHighlightRules = HaskellHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/haxe.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/haxe.js b/src/fauxton/assets/js/libs/ace/mode/haxe.js
new file mode 100644
index 0000000..138df42
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/haxe.js
@@ -0,0 +1,56 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var HaxeHighlightRules = require("./haxe_highlight_rules").HaxeHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = HaxeHighlightRules;
+    
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new CstyleBehaviour();
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = "//";
+    this.blockComment = {start: "/*", end: "*/"};
+    
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+
+        if (state == "start") {
+            var match = line.match(/^.*[\{\(\[]\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/haxe_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/haxe_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/haxe_highlight_rules.js
new file mode 100644
index 0000000..e995613
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/haxe_highlight_rules.js
@@ -0,0 +1,98 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var HaxeHighlightRules = function() {
+
+    var keywords = (
+        "break|case|cast|catch|class|continue|default|else|enum|extends|for|function|if|implements|import|in|inline|interface|new|override|package|private|public|return|static|super|switch|this|throw|trace|try|typedef|untyped|var|while|Array|Void|Bool|Int|UInt|Float|Dynamic|String|List|Hash|IntHash|Error|Unknown|Type|Std"
+    );
+
+    var buildinConstants = (
+        "null|true|false"
+    );
+
+    var keywordMapper = this.createKeywordMapper({
+        "variable.language": "this",
+        "keyword": keywords,
+        "constant.language": buildinConstants
+    }, "identifier");
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "start" : [
+            {
+                token : "comment",
+                regex : "\\/\\/.*$"
+            },
+            DocCommentHighlightRules.getStartRule("doc-start"),
+            {
+                token : "comment", // multi line comment
+                regex : "\\/\\*",
+                next : "comment"
+            }, {
+                token : "string.regexp",
+                regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
+            }, {
+                token : "string", // single line
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+            }, {
+                token : "string", // single line
+                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+            }, {
+                token : "constant.numeric", // hex
+                regex : "0[xX][0-9a-fA-F]+\\b"
+            }, {
+                token : "constant.numeric", // float
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+            }, {
+                token : "constant.language.boolean",
+                regex : "(?:true|false)\\b"
+            }, {
+                token : keywordMapper,
+                // TODO: Unicode escape sequences
+                // TODO: Unicode identifiers
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+            }, {
+                token : "keyword.operator",
+                regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"
+            }, {
+                token : "punctuation.operator",
+                regex : "\\?|\\:|\\,|\\;|\\."
+            }, {
+                token : "paren.lparen",
+                regex : "[[({<]"
+            }, {
+                token : "paren.rparen",
+                regex : "[\\])}>]"
+            }, {
+                token : "text",
+                regex : "\\s+"
+            }
+        ],
+        "comment" : [
+            {
+                token : "comment", // closing comment
+                regex : ".*?\\*\\/",
+                next : "start"
+            }, {
+                token : "comment", // comment spanning whole line
+                regex : ".+"
+            }
+        ]
+    };
+
+    this.embedRules(DocCommentHighlightRules, "doc-",
+        [ DocCommentHighlightRules.getEndRule("start") ]);
+};
+
+oop.inherits(HaxeHighlightRules, TextHighlightRules);
+
+exports.HaxeHighlightRules = HaxeHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/html.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/html.js b/src/fauxton/assets/js/libs/ace/mode/html.js
new file mode 100644
index 0000000..9085400
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/html.js
@@ -0,0 +1,77 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var JavaScriptMode = require("./javascript").Mode;
+var CssMode = require("./css").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+var HtmlBehaviour = require("./behaviour/html").HtmlBehaviour;
+var HtmlFoldMode = require("./folding/html").FoldMode;
+var HtmlCompletions = require("./html_completions").HtmlCompletions;
+
+var Mode = function() {
+    this.HighlightRules = HtmlHighlightRules;
+    this.$behaviour = new HtmlBehaviour();
+    this.$completer = new HtmlCompletions();
+    
+    this.createModeDelegates({
+        "js-": JavaScriptMode,
+        "css-": CssMode
+    });
+    
+    this.foldingRules = new HtmlFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.blockComment = {start: "<!--", end: "-->"};
+
+    this.getNextLineIndent = function(state, line, tab) {
+        return this.$getIndent(line);
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return false;
+    };
+
+    this.getCompletions = function(state, session, pos, prefix) {
+        return this.$completer.getCompletions(state, session, pos, prefix);
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/html_completions.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/html_completions.js b/src/fauxton/assets/js/libs/ace/mode/html_completions.js
new file mode 100644
index 0000000..283b713
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/html_completions.js
@@ -0,0 +1,313 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var TokenIterator = require("../token_iterator").TokenIterator;
+
+var commonAttributes = [
+    "accesskey",
+    "class",
+    "contenteditable",
+    "contextmenu",
+    "dir",
+    "draggable",
+    "dropzone",
+    "hidden",
+    "id",
+    "lang",
+    "spellcheck",
+    "style",
+    "tabindex",
+    "title",
+    "translate"
+];
+
+var eventAttributes = [
+    "onabort",
+    "onblur",
+    "oncancel",
+    "oncanplay",
+    "oncanplaythrough",
+    "onchange",
+    "onclick",
+    "onclose",
+    "oncontextmenu",
+    "oncuechange",
+    "ondblclick",
+    "ondrag",
+    "ondragend",
+    "ondragenter",
+    "ondragleave",
+    "ondragover",
+    "ondragstart",
+    "ondrop",
+    "ondurationchange",
+    "onemptied",
+    "onended",
+    "onerror",
+    "onfocus",
+    "oninput",
+    "oninvalid",
+    "onkeydown",
+    "onkeypress",
+    "onkeyup",
+    "onload",
+    "onloadeddata",
+    "onloadedmetadata",
+    "onloadstart",
+    "onmousedown",
+    "onmousemove",
+    "onmouseout",
+    "onmouseover",
+    "onmouseup",
+    "onmousewheel",
+    "onpause",
+    "onplay",
+    "onplaying",
+    "onprogress",
+    "onratechange",
+    "onreset",
+    "onscroll",
+    "onseeked",
+    "onseeking",
+    "onselect",
+    "onshow",
+    "onstalled",
+    "onsubmit",
+    "onsuspend",
+    "ontimeupdate",
+    "onvolumechange",
+    "onwaiting"
+];
+
+var globalAttributes = commonAttributes.concat(eventAttributes);
+
+var attributeMap = {
+    "html": ["manifest"],
+    "head": [],
+    "title": [],
+    "base": ["href", "target"],
+    "link": ["href", "hreflang", "rel", "media", "type", "sizes"],
+    "meta": ["http-equiv", "name", "content", "charset"],
+    "style": ["type", "media", "scoped"],
+    "script": ["charset", "type", "src", "defer", "async"],
+    "noscript": ["href"],
+    "body": ["onafterprint", "onbeforeprint", "onbeforeunload", "onhashchange", "onmessage", "onoffline", "onpopstate", "onredo", "onresize", "onstorage", "onundo", "onunload"],
+    "section": [],
+    "nav": [],
+    "article": ["pubdate"],
+    "aside": [],
+    "h1": [],
+    "h2": [],
+    "h3": [],
+    "h4": [],
+    "h5": [],
+    "h6": [],
+    "header": [],
+    "footer": [],
+    "address": [],
+    "main": [],
+    "p": [],
+    "hr": [],
+    "pre": [],
+    "blockquote": ["cite"],
+    "ol": ["start", "reversed"],
+    "ul": [],
+    "li": ["value"],
+    "dl": [],
+    "dt": [],
+    "dd": [],
+    "figure": [],
+    "figcaption": [],
+    "div": [],
+    "a": ["href", "target", "ping", "rel", "media", "hreflang", "type"],
+    "em": [],
+    "strong": [],
+    "small": [],
+    "s": [],
+    "cite": [],
+    "q": ["cite"],
+    "dfn": [],
+    "abbr": [],
+    "data": [],
+    "time": ["datetime"],
+    "code": [],
+    "var": [],
+    "samp": [],
+    "kbd": [],
+    "sub": [],
+    "sup": [],
+    "i": [],
+    "b": [],
+    "u": [],
+    "mark": [],
+    "ruby": [],
+    "rt": [],
+    "rp": [],
+    "bdi": [],
+    "bdo": [],
+    "span": [],
+    "br": [],
+    "wbr": [],
+    "ins": ["cite", "datetime"],
+    "del": ["cite", "datetime"],
+    "img": ["alt", "src", "height", "width", "usemap", "ismap"],
+    "iframe": ["name", "src", "height", "width", "sandbox", "seamless"],
+    "embed": ["src", "height", "width", "type"],
+    "object": ["param", "data", "type", "height" , "width", "usemap", "name", "form", "classid"],
+    "param": ["name", "value"],
+    "video": ["src", "autobuffer", "autoplay", "loop", "controls", "width", "height", "poster"],
+    "audio": ["src", "autobuffer", "autoplay", "loop", "controls"],
+    "source": ["src", "type", "media"],
+    "track": ["kind", "src", "srclang", "label", "default"],
+    "canvas": ["width", "height"],
+    "map": ["name"],
+    "area": ["shape", "coords", "href", "hreflang", "alt", "target", "media", "rel", "ping", "type"],
+    "svg": [],
+    "math": [],
+    "table": ["summary"],
+    "caption": [],
+    "colgroup": ["span"],
+    "col": ["span"],
+    "tbody": [],
+    "thead": [],
+    "tfoot": [],
+    "tr": [],
+    "td": ["headers", "rowspan", "colspan"],
+    "th": ["headers", "rowspan", "colspan", "scope"],
+    "form": ["accept-charset", "action", "autocomplete", "enctype", "method", "name", "novalidate", "target"],
+    "fieldset": ["disabled", "form", "name"],
+    "legend": [],
+    "label": ["form", "for"],
+    "input": ["type", "accept", "alt", "autocomplete", "checked", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "height", "list", "max", "maxlength", "min", "multiple", "pattern", "placeholder", "readonly", "required", "size", "src", "step", "width", "files", "value"],
+    "button": ["autofocus", "disabled", "form", "formaction", "formenctype", "formmethod", "formnovalidate", "formtarget", "name", "value", "type"],
+    "select": ["autofocus", "disabled", "form", "multiple", "name", "size"],
+    "datalist": [],
+    "optgroup": ["disabled", "label"],
+    "option": ["disabled", "selected", "label", "value"],
+    "textarea": ["autofocus", "disabled", "form", "maxlength", "name", "placeholder", "readonly", "required", "rows", "cols", "wrap"],
+    "keygen": ["autofocus", "challenge", "disabled", "form", "keytype", "name"],
+    "output": ["for", "form", "name"],
+    "progress": ["value", "max"],
+    "meter": ["value", "min", "max", "low", "high", "optimum"],
+    "details": ["open"],
+    "summary": [],
+    "command": ["type", "label", "icon", "disabled", "checked", "radiogroup", "command"],
+    "menu": ["type", "label"],
+    "dialog": ["open"]
+};
+
+var allElements = Object.keys(attributeMap);
+
+function hasType(token, type) {
+    var tokenTypes = token.type.split('.');
+    return type.split('.').every(function(type){
+        return (tokenTypes.indexOf(type) !== -1);
+    });
+}
+
+function findTagName(session, pos) {
+    var iterator = new TokenIterator(session, pos.row, pos.column);
+    var token = iterator.getCurrentToken();
+    if (!token || !hasType(token, 'tag') && !(hasType(token, 'text') && token.value.match('/'))){
+        do {
+            token = iterator.stepBackward();
+        } while (token && (hasType(token, 'string') || hasType(token, 'operator') || hasType(token, 'attribute-name') || hasType(token, 'text')));
+    }
+    if (token && hasType(token, 'tag-name') && !iterator.stepBackward().value.match('/'))
+        return token.value;
+}
+
+var HtmlCompletions = function() {
+
+};
+
+(function() {
+
+    this.getCompletions = function(state, session, pos, prefix) {
+        var token = session.getTokenAt(pos.row, pos.column);
+
+        if (!token)
+            return [];
+
+        // tag name
+        if (hasType(token, "tag-name") || (token.value == '<' && hasType(token, "text")))
+            return this.getTagCompletions(state, session, pos, prefix);
+
+        // tag attribute
+        if (hasType(token, 'text') || hasType(token, 'attribute-name'))
+            return this.getAttributeCompetions(state, session, pos, prefix);
+
+        return [];
+    };
+
+    this.getTagCompletions = function(state, session, pos, prefix) {
+        var elements = allElements;
+        if (prefix) {
+            elements = elements.filter(function(element){
+                return element.indexOf(prefix) === 0;
+            });
+        }
+        return elements.map(function(element){
+            return {
+                value: element,
+                meta: "tag"
+            };
+        });
+    };
+
+    this.getAttributeCompetions = function(state, session, pos, prefix) {
+        var tagName = findTagName(session, pos);
+        if (!tagName)
+            return [];
+        var attributes = globalAttributes;
+        if (tagName in attributeMap) {
+            attributes = attributes.concat(attributeMap[tagName]);
+        }
+        if (prefix) {
+            attributes = attributes.filter(function(attribute){
+                return attribute.indexOf(prefix) === 0;
+            });
+        }
+        return attributes.map(function(attribute){
+            return {
+                caption: attribute,
+                snippet: attribute + '="$0"',
+                meta: "attribute"
+            };
+        });
+    };
+
+}).call(HtmlCompletions.prototype);
+
+exports.HtmlCompletions = HtmlCompletions;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/html_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/html_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/html_highlight_rules.js
new file mode 100644
index 0000000..ec63187
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/html_highlight_rules.js
@@ -0,0 +1,123 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules;
+var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
+var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules;
+
+var tagMap = lang.createMap({
+    a           : 'anchor',
+    button 	    : 'form',
+    form        : 'form',
+    img         : 'image',
+    input       : 'form',
+    label       : 'form',
+    option      : 'form',
+    script      : 'script',
+    select      : 'form',
+    textarea    : 'form',
+    style       : 'style',
+    table       : 'table',
+    tbody       : 'table',
+    td          : 'table',
+    tfoot       : 'table',
+    th          : 'table',
+    tr          : 'table'
+});
+
+var HtmlHighlightRules = function() {
+    XmlHighlightRules.call(this);
+
+    this.addRules({
+        attributes: [{
+            include : "space"
+        }, {
+            token : "entity.other.attribute-name",
+            regex : "[-_a-zA-Z0-9:]+"
+        }, {
+            token : "keyword.operator.separator",
+            regex : "=",
+            push : [{
+                include: "space"
+            }, {
+                token : "string",
+                regex : "[^<>='\"`\\s]+",
+                next : "pop"
+            }, {
+                token : "empty",
+                regex : "",
+                next : "pop"
+            }]
+        }, {
+            include : "string"
+        }],
+        tag: [{
+            token : function(start, tag) {
+                var group = tagMap[tag];
+                return ["meta.tag.punctuation.begin",
+                    "meta.tag.name" + (group ? "." + group : "")];
+            },
+            regex : "(<)([-_a-zA-Z0-9:]+)",
+            next: "start_tag_stuff"
+        }, {
+            token : function(start, tag) {
+                var group = tagMap[tag];
+                return ["meta.tag.punctuation.begin",
+                    "meta.tag.name" + (group ? "." + group : "")];
+            },
+            regex : "(</)([-_a-zA-Z0-9:]+)",
+            next: "end_tag_stuff"
+        }],
+        start_tag_stuff: [
+            {include : "attributes"},
+            {token : "meta.tag.punctuation.end", regex : "/?>", next : "start"}
+        ],
+        end_tag_stuff: [
+            {include : "space"},
+            {token : "meta.tag.punctuation.end", regex : ">", next : "start"}
+        ]
+    });
+
+    this.embedTagRules(CssHighlightRules, "css-", "style");
+    this.embedTagRules(JavaScriptHighlightRules, "js-", "script");
+
+    if (this.constructor === HtmlHighlightRules)
+        this.normalizeRules();
+};
+
+oop.inherits(HtmlHighlightRules, XmlHighlightRules);
+
+exports.HtmlHighlightRules = HtmlHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/html_ruby.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/html_ruby.js b/src/fauxton/assets/js/libs/ace/mode/html_ruby.js
new file mode 100644
index 0000000..876f367
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/html_ruby.js
@@ -0,0 +1,59 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var Tokenizer = require("../tokenizer").Tokenizer;
+var HtmlRubyHighlightRules = require("./html_ruby_highlight_rules").HtmlRubyHighlightRules;
+var HtmlMode = require("./html").Mode;
+var JavaScriptMode = require("./javascript").Mode;
+var CssMode = require("./css").Mode;
+var RubyMode = require("./ruby").Mode;
+
+var Mode = function() {
+    HtmlMode.call(this);   
+    this.HighlightRules = HtmlRubyHighlightRules;    
+    this.createModeDelegates({
+        "js-": JavaScriptMode,
+        "css-": CssMode,
+        "ruby-": RubyMode
+    });
+};
+oop.inherits(Mode, HtmlMode);
+
+(function() {
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file


[49/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/config.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/config.js b/src/fauxton/assets/js/libs/ace/config.js
new file mode 100644
index 0000000..f8614c1
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/config.js
@@ -0,0 +1,295 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"no use strict";
+
+var lang = require("./lib/lang");
+var oop = require("./lib/oop");
+var net = require("./lib/net");
+var EventEmitter = require("./lib/event_emitter").EventEmitter;
+
+var global = (function() {
+    return this;
+})();
+
+var options = {
+    packaged: false,
+    workerPath: null,
+    modePath: null,
+    themePath: null,
+    basePath: "",
+    suffix: ".js",
+    $moduleUrls: {}
+};
+
+exports.get = function(key) {
+    if (!options.hasOwnProperty(key))
+        throw new Error("Unknown config key: " + key);
+
+    return options[key];
+};
+
+exports.set = function(key, value) {
+    if (!options.hasOwnProperty(key))
+        throw new Error("Unknown config key: " + key);
+
+    options[key] = value;
+};
+
+exports.all = function() {
+    return lang.copyObject(options);
+};
+
+// module loading
+oop.implement(exports, EventEmitter);
+
+exports.moduleUrl = function(name, component) {
+    if (options.$moduleUrls[name])
+        return options.$moduleUrls[name];
+
+    var parts = name.split("/");
+    component = component || parts[parts.length - 2] || "";
+    
+    // todo make this configurable or get rid of '-'
+    var sep = component == "snippets" ? "/" : "-";
+    var base = parts[parts.length - 1];    
+    if (sep == "-") {
+        var re = new RegExp("^" + component + "[\\-_]|[\\-_]" + component + "$", "g");
+        base = base.replace(re, "");
+    }
+
+    if ((!base || base == component) && parts.length > 1)
+        base = parts[parts.length - 2];
+    var path = options[component + "Path"];
+    if (path == null) {
+        path = options.basePath;
+    } else if (sep == "/") {
+        component = sep = "";
+    }
+    if (path && path.slice(-1) != "/")
+        path += "/";
+    return path + component + sep + base + this.get("suffix");
+};
+
+exports.setModuleUrl = function(name, subst) {
+    return options.$moduleUrls[name] = subst;
+};
+
+exports.$loading = {};
+exports.loadModule = function(moduleName, onLoad) {
+    var module, moduleType;
+    if (Array.isArray(moduleName)) {
+        moduleType = moduleName[0];
+        moduleName = moduleName[1];
+    }
+
+    try {
+        module = require(moduleName);
+    } catch (e) {}
+    // require(moduleName) can return empty object if called after require([moduleName], callback)
+    if (module && !exports.$loading[moduleName])
+        return onLoad && onLoad(module);
+
+    if (!exports.$loading[moduleName])
+        exports.$loading[moduleName] = [];
+
+    exports.$loading[moduleName].push(onLoad);
+
+    if (exports.$loading[moduleName].length > 1)
+        return;
+
+    var afterLoad = function() {
+        require([moduleName], function(module) {
+            exports._emit("load.module", {name: moduleName, module: module});
+            var listeners = exports.$loading[moduleName];
+            exports.$loading[moduleName] = null;
+            listeners.forEach(function(onLoad) {
+                onLoad && onLoad(module);
+            });
+        });
+    };
+
+    if (!exports.get("packaged"))
+        return afterLoad();
+    net.loadScript(exports.moduleUrl(moduleName, moduleType), afterLoad);
+};
+
+
+// initialization
+exports.init = function() {
+    options.packaged = require.packaged || module.packaged || (global.define && define.packaged);
+
+    if (!global.document)
+        return "";
+
+    var scriptOptions = {};
+    var scriptUrl = "";
+
+    var scripts = document.getElementsByTagName("script");
+    for (var i=0; i<scripts.length; i++) {
+        var script = scripts[i];
+
+        var src = script.src || script.getAttribute("src");
+        if (!src)
+            continue;
+
+        var attributes = script.attributes;
+        for (var j=0, l=attributes.length; j < l; j++) {
+            var attr = attributes[j];
+            if (attr.name.indexOf("data-ace-") === 0) {
+                scriptOptions[deHyphenate(attr.name.replace(/^data-ace-/, ""))] = attr.value;
+            }
+        }
+
+        var m = src.match(/^(.*)\/ace(\-\w+)?\.js(\?|$)/);
+        if (m)
+            scriptUrl = m[1];
+    }
+
+    if (scriptUrl) {
+        scriptOptions.base = scriptOptions.base || scriptUrl;
+        scriptOptions.packaged = true;
+    }
+
+    scriptOptions.basePath = scriptOptions.base;
+    scriptOptions.workerPath = scriptOptions.workerPath || scriptOptions.base;
+    scriptOptions.modePath = scriptOptions.modePath || scriptOptions.base;
+    scriptOptions.themePath = scriptOptions.themePath || scriptOptions.base;
+    delete scriptOptions.base;
+
+    for (var key in scriptOptions)
+        if (typeof scriptOptions[key] !== "undefined")
+            exports.set(key, scriptOptions[key]);
+};
+
+function deHyphenate(str) {
+    return str.replace(/-(.)/g, function(m, m1) { return m1.toUpperCase(); });
+}
+
+var optionsProvider = {
+    setOptions: function(optList) {
+        Object.keys(optList).forEach(function(key) {
+            this.setOption(key, optList[key]);
+        }, this);
+    },
+    getOptions: function(optionNames) {
+        var result = {};
+        if (!optionNames) {
+            optionNames = Object.keys(this.$options);
+        } else if (!Array.isArray(optionNames)) {
+            result = optionNames;
+            optionNames = Object.keys(result);
+        }
+        optionNames.forEach(function(key) {
+            result[key] = this.getOption(key);
+        }, this);
+        return result;
+    },
+    setOption: function(name, value) {
+        if (this["$" + name] === value)
+            return;
+        var opt = this.$options[name];
+        if (!opt) {
+            if (typeof console != "undefined" && console.warn)
+                console.warn('misspelled option "' + name + '"');
+            return undefined;
+        }
+        if (opt.forwardTo)
+            return this[opt.forwardTo] && this[opt.forwardTo].setOption(name, value);
+
+        if (!opt.handlesSet)
+            this["$" + name] = value;
+        if (opt && opt.set)
+            opt.set.call(this, value);
+    },
+    getOption: function(name) {
+        var opt = this.$options[name];
+        if (!opt) {
+            if (typeof console != "undefined" && console.warn)
+                console.warn('misspelled option "' + name + '"');
+            return undefined;
+        }
+        if (opt.forwardTo)
+            return this[opt.forwardTo] && this[opt.forwardTo].getOption(name);
+        return opt && opt.get ? opt.get.call(this) : this["$" + name];
+    }
+};
+
+var defaultOptions = {};
+/*
+ * option {name, value, initialValue, setterName, set, get }
+ */
+exports.defineOptions = function(obj, path, options) {
+    if (!obj.$options)
+        defaultOptions[path] = obj.$options = {};
+
+    Object.keys(options).forEach(function(key) {
+        var opt = options[key];
+        if (typeof opt == "string")
+            opt = {forwardTo: opt};
+
+        opt.name || (opt.name = key);
+        obj.$options[opt.name] = opt;
+        if ("initialValue" in opt)
+            obj["$" + opt.name] = opt.initialValue;
+    });
+
+    // implement option provider interface
+    oop.implement(obj, optionsProvider);
+
+    return this;
+};
+
+exports.resetOptions = function(obj) {
+    Object.keys(obj.$options).forEach(function(key) {
+        var opt = obj.$options[key];
+        if ("value" in opt)
+            obj.setOption(key, opt.value);
+    });
+};
+
+exports.setDefaultValue = function(path, name, value) {
+    var opts = defaultOptions[path] || (defaultOptions[path] = {});
+    if (opts[name]) {
+        if (opts.forwardTo)
+            exports.setDefaultValue(opts.forwardTo, name, value);
+        else
+            opts[name].value = value;
+    }
+};
+
+exports.setDefaultValues = function(path, optionHash) {
+    Object.keys(optionHash).forEach(function(key) {
+        exports.setDefaultValue(path, key, optionHash[key]);
+    });
+};
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/config_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/config_test.js b/src/fauxton/assets/js/libs/ace/config_test.js
new file mode 100644
index 0000000..d09a280
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/config_test.js
@@ -0,0 +1,128 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var config = require("./config");
+var assert = require("./test/assertions");
+
+module.exports = {
+
+    "test: path resolution" : function() {
+        config.set("packaged", "true");
+        var url = config.moduleUrl("kr_theme", "theme");
+        assert.equal(url, "theme-kr.js");
+        
+        config.set("basePath", "a/b");
+        url = config.moduleUrl("m/theme", "theme");
+        assert.equal(url, "a/b/theme-m.js");
+        
+        url = config.moduleUrl("m/theme", "ext");
+        assert.equal(url, "a/b/ext-theme.js");
+        
+        config.set("workerPath", "c/");
+        url = config.moduleUrl("foo/1", "worker");
+        assert.equal(url, "c/worker-1.js");
+        
+        config.setModuleUrl("foo/1", "a/b1.js");
+        url = config.moduleUrl("foo/1", "theme");
+        assert.equal(url, "a/b1.js");
+        
+        url = config.moduleUrl("snippets/js");
+        assert.equal(url, "a/b/snippets/js.js");
+        
+        config.setModuleUrl("snippets/js", "_.js");
+        url = config.moduleUrl("snippets/js");
+        assert.equal(url, "_.js");
+        
+        url = config.moduleUrl("ace/ext/textarea");
+        assert.equal(url, "a/b/ext-textarea.js");
+        
+        assert.equal();
+    },
+    "test: define options" : function() {
+        var o = {};
+        config.defineOptions(o, "test_object", {
+            opt1: {
+                set: function(val) {
+                    this.x = val;
+                },
+                value: 7,
+            },
+            initialValue: {
+                set: function(val) {
+                    this.x = val;
+                },
+                initialValue: 8,
+            },
+            opt2: {
+                get: function(val) {
+                    return this.x;
+                }
+            },
+            forwarded: "model"
+        });
+        o.model = {};
+        config.defineOptions(o.model, "model", {
+            forwarded: {value: 1}
+        });
+        
+        config.resetOptions(o);
+        config.resetOptions(o.model);
+        assert.equal(o.getOption("opt1"), 7);
+        assert.equal(o.getOption("opt2"), 7);
+        o.setOption("opt1", 8);
+        assert.equal(o.getOption("opt1"), 8);
+        assert.equal(o.getOption("opt2"), 8);
+        
+        assert.equal(o.getOption("forwarded"), 1);
+        
+        assert.equal(o.getOption("new"), undefined);
+        o.setOption("new", 0);
+        assert.equal(o.getOption("new"), undefined);
+        
+
+        assert.equal(o.getOption("initialValue"), 8);
+        o.setOption("initialValue", 7);
+        assert.equal(o.getOption("opt2"), 7);
+
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/css/codefolding-fold-button-states.png
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/css/codefolding-fold-button-states.png b/src/fauxton/assets/js/libs/ace/css/codefolding-fold-button-states.png
new file mode 100644
index 0000000..439a2a2
Binary files /dev/null and b/src/fauxton/assets/js/libs/ace/css/codefolding-fold-button-states.png differ

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/css/editor.css
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/css/editor.css b/src/fauxton/assets/js/libs/ace/css/editor.css
new file mode 100644
index 0000000..b291c11
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/css/editor.css
@@ -0,0 +1,447 @@
+.ace_editor {
+    position: relative;
+    overflow: hidden;
+    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
+    font-size: 12px;
+    line-height: normal;
+    color: black;
+    -ms-user-select: none;
+    -moz-user-select: none;
+    -webkit-user-select: none;
+    user-select: none;
+}
+
+.ace_scroller {
+    position: absolute;
+    overflow: hidden;
+    top: 0;
+    bottom: 0;
+    background-color: inherit;
+}
+
+.ace_content {
+    position: absolute;
+    -moz-box-sizing: border-box;
+    -webkit-box-sizing: border-box;
+    box-sizing: border-box;
+    cursor: text;
+}
+
+.ace_dragging, .ace_dragging * {
+    cursor: move !important;
+}
+
+.ace_dragging .ace_scroller:before{
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    content: '';
+    background: rgba(250, 250, 250, 0.01);
+    z-index: 1000;
+}
+.ace_dragging.ace_dark .ace_scroller:before{
+    background: rgba(0, 0, 0, 0.01);
+}
+
+.ace_selecting, .ace_selecting * {
+    cursor: text !important;
+}
+
+.ace_gutter {
+    position: absolute;
+    overflow : hidden;
+    width: auto;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    cursor: default;
+    z-index: 4;
+}
+
+.ace_gutter-active-line {
+    position: absolute;
+    left: 0;
+    right: 0;
+}
+
+.ace_scroller.ace_scroll-left {
+    box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;
+}
+
+.ace_gutter-cell {
+    padding-left: 19px;
+    padding-right: 6px;
+    background-repeat: no-repeat;
+}
+
+.ace_gutter-cell.ace_error {
+    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTQ4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTU4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJ
 RD0ieG1wLmlpZDpBQzY4RkNBMjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBMzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PkgXxbAAAAJbSURBVHjapFNNaBNBFH4zs5vdZLP5sQmNpT82QY209heh1ioWisaDRcSKF0WKJ0GQnrzrxasHsR6EnlrwD0TagxJabaVEpFYxLWlLSS822tr87m66ccfd2GKyVhA6MMybgfe97/vmPUQphd0sZjto9XIn9OOsvlu2nkqRzVU+6vvlzPf8W6bk8dxQ0NPbxAALgCgg2JkaQuhzQau/El0zbmUA7U0Es8v2CiYmKQJHGO1QICCLoqilMhkmurDAyapKgqItezi/USRdJqEYY4D5jCy03ht2yMkkvL91jTTX10qzyyu2hruPRN7jgbH+EOsXcMLgYiThEgAMhABW85oqy1DXdRIdvP1AHJ2acQXvDIrVHcdQNrEKNYSVMSZGMjEzIIAwDXIo+6G/FxcGnzkC3T2oMhLjre49sBB+RRcHLqdafK6sYdE/GGBwU1VpFNj0aN8pJbe+BkZyevUrvLl6Xmm0W9IuTc0DxrDNAJd5oEvI/KRsNC3bQyNjPO9yQ1YHcfj2QvfQc/5TUhJTBc2iM0U7AWDQtc1nJHvD/cfO2s7jaGkiTEfa/Ep8coLu7zmNmh8+dc5lZDuUeFAGUNA/OY6JVaypQ0vjr7XYjUvJM37vt+j1vuTK5DgVfVUoTjVe+y3/LxMxY2GgU+CSLy4cpfsYorRXuXIOi0Vt40h67uZFTdIo6nLaZcwUJWAzwNS0tBnqqKzQDnjdG/iPyZxo46HaKUpbvYkj8qYRTZsBhge+JHhZyh0x9b95J
 qjVJkT084kZIPwu/mPWqPgfQ5jXh2+92Ay7HedfAgwA6KDWafb4w3cAAAAASUVORK5CYII=");
+    background-repeat: no-repeat;
+    background-position: 2px center;
+}
+
+.ace_gutter-cell.ace_warning {
+    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTg4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTk4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJ
 RD0ieG1wLmlpZDpBQzY4RkNBNjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBNzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pgd7PfIAAAGmSURBVHjaYvr//z8DJZiJgUIANoCRkREb9gLiSVAaQx4OQM7AAkwd7XU2/v++/rOttdYGEB9dASEvOMydGKfH8Gv/p4XTkvRBfLxeQAP+1cUhXopyvzhP7P/IoSj7g7Mw09cNKO6J1QQ0L4gICPIv/veg/8W+JdFvQNLHVsW9/nmn9zk7B+cCkDwhL7gt6knSZnx9/LuCEOcvkIAMP+cvto9nfqyZmmUAksfnBUtbM60gX/3/kgyv3/xSFOL5DZT+L8vP+Yfh5cvfPvp/xUHyQHXGyAYwgpwBjZYFT3Y1OEl/OfCH4ffv3wzc4iwMvNIsDJ+f/mH4+vIPAxsb631WW0Yln6ZpQLXdMK/DXGDflh+sIv37EivD5x//Gb7+YWT4y86sl7BCCkSD+Z++/1dkvsFRl+HnD1Rvje4F8whjMXmGj58YGf5zsDMwcnAwfPvKcml62DsQDeaDxN+/Y0qwlpEHqrdB94IRNIDUgfgfKJChGK4OikEW3gTiXUB950ASLFAF54AC94A0G9QAfOnmF9DCDzABFqS08IHYDIScdijOjQABBgC+/9awBH96jwAAAABJRU5ErkJggg==");
+    background-position: 2px center;
+}
+
+.ace_gutter-cell.ace_info {
+    background-image: url("data:image/gif;base64,R0lGODlhEAAQAMQAAAAAAEFBQVJSUl5eXmRkZGtra39/f4WFhYmJiZGRkaampry8vMPDw8zMzNXV1dzc3OTk5Orq6vDw8P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABQALAAAAAAQABAAAAUuICWOZGmeaBml5XGwFCQSBGyXRSAwtqQIiRuiwIM5BoYVbEFIyGCQoeJGrVptIQA7");
+    background-position: 2px center;
+}
+.ace_dark .ace_gutter-cell.ace_info {
+    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpGRTk5MTVGREIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpGRTk5MTVGRUIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5j
 ZUlEPSJ4bXAuaWlkOkZFOTkxNUZCQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkZFOTkxNUZDQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+SIDkjAAAAJ1JREFUeNpi/P//PwMlgImBQkB7A6qrq/+DMC55FkIGKCoq4pVnpFkgTp069f/+/fv/r1u37r+tre1/kg0A+ptn9uzZYLaRkRHpLvjw4cNXWVlZhufPnzOcO3eOdAO0tbVPAjHDmzdvGA4fPsxIsgGSkpJmv379Ynj37h2DjIyMCMkG3LhxQ/T27dsMampqDHZ2dq/pH41DxwCAAAMAFdc68dUsFZgAAAAASUVORK5CYII=");
+}
+
+.ace_scrollbar {
+    position: absolute;
+    overflow-x: hidden;
+    overflow-y: auto;
+    right: 0;
+    top: 0;
+    bottom: 0;
+    z-index: 6;
+}
+
+.ace_scrollbar-inner {
+    position: absolute;
+    cursor: text;
+    left: 0;
+    top: 0;
+}
+
+.ace_scrollbar-h {
+    position: absolute;
+    overflow-x: auto;
+    overflow-y: hidden;
+    right: 0;
+    left: 0;
+    bottom: 0;
+    z-index: 6;
+}
+
+.ace_print-margin {
+    position: absolute;
+    height: 100%;
+}
+
+.ace_text-input {
+    position: absolute;
+    z-index: 0;
+    width: 0.5em;
+    height: 1em;
+    opacity: 0;
+    background: transparent;
+    -moz-appearance: none;
+    appearance: none;
+    border: none;
+    resize: none;
+    outline: none;
+    overflow: hidden;
+    font: inherit;
+    padding: 0 1px;
+    margin: 0 -1px;
+    text-indent: -1em;
+}
+
+.ace_text-input.ace_composition {
+    background: #f8f8f8;
+    color: #111;
+    z-index: 1000;
+    opacity: 1;
+    text-indent: 0;
+}
+
+.ace_layer {
+    z-index: 1;
+    position: absolute;
+    overflow: hidden;
+    white-space: nowrap;
+    height: 100%;
+    width: 100%;
+    -moz-box-sizing: border-box;
+    -webkit-box-sizing: border-box;
+    box-sizing: border-box;
+    /* setting pointer-events: auto; on node under the mouse, which changes
+        during scroll, will break mouse wheel scrolling in Safari */
+    pointer-events: none;
+}
+
+.ace_gutter-layer {
+    position: relative;
+    width: auto;
+    text-align: right;
+    pointer-events: auto;
+}
+
+.ace_text-layer {
+    font: inherit !important;
+}
+
+.ace_cjk {
+    display: inline-block;
+    text-align: center;
+}
+
+.ace_cursor-layer {
+    z-index: 4;
+}
+
+.ace_cursor {
+    z-index: 4;
+    position: absolute;
+    -moz-box-sizing: border-box;
+    -webkit-box-sizing: border-box;
+    box-sizing: border-box;
+    border-left: 2px solid
+}
+
+.ace_slim-cursors .ace_cursor {
+    border-left-width: 1px;
+}
+
+.ace_overwrite-cursors .ace_cursor {
+    border-left-width: 0px;
+    border-bottom: 1px solid;
+}
+
+.ace_hidden-cursors .ace_cursor {
+    opacity: 0.2;
+}
+
+.ace_smooth-blinking .ace_cursor {
+       -moz-transition: opacity 0.18s;
+    -webkit-transition: opacity 0.18s;
+         -o-transition: opacity 0.18s;
+        -ms-transition: opacity 0.18s;
+            transition: opacity 0.18s;
+}
+
+.ace_cursor[style*="opacity: 0"]{
+    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
+}
+
+.ace_editor.ace_multiselect .ace_cursor {
+    border-left-width: 1px;
+}
+
+.ace_line {
+    white-space: nowrap;
+}
+
+.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {
+    position: absolute;
+    z-index: 3;
+}
+
+.ace_marker-layer .ace_selection {
+    position: absolute;
+    z-index: 5;
+}
+
+.ace_marker-layer .ace_bracket {
+    position: absolute;
+    z-index: 6;
+}
+
+.ace_marker-layer .ace_active-line {
+    position: absolute;
+    z-index: 2;
+}
+
+.ace_marker-layer .ace_selected-word {
+    position: absolute;
+    z-index: 4;
+    -moz-box-sizing: border-box;
+    -webkit-box-sizing: border-box;
+    box-sizing: border-box;
+}
+
+.ace_line .ace_fold {
+    -moz-box-sizing: border-box;
+    -webkit-box-sizing: border-box;
+    box-sizing: border-box;
+
+    display: inline-block;
+    height: 11px;
+    margin-top: -2px;
+    vertical-align: middle;
+
+    background-image:
+        url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93
 %07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3E
 V%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82"),
+        url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%
 E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB
 %DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%3AIDAT8%11c%FC%FF%FF%7F%18%03%1A%60%01%F2%3F%A0%891%80%04%FF%11-%F8%17%9BJ%E2%05%B1ZD%81v%26t%E7%80%F8%A3%82h%A12%1A%20%A3%01%02%0F%01%BA%25%06%00%19%C0%0D%AEF%D5%3ES%00%00%00%00IEND%AEB%60%82");
+    background-repeat: no-repeat, repeat-x;
+    background-position: center center, top left;
+    color: transparent;
+
+    border: 1px solid black;
+    -moz-border-radius: 2px;
+    -webkit-border-radius: 2px;
+    border-radius: 2px;
+
+    cursor: pointer;
+    pointer-events: auto;
+}
+
+.ace_dark .ace_fold {
+}
+
+.ace_fold:hover{
+    background-image:
+        url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93
 %07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3E
 V%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82"),
+        url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%
 E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB
 %DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%003IDAT8%11c%FC%FF%FF%7F%3E%03%1A%60%01%F2%3F%A3%891%80%04%FFQ%26%F8w%C0%B43%A1%DB%0C%E2%8F%0A%A2%85%CAh%80%8C%06%08%3C%04%E8%96%18%00%A3S%0D%CD%CF%D8%C1%9D%00%00%00%00IEND%AEB%60%82");
+    background-repeat: no-repeat, repeat-x;
+    background-position: center center, top left;
+}
+
+.ace_gutter-tooltip {
+    background-color: #FFF;
+    background-image: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.1));
+    background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));
+    border: 1px solid gray;
+    border-radius: 1px;
+    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
+    color: black;
+    display: inline-block;
+    max-width: 500px;
+    padding: 4px;
+    position: fixed;
+    z-index: 999999;
+    -moz-box-sizing: border-box;
+    -webkit-box-sizing: border-box;
+    box-sizing: border-box;
+    cursor: default;
+    white-space: pre-line;
+    word-wrap: break-word;
+    line-height: normal;
+    font-style: normal;
+    font-weight: normal;
+    letter-spacing: normal;
+}
+
+.ace_folding-enabled > .ace_gutter-cell {
+    padding-right: 13px;
+}
+
+.ace_fold-widget {
+    -moz-box-sizing: border-box;
+    -webkit-box-sizing: border-box;
+    box-sizing: border-box;
+
+    margin: 0 -12px 0 1px;
+    display: none;
+    width: 11px;
+    vertical-align: top;
+
+    background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAe%8A%B1%0D%000%0C%C2%F2%2CK%96%BC%D0%8F9%81%88H%E9%D0%0E%96%C0%10%92%3E%02%80%5E%82%E4%A9*-%EEsw%C8%CC%11%EE%96w%D8%DC%E9*Eh%0C%151(%00%00%00%00IEND%AEB%60%82");
+    background-repeat: no-repeat;
+    background-position: center;
+
+    border-radius: 3px;
+    
+    border: 1px solid transparent;
+    cursor: pointer;
+}
+
+.ace_folding-enabled .ace_fold-widget {
+    display: inline-block;   
+}
+
+.ace_fold-widget.ace_end {
+    background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAm%C7%C1%09%000%08C%D1%8C%ECE%C8E(%8E%EC%02)%1EZJ%F1%C1'%04%07I%E1%E5%EE%CAL%F5%A2%99%99%22%E2%D6%1FU%B5%FE0%D9x%A7%26Wz5%0E%D5%00%00%00%00IEND%AEB%60%82");
+}
+
+.ace_fold-widget.ace_closed {
+    background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%03%00%00%00%06%08%06%00%00%00%06%E5%24%0C%00%00%009IDATx%DA5%CA%C1%09%000%08%03%C0%AC*(%3E%04%C1%0D%BA%B1%23%A4Uh%E0%20%81%C0%CC%F8%82%81%AA%A2%AArGfr%88%08%11%11%1C%DD%7D%E0%EE%5B%F6%F6%CB%B8%05Q%2F%E9tai%D9%00%00%00%00IEND%AEB%60%82");
+}
+
+.ace_fold-widget:hover {
+    border: 1px solid rgba(0, 0, 0, 0.3);
+    background-color: rgba(255, 255, 255, 0.2);
+    -moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
+    -webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
+    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
+}
+
+.ace_fold-widget:active {
+    border: 1px solid rgba(0, 0, 0, 0.4);
+    background-color: rgba(0, 0, 0, 0.05);
+    -moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
+    -webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
+    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
+}
+/**
+ * Dark version for fold widgets
+ */
+.ace_dark .ace_fold-widget {
+    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");
+}
+.ace_dark .ace_fold-widget.ace_end {
+    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");
+}
+.ace_dark .ace_fold-widget.ace_closed {
+    background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");
+}
+.ace_dark .ace_fold-widget:hover {
+    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
+    background-color: rgba(255, 255, 255, 0.1);
+}
+.ace_dark .ace_fold-widget:active {
+    -moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
+    -webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
+    box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
+}
+
+.ace_fold-widget.ace_invalid {
+    background-color: #FFB4B4;
+    border-color: #DE5555;
+}
+
+.ace_fade-fold-widgets .ace_fold-widget {
+       -moz-transition: opacity 0.4s ease 0.05s;
+    -webkit-transition: opacity 0.4s ease 0.05s;
+         -o-transition: opacity 0.4s ease 0.05s;
+        -ms-transition: opacity 0.4s ease 0.05s;
+            transition: opacity 0.4s ease 0.05s;
+    opacity: 0;
+}
+
+.ace_fade-fold-widgets:hover .ace_fold-widget {
+       -moz-transition: opacity 0.05s ease 0.05s;
+    -webkit-transition: opacity 0.05s ease 0.05s;
+         -o-transition: opacity 0.05s ease 0.05s;
+        -ms-transition: opacity 0.05s ease 0.05s;
+            transition: opacity 0.05s ease 0.05s;
+    opacity:1;
+}
+
+.ace_underline {
+    text-decoration: underline;
+}
+
+.ace_bold {
+    font-weight: bold;
+}
+
+.ace_nobold .ace_bold {
+    font-weight: normal;
+}
+
+.ace_italic {
+    font-style: italic;
+}
+
+
+.ace_error-marker {
+    background-color: rgba(255, 0, 0,0.2);
+    position: absolute;
+    z-index: 9;
+}
+
+.ace_highlight-marker {
+    background-color: rgba(255, 255, 0,0.2);
+    position: absolute;
+    z-index: 8;
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/css/expand-marker.png
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/css/expand-marker.png b/src/fauxton/assets/js/libs/ace/css/expand-marker.png
new file mode 100644
index 0000000..535e819
Binary files /dev/null and b/src/fauxton/assets/js/libs/ace/css/expand-marker.png differ

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/document.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/document.js b/src/fauxton/assets/js/libs/ace/document.js
new file mode 100644
index 0000000..75a7920
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/document.js
@@ -0,0 +1,642 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("./lib/oop");
+var EventEmitter = require("./lib/event_emitter").EventEmitter;
+var Range = require("./range").Range;
+var Anchor = require("./anchor").Anchor;
+
+/**
+ * Contains the text of the document. Document can be attached to several [[EditSession `EditSession`]]s. 
+ *
+ * At its core, `Document`s are just an array of strings, with each row in the document matching up to the array index.
+ *
+ * @class Document
+ **/
+
+ /**
+ *
+ * Creates a new `Document`. If `text` is included, the `Document` contains those strings; otherwise, it's empty.
+ * @param {String | Array} text The starting text
+ * @constructor
+ **/
+
+var Document = function(text) {
+    this.$lines = [];
+
+    // There has to be one line at least in the document. If you pass an empty
+    // string to the insert function, nothing will happen. Workaround.
+    if (text.length == 0) {
+        this.$lines = [""];
+    } else if (Array.isArray(text)) {
+        this._insertLines(0, text);
+    } else {
+        this.insert({row: 0, column:0}, text);
+    }
+};
+
+(function() {
+
+    oop.implement(this, EventEmitter);
+
+    /**
+    * Replaces all the lines in the current `Document` with the value of `text`.
+    *
+    * @param {String} text The text to use
+    **/
+    this.setValue = function(text) {
+        var len = this.getLength();
+        this.remove(new Range(0, 0, len, this.getLine(len-1).length));
+        this.insert({row: 0, column:0}, text);
+    };
+
+    /**
+    * Returns all the lines in the document as a single string, joined by the new line character.
+    **/
+    this.getValue = function() {
+        return this.getAllLines().join(this.getNewLineCharacter());
+    };
+
+    /** 
+    * Creates a new `Anchor` to define a floating point in the document.
+    * @param {Number} row The row number to use
+    * @param {Number} column The column number to use
+    *
+    **/
+    this.createAnchor = function(row, column) {
+        return new Anchor(this, row, column);
+    };
+
+    /** 
+    * Splits a string of text on any newline (`\n`) or carriage-return ('\r') characters.
+    *
+    * @method $split
+    * @param {String} text The text to work with
+    * @returns {String} A String array, with each index containing a piece of the original `text` string.
+    *
+    **/
+
+    // check for IE split bug
+    if ("aaa".split(/a/).length == 0)
+        this.$split = function(text) {
+            return text.replace(/\r\n|\r/g, "\n").split("\n");
+        }
+    else
+        this.$split = function(text) {
+            return text.split(/\r\n|\r|\n/);
+        };
+
+
+    this.$detectNewLine = function(text) {
+        var match = text.match(/^.*?(\r\n|\r|\n)/m);
+        this.$autoNewLine = match ? match[1] : "\n";
+    };
+
+    /**
+    * Returns the newline character that's being used, depending on the value of `newLineMode`. 
+    * @returns {String} If `newLineMode == windows`, `\r\n` is returned.  
+    *  If `newLineMode == unix`, `\n` is returned.  
+    *  If `newLineMode == auto`, the value of `autoNewLine` is returned.
+    *
+    **/
+    this.getNewLineCharacter = function() {
+        switch (this.$newLineMode) {
+          case "windows":
+            return "\r\n";
+          case "unix":
+            return "\n";
+          default:
+            return this.$autoNewLine;
+        }
+    };
+
+    this.$autoNewLine = "\n";
+    this.$newLineMode = "auto";
+    /**
+     * [Sets the new line mode.]{: #Document.setNewLineMode.desc}
+     * @param {String} newLineMode [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param}
+     *
+     **/
+    this.setNewLineMode = function(newLineMode) {
+        if (this.$newLineMode === newLineMode)
+            return;
+
+        this.$newLineMode = newLineMode;
+    };
+
+    /**
+    * [Returns the type of newlines being used; either `windows`, `unix`, or `auto`]{: #Document.getNewLineMode}
+    * @returns {String}
+    **/
+    this.getNewLineMode = function() {
+        return this.$newLineMode;
+    };
+
+    /**
+    * Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`).
+    * @param {String} text The text to check
+    *
+    **/
+    this.isNewLine = function(text) {
+        return (text == "\r\n" || text == "\r" || text == "\n");
+    };
+
+    /**
+    * Returns a verbatim copy of the given line as it is in the document
+    * @param {Number} row The row index to retrieve
+    *
+    **/
+    this.getLine = function(row) {
+        return this.$lines[row] || "";
+    };
+
+    /**
+    * Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`.
+    * @param {Number} firstRow The first row index to retrieve
+    * @param {Number} lastRow The final row index to retrieve
+    *
+    **/
+    this.getLines = function(firstRow, lastRow) {
+        return this.$lines.slice(firstRow, lastRow + 1);
+    };
+
+    /**
+    * Returns all lines in the document as string array.
+    **/
+    this.getAllLines = function() {
+        return this.getLines(0, this.getLength());
+    };
+
+    /**
+    * Returns the number of rows in the document.
+    **/
+    this.getLength = function() {
+        return this.$lines.length;
+    };
+
+    /**
+    * [Given a range within the document, this function returns all the text within that range as a single string.]{: #Document.getTextRange.desc}
+    * @param {Range} range The range to work with
+    * 
+    * @returns {String}
+    **/
+    this.getTextRange = function(range) {
+        if (range.start.row == range.end.row) {
+            return this.getLine(range.start.row)
+                .substring(range.start.column, range.end.column);
+        }
+        var lines = this.getLines(range.start.row, range.end.row);
+        lines[0] = (lines[0] || "").substring(range.start.column);
+        var l = lines.length - 1;
+        if (range.end.row - range.start.row == l)
+            lines[l] = lines[l].substring(0, range.end.column);
+        return lines.join(this.getNewLineCharacter());
+    };
+
+    this.$clipPosition = function(position) {
+        var length = this.getLength();
+        if (position.row >= length) {
+            position.row = Math.max(0, length - 1);
+            position.column = this.getLine(length-1).length;
+        } else if (position.row < 0)
+            position.row = 0;
+        return position;
+    };
+
+    /**
+    * Inserts a block of `text` at the indicated `position`.
+    * @param {Object} position The position to start inserting at; it's an object that looks like `{ row: row, column: column}`
+    * @param {String} text A chunk of text to insert
+    * @returns {Object} The position ({row, column}) of the last line of `text`. If the length of `text` is 0, this function simply returns `position`. 
+    *
+    **/
+    this.insert = function(position, text) {
+        if (!text || text.length === 0)
+            return position;
+
+        position = this.$clipPosition(position);
+
+        // only detect new lines if the document has no line break yet
+        if (this.getLength() <= 1)
+            this.$detectNewLine(text);
+
+        var lines = this.$split(text);
+        var firstLine = lines.splice(0, 1)[0];
+        var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0];
+
+        position = this.insertInLine(position, firstLine);
+        if (lastLine !== null) {
+            position = this.insertNewLine(position); // terminate first line
+            position = this._insertLines(position.row, lines);
+            position = this.insertInLine(position, lastLine || "");
+        }
+        return position;
+    };
+
+    /**
+     * Fires whenever the document changes.
+     *
+     * Several methods trigger different `"change"` events. Below is a list of each action type, followed by each property that's also available:
+     *
+     *  * `"insertLines"` (emitted by [[Document.insertLines]])
+     *    * `range`: the [[Range]] of the change within the document
+     *    * `lines`: the lines in the document that are changing
+     *  * `"insertText"` (emitted by [[Document.insertNewLine]])
+     *    * `range`: the [[Range]] of the change within the document
+     *    * `text`: the text that's being added
+     *  * `"removeLines"` (emitted by [[Document.insertLines]])
+     *    * `range`: the [[Range]] of the change within the document
+     *    * `lines`: the lines in the document that were removed
+     *    * `nl`: the new line character (as defined by [[Document.getNewLineCharacter]])
+     *  * `"removeText"` (emitted by [[Document.removeInLine]] and [[Document.removeNewLine]])
+     *    * `range`: the [[Range]] of the change within the document
+     *    * `text`: the text that's being removed
+     *
+     * @event change
+     * @param {Object} e Contains at least one property called `"action"`. `"action"` indicates the action that triggered the change. Each action also has a set of additional properties.
+     *
+     **/
+    /**
+    * Inserts the elements in `lines` into the document, starting at the row index given by `row`. This method also triggers the `'change'` event.
+    * @param {Number} row The index of the row to insert at
+    * @param {Array} lines An array of strings
+    * @returns {Object} Contains the final row and column, like this:  
+    *   ```
+    *   {row: endRow, column: 0}
+    *   ```  
+    *   If `lines` is empty, this function returns an object containing the current row, and column, like this:  
+    *   ``` 
+    *   {row: row, column: 0}
+    *   ```
+    *
+    **/
+    this.insertLines = function(row, lines) {
+        if (row >= this.getLength())
+            return this.insert({row: row, column: 0}, "\n" + lines.join("\n"));
+        return this._insertLines(Math.max(row, 0), lines);
+    };
+    this._insertLines = function(row, lines) {
+        if (lines.length == 0)
+            return {row: row, column: 0};
+
+        // apply doesn't work for big arrays (smallest threshold is on safari 0xFFFF)
+        // to circumvent that we have to break huge inserts into smaller chunks here
+        if (lines.length > 0xFFFF) {
+            var end = this._insertLines(row, lines.slice(0xFFFF));
+            lines = lines.slice(0, 0xFFFF);
+        }
+
+        var args = [row, 0];
+        args.push.apply(args, lines);
+        this.$lines.splice.apply(this.$lines, args);
+
+        var range = new Range(row, 0, row + lines.length, 0);
+        var delta = {
+            action: "insertLines",
+            range: range,
+            lines: lines
+        };
+        this._emit("change", { data: delta });
+        return end || range.end;
+    };
+
+    /**
+    * Inserts a new line into the document at the current row's `position`. This method also triggers the `'change'` event. 
+    * @param {Object} position The position to insert at
+    * @returns {Object} Returns an object containing the final row and column, like this:<br/>
+    *    ```
+    *    {row: endRow, column: 0}
+    *    ```
+    *
+    **/
+    this.insertNewLine = function(position) {
+        position = this.$clipPosition(position);
+        var line = this.$lines[position.row] || "";
+
+        this.$lines[position.row] = line.substring(0, position.column);
+        this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length));
+
+        var end = {
+            row : position.row + 1,
+            column : 0
+        };
+
+        var delta = {
+            action: "insertText",
+            range: Range.fromPoints(position, end),
+            text: this.getNewLineCharacter()
+        };
+        this._emit("change", { data: delta });
+
+        return end;
+    };
+
+    /**
+    * Inserts `text` into the `position` at the current row. This method also triggers the `'change'` event.
+    * @param {Object} position The position to insert at; it's an object that looks like `{ row: row, column: column}`
+    * @param {String} text A chunk of text
+    * @returns {Object} Returns an object containing the final row and column, like this:  
+    *     ```
+    *     {row: endRow, column: 0}
+    *     ```
+    *
+    **/
+    this.insertInLine = function(position, text) {
+        if (text.length == 0)
+            return position;
+
+        var line = this.$lines[position.row] || "";
+
+        this.$lines[position.row] = line.substring(0, position.column) + text
+                + line.substring(position.column);
+
+        var end = {
+            row : position.row,
+            column : position.column + text.length
+        };
+
+        var delta = {
+            action: "insertText",
+            range: Range.fromPoints(position, end),
+            text: text
+        };
+        this._emit("change", { data: delta });
+
+        return end;
+    };
+
+    /**
+    * Removes the `range` from the document.
+    * @param {Range} range A specified Range to remove
+    * @returns {Object} Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`.
+    *
+    **/
+    this.remove = function(range) {
+        if (!range instanceof Range)
+            range = Range.fromPoints(range.start, range.end);
+        // clip to document
+        range.start = this.$clipPosition(range.start);
+        range.end = this.$clipPosition(range.end);
+
+        if (range.isEmpty())
+            return range.start;
+
+        var firstRow = range.start.row;
+        var lastRow = range.end.row;
+
+        if (range.isMultiLine()) {
+            var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1;
+            var lastFullRow = lastRow - 1;
+
+            if (range.end.column > 0)
+                this.removeInLine(lastRow, 0, range.end.column);
+
+            if (lastFullRow >= firstFullRow)
+                this._removeLines(firstFullRow, lastFullRow);
+
+            if (firstFullRow != firstRow) {
+                this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length);
+                this.removeNewLine(range.start.row);
+            }
+        }
+        else {
+            this.removeInLine(firstRow, range.start.column, range.end.column);
+        }
+        return range.start;
+    };
+
+    /**
+    * Removes the specified columns from the `row`. This method also triggers the `'change'` event.
+    * @param {Number} row The row to remove from
+    * @param {Number} startColumn The column to start removing at 
+    * @param {Number} endColumn The column to stop removing at
+    * @returns {Object} Returns an object containing `startRow` and `startColumn`, indicating the new row and column values.<br/>If `startColumn` is equal to `endColumn`, this function returns nothing.
+    *
+    **/
+    this.removeInLine = function(row, startColumn, endColumn) {
+        if (startColumn == endColumn)
+            return;
+
+        var range = new Range(row, startColumn, row, endColumn);
+        var line = this.getLine(row);
+        var removed = line.substring(startColumn, endColumn);
+        var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length);
+        this.$lines.splice(row, 1, newLine);
+
+        var delta = {
+            action: "removeText",
+            range: range,
+            text: removed
+        };
+        this._emit("change", { data: delta });
+        return range.start;
+    };
+
+    /**
+    * Removes a range of full lines. This method also triggers the `'change'` event.
+    * @param {Number} firstRow The first row to be removed
+    * @param {Number} lastRow The last row to be removed
+    * @returns {[String]} Returns all the removed lines.
+    *
+    **/
+    this.removeLines = function(firstRow, lastRow) {
+        if (firstRow < 0 || lastRow >= this.getLength())
+            return this.remove(new Range(firstRow, 0, lastRow + 1, 0));
+        return this._removeLines(firstRow, lastRow);
+    };
+
+    this._removeLines = function(firstRow, lastRow) {
+        var range = new Range(firstRow, 0, lastRow + 1, 0);
+        var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
+
+        var delta = {
+            action: "removeLines",
+            range: range,
+            nl: this.getNewLineCharacter(),
+            lines: removed
+        };
+        this._emit("change", { data: delta });
+        return removed;
+    };
+
+    /**
+    * Removes the new line between `row` and the row immediately following it. This method also triggers the `'change'` event.
+    * @param {Number} row The row to check
+    *
+    **/
+    this.removeNewLine = function(row) {
+        var firstLine = this.getLine(row);
+        var secondLine = this.getLine(row+1);
+
+        var range = new Range(row, firstLine.length, row+1, 0);
+        var line = firstLine + secondLine;
+
+        this.$lines.splice(row, 2, line);
+
+        var delta = {
+            action: "removeText",
+            range: range,
+            text: this.getNewLineCharacter()
+        };
+        this._emit("change", { data: delta });
+    };
+
+    /**
+    * Replaces a range in the document with the new `text`.
+    * @param {Range} range A specified Range to replace
+    * @param {String} text The new text to use as a replacement
+    * @returns {Object} Returns an object containing the final row and column, like this:
+    *     {row: endRow, column: 0}
+    * If the text and range are empty, this function returns an object containing the current `range.start` value.
+    * If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value.
+    *
+    **/
+    this.replace = function(range, text) {
+        if (!range instanceof Range)
+            range = Range.fromPoints(range.start, range.end);
+        if (text.length == 0 && range.isEmpty())
+            return range.start;
+
+        // Shortcut: If the text we want to insert is the same as it is already
+        // in the document, we don't have to replace anything.
+        if (text == this.getTextRange(range))
+            return range.end;
+
+        this.remove(range);
+        if (text) {
+            var end = this.insert(range.start, text);
+        }
+        else {
+            end = range.start;
+        }
+
+        return end;
+    };
+
+    /**
+    * Applies all the changes previously accumulated. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
+    **/
+    this.applyDeltas = function(deltas) {
+        for (var i=0; i<deltas.length; i++) {
+            var delta = deltas[i];
+            var range = Range.fromPoints(delta.range.start, delta.range.end);
+
+            if (delta.action == "insertLines")
+                this.insertLines(range.start.row, delta.lines);
+            else if (delta.action == "insertText")
+                this.insert(range.start, delta.text);
+            else if (delta.action == "removeLines")
+                this._removeLines(range.start.row, range.end.row - 1);
+            else if (delta.action == "removeText")
+                this.remove(range);
+        }
+    };
+
+    /**
+    * Reverts any changes previously applied. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
+    **/
+    this.revertDeltas = function(deltas) {
+        for (var i=deltas.length-1; i>=0; i--) {
+            var delta = deltas[i];
+
+            var range = Range.fromPoints(delta.range.start, delta.range.end);
+
+            if (delta.action == "insertLines")
+                this._removeLines(range.start.row, range.end.row - 1);
+            else if (delta.action == "insertText")
+                this.remove(range);
+            else if (delta.action == "removeLines")
+                this._insertLines(range.start.row, delta.lines);
+            else if (delta.action == "removeText")
+                this.insert(range.start, delta.text);
+        }
+    };
+
+    /**
+     * Converts an index position in a document to a `{row, column}` object.
+     *
+     * Index refers to the "absolute position" of a character in the document. For example:
+     *
+     * ```javascript
+     * var x = 0; // 10 characters, plus one for newline
+     * var y = -1;
+     * ```
+     * 
+     * Here, `y` is an index 15: 11 characters for the first row, and 5 characters until `y` in the second.
+     *
+     * @param {Number} index An index to convert
+     * @param {Number} startRow=0 The row from which to start the conversion
+     * @returns {Object} A `{row, column}` object of the `index` position
+     */
+    this.indexToPosition = function(index, startRow) {
+        var lines = this.$lines || this.getAllLines();
+        var newlineLength = this.getNewLineCharacter().length;
+        for (var i = startRow || 0, l = lines.length; i < l; i++) {
+            index -= lines[i].length + newlineLength;
+            if (index < 0)
+                return {row: i, column: index + lines[i].length + newlineLength};
+        }
+        return {row: l-1, column: lines[l-1].length};
+    };
+
+    /**
+     * Converts the `{row, column}` position in a document to the character's index.
+     *
+     * Index refers to the "absolute position" of a character in the document. For example:
+     *
+     * ```javascript
+     * var x = 0; // 10 characters, plus one for newline
+     * var y = -1;
+     * ```
+     * 
+     * Here, `y` is an index 15: 11 characters for the first row, and 5 characters until `y` in the second.
+     *
+     * @param {Object} pos The `{row, column}` to convert
+     * @param {Number} startRow=0 The row from which to start the conversion
+     * @returns {Number} The index position in the document
+     */
+    this.positionToIndex = function(pos, startRow) {
+        var lines = this.$lines || this.getAllLines();
+        var newlineLength = this.getNewLineCharacter().length;
+        var index = 0;
+        var row = Math.min(pos.row, lines.length);
+        for (var i = startRow || 0; i < row; ++i)
+            index += lines[i].length + newlineLength;
+
+        return index + pos.column;
+    };
+
+}).call(Document.prototype);
+
+exports.Document = Document;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/document_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/document_test.js b/src/fauxton/assets/js/libs/ace/document_test.js
new file mode 100644
index 0000000..5c324db
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/document_test.js
@@ -0,0 +1,306 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+    require("./test/mockdom");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var Document = require("./document").Document;
+var Range = require("./range").Range;
+var assert = require("./test/assertions");
+
+module.exports = {
+
+    "test: insert text in line" : function() {
+        var doc = new Document(["12", "34"]);
+
+        var deltas = [];
+        doc.on("change", function(e) { deltas.push(e.data); });
+
+        doc.insert({row: 0, column: 1}, "juhu");
+        assert.equal(doc.getValue(), ["1juhu2", "34"].join("\n"));
+
+        var d = deltas.concat();
+        doc.revertDeltas(d);
+        assert.equal(doc.getValue(), ["12", "34"].join("\n"));
+
+        doc.applyDeltas(d);
+        assert.equal(doc.getValue(), ["1juhu2", "34"].join("\n"));
+    },
+
+    "test: insert new line" : function() {
+        var doc = new Document(["12", "34"]);
+
+        var deltas = [];
+        doc.on("change", function(e) { deltas.push(e.data); });
+
+        doc.insertNewLine({row: 0, column: 1});
+        assert.equal(doc.getValue(), ["1", "2", "34"].join("\n"));
+
+        var d = deltas.concat();
+        doc.revertDeltas(d);
+        assert.equal(doc.getValue(), ["12", "34"].join("\n"));
+
+        doc.applyDeltas(d);
+        assert.equal(doc.getValue(), ["1", "2", "34"].join("\n"));
+    },
+
+    "test: insert lines at the beginning" : function() {
+        var doc = new Document(["12", "34"]);
+
+        var deltas = [];
+        doc.on("change", function(e) { deltas.push(e.data); });
+
+        doc.insertLines(0, ["aa", "bb"]);
+        assert.equal(doc.getValue(), ["aa", "bb", "12", "34"].join("\n"));
+
+        var d = deltas.concat();
+        doc.revertDeltas(d);
+        assert.equal(doc.getValue(), ["12", "34"].join("\n"));
+
+        doc.applyDeltas(d);
+        assert.equal(doc.getValue(), ["aa", "bb", "12", "34"].join("\n"));
+    },
+
+    "test: insert lines at the end" : function() {
+        var doc = new Document(["12", "34"]);
+
+        var deltas = [];
+        doc.on("change", function(e) { deltas.push(e.data); });
+
+        doc.insertLines(2, ["aa", "bb"]);
+        assert.equal(doc.getValue(), ["12", "34", "aa", "bb"].join("\n"));
+    },
+
+    "test: insert lines in the middle" : function() {
+        var doc = new Document(["12", "34"]);
+
+        var deltas = [];
+        doc.on("change", function(e) { deltas.push(e.data); });
+
+        doc.insertLines(1, ["aa", "bb"]);
+        assert.equal(doc.getValue(), ["12", "aa", "bb", "34"].join("\n"));
+
+        var d = deltas.concat();
+        doc.revertDeltas(d);
+        assert.equal(doc.getValue(), ["12", "34"].join("\n"));
+
+        doc.applyDeltas(d);
+        assert.equal(doc.getValue(), ["12", "aa", "bb", "34"].join("\n"));
+    },
+
+    "test: insert multi line string at the start" : function() {
+        var doc = new Document(["12", "34"]);
+
+        var deltas = [];
+        doc.on("change", function(e) { deltas.push(e.data); });
+
+        doc.insert({row: 0, column: 0}, "aa\nbb\ncc");
+        assert.equal(doc.getValue(), ["aa", "bb", "cc12", "34"].join("\n"));
+
+        var d = deltas.concat();
+        doc.revertDeltas(d);
+        assert.equal(doc.getValue(), ["12", "34"].join("\n"));
+
+        doc.applyDeltas(d);
+        assert.equal(doc.getValue(), ["aa", "bb", "cc12", "34"].join("\n"));
+    },
+
+    "test: insert multi line string at the end" : function() {
+        var doc = new Document(["12", "34"]);
+
+        var deltas = [];
+        doc.on("change", function(e) { deltas.push(e.data); });
+
+        doc.insert({row: 2, column: 0}, "aa\nbb\ncc");
+        assert.equal(doc.getValue(), ["12", "34aa", "bb", "cc"].join("\n"));
+
+        var d = deltas.concat();
+        doc.revertDeltas(d);
+        assert.equal(doc.getValue(), ["12", "34"].join("\n"));
+
+        doc.applyDeltas(d);
+        assert.equal(doc.getValue(), ["12", "34aa", "bb", "cc"].join("\n"));
+    },
+
+    "test: insert multi line string in the middle" : function() {
+        var doc = new Document(["12", "34"]);
+
+        var deltas = [];
+        doc.on("change", function(e) { deltas.push(e.data); });
+
+        doc.insert({row: 0, column: 1}, "aa\nbb\ncc");
+        assert.equal(doc.getValue(), ["1aa", "bb", "cc2", "34"].join("\n"));
+
+        var d = deltas.concat();
+        doc.revertDeltas(d);
+        assert.equal(doc.getValue(), ["12", "34"].join("\n"));
+
+        doc.applyDeltas(d);
+        assert.equal(doc.getValue(), ["1aa", "bb", "cc2", "34"].join("\n"));
+    },
+
+    "test: delete in line" : function() {
+        var doc = new Document(["1234", "5678"]);
+
+        var deltas = [];
+        doc.on("change", function(e) { deltas.push(e.data); });
+
+        doc.remove(new Range(0, 1, 0, 3));
+        assert.equal(doc.getValue(), ["14", "5678"].join("\n"));
+
+        var d = deltas.concat();
+        doc.revertDeltas(d);
+        assert.equal(doc.getValue(), ["1234", "5678"].join("\n"));
+
+        doc.applyDeltas(d);
+        assert.equal(doc.getValue(), ["14", "5678"].join("\n"));
+    },
+
+    "test: delete new line" : function() {
+        var doc = new Document(["1234", "5678"]);
+
+        var deltas = [];
+        doc.on("change", function(e) { deltas.push(e.data); });
+
+        doc.remove(new Range(0, 4, 1, 0));
+        assert.equal(doc.getValue(), ["12345678"].join("\n"));
+
+        var d = deltas.concat();
+        doc.revertDeltas(d);
+        assert.equal(doc.getValue(), ["1234", "5678"].join("\n"));
+
+        doc.applyDeltas(d);
+        assert.equal(doc.getValue(), ["12345678"].join("\n"));
+    },
+
+    "test: delete multi line range line" : function() {
+        var doc = new Document(["1234", "5678", "abcd"]);
+
+        var deltas = [];
+        doc.on("change", function(e) { deltas.push(e.data); });
+
+        doc.remove(new Range(0, 2, 2, 2));
+        assert.equal(doc.getValue(), ["12cd"].join("\n"));
+
+        var d = deltas.concat();
+        doc.revertDeltas(d);
+        assert.equal(doc.getValue(), ["1234", "5678", "abcd"].join("\n"));
+
+        doc.applyDeltas(d);
+        assert.equal(doc.getValue(), ["12cd"].join("\n"));
+    },
+
+    "test: delete full lines" : function() {
+        var doc = new Document(["1234", "5678", "abcd"]);
+
+        var deltas = [];
+        doc.on("change", function(e) { deltas.push(e.data); });
+
+        doc.remove(new Range(1, 0, 3, 0));
+        assert.equal(doc.getValue(), ["1234", ""].join("\n"));
+    },
+
+    "test: remove lines should return the removed lines" : function() {
+        var doc = new Document(["1234", "5678", "abcd"]);
+
+        var removed = doc.removeLines(1, 2);
+        assert.equal(removed.join("\n"), ["5678", "abcd"].join("\n"));
+    },
+
+    "test: should handle unix style new lines" : function() {
+        var doc = new Document(["1", "2", "3"]);
+        assert.equal(doc.getValue(), ["1", "2", "3"].join("\n"));
+    },
+
+    "test: should handle windows style new lines" : function() {
+        var doc = new Document(["1", "2", "3"].join("\r\n"));
+
+        doc.setNewLineMode("unix");
+        assert.equal(doc.getValue(), ["1", "2", "3"].join("\n"));
+    },
+
+    "test: set new line mode to 'windows' should use '\\r\\n' as new lines": function() {
+        var doc = new Document(["1", "2", "3"].join("\n"));
+        doc.setNewLineMode("windows");
+        assert.equal(doc.getValue(), ["1", "2", "3"].join("\r\n"));
+    },
+
+    "test: set new line mode to 'unix' should use '\\n' as new lines": function() {
+        var doc = new Document(["1", "2", "3"].join("\r\n"));
+
+        doc.setNewLineMode("unix");
+        assert.equal(doc.getValue(), ["1", "2", "3"].join("\n"));
+    },
+
+    "test: set new line mode to 'auto' should detect the incoming nl type": function() {
+        var doc = new Document(["1", "2", "3"].join("\n"));
+
+        doc.setNewLineMode("auto");
+        assert.equal(doc.getValue(), ["1", "2", "3"].join("\n"));
+
+        var doc = new Document(["1", "2", "3"].join("\r\n"));
+
+        doc.setNewLineMode("auto");
+        assert.equal(doc.getValue(), ["1", "2", "3"].join("\r\n"));
+
+        doc.replace(new Range(0, 0, 2, 1), ["4", "5", "6"].join("\n"));
+        assert.equal(["4", "5", "6"].join("\n"), doc.getValue());
+    },
+
+    "test: set value": function() {
+        var doc = new Document("1");
+        assert.equal("1", doc.getValue());
+
+        doc.setValue(doc.getValue());
+        assert.equal("1", doc.getValue());
+
+        var doc = new Document("1\n2");
+        assert.equal("1\n2", doc.getValue());
+
+        doc.setValue(doc.getValue());
+        assert.equal("1\n2", doc.getValue());
+    },
+
+    "test: empty document has to contain one line": function() {
+        var doc = new Document("");
+        assert.equal(doc.$lines.length, 1);
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}


[10/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/perl_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/perl_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/perl_highlight_rules.js
new file mode 100644
index 0000000..7c183fe
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/perl_highlight_rules.js
@@ -0,0 +1,165 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var PerlHighlightRules = function() {
+
+    var keywords = (
+        "base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|" +
+         "no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars"
+    );
+
+    var buildinConstants = ("ARGV|ENV|INC|SIG");
+
+    var builtinFunctions = (
+        "getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|" +
+         "gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|" +
+         "getpeername|setpriority|getprotoent|setprotoent|getpriority|" +
+         "endprotoent|getservent|setservent|endservent|sethostent|socketpair|" +
+         "getsockopt|gethostent|endhostent|setsockopt|setnetent|quotemeta|" +
+         "localtime|prototype|getnetent|endnetent|rewinddir|wantarray|getpwuid|" +
+         "closedir|getlogin|readlink|endgrent|getgrgid|getgrnam|shmwrite|" +
+         "shutdown|readline|endpwent|setgrent|readpipe|formline|truncate|" +
+         "dbmclose|syswrite|setpwent|getpwnam|getgrent|getpwent|ucfirst|sysread|" +
+         "setpgrp|shmread|sysseek|sysopen|telldir|defined|opendir|connect|" +
+         "lcfirst|getppid|binmode|syscall|sprintf|getpgrp|readdir|seekdir|" +
+         "waitpid|reverse|unshift|symlink|dbmopen|semget|msgrcv|rename|listen|" +
+         "chroot|msgsnd|shmctl|accept|unpack|exists|fileno|shmget|system|" +
+         "unlink|printf|gmtime|msgctl|semctl|values|rindex|substr|splice|" +
+         "length|msgget|select|socket|return|caller|delete|alarm|ioctl|index|" +
+         "undef|lstat|times|srand|chown|fcntl|close|write|umask|rmdir|study|" +
+         "sleep|chomp|untie|print|utime|mkdir|atan2|split|crypt|flock|chmod|" +
+         "BEGIN|bless|chdir|semop|shift|reset|link|stat|chop|grep|fork|dump|" +
+         "join|open|tell|pipe|exit|glob|warn|each|bind|sort|pack|eval|push|" +
+         "keys|getc|kill|seek|sqrt|send|wait|rand|tied|read|time|exec|recv|" +
+         "eof|chr|int|ord|exp|pos|pop|sin|log|abs|oct|hex|tie|cos|vec|END|ref|" +
+         "map|die|uc|lc|do"
+    );
+
+    var keywordMapper = this.createKeywordMapper({
+        "keyword": keywords,
+        "constant.language": buildinConstants,
+        "support.function": builtinFunctions
+    }, "identifier");
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "start" : [
+            {
+                token : "comment.doc",
+                regex : "^=(?:begin|item)\\b",
+                next : "block_comment"
+            }, {
+                token : "string.regexp",
+                regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"
+            }, {
+                token : "string", // single line
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+            }, {
+                token : "string", // multi line string start
+                regex : '["].*\\\\$',
+                next : "qqstring"
+            }, {
+                token : "string", // single line
+                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+            }, {
+                token : "string", // multi line string start
+                regex : "['].*\\\\$",
+                next : "qstring"
+            }, {
+                token : "constant.numeric", // hex
+                regex : "0x[0-9a-fA-F]+\\b"
+            }, {
+                token : "constant.numeric", // float
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+            }, {
+                token : keywordMapper,
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+            }, {
+                token : "keyword.operator",
+                regex : "%#|\\$#|\\.\\.\\.|\\|\\|=|>>=|<<=|<=>|&&=|=>|!~|\\^=|&=|\\|=|\\.=|x=|%=|\\/=|\\*=|\\-=|\\+=|=~|\\*\\*|\\-\\-|\\.\\.|\\|\\||&&|\\+\\+|\\->|!=|==|>=|<=|>>|<<|,|=|\\?\\:|\\^|\\||x|%|\\/|\\*|<|&|\\\\|~|!|>|\\.|\\-|\\+|\\-C|\\-b|\\-S|\\-u|\\-t|\\-p|\\-l|\\-d|\\-f|\\-g|\\-s|\\-z|\\-k|\\-e|\\-O|\\-T|\\-B|\\-M|\\-A|\\-X|\\-W|\\-c|\\-R|\\-o|\\-x|\\-w|\\-r|\\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)"
+            }, {
+                token : "comment",
+                regex : "#.*$"
+            }, {
+                token : "lparen",
+                regex : "[[({]"
+            }, {
+                token : "rparen",
+                regex : "[\\])}]"
+            }, {
+                token : "text",
+                regex : "\\s+"
+            }
+        ],
+        "qqstring" : [
+            {
+                token : "string",
+                regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
+                next : "start"
+            }, {
+                token : "string",
+                regex : '.+'
+            }
+        ],
+        "qstring" : [
+            {
+                token : "string",
+                regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
+                next : "start"
+            }, {
+                token : "string",
+                regex : '.+'
+            }
+        ],
+        "block_comment": [
+            {
+                token: "comment.doc", 
+                regex: "^=cut\\b",
+                next: "start"
+            },
+            {
+                defaultToken: "comment.doc"
+            }
+        ]
+    };
+};
+
+oop.inherits(PerlHighlightRules, TextHighlightRules);
+
+exports.PerlHighlightRules = PerlHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/pgsql.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/pgsql.js b/src/fauxton/assets/js/libs/ace/mode/pgsql.js
new file mode 100755
index 0000000..cdcf109
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/pgsql.js
@@ -0,0 +1,59 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+
+var oop = require("../lib/oop");
+var TextMode = require("../mode/text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var PgsqlHighlightRules = require("./pgsql_highlight_rules").PgsqlHighlightRules;
+var Range = require("../range").Range;
+
+var Mode = function() {
+    this.HighlightRules = PgsqlHighlightRules;
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = "--";
+    this.blockComment = {start: "/*", end: "*/"};
+
+    this.getNextLineIndent = function(state, line, tab) { 
+        if (state == "start" || state == "keyword.statementEnd") {
+            return "";
+        } else {
+            return this.$getIndent(line); // Keep whatever indent the previous line has
+        }
+    }
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/pgsql_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/pgsql_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/pgsql_highlight_rules.js
new file mode 100755
index 0000000..1e1694e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/pgsql_highlight_rules.js
@@ -0,0 +1,570 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+// Supporting perl and python for now -- both in pg core and ace
+var PerlHighlightRules = require("./perl_highlight_rules").PerlHighlightRules;
+var PythonHighlightRules = require("./python_highlight_rules").PythonHighlightRules;
+
+var PgsqlHighlightRules = function() {
+
+    // Keywords, functions, operators last updated for pg 9.1.
+    var keywords = (
+        "abort|absolute|abstime|access|aclitem|action|add|admin|after|aggregate|all|also|alter|always|" +
+        "analyse|analyze|and|any|anyarray|anyelement|anyenum|anynonarray|array|as|asc|assertion|" +
+        "assignment|asymmetric|at|attribute|authorization|backward|before|begin|between|bigint|" +
+        "binary|bit|bool|boolean|both|box|bpchar|by|bytea|cache|called|cascade|cascaded|case|cast|" +
+        "catalog|chain|char|character|characteristics|check|checkpoint|cid|cidr|circle|class|close|" +
+        "cluster|coalesce|collate|collation|column|comment|comments|commit|committed|concurrently|" +
+        "configuration|connection|constraint|constraints|content|continue|conversion|copy|cost|" +
+        "create|cross|cstring|csv|current|current_catalog|current_date|current_role|" +
+        "current_schema|current_time|current_timestamp|current_user|cursor|cycle|data|database|" +
+        "date|day|deallocate|dec|decimal|declare|default|defaults|deferrable|deferred|definer|delete|" +
+        "delimiter|delimiters|desc|dictionary|disable|discard|distinct|do|document|domain|double|" +
+        "drop|each|else|enable|encoding|encrypted|end|enum|escape|except|exclude|excluding|exclusive|" +
+        "execute|exists|explain|extension|external|extract|false|family|fdw_handler|fetch|first|" +
+        "float|float4|float8|following|for|force|foreign|forward|freeze|from|full|function|functions|" +
+        "global|grant|granted|greatest|group|gtsvector|handler|having|header|hold|hour|identity|if|" +
+        "ilike|immediate|immutable|implicit|in|including|increment|index|indexes|inet|inherit|" +
+        "inherits|initially|inline|inner|inout|input|insensitive|insert|instead|int|int2|int2vector|" +
+        "int4|int8|integer|internal|intersect|interval|into|invoker|is|isnull|isolation|join|key|label|" +
+        "language|language_handler|large|last|lc_collate|lc_ctype|leading|least|left|level|like|" +
+        "limit|line|listen|load|local|localtime|localtimestamp|location|lock|lseg|macaddr|mapping|" +
+        "match|maxvalue|minute|minvalue|mode|money|month|move|name|names|national|natural|nchar|next|no|" +
+        "none|not|nothing|notify|notnull|nowait|null|nullif|nulls|numeric|object|of|off|offset|oid|oids|" +
+        "oidvector|on|only|opaque|operator|option|options|or|order|out|outer|over|overlaps|overlay|" +
+        "owned|owner|parser|partial|partition|passing|password|path|pg_attribute|pg_auth_members|" +
+        "pg_authid|pg_class|pg_database|pg_node_tree|pg_proc|pg_type|placing|plans|point|polygon|" +
+        "position|preceding|precision|prepare|prepared|preserve|primary|prior|privileges|" +
+        "procedural|procedure|quote|range|read|real|reassign|recheck|record|recursive|ref|refcursor|" +
+        "references|regclass|regconfig|regdictionary|regoper|regoperator|regproc|regprocedure|" +
+        "regtype|reindex|relative|release|reltime|rename|repeatable|replace|replica|reset|restart|" +
+        "restrict|returning|returns|revoke|right|role|rollback|row|rows|rule|savepoint|schema|scroll|" +
+        "search|second|security|select|sequence|sequences|serializable|server|session|session_user|" +
+        "set|setof|share|show|similar|simple|smallint|smgr|some|stable|standalone|start|statement|" +
+        "statistics|stdin|stdout|storage|strict|strip|substring|symmetric|sysid|system|table|tables|" +
+        "tablespace|temp|template|temporary|text|then|tid|time|timestamp|timestamptz|timetz|" +
+        "tinterval|to|trailing|transaction|treat|trigger|trim|true|truncate|trusted|tsquery|tsvector|" +
+        "txid_snapshot|type|unbounded|uncommitted|unencrypted|union|unique|unknown|unlisten|" +
+        "unlogged|until|update|user|using|uuid|vacuum|valid|validate|validator|value|values|varbit|" +
+        "varchar|variadic|varying|verbose|version|view|void|volatile|when|where|whitespace|window|" +
+        "with|without|work|wrapper|write|xid|xml|xmlattributes|xmlconcat|xmlelement|xmlexists|" +
+        "xmlforest|xmlparse|xmlpi|xmlroot|xmlserialize|year|yes|zone"
+    );
+
+
+    var builtinFunctions = (
+        "RI_FKey_cascade_del|RI_FKey_cascade_upd|RI_FKey_check_ins|RI_FKey_check_upd|" +
+        "RI_FKey_noaction_del|RI_FKey_noaction_upd|RI_FKey_restrict_del|RI_FKey_restrict_upd|" +
+        "RI_FKey_setdefault_del|RI_FKey_setdefault_upd|RI_FKey_setnull_del|" +
+        "RI_FKey_setnull_upd|abbrev|abs|abstime|abstimeeq|abstimege|abstimegt|abstimein|abstimele|" +
+        "abstimelt|abstimene|abstimeout|abstimerecv|abstimesend|aclcontains|aclexplode|aclinsert|" +
+        "aclitemeq|aclitemin|aclitemout|aclremove|acos|age|any_in|any_out|anyarray_in|anyarray_out|" +
+        "anyarray_recv|anyarray_send|anyelement_in|anyelement_out|anyenum_in|anyenum_out|" +
+        "anynonarray_in|anynonarray_out|anytextcat|area|areajoinsel|areasel|array_agg|" +
+        "array_agg_finalfn|array_agg_transfn|array_append|array_cat|array_dims|array_eq|" +
+        "array_fill|array_ge|array_gt|array_in|array_larger|array_le|array_length|array_lower|" +
+        "array_lt|array_ndims|array_ne|array_out|array_prepend|array_recv|array_send|" +
+        "array_smaller|array_to_string|array_upper|arraycontained|arraycontains|arrayoverlap|" +
+        "ascii|ascii_to_mic|ascii_to_utf8|asin|atan|atan2|avg|big5_to_euc_tw|big5_to_mic|" +
+        "big5_to_utf8|bit_and|bit_in|bit_length|bit_or|bit_out|bit_recv|bit_send|bitand|bitcat|" +
+        "bitcmp|biteq|bitge|bitgt|bitle|bitlt|bitne|bitnot|bitor|bitshiftleft|bitshiftright|" +
+        "bittypmodin|bittypmodout|bitxor|bool|bool_and|bool_or|booland_statefunc|booleq|boolge|" +
+        "boolgt|boolin|boolle|boollt|boolne|boolor_statefunc|boolout|boolrecv|boolsend|box|" +
+        "box_above|box_above_eq|box_add|box_below|box_below_eq|box_center|box_contain|" +
+        "box_contain_pt|box_contained|box_distance|box_div|box_eq|box_ge|box_gt|box_in|" +
+        "box_intersect|box_le|box_left|box_lt|box_mul|box_out|box_overabove|box_overbelow|" +
+        "box_overlap|box_overleft|box_overright|box_recv|box_right|box_same|box_send|box_sub|" +
+        "bpchar_larger|bpchar_pattern_ge|bpchar_pattern_gt|bpchar_pattern_le|" +
+        "bpchar_pattern_lt|bpchar_smaller|bpcharcmp|bpchareq|bpcharge|bpchargt|bpchariclike|" +
+        "bpcharicnlike|bpcharicregexeq|bpcharicregexne|bpcharin|bpcharle|bpcharlike|bpcharlt|" +
+        "bpcharne|bpcharnlike|bpcharout|bpcharrecv|bpcharregexeq|bpcharregexne|bpcharsend|" +
+        "bpchartypmodin|bpchartypmodout|broadcast|btabstimecmp|btarraycmp|btbeginscan|btboolcmp|" +
+        "btbpchar_pattern_cmp|btbuild|btbuildempty|btbulkdelete|btcharcmp|btcostestimate|" +
+        "btendscan|btfloat48cmp|btfloat4cmp|btfloat84cmp|btfloat8cmp|btgetbitmap|btgettuple|" +
+        "btinsert|btint24cmp|btint28cmp|btint2cmp|btint42cmp|btint48cmp|btint4cmp|btint82cmp|" +
+        "btint84cmp|btint8cmp|btmarkpos|btnamecmp|btoidcmp|btoidvectorcmp|btoptions|btrecordcmp|" +
+        "btreltimecmp|btrescan|btrestrpos|btrim|bttext_pattern_cmp|bttextcmp|bttidcmp|" +
+        "bttintervalcmp|btvacuumcleanup|byteacat|byteacmp|byteaeq|byteage|byteagt|byteain|byteale|" +
+        "bytealike|bytealt|byteane|byteanlike|byteaout|bytearecv|byteasend|cash_cmp|cash_div_cash|" +
+        "cash_div_flt4|cash_div_flt8|cash_div_int2|cash_div_int4|cash_eq|cash_ge|cash_gt|cash_in|" +
+        "cash_le|cash_lt|cash_mi|cash_mul_flt4|cash_mul_flt8|cash_mul_int2|cash_mul_int4|cash_ne|" +
+        "cash_out|cash_pl|cash_recv|cash_send|cash_words|cashlarger|cashsmaller|cbrt|ceil|ceiling|" +
+        "center|char|char_length|character_length|chareq|charge|chargt|charin|charle|charlt|charne|" +
+        "charout|charrecv|charsend|chr|cideq|cidin|cidout|cidr|cidr_in|cidr_out|cidr_recv|cidr_send|" +
+        "cidrecv|cidsend|circle|circle_above|circle_add_pt|circle_below|circle_center|" +
+        "circle_contain|circle_contain_pt|circle_contained|circle_distance|circle_div_pt|" +
+        "circle_eq|circle_ge|circle_gt|circle_in|circle_le|circle_left|circle_lt|circle_mul_pt|" +
+        "circle_ne|circle_out|circle_overabove|circle_overbelow|circle_overlap|circle_overleft|" +
+        "circle_overright|circle_recv|circle_right|circle_same|circle_send|circle_sub_pt|" +
+        "clock_timestamp|close_lb|close_ls|close_lseg|close_pb|close_pl|close_ps|close_sb|" +
+        "close_sl|col_description|concat|concat_ws|contjoinsel|contsel|convert|convert_from|" +
+        "convert_to|corr|cos|cot|count|covar_pop|covar_samp|cstring_in|cstring_out|cstring_recv|" +
+        "cstring_send|cume_dist|current_database|current_query|current_schema|current_schemas|" +
+        "current_setting|current_user|currtid|currtid2|currval|cursor_to_xml|" +
+        "cursor_to_xmlschema|database_to_xml|database_to_xml_and_xmlschema|" +
+        "database_to_xmlschema|date|date_cmp|date_cmp_timestamp|date_cmp_timestamptz|date_eq|" +
+        "date_eq_timestamp|date_eq_timestamptz|date_ge|date_ge_timestamp|date_ge_timestamptz|" +
+        "date_gt|date_gt_timestamp|date_gt_timestamptz|date_in|date_larger|date_le|" +
+        "date_le_timestamp|date_le_timestamptz|date_lt|date_lt_timestamp|date_lt_timestamptz|" +
+        "date_mi|date_mi_interval|date_mii|date_ne|date_ne_timestamp|date_ne_timestamptz|" +
+        "date_out|date_part|date_pl_interval|date_pli|date_recv|date_send|date_smaller|" +
+        "date_trunc|datetime_pl|datetimetz_pl|dcbrt|decode|degrees|dense_rank|dexp|diagonal|" +
+        "diameter|dispell_init|dispell_lexize|dist_cpoly|dist_lb|dist_pb|dist_pc|dist_pl|" +
+        "dist_ppath|dist_ps|dist_sb|dist_sl|div|dlog1|dlog10|domain_in|domain_recv|dpow|dround|" +
+        "dsimple_init|dsimple_lexize|dsnowball_init|dsnowball_lexize|dsqrt|dsynonym_init|" +
+        "dsynonym_lexize|dtrunc|encode|enum_cmp|enum_eq|enum_first|enum_ge|enum_gt|enum_in|" +
+        "enum_larger|enum_last|enum_le|enum_lt|enum_ne|enum_out|enum_range|enum_recv|enum_send|" +
+        "enum_smaller|eqjoinsel|eqsel|euc_cn_to_mic|euc_cn_to_utf8|" +
+        "euc_jis_2004_to_shift_jis_2004|euc_jis_2004_to_utf8|euc_jp_to_mic|euc_jp_to_sjis|" +
+        "euc_jp_to_utf8|euc_kr_to_mic|euc_kr_to_utf8|euc_tw_to_big5|euc_tw_to_mic|" +
+        "euc_tw_to_utf8|every|exp|factorial|family|fdw_handler_in|fdw_handler_out|first_value|" +
+        "float4|float48div|float48eq|float48ge|float48gt|float48le|float48lt|float48mi|float48mul|" +
+        "float48ne|float48pl|float4_accum|float4abs|float4div|float4eq|float4ge|float4gt|float4in|" +
+        "float4larger|float4le|float4lt|float4mi|float4mul|float4ne|float4out|float4pl|float4recv|" +
+        "float4send|float4smaller|float4um|float4up|float8|float84div|float84eq|float84ge|" +
+        "float84gt|float84le|float84lt|float84mi|float84mul|float84ne|float84pl|float8_accum|" +
+        "float8_avg|float8_corr|float8_covar_pop|float8_covar_samp|float8_regr_accum|" +
+        "float8_regr_avgx|float8_regr_avgy|float8_regr_intercept|float8_regr_r2|" +
+        "float8_regr_slope|float8_regr_sxx|float8_regr_sxy|float8_regr_syy|float8_stddev_pop|" +
+        "float8_stddev_samp|float8_var_pop|float8_var_samp|float8abs|float8div|float8eq|" +
+        "float8ge|float8gt|float8in|float8larger|float8le|float8lt|float8mi|float8mul|float8ne|" +
+        "float8out|float8pl|float8recv|float8send|float8smaller|float8um|float8up|floor|" +
+        "flt4_mul_cash|flt8_mul_cash|fmgr_c_validator|fmgr_internal_validator|" +
+        "fmgr_sql_validator|format|format_type|gb18030_to_utf8|gbk_to_utf8|generate_series|" +
+        "generate_subscripts|get_bit|get_byte|get_current_ts_config|getdatabaseencoding|" +
+        "getpgusername|gin_cmp_prefix|gin_cmp_tslexeme|gin_extract_tsquery|" +
+        "gin_extract_tsvector|gin_tsquery_consistent|ginarrayconsistent|ginarrayextract|" +
+        "ginbeginscan|ginbuild|ginbuildempty|ginbulkdelete|gincostestimate|ginendscan|" +
+        "gingetbitmap|gininsert|ginmarkpos|ginoptions|ginqueryarrayextract|ginrescan|" +
+        "ginrestrpos|ginvacuumcleanup|gist_box_compress|gist_box_consistent|" +
+        "gist_box_decompress|gist_box_penalty|gist_box_picksplit|gist_box_same|gist_box_union|" +
+        "gist_circle_compress|gist_circle_consistent|gist_point_compress|" +
+        "gist_point_consistent|gist_point_distance|gist_poly_compress|gist_poly_consistent|" +
+        "gistbeginscan|gistbuild|gistbuildempty|gistbulkdelete|gistcostestimate|gistendscan|" +
+        "gistgetbitmap|gistgettuple|gistinsert|gistmarkpos|gistoptions|gistrescan|gistrestrpos|" +
+        "gistvacuumcleanup|gtsquery_compress|gtsquery_consistent|gtsquery_decompress|" +
+        "gtsquery_penalty|gtsquery_picksplit|gtsquery_same|gtsquery_union|gtsvector_compress|" +
+        "gtsvector_consistent|gtsvector_decompress|gtsvector_penalty|gtsvector_picksplit|" +
+        "gtsvector_same|gtsvector_union|gtsvectorin|gtsvectorout|has_any_column_privilege|" +
+        "has_column_privilege|has_database_privilege|has_foreign_data_wrapper_privilege|" +
+        "has_function_privilege|has_language_privilege|has_schema_privilege|" +
+        "has_sequence_privilege|has_server_privilege|has_table_privilege|" +
+        "has_tablespace_privilege|hash_aclitem|hash_array|hash_numeric|hashbeginscan|" +
+        "hashbpchar|hashbuild|hashbuildempty|hashbulkdelete|hashchar|hashcostestimate|" +
+        "hashendscan|hashenum|hashfloat4|hashfloat8|hashgetbitmap|hashgettuple|hashinet|" +
+        "hashinsert|hashint2|hashint2vector|hashint4|hashint8|hashmacaddr|hashmarkpos|hashname|" +
+        "hashoid|hashoidvector|hashoptions|hashrescan|hashrestrpos|hashtext|hashvacuumcleanup|" +
+        "hashvarlena|height|host|hostmask|iclikejoinsel|iclikesel|icnlikejoinsel|icnlikesel|" +
+        "icregexeqjoinsel|icregexeqsel|icregexnejoinsel|icregexnesel|inet_client_addr|" +
+        "inet_client_port|inet_in|inet_out|inet_recv|inet_send|inet_server_addr|" +
+        "inet_server_port|inetand|inetmi|inetmi_int8|inetnot|inetor|inetpl|initcap|int2|int24div|" +
+        "int24eq|int24ge|int24gt|int24le|int24lt|int24mi|int24mul|int24ne|int24pl|int28div|int28eq|" +
+        "int28ge|int28gt|int28le|int28lt|int28mi|int28mul|int28ne|int28pl|int2_accum|" +
+        "int2_avg_accum|int2_mul_cash|int2_sum|int2abs|int2and|int2div|int2eq|int2ge|int2gt|int2in|" +
+        "int2larger|int2le|int2lt|int2mi|int2mod|int2mul|int2ne|int2not|int2or|int2out|int2pl|" +
+        "int2recv|int2send|int2shl|int2shr|int2smaller|int2um|int2up|int2vectoreq|int2vectorin|" +
+        "int2vectorout|int2vectorrecv|int2vectorsend|int2xor|int4|int42div|int42eq|int42ge|" +
+        "int42gt|int42le|int42lt|int42mi|int42mul|int42ne|int42pl|int48div|int48eq|int48ge|int48gt|" +
+        "int48le|int48lt|int48mi|int48mul|int48ne|int48pl|int4_accum|int4_avg_accum|int4_mul_cash|" +
+        "int4_sum|int4abs|int4and|int4div|int4eq|int4ge|int4gt|int4in|int4inc|int4larger|int4le|" +
+        "int4lt|int4mi|int4mod|int4mul|int4ne|int4not|int4or|int4out|int4pl|int4recv|int4send|" +
+        "int4shl|int4shr|int4smaller|int4um|int4up|int4xor|int8|int82div|int82eq|int82ge|int82gt|" +
+        "int82le|int82lt|int82mi|int82mul|int82ne|int82pl|int84div|int84eq|int84ge|int84gt|int84le|" +
+        "int84lt|int84mi|int84mul|int84ne|int84pl|int8_accum|int8_avg|int8_avg_accum|int8_sum|" +
+        "int8abs|int8and|int8div|int8eq|int8ge|int8gt|int8in|int8inc|int8inc_any|" +
+        "int8inc_float8_float8|int8larger|int8le|int8lt|int8mi|int8mod|int8mul|int8ne|int8not|" +
+        "int8or|int8out|int8pl|int8pl_inet|int8recv|int8send|int8shl|int8shr|int8smaller|int8um|" +
+        "int8up|int8xor|integer_pl_date|inter_lb|inter_sb|inter_sl|internal_in|internal_out|" +
+        "interval_accum|interval_avg|interval_cmp|interval_div|interval_eq|interval_ge|" +
+        "interval_gt|interval_hash|interval_in|interval_larger|interval_le|interval_lt|" +
+        "interval_mi|interval_mul|interval_ne|interval_out|interval_pl|interval_pl_date|" +
+        "interval_pl_time|interval_pl_timestamp|interval_pl_timestamptz|interval_pl_timetz|" +
+        "interval_recv|interval_send|interval_smaller|interval_um|intervaltypmodin|" +
+        "intervaltypmodout|intinterval|isclosed|isfinite|ishorizontal|iso8859_1_to_utf8|" +
+        "iso8859_to_utf8|iso_to_koi8r|iso_to_mic|iso_to_win1251|iso_to_win866|isopen|isparallel|" +
+        "isperp|isvertical|johab_to_utf8|justify_days|justify_hours|justify_interval|" +
+        "koi8r_to_iso|koi8r_to_mic|koi8r_to_utf8|koi8r_to_win1251|koi8r_to_win866|" +
+        "koi8u_to_utf8|lag|language_handler_in|language_handler_out|last_value|lastval|" +
+        "latin1_to_mic|latin2_to_mic|latin2_to_win1250|latin3_to_mic|latin4_to_mic|lead|left|" +
+        "length|like|like_escape|likejoinsel|likesel|line|line_distance|line_eq|line_horizontal|" +
+        "line_in|line_interpt|line_intersect|line_out|line_parallel|line_perp|line_recv|" +
+        "line_send|line_vertical|ln|lo_close|lo_creat|lo_create|lo_export|lo_import|lo_lseek|" +
+        "lo_open|lo_tell|lo_truncate|lo_unlink|log|loread|lower|lowrite|lpad|lseg|lseg_center|" +
+        "lseg_distance|lseg_eq|lseg_ge|lseg_gt|lseg_horizontal|lseg_in|lseg_interpt|" +
+        "lseg_intersect|lseg_le|lseg_length|lseg_lt|lseg_ne|lseg_out|lseg_parallel|lseg_perp|" +
+        "lseg_recv|lseg_send|lseg_vertical|ltrim|macaddr_cmp|macaddr_eq|macaddr_ge|macaddr_gt|" +
+        "macaddr_in|macaddr_le|macaddr_lt|macaddr_ne|macaddr_out|macaddr_recv|macaddr_send|" +
+        "makeaclitem|masklen|max|md5|mic_to_ascii|mic_to_big5|mic_to_euc_cn|mic_to_euc_jp|" +
+        "mic_to_euc_kr|mic_to_euc_tw|mic_to_iso|mic_to_koi8r|mic_to_latin1|mic_to_latin2|" +
+        "mic_to_latin3|mic_to_latin4|mic_to_sjis|mic_to_win1250|mic_to_win1251|mic_to_win866|" +
+        "min|mktinterval|mod|money|mul_d_interval|name|nameeq|namege|namegt|nameiclike|nameicnlike|" +
+        "nameicregexeq|nameicregexne|namein|namele|namelike|namelt|namene|namenlike|nameout|" +
+        "namerecv|nameregexeq|nameregexne|namesend|neqjoinsel|neqsel|netmask|network|network_cmp|" +
+        "network_eq|network_ge|network_gt|network_le|network_lt|network_ne|network_sub|" +
+        "network_subeq|network_sup|network_supeq|nextval|nlikejoinsel|nlikesel|notlike|now|" +
+        "npoints|nth_value|ntile|numeric_abs|numeric_accum|numeric_add|numeric_avg|" +
+        "numeric_avg_accum|numeric_cmp|numeric_div|numeric_div_trunc|numeric_eq|numeric_exp|" +
+        "numeric_fac|numeric_ge|numeric_gt|numeric_in|numeric_inc|numeric_larger|numeric_le|" +
+        "numeric_ln|numeric_log|numeric_lt|numeric_mod|numeric_mul|numeric_ne|numeric_out|" +
+        "numeric_power|numeric_recv|numeric_send|numeric_smaller|numeric_sqrt|" +
+        "numeric_stddev_pop|numeric_stddev_samp|numeric_sub|numeric_uminus|numeric_uplus|" +
+        "numeric_var_pop|numeric_var_samp|numerictypmodin|numerictypmodout|numnode|" +
+        "obj_description|octet_length|oid|oideq|oidge|oidgt|oidin|oidlarger|oidle|oidlt|oidne|oidout|" +
+        "oidrecv|oidsend|oidsmaller|oidvectoreq|oidvectorge|oidvectorgt|oidvectorin|oidvectorle|" +
+        "oidvectorlt|oidvectorne|oidvectorout|oidvectorrecv|oidvectorsend|oidvectortypes|on_pb|" +
+        "on_pl|on_ppath|on_ps|on_sb|on_sl|opaque_in|opaque_out|overlaps|overlay|path|path_add|" +
+        "path_add_pt|path_center|path_contain_pt|path_distance|path_div_pt|path_in|path_inter|" +
+        "path_length|path_mul_pt|path_n_eq|path_n_ge|path_n_gt|path_n_le|path_n_lt|path_npoints|" +
+        "path_out|path_recv|path_send|path_sub_pt|pclose|percent_rank|pg_advisory_lock|" +
+        "pg_advisory_lock_shared|pg_advisory_unlock|pg_advisory_unlock_all|" +
+        "pg_advisory_unlock_shared|pg_advisory_xact_lock|pg_advisory_xact_lock_shared|" +
+        "pg_available_extension_versions|pg_available_extensions|pg_backend_pid|" +
+        "pg_cancel_backend|pg_char_to_encoding|pg_client_encoding|pg_collation_is_visible|" +
+        "pg_column_size|pg_conf_load_time|pg_conversion_is_visible|pg_create_restore_point|" +
+        "pg_current_xlog_insert_location|pg_current_xlog_location|pg_cursor|pg_database_size|" +
+        "pg_describe_object|pg_encoding_max_length|pg_encoding_to_char|" +
+        "pg_extension_config_dump|pg_extension_update_paths|pg_function_is_visible|" +
+        "pg_get_constraintdef|pg_get_expr|pg_get_function_arguments|" +
+        "pg_get_function_identity_arguments|pg_get_function_result|pg_get_functiondef|" +
+        "pg_get_indexdef|pg_get_keywords|pg_get_ruledef|pg_get_serial_sequence|" +
+        "pg_get_triggerdef|pg_get_userbyid|pg_get_viewdef|pg_has_role|pg_indexes_size|" +
+        "pg_is_in_recovery|pg_is_other_temp_schema|pg_is_xlog_replay_paused|" +
+        "pg_last_xact_replay_timestamp|pg_last_xlog_receive_location|" +
+        "pg_last_xlog_replay_location|pg_listening_channels|pg_lock_status|pg_ls_dir|" +
+        "pg_my_temp_schema|pg_node_tree_in|pg_node_tree_out|pg_node_tree_recv|" +
+        "pg_node_tree_send|pg_notify|pg_opclass_is_visible|pg_operator_is_visible|" +
+        "pg_options_to_table|pg_postmaster_start_time|pg_prepared_statement|pg_prepared_xact|" +
+        "pg_read_binary_file|pg_read_file|pg_relation_filenode|pg_relation_filepath|" +
+        "pg_relation_size|pg_reload_conf|pg_rotate_logfile|pg_sequence_parameters|" +
+        "pg_show_all_settings|pg_size_pretty|pg_sleep|pg_start_backup|pg_stat_clear_snapshot|" +
+        "pg_stat_file|pg_stat_get_activity|pg_stat_get_analyze_count|" +
+        "pg_stat_get_autoanalyze_count|pg_stat_get_autovacuum_count|" +
+        "pg_stat_get_backend_activity|pg_stat_get_backend_activity_start|" +
+        "pg_stat_get_backend_client_addr|pg_stat_get_backend_client_port|" +
+        "pg_stat_get_backend_dbid|pg_stat_get_backend_idset|pg_stat_get_backend_pid|" +
+        "pg_stat_get_backend_start|pg_stat_get_backend_userid|pg_stat_get_backend_waiting|" +
+        "pg_stat_get_backend_xact_start|pg_stat_get_bgwriter_buf_written_checkpoints|" +
+        "pg_stat_get_bgwriter_buf_written_clean|pg_stat_get_bgwriter_maxwritten_clean|" +
+        "pg_stat_get_bgwriter_requested_checkpoints|pg_stat_get_bgwriter_stat_reset_time|" +
+        "pg_stat_get_bgwriter_timed_checkpoints|pg_stat_get_blocks_fetched|" +
+        "pg_stat_get_blocks_hit|pg_stat_get_buf_alloc|pg_stat_get_buf_fsync_backend|" +
+        "pg_stat_get_buf_written_backend|pg_stat_get_db_blocks_fetched|" +
+        "pg_stat_get_db_blocks_hit|pg_stat_get_db_conflict_all|" +
+        "pg_stat_get_db_conflict_bufferpin|pg_stat_get_db_conflict_lock|" +
+        "pg_stat_get_db_conflict_snapshot|pg_stat_get_db_conflict_startup_deadlock|" +
+        "pg_stat_get_db_conflict_tablespace|pg_stat_get_db_numbackends|" +
+        "pg_stat_get_db_stat_reset_time|pg_stat_get_db_tuples_deleted|" +
+        "pg_stat_get_db_tuples_fetched|pg_stat_get_db_tuples_inserted|" +
+        "pg_stat_get_db_tuples_returned|pg_stat_get_db_tuples_updated|" +
+        "pg_stat_get_db_xact_commit|pg_stat_get_db_xact_rollback|pg_stat_get_dead_tuples|" +
+        "pg_stat_get_function_calls|pg_stat_get_function_self_time|" +
+        "pg_stat_get_function_time|pg_stat_get_last_analyze_time|" +
+        "pg_stat_get_last_autoanalyze_time|pg_stat_get_last_autovacuum_time|" +
+        "pg_stat_get_last_vacuum_time|pg_stat_get_live_tuples|pg_stat_get_numscans|" +
+        "pg_stat_get_tuples_deleted|pg_stat_get_tuples_fetched|" +
+        "pg_stat_get_tuples_hot_updated|pg_stat_get_tuples_inserted|" +
+        "pg_stat_get_tuples_returned|pg_stat_get_tuples_updated|pg_stat_get_vacuum_count|" +
+        "pg_stat_get_wal_senders|pg_stat_get_xact_blocks_fetched|" +
+        "pg_stat_get_xact_blocks_hit|pg_stat_get_xact_function_calls|" +
+        "pg_stat_get_xact_function_self_time|pg_stat_get_xact_function_time|" +
+        "pg_stat_get_xact_numscans|pg_stat_get_xact_tuples_deleted|" +
+        "pg_stat_get_xact_tuples_fetched|pg_stat_get_xact_tuples_hot_updated|" +
+        "pg_stat_get_xact_tuples_inserted|pg_stat_get_xact_tuples_returned|" +
+        "pg_stat_get_xact_tuples_updated|pg_stat_reset|pg_stat_reset_shared|" +
+        "pg_stat_reset_single_function_counters|pg_stat_reset_single_table_counters|" +
+        "pg_stop_backup|pg_switch_xlog|pg_table_is_visible|pg_table_size|" +
+        "pg_tablespace_databases|pg_tablespace_size|pg_terminate_backend|pg_timezone_abbrevs|" +
+        "pg_timezone_names|pg_total_relation_size|pg_try_advisory_lock|" +
+        "pg_try_advisory_lock_shared|pg_try_advisory_xact_lock|" +
+        "pg_try_advisory_xact_lock_shared|pg_ts_config_is_visible|pg_ts_dict_is_visible|" +
+        "pg_ts_parser_is_visible|pg_ts_template_is_visible|pg_type_is_visible|pg_typeof|" +
+        "pg_xlog_replay_pause|pg_xlog_replay_resume|pg_xlogfile_name|pg_xlogfile_name_offset|" +
+        "pi|plainto_tsquery|plpgsql_call_handler|plpgsql_inline_handler|plpgsql_validator|" +
+        "point|point_above|point_add|point_below|point_distance|point_div|point_eq|point_horiz|" +
+        "point_in|point_left|point_mul|point_ne|point_out|point_recv|point_right|point_send|" +
+        "point_sub|point_vert|poly_above|poly_below|poly_center|poly_contain|poly_contain_pt|" +
+        "poly_contained|poly_distance|poly_in|poly_left|poly_npoints|poly_out|poly_overabove|" +
+        "poly_overbelow|poly_overlap|poly_overleft|poly_overright|poly_recv|poly_right|" +
+        "poly_same|poly_send|polygon|popen|position|positionjoinsel|positionsel|" +
+        "postgresql_fdw_validator|pow|power|prsd_end|prsd_headline|prsd_lextype|prsd_nexttoken|" +
+        "prsd_start|pt_contained_circle|pt_contained_poly|query_to_xml|" +
+        "query_to_xml_and_xmlschema|query_to_xmlschema|querytree|quote_ident|quote_literal|" +
+        "quote_nullable|radians|radius|random|rank|record_eq|record_ge|record_gt|record_in|" +
+        "record_le|record_lt|record_ne|record_out|record_recv|record_send|regclass|regclassin|" +
+        "regclassout|regclassrecv|regclasssend|regconfigin|regconfigout|regconfigrecv|" +
+        "regconfigsend|regdictionaryin|regdictionaryout|regdictionaryrecv|regdictionarysend|" +
+        "regexeqjoinsel|regexeqsel|regexnejoinsel|regexnesel|regexp_matches|regexp_replace|" +
+        "regexp_split_to_array|regexp_split_to_table|regoperatorin|regoperatorout|" +
+        "regoperatorrecv|regoperatorsend|regoperin|regoperout|regoperrecv|regopersend|" +
+        "regprocedurein|regprocedureout|regprocedurerecv|regproceduresend|regprocin|regprocout|" +
+        "regprocrecv|regprocsend|regr_avgx|regr_avgy|regr_count|regr_intercept|regr_r2|" +
+        "regr_slope|regr_sxx|regr_sxy|regr_syy|regtypein|regtypeout|regtyperecv|regtypesend|" +
+        "reltime|reltimeeq|reltimege|reltimegt|reltimein|reltimele|reltimelt|reltimene|reltimeout|" +
+        "reltimerecv|reltimesend|repeat|replace|reverse|right|round|row_number|rpad|rtrim|" +
+        "scalargtjoinsel|scalargtsel|scalarltjoinsel|scalarltsel|schema_to_xml|" +
+        "schema_to_xml_and_xmlschema|schema_to_xmlschema|session_user|set_bit|set_byte|" +
+        "set_config|set_masklen|setseed|setval|setweight|shell_in|shell_out|" +
+        "shift_jis_2004_to_euc_jis_2004|shift_jis_2004_to_utf8|shobj_description|sign|" +
+        "similar_escape|sin|sjis_to_euc_jp|sjis_to_mic|sjis_to_utf8|slope|smgreq|smgrin|smgrne|" +
+        "smgrout|split_part|sqrt|statement_timestamp|stddev|stddev_pop|stddev_samp|string_agg|" +
+        "string_agg_finalfn|string_agg_transfn|string_to_array|strip|strpos|substr|substring|sum|" +
+        "suppress_redundant_updates_trigger|table_to_xml|table_to_xml_and_xmlschema|" +
+        "table_to_xmlschema|tan|text|text_ge|text_gt|text_larger|text_le|text_lt|text_pattern_ge|" +
+        "text_pattern_gt|text_pattern_le|text_pattern_lt|text_smaller|textanycat|textcat|texteq|" +
+        "texticlike|texticnlike|texticregexeq|texticregexne|textin|textlen|textlike|textne|" +
+        "textnlike|textout|textrecv|textregexeq|textregexne|textsend|thesaurus_init|" +
+        "thesaurus_lexize|tideq|tidge|tidgt|tidin|tidlarger|tidle|tidlt|tidne|tidout|tidrecv|tidsend|" +
+        "tidsmaller|time_cmp|time_eq|time_ge|time_gt|time_hash|time_in|time_larger|time_le|time_lt|" +
+        "time_mi_interval|time_mi_time|time_ne|time_out|time_pl_interval|time_recv|time_send|" +
+        "time_smaller|timedate_pl|timemi|timenow|timeofday|timepl|timestamp_cmp|" +
+        "timestamp_cmp_date|timestamp_cmp_timestamptz|timestamp_eq|timestamp_eq_date|" +
+        "timestamp_eq_timestamptz|timestamp_ge|timestamp_ge_date|timestamp_ge_timestamptz|" +
+        "timestamp_gt|timestamp_gt_date|timestamp_gt_timestamptz|timestamp_hash|timestamp_in|" +
+        "timestamp_larger|timestamp_le|timestamp_le_date|timestamp_le_timestamptz|" +
+        "timestamp_lt|timestamp_lt_date|timestamp_lt_timestamptz|timestamp_mi|" +
+        "timestamp_mi_interval|timestamp_ne|timestamp_ne_date|timestamp_ne_timestamptz|" +
+        "timestamp_out|timestamp_pl_interval|timestamp_recv|timestamp_send|timestamp_smaller|" +
+        "timestamptypmodin|timestamptypmodout|timestamptz_cmp|timestamptz_cmp_date|" +
+        "timestamptz_cmp_timestamp|timestamptz_eq|timestamptz_eq_date|" +
+        "timestamptz_eq_timestamp|timestamptz_ge|timestamptz_ge_date|" +
+        "timestamptz_ge_timestamp|timestamptz_gt|timestamptz_gt_date|" +
+        "timestamptz_gt_timestamp|timestamptz_in|timestamptz_larger|timestamptz_le|" +
+        "timestamptz_le_date|timestamptz_le_timestamp|timestamptz_lt|timestamptz_lt_date|" +
+        "timestamptz_lt_timestamp|timestamptz_mi|timestamptz_mi_interval|timestamptz_ne|" +
+        "timestamptz_ne_date|timestamptz_ne_timestamp|timestamptz_out|" +
+        "timestamptz_pl_interval|timestamptz_recv|timestamptz_send|timestamptz_smaller|" +
+        "timestamptztypmodin|timestamptztypmodout|timetypmodin|timetypmodout|timetz_cmp|" +
+        "timetz_eq|timetz_ge|timetz_gt|timetz_hash|timetz_in|timetz_larger|timetz_le|timetz_lt|" +
+        "timetz_mi_interval|timetz_ne|timetz_out|timetz_pl_interval|timetz_recv|timetz_send|" +
+        "timetz_smaller|timetzdate_pl|timetztypmodin|timetztypmodout|timezone|tinterval|" +
+        "tintervalct|tintervalend|tintervaleq|tintervalge|tintervalgt|tintervalin|tintervalle|" +
+        "tintervalleneq|tintervallenge|tintervallengt|tintervallenle|tintervallenlt|" +
+        "tintervallenne|tintervallt|tintervalne|tintervalout|tintervalov|tintervalrecv|" +
+        "tintervalrel|tintervalsame|tintervalsend|tintervalstart|to_ascii|to_char|to_date|to_hex|" +
+        "to_number|to_timestamp|to_tsquery|to_tsvector|transaction_timestamp|translate|" +
+        "trigger_in|trigger_out|trunc|ts_debug|ts_headline|ts_lexize|ts_match_qv|ts_match_tq|" +
+        "ts_match_tt|ts_match_vq|ts_parse|ts_rank|ts_rank_cd|ts_rewrite|ts_stat|ts_token_type|" +
+        "ts_typanalyze|tsmatchjoinsel|tsmatchsel|tsq_mcontained|tsq_mcontains|tsquery_and|" +
+        "tsquery_cmp|tsquery_eq|tsquery_ge|tsquery_gt|tsquery_le|tsquery_lt|tsquery_ne|" +
+        "tsquery_not|tsquery_or|tsqueryin|tsqueryout|tsqueryrecv|tsquerysend|tsvector_cmp|" +
+        "tsvector_concat|tsvector_eq|tsvector_ge|tsvector_gt|tsvector_le|tsvector_lt|" +
+        "tsvector_ne|tsvector_update_trigger|tsvector_update_trigger_column|tsvectorin|" +
+        "tsvectorout|tsvectorrecv|tsvectorsend|txid_current|txid_current_snapshot|" +
+        "txid_snapshot_in|txid_snapshot_out|txid_snapshot_recv|txid_snapshot_send|" +
+        "txid_snapshot_xip|txid_snapshot_xmax|txid_snapshot_xmin|txid_visible_in_snapshot|" +
+        "uhc_to_utf8|unique_key_recheck|unknownin|unknownout|unknownrecv|unknownsend|unnest|" +
+        "upper|utf8_to_ascii|utf8_to_big5|utf8_to_euc_cn|utf8_to_euc_jis_2004|utf8_to_euc_jp|" +
+        "utf8_to_euc_kr|utf8_to_euc_tw|utf8_to_gb18030|utf8_to_gbk|utf8_to_iso8859|" +
+        "utf8_to_iso8859_1|utf8_to_johab|utf8_to_koi8r|utf8_to_koi8u|utf8_to_shift_jis_2004|" +
+        "utf8_to_sjis|utf8_to_uhc|utf8_to_win|uuid_cmp|uuid_eq|uuid_ge|uuid_gt|uuid_hash|uuid_in|" +
+        "uuid_le|uuid_lt|uuid_ne|uuid_out|uuid_recv|uuid_send|var_pop|var_samp|varbit_in|" +
+        "varbit_out|varbit_recv|varbit_send|varbitcmp|varbiteq|varbitge|varbitgt|varbitle|" +
+        "varbitlt|varbitne|varbittypmodin|varbittypmodout|varcharin|varcharout|varcharrecv|" +
+        "varcharsend|varchartypmodin|varchartypmodout|variance|version|void_in|void_out|" +
+        "void_recv|void_send|width|width_bucket|win1250_to_latin2|win1250_to_mic|win1251_to_iso|" +
+        "win1251_to_koi8r|win1251_to_mic|win1251_to_win866|win866_to_iso|win866_to_koi8r|" +
+        "win866_to_mic|win866_to_win1251|win_to_utf8|xideq|xideqint4|xidin|xidout|xidrecv|xidsend|" +
+        "xml|xml_in|xml_is_well_formed|xml_is_well_formed_content|xml_is_well_formed_document|" +
+        "xml_out|xml_recv|xml_send|xmlagg|xmlcomment|xmlconcat2|xmlexists|xmlvalidate|xpath|" +
+        "xpath_exists"
+    );
+
+    var keywordMapper = this.createKeywordMapper({
+        "support.function": builtinFunctions,
+        "keyword": keywords
+    }, "identifier", true);
+
+
+    var sqlRules = [{
+            token : "string", // single line string -- assume dollar strings if multi-line for now
+            regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+        }, {
+            token : "variable.language", // pg identifier
+            regex : '".*?"'
+        }, {
+            token : "constant.numeric", // float
+            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+        }, {
+            token : keywordMapper,
+            regex : "[a-zA-Z_][a-zA-Z0-9_$]*\\b" // TODO - Unicode in identifiers
+        }, {
+            token : "keyword.operator",
+            regex : "!|!!|!~|!~\\*|!~~|!~~\\*|#|##|#<|#<=|#<>|#=|#>|#>=|%|\\&|\\&\\&|\\&<|\\&<\\||\\&>|\\*|\\+|" +
+                    "\\-|/|<|<#>|<\\->|<<|<<=|<<\\||<=|<>|<\\?>|<@|<\\^|=|>|>=|>>|>>=|>\\^|\\?#|\\?\\-|\\?\\-\\||" +
+                    "\\?\\||\\?\\|\\||@|@\\-@|@>|@@|@@@|\\^|\\||\\|\\&>|\\|/|\\|>>|\\|\\||\\|\\|/|~|~\\*|~<=~|~<~|" +
+                    "~=|~>=~|~>~|~~|~~\\*"
+        }, {
+            token : "paren.lparen",
+            regex : "[\\(]"
+        }, {
+            token : "paren.rparen",
+            regex : "[\\)]"
+        }, {
+            token : "text",
+            regex : "\\s+"
+        }
+    ];
+
+
+    this.$rules = {
+        "start" : [{
+                token : "comment",
+                regex : "--.*$"
+            },
+            DocCommentHighlightRules.getStartRule("doc-start"),
+            {
+                token : "comment", // multi-line comment
+                regex : "\\/\\*",
+                next : "comment"
+            },{
+                token : "keyword.statementBegin",
+                regex : "^[a-zA-Z]+", // Could enumerate starting keywords but this allows things to work when new statements are added.
+                next : "statement"
+            },{
+                token : "support.buildin", // psql directive
+                regex : "^\\\\[\\S]+.*$"
+            }
+        ],
+
+        "statement" : [{
+                token : "comment",
+                regex : "--.*$"
+            }, {
+                token : "comment", // multi-line comment
+                regex : "\\/\\*",
+                next : "commentStatement"
+            }, {
+                token : "statementEnd",
+                regex : ";",
+                next : "start"
+            }, {
+                token : "string", // perl, python, tcl are in the pg default dist (no tcl highlighter)
+                regex : "\\$perl\\$",
+                next : "perl-start"
+            }, {
+                token : "string",
+                regex : "\\$python\\$",
+                next : "python-start"
+            },{
+                token : "string",
+                regex : "\\$[\\w_0-9]*\\$$", // dollar quote at the end of a line
+                next : "dollarSql"
+            }, {
+                token : "string",
+                regex : "\\$[\\w_0-9]*\\$",
+                next : "dollarStatementString"
+            }
+        ].concat(sqlRules),
+
+        "dollarSql" : [{
+                token : "comment",
+                regex : "--.*$"
+            }, {
+                token : "comment", // multi-line comment
+                regex : "\\/\\*",
+                next : "commentDollarSql"
+            }, {
+                token : "string", // end quoting with dollar at the start of a line
+                regex : "^\\$[\\w_0-9]*\\$",
+                next : "statement"
+            }, {
+                token : "string",
+                regex : "\\$[\\w_0-9]*\\$",
+                next : "dollarSqlString"
+            }
+        ].concat(sqlRules),
+
+        "comment" : [{
+                token : "comment", // closing comment
+                regex : ".*?\\*\\/",
+                next : "start"
+            }, {
+                token : "comment", // comment spanning whole line
+                regex : ".+"
+            }
+        ],
+
+        "commentStatement" : [{
+                token : "comment", // closing comment
+                regex : ".*?\\*\\/",
+                next : "statement"
+            }, {
+                token : "comment", // comment spanning whole line
+                regex : ".+"
+            }
+        ],
+
+        "commentDollarSql" : [{
+                token : "comment", // closing comment
+                regex : ".*?\\*\\/",
+                next : "dollarSql"
+            }, {
+                token : "comment", // comment spanning whole line
+                regex : ".+"
+            }
+        ],
+
+        "dollarStatementString" : [{
+                token : "string", // closing dollarstring
+                regex : ".*?\\$[\\w_0-9]*\\$",
+                next : "statement"
+            }, {
+                token : "string", // dollarstring spanning whole line
+                regex : ".+"
+            }
+        ],
+
+        "dollarSqlString" : [{
+                token : "string", // closing dollarstring
+                regex : ".*?\\$[\\w_0-9]*\\$",
+                next : "dollarSql"
+            }, {
+                token : "string", // dollarstring spanning whole line
+                regex : ".+"
+            }
+        ]
+    };
+
+    this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]);
+    this.embedRules(PerlHighlightRules, "perl-", [{token : "string", regex : "\\$perl\\$", next : "statement"}]);
+    this.embedRules(PythonHighlightRules, "python-", [{token : "string", regex : "\\$python\\$", next : "statement"}]);
+};
+
+oop.inherits(PgsqlHighlightRules, TextHighlightRules);
+
+exports.PgsqlHighlightRules = PgsqlHighlightRules;
+});
+

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/php.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/php.js b/src/fauxton/assets/js/libs/ace/mode/php.js
new file mode 100644
index 0000000..18aecb6
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/php.js
@@ -0,0 +1,135 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var PhpHighlightRules = require("./php_highlight_rules").PhpHighlightRules;
+var PhpLangHighlightRules = require("./php_highlight_rules").PhpLangHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var Range = require("../range").Range;
+var WorkerClient = require("../worker/worker_client").WorkerClient;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+var unicode = require("../unicode");
+
+var Mode = function(opts) {
+    var inline = opts && opts.inline;
+    var HighlightRules = inline ? PhpLangHighlightRules : PhpHighlightRules;
+    this.HighlightRules = HighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new CstyleBehaviour();
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.tokenRe = new RegExp("^["
+        + unicode.packages.L
+        + unicode.packages.Mn + unicode.packages.Mc
+        + unicode.packages.Nd
+        + unicode.packages.Pc + "\_]+", "g"
+    );
+    
+    this.nonTokenRe = new RegExp("^(?:[^"
+        + unicode.packages.L
+        + unicode.packages.Mn + unicode.packages.Mc
+        + unicode.packages.Nd
+        + unicode.packages.Pc + "\_]|\s])+", "g"
+    );
+
+       
+    this.lineCommentStart = ["//", "#"];
+    this.blockComment = {start: "/*", end: "*/"};
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+        var endState = tokenizedLine.state;
+
+
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+
+        if (state == "php-start") {
+            var match = line.match(/^.*[\{\(\[\:]\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        } else if (state == "php-doc-start") {
+            if (endState != "php-doc-start") {
+                return "";
+            }
+            var match = line.match(/^\s*(\/?)\*/);
+            if (match) {
+                if (match[1]) {
+                    indent += " ";
+                }
+                indent += "* ";
+            }
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+    this.createWorker = function(session) {
+        var worker = new WorkerClient(["ace"], "ace/mode/php_worker", "PhpWorker");
+        worker.attachToDocument(session.getDocument());
+
+        worker.on("error", function(e) {
+            session.setAnnotations(e.data);
+        });
+
+        worker.on("ok", function() {
+            session.clearAnnotations();
+        });
+
+        return worker;
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});


[32/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_rdoc.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_rdoc.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_rdoc.json
new file mode 100644
index 0000000..0c75743
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_rdoc.json
@@ -0,0 +1,441 @@
+[[
+   "start",
+  ["keyword","\\name"],
+  ["paren.keyword.operator","{"],
+  ["nospell.text","picker"],
+  ["paren.keyword.operator","}"]
+],[
+   "start",
+  ["keyword","\\alias"],
+  ["paren.keyword.operator","{"],
+  ["nospell.text","picker"],
+  ["paren.keyword.operator","}"]
+],[
+   "start",
+  ["keyword","\\title"],
+  ["paren.keyword.operator","{"],
+  ["text","Create a picker control"],
+  ["paren.keyword.operator","}"]
+],[
+   "start",
+  ["keyword","\\description"],
+  ["paren.keyword.operator","{"]
+],[
+   "start",
+  ["text","  Create a picker control to enable manipulation of plot variables based on a set of fixed choices."]
+],[
+   "start",
+  ["paren.keyword.operator","}"]
+],[
+   "start"
+],[
+   "nospell",
+  ["keyword","\\usage"],
+  ["paren.keyword.operator","{"]
+],[
+   "nospell",
+  ["nospell.text","picker"],
+  ["paren.keyword.operator","("],
+  ["text","...,"],
+  ["nospell.text"," initial "],
+  ["text","="],
+  ["nospell.text"," NULL"],
+  ["text",","],
+  ["nospell.text"," label "],
+  ["text","="],
+  ["nospell.text"," NULL"],
+  ["paren.keyword.operator",")"]
+],[
+   "start",
+  ["paren.keyword.operator","}"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["keyword","\\arguments"],
+  ["paren.keyword.operator","{"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","\\item"],
+  ["paren.keyword.operator","{"],
+  ["keyword","\\dots"],
+  ["paren.keyword.operator","}{"]
+],[
+   "start",
+  ["text","    Arguments containing objects to be presented as choices for the picker "],
+  ["paren.keyword.operator","("],
+  ["text","or a list containing the choices"],
+  ["paren.keyword.operator",")"],
+  ["text",". If an element is named then the name is used to display it within the picker. If an element is not named then it is displayed within the picker using "],
+  ["keyword","\\code"],
+  ["paren.keyword.operator","{"],
+  ["keyword","\\link"],
+  ["paren.keyword.operator","{"],
+  ["nospell.text","as"],
+  ["text","."],
+  ["nospell.text","character"],
+  ["paren.keyword.operator","}}"],
+  ["text",". "]
+],[
+   "start",
+  ["paren.keyword.operator","}"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","\\item"],
+  ["paren.keyword.operator","{"],
+  ["nospell.text","initial"],
+  ["paren.keyword.operator","}{"]
+],[
+   "start",
+  ["text","    Initial value for picker. Value must be present in the list of choices specified. If not specified defaults to the first choice."]
+],[
+   "start",
+  ["paren.keyword.operator","}"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","\\item"],
+  ["paren.keyword.operator","{"],
+  ["nospell.text","label"],
+  ["paren.keyword.operator","}{"]
+],[
+   "start",
+  ["text","    Display label for picker. Defaults to the variable name if not specified."]
+],[
+   "start",
+  ["paren.keyword.operator","}"]
+],[
+   "start",
+  ["paren.keyword.operator","}"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","\\value"],
+  ["paren.keyword.operator","{"]
+],[
+   "start",
+  ["text","  An object of class \"manipulator.picker\" which can be passed to the "],
+  ["keyword","\\code"],
+  ["paren.keyword.operator","{"],
+  ["keyword","\\link"],
+  ["paren.keyword.operator","{"],
+  ["nospell.text","manipulate"],
+  ["paren.keyword.operator","}}"],
+  ["text"," function."]
+],[
+   "start",
+  ["paren.keyword.operator","}"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","\\seealso"],
+  ["paren.keyword.operator","{"]
+],[
+   "start",
+  ["keyword","\\code"],
+  ["paren.keyword.operator","{"],
+  ["keyword","\\link"],
+  ["paren.keyword.operator","{"],
+  ["nospell.text","manipulate"],
+  ["paren.keyword.operator","}}"],
+  ["text",", "],
+  ["keyword","\\code"],
+  ["paren.keyword.operator","{"],
+  ["keyword","\\link"],
+  ["paren.keyword.operator","{"],
+  ["nospell.text","slider"],
+  ["paren.keyword.operator","}}"],
+  ["text",", "],
+  ["keyword","\\code"],
+  ["paren.keyword.operator","{"],
+  ["keyword","\\link"],
+  ["paren.keyword.operator","{"],
+  ["nospell.text","checkbox"],
+  ["paren.keyword.operator","}}"],
+  ["text",", "],
+  ["keyword","\\code"],
+  ["paren.keyword.operator","{"],
+  ["keyword","\\link"],
+  ["paren.keyword.operator","{"],
+  ["nospell.text","button"],
+  ["paren.keyword.operator","}}"]
+],[
+   "start",
+  ["paren.keyword.operator","}"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "nospell",
+  ["keyword","\\examples"],
+  ["paren.keyword.operator","{"]
+],[
+   "nospell",
+  ["keyword","\\dontrun"],
+  ["paren.keyword.operator","{"]
+],[
+   "nospell"
+],[
+   "nospell",
+  ["text","##"],
+  ["nospell.text"," Filtering data with a picker"]
+],[
+   "nospell",
+  ["nospell.text","manipulate"],
+  ["paren.keyword.operator","("]
+],[
+   "nospell",
+  ["nospell.text","  barplot"],
+  ["paren.keyword.operator","("],
+  ["nospell.text","as"],
+  ["text","."],
+  ["nospell.text","matrix"],
+  ["paren.keyword.operator","("],
+  ["nospell.text","longley"],
+  ["paren.keyword.operator","["],
+  ["text",","],
+  ["nospell.text","factor"],
+  ["paren.keyword.operator","])"],
+  ["text",","],
+  ["nospell.text"," "]
+],[
+   "nospell",
+  ["nospell.text","          beside "],
+  ["text","="],
+  ["nospell.text"," TRUE"],
+  ["text",","],
+  ["nospell.text"," main "],
+  ["text","="],
+  ["nospell.text"," factor"],
+  ["paren.keyword.operator",")"],
+  ["text",","]
+],[
+   "nospell",
+  ["nospell.text","  factor "],
+  ["text","="],
+  ["nospell.text"," picker"],
+  ["paren.keyword.operator","("],
+  ["text","\""],
+  ["nospell.text","GNP"],
+  ["text","\","],
+  ["nospell.text"," "],
+  ["text","\""],
+  ["nospell.text","Unemployed"],
+  ["text","\","],
+  ["nospell.text"," "],
+  ["text","\""],
+  ["nospell.text","Employed"],
+  ["text","\""],
+  ["paren.keyword.operator","))"]
+],[
+   "nospell"
+],[
+   "nospell",
+  ["text","##"],
+  ["nospell.text"," Create a picker with labels"]
+],[
+   "nospell",
+  ["nospell.text","manipulate"],
+  ["paren.keyword.operator","("]
+],[
+   "nospell",
+  ["nospell.text","  plot"],
+  ["paren.keyword.operator","("],
+  ["nospell.text","pressure"],
+  ["text",","],
+  ["nospell.text"," type "],
+  ["text","="],
+  ["nospell.text"," type"],
+  ["paren.keyword.operator",")"],
+  ["text",","],
+  ["nospell.text"," "]
+],[
+   "nospell",
+  ["nospell.text","  type "],
+  ["text","="],
+  ["nospell.text"," picker"],
+  ["paren.keyword.operator","("],
+  ["text","\""],
+  ["nospell.text","points"],
+  ["text","\""],
+  ["nospell.text"," "],
+  ["text","="],
+  ["nospell.text"," "],
+  ["text","\""],
+  ["nospell.text","p"],
+  ["text","\","],
+  ["nospell.text"," "],
+  ["text","\""],
+  ["nospell.text","line"],
+  ["text","\""],
+  ["nospell.text"," "],
+  ["text","="],
+  ["nospell.text"," "],
+  ["text","\""],
+  ["nospell.text","l"],
+  ["text","\","],
+  ["nospell.text"," "],
+  ["text","\""],
+  ["nospell.text","step"],
+  ["text","\""],
+  ["nospell.text"," "],
+  ["text","="],
+  ["nospell.text"," "],
+  ["text","\""],
+  ["nospell.text","s"],
+  ["text","\""],
+  ["paren.keyword.operator","))"]
+],[
+   "nospell",
+  ["nospell.text","  "]
+],[
+   "nospell",
+  ["text","##"],
+  ["nospell.text"," Picker with groups"]
+],[
+   "nospell",
+  ["nospell.text","manipulate"],
+  ["paren.keyword.operator","("]
+],[
+   "nospell",
+  ["nospell.text","  barplot"],
+  ["paren.keyword.operator","("],
+  ["nospell.text","as"],
+  ["text","."],
+  ["nospell.text","matrix"],
+  ["paren.keyword.operator","("],
+  ["nospell.text","mtcars"],
+  ["paren.keyword.operator","["],
+  ["nospell.text","group"],
+  ["text",",\""],
+  ["nospell.text","mpg"],
+  ["text","\""],
+  ["paren.keyword.operator","])"],
+  ["text",","],
+  ["nospell.text"," beside"],
+  ["text","="],
+  ["nospell.text","TRUE"],
+  ["paren.keyword.operator",")"],
+  ["text",","]
+],[
+   "nospell",
+  ["nospell.text","  group "],
+  ["text","="],
+  ["nospell.text"," picker"],
+  ["paren.keyword.operator","("],
+  ["text","\""],
+  ["nospell.text","Group 1"],
+  ["text","\""],
+  ["nospell.text"," "],
+  ["text","="],
+  ["nospell.text"," 1"],
+  ["text",":"],
+  ["nospell.text","11"],
+  ["text",","],
+  ["nospell.text"," "]
+],[
+   "nospell",
+  ["nospell.text","                 "],
+  ["text","\""],
+  ["nospell.text","Group 2"],
+  ["text","\""],
+  ["nospell.text"," "],
+  ["text","="],
+  ["nospell.text"," 12"],
+  ["text",":"],
+  ["nospell.text","22"],
+  ["text",","],
+  ["nospell.text"," "]
+],[
+   "nospell",
+  ["nospell.text","                 "],
+  ["text","\""],
+  ["nospell.text","Group 3"],
+  ["text","\""],
+  ["nospell.text"," "],
+  ["text","="],
+  ["nospell.text"," 23"],
+  ["text",":"],
+  ["nospell.text","32"],
+  ["paren.keyword.operator","))"]
+],[
+   "nospell"
+],[
+   "nospell",
+  ["text","##"],
+  ["nospell.text"," Histogram w"],
+  ["text","/"],
+  ["nospell.text"," picker to select type"]
+],[
+   "nospell",
+  ["nospell.text","require"],
+  ["paren.keyword.operator","("],
+  ["nospell.text","lattice"],
+  ["paren.keyword.operator",")"]
+],[
+   "nospell",
+  ["nospell.text","require"],
+  ["paren.keyword.operator","("],
+  ["nospell.text","stats"],
+  ["paren.keyword.operator",")"]
+],[
+   "nospell",
+  ["nospell.text","manipulate"],
+  ["paren.keyword.operator","("]
+],[
+   "nospell",
+  ["nospell.text","  histogram"],
+  ["paren.keyword.operator","("],
+  ["text","~"],
+  ["nospell.text"," height "],
+  ["text","|"],
+  ["nospell.text"," voice"],
+  ["text","."],
+  ["nospell.text","part"],
+  ["text",","],
+  ["nospell.text"," "]
+],[
+   "nospell",
+  ["nospell.text","            data "],
+  ["text","="],
+  ["nospell.text"," singer"],
+  ["text",","],
+  ["nospell.text"," type "],
+  ["text","="],
+  ["nospell.text"," type"],
+  ["paren.keyword.operator",")"],
+  ["text",","]
+],[
+   "nospell",
+  ["nospell.text","  type "],
+  ["text","="],
+  ["nospell.text"," picker"],
+  ["paren.keyword.operator","("],
+  ["text","\""],
+  ["nospell.text","percent"],
+  ["text","\","],
+  ["nospell.text"," "],
+  ["text","\""],
+  ["nospell.text","count"],
+  ["text","\","],
+  ["nospell.text"," "],
+  ["text","\""],
+  ["nospell.text","density"],
+  ["text","\""],
+  ["paren.keyword.operator","))"]
+],[
+   "nospell"
+],[
+   "start",
+  ["paren.keyword.operator","}"]
+],[
+   "start",
+  ["paren.keyword.operator","}"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_rhtml.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_rhtml.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_rhtml.json
new file mode 100644
index 0000000..6dca1c5
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_rhtml.json
@@ -0,0 +1,106 @@
+[[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","html"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","head"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","title"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","Title"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","title"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","head"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","body"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","This is an R HTML document. When you click the "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","b"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","Knit HTML"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","b"],
+  ["meta.tag.punctuation.end",">"],
+  ["text"," button a web page will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "r-start",
+  ["support.function.codebegin","<!--begin.rcode"]
+],[
+   "r-start",
+  ["identifier","summary"],
+  ["paren.keyword.operator","("],
+  ["identifier","cars"],
+  ["paren.keyword.operator",")"]
+],[
+   "start",
+  ["support.function.codeend","end.rcode-->"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","You can also embed plots, for example:"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","p"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "r-start",
+  ["support.function.codebegin","<!--begin.rcode fig.width=7, fig.height=6"]
+],[
+   "r-start",
+  ["identifier","plot"],
+  ["paren.keyword.operator","("],
+  ["identifier","cars"],
+  ["paren.keyword.operator",")"]
+],[
+   "start",
+  ["support.function.codeend","end.rcode-->"]
+],[
+   "start"
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","body"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","html"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_ruby.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_ruby.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_ruby.json
new file mode 100644
index 0000000..19b98b7
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_ruby.json
@@ -0,0 +1,232 @@
+[[
+   "start",
+  ["text"," "],
+  ["comment","#test: symbol tokenizer"]
+],[
+   "start",
+  ["text","  "],
+  ["paren.lparen","["],
+  ["constant.other.symbol.ruby",":@thing"],
+  ["text",", "],
+  ["constant.other.symbol.ruby",":$thing"],
+  ["text",", "],
+  ["constant.other.symbol.ruby",":_thing"],
+  ["text",", "],
+  ["constant.other.symbol.ruby",":thing"],
+  ["text",", "],
+  ["constant.other.symbol.ruby",":Thing"],
+  ["text",", "],
+  ["constant.other.symbol.ruby",":thing1"],
+  ["text",", "],
+  ["constant.other.symbol.ruby",":thing_a"],
+  ["text",","]
+],[
+   "start",
+  ["text","              "],
+  ["constant.other.symbol.ruby",":THING"],
+  ["text",", "],
+  ["constant.other.symbol.ruby",":thing!"],
+  ["text",", "],
+  ["constant.other.symbol.ruby",":thing="],
+  ["text",", "],
+  ["constant.other.symbol.ruby",":thing?"],
+  ["text",", "],
+  ["constant.other.symbol.ruby",":t?"],
+  ["text",","]
+],[
+   "start",
+  ["text","              :, :@, :"],
+  ["keyword.operator","$"],
+  ["text",", :"],
+  ["constant.numeric","1"],
+  ["text",", :1"],
+  ["identifier","thing"],
+  ["text",", "],
+  ["constant.other.symbol.ruby",":th?"],
+  ["identifier","ing"],
+  ["text",", "],
+  ["constant.other.symbol.ruby",":thi="],
+  ["identifier","ng"],
+  ["text",", :1"],
+  ["identifier","thing"],
+  ["text",","]
+],[
+   "start",
+  ["text","            "],
+  ["constant.other.symbol.ruby",":th!"],
+  ["identifier","ing"],
+  ["text",", "],
+  ["constant.other.symbol.ruby",":thing"],
+  ["comment","#"]
+],[
+   "start",
+  ["text","    "],
+  ["paren.rparen","]"]
+],[
+   "start"
+],[
+   "start",
+  ["text"," "],
+  ["comment","#test: namespaces aren't symbols\" : function() {"]
+],[
+   "start",
+  ["text","   "],
+  ["support.class","Namespaced"],
+  ["text","::"],
+  ["support.class","Class"]
+],[
+   "start",
+  ["text"," "],
+  ["comment","#test: hex tokenizer "]
+],[
+   "start",
+  ["text","    "],
+  ["constant.numeric","0x9a"],
+  ["text",", "],
+  ["constant.numeric","0XA1"],
+  ["text",", "],
+  ["constant.numeric","0x9_a"],
+  ["text",", 0"],
+  ["identifier","x"],
+  ["text",", 0"],
+  ["identifier","x_9a"],
+  ["text",", 0"],
+  ["identifier","x9a_"],
+  ["text",","]
+],[
+   "start",
+  ["text"," "],
+  ["comment","#test: float tokenizer"]
+],[
+   "start",
+  ["text","    "],
+  ["paren.lparen","["],
+  ["constant.numeric","1"],
+  ["text",", "],
+  ["constant.numeric","+1"],
+  ["text",", "],
+  ["constant.numeric","-1"],
+  ["text",", "],
+  ["constant.numeric","12_345"],
+  ["text",", "],
+  ["constant.numeric","0.000_1"],
+  ["text",","]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","_"],
+  ["text",", "],
+  ["constant.numeric","3_1"],
+  ["text",", "],
+  ["constant.numeric","1_2"],
+  ["text",", 1"],
+  ["identifier","_"],
+  ["text","."],
+  ["constant.numeric","0"],
+  ["text",", "],
+  ["constant.numeric","0"],
+  ["text","."],
+  ["identifier","_1"],
+  ["paren.rparen","]"],
+  ["text",";"]
+],[
+   "start",
+  ["text"," "]
+],[
+   "start",
+  ["paren.lparen","{"],
+  ["constant.other.symbol.ruby",":id"],
+  ["text"," "],
+  ["punctuation.separator.key-value","=>"],
+  ["text"," "],
+  ["constant.numeric","34"],
+  ["text",", "],
+  ["constant.other.symbol.ruby",":key"],
+  ["text"," "],
+  ["punctuation.separator.key-value","=>"],
+  ["text"," "],
+  ["string","\"value\""],
+  ["paren.rparen","}"]
+],[
+   "start"
+],[
+   "comment",
+  ["comment","=begin"]
+],[
+   "start",
+  ["comment","=end"]
+],[
+   "start"
+],[
+   "comment",
+  ["comment","=begin x"]
+],[
+   "comment",
+  ["comment","=end-"]
+],[
+   "start",
+  ["comment","=end   x"]
+],[
+   "start"
+],[
+   ["heredoc","FOO","heredoc","BAR","indentedHeredoc","BAZ","indentedHeredoc","EXEC"],
+  ["text","    "],
+  ["identifier","herDocs"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["constant","<<"],
+  ["string","'"],
+  ["support.class","FOO"],
+  ["string","'"],
+  ["text",", "],
+  ["constant","<<"],
+  ["string",""],
+  ["support.class","BAR"],
+  ["string",""],
+  ["text",", "],
+  ["constant","<<-"],
+  ["string",""],
+  ["support.class","BAZ"],
+  ["string",""],
+  ["text",", "],
+  ["constant","<<-"],
+  ["string","`"],
+  ["support.class","EXEC"],
+  ["string","`"],
+  ["paren.rparen","]"],
+  ["text"," "],
+  ["comment","#comment"]
+],[
+   ["heredoc","FOO","heredoc","BAR","indentedHeredoc","BAZ","indentedHeredoc","EXEC"],
+  ["string","  FOO #{literal}"]
+],[
+   ["heredoc","BAR","indentedHeredoc","BAZ","indentedHeredoc","EXEC"],
+  ["support.class","FOO"]
+],[
+   ["heredoc","BAR","indentedHeredoc","BAZ","indentedHeredoc","EXEC"],
+  ["string","  BAR #{fact(10)}"]
+],[
+   ["indentedHeredoc","BAZ","indentedHeredoc","EXEC"],
+  ["support.class","BAR"]
+],[
+   ["indentedHeredoc","BAZ","indentedHeredoc","EXEC"],
+  ["string","  BAZ indented"]
+],[
+   ["indentedHeredoc","EXEC"],
+  ["string","    "],
+  ["support.class","BAZ"]
+],[
+   ["indentedHeredoc","EXEC"],
+  ["string","        echo hi"]
+],[
+   "start",
+  ["string","    "],
+  ["support.class","EXEC"]
+],[
+   "start",
+  ["support.function","puts"],
+  ["text"," "],
+  ["identifier","herDocs"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_rust.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_rust.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_rust.json
new file mode 100644
index 0000000..6592575
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_rust.json
@@ -0,0 +1,136 @@
+[[
+   "start",
+  ["keyword.source.rust","use"],
+  ["text"," "],
+  ["support.constant","core::rand::"],
+  ["text","RngUtil"],
+  ["keyword.operator",";"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword.source.rust","fn"],
+  ["meta.function.source.rust"," "],
+  ["entity.name.function.source.rust","main"],
+  ["meta.function.source.rust","("],
+  ["text",") {"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword.source.rust","for"],
+  ["text"," ["],
+  ["string.quoted.double.source.rust","\"Alice\""],
+  ["keyword.operator",","],
+  ["text"," "],
+  ["string.quoted.double.source.rust","\"Bob\""],
+  ["keyword.operator",","],
+  ["text"," "],
+  ["string.quoted.double.source.rust","\"Carol\""],
+  ["text","].each |&name| {"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword.source.rust","do"],
+  ["text"," spawn {"]
+],[
+   "start",
+  ["text","            "],
+  ["keyword.source.rust","let"],
+  ["text"," v "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["support.constant","rand::"],
+  ["text","Rng().shuffle(["],
+  ["constant.numeric.integer.source.rust","1"],
+  ["keyword.operator",","],
+  ["text"," "],
+  ["constant.numeric.integer.source.rust","2"],
+  ["keyword.operator",","],
+  ["text"," "],
+  ["constant.numeric.integer.source.rust","3"],
+  ["text","])"],
+  ["keyword.operator",";"]
+],[
+   "start",
+  ["text","            "],
+  ["keyword.source.rust","for"],
+  ["text"," v.each |&num| {"]
+],[
+   "start",
+  ["text","                print(fmt"],
+  ["keyword.operator","!"],
+  ["text","("],
+  ["string.quoted.double.source.rust","\"%s says: '%d'"],
+  ["constant.character.escape.source.rust","\\n"],
+  ["string.quoted.double.source.rust","\""],
+  ["keyword.operator",","],
+  ["text"," name"],
+  ["keyword.operator",","],
+  ["text"," num "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["constant.numeric.integer.source.rust","1"],
+  ["text","))"]
+],[
+   "start",
+  ["text","            }"]
+],[
+   "start",
+  ["text","        }"]
+],[
+   "start",
+  ["text","    }"]
+],[
+   "start",
+  ["text","}"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword.source.rust","fn"],
+  ["meta.function.source.rust"," "],
+  ["entity.name.function.source.rust","map<T, U>"],
+  ["meta.function.source.rust","("],
+  ["text","vector: &[T]"],
+  ["keyword.operator",","],
+  ["text"," function: &fn(v: &T) "],
+  ["keyword.operator","->"],
+  ["text"," U) "],
+  ["keyword.operator","->"],
+  ["text"," ~[U] {"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword.source.rust","let"],
+  ["text"," "],
+  ["keyword.source.rust","mut"],
+  ["text"," accumulator "],
+  ["keyword.operator","="],
+  ["text"," ~[]"],
+  ["keyword.operator",";"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword.source.rust","for"],
+  ["text"," "],
+  ["support.constant","vec::"],
+  ["text","each(vector) |element| {"]
+],[
+   "start",
+  ["text","        accumulator.push(function(element))"],
+  ["keyword.operator",";"]
+],[
+   "start",
+  ["text","    }"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword.source.rust","return"],
+  ["text"," accumulator"],
+  ["keyword.operator",";"]
+],[
+   "start",
+  ["text","}"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_sass.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_sass.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_sass.json
new file mode 100644
index 0000000..c0b8568
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_sass.json
@@ -0,0 +1,229 @@
+[[
+   "start",
+  ["comment","// sass ace mode;"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","@import"],
+  ["text"," "],
+  ["support.function","url("],
+  ["string","http://fonts.googleapis.com/css?family=Ace:700"],
+  ["support.function",")"]
+],[
+   "start"
+],[
+   "start",
+  ["variable.language","html"],
+  ["text",", "],
+  ["variable.language","body"]
+],[
+   "start",
+  ["support.type","  :background-color "],
+  ["constant.numeric","#ace"]
+],[
+   "start",
+  ["text","  "],
+  ["support.type","text-align"],
+  ["text",": "],
+  ["constant.language","center"]
+],[
+   "start",
+  ["text","  "],
+  ["support.type","height"],
+  ["text",": "],
+  ["constant.numeric","100%"]
+],[
+   ["comment",-1,2,"start"],
+  ["comment","  /*;*********;"]
+],[
+   ["comment",3,2,"start"],
+  ["comment","    ;comment  ;"]
+],[
+   ["comment",3,2,"start"],
+  ["comment","    ;*********;"]
+],[
+   "start"
+],[
+   "start",
+  ["variable.language",".toggle"]
+],[
+   "start",
+  ["text","  "],
+  ["variable","$size"],
+  ["text",": "],
+  ["constant.numeric","14px"]
+],[
+   "start"
+],[
+   "start",
+  ["support.type","  :background "],
+  ["support.function","url("],
+  ["string","http://subtlepatterns.com/patterns/dark_stripes.png"],
+  ["support.function",")"]
+],[
+   "start",
+  ["text","  "],
+  ["support.type","border-radius"],
+  ["text",": "],
+  ["constant.numeric","8px"]
+],[
+   "start",
+  ["text","  "],
+  ["support.type","height"],
+  ["text",": "],
+  ["variable","$size"]
+],[
+   "start"
+],[
+   "start",
+  ["text","  &"],
+  ["variable.language",":before"]
+],[
+   "start",
+  ["text","    "],
+  ["variable","$radius"],
+  ["text",": "],
+  ["variable","$size"],
+  ["text"," "],
+  ["keyword.operator","*"],
+  ["text"," "],
+  ["constant.numeric","0.845"]
+],[
+   "start",
+  ["text","    "],
+  ["variable","$glow"],
+  ["text",": "],
+  ["variable","$size"],
+  ["text"," "],
+  ["keyword.operator","*"],
+  ["text"," "],
+  ["constant.numeric","0.125"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    "],
+  ["support.type","box-shadow"],
+  ["text",": "],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["variable","$glow"],
+  ["text"," "],
+  ["variable","$glow"],
+  ["text"," / "],
+  ["constant.numeric","2"],
+  ["text"," "],
+  ["constant.numeric","#fff"]
+],[
+   "start",
+  ["text","    "],
+  ["support.type","border-radius"],
+  ["text",": "],
+  ["variable","$radius"]
+],[
+   "start",
+  ["text","    "]
+],[
+   "start",
+  ["text","    &"],
+  ["variable.language",":active"]
+],[
+   "start",
+  ["text","      ~ "],
+  ["variable.language",".button"]
+],[
+   "start",
+  ["text","        "],
+  ["support.type","box-shadow"],
+  ["text",": "],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["constant.numeric","15px"],
+  ["text"," "],
+  ["constant.numeric","25px"],
+  ["text"," "],
+  ["constant.numeric","-4px"],
+  ["text"," "],
+  ["support.function","rgba"],
+  ["paren.lparen","("],
+  ["constant.numeric","0"],
+  ["text",","],
+  ["constant.numeric","0"],
+  ["text",","],
+  ["constant.numeric","0"],
+  ["text",","],
+  ["constant.numeric","0.4"],
+  ["paren.rparen",")"],
+  ["text","      "]
+],[
+   "start",
+  ["text","      ~ "],
+  ["variable.language",".label"]
+],[
+   "start",
+  ["text","        "],
+  ["support.type","font-size"],
+  ["text",": "],
+  ["constant.numeric","40px"]
+],[
+   "start",
+  ["text","        "],
+  ["support.type","color"],
+  ["text",": "],
+  ["support.function","rgba"],
+  ["paren.lparen","("],
+  ["constant.numeric","0"],
+  ["text",","],
+  ["constant.numeric","0"],
+  ["text",","],
+  ["constant.numeric","0"],
+  ["text",","],
+  ["constant.numeric","0.45"],
+  ["paren.rparen",")"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    &"],
+  ["variable.language",":checked"],
+  ["text","      "]
+],[
+   "start",
+  ["text","      ~ "],
+  ["variable.language",".button"]
+],[
+   "start",
+  ["text","        "],
+  ["support.type","box-shadow"],
+  ["text",": "],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["constant.numeric","15px"],
+  ["text"," "],
+  ["constant.numeric","25px"],
+  ["text"," "],
+  ["constant.numeric","-4px"],
+  ["text"," "],
+  ["constant.numeric","#ace"]
+],[
+   "start",
+  ["text","      ~ "],
+  ["variable.language",".label"]
+],[
+   "start",
+  ["text","        "],
+  ["support.type","font-size"],
+  ["text",": "],
+  ["constant.numeric","40px"]
+],[
+   "start",
+  ["text","        "],
+  ["support.type","color"],
+  ["text",": "],
+  ["constant.numeric","#c9c9c9"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_scad.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_scad.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_scad.json
new file mode 100644
index 0000000..8f0ff63
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_scad.json
@@ -0,0 +1,194 @@
+[[
+   "start",
+  ["comment","// ace can highlight scad!"]
+],[
+   "start",
+  ["keyword","module"],
+  ["text"," "],
+  ["identifier","Element"],
+  ["paren.lparen","("],
+  ["identifier","xpos"],
+  ["text",", "],
+  ["identifier","ypos"],
+  ["text",", "],
+  ["identifier","zpos"],
+  ["paren.rparen",")"],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","\t"],
+  ["identifier","translate"],
+  ["paren.lparen","(["],
+  ["identifier","xpos"],
+  ["text",","],
+  ["identifier","ypos"],
+  ["text",","],
+  ["identifier","zpos"],
+  ["paren.rparen","])"],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["identifier","union"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","\t\t\t"],
+  ["identifier","cube"],
+  ["paren.lparen","(["],
+  ["constant.numeric","10"],
+  ["text",","],
+  ["constant.numeric","10"],
+  ["text",","],
+  ["constant.numeric","4"],
+  ["paren.rparen","]"],
+  ["text",","],
+  ["identifier","true"],
+  ["paren.rparen",")"],
+  ["text",";"]
+],[
+   "start",
+  ["text","\t\t\t"],
+  ["identifier","cylinder"],
+  ["paren.lparen","("],
+  ["constant.numeric","10"],
+  ["text",","],
+  ["constant.numeric","15"],
+  ["text",","],
+  ["constant.numeric","5"],
+  ["paren.rparen",")"],
+  ["text",";"]
+],[
+   "start",
+  ["text","\t\t\t"],
+  ["identifier","translate"],
+  ["paren.lparen","(["],
+  ["constant.numeric","0"],
+  ["text",","],
+  ["constant.numeric","0"],
+  ["text",","],
+  ["constant.numeric","10"],
+  ["paren.rparen","])"],
+  ["identifier","sphere"],
+  ["paren.lparen","("],
+  ["constant.numeric","5"],
+  ["paren.rparen",")"],
+  ["text",";"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","\t"],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["identifier","union"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","\t"],
+  ["keyword","for"],
+  ["paren.lparen","("],
+  ["identifier","i"],
+  ["keyword.operator","="],
+  ["paren.lparen","["],
+  ["constant.numeric","0"],
+  ["text",":"],
+  ["constant.numeric","30"],
+  ["paren.rparen","])"],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","\t\t# "],
+  ["identifier","Element"],
+  ["paren.lparen","("],
+  ["constant.numeric","0"],
+  ["text",","],
+  ["constant.numeric","0"],
+  ["text",","],
+  ["constant.numeric","0"],
+  ["paren.rparen",")"],
+  ["text",";"]
+],[
+   "start",
+  ["text","\t\t"],
+  ["identifier","Element"],
+  ["paren.lparen","("],
+  ["constant.numeric","15"],
+  ["keyword.operator","*"],
+  ["identifier","i"],
+  ["text",","],
+  ["constant.numeric","0"],
+  ["text",","],
+  ["constant.numeric","0"],
+  ["paren.rparen",")"],
+  ["text",";"]
+],[
+   "start",
+  ["text","\t"],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","for"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["identifier","i"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["constant.numeric","3"],
+  ["text",", "],
+  ["constant.numeric","5"],
+  ["text",", "],
+  ["constant.numeric","7"],
+  ["text",", "],
+  ["constant.numeric","11"],
+  ["paren.rparen","])"],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","\t"],
+  ["identifier","rotate"],
+  ["paren.lparen","(["],
+  ["identifier","i"],
+  ["keyword.operator","*"],
+  ["constant.numeric","10"],
+  ["text",","],
+  ["constant.numeric","0"],
+  ["text",","],
+  ["constant.numeric","0"],
+  ["paren.rparen","])"],
+  ["identifier","scale"],
+  ["paren.lparen","(["],
+  ["constant.numeric","1"],
+  ["text",","],
+  ["constant.numeric","1"],
+  ["text",","],
+  ["identifier","i"],
+  ["paren.rparen","])"],
+  ["identifier","cube"],
+  ["paren.lparen","("],
+  ["constant.numeric","10"],
+  ["paren.rparen",")"],
+  ["text",";"]
+],[
+   "start",
+  ["paren.rparen","}"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_scala.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_scala.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_scala.json
new file mode 100644
index 0000000..01dd3ce
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_scala.json
@@ -0,0 +1,542 @@
+[[
+   "start",
+  ["comment","// http://www.scala-lang.org/node/54"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","package"],
+  ["text"," "],
+  ["identifier","examples"],
+  ["text","."],
+  ["identifier","actors"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","import"],
+  ["text"," "],
+  ["identifier","scala"],
+  ["text","."],
+  ["identifier","actors"],
+  ["text","."],
+  ["identifier","Actor"]
+],[
+   "start",
+  ["keyword","import"],
+  ["text"," "],
+  ["identifier","scala"],
+  ["text","."],
+  ["identifier","actors"],
+  ["text","."],
+  ["identifier","Actor"],
+  ["text","."],
+  ["identifier","_"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","abstract"],
+  ["text"," "],
+  ["keyword","class"],
+  ["text"," "],
+  ["identifier","PingMessage"]
+],[
+   "start",
+  ["keyword","case"],
+  ["text"," "],
+  ["keyword","object"],
+  ["text"," "],
+  ["identifier","Start"],
+  ["text"," "],
+  ["keyword","extends"],
+  ["text"," "],
+  ["identifier","PingMessage"]
+],[
+   "start",
+  ["keyword","case"],
+  ["text"," "],
+  ["keyword","object"],
+  ["text"," "],
+  ["identifier","SendPing"],
+  ["text"," "],
+  ["keyword","extends"],
+  ["text"," "],
+  ["identifier","PingMessage"]
+],[
+   "start",
+  ["keyword","case"],
+  ["text"," "],
+  ["keyword","object"],
+  ["text"," "],
+  ["identifier","Pong"],
+  ["text"," "],
+  ["keyword","extends"],
+  ["text"," "],
+  ["identifier","PingMessage"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","abstract"],
+  ["text"," "],
+  ["keyword","class"],
+  ["text"," "],
+  ["identifier","PongMessage"]
+],[
+   "start",
+  ["keyword","case"],
+  ["text"," "],
+  ["keyword","object"],
+  ["text"," "],
+  ["identifier","Ping"],
+  ["text"," "],
+  ["keyword","extends"],
+  ["text"," "],
+  ["identifier","PongMessage"]
+],[
+   "start",
+  ["keyword","case"],
+  ["text"," "],
+  ["keyword","object"],
+  ["text"," "],
+  ["identifier","Stop"],
+  ["text"," "],
+  ["keyword","extends"],
+  ["text"," "],
+  ["identifier","PongMessage"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","object"],
+  ["text"," "],
+  ["identifier","pingpong"],
+  ["text"," "],
+  ["keyword","extends"],
+  ["text"," "],
+  ["identifier","Application"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","val"],
+  ["text"," "],
+  ["identifier","pong"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["keyword","new"],
+  ["text"," "],
+  ["identifier","Pong"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","val"],
+  ["text"," "],
+  ["identifier","ping"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["keyword","new"],
+  ["text"," "],
+  ["identifier","Ping"],
+  ["paren.lparen","("],
+  ["constant.numeric","100000"],
+  ["text",", "],
+  ["identifier","pong"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","  "],
+  ["identifier","ping"],
+  ["text","."],
+  ["identifier","start"]
+],[
+   "start",
+  ["text","  "],
+  ["identifier","pong"],
+  ["text","."],
+  ["identifier","start"]
+],[
+   "start",
+  ["text","  "],
+  ["identifier","ping"],
+  ["text"," "],
+  ["keyword.operator","!"],
+  ["text"," "],
+  ["identifier","Start"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","class"],
+  ["text"," "],
+  ["identifier","Ping"],
+  ["paren.lparen","("],
+  ["identifier","count"],
+  ["text",": "],
+  ["support.function","Int"],
+  ["text",", "],
+  ["identifier","pong"],
+  ["text",": "],
+  ["identifier","Actor"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["keyword","extends"],
+  ["text"," "],
+  ["identifier","Actor"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","def"],
+  ["text"," "],
+  ["identifier","act"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","println"],
+  ["paren.lparen","("],
+  ["string","\"Ping: Initializing with count \""],
+  ["keyword.operator","+"],
+  ["identifier","count"],
+  ["keyword.operator","+"],
+  ["string","\": \""],
+  ["keyword.operator","+"],
+  ["identifier","pong"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","var"],
+  ["text"," "],
+  ["identifier","pingsLeft"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","count"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","loop"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","      "],
+  ["identifier","react"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","case"],
+  ["text"," "],
+  ["identifier","Start"],
+  ["text"," "],
+  ["keyword.operator","=>"]
+],[
+   "start",
+  ["text","          "],
+  ["identifier","println"],
+  ["paren.lparen","("],
+  ["string","\"Ping: starting.\""],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","          "],
+  ["identifier","pong"],
+  ["text"," "],
+  ["keyword.operator","!"],
+  ["text"," "],
+  ["identifier","Ping"]
+],[
+   "start",
+  ["text","          "],
+  ["identifier","pingsLeft"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","pingsLeft"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["text"," "],
+  ["constant.numeric","1"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","case"],
+  ["text"," "],
+  ["identifier","SendPing"],
+  ["text"," "],
+  ["keyword.operator","=>"]
+],[
+   "start",
+  ["text","          "],
+  ["identifier","pong"],
+  ["text"," "],
+  ["keyword.operator","!"],
+  ["text"," "],
+  ["identifier","Ping"]
+],[
+   "start",
+  ["text","          "],
+  ["identifier","pingsLeft"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","pingsLeft"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["text"," "],
+  ["constant.numeric","1"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","case"],
+  ["text"," "],
+  ["identifier","Pong"],
+  ["text"," "],
+  ["keyword.operator","=>"]
+],[
+   "start",
+  ["text","          "],
+  ["keyword","if"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["identifier","pingsLeft"],
+  ["text"," "],
+  ["keyword.operator","%"],
+  ["text"," "],
+  ["constant.numeric","1000"],
+  ["text"," "],
+  ["keyword.operator","=="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","            "],
+  ["identifier","println"],
+  ["paren.lparen","("],
+  ["string","\"Ping: pong from: \""],
+  ["keyword.operator","+"],
+  ["identifier","sender"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","          "],
+  ["keyword","if"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["identifier","pingsLeft"],
+  ["text"," "],
+  ["keyword.operator",">"],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","            "],
+  ["identifier","self"],
+  ["text"," "],
+  ["keyword.operator","!"],
+  ["text"," "],
+  ["identifier","SendPing"]
+],[
+   "start",
+  ["text","          "],
+  ["keyword","else"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","            "],
+  ["identifier","println"],
+  ["paren.lparen","("],
+  ["string","\"Ping: Stop.\""],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","            "],
+  ["identifier","pong"],
+  ["text"," "],
+  ["keyword.operator","!"],
+  ["text"," "],
+  ["identifier","Stop"]
+],[
+   "start",
+  ["text","            "],
+  ["identifier","exit"],
+  ["paren.lparen","("],
+  ["symbol.constant","'stop"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","          "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","      "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","  "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","class"],
+  ["text"," "],
+  ["identifier","Pong"],
+  ["text"," "],
+  ["keyword","extends"],
+  ["text"," "],
+  ["identifier","Actor"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword","def"],
+  ["text"," "],
+  ["identifier","act"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","var"],
+  ["text"," "],
+  ["identifier","pongCount"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","0"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","loop"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","      "],
+  ["identifier","react"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","case"],
+  ["text"," "],
+  ["identifier","Ping"],
+  ["text"," "],
+  ["keyword.operator","=>"]
+],[
+   "start",
+  ["text","          "],
+  ["keyword","if"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["identifier","pongCount"],
+  ["text"," "],
+  ["keyword.operator","%"],
+  ["text"," "],
+  ["constant.numeric","1000"],
+  ["text"," "],
+  ["keyword.operator","=="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","            "],
+  ["identifier","println"],
+  ["paren.lparen","("],
+  ["string","\"Pong: ping \""],
+  ["keyword.operator","+"],
+  ["identifier","pongCount"],
+  ["keyword.operator","+"],
+  ["string","\" from \""],
+  ["keyword.operator","+"],
+  ["identifier","sender"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","          "],
+  ["identifier","sender"],
+  ["text"," "],
+  ["keyword.operator","!"],
+  ["text"," "],
+  ["identifier","Pong"]
+],[
+   "start",
+  ["text","          "],
+  ["identifier","pongCount"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","pongCount"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["constant.numeric","1"]
+],[
+   "start",
+  ["text","        "],
+  ["keyword","case"],
+  ["text"," "],
+  ["identifier","Stop"],
+  ["text"," "],
+  ["keyword.operator","=>"]
+],[
+   "start",
+  ["text","          "],
+  ["identifier","println"],
+  ["paren.lparen","("],
+  ["string","\"Pong: Stop.\""],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","          "],
+  ["identifier","exit"],
+  ["paren.lparen","("],
+  ["symbol.constant","'stop"],
+  ["paren.rparen",")"]
+],[
+   "start",
+  ["text","      "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","  "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["paren.rparen","}"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_scheme.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_scheme.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_scheme.json
new file mode 100644
index 0000000..42f4aa6
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_scheme.json
@@ -0,0 +1,216 @@
+[[
+   "start",
+  ["text","("],
+  ["storage.type.function-type.scheme","define"],
+  ["text"," "],
+  ["text","("],
+  ["identifier","prompt-for-cd"],
+  ["text",")"]
+],[
+   "start",
+  ["text","   "],
+  ["string","\"Prompts"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","for"],
+  ["text"," "],
+  ["identifier","CD"],
+  ["text","\""]
+],[
+   "start",
+  ["text","   ("],
+  ["identifier","prompt-read"],
+  ["text"," "],
+  ["string","\"Title\""],
+  ["text"," "],
+  ["constant.numeric","1.53"],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["text","/"],
+  ["constant.numeric","4"],
+  ["text"," "],
+  ["constant.numeric","1.7"],
+  ["text"," "],
+  ["constant.numeric","1.7e0"],
+  ["text"," "],
+  ["constant.numeric","2.9E-4"],
+  ["text"," "],
+  ["constant.numeric","+42"],
+  ["text"," "],
+  ["constant.numeric","-7"],
+  ["text"," "],
+  ["constant.numeric","#b001"],
+  ["text"," "],
+  ["constant.numeric","#b001"],
+  ["text","/"],
+  ["constant.numeric","100"],
+  ["text"," "],
+  ["constant.numeric","#o777"],
+  ["text"," "],
+  ["constant.numeric","#O777"],
+  ["text"," "],
+  ["constant.numeric","#xabc55"],
+  ["text"," "],
+  ["identifier","#c"],
+  ["text","("],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["constant.numeric","-5.6"],
+  ["text","))"]
+],[
+   "start",
+  ["text","   ("],
+  ["identifier","prompt-read"],
+  ["text"," "],
+  ["string","\"Artist\""],
+  ["text",")"]
+],[
+   "start",
+  ["text","   ("],
+  ["keyword.operator","or"],
+  ["text"," ("],
+  ["identifier","parse-integer"],
+  ["text"," ("],
+  ["identifier","prompt-read"],
+  ["text"," "],
+  ["string","\"Rating\""],
+  ["text",") "],
+  ["punctuation.definition.constant.character.scheme","#:junk-allowed"],
+  ["text"," "],
+  ["constant.language","#t"],
+  ["text",") "],
+  ["constant.numeric","0"],
+  ["text",")"]
+],[
+   "start",
+  ["text","  ("],
+  ["keyword.control","if"],
+  ["text"," "],
+  ["identifier","x"],
+  ["text"," ("],
+  ["support.function","format"],
+  ["text"," "],
+  ["constant.language","#t"],
+  ["text"," "],
+  ["string","\"yes\""],
+  ["text",") ("],
+  ["support.function","format"],
+  ["text"," "],
+  ["constant.language","#f"],
+  ["text"," "],
+  ["string","\"no\""],
+  ["text",") "],
+  ["comment",";and here comment"]
+],[
+   "start",
+  ["text","  ) "]
+],[
+   "start",
+  ["text","  "],
+  ["comment",";; second line comment"]
+],[
+   "start",
+  ["text","  '(+ "],
+  ["constant.numeric","1"],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["text",")"]
+],[
+   "start",
+  ["text","  ("],
+  ["identifier","position-if-not"],
+  ["text"," "],
+  ["identifier","char-set"],
+  ["text",":"],
+  ["identifier","whitespace"],
+  ["text"," "],
+  ["identifier","line"],
+  ["text"," "],
+  ["punctuation.definition.constant.character.scheme","#:start"],
+  ["text"," "],
+  ["identifier","beg"],
+  ["text","))"]
+],[
+   "start",
+  ["text","  ("],
+  ["support.function","quote"],
+  ["text"," ("],
+  ["identifier","privet"],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["text"," "],
+  ["constant.numeric","3"],
+  ["text","))"]
+],[
+   "start",
+  ["text","  '("],
+  ["identifier","hello"],
+  ["text"," "],
+  ["identifier","world"],
+  ["text",")"]
+],[
+   "start",
+  ["text","  (* "],
+  ["constant.numeric","5"],
+  ["text"," "],
+  ["constant.numeric","7"],
+  ["text",")"]
+],[
+   "start",
+  ["text","  ("],
+  ["constant.numeric","1"],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["text"," "],
+  ["constant.numeric","34"],
+  ["text"," "],
+  ["constant.numeric","5"],
+  ["text",")"]
+],[
+   "start",
+  ["text","  ("],
+  ["punctuation.definition.constant.character.scheme","#:use"],
+  ["text"," "],
+  ["string","\"aaaa\""],
+  ["text",")"]
+],[
+   "start",
+  ["text","  ("],
+  ["keyword.control","let"],
+  ["text"," (("],
+  ["identifier","x"],
+  ["text"," "],
+  ["constant.numeric","10"],
+  ["text",") ("],
+  ["identifier","y"],
+  ["text"," "],
+  ["constant.numeric","20"],
+  ["text","))"]
+],[
+   "start",
+  ["text","    ("],
+  ["identifier","display"],
+  ["text"," (+ "],
+  ["identifier","x"],
+  ["text"," "],
+  ["identifier","y"],
+  ["text","))"]
+],[
+   "start",
+  ["text","  ) "]
+],[
+   "start"
+],[
+   "start",
+  ["text","  "],
+  ["string","\"asdad"],
+  ["constant.character.escape.scheme","\\0"],
+  ["string","eqweqe\""]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_scss.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_scss.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_scss.json
new file mode 100644
index 0000000..7e92f15
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_scss.json
@@ -0,0 +1,123 @@
+[[
+   "start",
+  ["comment","/* style.scss */"]
+],[
+   "start"
+],[
+   "start",
+  ["variable.language","#navbar"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["variable","$navbar-width"],
+  ["text",": "],
+  ["constant.numeric","800px"],
+  ["text",";"]
+],[
+   "start",
+  ["text","    "],
+  ["variable","$items"],
+  ["text",": "],
+  ["constant.numeric","5"],
+  ["text",";"]
+],[
+   "start",
+  ["text","    "],
+  ["variable","$navbar-color"],
+  ["text",": "],
+  ["constant.numeric","#ce4dd6"],
+  ["text",";"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    "],
+  ["support.type","width"],
+  ["text",": "],
+  ["variable","$navbar-width"],
+  ["text",";"]
+],[
+   "start",
+  ["text","    "],
+  ["support.type","border-bottom"],
+  ["text",": "],
+  ["constant.numeric","2px"],
+  ["text"," "],
+  ["constant.language","solid"],
+  ["text"," "],
+  ["variable","$navbar-color"],
+  ["text",";"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    "],
+  ["variable.language","li"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","        "],
+  ["support.type","float"],
+  ["text",": "],
+  ["support.type","left"],
+  ["text",";"]
+],[
+   "start",
+  ["text","        "],
+  ["support.type","width"],
+  ["text",": "],
+  ["variable","$navbar-width"],
+  ["text","/"],
+  ["variable","$items"],
+  ["text"," "],
+  ["constant","-"],
+  ["text"," "],
+  ["constant.numeric","10px"],
+  ["text",";"]
+],[
+   "start"
+],[
+   "start",
+  ["text","        "],
+  ["support.type","background-color"],
+  ["text",": "],
+  ["support.function","lighten"],
+  ["paren.lparen","("],
+  ["variable","$navbar-color"],
+  ["text",", "],
+  ["constant.numeric","20%"],
+  ["paren.rparen",")"],
+  ["text",";"]
+],[
+   "start",
+  ["text","        &"],
+  ["variable.language",":hover"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","            "],
+  ["support.type","background-color"],
+  ["text",": "],
+  ["support.function","lighten"],
+  ["paren.lparen","("],
+  ["variable","$navbar-color"],
+  ["text",", "],
+  ["constant.numeric","10%"],
+  ["paren.rparen",")"],
+  ["text",";"]
+],[
+   "start",
+  ["text","        "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "start",
+  ["paren.rparen","}"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_sh.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_sh.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_sh.json
new file mode 100644
index 0000000..e4ab341
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_sh.json
@@ -0,0 +1,334 @@
+[[
+   "start",
+  ["comment","#!/bin/sh"]
+],[
+   "start"
+],[
+   "start",
+  ["comment","# Script to open a browser to current branch"]
+],[
+   "start",
+  ["comment","# Repo formats:"]
+],[
+   "start",
+  ["comment","# ssh   git@github.com:richoH/gh_pr.git"]
+],[
+   "start",
+  ["comment","# http  https://richoH@github.com/richoH/gh_pr.git"]
+],[
+   "start",
+  ["comment","# git   git://github.com/richoH/gh_pr.git"]
+],[
+   "start"
+],[
+   "start",
+  ["variable","username="],
+  ["text","`"],
+  ["identifier","git"],
+  ["text"," "],
+  ["identifier","config"],
+  ["text"," "],
+  ["keyword.operator","--"],
+  ["identifier","get"],
+  ["text"," "],
+  ["identifier","github"],
+  ["text","."],
+  ["identifier","user"],
+  ["text","`"]
+],[
+   "start"
+],[
+   "start",
+  ["support.function","get_repo()"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "start",
+  ["text","    "],
+  ["identifier","git"],
+  ["text"," "],
+  ["identifier","remote"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["identifier","v"],
+  ["text"," | "],
+  ["identifier","grep"],
+  ["text"," $"],
+  ["paren.lparen","{"],
+  ["text","@:"],
+  ["keyword.operator","-"],
+  ["variable","$username"],
+  ["paren.rparen","}"],
+  ["text"," | "],
+  ["keyword","while"],
+  ["text"," "],
+  ["keyword","read"],
+  ["text"," "],
+  ["identifier","remote"],
+  ["text","; "],
+  ["keyword","do"]
+],[
+   "start",
+  ["text","      "],
+  ["keyword","if"],
+  ["text"," "],
+  ["variable","repo="],
+  ["text","`"],
+  ["support.function.builtin","echo"],
+  ["text"," "],
+  ["variable","$remote"],
+  ["text"," | "],
+  ["identifier","grep"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["identifier","E"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["identifier","o"],
+  ["text"," "],
+  ["string","\"git@github.com:[^ ]*\""],
+  ["text","`; "],
+  ["keyword","then"]
+],[
+   "start",
+  ["text","          "],
+  ["support.function.builtin","echo"],
+  ["text"," "],
+  ["variable","$repo"],
+  ["text"," | "],
+  ["identifier","sed"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["identifier","e"],
+  ["text"," "],
+  ["string","\"s/^git@github\\.com://\""],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["identifier","e"],
+  ["text"," "],
+  ["string","\"s/\\.git$//\""]
+],[
+   "start",
+  ["text","          "],
+  ["support.function.builtin","exit"],
+  ["text"," "],
+  ["constant.numeric","1"]
+],[
+   "start",
+  ["text","      "],
+  ["keyword","fi"]
+],[
+   "start",
+  ["text","      "],
+  ["keyword","if"],
+  ["text"," "],
+  ["variable","repo="],
+  ["text","`"],
+  ["support.function.builtin","echo"],
+  ["text"," "],
+  ["variable","$remote"],
+  ["text"," | "],
+  ["identifier","grep"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["identifier","E"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["identifier","o"],
+  ["text"," "],
+  ["string","\"https?://([^@]*@)?github.com/[^ ]*\\.git\""],
+  ["text","`; "],
+  ["keyword","then"]
+],[
+   "start",
+  ["text","          "],
+  ["support.function.builtin","echo"],
+  ["text"," "],
+  ["variable","$repo"],
+  ["text"," | "],
+  ["identifier","sed"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["identifier","e"],
+  ["text"," "],
+  ["string","\"s|^https?://||\""],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["identifier","e"],
+  ["text"," "],
+  ["string","\"s/^.*github\\.com\\///\""],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["identifier","e"],
+  ["text"," "],
+  ["string","\"s/\\.git$//\""]
+],[
+   "start",
+  ["text","          "],
+  ["support.function.builtin","exit"],
+  ["text"," "],
+  ["constant.numeric","1"]
+],[
+   "start",
+  ["text","      "],
+  ["keyword","fi"]
+],[
+   "start",
+  ["text","      "],
+  ["keyword","if"],
+  ["text"," "],
+  ["variable","repo="],
+  ["text","`"],
+  ["support.function.builtin","echo"],
+  ["text"," "],
+  ["variable","$remote"],
+  ["text"," | "],
+  ["identifier","grep"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["identifier","E"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["identifier","o"],
+  ["text"," "],
+  ["string","\"git://github.com/[^ ]*\\.git\""],
+  ["text","`; "],
+  ["keyword","then"]
+],[
+   "start",
+  ["text","          "],
+  ["support.function.builtin","echo"],
+  ["text"," "],
+  ["variable","$repo"],
+  ["text"," | "],
+  ["identifier","sed"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["identifier","e"],
+  ["text"," "],
+  ["string","\"s|^git://github.com/||\""],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["identifier","e"],
+  ["text"," "],
+  ["string","\"s/\\.git$//\""]
+],[
+   "start",
+  ["text","          "],
+  ["support.function.builtin","exit"],
+  ["text"," "],
+  ["constant.numeric","1"]
+],[
+   "start",
+  ["text","      "],
+  ["keyword","fi"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","done"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    "],
+  ["keyword","if"],
+  ["text"," "],
+  ["paren.lparen","["],
+  ["text"," "],
+  ["variable.language","$?"],
+  ["text"," "],
+  ["keyword.operator","-"],
+  ["identifier","eq"],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["paren.rparen","]"],
+  ["text","; "],
+  ["keyword","then"]
+],[
+   "start",
+  ["text","        "],
+  ["support.function.builtin","echo"],
+  ["text"," "],
+  ["string","\"Couldn't find a valid remote\""],
+  ["text"," "],
+  ["keyword.operator",">"],
+  ["support.function","&2"]
+],[
+   "start",
+  ["text","        "],
+  ["support.function.builtin","exit"],
+  ["text"," "],
+  ["constant.numeric","1"]
+],[
+   "start",
+  ["text","    "],
+  ["keyword","fi"]
+],[
+   "start",
+  ["paren.rparen","}"]
+],[
+   "start"
+],[
+   "start",
+  ["support.function.builtin","echo"],
+  ["text"," $"],
+  ["paren.lparen","{"],
+  ["text","#"],
+  ["identifier","x"],
+  ["paren.lparen","["],
+  ["text","@"],
+  ["paren.rparen","]}"]
+],[
+   "start"
+],[
+   "start",
+  ["keyword","if"],
+  ["text"," "],
+  ["variable","repo="],
+  ["text","`"],
+  ["identifier","get_repo"],
+  ["text"," $@`; "],
+  ["keyword","then"]
+],[
+   "start",
+  ["text","    "],
+  ["variable","branch="],
+  ["text","`"],
+  ["identifier","git"],
+  ["text"," "],
+  ["identifier","symbolic"],
+  ["keyword.operator","-"],
+  ["identifier","ref"],
+  ["text"," "],
+  ["identifier","HEAD"],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["keyword.operator",">/"],
+  ["identifier","dev"],
+  ["keyword.operator","/"],
+  ["identifier","null"],
+  ["text","`"]
+],[
+   "start",
+  ["text","    "],
+  ["support.function.builtin","echo"],
+  ["text"," "],
+  ["string","\"http://github.com/"],
+  ["constant","$repo"],
+  ["string","/pull/new/${branch##refs/heads/}\""]
+],[
+   "start",
+  ["keyword","else"]
+],[
+   "start",
+  ["text","    "],
+  ["support.function.builtin","exit"],
+  ["text"," "],
+  ["constant.numeric","1"]
+],[
+   "start",
+  ["keyword","fi"]
+],[
+   "start"
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_snippets.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_snippets.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_snippets.json
new file mode 100644
index 0000000..308683b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_snippets.json
@@ -0,0 +1,159 @@
+[[
+   "start",
+  ["comment","# Function"]
+],[
+   "start",
+  ["constant.language.escape","snippet"],
+  ["text"," fun"]
+],[
+   "sn-start",
+  ["text","\tfunction "],
+  ["markup.list","${"],
+  ["constant.numeric","1"],
+  ["text","?:function_name"],
+  ["markup.list","}"],
+  ["text","("],
+  ["markup.list","${"],
+  ["constant.numeric","2"],
+  ["punctuation.operator",":"],
+  ["text","argument"],
+  ["markup.list","}"],
+  ["text",") {"]
+],[
+   "sn-start",
+  ["text","\t\t"],
+  ["markup.list","${"],
+  ["constant.numeric","3"],
+  ["punctuation.operator",":"],
+  ["text","// body..."],
+  ["markup.list","}"]
+],[
+   "sn-start",
+  ["text","\t}"]
+],[
+   "start",
+  ["comment","# Anonymous Function"]
+],[
+   "start",
+  ["constant.language.escape","regex "],
+  ["keyword","/"],
+  ["text","((=)\\s*|(:)\\s*|(\\()|\\b)"],
+  ["keyword","/"],
+  ["text","f"],
+  ["keyword","/"],
+  ["text","(\\))?"],
+  ["keyword","/"]
+],[
+   "start",
+  ["constant.language.escape","name"],
+  ["text"," f"]
+],[
+   "sn-start",
+  ["text","\tfunction"],
+  ["markup.list","${"],
+  ["variable","M1"],
+  ["text","?: "],
+  ["markup.list","${"],
+  ["constant.numeric","1"],
+  ["punctuation.operator",":"],
+  ["text","functionName"],
+  ["markup.list","}}"],
+  ["text","("],
+  ["variable","$2"],
+  ["text",") {"]
+],[
+   "sn-start",
+  ["text","\t\t"],
+  ["markup.list","${"],
+  ["constant.numeric","0"],
+  ["punctuation.operator",":"],
+  ["keyword","$TM_SELECTED_TEXT"],
+  ["markup.list","}"]
+],[
+   "sn-start",
+  ["text","\t}"],
+  ["markup.list","${"],
+  ["variable","M2"],
+  ["text","?;"],
+  ["markup.list","}${"],
+  ["variable","M3"],
+  ["text","?,"],
+  ["markup.list","}${"],
+  ["variable","M4"],
+  ["text","?)"],
+  ["markup.list","}"]
+],[
+   "start",
+  ["comment","# Immediate function"]
+],[
+   "start",
+  ["constant.language.escape","trigger"],
+  ["text"," \\(?f\\("]
+],[
+   "start",
+  ["constant.language.escape","endTrigger"],
+  ["text"," \\)?"]
+],[
+   "start",
+  ["constant.language.escape","snippet"],
+  ["text"," f("]
+],[
+   "sn-start",
+  ["text","\t(function("],
+  ["markup.list","${"],
+  ["constant.numeric","1"],
+  ["markup.list","}"],
+  ["text",") {"]
+],[
+   "sn-start",
+  ["text","\t\t"],
+  ["markup.list","${"],
+  ["constant.numeric","0"],
+  ["punctuation.operator",":"],
+  ["markup.list","${"],
+  ["keyword","TM_SELECTED_TEXT"],
+  ["punctuation.operator",":"],
+  ["text","/* code */"],
+  ["markup.list","}}"]
+],[
+   "sn-start",
+  ["text","\t}("],
+  ["markup.list","${"],
+  ["constant.numeric","1"],
+  ["markup.list","}"],
+  ["text","));"]
+],[
+   "start",
+  ["comment","# if"]
+],[
+   "start",
+  ["constant.language.escape","snippet"],
+  ["text"," if"]
+],[
+   "sn-start",
+  ["text","\tif ("],
+  ["markup.list","${"],
+  ["constant.numeric","1"],
+  ["punctuation.operator",":"],
+  ["text","true"],
+  ["markup.list","}"],
+  ["text",") {"]
+],[
+   "sn-start",
+  ["text","\t\t"],
+  ["markup.list","${"],
+  ["constant.numeric","0"],
+  ["markup.list","}"]
+],[
+   "sn-start",
+  ["text","\t}"]
+],[
+   "sn-start",
+  ["text","\t"]
+],[
+   "sn-start",
+  ["text","\t"]
+],[
+   "sn-start",
+  ["text","\t"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_sql.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_sql.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_sql.json
new file mode 100644
index 0000000..09a3ef9
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_sql.json
@@ -0,0 +1,54 @@
+[[
+   "start",
+  ["keyword","SELECT"],
+  ["text"," "],
+  ["identifier","city"],
+  ["text",", "],
+  ["support.function","COUNT"],
+  ["paren.lparen","("],
+  ["identifier","id"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["keyword","AS"],
+  ["text"," "],
+  ["identifier","users_count"]
+],[
+   "start",
+  ["keyword","FROM"],
+  ["text"," "],
+  ["identifier","users"]
+],[
+   "start",
+  ["keyword","WHERE"],
+  ["text"," "],
+  ["identifier","group_name"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["string","'salesman'"]
+],[
+   "start",
+  ["keyword","AND"],
+  ["text"," "],
+  ["identifier","created"],
+  ["text"," "],
+  ["keyword.operator",">"],
+  ["text"," "],
+  ["string","'2011-05-21'"]
+],[
+   "start",
+  ["keyword","GROUP"],
+  ["text"," "],
+  ["keyword","BY"],
+  ["text"," "],
+  ["constant.numeric","1"]
+],[
+   "start",
+  ["keyword","ORDER"],
+  ["text"," "],
+  ["keyword","BY"],
+  ["text"," "],
+  ["constant.numeric","2"],
+  ["text"," "],
+  ["keyword","DESC"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_stylus.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_stylus.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_stylus.json
new file mode 100644
index 0000000..f24993f
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_stylus.json
@@ -0,0 +1,271 @@
+[[
+   "start",
+  ["comment","// I'm a comment!"]
+],[
+   "start"
+],[
+   "comment",
+  ["comment","/*"]
+],[
+   "comment",
+  ["comment"," * Adds the given numbers together."]
+],[
+   "start",
+  ["comment"," */"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "comment",
+  ["comment","/*!"]
+],[
+   "comment",
+  ["comment"," * Adds the given numbers together."]
+],[
+   "start",
+  ["comment"," */"]
+],[
+   "start"
+],[
+   "start"
+],[
+   "start",
+  ["entity.name.function.stylus","asdasdasdad"],
+  ["text","("],
+  ["text","df, ad"],
+  ["keyword.operator.stylus","="],
+  ["constant.numeric","23"],
+  ["text",")"]
+],[
+   "start"
+],[
+   "start",
+  ["entity.name.function.stylus","add"],
+  ["text","("],
+  ["entity.name.tag.stylus","a"],
+  ["text",", "],
+  ["entity.name.tag.stylus","b"],
+  ["text"," "],
+  ["keyword.operator.stylus","="],
+  ["text"," "],
+  ["entity.name.tag.stylus","a"],
+  ["text",")"]
+],[
+   "start",
+  ["text","   "],
+  ["entity.name.tag.stylus","a"],
+  ["text"," "],
+  ["keyword.operator.stylus","+"],
+  ["text"," "],
+  ["entity.name.tag.stylus","b"]
+],[
+   "start",
+  ["entity.name.function.stylus","green"],
+  ["text","("],
+  ["constant.numeric","#0c0"],
+  ["text",")"]
+],[
+   "start",
+  ["text"," add("],
+  ["constant.numeric","10"],
+  ["text",", "],
+  ["constant.numeric","5"],
+  ["text",")"]
+],[
+   "start",
+  ["text"," "],
+  ["comment","// => 15"]
+],[
+   "start"
+],[
+   "start",
+  ["text"," add("],
+  ["constant.numeric","10"],
+  ["text",")"]
+],[
+   "start",
+  ["text"," add("],
+  ["entity.name.tag.stylus","a"],
+  ["text",", "],
+  ["entity.name.tag.stylus","b"],
+  ["text",")"]
+],[
+   "start"
+],[
+   "start",
+  ["entity.language.stylus","    &"],
+  ["text","asdasd"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    ("],
+  ["variable.language.stylus","arguments"],
+  ["text",")"]
+],[
+   "start"
+],[
+   "start",
+  ["text","    "],
+  ["keyword.stylus","@sdfsdf"]
+],[
+   "start",
+  ["entity.other.attribute-name.class.stylus",".signatures"]
+],[
+   "start",
+  ["text","  "],
+  ["support.type","background-color"],
+  ["text"," "],
+  ["constant.numeric","#e0e8e0"]
+],[
+   "start",
+  ["text","  "],
+  ["support.type","border"],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["keyword","px"],
+  ["text"," "],
+  ["support.constant","solid"],
+  ["text"," grayLighter"]
+],[
+   "start",
+  ["text","  "],
+  ["support.type","box-shadow"],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["constant.numeric","3"],
+  ["keyword","px"],
+  ["text"," grayLightest"]
+],[
+   "start",
+  ["text","  "],
+  ["support.type","border-radius"],
+  ["text"," "],
+  ["constant.numeric","3"],
+  ["keyword","px"]
+],[
+   "start",
+  ["text","  "],
+  ["support.type","padding"],
+  ["text"," "],
+  ["constant.numeric","3"],
+  ["keyword","px"],
+  ["text"," "],
+  ["constant.numeric","5"],
+  ["keyword","px"]
+],[
+   "start",
+  ["text","  "],
+  ["string","\"adsads\""]
+],[
+   "start",
+  ["text","  "],
+  ["support.type","margin-left"],
+  ["text"," "],
+  ["constant.numeric","0"]
+],[
+   "start",
+  ["text","  "],
+  ["support.type","list-style"],
+  ["text"," "],
+  ["support.constant","none"]
+],[
+   "start",
+  ["entity.other.attribute-name.class.stylus",".signature"]
+],[
+   "start",
+  ["text","  "],
+  ["support.type","list-style"],
+  ["text"," "],
+  ["support.constant","none"]
+],[
+   "start",
+  ["text","  "],
+  ["support.type","display"],
+  ["text",": "],
+  ["support.constant","inline"]
+],[
+   "start",
+  ["text","  "],
+  ["support.type","margin-left"],
+  ["text"," "],
+  ["constant.numeric","0"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword.operator.stylus",">"],
+  ["text"," "],
+  ["entity.name.tag.stylus","li"]
+],[
+   "start",
+  ["text","    "],
+  ["support.type","display"],
+  ["text"," "],
+  ["support.constant","inline"]
+],[
+   "start",
+  ["keyword.operator.stylus","is"],
+  ["text"," "],
+  ["keyword.operator.stylus","not"]
+],[
+   "start",
+  ["entity.other.attribute-name.class.stylus",".signature-values"]
+],[
+   "start",
+  ["text","  "],
+  ["support.type","list-style"],
+  ["text"," "],
+  ["support.constant","none"]
+],[
+   "start",
+  ["text","  "],
+  ["support.type","display"],
+  ["text"," "],
+  ["support.constant","inline"]
+],[
+   "start",
+  ["text","  "],
+  ["support.type","margin-left"],
+  ["text"," "],
+  ["constant.numeric","0"]
+],[
+   "start",
+  ["entity.language.stylus","  &"],
+  ["punctuation",":"],
+  ["entity.other.attribute-name.pseudo-element.css","before"]
+],[
+   "start",
+  ["text","    "],
+  ["support.type","content"],
+  ["text"," "],
+  ["string","'→'"]
+],[
+   "start",
+  ["text","    "],
+  ["support.type","margin"],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["text"," "],
+  ["constant.numeric","5"],
+  ["keyword","px"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword.operator.stylus",">"],
+  ["text"," "],
+  ["entity.name.tag.stylus","li"]
+],[
+   "start",
+  ["text","  "],
+  ["keyword.control.stylus","!important"]
+],[
+   "start"
+],[
+   "start",
+  ["text","  "],
+  ["keyword.control.stylus","unless"]
+]]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/_test/tokens_svg.json
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/_test/tokens_svg.json b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_svg.json
new file mode 100644
index 0000000..f92fbbb
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/_test/tokens_svg.json
@@ -0,0 +1,684 @@
+[[
+   "meta.tag.punctuation.begin0",
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","svg"]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","  "],
+  ["entity.other.attribute-name","width"],
+  ["keyword.operator.separator","="],
+  ["string","\"800\""],
+  ["text"," "],
+  ["entity.other.attribute-name","height"],
+  ["keyword.operator.separator","="],
+  ["string","\"600\""]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","  "],
+  ["entity.other.attribute-name","xmlns"],
+  ["keyword.operator.separator","="],
+  ["string","\"http://www.w3.org/2000/svg\""]
+],[
+   "start",
+  ["text","  "],
+  ["entity.other.attribute-name","onload"],
+  ["keyword.operator.separator","="],
+  ["string","\"StartAnimation(evt)\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "start",
+  ["text","  "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","title"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","Test Tube Progress Bar"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","title"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","  "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","desc"],
+  ["meta.tag.punctuation.end",">"],
+  ["text","Created for the Web Directions SVG competition"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","desc"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "js-no_regex",
+  ["text","  "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name.script","script"],
+  ["text"," "],
+  ["entity.other.attribute-name","type"],
+  ["keyword.operator.separator","="],
+  ["string","\"text/ecmascript\""],
+  ["meta.tag.punctuation.end",">"],
+  ["string.begin","<![CDATA["]
+],[
+   "js-start",
+  ["text","    "],
+  ["storage.type","var"],
+  ["text"," "],
+  ["identifier","timevalue"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","0"],
+  ["punctuation.operator",";"]
+],[
+   "js-start",
+  ["text","    "],
+  ["storage.type","var"],
+  ["text"," "],
+  ["identifier","timer_increment"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","1"],
+  ["punctuation.operator",";"]
+],[
+   "js-start",
+  ["text","    "],
+  ["storage.type","var"],
+  ["text"," "],
+  ["identifier","max_time"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["constant.numeric","100"],
+  ["punctuation.operator",";"]
+],[
+   "js-start",
+  ["text","    "],
+  ["storage.type","var"],
+  ["text"," "],
+  ["identifier","hickory"],
+  ["punctuation.operator",";"]
+],[
+   "js-start",
+  ["text","    "],
+  ["storage.type","var"],
+  ["text"," "],
+  ["identifier","dickory"],
+  ["punctuation.operator",";"]
+],[
+   "js-start",
+  ["text","    "],
+  ["storage.type","var"],
+  ["text"," "],
+  ["identifier","dock"],
+  ["punctuation.operator",";"]
+],[
+   "js-start",
+  ["text","    "],
+  ["storage.type","var"],
+  ["text"," "],
+  ["identifier","i"],
+  ["punctuation.operator",";"]
+],[
+   "js-start"
+],[
+   "js-start",
+  ["text","    "],
+  ["storage.type","function"],
+  ["text"," "],
+  ["entity.name.function","StartAnimation"],
+  ["paren.lparen","("],
+  ["variable.parameter","evt"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "js-start",
+  ["text","        "],
+  ["identifier","hickory"],
+  ["text","  "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","evt"],
+  ["punctuation.operator","."],
+  ["identifier","target"],
+  ["punctuation.operator","."],
+  ["identifier","ownerDocument"],
+  ["punctuation.operator","."],
+  ["support.function.dom","getElementById"],
+  ["paren.lparen","("],
+  ["string","\"hickory\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "js-start",
+  ["text","        "],
+  ["identifier","dickory"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","evt"],
+  ["punctuation.operator","."],
+  ["identifier","target"],
+  ["punctuation.operator","."],
+  ["identifier","ownerDocument"],
+  ["punctuation.operator","."],
+  ["support.function.dom","getElementById"],
+  ["paren.lparen","("],
+  ["string","\"dickory\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "js-start",
+  ["text","        "],
+  ["identifier","dock"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","evt"],
+  ["punctuation.operator","."],
+  ["identifier","target"],
+  ["punctuation.operator","."],
+  ["identifier","ownerDocument"],
+  ["punctuation.operator","."],
+  ["support.function.dom","getElementById"],
+  ["paren.lparen","("],
+  ["string","\"dock\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "js-start"
+],[
+   "js-start",
+  ["text","        "],
+  ["identifier","ShowAndGrowElement"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "js-no_regex",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "js-start",
+  ["text","    "],
+  ["storage.type","function"],
+  ["text"," "],
+  ["entity.name.function","ShowAndGrowElement"],
+  ["paren.lparen","("],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "js-start",
+  ["text","        "],
+  ["identifier","timevalue"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","timevalue"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["identifier","timer_increment"],
+  ["punctuation.operator",";"]
+],[
+   "js-no_regex",
+  ["text","        "],
+  ["keyword","if"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["identifier","timevalue"],
+  ["text"," "],
+  ["keyword.operator",">"],
+  ["text"," "],
+  ["identifier","max_time"],
+  ["paren.rparen",")"]
+],[
+   "js-start",
+  ["text","            "],
+  ["keyword","return"],
+  ["punctuation.operator",";"]
+],[
+   "js-start",
+  ["text","        "],
+  ["comment","// Scale the text string gradually until it is 20 times larger"]
+],[
+   "js-start",
+  ["text","        "],
+  ["identifier","scalefactor"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["identifier","timevalue"],
+  ["text"," "],
+  ["keyword.operator","*"],
+  ["text"," "],
+  ["constant.numeric","650"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["keyword.operator","/"],
+  ["text"," "],
+  ["identifier","max_time"],
+  ["punctuation.operator",";"]
+],[
+   "js-start"
+],[
+   "js-start",
+  ["text","        "],
+  ["keyword","if"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["identifier","timevalue"],
+  ["text"," "],
+  ["keyword.operator","<"],
+  ["text"," "],
+  ["constant.numeric","30"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "js-start",
+  ["text","            "],
+  ["identifier","hickory"],
+  ["punctuation.operator","."],
+  ["support.function.dom","setAttribute"],
+  ["paren.lparen","("],
+  ["string","\"display\""],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["string","\"\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "js-start",
+  ["text","            "],
+  ["identifier","hickory"],
+  ["punctuation.operator","."],
+  ["support.function.dom","setAttribute"],
+  ["paren.lparen","("],
+  ["string","\"transform\""],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["string","\"translate(\""],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["constant.numeric","600"],
+  ["keyword.operator","+"],
+  ["identifier","scalefactor"],
+  ["keyword.operator","*"],
+  ["constant.numeric","3"],
+  ["keyword.operator","*"],
+  ["constant.numeric","-1"],
+  ["text"," "],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["string","\", -144 )\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "js-no_regex",
+  ["text","        "],
+  ["paren.rparen","}"]
+],[
+   "js-no_regex"
+],[
+   "js-start",
+  ["text","        "],
+  ["keyword","if"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["identifier","timevalue"],
+  ["text"," "],
+  ["keyword.operator",">"],
+  ["text"," "],
+  ["constant.numeric","30"],
+  ["text"," "],
+  ["keyword.operator","&&"],
+  ["text"," "],
+  ["identifier","timevalue"],
+  ["text"," "],
+  ["keyword.operator","<"],
+  ["text"," "],
+  ["constant.numeric","66"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "js-start",
+  ["text","            "],
+  ["identifier","dickory"],
+  ["punctuation.operator","."],
+  ["support.function.dom","setAttribute"],
+  ["paren.lparen","("],
+  ["string","\"display\""],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["string","\"\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "js-start",
+  ["text","            "],
+  ["identifier","dickory"],
+  ["punctuation.operator","."],
+  ["support.function.dom","setAttribute"],
+  ["paren.lparen","("],
+  ["string","\"transform\""],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["string","\"translate(\""],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["constant.numeric","-795"],
+  ["keyword.operator","+"],
+  ["identifier","scalefactor"],
+  ["keyword.operator","*"],
+  ["constant.numeric","2"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["string","\", 0 )\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "js-no_regex",
+  ["text","        "],
+  ["paren.rparen","}"]
+],[
+   "js-start",
+  ["text","        "],
+  ["keyword","if"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["identifier","timevalue"],
+  ["text"," "],
+  ["keyword.operator",">"],
+  ["text"," "],
+  ["constant.numeric","66"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["paren.lparen","{"]
+],[
+   "js-start",
+  ["text","            "],
+  ["identifier","dock"],
+  ["punctuation.operator","."],
+  ["support.function.dom","setAttribute"],
+  ["paren.lparen","("],
+  ["string","\"display\""],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["string","\"\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "js-start",
+  ["text","            "],
+  ["identifier","dock"],
+  ["punctuation.operator","."],
+  ["support.function.dom","setAttribute"],
+  ["paren.lparen","("],
+  ["string","\"transform\""],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["string","\"translate(\""],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["paren.lparen","("],
+  ["constant.numeric","1450"],
+  ["keyword.operator","+"],
+  ["identifier","scalefactor"],
+  ["keyword.operator","*"],
+  ["constant.numeric","2"],
+  ["keyword.operator","*"],
+  ["constant.numeric","-1"],
+  ["paren.rparen",")"],
+  ["text"," "],
+  ["keyword.operator","+"],
+  ["text"," "],
+  ["string","\", 144 )\""],
+  ["paren.rparen",")"],
+  ["punctuation.operator",";"]
+],[
+   "js-no_regex",
+  ["text","        "],
+  ["paren.rparen","}"]
+],[
+   "js-no_regex"
+],[
+   "js-no_regex",
+  ["text","        "],
+  ["comment","// Call ShowAndGrowElement again <timer_increment> milliseconds later."]
+],[
+   "js-no_regex",
+  ["text","        "],
+  ["identifier","setTimeout"],
+  ["paren.lparen","("],
+  ["string","\"ShowAndGrowElement()\""],
+  ["punctuation.operator",","],
+  ["text"," "],
+  ["identifier","timer_increment"],
+  ["paren.rparen",")"]
+],[
+   "js-no_regex",
+  ["text","    "],
+  ["paren.rparen","}"]
+],[
+   "js-no_regex",
+  ["text","    "],
+  ["variable.language","window"],
+  ["punctuation.operator","."],
+  ["identifier","ShowAndGrowElement"],
+  ["text"," "],
+  ["keyword.operator","="],
+  ["text"," "],
+  ["identifier","ShowAndGrowElement"]
+],[
+   "start",
+  ["text","  "],
+  ["string.end","]]>"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name.script","script"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start"
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","  "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","rect"]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","    "],
+  ["entity.other.attribute-name","fill"],
+  ["keyword.operator.separator","="],
+  ["string","\"#2e3436\""]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","    "],
+  ["entity.other.attribute-name","fill-rule"],
+  ["keyword.operator.separator","="],
+  ["string","\"nonzero\""]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","    "],
+  ["entity.other.attribute-name","stroke-width"],
+  ["keyword.operator.separator","="],
+  ["string","\"3\""]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","    "],
+  ["entity.other.attribute-name","y"],
+  ["keyword.operator.separator","="],
+  ["string","\"0\""]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","    "],
+  ["entity.other.attribute-name","x"],
+  ["keyword.operator.separator","="],
+  ["string","\"0\""]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","    "],
+  ["entity.other.attribute-name","height"],
+  ["keyword.operator.separator","="],
+  ["string","\"600\""]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","    "],
+  ["entity.other.attribute-name","width"],
+  ["keyword.operator.separator","="],
+  ["string","\"800\""]
+],[
+   "start",
+  ["text","    "],
+  ["entity.other.attribute-name","id"],
+  ["keyword.operator.separator","="],
+  ["string","\"rect3590\""],
+  ["meta.tag.punctuation.end","/>"]
+],[
+   "start"
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","text"]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","       "],
+  ["entity.other.attribute-name","style"],
+  ["keyword.operator.separator","="],
+  ["string","\"font-size:144px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold\""]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","       "],
+  ["entity.other.attribute-name","x"],
+  ["keyword.operator.separator","="],
+  ["string","\"50\""]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","       "],
+  ["entity.other.attribute-name","y"],
+  ["keyword.operator.separator","="],
+  ["string","\"350\""]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","       "],
+  ["entity.other.attribute-name","id"],
+  ["keyword.operator.separator","="],
+  ["string","\"hickory\""]
+],[
+   "start",
+  ["text","       "],
+  ["entity.other.attribute-name","display"],
+  ["keyword.operator.separator","="],
+  ["string","\"none\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        Hickory,"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","text"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","text"]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","       "],
+  ["entity.other.attribute-name","style"],
+  ["keyword.operator.separator","="],
+  ["string","\"font-size:144px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold\""]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","       "],
+  ["entity.other.attribute-name","x"],
+  ["keyword.operator.separator","="],
+  ["string","\"50\""]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","       "],
+  ["entity.other.attribute-name","y"],
+  ["keyword.operator.separator","="],
+  ["string","\"350\""]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","       "],
+  ["entity.other.attribute-name","id"],
+  ["keyword.operator.separator","="],
+  ["string","\"dickory\""]
+],[
+   "start",
+  ["text","       "],
+  ["entity.other.attribute-name","display"],
+  ["keyword.operator.separator","="],
+  ["string","\"none\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        dickory,"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","text"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","    "],
+  ["meta.tag.punctuation.begin","<"],
+  ["meta.tag.name","text"]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","       "],
+  ["entity.other.attribute-name","style"],
+  ["keyword.operator.separator","="],
+  ["string","\"font-size:144px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold\""]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","       "],
+  ["entity.other.attribute-name","x"],
+  ["keyword.operator.separator","="],
+  ["string","\"50\""]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","       "],
+  ["entity.other.attribute-name","y"],
+  ["keyword.operator.separator","="],
+  ["string","\"350\""]
+],[
+   "meta.tag.punctuation.begin0",
+  ["text","       "],
+  ["entity.other.attribute-name","id"],
+  ["keyword.operator.separator","="],
+  ["string","\"dock\""]
+],[
+   "start",
+  ["text","       "],
+  ["entity.other.attribute-name","display"],
+  ["keyword.operator.separator","="],
+  ["string","\"none\""],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["text","        dock!"],
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","text"],
+  ["meta.tag.punctuation.end",">"]
+],[
+   "start",
+  ["meta.tag.punctuation.begin","</"],
+  ["meta.tag.name","svg"],
+  ["meta.tag.punctuation.end",">"]
+]]
\ No newline at end of file


[17/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/javascript/jshint.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/javascript/jshint.js b/src/fauxton/assets/js/libs/ace/mode/javascript/jshint.js
new file mode 100644
index 0000000..1faef4c
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/javascript/jshint.js
@@ -0,0 +1,9072 @@
+define(function(require, exports, module) {
+// 2.1.9
+require = null;
+require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({
+9:[function (req,module,exports){
+        ["log", "info", "warn", "error", 
+        "time","timeEnd", "trace", "dir", "assert"
+        ].forEach(function(x) {exports[x] = nop;});
+        function nop() {}
+    },{}],
+1:[function(req,module,exports){
+//     Underscore.js 1.4.4
+//     http://underscorejs.org
+//     (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
+//     Underscore may be freely distributed under the MIT license.
+
+(function() {
+
+  // Baseline setup
+  // --------------
+
+  // Establish the root object, `window` in the browser, or `global` on the server.
+  var root = this;
+
+  // Save the previous value of the `_` variable.
+  var previousUnderscore = root._;
+
+  // Establish the object that gets returned to break out of a loop iteration.
+  var breaker = {};
+
+  // Save bytes in the minified (but not gzipped) version:
+  var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
+
+  // Create quick reference variables for speed access to core prototypes.
+  var push             = ArrayProto.push,
+      slice            = ArrayProto.slice,
+      concat           = ArrayProto.concat,
+      toString         = ObjProto.toString,
+      hasOwnProperty   = ObjProto.hasOwnProperty;
+
+  // All **ECMAScript 5** native function implementations that we hope to use
+  // are declared here.
+  var
+    nativeForEach      = ArrayProto.forEach,
+    nativeMap          = ArrayProto.map,
+    nativeReduce       = ArrayProto.reduce,
+    nativeReduceRight  = ArrayProto.reduceRight,
+    nativeFilter       = ArrayProto.filter,
+    nativeEvery        = ArrayProto.every,
+    nativeSome         = ArrayProto.some,
+    nativeIndexOf      = ArrayProto.indexOf,
+    nativeLastIndexOf  = ArrayProto.lastIndexOf,
+    nativeIsArray      = Array.isArray,
+    nativeKeys         = Object.keys,
+    nativeBind         = FuncProto.bind;
+
+  // Create a safe reference to the Underscore object for use below.
+  var _ = function(obj) {
+    if (obj instanceof _) return obj;
+    if (!(this instanceof _)) return new _(obj);
+    this._wrapped = obj;
+  };
+
+  // Export the Underscore object for **Node.js**, with
+  // backwards-compatibility for the old `require()` API. If we're in
+  // the browser, add `_` as a global object via a string identifier,
+  // for Closure Compiler "advanced" mode.
+  if (typeof exports !== 'undefined') {
+    if (typeof module !== 'undefined' && module.exports) {
+      exports = module.exports = _;
+    }
+    exports._ = _;
+  } else {
+    root._ = _;
+  }
+
+  // Current version.
+  _.VERSION = '1.4.4';
+
+  // Collection Functions
+  // --------------------
+
+  // The cornerstone, an `each` implementation, aka `forEach`.
+  // Handles objects with the built-in `forEach`, arrays, and raw objects.
+  // Delegates to **ECMAScript 5**'s native `forEach` if available.
+  var each = _.each = _.forEach = function(obj, iterator, context) {
+    if (obj == null) return;
+    if (nativeForEach && obj.forEach === nativeForEach) {
+      obj.forEach(iterator, context);
+    } else if (obj.length === +obj.length) {
+      for (var i = 0, l = obj.length; i < l; i++) {
+        if (iterator.call(context, obj[i], i, obj) === breaker) return;
+      }
+    } else {
+      for (var key in obj) {
+        if (_.has(obj, key)) {
+          if (iterator.call(context, obj[key], key, obj) === breaker) return;
+        }
+      }
+    }
+  };
+
+  // Return the results of applying the iterator to each element.
+  // Delegates to **ECMAScript 5**'s native `map` if available.
+  _.map = _.collect = function(obj, iterator, context) {
+    var results = [];
+    if (obj == null) return results;
+    if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
+    each(obj, function(value, index, list) {
+      results[results.length] = iterator.call(context, value, index, list);
+    });
+    return results;
+  };
+
+  var reduceError = 'Reduce of empty array with no initial value';
+
+  // **Reduce** builds up a single result from a list of values, aka `inject`,
+  // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
+  _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
+    var initial = arguments.length > 2;
+    if (obj == null) obj = [];
+    if (nativeReduce && obj.reduce === nativeReduce) {
+      if (context) iterator = _.bind(iterator, context);
+      return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
+    }
+    each(obj, function(value, index, list) {
+      if (!initial) {
+        memo = value;
+        initial = true;
+      } else {
+        memo = iterator.call(context, memo, value, index, list);
+      }
+    });
+    if (!initial) throw new TypeError(reduceError);
+    return memo;
+  };
+
+  // The right-associative version of reduce, also known as `foldr`.
+  // Delegates to **ECMAScript 5**'s native `reduceRight` if available.
+  _.reduceRight = _.foldr = function(obj, iterator, memo, context) {
+    var initial = arguments.length > 2;
+    if (obj == null) obj = [];
+    if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
+      if (context) iterator = _.bind(iterator, context);
+      return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
+    }
+    var length = obj.length;
+    if (length !== +length) {
+      var keys = _.keys(obj);
+      length = keys.length;
+    }
+    each(obj, function(value, index, list) {
+      index = keys ? keys[--length] : --length;
+      if (!initial) {
+        memo = obj[index];
+        initial = true;
+      } else {
+        memo = iterator.call(context, memo, obj[index], index, list);
+      }
+    });
+    if (!initial) throw new TypeError(reduceError);
+    return memo;
+  };
+
+  // Return the first value which passes a truth test. Aliased as `detect`.
+  _.find = _.detect = function(obj, iterator, context) {
+    var result;
+    any(obj, function(value, index, list) {
+      if (iterator.call(context, value, index, list)) {
+        result = value;
+        return true;
+      }
+    });
+    return result;
+  };
+
+  // Return all the elements that pass a truth test.
+  // Delegates to **ECMAScript 5**'s native `filter` if available.
+  // Aliased as `select`.
+  _.filter = _.select = function(obj, iterator, context) {
+    var results = [];
+    if (obj == null) return results;
+    if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context);
+    each(obj, function(value, index, list) {
+      if (iterator.call(context, value, index, list)) results[results.length] = value;
+    });
+    return results;
+  };
+
+  // Return all the elements for which a truth test fails.
+  _.reject = function(obj, iterator, context) {
+    return _.filter(obj, function(value, index, list) {
+      return !iterator.call(context, value, index, list);
+    }, context);
+  };
+
+  // Determine whether all of the elements match a truth test.
+  // Delegates to **ECMAScript 5**'s native `every` if available.
+  // Aliased as `all`.
+  _.every = _.all = function(obj, iterator, context) {
+    iterator || (iterator = _.identity);
+    var result = true;
+    if (obj == null) return result;
+    if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context);
+    each(obj, function(value, index, list) {
+      if (!(result = result && iterator.call(context, value, index, list))) return breaker;
+    });
+    return !!result;
+  };
+
+  // Determine if at least one element in the object matches a truth test.
+  // Delegates to **ECMAScript 5**'s native `some` if available.
+  // Aliased as `any`.
+  var any = _.some = _.any = function(obj, iterator, context) {
+    iterator || (iterator = _.identity);
+    var result = false;
+    if (obj == null) return result;
+    if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context);
+    each(obj, function(value, index, list) {
+      if (result || (result = iterator.call(context, value, index, list))) return breaker;
+    });
+    return !!result;
+  };
+
+  // Determine if the array or object contains a given value (using `===`).
+  // Aliased as `include`.
+  _.contains = _.include = function(obj, target) {
+    if (obj == null) return false;
+    if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
+    return any(obj, function(value) {
+      return value === target;
+    });
+  };
+
+  // Invoke a method (with arguments) on every item in a collection.
+  _.invoke = function(obj, method) {
+    var args = slice.call(arguments, 2);
+    var isFunc = _.isFunction(method);
+    return _.map(obj, function(value) {
+      return (isFunc ? method : value[method]).apply(value, args);
+    });
+  };
+
+  // Convenience version of a common use case of `map`: fetching a property.
+  _.pluck = function(obj, key) {
+    return _.map(obj, function(value){ return value[key]; });
+  };
+
+  // Convenience version of a common use case of `filter`: selecting only objects
+  // containing specific `key:value` pairs.
+  _.where = function(obj, attrs, first) {
+    if (_.isEmpty(attrs)) return first ? null : [];
+    return _[first ? 'find' : 'filter'](obj, function(value) {
+      for (var key in attrs) {
+        if (attrs[key] !== value[key]) return false;
+      }
+      return true;
+    });
+  };
+
+  // Convenience version of a common use case of `find`: getting the first object
+  // containing specific `key:value` pairs.
+  _.findWhere = function(obj, attrs) {
+    return _.where(obj, attrs, true);
+  };
+
+  // Return the maximum element or (element-based computation).
+  // Can't optimize arrays of integers longer than 65,535 elements.
+  // See: https://bugs.webkit.org/show_bug.cgi?id=80797
+  _.max = function(obj, iterator, context) {
+    if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
+      return Math.max.apply(Math, obj);
+    }
+    if (!iterator && _.isEmpty(obj)) return -Infinity;
+    var result = {computed : -Infinity, value: -Infinity};
+    each(obj, function(value, index, list) {
+      var computed = iterator ? iterator.call(context, value, index, list) : value;
+      computed >= result.computed && (result = {value : value, computed : computed});
+    });
+    return result.value;
+  };
+
+  // Return the minimum element (or element-based computation).
+  _.min = function(obj, iterator, context) {
+    if (!iterator && _.isArray(obj) && obj[0] === +obj[0] && obj.length < 65535) {
+      return Math.min.apply(Math, obj);
+    }
+    if (!iterator && _.isEmpty(obj)) return Infinity;
+    var result = {computed : Infinity, value: Infinity};
+    each(obj, function(value, index, list) {
+      var computed = iterator ? iterator.call(context, value, index, list) : value;
+      computed < result.computed && (result = {value : value, computed : computed});
+    });
+    return result.value;
+  };
+
+  // Shuffle an array.
+  _.shuffle = function(obj) {
+    var rand;
+    var index = 0;
+    var shuffled = [];
+    each(obj, function(value) {
+      rand = _.random(index++);
+      shuffled[index - 1] = shuffled[rand];
+      shuffled[rand] = value;
+    });
+    return shuffled;
+  };
+
+  // An internal function to generate lookup iterators.
+  var lookupIterator = function(value) {
+    return _.isFunction(value) ? value : function(obj){ return obj[value]; };
+  };
+
+  // Sort the object's values by a criterion produced by an iterator.
+  _.sortBy = function(obj, value, context) {
+    var iterator = lookupIterator(value);
+    return _.pluck(_.map(obj, function(value, index, list) {
+      return {
+        value : value,
+        index : index,
+        criteria : iterator.call(context, value, index, list)
+      };
+    }).sort(function(left, right) {
+      var a = left.criteria;
+      var b = right.criteria;
+      if (a !== b) {
+        if (a > b || a === void 0) return 1;
+        if (a < b || b === void 0) return -1;
+      }
+      return left.index < right.index ? -1 : 1;
+    }), 'value');
+  };
+
+  // An internal function used for aggregate "group by" operations.
+  var group = function(obj, value, context, behavior) {
+    var result = {};
+    var iterator = lookupIterator(value || _.identity);
+    each(obj, function(value, index) {
+      var key = iterator.call(context, value, index, obj);
+      behavior(result, key, value);
+    });
+    return result;
+  };
+
+  // Groups the object's values by a criterion. Pass either a string attribute
+  // to group by, or a function that returns the criterion.
+  _.groupBy = function(obj, value, context) {
+    return group(obj, value, context, function(result, key, value) {
+      (_.has(result, key) ? result[key] : (result[key] = [])).push(value);
+    });
+  };
+
+  // Counts instances of an object that group by a certain criterion. Pass
+  // either a string attribute to count by, or a function that returns the
+  // criterion.
+  _.countBy = function(obj, value, context) {
+    return group(obj, value, context, function(result, key) {
+      if (!_.has(result, key)) result[key] = 0;
+      result[key]++;
+    });
+  };
+
+  // Use a comparator function to figure out the smallest index at which
+  // an object should be inserted so as to maintain order. Uses binary search.
+  _.sortedIndex = function(array, obj, iterator, context) {
+    iterator = iterator == null ? _.identity : lookupIterator(iterator);
+    var value = iterator.call(context, obj);
+    var low = 0, high = array.length;
+    while (low < high) {
+      var mid = (low + high) >>> 1;
+      iterator.call(context, array[mid]) < value ? low = mid + 1 : high = mid;
+    }
+    return low;
+  };
+
+  // Safely convert anything iterable into a real, live array.
+  _.toArray = function(obj) {
+    if (!obj) return [];
+    if (_.isArray(obj)) return slice.call(obj);
+    if (obj.length === +obj.length) return _.map(obj, _.identity);
+    return _.values(obj);
+  };
+
+  // Return the number of elements in an object.
+  _.size = function(obj) {
+    if (obj == null) return 0;
+    return (obj.length === +obj.length) ? obj.length : _.keys(obj).length;
+  };
+
+  // Array Functions
+  // ---------------
+
+  // Get the first element of an array. Passing **n** will return the first N
+  // values in the array. Aliased as `head` and `take`. The **guard** check
+  // allows it to work with `_.map`.
+  _.first = _.head = _.take = function(array, n, guard) {
+    if (array == null) return void 0;
+    return (n != null) && !guard ? slice.call(array, 0, n) : array[0];
+  };
+
+  // Returns everything but the last entry of the array. Especially useful on
+  // the arguments object. Passing **n** will return all the values in
+  // the array, excluding the last N. The **guard** check allows it to work with
+  // `_.map`.
+  _.initial = function(array, n, guard) {
+    return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n));
+  };
+
+  // Get the last element of an array. Passing **n** will return the last N
+  // values in the array. The **guard** check allows it to work with `_.map`.
+  _.last = function(array, n, guard) {
+    if (array == null) return void 0;
+    if ((n != null) && !guard) {
+      return slice.call(array, Math.max(array.length - n, 0));
+    } else {
+      return array[array.length - 1];
+    }
+  };
+
+  // Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
+  // Especially useful on the arguments object. Passing an **n** will return
+  // the rest N values in the array. The **guard**
+  // check allows it to work with `_.map`.
+  _.rest = _.tail = _.drop = function(array, n, guard) {
+    return slice.call(array, (n == null) || guard ? 1 : n);
+  };
+
+  // Trim out all falsy values from an array.
+  _.compact = function(array) {
+    return _.filter(array, _.identity);
+  };
+
+  // Internal implementation of a recursive `flatten` function.
+  var flatten = function(input, shallow, output) {
+    each(input, function(value) {
+      if (_.isArray(value)) {
+        shallow ? push.apply(output, value) : flatten(value, shallow, output);
+      } else {
+        output.push(value);
+      }
+    });
+    return output;
+  };
+
+  // Return a completely flattened version of an array.
+  _.flatten = function(array, shallow) {
+    return flatten(array, shallow, []);
+  };
+
+  // Return a version of the array that does not contain the specified value(s).
+  _.without = function(array) {
+    return _.difference(array, slice.call(arguments, 1));
+  };
+
+  // Produce a duplicate-free version of the array. If the array has already
+  // been sorted, you have the option of using a faster algorithm.
+  // Aliased as `unique`.
+  _.uniq = _.unique = function(array, isSorted, iterator, context) {
+    if (_.isFunction(isSorted)) {
+      context = iterator;
+      iterator = isSorted;
+      isSorted = false;
+    }
+    var initial = iterator ? _.map(array, iterator, context) : array;
+    var results = [];
+    var seen = [];
+    each(initial, function(value, index) {
+      if (isSorted ? (!index || seen[seen.length - 1] !== value) : !_.contains(seen, value)) {
+        seen.push(value);
+        results.push(array[index]);
+      }
+    });
+    return results;
+  };
+
+  // Produce an array that contains the union: each distinct element from all of
+  // the passed-in arrays.
+  _.union = function() {
+    return _.uniq(concat.apply(ArrayProto, arguments));
+  };
+
+  // Produce an array that contains every item shared between all the
+  // passed-in arrays.
+  _.intersection = function(array) {
+    var rest = slice.call(arguments, 1);
+    return _.filter(_.uniq(array), function(item) {
+      return _.every(rest, function(other) {
+        return _.indexOf(other, item) >= 0;
+      });
+    });
+  };
+
+  // Take the difference between one array and a number of other arrays.
+  // Only the elements present in just the first array will remain.
+  _.difference = function(array) {
+    var rest = concat.apply(ArrayProto, slice.call(arguments, 1));
+    return _.filter(array, function(value){ return !_.contains(rest, value); });
+  };
+
+  // Zip together multiple lists into a single array -- elements that share
+  // an index go together.
+  _.zip = function() {
+    var args = slice.call(arguments);
+    var length = _.max(_.pluck(args, 'length'));
+    var results = new Array(length);
+    for (var i = 0; i < length; i++) {
+      results[i] = _.pluck(args, "" + i);
+    }
+    return results;
+  };
+
+  // Converts lists into objects. Pass either a single array of `[key, value]`
+  // pairs, or two parallel arrays of the same length -- one of keys, and one of
+  // the corresponding values.
+  _.object = function(list, values) {
+    if (list == null) return {};
+    var result = {};
+    for (var i = 0, l = list.length; i < l; i++) {
+      if (values) {
+        result[list[i]] = values[i];
+      } else {
+        result[list[i][0]] = list[i][1];
+      }
+    }
+    return result;
+  };
+
+  // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
+  // we need this function. Return the position of the first occurrence of an
+  // item in an array, or -1 if the item is not included in the array.
+  // Delegates to **ECMAScript 5**'s native `indexOf` if available.
+  // If the array is large and already in sort order, pass `true`
+  // for **isSorted** to use binary search.
+  _.indexOf = function(array, item, isSorted) {
+    if (array == null) return -1;
+    var i = 0, l = array.length;
+    if (isSorted) {
+      if (typeof isSorted == 'number') {
+        i = (isSorted < 0 ? Math.max(0, l + isSorted) : isSorted);
+      } else {
+        i = _.sortedIndex(array, item);
+        return array[i] === item ? i : -1;
+      }
+    }
+    if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item, isSorted);
+    for (; i < l; i++) if (array[i] === item) return i;
+    return -1;
+  };
+
+  // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
+  _.lastIndexOf = function(array, item, from) {
+    if (array == null) return -1;
+    var hasIndex = from != null;
+    if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) {
+      return hasIndex ? array.lastIndexOf(item, from) : array.lastIndexOf(item);
+    }
+    var i = (hasIndex ? from : array.length);
+    while (i--) if (array[i] === item) return i;
+    return -1;
+  };
+
+  // Generate an integer Array containing an arithmetic progression. A port of
+  // the native Python `range()` function. See
+  // [the Python documentation](http://docs.python.org/library/functions.html#range).
+  _.range = function(start, stop, step) {
+    if (arguments.length <= 1) {
+      stop = start || 0;
+      start = 0;
+    }
+    step = arguments[2] || 1;
+
+    var len = Math.max(Math.ceil((stop - start) / step), 0);
+    var idx = 0;
+    var range = new Array(len);
+
+    while(idx < len) {
+      range[idx++] = start;
+      start += step;
+    }
+
+    return range;
+  };
+
+  // Function (ahem) Functions
+  // ------------------
+
+  // Create a function bound to a given object (assigning `this`, and arguments,
+  // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
+  // available.
+  _.bind = function(func, context) {
+    if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
+    var args = slice.call(arguments, 2);
+    return function() {
+      return func.apply(context, args.concat(slice.call(arguments)));
+    };
+  };
+
+  // Partially apply a function by creating a version that has had some of its
+  // arguments pre-filled, without changing its dynamic `this` context.
+  _.partial = function(func) {
+    var args = slice.call(arguments, 1);
+    return function() {
+      return func.apply(this, args.concat(slice.call(arguments)));
+    };
+  };
+
+  // Bind all of an object's methods to that object. Useful for ensuring that
+  // all callbacks defined on an object belong to it.
+  _.bindAll = function(obj) {
+    var funcs = slice.call(arguments, 1);
+    if (funcs.length === 0) funcs = _.functions(obj);
+    each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
+    return obj;
+  };
+
+  // Memoize an expensive function by storing its results.
+  _.memoize = function(func, hasher) {
+    var memo = {};
+    hasher || (hasher = _.identity);
+    return function() {
+      var key = hasher.apply(this, arguments);
+      return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
+    };
+  };
+
+  // Delays a function for the given number of milliseconds, and then calls
+  // it with the arguments supplied.
+  _.delay = function(func, wait) {
+    var args = slice.call(arguments, 2);
+    return setTimeout(function(){ return func.apply(null, args); }, wait);
+  };
+
+  // Defers a function, scheduling it to run after the current call stack has
+  // cleared.
+  _.defer = function(func) {
+    return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));
+  };
+
+  // Returns a function, that, when invoked, will only be triggered at most once
+  // during a given window of time.
+  _.throttle = function(func, wait) {
+    var context, args, timeout, result;
+    var previous = 0;
+    var later = function() {
+      previous = new Date;
+      timeout = null;
+      result = func.apply(context, args);
+    };
+    return function() {
+      var now = new Date;
+      var remaining = wait - (now - previous);
+      context = this;
+      args = arguments;
+      if (remaining <= 0) {
+        clearTimeout(timeout);
+        timeout = null;
+        previous = now;
+        result = func.apply(context, args);
+      } else if (!timeout) {
+        timeout = setTimeout(later, remaining);
+      }
+      return result;
+    };
+  };
+
+  // Returns a function, that, as long as it continues to be invoked, will not
+  // be triggered. The function will be called after it stops being called for
+  // N milliseconds. If `immediate` is passed, trigger the function on the
+  // leading edge, instead of the trailing.
+  _.debounce = function(func, wait, immediate) {
+    var timeout, result;
+    return function() {
+      var context = this, args = arguments;
+      var later = function() {
+        timeout = null;
+        if (!immediate) result = func.apply(context, args);
+      };
+      var callNow = immediate && !timeout;
+      clearTimeout(timeout);
+      timeout = setTimeout(later, wait);
+      if (callNow) result = func.apply(context, args);
+      return result;
+    };
+  };
+
+  // Returns a function that will be executed at most one time, no matter how
+  // often you call it. Useful for lazy initialization.
+  _.once = function(func) {
+    var ran = false, memo;
+    return function() {
+      if (ran) return memo;
+      ran = true;
+      memo = func.apply(this, arguments);
+      func = null;
+      return memo;
+    };
+  };
+
+  // Returns the first function passed as an argument to the second,
+  // allowing you to adjust arguments, run code before and after, and
+  // conditionally execute the original function.
+  _.wrap = function(func, wrapper) {
+    return function() {
+      var args = [func];
+      push.apply(args, arguments);
+      return wrapper.apply(this, args);
+    };
+  };
+
+  // Returns a function that is the composition of a list of functions, each
+  // consuming the return value of the function that follows.
+  _.compose = function() {
+    var funcs = arguments;
+    return function() {
+      var args = arguments;
+      for (var i = funcs.length - 1; i >= 0; i--) {
+        args = [funcs[i].apply(this, args)];
+      }
+      return args[0];
+    };
+  };
+
+  // Returns a function that will only be executed after being called N times.
+  _.after = function(times, func) {
+    if (times <= 0) return func();
+    return function() {
+      if (--times < 1) {
+        return func.apply(this, arguments);
+      }
+    };
+  };
+
+  // Object Functions
+  // ----------------
+
+  // Retrieve the names of an object's properties.
+  // Delegates to **ECMAScript 5**'s native `Object.keys`
+  _.keys = nativeKeys || function(obj) {
+    if (obj !== Object(obj)) throw new TypeError('Invalid object');
+    var keys = [];
+    for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key;
+    return keys;
+  };
+
+  // Retrieve the values of an object's properties.
+  _.values = function(obj) {
+    var values = [];
+    for (var key in obj) if (_.has(obj, key)) values.push(obj[key]);
+    return values;
+  };
+
+  // Convert an object into a list of `[key, value]` pairs.
+  _.pairs = function(obj) {
+    var pairs = [];
+    for (var key in obj) if (_.has(obj, key)) pairs.push([key, obj[key]]);
+    return pairs;
+  };
+
+  // Invert the keys and values of an object. The values must be serializable.
+  _.invert = function(obj) {
+    var result = {};
+    for (var key in obj) if (_.has(obj, key)) result[obj[key]] = key;
+    return result;
+  };
+
+  // Return a sorted list of the function names available on the object.
+  // Aliased as `methods`
+  _.functions = _.methods = function(obj) {
+    var names = [];
+    for (var key in obj) {
+      if (_.isFunction(obj[key])) names.push(key);
+    }
+    return names.sort();
+  };
+
+  // Extend a given object with all the properties in passed-in object(s).
+  _.extend = function(obj) {
+    each(slice.call(arguments, 1), function(source) {
+      if (source) {
+        for (var prop in source) {
+          obj[prop] = source[prop];
+        }
+      }
+    });
+    return obj;
+  };
+
+  // Return a copy of the object only containing the whitelisted properties.
+  _.pick = function(obj) {
+    var copy = {};
+    var keys = concat.apply(ArrayProto, slice.call(arguments, 1));
+    each(keys, function(key) {
+      if (key in obj) copy[key] = obj[key];
+    });
+    return copy;
+  };
+
+   // Return a copy of the object without the blacklisted properties.
+  _.omit = function(obj) {
+    var copy = {};
+    var keys = concat.apply(ArrayProto, slice.call(arguments, 1));
+    for (var key in obj) {
+      if (!_.contains(keys, key)) copy[key] = obj[key];
+    }
+    return copy;
+  };
+
+  // Fill in a given object with default properties.
+  _.defaults = function(obj) {
+    each(slice.call(arguments, 1), function(source) {
+      if (source) {
+        for (var prop in source) {
+          if (obj[prop] == null) obj[prop] = source[prop];
+        }
+      }
+    });
+    return obj;
+  };
+
+  // Create a (shallow-cloned) duplicate of an object.
+  _.clone = function(obj) {
+    if (!_.isObject(obj)) return obj;
+    return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
+  };
+
+  // Invokes interceptor with the obj, and then returns obj.
+  // The primary purpose of this method is to "tap into" a method chain, in
+  // order to perform operations on intermediate results within the chain.
+  _.tap = function(obj, interceptor) {
+    interceptor(obj);
+    return obj;
+  };
+
+  // Internal recursive comparison function for `isEqual`.
+  var eq = function(a, b, aStack, bStack) {
+    // Identical objects are equal. `0 === -0`, but they aren't identical.
+    // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
+    if (a === b) return a !== 0 || 1 / a == 1 / b;
+    // A strict comparison is necessary because `null == undefined`.
+    if (a == null || b == null) return a === b;
+    // Unwrap any wrapped objects.
+    if (a instanceof _) a = a._wrapped;
+    if (b instanceof _) b = b._wrapped;
+    // Compare `[[Class]]` names.
+    var className = toString.call(a);
+    if (className != toString.call(b)) return false;
+    switch (className) {
+      // Strings, numbers, dates, and booleans are compared by value.
+      case '[object String]':
+        // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
+        // equivalent to `new String("5")`.
+        return a == String(b);
+      case '[object Number]':
+        // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
+        // other numeric values.
+        return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);
+      case '[object Date]':
+      case '[object Boolean]':
+        // Coerce dates and booleans to numeric primitive values. Dates are compared by their
+        // millisecond representations. Note that invalid dates with millisecond representations
+        // of `NaN` are not equivalent.
+        return +a == +b;
+      // RegExps are compared by their source patterns and flags.
+      case '[object RegExp]':
+        return a.source == b.source &&
+               a.global == b.global &&
+               a.multiline == b.multiline &&
+               a.ignoreCase == b.ignoreCase;
+    }
+    if (typeof a != 'object' || typeof b != 'object') return false;
+    // Assume equality for cyclic structures. The algorithm for detecting cyclic
+    // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
+    var length = aStack.length;
+    while (length--) {
+      // Linear search. Performance is inversely proportional to the number of
+      // unique nested structures.
+      if (aStack[length] == a) return bStack[length] == b;
+    }
+    // Add the first object to the stack of traversed objects.
+    aStack.push(a);
+    bStack.push(b);
+    var size = 0, result = true;
+    // Recursively compare objects and arrays.
+    if (className == '[object Array]') {
+      // Compare array lengths to determine if a deep comparison is necessary.
+      size = a.length;
+      result = size == b.length;
+      if (result) {
+        // Deep compare the contents, ignoring non-numeric properties.
+        while (size--) {
+          if (!(result = eq(a[size], b[size], aStack, bStack))) break;
+        }
+      }
+    } else {
+      // Objects with different constructors are not equivalent, but `Object`s
+      // from different frames are.
+      var aCtor = a.constructor, bCtor = b.constructor;
+      if (aCtor !== bCtor && !(_.isFunction(aCtor) && (aCtor instanceof aCtor) &&
+                               _.isFunction(bCtor) && (bCtor instanceof bCtor))) {
+        return false;
+      }
+      // Deep compare objects.
+      for (var key in a) {
+        if (_.has(a, key)) {
+          // Count the expected number of properties.
+          size++;
+          // Deep compare each member.
+          if (!(result = _.has(b, key) && eq(a[key], b[key], aStack, bStack))) break;
+        }
+      }
+      // Ensure that both objects contain the same number of properties.
+      if (result) {
+        for (key in b) {
+          if (_.has(b, key) && !(size--)) break;
+        }
+        result = !size;
+      }
+    }
+    // Remove the first object from the stack of traversed objects.
+    aStack.pop();
+    bStack.pop();
+    return result;
+  };
+
+  // Perform a deep comparison to check if two objects are equal.
+  _.isEqual = function(a, b) {
+    return eq(a, b, [], []);
+  };
+
+  // Is a given array, string, or object empty?
+  // An "empty" object has no enumerable own-properties.
+  _.isEmpty = function(obj) {
+    if (obj == null) return true;
+    if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;
+    for (var key in obj) if (_.has(obj, key)) return false;
+    return true;
+  };
+
+  // Is a given value a DOM element?
+  _.isElement = function(obj) {
+    return !!(obj && obj.nodeType === 1);
+  };
+
+  // Is a given value an array?
+  // Delegates to ECMA5's native Array.isArray
+  _.isArray = nativeIsArray || function(obj) {
+    return toString.call(obj) == '[object Array]';
+  };
+
+  // Is a given variable an object?
+  _.isObject = function(obj) {
+    return obj === Object(obj);
+  };
+
+  // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp.
+  each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp'], function(name) {
+    _['is' + name] = function(obj) {
+      return toString.call(obj) == '[object ' + name + ']';
+    };
+  });
+
+  // Define a fallback version of the method in browsers (ahem, IE), where
+  // there isn't any inspectable "Arguments" type.
+  if (!_.isArguments(arguments)) {
+    _.isArguments = function(obj) {
+      return !!(obj && _.has(obj, 'callee'));
+    };
+  }
+
+  // Optimize `isFunction` if appropriate.
+  if (typeof (/./) !== 'function') {
+    _.isFunction = function(obj) {
+      return typeof obj === 'function';
+    };
+  }
+
+  // Is a given object a finite number?
+  _.isFinite = function(obj) {
+    return isFinite(obj) && !isNaN(parseFloat(obj));
+  };
+
+  // Is the given value `NaN`? (NaN is the only number which does not equal itself).
+  _.isNaN = function(obj) {
+    return _.isNumber(obj) && obj != +obj;
+  };
+
+  // Is a given value a boolean?
+  _.isBoolean = function(obj) {
+    return obj === true || obj === false || toString.call(obj) == '[object Boolean]';
+  };
+
+  // Is a given value equal to null?
+  _.isNull = function(obj) {
+    return obj === null;
+  };
+
+  // Is a given variable undefined?
+  _.isUndefined = function(obj) {
+    return obj === void 0;
+  };
+
+  // Shortcut function for checking if an object has a given property directly
+  // on itself (in other words, not on a prototype).
+  _.has = function(obj, key) {
+    return hasOwnProperty.call(obj, key);
+  };
+
+  // Utility Functions
+  // -----------------
+
+  // Run Underscore.js in *noConflict* mode, returning the `_` variable to its
+  // previous owner. Returns a reference to the Underscore object.
+  _.noConflict = function() {
+    root._ = previousUnderscore;
+    return this;
+  };
+
+  // Keep the identity function around for default iterators.
+  _.identity = function(value) {
+    return value;
+  };
+
+  // Run a function **n** times.
+  _.times = function(n, iterator, context) {
+    var accum = Array(n);
+    for (var i = 0; i < n; i++) accum[i] = iterator.call(context, i);
+    return accum;
+  };
+
+  // Return a random integer between min and max (inclusive).
+  _.random = function(min, max) {
+    if (max == null) {
+      max = min;
+      min = 0;
+    }
+    return min + Math.floor(Math.random() * (max - min + 1));
+  };
+
+  // List of HTML entities for escaping.
+  var entityMap = {
+    escape: {
+      '&': '&amp;',
+      '<': '&lt;',
+      '>': '&gt;',
+      '"': '&quot;',
+      "'": '&#x27;',
+      '/': '&#x2F;'
+    }
+  };
+  entityMap.unescape = _.invert(entityMap.escape);
+
+  // Regexes containing the keys and values listed immediately above.
+  var entityRegexes = {
+    escape:   new RegExp('[' + _.keys(entityMap.escape).join('') + ']', 'g'),
+    unescape: new RegExp('(' + _.keys(entityMap.unescape).join('|') + ')', 'g')
+  };
+
+  // Functions for escaping and unescaping strings to/from HTML interpolation.
+  _.each(['escape', 'unescape'], function(method) {
+    _[method] = function(string) {
+      if (string == null) return '';
+      return ('' + string).replace(entityRegexes[method], function(match) {
+        return entityMap[method][match];
+      });
+    };
+  });
+
+  // If the value of the named property is a function then invoke it;
+  // otherwise, return it.
+  _.result = function(object, property) {
+    if (object == null) return null;
+    var value = object[property];
+    return _.isFunction(value) ? value.call(object) : value;
+  };
+
+  // Add your own custom functions to the Underscore object.
+  _.mixin = function(obj) {
+    each(_.functions(obj), function(name){
+      var func = _[name] = obj[name];
+      _.prototype[name] = function() {
+        var args = [this._wrapped];
+        push.apply(args, arguments);
+        return result.call(this, func.apply(_, args));
+      };
+    });
+  };
+
+  // Generate a unique integer id (unique within the entire client session).
+  // Useful for temporary DOM ids.
+  var idCounter = 0;
+  _.uniqueId = function(prefix) {
+    var id = ++idCounter + '';
+    return prefix ? prefix + id : id;
+  };
+
+  // By default, Underscore uses ERB-style template delimiters, change the
+  // following template settings to use alternative delimiters.
+  _.templateSettings = {
+    evaluate    : /<%([\s\S]+?)%>/g,
+    interpolate : /<%=([\s\S]+?)%>/g,
+    escape      : /<%-([\s\S]+?)%>/g
+  };
+
+  // When customizing `templateSettings`, if you don't want to define an
+  // interpolation, evaluation or escaping regex, we need one that is
+  // guaranteed not to match.
+  var noMatch = /(.)^/;
+
+  // Certain characters need to be escaped so that they can be put into a
+  // string literal.
+  var escapes = {
+    "'":      "'",
+    '\\':     '\\',
+    '\r':     'r',
+    '\n':     'n',
+    '\t':     't',
+    '\u2028': 'u2028',
+    '\u2029': 'u2029'
+  };
+
+  var escaper = /\\|'|\r|\n|\t|\u2028|\u2029/g;
+
+  // JavaScript micro-templating, similar to John Resig's implementation.
+  // Underscore templating handles arbitrary delimiters, preserves whitespace,
+  // and correctly escapes quotes within interpolated code.
+  _.template = function(text, data, settings) {
+    var render;
+    settings = _.defaults({}, settings, _.templateSettings);
+
+    // Combine delimiters into one regular expression via alternation.
+    var matcher = new RegExp([
+      (settings.escape || noMatch).source,
+      (settings.interpolate || noMatch).source,
+      (settings.evaluate || noMatch).source
+    ].join('|') + '|$', 'g');
+
+    // Compile the template source, escaping string literals appropriately.
+    var index = 0;
+    var source = "__p+='";
+    text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
+      source += text.slice(index, offset)
+        .replace(escaper, function(match) { return '\\' + escapes[match]; });
+
+      if (escape) {
+        source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
+      }
+      if (interpolate) {
+        source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
+      }
+      if (evaluate) {
+        source += "';\n" + evaluate + "\n__p+='";
+      }
+      index = offset + match.length;
+      return match;
+    });
+    source += "';\n";
+
+    // If a variable is not specified, place data values in local scope.
+    if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';
+
+    source = "var __t,__p='',__j=Array.prototype.join," +
+      "print=function(){__p+=__j.call(arguments,'');};\n" +
+      source + "return __p;\n";
+
+    try {
+      render = new Function(settings.variable || 'obj', '_', source);
+    } catch (e) {
+      e.source = source;
+      throw e;
+    }
+
+    if (data) return render(data, _);
+    var template = function(data) {
+      return render.call(this, data, _);
+    };
+
+    // Provide the compiled function source as a convenience for precompilation.
+    template.source = 'function(' + (settings.variable || 'obj') + '){\n' + source + '}';
+
+    return template;
+  };
+
+  // Add a "chain" function, which will delegate to the wrapper.
+  _.chain = function(obj) {
+    return _(obj).chain();
+  };
+
+  // OOP
+  // ---------------
+  // If Underscore is called as a function, it returns a wrapped object that
+  // can be used OO-style. This wrapper holds altered versions of all the
+  // underscore functions. Wrapped objects may be chained.
+
+  // Helper function to continue chaining intermediate results.
+  var result = function(obj) {
+    return this._chain ? _(obj).chain() : obj;
+  };
+
+  // Add all of the Underscore functions to the wrapper object.
+  _.mixin(_);
+
+  // Add all mutator Array functions to the wrapper.
+  each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
+    var method = ArrayProto[name];
+    _.prototype[name] = function() {
+      var obj = this._wrapped;
+      method.apply(obj, arguments);
+      if ((name == 'shift' || name == 'splice') && obj.length === 0) delete obj[0];
+      return result.call(this, obj);
+    };
+  });
+
+  // Add all accessor Array functions to the wrapper.
+  each(['concat', 'join', 'slice'], function(name) {
+    var method = ArrayProto[name];
+    _.prototype[name] = function() {
+      return result.call(this, method.apply(this._wrapped, arguments));
+    };
+  });
+
+  _.extend(_.prototype, {
+
+    // Start chaining a wrapped Underscore object.
+    chain: function() {
+      this._chain = true;
+      return this;
+    },
+
+    // Extracts the result from a wrapped and chained object.
+    value: function() {
+      return this._wrapped;
+    }
+
+  });
+
+}).call(this);
+
+},
+{}],
+2:[function(req,module,exports){
+"use strict";
+
+var _ = req("underscore");
+
+var errors = {
+	// JSHint options
+	E001: "Bad option: '{a}'.",
+	E002: "Bad option value.",
+
+	// JSHint input
+	E003: "Expected a JSON value.",
+	E004: "Input is neither a string nor an array of strings.",
+	E005: "Input is empty.",
+	E006: "Unexpected early end of program.",
+
+	// Strict mode
+	E007: "Missing \"use strict\" statement.",
+	E008: "Strict violation.",
+	E009: "Option 'validthis' can't be used in a global scope.",
+	E010: "'with' is not allowed in strict mode.",
+
+	// Constants
+	E011: "const '{a}' has already been declared.",
+	E012: "const '{a}' is initialized to 'undefined'.",
+	E013: "Attempting to override '{a}' which is a constant.",
+
+	// Regular expressions
+	E014: "A regular expression literal can be confused with '/='.",
+	E015: "Unclosed regular expression.",
+	E016: "Invalid regular expression.",
+
+	// Tokens
+	E017: "Unclosed comment.",
+	E018: "Unbegun comment.",
+	E019: "Unmatched '{a}'.",
+	E020: "Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.",
+	E021: "Expected '{a}' and instead saw '{b}'.",
+	E022: "Line breaking error '{a}'.",
+	E023: "Missing '{a}'.",
+	E024: "Unexpected '{a}'.",
+	E025: "Missing ':' on a case clause.",
+	E026: "Missing '}' to match '{' from line {a}.",
+	E027: "Missing ']' to match '[' form line {a}.",
+	E028: "Illegal comma.",
+	E029: "Unclosed string.",
+
+	// Everything else
+	E030: "Expected an identifier and instead saw '{a}'.",
+	E031: "Bad assignment.", // FIXME: Rephrase
+	E032: "Expected a small integer or 'false' and instead saw '{a}'.",
+	E033: "Expected an operator and instead saw '{a}'.",
+	E034: "get/set are ES5 features.",
+	E035: "Missing property name.",
+	E036: "Expected to see a statement and instead saw a block.",
+	E037: null, // Vacant
+	E038: null, // Vacant
+	E039: "Function declarations are not invocable. Wrap the whole function invocation in parens.",
+	E040: "Each value should have its own case label.",
+	E041: "Unrecoverable syntax error.",
+	E042: "Stopping.",
+	E043: "Too many errors.",
+	E044: "'{a}' is already defined and can't be redefined.",
+	E045: "Invalid for each loop.",
+	E046: "A yield statement shall be within a generator function (with syntax: `function*`)",
+	E047: "A generator function shall contain a yield statement.",
+	E048: "Let declaration not directly within block.",
+	E049: "A {a} cannot be named '{b}'.",
+	E050: "Mozilla requires the yield expression to be parenthesized here.",
+	E051: "Regular parameters cannot come after default parameters."
+};
+
+var warnings = {
+	W001: "'hasOwnProperty' is a really bad name.",
+	W002: "Value of '{a}' may be overwritten in IE 8 and earlier.",
+	W003: "'{a}' was used before it was defined.",
+	W004: "'{a}' is already defined.",
+	W005: "A dot following a number can be confused with a decimal point.",
+	W006: "Confusing minuses.",
+	W007: "Confusing pluses.",
+	W008: "A leading decimal point can be confused with a dot: '{a}'.",
+	W009: "The array literal notation [] is preferrable.",
+	W010: "The object literal notation {} is preferrable.",
+	W011: "Unexpected space after '{a}'.",
+	W012: "Unexpected space before '{a}'.",
+	W013: "Missing space after '{a}'.",
+	W014: "Bad line breaking before '{a}'.",
+	W015: "Expected '{a}' to have an indentation at {b} instead at {c}.",
+	W016: "Unexpected use of '{a}'.",
+	W017: "Bad operand.",
+	W018: "Confusing use of '{a}'.",
+	W019: "Use the isNaN function to compare with NaN.",
+	W020: "Read only.",
+	W021: "'{a}' is a function.",
+	W022: "Do not assign to the exception parameter.",
+	W023: "Expected an identifier in an assignment and instead saw a function invocation.",
+	W024: "Expected an identifier and instead saw '{a}' (a reserved word).",
+	W025: "Missing name in function declaration.",
+	W026: "Inner functions should be listed at the top of the outer function.",
+	W027: "Unreachable '{a}' after '{b}'.",
+	W028: "Label '{a}' on {b} statement.",
+	W030: "Expected an assignment or function call and instead saw an expression.",
+	W031: "Do not use 'new' for side effects.",
+	W032: "Unnecessary semicolon.",
+	W033: "Missing semicolon.",
+	W034: "Unnecessary directive \"{a}\".",
+	W035: "Empty block.",
+	W036: "Unexpected /*member '{a}'.",
+	W037: "'{a}' is a statement label.",
+	W038: "'{a}' used out of scope.",
+	W039: "'{a}' is not allowed.",
+	W040: "Possible strict violation.",
+	W041: "Use '{a}' to compare with '{b}'.",
+	W042: "Avoid EOL escaping.",
+	W043: "Bad escaping of EOL. Use option multistr if needed.",
+	W044: "Bad or unnecessary escaping.",
+	W045: "Bad number '{a}'.",
+	W046: "Don't use extra leading zeros '{a}'.",
+	W047: "A trailing decimal point can be confused with a dot: '{a}'.",
+	W048: "Unexpected control character in regular expression.",
+	W049: "Unexpected escaped character '{a}' in regular expression.",
+	W050: "JavaScript URL.",
+	W051: "Variables should not be deleted.",
+	W052: "Unexpected '{a}'.",
+	W053: "Do not use {a} as a constructor.",
+	W054: "The Function constructor is a form of eval.",
+	W055: "A constructor name should start with an uppercase letter.",
+	W056: "Bad constructor.",
+	W057: "Weird construction. Is 'new' unnecessary?",
+	W058: "Missing '()' invoking a constructor.",
+	W059: "Avoid arguments.{a}.",
+	W060: "document.write can be a form of eval.",
+	W061: "eval can be harmful.",
+	W062: "Wrap an immediate function invocation in parens " +
+		"to assist the reader in understanding that the expression " +
+		"is the result of a function, and not the function itself.",
+	W063: "Math is not a function.",
+	W064: "Missing 'new' prefix when invoking a constructor.",
+	W065: "Missing radix parameter.",
+	W066: "Implied eval. Consider passing a function instead of a string.",
+	W067: "Bad invocation.",
+	W068: "Wrapping non-IIFE function literals in parens is unnecessary.",
+	W069: "['{a}'] is better written in dot notation.",
+	W070: "Extra comma. (it breaks older versions of IE)",
+	W071: "This function has too many statements. ({a})",
+	W072: "This function has too many parameters. ({a})",
+	W073: "Blocks are nested too deeply. ({a})",
+	W074: "This function's cyclomatic complexity is too high. ({a})",
+	W075: "Duplicate key '{a}'.",
+	W076: "Unexpected parameter '{a}' in get {b} function.",
+	W077: "Expected a single parameter in set {a} function.",
+	W078: "Setter is defined without getter.",
+	W079: "Redefinition of '{a}'.",
+	W080: "It's not necessary to initialize '{a}' to 'undefined'.",
+	W081: "Too many var statements.",
+	W082: "Function declarations should not be placed in blocks. " +
+		"Use a function expression or move the statement to the top of " +
+		"the outer function.",
+	W083: "Don't make functions within a loop.",
+	W084: "Assignment in conditional expression",
+	W085: "Don't use 'with'.",
+	W086: "Expected a 'break' statement before '{a}'.",
+	W087: "Forgotten 'debugger' statement?",
+	W088: "Creating global 'for' variable. Should be 'for (var {a} ...'.",
+	W089: "The body of a for in should be wrapped in an if statement to filter " +
+		"unwanted properties from the prototype.",
+	W090: "'{a}' is not a statement label.",
+	W091: "'{a}' is out of scope.",
+	W092: "Wrap the /regexp/ literal in parens to disambiguate the slash operator.",
+	W093: "Did you mean to return a conditional instead of an assignment?",
+	W094: "Unexpected comma.",
+	W095: "Expected a string and instead saw {a}.",
+	W096: "The '{a}' key may produce unexpected results.",
+	W097: "Use the function form of \"use strict\".",
+	W098: "'{a}' is defined but never used.",
+	W099: "Mixed spaces and tabs.",
+	W100: "This character may get silently deleted by one or more browsers.",
+	W101: "Line is too long.",
+	W102: "Trailing whitespace.",
+	W103: "The '{a}' property is deprecated.",
+	W104: "'{a}' is only available in JavaScript 1.7.",
+	W105: "Unexpected {a} in '{b}'.",
+	W106: "Identifier '{a}' is not in camel case.",
+	W107: "Script URL.",
+	W108: "Strings must use doublequote.",
+	W109: "Strings must use singlequote.",
+	W110: "Mixed double and single quotes.",
+	W112: "Unclosed string.",
+	W113: "Control character in string: {a}.",
+	W114: "Avoid {a}.",
+	W115: "Octal literals are not allowed in strict mode.",
+	W116: "Expected '{a}' and instead saw '{b}'.",
+	W117: "'{a}' is not defined.",
+	W118: "'{a}' is only available in Mozilla JavaScript extensions (use moz option).",
+	W119: "'{a}' is only available in ES6 (use esnext option).",
+	W120: "You might be leaking a variable ({a}) here."
+};
+
+var info = {
+	I001: "Comma warnings can be turned off with 'laxcomma'.",
+	I002: "Reserved words as properties can be used under the 'es5' option.",
+	I003: "ES5 option is now set per default"
+};
+
+exports.errors = {};
+exports.warnings = {};
+exports.info = {};
+
+_.each(errors, function (desc, code) {
+	exports.errors[code] = { code: code, desc: desc };
+});
+
+_.each(warnings, function (desc, code) {
+	exports.warnings[code] = { code: code, desc: desc };
+});
+
+_.each(info, function (desc, code) {
+	exports.info[code] = { code: code, desc: desc };
+});
+
+},
+{"underscore":1}],
+3:[function(req,module,exports){
+// jshint -W001
+
+"use strict";
+
+// Identifiers provided by the ECMAScript standard.
+
+exports.reservedVars = {
+	arguments : false,
+	NaN       : false
+};
+
+exports.ecmaIdentifiers = {
+	Array              : false,
+	Boolean            : false,
+	Date               : false,
+	decodeURI          : false,
+	decodeURIComponent : false,
+	encodeURI          : false,
+	encodeURIComponent : false,
+	Error              : false,
+	"eval"             : false,
+	EvalError          : false,
+	Function           : false,
+	hasOwnProperty     : false,
+	isFinite           : false,
+	isNaN              : false,
+	JSON               : false,
+	Math               : false,
+	Map                : false,
+	Number             : false,
+	Object             : false,
+	parseInt           : false,
+	parseFloat         : false,
+	RangeError         : false,
+	ReferenceError     : false,
+	RegExp             : false,
+	Set                : false,
+	String             : false,
+	SyntaxError        : false,
+	TypeError          : false,
+	URIError           : false,
+	WeakMap            : false
+};
+
+// Global variables commonly provided by a web browser environment.
+
+exports.browser = {
+	ArrayBuffer          : false,
+	ArrayBufferView      : false,
+	Audio                : false,
+	Blob                 : false,
+	addEventListener     : false,
+	applicationCache     : false,
+	atob                 : false,
+	blur                 : false,
+	btoa                 : false,
+	clearInterval        : false,
+	clearTimeout         : false,
+	close                : false,
+	closed               : false,
+	CustomEvent          : false,
+	DataView             : false,
+	DOMParser            : false,
+	defaultStatus        : false,
+	document             : false,
+	Element              : false,
+	ElementTimeControl   : false,
+	event                : false,
+	FileReader           : false,
+	Float32Array         : false,
+	Float64Array         : false,
+	FormData             : false,
+	focus                : false,
+	frames               : false,
+	getComputedStyle     : false,
+	HTMLElement          : false,
+	HTMLAnchorElement    : false,
+	HTMLBaseElement      : false,
+	HTMLBlockquoteElement: false,
+	HTMLBodyElement      : false,
+	HTMLBRElement        : false,
+	HTMLButtonElement    : false,
+	HTMLCanvasElement    : false,
+	HTMLDirectoryElement : false,
+	HTMLDivElement       : false,
+	HTMLDListElement     : false,
+	HTMLFieldSetElement  : false,
+	HTMLFontElement      : false,
+	HTMLFormElement      : false,
+	HTMLFrameElement     : false,
+	HTMLFrameSetElement  : false,
+	HTMLHeadElement      : false,
+	HTMLHeadingElement   : false,
+	HTMLHRElement        : false,
+	HTMLHtmlElement      : false,
+	HTMLIFrameElement    : false,
+	HTMLImageElement     : false,
+	HTMLInputElement     : false,
+	HTMLIsIndexElement   : false,
+	HTMLLabelElement     : false,
+	HTMLLayerElement     : false,
+	HTMLLegendElement    : false,
+	HTMLLIElement        : false,
+	HTMLLinkElement      : false,
+	HTMLMapElement       : false,
+	HTMLMenuElement      : false,
+	HTMLMetaElement      : false,
+	HTMLModElement       : false,
+	HTMLObjectElement    : false,
+	HTMLOListElement     : false,
+	HTMLOptGroupElement  : false,
+	HTMLOptionElement    : false,
+	HTMLParagraphElement : false,
+	HTMLParamElement     : false,
+	HTMLPreElement       : false,
+	HTMLQuoteElement     : false,
+	HTMLScriptElement    : false,
+	HTMLSelectElement    : false,
+	HTMLStyleElement     : false,
+	HTMLTableCaptionElement: false,
+	HTMLTableCellElement : false,
+	HTMLTableColElement  : false,
+	HTMLTableElement     : false,
+	HTMLTableRowElement  : false,
+	HTMLTableSectionElement: false,
+	HTMLTextAreaElement  : false,
+	HTMLTitleElement     : false,
+	HTMLUListElement     : false,
+	HTMLVideoElement     : false,
+	history              : false,
+	Int16Array           : false,
+	Int32Array           : false,
+	Int8Array            : false,
+	Image                : false,
+	length               : false,
+	localStorage         : false,
+	location             : false,
+	MessageChannel       : false,
+	MessageEvent         : false,
+	MessagePort          : false,
+	MouseEvent           : false,
+	moveBy               : false,
+	moveTo               : false,
+	MutationObserver     : false,
+	name                 : false,
+	Node                 : false,
+	NodeFilter           : false,
+	navigator            : false,
+	onbeforeunload       : true,
+	onblur               : true,
+	onerror              : true,
+	onfocus              : true,
+	onload               : true,
+	onresize             : true,
+	onunload             : true,
+	open                 : false,
+	openDatabase         : false,
+	opener               : false,
+	Option               : false,
+	parent               : false,
+	print                : false,
+	removeEventListener  : false,
+	resizeBy             : false,
+	resizeTo             : false,
+	screen               : false,
+	scroll               : false,
+	scrollBy             : false,
+	scrollTo             : false,
+	sessionStorage       : false,
+	setInterval          : false,
+	setTimeout           : false,
+	SharedWorker         : false,
+	status               : false,
+	SVGAElement          : false,
+	SVGAltGlyphDefElement: false,
+	SVGAltGlyphElement   : false,
+	SVGAltGlyphItemElement: false,
+	SVGAngle             : false,
+	SVGAnimateColorElement: false,
+	SVGAnimateElement    : false,
+	SVGAnimateMotionElement: false,
+	SVGAnimateTransformElement: false,
+	SVGAnimatedAngle     : false,
+	SVGAnimatedBoolean   : false,
+	SVGAnimatedEnumeration: false,
+	SVGAnimatedInteger   : false,
+	SVGAnimatedLength    : false,
+	SVGAnimatedLengthList: false,
+	SVGAnimatedNumber    : false,
+	SVGAnimatedNumberList: false,
+	SVGAnimatedPathData  : false,
+	SVGAnimatedPoints    : false,
+	SVGAnimatedPreserveAspectRatio: false,
+	SVGAnimatedRect      : false,
+	SVGAnimatedString    : false,
+	SVGAnimatedTransformList: false,
+	SVGAnimationElement  : false,
+	SVGCSSRule           : false,
+	SVGCircleElement     : false,
+	SVGClipPathElement   : false,
+	SVGColor             : false,
+	SVGColorProfileElement: false,
+	SVGColorProfileRule  : false,
+	SVGComponentTransferFunctionElement: false,
+	SVGCursorElement     : false,
+	SVGDefsElement       : false,
+	SVGDescElement       : false,
+	SVGDocument          : false,
+	SVGElement           : false,
+	SVGElementInstance   : false,
+	SVGElementInstanceList: false,
+	SVGEllipseElement    : false,
+	SVGExternalResourcesRequired: false,
+	SVGFEBlendElement    : false,
+	SVGFEColorMatrixElement: false,
+	SVGFEComponentTransferElement: false,
+	SVGFECompositeElement: false,
+	SVGFEConvolveMatrixElement: false,
+	SVGFEDiffuseLightingElement: false,
+	SVGFEDisplacementMapElement: false,
+	SVGFEDistantLightElement: false,
+	SVGFEFloodElement    : false,
+	SVGFEFuncAElement    : false,
+	SVGFEFuncBElement    : false,
+	SVGFEFuncGElement    : false,
+	SVGFEFuncRElement    : false,
+	SVGFEGaussianBlurElement: false,
+	SVGFEImageElement    : false,
+	SVGFEMergeElement    : false,
+	SVGFEMergeNodeElement: false,
+	SVGFEMorphologyElement: false,
+	SVGFEOffsetElement   : false,
+	SVGFEPointLightElement: false,
+	SVGFESpecularLightingElement: false,
+	SVGFESpotLightElement: false,
+	SVGFETileElement     : false,
+	SVGFETurbulenceElement: false,
+	SVGFilterElement     : false,
+	SVGFilterPrimitiveStandardAttributes: false,
+	SVGFitToViewBox      : false,
+	SVGFontElement       : false,
+	SVGFontFaceElement   : false,
+	SVGFontFaceFormatElement: false,
+	SVGFontFaceNameElement: false,
+	SVGFontFaceSrcElement: false,
+	SVGFontFaceUriElement: false,
+	SVGForeignObjectElement: false,
+	SVGGElement          : false,
+	SVGGlyphElement      : false,
+	SVGGlyphRefElement   : false,
+	SVGGradientElement   : false,
+	SVGHKernElement      : false,
+	SVGICCColor          : false,
+	SVGImageElement      : false,
+	SVGLangSpace         : false,
+	SVGLength            : false,
+	SVGLengthList        : false,
+	SVGLineElement       : false,
+	SVGLinearGradientElement: false,
+	SVGLocatable         : false,
+	SVGMPathElement      : false,
+	SVGMarkerElement     : false,
+	SVGMaskElement       : false,
+	SVGMatrix            : false,
+	SVGMetadataElement   : false,
+	SVGMissingGlyphElement: false,
+	SVGNumber            : false,
+	SVGNumberList        : false,
+	SVGPaint             : false,
+	SVGPathElement       : false,
+	SVGPathSeg           : false,
+	SVGPathSegArcAbs     : false,
+	SVGPathSegArcRel     : false,
+	SVGPathSegClosePath  : false,
+	SVGPathSegCurvetoCubicAbs: false,
+	SVGPathSegCurvetoCubicRel: false,
+	SVGPathSegCurvetoCubicSmoothAbs: false,
+	SVGPathSegCurvetoCubicSmoothRel: false,
+	SVGPathSegCurvetoQuadraticAbs: false,
+	SVGPathSegCurvetoQuadraticRel: false,
+	SVGPathSegCurvetoQuadraticSmoothAbs: false,
+	SVGPathSegCurvetoQuadraticSmoothRel: false,
+	SVGPathSegLinetoAbs  : false,
+	SVGPathSegLinetoHorizontalAbs: false,
+	SVGPathSegLinetoHorizontalRel: false,
+	SVGPathSegLinetoRel  : false,
+	SVGPathSegLinetoVerticalAbs: false,
+	SVGPathSegLinetoVerticalRel: false,
+	SVGPathSegList       : false,
+	SVGPathSegMovetoAbs  : false,
+	SVGPathSegMovetoRel  : false,
+	SVGPatternElement    : false,
+	SVGPoint             : false,
+	SVGPointList         : false,
+	SVGPolygonElement    : false,
+	SVGPolylineElement   : false,
+	SVGPreserveAspectRatio: false,
+	SVGRadialGradientElement: false,
+	SVGRect              : false,
+	SVGRectElement       : false,
+	SVGRenderingIntent   : false,
+	SVGSVGElement        : false,
+	SVGScriptElement     : false,
+	SVGSetElement        : false,
+	SVGStopElement       : false,
+	SVGStringList        : false,
+	SVGStylable          : false,
+	SVGStyleElement      : false,
+	SVGSwitchElement     : false,
+	SVGSymbolElement     : false,
+	SVGTRefElement       : false,
+	SVGTSpanElement      : false,
+	SVGTests             : false,
+	SVGTextContentElement: false,
+	SVGTextElement       : false,
+	SVGTextPathElement   : false,
+	SVGTextPositioningElement: false,
+	SVGTitleElement      : false,
+	SVGTransform         : false,
+	SVGTransformList     : false,
+	SVGTransformable     : false,
+	SVGURIReference      : false,
+	SVGUnitTypes         : false,
+	SVGUseElement        : false,
+	SVGVKernElement      : false,
+	SVGViewElement       : false,
+	SVGViewSpec          : false,
+	SVGZoomAndPan        : false,
+	TimeEvent            : false,
+	top                  : false,
+	Uint16Array          : false,
+	Uint32Array          : false,
+	Uint8Array           : false,
+	Uint8ClampedArray    : false,
+	WebSocket            : false,
+	window               : false,
+	Worker               : false,
+	XMLHttpRequest       : false,
+	XMLSerializer        : false,
+	XPathEvaluator       : false,
+	XPathException       : false,
+	XPathExpression      : false,
+	XPathNamespace       : false,
+	XPathNSResolver      : false,
+	XPathResult          : false
+};
+
+exports.devel = {
+	alert  : false,
+	confirm: false,
+	console: false,
+	Debug  : false,
+	opera  : false,
+	prompt : false
+};
+
+exports.worker = {
+	importScripts: true,
+	postMessage  : true,
+	self         : true
+};
+
+// Widely adopted global names that are not part of ECMAScript standard
+exports.nonstandard = {
+	escape  : false,
+	unescape: false
+};
+
+// Globals provided by popular JavaScript environments.
+
+exports.couch = {
+	"require" : false,
+	respond   : false,
+	getRow    : false,
+	emit      : false,
+	send      : false,
+	start     : false,
+	sum       : false,
+	log       : false,
+	exports   : false,
+	module    : false,
+	provides  : false
+};
+
+exports.node = {
+	__filename    : false,
+	__dirname     : false,
+	Buffer        : false,
+	DataView      : false,
+	console       : false,
+	exports       : true,  // In Node it is ok to exports = module.exports = foo();
+	GLOBAL        : false,
+	global        : false,
+	module        : false,
+	process       : false,
+	require       : false,
+	setTimeout    : false,
+	clearTimeout  : false,
+	setInterval   : false,
+	clearInterval : false,
+	setImmediate  : false, // v0.9.1+
+	clearImmediate: false  // v0.9.1+
+};
+
+exports.phantom = {
+	phantom      : true,
+	require      : true,
+	WebPage      : true
+};
+
+exports.rhino = {
+	defineClass  : false,
+	deserialize  : false,
+	gc           : false,
+	help         : false,
+	importPackage: false,
+	"java"       : false,
+	load         : false,
+	loadClass    : false,
+	print        : false,
+	quit         : false,
+	readFile     : false,
+	readUrl      : false,
+	runCommand   : false,
+	seal         : false,
+	serialize    : false,
+	spawn        : false,
+	sync         : false,
+	toint32      : false,
+	version      : false
+};
+
+exports.shelljs = {
+	target       : false,
+	echo         : false,
+	exit         : false,
+	cd           : false,
+	pwd          : false,
+	ls           : false,
+	find         : false,
+	cp           : false,
+	rm           : false,
+	mv           : false,
+	mkdir        : false,
+	test         : false,
+	cat          : false,
+	sed          : false,
+	grep         : false,
+	which        : false,
+	dirs         : false,
+	pushd        : false,
+	popd         : false,
+	env          : false,
+	exec         : false,
+	chmod        : false,
+	config       : false,
+	error        : false,
+	tempdir      : false
+};
+
+exports.wsh = {
+	ActiveXObject            : true,
+	Enumerator               : true,
+	GetObject                : true,
+	ScriptEngine             : true,
+	ScriptEngineBuildVersion : true,
+	ScriptEngineMajorVersion : true,
+	ScriptEngineMinorVersion : true,
+	VBArray                  : true,
+	WSH                      : true,
+	WScript                  : true,
+	XDomainRequest           : true
+};
+
+// Globals provided by popular JavaScript libraries.
+
+exports.dojo = {
+	dojo     : false,
+	dijit    : false,
+	dojox    : false,
+	define	 : false,
+	"require": false
+};
+
+exports.jquery = {
+	"$"    : false,
+	jQuery : false
+};
+
+exports.mootools = {
+	"$"           : false,
+	"$$"          : false,
+	Asset         : false,
+	Browser       : false,
+	Chain         : false,
+	Class         : false,
+	Color         : false,
+	Cookie        : false,
+	Core          : false,
+	Document      : false,
+	DomReady      : false,
+	DOMEvent      : false,
+	DOMReady      : false,
+	Drag          : false,
+	Element       : false,
+	Elements      : false,
+	Event         : false,
+	Events        : false,
+	Fx            : false,
+	Group         : false,
+	Hash          : false,
+	HtmlTable     : false,
+	Iframe        : false,
+	IframeShim    : false,
+	InputValidator: false,
+	instanceOf    : false,
+	Keyboard      : false,
+	Locale        : false,
+	Mask          : false,
+	MooTools      : false,
+	Native        : false,
+	Options       : false,
+	OverText      : false,
+	Request       : false,
+	Scroller      : false,
+	Slick         : false,
+	Slider        : false,
+	Sortables     : false,
+	Spinner       : false,
+	Swiff         : false,
+	Tips          : false,
+	Type          : false,
+	typeOf        : false,
+	URI           : false,
+	Window        : false
+};
+
+exports.prototypejs = {
+	"$"               : false,
+	"$$"              : false,
+	"$A"              : false,
+	"$F"              : false,
+	"$H"              : false,
+	"$R"              : false,
+	"$break"          : false,
+	"$continue"       : false,
+	"$w"              : false,
+	Abstract          : false,
+	Ajax              : false,
+	Class             : false,
+	Enumerable        : false,
+	Element           : false,
+	Event             : false,
+	Field             : false,
+	Form              : false,
+	Hash              : false,
+	Insertion         : false,
+	ObjectRange       : false,
+	PeriodicalExecuter: false,
+	Position          : false,
+	Prototype         : false,
+	Selector          : false,
+	Template          : false,
+	Toggle            : false,
+	Try               : false,
+	Autocompleter     : false,
+	Builder           : false,
+	Control           : false,
+	Draggable         : false,
+	Draggables        : false,
+	Droppables        : false,
+	Effect            : false,
+	Sortable          : false,
+	SortableObserver  : false,
+	Sound             : false,
+	Scriptaculous     : false
+};
+
+exports.yui = {
+	YUI       : false,
+	Y         : false,
+	YUI_config: false
+};
+
+
+},
+{}],
+"n4bKNg":[function(req,module,exports){
+/*!
+ * JSHint, by JSHint Community.
+ *
+ * This file (and this file only) is licensed under the same slightly modified
+ * MIT license that JSLint is. It stops evil-doers everywhere:
+ *
+ *	 Copyright (c) 2002 Douglas Crockford  (www.JSLint.com)
+ *
+ *	 Permission is hereby granted, free of charge, to any person obtaining
+ *	 a copy of this software and associated documentation files (the "Software"),
+ *	 to deal in the Software without restriction, including without limitation
+ *	 the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ *	 and/or sell copies of the Software, and to permit persons to whom
+ *	 the Software is furnished to do so, subject to the following conditions:
+ *
+ *	 The above copyright notice and this permission notice shall be included
+ *	 in all copies or substantial portions of the Software.
+ *
+ *	 The Software shall be used for Good, not Evil.
+ *
+ *	 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ *	 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ *	 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ *	 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ *	 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *	 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ *	 DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+/*jshint quotmark:double */
+/*global console:true */
+/*exported console */
+
+var _        = req("underscore");
+var events   = req("events");
+var vars     = req("../shared/vars.js");
+var messages = req("../shared/messages.js");
+var Lexer    = req("./lex.js").Lexer;
+var reg      = req("./reg.js");
+var state    = req("./state.js").state;
+var style    = req("./style.js");
+
+// We need this module here because environments such as IE and Rhino
+// don't necessarilly expose the 'console' API and browserify uses
+// it to log things. It's a sad state of affair, really.
+var console = req("console-browserify");
+
+// We build the application inside a function so that we produce only a singleton
+// variable. That function will be invoked immediately, and its return value is
+// the JSHINT function itself.
+
+var JSHINT = (function () {
+	"use strict";
+
+	var anonname, // The guessed name for anonymous functions.
+		api, // Extension API
+
+		// These are operators that should not be used with the ! operator.
+		bang = {
+			"<"  : true,
+			"<=" : true,
+			"==" : true,
+			"===": true,
+			"!==": true,
+			"!=" : true,
+			">"  : true,
+			">=" : true,
+			"+"  : true,
+			"-"  : true,
+			"*"  : true,
+			"/"  : true,
+			"%"  : true
+		},
+
+		// These are the JSHint boolean options.
+		boolOptions = {
+			asi         : true, // if automatic semicolon insertion should be tolerated
+			bitwise     : true, // if bitwise operators should not be allowed
+			boss        : true, // if advanced usage of assignments should be allowed
+			browser     : true, // if the standard browser globals should be predefined
+			camelcase   : true, // if identifiers should be required in camel case
+			couch       : true, // if CouchDB globals should be predefined
+			curly       : true, // if curly braces around all blocks should be required
+			debug       : true, // if debugger statements should be allowed
+			devel       : true, // if logging globals should be predefined (console, alert, etc.)
+			dojo        : true, // if Dojo Toolkit globals should be predefined
+			eqeqeq      : true, // if === should be required
+			eqnull      : true, // if == null comparisons should be tolerated
+			es3         : true, // if ES3 syntax should be allowed
+			es5         : true, // if ES5 syntax should be allowed (is now set per default)
+			esnext      : true, // if es.next specific syntax should be allowed
+			moz         : true, // if mozilla specific syntax should be allowed
+			evil        : true, // if eval should be allowed
+			expr        : true, // if ExpressionStatement should be allowed as Programs
+			forin       : true, // if for in statements must filter
+			funcscope   : true, // if only function scope should be used for scope tests
+			gcl         : true, // if JSHint should be compatible with Google Closure Linter
+			globalstrict: true, // if global "use strict"; should be allowed (also enables 'strict')
+			immed       : true, // if immediate invocations must be wrapped in parens
+			iterator    : true, // if the `__iterator__` property should be allowed
+			jquery      : true, // if jQuery globals should be predefined
+			lastsemic   : true, // if semicolons may be ommitted for the trailing
+			                    // statements inside of a one-line blocks.
+			laxbreak    : true, // if line breaks should not be checked
+			laxcomma    : true, // if line breaks should not be checked around commas
+			loopfunc    : true, // if functions should be allowed to be defined within
+			                    // loops
+			mootools    : true, // if MooTools globals should be predefined
+			multistr    : true, // allow multiline strings
+			newcap      : true, // if constructor names must be capitalized
+			noarg       : true, // if arguments.caller and arguments.callee should be
+			                    // disallowed
+			node        : true, // if the Node.js environment globals should be
+			                    // predefined
+			noempty     : true, // if empty blocks should be disallowed
+			nonew       : true, // if using `new` for side-effects should be disallowed
+			nonstandard : true, // if non-standard (but widely adopted) globals should
+			                    // be predefined
+			nomen       : true, // if names should be checked
+			onevar      : true, // if only one var statement per function should be
+			                    // allowed
+			passfail    : true, // if the scan should stop on first error
+			phantom     : true, // if PhantomJS symbols should be allowed
+			plusplus    : true, // if increment/decrement should not be allowed
+			proto       : true, // if the `__proto__` property should be allowed
+			prototypejs : true, // if Prototype and Scriptaculous globals should be
+			                    // predefined
+			rhino       : true, // if the Rhino environment globals should be predefined
+			shelljs     : true, // if ShellJS globals should be predefined
+			undef       : true, // if variables should be declared before used
+			scripturl   : true, // if script-targeted URLs should be tolerated
+			shadow      : true, // if variable shadowing should be tolerated
+			smarttabs   : true, // if smarttabs should be tolerated
+			                    // (http://www.emacswiki.org/emacs/SmartTabs)
+			strict      : true, // require the "use strict"; pragma
+			sub         : true, // if all forms of subscript notation are tolerated
+			supernew    : true, // if `new function () { ... };` and `new Object;`
+			                    // should be tolerated
+			trailing    : true, // if trailing whitespace rules apply
+			validthis   : true, // if 'this' inside a non-constructor function is valid.
+			                    // This is a function scoped option only.
+			withstmt    : true, // if with statements should be allowed
+			white       : true, // if strict whitespace rules apply
+			worker      : true, // if Web Worker script symbols should be allowed
+			wsh         : true, // if the Windows Scripting Host environment globals
+			                    // should be predefined
+			yui         : true, // YUI variables should be predefined
+
+			// Obsolete options
+			onecase     : true, // if one case switch statements should be allowed
+			regexp      : true, // if the . should not be allowed in regexp literals
+			regexdash   : true  // if unescaped first/last dash (-) inside brackets
+			                    // should be tolerated
+		},
+
+		// These are the JSHint options that can take any value
+		// (we use this object to detect invalid options)
+		valOptions = {
+			maxlen       : false,
+			indent       : false,
+			maxerr       : false,
+			predef       : false,
+			quotmark     : false, //'single'|'double'|true
+			scope        : false,
+			maxstatements: false, // {int} max statements per function
+			maxdepth     : false, // {int} max nested block depth per function
+			maxparams    : false, // {int} max params per function
+			maxcomplexity: false, // {int} max cyclomatic complexity per function
+			unused       : true,  // warn if variables are unused. Available options:
+			                      //   false    - don't check for unused variables
+			                      //   true     - "vars" + check last function param
+			                      //   "vars"   - skip checking unused function params
+			                      //   "strict" - "vars" + check all function params
+			latedef      : false  // warn if the variable is used before its definition
+			                      //   false    - don't emit any warnings
+			                      //   true     - warn if any variable is used before its definition
+			                      //   "nofunc" - warn for any variable but function declarations
+		},
+
+		// These are JSHint boolean options which are shared with JSLint
+		// where the definition in JSHint is opposite JSLint
+		invertedOptions = {
+			bitwise : true,
+			forin   : true,
+			newcap  : true,
+			nomen   : true,
+			plusplus: true,
+			regexp  : true,
+			undef   : true,
+			white   : true,
+
+			// Inverted and renamed, use JSHint name here
+			eqeqeq  : true,
+			onevar  : true,
+			strict  : true
+		},
+
+		// These are JSHint boolean options which are shared with JSLint
+		// where the name has been changed but the effect is unchanged
+		renamedOptions = {
+			eqeq   : "eqeqeq",
+			vars   : "onevar",
+			windows: "wsh",
+			sloppy : "strict"
+		},
+
+		declared, // Globals that were declared using /*global ... */ syntax.
+		exported, // Variables that are used outside of the current file.
+
+		functionicity = [
+			"closure", "exception", "global", "label",
+			"outer", "unused", "var"
+		],
+
+		funct, // The current function
+		functions, // All of the functions
+
+		global, // The global scope
+		implied, // Implied globals
+		inblock,
+		indent,
+		lookahead,
+		lex,
+		member,
+		membersOnly,
+		noreach,
+		predefined,		// Global variables defined by option
+
+		scope,  // The current scope
+		stack,
+		unuseds,
+		urls,
+		warnings,
+
+		extraModules = [],
+		emitter = new events.EventEmitter();
+
+	function checkOption(name, t) {
+		name = name.trim();
+
+		if (/^[+-]W\d{3}$/g.test(name)) {
+			return true;
+		}
+
+		if (valOptions[name] === undefined && boolOptions[name] === undefined) {
+			if (t.type !== "jslint") {
+				error("E001", t, name);
+				return false;
+			}
+		}
+
+		return true;
+	}
+
+	function isString(obj) {
+		return Object.prototype.toString.call(obj) === "[object String]";
+	}
+
+	function isIdentifier(tkn, value) {
+		if (!tkn)
+			return false;
+
+		if (!tkn.identifier || tkn.value !== value)
+			return false;
+
+		return true;
+	}
+
+	function isReserved(token) {
+		if (!token.reserved) {
+			return false;
+		}
+		var meta = token.meta;
+
+		if (meta && meta.isFutureReservedWord && state.option.inES5()) {
+			// ES3 FutureReservedWord in an ES5 environment.
+			if (!meta.es5) {
+				return false;
+			}
+
+			// Some ES5 FutureReservedWord identifiers are active only
+			// within a strict mode environment.
+			if (meta.strictOnly) {
+				if (!state.option.strict && !state.directive["use strict"]) {
+					return false;
+				}
+			}
+
+			if (token.isProperty) {
+				return false;
+			}
+		}
+
+		return true;
+	}
+
+	function supplant(str, data) {
+		return str.replace(/\{([^{}]*)\}/g, function (a, b) {
+			var r = data[b];
+			return typeof r === "string" || typeof r === "number" ? r : a;
+		});
+	}
+
+	function combine(t, o) {
+		var n;
+		for (n in o) {
+			if (_.has(o, n) && !_.has(JSHINT.blacklist, n)) {
+				t[n] = o[n];
+			}
+		}
+	}
+
+	function updatePredefined() {
+		Object.keys(JSHINT.blacklist).forEach(function (key) {
+			delete predefined[key];
+		});
+	}
+
+	function assume() {
+		if (state.option.couch) {
+			combine(predefined, vars.couch);
+		}
+
+		if (state.option.rhino) {
+			combine(predefined, vars.rhino);
+		}
+
+		if (state.option.shelljs) {
+			combine(predefined, vars.shelljs);
+			combine(predefined, vars.node);
+		}
+
+		if (state.option.phantom) {
+			combine(predefined, vars.phantom);
+		}
+
+		if (state.option.prototypejs) {
+			combine(predefined, vars.prototypejs);
+		}
+
+		if (state.option.node) {
+			combine(predefined, vars.node);
+		}
+
+		if (state.option.devel) {
+			combine(predefined, vars.devel);
+		}
+
+		if (state.option.dojo) {
+			combine(predefined, vars.dojo);
+		}
+
+		if (state.option.browser) {
+			combine(predefined, vars.browser);
+		}
+
+		if (state.option.nonstandard) {
+			combine(predefined, vars.nonstandard);
+		}
+
+		if (state.option.jquery) {
+			combine(predefined, vars.jquery);
+		}
+
+		if (state.option.mootools) {
+			combine(predefined, vars.mootools);
+		}
+
+		if (state.option.worker) {
+			combine(predefined, vars.worker);
+		}
+
+		if (state.option.wsh) {
+			combine(predefined, vars.wsh);
+		}
+
+		if (state.option.globalstrict && state.option.strict !== false) {
+			state.option.strict = true;
+		}
+
+		if (state.option.yui) {
+			combine(predefined, vars.yui);
+		}
+
+		// Let's assume that chronologically ES3 < ES5 < ES6/ESNext < Moz
+
+		state.option.inMoz = function (strict) {
+			return state.option.moz;
+		};
+
+		state.option.inESNext = function (strict) {
+			return state.option.moz || state.option.esnext;
+		};
+
+		state.option.inES5 = function (/* strict */) {
+			return !state.option.es3;
+		};
+
+		state.option.inES3 = function (strict) {
+			if (strict) {
+				return !state.option.moz && !state.option.esnext && state.option.es3;
+			}
+			return state.option.es3;
+		};
+	}
+
+	// Produce an error warning.
+	function quit(code, line, chr) {
+		var percentage = Math.floor((line / state.lines.length) * 100);
+		var message = messages.errors[code].desc;
+
+		throw {
+			name: "JSHintError",
+			line: line,
+			character: chr,
+			message: message + " (" + percentage + "% scanned).",
+			raw: message,
+			code: code
+		};
+	}
+
+	function isundef(scope, code, token, a) {
+		return JSHINT.undefs.push([scope, code, token, a]);
+	}
+
+	function warning(code, t, a, b, c, d) {
+		var ch, l, w, msg;
+
+		if (/^W\d{3}$/.test(code)) {
+			if (state.ignored[code])
+				return;
+
+			msg = messages.warnings[code];
+		} else if (/E\d{3}/.test(code)) {
+			msg = messages.errors[code];
+		} else if (/I\d{3}/.test(code)) {
+			msg = messages.info[code];
+		}
+
+		t = t || state.tokens.next;
+		if (t.id === "(end)") {  // `~
+			t = state.tokens.curr;
+		}
+
+		l = t.line || 0;
+		ch = t.from || 0;
+
+		w = {
+			id: "(error)",
+			raw: msg.desc,
+			code: msg.code,
+			evidence: state.lines[l - 1] || "",
+			line: l,
+			character: ch,
+			scope: JSHINT.scope,
+			a: a,
+			b: b,
+			c: c,
+			d: d
+		};
+
+		w.reason = supplant(msg.desc, w);
+		JSHINT.errors.push(w);
+
+		if (state.option.passfail) {
+			quit("E042", l, ch);
+		}
+
+		warnings += 1;
+		if (warnings >= state.option.maxerr) {
+			quit("E043", l, ch);
+		}
+
+		return w;
+	}
+
+	function warningAt(m, l, ch, a, b, c, d) {
+		return warning(m, {
+			line: l,
+			from: ch
+		}, a, b, c, d);
+	}
+
+	function error(m, t, a, b, c, d) {
+		warning(m, t, a, b, c, d);
+	}
+
+	function errorAt(m, l, ch, a, b, c, d) {
+		return error(m, {
+			line: l,
+			from: ch
+		}, a, b, c, d);
+	}
+
+	// Tracking of "internal" scripts, like eval containing a static string
+	function addInternalSrc(elem, src) {
+		var i;
+		i = {
+			id: "(internal)",
+			elem: elem,
+			value: src
+		};
+		JSHINT.internals.push(i);
+		return i;
+	}
+
+	function addlabel(t, type, tkn, islet) {
+		// Define t in the current function in the current scope.
+		if (type === "exception") {
+			if (_.has(funct["(context)"], t)) {
+				if (funct[t] !== true && !state.option.node) {
+					warning("W002", state.tokens.next, t);
+				}
+			}
+		}
+
+		if (_.has(funct, t) && !funct["(global)"]) {
+			if (funct[t] === true) {
+				if (state.option.latedef) {
+					if ((state.option.latedef === true && _.contains([funct[t], type], "unction")) ||
+							!_.contains([funct[t], type], "unction")) {
+						warning("W003", state.tokens.next, t);
+					}
+				}
+			} else {
+				if (!state.option.shadow && type !== "exception" ||
+							(funct["(blockscope)"].getlabel(t))) {
+					warning("W004", state.tokens.next, t);
+				}
+			}
+		}
+
+		// a double definition of a let variable in same block throws a TypeError
+		if (funct["(blockscope)"] && funct["(blockscope)"].current.has(t)) {
+			error("E044", state.tokens.next, t);
+		}
+
+		// if the identifier is from a let, adds it only to the current blockscope
+		if (islet) {
+			funct["(blockscope)"].current.add(t, type, state.tokens.curr);
+		} else {
+
+			funct[t] = type;
+
+			if (tkn) {
+				funct["(tokens)"][t] = tkn;
+			}
+
+			if (funct["(global)"]) {
+				global[t] = funct;
+				if (_.has(implied, t)) {
+					if (state.option.latedef) {
+						if ((state.option.latedef === true && _.contains([funct[t], type], "unction")) ||
+								!_.contains([funct[t], type], "unction")) {
+							warning("W003", state.tokens.next, t);
+						}
+					}
+
+					delete implied[t];
+				}
+			} else {
+				scope[t] = funct;
+			}
+		}
+	}
+
+	function doOption() {
+		var nt = state.tokens.next;
+		var body = nt.body.match(/(-\s+)?[^\s,]+(?:\s*:\s*(-\s+)?[^\s,]+)?/g);
+		var predef = {};
+
+		if (nt.type === "globals") {
+			body.forEach(function (g) {
+				g = g.split(":");
+				var key = (g[0] || "").trim();
+				var val = (g[1] || "").trim();
+
+				if (key.charAt(0) === "-") {
+					key = key.slice(1);
+					val = false;
+
+					JSHINT.blacklist[key] = key;
+					updatePredefined();
+				} else {
+					predef[key] = (val === "true");
+				}
+			});
+
+			combine(predefined, predef);
+
+			for (var key in predef) {
+				if (_.has(predef, key)) {
+					declared[key] = nt;
+				}
+			}
+		}
+
+		if (nt.type === "exported") {
+			body.forEach(function (e) {
+				exported[e] = true;
+			});
+		}
+
+		if (nt.type === "members") {
+			membersOnly = membersOnly || {};
+
+			body.forEach(function (m) {
+				var ch1 = m.charAt(0);
+				var ch2 = m.charAt(m.length - 1);
+
+				if (ch1 === ch2 && (ch1 === "\"" || ch1 === "'")) {
+					m = m
+						.substr(1, m.length - 2)
+						.replace("\\b", "\b")
+						.replace("\\t", "\t")
+						.replace("\\n", "\n")
+						.replace("\\v", "\v")
+						.replace("\\f", "\f")
+						.replace("\\r", "\r")
+						.replace("\\\\", "\\")
+						.replace("\\\"", "\"");
+				}
+
+				membersOnly[m] = false;
+			});
+		}
+
+		var numvals = [
+			"maxstatements",
+			"maxparams",
+			"maxdepth",
+			"maxcomplexity",
+			"maxerr",
+			"maxlen",
+			"indent"
+		];
+
+		if (nt.type === "jshint" || nt.type === "jslint") {
+			body.forEach(function (g) {
+				g = g.split(":");
+				var key = (g[0] || "").trim();
+				var val = (g[1] || "").trim();
+
+				if (!checkOption(key, nt)) {
+					return;
+				}
+
+				if (numvals.indexOf(key) >= 0) {
+
+					// GH988 - numeric options can be disabled by setting them to `false`
+					if (val !== "false") {
+						val = +val;
+
+						if (typeof val !== "number" || !isFinite(val) || val <= 0 || Math.floor(val) !== val) {
+							error("E032", nt, g[1].trim());
+							return;
+						}
+
+						if (key === "indent") {
+							state.option["(explicitIndent)"] = true;
+						}
+						state.option[key] = val;
+					} else {
+						if (key === "indent") {
+							state.option["(explicitIndent)"] = false;
+						} else {
+							state.option[key] = false;
+						}
+					}
+
+					return;
+				}
+
+				if (key === "validthis") {
+					// `validthis` is valid only within a function s

<TRUNCATED>

[02/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/xquery/JSONiqTokenizer.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/xquery/JSONiqTokenizer.js b/src/fauxton/assets/js/libs/ace/mode/xquery/JSONiqTokenizer.js
new file mode 100644
index 0000000..bef94c4
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/xquery/JSONiqTokenizer.js
@@ -0,0 +1,4205 @@
+// This file was generated on Mon Mar 18, 2013 16:57 (UTC+01) by REx v5.24 which is Copyright (c) 1979-2013 by Gunther Rademacher <gr...@gmx.net>
+// REx command line: JSONiqTokenizer.ebnf -ll 2 -backtrack -tree -javascript -a xqlint
+
+                                                            // line 2 "JSONiqTokenizer.ebnf"
+                                                            /* ***** BEGIN LICENSE BLOCK *****
+                                                             * Distributed under the BSD license:
+                                                             *
+                                                             * Copyright (c) 2010, Ajax.org B.V.
+                                                             * All rights reserved.
+                                                             *
+                                                             * Redistribution and use in source and binary forms, with or without
+                                                             * modification, are permitted provided that the following conditions are met:
+                                                             *     * Redistributions of source code must retain the above copyright
+                                                             *       notice, this list of conditions and the following disclaimer.
+                                                             *     * Redistributions in binary form must reproduce the above copyright
+                                                             *       notice, this list of conditions and the following disclaimer in the
+                                                             *       documentation and/or other materials provided with the distribution.
+                                                             *     * Neither the name of Ajax.org B.V. nor the
+                                                             *       names of its contributors may be used to endorse or promote products
+                                                             *       derived from this software without specific prior written permission.
+                                                             *
+                                                             * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+                                                             * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+                                                             * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+                                                             * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+                                                             * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+                                                             * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+                                                             * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+                                                             * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+                                                             * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+                                                             * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+                                                             *
+                                                             * ***** END LICENSE BLOCK ***** */
+
+                                                            define(function(require, exports, module){
+                                                            var JSONiqTokenizer = exports.JSONiqTokenizer = function JSONiqTokenizer(string, parsingEventHandler)
+                                                            {
+                                                              init(string, parsingEventHandler);
+                                                            // line 40 "JSONiqTokenizer.js"
+  var self = this;
+
+  this.ParseException = function(b, e, s, o, x)
+  {
+    var
+      begin = b,
+      end = e,
+      state = s,
+      offending = o,
+      expected = x;
+
+    this.getBegin = function() {return begin;};
+    this.getEnd = function() {return end;};
+    this.getState = function() {return state;};
+    this.getExpected = function() {return expected;};
+    this.getOffending = function() {return offending;};
+
+    this.getMessage = function()
+    {
+      return offending < 0 ? "lexical analysis failed" : "syntax error";
+    };
+  };
+
+  function init(string, parsingEventHandler)
+  {
+    eventHandler = parsingEventHandler;
+    input = string;
+    size = string.length;
+    reset(0, 0, 0);
+  }
+
+  this.getInput = function()
+  {
+    return input;
+  };
+
+  function reset(l, b, e)
+  {
+            b0 = b; e0 = b;
+    l1 = l; b1 = b; e1 = e;
+    end = e;
+    eventHandler.reset(input);
+  }
+
+  this.getOffendingToken = function(e)
+  {
+    var o = e.getOffending();
+    return o >= 0 ? JSONiqTokenizer.TOKEN[o] : null;
+  };
+
+  this.getExpectedTokenSet = function(e)
+  {
+    var expected;
+    if (e.getExpected() < 0)
+    {
+      expected = JSONiqTokenizer.getTokenSet(- e.getState());
+    }
+    else
+    {
+      expected = [JSONiqTokenizer.TOKEN[e.getExpected()]];
+    }
+    return expected;
+  };
+
+  this.getErrorMessage = function(e)
+  {
+    var tokenSet = this.getExpectedTokenSet(e);
+    var found = this.getOffendingToken(e);
+    var prefix = input.substring(0, e.getBegin());
+    var lines = prefix.split("\n");
+    var line = lines.length;
+    var column = lines[line - 1].length + 1;
+    var size = e.getEnd() - e.getBegin();
+    return e.getMessage()
+         + (found == null ? "" : ", found " + found)
+         + "\nwhile expecting "
+         + (tokenSet.length == 1 ? tokenSet[0] : ("[" + tokenSet.join(", ") + "]"))
+         + "\n"
+         + (size == 0 || found != null ? "" : "after successfully scanning " + size + " characters beginning ")
+         + "at line " + line + ", column " + column + ":\n..."
+         + input.substring(e.getBegin(), Math.min(input.length, e.getBegin() + 64))
+         + "...";
+  };
+
+  this.parse_start = function()
+  {
+    eventHandler.startNonterminal("start", e0);
+    lookahead1W(14);                // ModuleDecl | Annotation | OptionDecl | Operator | Variable | Tag | AttrTest |
+                                    // Wildcard | EQName^Token | IntegerLiteral | DecimalLiteral | DoubleLiteral |
+                                    // S^WS | EOF | '!' | '"' | "'" | '(' | '(#' | '(:' | '(:~' | ')' | ',' | '.' |
+                                    // '/' | ':' | ';' | '<!--' | '<![CDATA[' | '<?' | '[' | ']' | 'after' |
+                                    // 'allowing' | 'ancestor' | 'ancestor-or-self' | 'and' | 'as' | 'ascending' |
+                                    // 'at' | 'attribute' | 'base-uri' | 'before' | 'boundary-space' | 'break' |
+                                    // 'case' | 'cast' | 'castable' | 'catch' | 'child' | 'collation' | 'comment' |
+                                    // 'constraint' | 'construction' | 'context' | 'continue' | 'copy' |
+                                    // 'copy-namespaces' | 'count' | 'decimal-format' | 'declare' | 'default' |
+                                    // 'delete' | 'descendant' | 'descendant-or-self' | 'descending' | 'div' |
+                                    // 'document' | 'document-node' | 'element' | 'else' | 'empty' | 'empty-sequence' |
+                                    // 'encoding' | 'end' | 'eq' | 'every' | 'except' | 'exit' | 'external' | 'first' |
+                                    // 'following' | 'following-sibling' | 'for' | 'ft-option' | 'function' | 'ge' |
+                                    // 'group' | 'gt' | 'idiv' | 'if' | 'import' | 'in' | 'index' | 'insert' |
+                                    // 'instance' | 'integrity' | 'intersect' | 'into' | 'is' | 'item' | 'last' |
+                                    // 'lax' | 'le' | 'let' | 'loop' | 'lt' | 'mod' | 'modify' | 'module' |
+                                    // 'namespace' | 'namespace-node' | 'ne' | 'node' | 'nodes' | 'only' | 'option' |
+                                    // 'or' | 'order' | 'ordered' | 'ordering' | 'parent' | 'preceding' |
+                                    // 'preceding-sibling' | 'processing-instruction' | 'rename' | 'replace' |
+                                    // 'return' | 'returning' | 'revalidation' | 'satisfies' | 'schema' |
+                                    // 'schema-attribute' | 'schema-element' | 'score' | 'self' | 'sliding' | 'some' |
+                                    // 'stable' | 'start' | 'strict' | 'switch' | 'text' | 'to' | 'treat' | 'try' |
+                                    // 'tumbling' | 'type' | 'typeswitch' | 'union' | 'unordered' | 'updating' |
+                                    // 'validate' | 'value' | 'variable' | 'version' | 'where' | 'while' | 'with' |
+                                    // 'xquery' | '{' | '|' | '}'
+    switch (l1)
+    {
+    case 55:                        // '<![CDATA['
+      shift(55);                    // '<![CDATA['
+      break;
+    case 54:                        // '<!--'
+      shift(54);                    // '<!--'
+      break;
+    case 56:                        // '<?'
+      shift(56);                    // '<?'
+      break;
+    case 40:                        // '(#'
+      shift(40);                    // '(#'
+      break;
+    case 42:                        // '(:~'
+      shift(42);                    // '(:~'
+      break;
+    case 41:                        // '(:'
+      shift(41);                    // '(:'
+      break;
+    case 35:                        // '"'
+      shift(35);                    // '"'
+      break;
+    case 38:                        // "'"
+      shift(38);                    // "'"
+      break;
+    case 274:                       // '}'
+      shift(274);                   // '}'
+      break;
+    case 271:                       // '{'
+      shift(271);                   // '{'
+      break;
+    case 39:                        // '('
+      shift(39);                    // '('
+      break;
+    case 43:                        // ')'
+      shift(43);                    // ')'
+      break;
+    case 49:                        // '/'
+      shift(49);                    // '/'
+      break;
+    case 62:                        // '['
+      shift(62);                    // '['
+      break;
+    case 63:                        // ']'
+      shift(63);                    // ']'
+      break;
+    case 46:                        // ','
+      shift(46);                    // ','
+      break;
+    case 48:                        // '.'
+      shift(48);                    // '.'
+      break;
+    case 53:                        // ';'
+      shift(53);                    // ';'
+      break;
+    case 51:                        // ':'
+      shift(51);                    // ':'
+      break;
+    case 34:                        // '!'
+      shift(34);                    // '!'
+      break;
+    case 273:                       // '|'
+      shift(273);                   // '|'
+      break;
+    case 2:                         // Annotation
+      shift(2);                     // Annotation
+      break;
+    case 1:                         // ModuleDecl
+      shift(1);                     // ModuleDecl
+      break;
+    case 3:                         // OptionDecl
+      shift(3);                     // OptionDecl
+      break;
+    case 12:                        // AttrTest
+      shift(12);                    // AttrTest
+      break;
+    case 13:                        // Wildcard
+      shift(13);                    // Wildcard
+      break;
+    case 15:                        // IntegerLiteral
+      shift(15);                    // IntegerLiteral
+      break;
+    case 16:                        // DecimalLiteral
+      shift(16);                    // DecimalLiteral
+      break;
+    case 17:                        // DoubleLiteral
+      shift(17);                    // DoubleLiteral
+      break;
+    case 5:                         // Variable
+      shift(5);                     // Variable
+      break;
+    case 6:                         // Tag
+      shift(6);                     // Tag
+      break;
+    case 4:                         // Operator
+      shift(4);                     // Operator
+      break;
+    case 33:                        // EOF
+      shift(33);                    // EOF
+      break;
+    default:
+      parse_EQName();
+    }
+    eventHandler.endNonterminal("start", e0);
+  };
+
+  this.parse_StartTag = function()
+  {
+    eventHandler.startNonterminal("StartTag", e0);
+    lookahead1W(8);                 // QName | S^WS | EOF | '"' | "'" | '/>' | '=' | '>'
+    switch (l1)
+    {
+    case 58:                        // '>'
+      shift(58);                    // '>'
+      break;
+    case 50:                        // '/>'
+      shift(50);                    // '/>'
+      break;
+    case 27:                        // QName
+      shift(27);                    // QName
+      break;
+    case 57:                        // '='
+      shift(57);                    // '='
+      break;
+    case 35:                        // '"'
+      shift(35);                    // '"'
+      break;
+    case 38:                        // "'"
+      shift(38);                    // "'"
+      break;
+    default:
+      shift(33);                    // EOF
+    }
+    eventHandler.endNonterminal("StartTag", e0);
+  };
+
+  this.parse_TagContent = function()
+  {
+    eventHandler.startNonterminal("TagContent", e0);
+    lookahead1(11);                 // Tag | EndTag | PredefinedEntityRef | ElementContentChar | CharRef | EOF |
+                                    // '<!--' | '<![CDATA[' | '{' | '{{' | '}}'
+    switch (l1)
+    {
+    case 23:                        // ElementContentChar
+      shift(23);                    // ElementContentChar
+      break;
+    case 6:                         // Tag
+      shift(6);                     // Tag
+      break;
+    case 7:                         // EndTag
+      shift(7);                     // EndTag
+      break;
+    case 55:                        // '<![CDATA['
+      shift(55);                    // '<![CDATA['
+      break;
+    case 54:                        // '<!--'
+      shift(54);                    // '<!--'
+      break;
+    case 18:                        // PredefinedEntityRef
+      shift(18);                    // PredefinedEntityRef
+      break;
+    case 29:                        // CharRef
+      shift(29);                    // CharRef
+      break;
+    case 272:                       // '{{'
+      shift(272);                   // '{{'
+      break;
+    case 275:                       // '}}'
+      shift(275);                   // '}}'
+      break;
+    case 271:                       // '{'
+      shift(271);                   // '{'
+      break;
+    default:
+      shift(33);                    // EOF
+    }
+    eventHandler.endNonterminal("TagContent", e0);
+  };
+
+  this.parse_AposAttr = function()
+  {
+    eventHandler.startNonterminal("AposAttr", e0);
+    lookahead1(10);                 // PredefinedEntityRef | EscapeApos | AposAttrContentChar | CharRef | EOF | "'" |
+                                    // '{' | '{{' | '}}'
+    switch (l1)
+    {
+    case 20:                        // EscapeApos
+      shift(20);                    // EscapeApos
+      break;
+    case 25:                        // AposAttrContentChar
+      shift(25);                    // AposAttrContentChar
+      break;
+    case 18:                        // PredefinedEntityRef
+      shift(18);                    // PredefinedEntityRef
+      break;
+    case 29:                        // CharRef
+      shift(29);                    // CharRef
+      break;
+    case 272:                       // '{{'
+      shift(272);                   // '{{'
+      break;
+    case 275:                       // '}}'
+      shift(275);                   // '}}'
+      break;
+    case 271:                       // '{'
+      shift(271);                   // '{'
+      break;
+    case 38:                        // "'"
+      shift(38);                    // "'"
+      break;
+    default:
+      shift(33);                    // EOF
+    }
+    eventHandler.endNonterminal("AposAttr", e0);
+  };
+
+  this.parse_QuotAttr = function()
+  {
+    eventHandler.startNonterminal("QuotAttr", e0);
+    lookahead1(9);                  // PredefinedEntityRef | EscapeQuot | QuotAttrContentChar | CharRef | EOF | '"' |
+                                    // '{' | '{{' | '}}'
+    switch (l1)
+    {
+    case 19:                        // EscapeQuot
+      shift(19);                    // EscapeQuot
+      break;
+    case 24:                        // QuotAttrContentChar
+      shift(24);                    // QuotAttrContentChar
+      break;
+    case 18:                        // PredefinedEntityRef
+      shift(18);                    // PredefinedEntityRef
+      break;
+    case 29:                        // CharRef
+      shift(29);                    // CharRef
+      break;
+    case 272:                       // '{{'
+      shift(272);                   // '{{'
+      break;
+    case 275:                       // '}}'
+      shift(275);                   // '}}'
+      break;
+    case 271:                       // '{'
+      shift(271);                   // '{'
+      break;
+    case 35:                        // '"'
+      shift(35);                    // '"'
+      break;
+    default:
+      shift(33);                    // EOF
+    }
+    eventHandler.endNonterminal("QuotAttr", e0);
+  };
+
+  this.parse_CData = function()
+  {
+    eventHandler.startNonterminal("CData", e0);
+    lookahead1(1);                  // CDataSectionContents | EOF | ']]>'
+    switch (l1)
+    {
+    case 11:                        // CDataSectionContents
+      shift(11);                    // CDataSectionContents
+      break;
+    case 64:                        // ']]>'
+      shift(64);                    // ']]>'
+      break;
+    default:
+      shift(33);                    // EOF
+    }
+    eventHandler.endNonterminal("CData", e0);
+  };
+
+  this.parse_XMLComment = function()
+  {
+    eventHandler.startNonterminal("XMLComment", e0);
+    lookahead1(0);                  // DirCommentContents | EOF | '-->'
+    switch (l1)
+    {
+    case 9:                         // DirCommentContents
+      shift(9);                     // DirCommentContents
+      break;
+    case 47:                        // '-->'
+      shift(47);                    // '-->'
+      break;
+    default:
+      shift(33);                    // EOF
+    }
+    eventHandler.endNonterminal("XMLComment", e0);
+  };
+
+  this.parse_PI = function()
+  {
+    eventHandler.startNonterminal("PI", e0);
+    lookahead1(3);                  // DirPIContents | EOF | '?' | '?>'
+    switch (l1)
+    {
+    case 10:                        // DirPIContents
+      shift(10);                    // DirPIContents
+      break;
+    case 59:                        // '?'
+      shift(59);                    // '?'
+      break;
+    case 60:                        // '?>'
+      shift(60);                    // '?>'
+      break;
+    default:
+      shift(33);                    // EOF
+    }
+    eventHandler.endNonterminal("PI", e0);
+  };
+
+  this.parse_Pragma = function()
+  {
+    eventHandler.startNonterminal("Pragma", e0);
+    lookahead1(2);                  // PragmaContents | EOF | '#' | '#)'
+    switch (l1)
+    {
+    case 8:                         // PragmaContents
+      shift(8);                     // PragmaContents
+      break;
+    case 36:                        // '#'
+      shift(36);                    // '#'
+      break;
+    case 37:                        // '#)'
+      shift(37);                    // '#)'
+      break;
+    default:
+      shift(33);                    // EOF
+    }
+    eventHandler.endNonterminal("Pragma", e0);
+  };
+
+  this.parse_Comment = function()
+  {
+    eventHandler.startNonterminal("Comment", e0);
+    lookahead1(4);                  // CommentContents | EOF | '(:' | ':)'
+    switch (l1)
+    {
+    case 52:                        // ':)'
+      shift(52);                    // ':)'
+      break;
+    case 41:                        // '(:'
+      shift(41);                    // '(:'
+      break;
+    case 30:                        // CommentContents
+      shift(30);                    // CommentContents
+      break;
+    default:
+      shift(33);                    // EOF
+    }
+    eventHandler.endNonterminal("Comment", e0);
+  };
+
+  this.parse_CommentDoc = function()
+  {
+    eventHandler.startNonterminal("CommentDoc", e0);
+    lookahead1(5);                  // DocTag | DocCommentContents | EOF | '(:' | ':)'
+    switch (l1)
+    {
+    case 31:                        // DocTag
+      shift(31);                    // DocTag
+      break;
+    case 32:                        // DocCommentContents
+      shift(32);                    // DocCommentContents
+      break;
+    case 52:                        // ':)'
+      shift(52);                    // ':)'
+      break;
+    case 41:                        // '(:'
+      shift(41);                    // '(:'
+      break;
+    default:
+      shift(33);                    // EOF
+    }
+    eventHandler.endNonterminal("CommentDoc", e0);
+  };
+
+  this.parse_QuotString = function()
+  {
+    eventHandler.startNonterminal("QuotString", e0);
+    lookahead1(6);                  // PredefinedEntityRef | EscapeQuot | QuotChar | CharRef | EOF | '"'
+    switch (l1)
+    {
+    case 18:                        // PredefinedEntityRef
+      shift(18);                    // PredefinedEntityRef
+      break;
+    case 29:                        // CharRef
+      shift(29);                    // CharRef
+      break;
+    case 19:                        // EscapeQuot
+      shift(19);                    // EscapeQuot
+      break;
+    case 21:                        // QuotChar
+      shift(21);                    // QuotChar
+      break;
+    case 35:                        // '"'
+      shift(35);                    // '"'
+      break;
+    default:
+      shift(33);                    // EOF
+    }
+    eventHandler.endNonterminal("QuotString", e0);
+  };
+
+  this.parse_AposString = function()
+  {
+    eventHandler.startNonterminal("AposString", e0);
+    lookahead1(7);                  // PredefinedEntityRef | EscapeApos | AposChar | CharRef | EOF | "'"
+    switch (l1)
+    {
+    case 18:                        // PredefinedEntityRef
+      shift(18);                    // PredefinedEntityRef
+      break;
+    case 29:                        // CharRef
+      shift(29);                    // CharRef
+      break;
+    case 20:                        // EscapeApos
+      shift(20);                    // EscapeApos
+      break;
+    case 22:                        // AposChar
+      shift(22);                    // AposChar
+      break;
+    case 38:                        // "'"
+      shift(38);                    // "'"
+      break;
+    default:
+      shift(33);                    // EOF
+    }
+    eventHandler.endNonterminal("AposString", e0);
+  };
+
+  this.parse_Prefix = function()
+  {
+    eventHandler.startNonterminal("Prefix", e0);
+    lookahead1W(13);                // NCName^Token | S^WS | 'after' | 'allowing' | 'ancestor' | 'ancestor-or-self' |
+                                    // 'and' | 'as' | 'ascending' | 'at' | 'attribute' | 'base-uri' | 'before' |
+                                    // 'boundary-space' | 'break' | 'case' | 'cast' | 'castable' | 'catch' | 'child' |
+                                    // 'collation' | 'comment' | 'constraint' | 'construction' | 'context' |
+                                    // 'continue' | 'copy' | 'copy-namespaces' | 'count' | 'decimal-format' |
+                                    // 'declare' | 'default' | 'delete' | 'descendant' | 'descendant-or-self' |
+                                    // 'descending' | 'div' | 'document' | 'document-node' | 'element' | 'else' |
+                                    // 'empty' | 'empty-sequence' | 'encoding' | 'end' | 'eq' | 'every' | 'except' |
+                                    // 'exit' | 'external' | 'first' | 'following' | 'following-sibling' | 'for' |
+                                    // 'ft-option' | 'function' | 'ge' | 'group' | 'gt' | 'idiv' | 'if' | 'import' |
+                                    // 'in' | 'index' | 'insert' | 'instance' | 'integrity' | 'intersect' | 'into' |
+                                    // 'is' | 'item' | 'last' | 'lax' | 'le' | 'let' | 'loop' | 'lt' | 'mod' |
+                                    // 'modify' | 'module' | 'namespace' | 'namespace-node' | 'ne' | 'node' | 'nodes' |
+                                    // 'only' | 'option' | 'or' | 'order' | 'ordered' | 'ordering' | 'parent' |
+                                    // 'preceding' | 'preceding-sibling' | 'processing-instruction' | 'rename' |
+                                    // 'replace' | 'return' | 'returning' | 'revalidation' | 'satisfies' | 'schema' |
+                                    // 'schema-attribute' | 'schema-element' | 'score' | 'self' | 'sliding' | 'some' |
+                                    // 'stable' | 'start' | 'strict' | 'switch' | 'text' | 'to' | 'treat' | 'try' |
+                                    // 'tumbling' | 'type' | 'typeswitch' | 'union' | 'unordered' | 'updating' |
+                                    // 'validate' | 'value' | 'variable' | 'version' | 'where' | 'while' | 'with' |
+                                    // 'xquery'
+    whitespace();
+    parse_NCName();
+    eventHandler.endNonterminal("Prefix", e0);
+  };
+
+  this.parse__EQName = function()
+  {
+    eventHandler.startNonterminal("_EQName", e0);
+    lookahead1W(12);                // EQName^Token | S^WS | 'after' | 'allowing' | 'ancestor' | 'ancestor-or-self' |
+                                    // 'and' | 'as' | 'ascending' | 'at' | 'attribute' | 'base-uri' | 'before' |
+                                    // 'boundary-space' | 'break' | 'case' | 'cast' | 'castable' | 'catch' | 'child' |
+                                    // 'collation' | 'comment' | 'constraint' | 'construction' | 'context' |
+                                    // 'continue' | 'copy' | 'copy-namespaces' | 'count' | 'decimal-format' |
+                                    // 'declare' | 'default' | 'delete' | 'descendant' | 'descendant-or-self' |
+                                    // 'descending' | 'div' | 'document' | 'document-node' | 'element' | 'else' |
+                                    // 'empty' | 'empty-sequence' | 'encoding' | 'end' | 'eq' | 'every' | 'except' |
+                                    // 'exit' | 'external' | 'first' | 'following' | 'following-sibling' | 'for' |
+                                    // 'ft-option' | 'function' | 'ge' | 'group' | 'gt' | 'idiv' | 'if' | 'import' |
+                                    // 'in' | 'index' | 'insert' | 'instance' | 'integrity' | 'intersect' | 'into' |
+                                    // 'is' | 'item' | 'last' | 'lax' | 'le' | 'let' | 'loop' | 'lt' | 'mod' |
+                                    // 'modify' | 'module' | 'namespace' | 'namespace-node' | 'ne' | 'node' | 'nodes' |
+                                    // 'only' | 'option' | 'or' | 'order' | 'ordered' | 'ordering' | 'parent' |
+                                    // 'preceding' | 'preceding-sibling' | 'processing-instruction' | 'rename' |
+                                    // 'replace' | 'return' | 'returning' | 'revalidation' | 'satisfies' | 'schema' |
+                                    // 'schema-attribute' | 'schema-element' | 'score' | 'self' | 'sliding' | 'some' |
+                                    // 'stable' | 'start' | 'strict' | 'switch' | 'text' | 'to' | 'treat' | 'try' |
+                                    // 'tumbling' | 'type' | 'typeswitch' | 'union' | 'unordered' | 'updating' |
+                                    // 'validate' | 'value' | 'variable' | 'version' | 'where' | 'while' | 'with' |
+                                    // 'xquery'
+    whitespace();
+    parse_EQName();
+    eventHandler.endNonterminal("_EQName", e0);
+  };
+
+  function parse_EQName()
+  {
+    eventHandler.startNonterminal("EQName", e0);
+    switch (l1)
+    {
+    case 77:                        // 'attribute'
+      shift(77);                    // 'attribute'
+      break;
+    case 91:                        // 'comment'
+      shift(91);                    // 'comment'
+      break;
+    case 115:                       // 'document-node'
+      shift(115);                   // 'document-node'
+      break;
+    case 116:                       // 'element'
+      shift(116);                   // 'element'
+      break;
+    case 119:                       // 'empty-sequence'
+      shift(119);                   // 'empty-sequence'
+      break;
+    case 140:                       // 'function'
+      shift(140);                   // 'function'
+      break;
+    case 147:                       // 'if'
+      shift(147);                   // 'if'
+      break;
+    case 160:                       // 'item'
+      shift(160);                   // 'item'
+      break;
+    case 180:                       // 'namespace-node'
+      shift(180);                   // 'namespace-node'
+      break;
+    case 186:                       // 'node'
+      shift(186);                   // 'node'
+      break;
+    case 211:                       // 'processing-instruction'
+      shift(211);                   // 'processing-instruction'
+      break;
+    case 221:                       // 'schema-attribute'
+      shift(221);                   // 'schema-attribute'
+      break;
+    case 222:                       // 'schema-element'
+      shift(222);                   // 'schema-element'
+      break;
+    case 238:                       // 'switch'
+      shift(238);                   // 'switch'
+      break;
+    case 239:                       // 'text'
+      shift(239);                   // 'text'
+      break;
+    case 248:                       // 'typeswitch'
+      shift(248);                   // 'typeswitch'
+      break;
+    default:
+      parse_FunctionName();
+    }
+    eventHandler.endNonterminal("EQName", e0);
+  }
+
+  function parse_FunctionName()
+  {
+    eventHandler.startNonterminal("FunctionName", e0);
+    switch (l1)
+    {
+    case 14:                        // EQName^Token
+      shift(14);                    // EQName^Token
+      break;
+    case 65:                        // 'after'
+      shift(65);                    // 'after'
+      break;
+    case 68:                        // 'ancestor'
+      shift(68);                    // 'ancestor'
+      break;
+    case 69:                        // 'ancestor-or-self'
+      shift(69);                    // 'ancestor-or-self'
+      break;
+    case 70:                        // 'and'
+      shift(70);                    // 'and'
+      break;
+    case 74:                        // 'as'
+      shift(74);                    // 'as'
+      break;
+    case 75:                        // 'ascending'
+      shift(75);                    // 'ascending'
+      break;
+    case 79:                        // 'before'
+      shift(79);                    // 'before'
+      break;
+    case 83:                        // 'case'
+      shift(83);                    // 'case'
+      break;
+    case 84:                        // 'cast'
+      shift(84);                    // 'cast'
+      break;
+    case 85:                        // 'castable'
+      shift(85);                    // 'castable'
+      break;
+    case 88:                        // 'child'
+      shift(88);                    // 'child'
+      break;
+    case 89:                        // 'collation'
+      shift(89);                    // 'collation'
+      break;
+    case 98:                        // 'copy'
+      shift(98);                    // 'copy'
+      break;
+    case 100:                       // 'count'
+      shift(100);                   // 'count'
+      break;
+    case 103:                       // 'declare'
+      shift(103);                   // 'declare'
+      break;
+    case 104:                       // 'default'
+      shift(104);                   // 'default'
+      break;
+    case 105:                       // 'delete'
+      shift(105);                   // 'delete'
+      break;
+    case 106:                       // 'descendant'
+      shift(106);                   // 'descendant'
+      break;
+    case 107:                       // 'descendant-or-self'
+      shift(107);                   // 'descendant-or-self'
+      break;
+    case 108:                       // 'descending'
+      shift(108);                   // 'descending'
+      break;
+    case 113:                       // 'div'
+      shift(113);                   // 'div'
+      break;
+    case 114:                       // 'document'
+      shift(114);                   // 'document'
+      break;
+    case 117:                       // 'else'
+      shift(117);                   // 'else'
+      break;
+    case 118:                       // 'empty'
+      shift(118);                   // 'empty'
+      break;
+    case 121:                       // 'end'
+      shift(121);                   // 'end'
+      break;
+    case 123:                       // 'eq'
+      shift(123);                   // 'eq'
+      break;
+    case 124:                       // 'every'
+      shift(124);                   // 'every'
+      break;
+    case 126:                       // 'except'
+      shift(126);                   // 'except'
+      break;
+    case 129:                       // 'first'
+      shift(129);                   // 'first'
+      break;
+    case 130:                       // 'following'
+      shift(130);                   // 'following'
+      break;
+    case 131:                       // 'following-sibling'
+      shift(131);                   // 'following-sibling'
+      break;
+    case 132:                       // 'for'
+      shift(132);                   // 'for'
+      break;
+    case 141:                       // 'ge'
+      shift(141);                   // 'ge'
+      break;
+    case 143:                       // 'group'
+      shift(143);                   // 'group'
+      break;
+    case 145:                       // 'gt'
+      shift(145);                   // 'gt'
+      break;
+    case 146:                       // 'idiv'
+      shift(146);                   // 'idiv'
+      break;
+    case 148:                       // 'import'
+      shift(148);                   // 'import'
+      break;
+    case 154:                       // 'insert'
+      shift(154);                   // 'insert'
+      break;
+    case 155:                       // 'instance'
+      shift(155);                   // 'instance'
+      break;
+    case 157:                       // 'intersect'
+      shift(157);                   // 'intersect'
+      break;
+    case 158:                       // 'into'
+      shift(158);                   // 'into'
+      break;
+    case 159:                       // 'is'
+      shift(159);                   // 'is'
+      break;
+    case 165:                       // 'last'
+      shift(165);                   // 'last'
+      break;
+    case 167:                       // 'le'
+      shift(167);                   // 'le'
+      break;
+    case 169:                       // 'let'
+      shift(169);                   // 'let'
+      break;
+    case 173:                       // 'lt'
+      shift(173);                   // 'lt'
+      break;
+    case 175:                       // 'mod'
+      shift(175);                   // 'mod'
+      break;
+    case 176:                       // 'modify'
+      shift(176);                   // 'modify'
+      break;
+    case 177:                       // 'module'
+      shift(177);                   // 'module'
+      break;
+    case 179:                       // 'namespace'
+      shift(179);                   // 'namespace'
+      break;
+    case 181:                       // 'ne'
+      shift(181);                   // 'ne'
+      break;
+    case 193:                       // 'only'
+      shift(193);                   // 'only'
+      break;
+    case 195:                       // 'or'
+      shift(195);                   // 'or'
+      break;
+    case 196:                       // 'order'
+      shift(196);                   // 'order'
+      break;
+    case 197:                       // 'ordered'
+      shift(197);                   // 'ordered'
+      break;
+    case 201:                       // 'parent'
+      shift(201);                   // 'parent'
+      break;
+    case 207:                       // 'preceding'
+      shift(207);                   // 'preceding'
+      break;
+    case 208:                       // 'preceding-sibling'
+      shift(208);                   // 'preceding-sibling'
+      break;
+    case 213:                       // 'rename'
+      shift(213);                   // 'rename'
+      break;
+    case 214:                       // 'replace'
+      shift(214);                   // 'replace'
+      break;
+    case 215:                       // 'return'
+      shift(215);                   // 'return'
+      break;
+    case 219:                       // 'satisfies'
+      shift(219);                   // 'satisfies'
+      break;
+    case 224:                       // 'self'
+      shift(224);                   // 'self'
+      break;
+    case 230:                       // 'some'
+      shift(230);                   // 'some'
+      break;
+    case 231:                       // 'stable'
+      shift(231);                   // 'stable'
+      break;
+    case 232:                       // 'start'
+      shift(232);                   // 'start'
+      break;
+    case 243:                       // 'to'
+      shift(243);                   // 'to'
+      break;
+    case 244:                       // 'treat'
+      shift(244);                   // 'treat'
+      break;
+    case 245:                       // 'try'
+      shift(245);                   // 'try'
+      break;
+    case 249:                       // 'union'
+      shift(249);                   // 'union'
+      break;
+    case 251:                       // 'unordered'
+      shift(251);                   // 'unordered'
+      break;
+    case 255:                       // 'validate'
+      shift(255);                   // 'validate'
+      break;
+    case 261:                       // 'where'
+      shift(261);                   // 'where'
+      break;
+    case 265:                       // 'with'
+      shift(265);                   // 'with'
+      break;
+    case 269:                       // 'xquery'
+      shift(269);                   // 'xquery'
+      break;
+    case 67:                        // 'allowing'
+      shift(67);                    // 'allowing'
+      break;
+    case 76:                        // 'at'
+      shift(76);                    // 'at'
+      break;
+    case 78:                        // 'base-uri'
+      shift(78);                    // 'base-uri'
+      break;
+    case 80:                        // 'boundary-space'
+      shift(80);                    // 'boundary-space'
+      break;
+    case 81:                        // 'break'
+      shift(81);                    // 'break'
+      break;
+    case 86:                        // 'catch'
+      shift(86);                    // 'catch'
+      break;
+    case 93:                        // 'construction'
+      shift(93);                    // 'construction'
+      break;
+    case 96:                        // 'context'
+      shift(96);                    // 'context'
+      break;
+    case 97:                        // 'continue'
+      shift(97);                    // 'continue'
+      break;
+    case 99:                        // 'copy-namespaces'
+      shift(99);                    // 'copy-namespaces'
+      break;
+    case 101:                       // 'decimal-format'
+      shift(101);                   // 'decimal-format'
+      break;
+    case 120:                       // 'encoding'
+      shift(120);                   // 'encoding'
+      break;
+    case 127:                       // 'exit'
+      shift(127);                   // 'exit'
+      break;
+    case 128:                       // 'external'
+      shift(128);                   // 'external'
+      break;
+    case 136:                       // 'ft-option'
+      shift(136);                   // 'ft-option'
+      break;
+    case 149:                       // 'in'
+      shift(149);                   // 'in'
+      break;
+    case 150:                       // 'index'
+      shift(150);                   // 'index'
+      break;
+    case 156:                       // 'integrity'
+      shift(156);                   // 'integrity'
+      break;
+    case 166:                       // 'lax'
+      shift(166);                   // 'lax'
+      break;
+    case 187:                       // 'nodes'
+      shift(187);                   // 'nodes'
+      break;
+    case 194:                       // 'option'
+      shift(194);                   // 'option'
+      break;
+    case 198:                       // 'ordering'
+      shift(198);                   // 'ordering'
+      break;
+    case 217:                       // 'revalidation'
+      shift(217);                   // 'revalidation'
+      break;
+    case 220:                       // 'schema'
+      shift(220);                   // 'schema'
+      break;
+    case 223:                       // 'score'
+      shift(223);                   // 'score'
+      break;
+    case 229:                       // 'sliding'
+      shift(229);                   // 'sliding'
+      break;
+    case 235:                       // 'strict'
+      shift(235);                   // 'strict'
+      break;
+    case 246:                       // 'tumbling'
+      shift(246);                   // 'tumbling'
+      break;
+    case 247:                       // 'type'
+      shift(247);                   // 'type'
+      break;
+    case 252:                       // 'updating'
+      shift(252);                   // 'updating'
+      break;
+    case 256:                       // 'value'
+      shift(256);                   // 'value'
+      break;
+    case 257:                       // 'variable'
+      shift(257);                   // 'variable'
+      break;
+    case 258:                       // 'version'
+      shift(258);                   // 'version'
+      break;
+    case 262:                       // 'while'
+      shift(262);                   // 'while'
+      break;
+    case 92:                        // 'constraint'
+      shift(92);                    // 'constraint'
+      break;
+    case 171:                       // 'loop'
+      shift(171);                   // 'loop'
+      break;
+    default:
+      shift(216);                   // 'returning'
+    }
+    eventHandler.endNonterminal("FunctionName", e0);
+  }
+
+  function parse_NCName()
+  {
+    eventHandler.startNonterminal("NCName", e0);
+    switch (l1)
+    {
+    case 26:                        // NCName^Token
+      shift(26);                    // NCName^Token
+      break;
+    case 65:                        // 'after'
+      shift(65);                    // 'after'
+      break;
+    case 70:                        // 'and'
+      shift(70);                    // 'and'
+      break;
+    case 74:                        // 'as'
+      shift(74);                    // 'as'
+      break;
+    case 75:                        // 'ascending'
+      shift(75);                    // 'ascending'
+      break;
+    case 79:                        // 'before'
+      shift(79);                    // 'before'
+      break;
+    case 83:                        // 'case'
+      shift(83);                    // 'case'
+      break;
+    case 84:                        // 'cast'
+      shift(84);                    // 'cast'
+      break;
+    case 85:                        // 'castable'
+      shift(85);                    // 'castable'
+      break;
+    case 89:                        // 'collation'
+      shift(89);                    // 'collation'
+      break;
+    case 100:                       // 'count'
+      shift(100);                   // 'count'
+      break;
+    case 104:                       // 'default'
+      shift(104);                   // 'default'
+      break;
+    case 108:                       // 'descending'
+      shift(108);                   // 'descending'
+      break;
+    case 113:                       // 'div'
+      shift(113);                   // 'div'
+      break;
+    case 117:                       // 'else'
+      shift(117);                   // 'else'
+      break;
+    case 118:                       // 'empty'
+      shift(118);                   // 'empty'
+      break;
+    case 121:                       // 'end'
+      shift(121);                   // 'end'
+      break;
+    case 123:                       // 'eq'
+      shift(123);                   // 'eq'
+      break;
+    case 126:                       // 'except'
+      shift(126);                   // 'except'
+      break;
+    case 132:                       // 'for'
+      shift(132);                   // 'for'
+      break;
+    case 141:                       // 'ge'
+      shift(141);                   // 'ge'
+      break;
+    case 143:                       // 'group'
+      shift(143);                   // 'group'
+      break;
+    case 145:                       // 'gt'
+      shift(145);                   // 'gt'
+      break;
+    case 146:                       // 'idiv'
+      shift(146);                   // 'idiv'
+      break;
+    case 155:                       // 'instance'
+      shift(155);                   // 'instance'
+      break;
+    case 157:                       // 'intersect'
+      shift(157);                   // 'intersect'
+      break;
+    case 158:                       // 'into'
+      shift(158);                   // 'into'
+      break;
+    case 159:                       // 'is'
+      shift(159);                   // 'is'
+      break;
+    case 167:                       // 'le'
+      shift(167);                   // 'le'
+      break;
+    case 169:                       // 'let'
+      shift(169);                   // 'let'
+      break;
+    case 173:                       // 'lt'
+      shift(173);                   // 'lt'
+      break;
+    case 175:                       // 'mod'
+      shift(175);                   // 'mod'
+      break;
+    case 176:                       // 'modify'
+      shift(176);                   // 'modify'
+      break;
+    case 181:                       // 'ne'
+      shift(181);                   // 'ne'
+      break;
+    case 193:                       // 'only'
+      shift(193);                   // 'only'
+      break;
+    case 195:                       // 'or'
+      shift(195);                   // 'or'
+      break;
+    case 196:                       // 'order'
+      shift(196);                   // 'order'
+      break;
+    case 215:                       // 'return'
+      shift(215);                   // 'return'
+      break;
+    case 219:                       // 'satisfies'
+      shift(219);                   // 'satisfies'
+      break;
+    case 231:                       // 'stable'
+      shift(231);                   // 'stable'
+      break;
+    case 232:                       // 'start'
+      shift(232);                   // 'start'
+      break;
+    case 243:                       // 'to'
+      shift(243);                   // 'to'
+      break;
+    case 244:                       // 'treat'
+      shift(244);                   // 'treat'
+      break;
+    case 249:                       // 'union'
+      shift(249);                   // 'union'
+      break;
+    case 261:                       // 'where'
+      shift(261);                   // 'where'
+      break;
+    case 265:                       // 'with'
+      shift(265);                   // 'with'
+      break;
+    case 68:                        // 'ancestor'
+      shift(68);                    // 'ancestor'
+      break;
+    case 69:                        // 'ancestor-or-self'
+      shift(69);                    // 'ancestor-or-self'
+      break;
+    case 77:                        // 'attribute'
+      shift(77);                    // 'attribute'
+      break;
+    case 88:                        // 'child'
+      shift(88);                    // 'child'
+      break;
+    case 91:                        // 'comment'
+      shift(91);                    // 'comment'
+      break;
+    case 98:                        // 'copy'
+      shift(98);                    // 'copy'
+      break;
+    case 103:                       // 'declare'
+      shift(103);                   // 'declare'
+      break;
+    case 105:                       // 'delete'
+      shift(105);                   // 'delete'
+      break;
+    case 106:                       // 'descendant'
+      shift(106);                   // 'descendant'
+      break;
+    case 107:                       // 'descendant-or-self'
+      shift(107);                   // 'descendant-or-self'
+      break;
+    case 114:                       // 'document'
+      shift(114);                   // 'document'
+      break;
+    case 115:                       // 'document-node'
+      shift(115);                   // 'document-node'
+      break;
+    case 116:                       // 'element'
+      shift(116);                   // 'element'
+      break;
+    case 119:                       // 'empty-sequence'
+      shift(119);                   // 'empty-sequence'
+      break;
+    case 124:                       // 'every'
+      shift(124);                   // 'every'
+      break;
+    case 129:                       // 'first'
+      shift(129);                   // 'first'
+      break;
+    case 130:                       // 'following'
+      shift(130);                   // 'following'
+      break;
+    case 131:                       // 'following-sibling'
+      shift(131);                   // 'following-sibling'
+      break;
+    case 140:                       // 'function'
+      shift(140);                   // 'function'
+      break;
+    case 147:                       // 'if'
+      shift(147);                   // 'if'
+      break;
+    case 148:                       // 'import'
+      shift(148);                   // 'import'
+      break;
+    case 154:                       // 'insert'
+      shift(154);                   // 'insert'
+      break;
+    case 160:                       // 'item'
+      shift(160);                   // 'item'
+      break;
+    case 165:                       // 'last'
+      shift(165);                   // 'last'
+      break;
+    case 177:                       // 'module'
+      shift(177);                   // 'module'
+      break;
+    case 179:                       // 'namespace'
+      shift(179);                   // 'namespace'
+      break;
+    case 180:                       // 'namespace-node'
+      shift(180);                   // 'namespace-node'
+      break;
+    case 186:                       // 'node'
+      shift(186);                   // 'node'
+      break;
+    case 197:                       // 'ordered'
+      shift(197);                   // 'ordered'
+      break;
+    case 201:                       // 'parent'
+      shift(201);                   // 'parent'
+      break;
+    case 207:                       // 'preceding'
+      shift(207);                   // 'preceding'
+      break;
+    case 208:                       // 'preceding-sibling'
+      shift(208);                   // 'preceding-sibling'
+      break;
+    case 211:                       // 'processing-instruction'
+      shift(211);                   // 'processing-instruction'
+      break;
+    case 213:                       // 'rename'
+      shift(213);                   // 'rename'
+      break;
+    case 214:                       // 'replace'
+      shift(214);                   // 'replace'
+      break;
+    case 221:                       // 'schema-attribute'
+      shift(221);                   // 'schema-attribute'
+      break;
+    case 222:                       // 'schema-element'
+      shift(222);                   // 'schema-element'
+      break;
+    case 224:                       // 'self'
+      shift(224);                   // 'self'
+      break;
+    case 230:                       // 'some'
+      shift(230);                   // 'some'
+      break;
+    case 238:                       // 'switch'
+      shift(238);                   // 'switch'
+      break;
+    case 239:                       // 'text'
+      shift(239);                   // 'text'
+      break;
+    case 245:                       // 'try'
+      shift(245);                   // 'try'
+      break;
+    case 248:                       // 'typeswitch'
+      shift(248);                   // 'typeswitch'
+      break;
+    case 251:                       // 'unordered'
+      shift(251);                   // 'unordered'
+      break;
+    case 255:                       // 'validate'
+      shift(255);                   // 'validate'
+      break;
+    case 257:                       // 'variable'
+      shift(257);                   // 'variable'
+      break;
+    case 269:                       // 'xquery'
+      shift(269);                   // 'xquery'
+      break;
+    case 67:                        // 'allowing'
+      shift(67);                    // 'allowing'
+      break;
+    case 76:                        // 'at'
+      shift(76);                    // 'at'
+      break;
+    case 78:                        // 'base-uri'
+      shift(78);                    // 'base-uri'
+      break;
+    case 80:                        // 'boundary-space'
+      shift(80);                    // 'boundary-space'
+      break;
+    case 81:                        // 'break'
+      shift(81);                    // 'break'
+      break;
+    case 86:                        // 'catch'
+      shift(86);                    // 'catch'
+      break;
+    case 93:                        // 'construction'
+      shift(93);                    // 'construction'
+      break;
+    case 96:                        // 'context'
+      shift(96);                    // 'context'
+      break;
+    case 97:                        // 'continue'
+      shift(97);                    // 'continue'
+      break;
+    case 99:                        // 'copy-namespaces'
+      shift(99);                    // 'copy-namespaces'
+      break;
+    case 101:                       // 'decimal-format'
+      shift(101);                   // 'decimal-format'
+      break;
+    case 120:                       // 'encoding'
+      shift(120);                   // 'encoding'
+      break;
+    case 127:                       // 'exit'
+      shift(127);                   // 'exit'
+      break;
+    case 128:                       // 'external'
+      shift(128);                   // 'external'
+      break;
+    case 136:                       // 'ft-option'
+      shift(136);                   // 'ft-option'
+      break;
+    case 149:                       // 'in'
+      shift(149);                   // 'in'
+      break;
+    case 150:                       // 'index'
+      shift(150);                   // 'index'
+      break;
+    case 156:                       // 'integrity'
+      shift(156);                   // 'integrity'
+      break;
+    case 166:                       // 'lax'
+      shift(166);                   // 'lax'
+      break;
+    case 187:                       // 'nodes'
+      shift(187);                   // 'nodes'
+      break;
+    case 194:                       // 'option'
+      shift(194);                   // 'option'
+      break;
+    case 198:                       // 'ordering'
+      shift(198);                   // 'ordering'
+      break;
+    case 217:                       // 'revalidation'
+      shift(217);                   // 'revalidation'
+      break;
+    case 220:                       // 'schema'
+      shift(220);                   // 'schema'
+      break;
+    case 223:                       // 'score'
+      shift(223);                   // 'score'
+      break;
+    case 229:                       // 'sliding'
+      shift(229);                   // 'sliding'
+      break;
+    case 235:                       // 'strict'
+      shift(235);                   // 'strict'
+      break;
+    case 246:                       // 'tumbling'
+      shift(246);                   // 'tumbling'
+      break;
+    case 247:                       // 'type'
+      shift(247);                   // 'type'
+      break;
+    case 252:                       // 'updating'
+      shift(252);                   // 'updating'
+      break;
+    case 256:                       // 'value'
+      shift(256);                   // 'value'
+      break;
+    case 258:                       // 'version'
+      shift(258);                   // 'version'
+      break;
+    case 262:                       // 'while'
+      shift(262);                   // 'while'
+      break;
+    case 92:                        // 'constraint'
+      shift(92);                    // 'constraint'
+      break;
+    case 171:                       // 'loop'
+      shift(171);                   // 'loop'
+      break;
+    default:
+      shift(216);                   // 'returning'
+    }
+    eventHandler.endNonterminal("NCName", e0);
+  }
+
+  function shift(t)
+  {
+    if (l1 == t)
+    {
+      whitespace();
+      eventHandler.terminal(JSONiqTokenizer.TOKEN[l1], b1, e1 > size ? size : e1);
+      b0 = b1; e0 = e1; l1 = 0;
+    }
+    else
+    {
+      error(b1, e1, 0, l1, t);
+    }
+  }
+
+  function whitespace()
+  {
+    if (e0 != b1)
+    {
+      b0 = e0;
+      e0 = b1;
+      eventHandler.whitespace(b0, e0);
+    }
+  }
+
+  function matchW(set)
+  {
+    var code;
+    for (;;)
+    {
+      code = match(set);
+      if (code != 28)               // S^WS
+      {
+        break;
+      }
+    }
+    return code;
+  }
+
+  function lookahead1W(set)
+  {
+    if (l1 == 0)
+    {
+      l1 = matchW(set);
+      b1 = begin;
+      e1 = end;
+    }
+  }
+
+  function lookahead1(set)
+  {
+    if (l1 == 0)
+    {
+      l1 = match(set);
+      b1 = begin;
+      e1 = end;
+    }
+  }
+
+  function error(b, e, s, l, t)
+  {
+    throw new self.ParseException(b, e, s, l, t);
+  }
+
+  var lk, b0, e0;
+  var l1, b1, e1;
+  var eventHandler;
+
+  var input;
+  var size;
+  var begin;
+  var end;
+
+  function match(tokenSetId)
+  {
+    var nonbmp = false;
+    begin = end;
+    var current = end;
+    var result = JSONiqTokenizer.INITIAL[tokenSetId];
+    var state = 0;
+
+    for (var code = result & 4095; code != 0; )
+    {
+      var charclass;
+      var c0 = current < size ? input.charCodeAt(current) : 0;
+      ++current;
+      if (c0 < 0x80)
+      {
+        charclass = JSONiqTokenizer.MAP0[c0];
+      }
+      else if (c0 < 0xd800)
+      {
+        var c1 = c0 >> 4;
+        charclass = JSONiqTokenizer.MAP1[(c0 & 15) + JSONiqTokenizer.MAP1[(c1 & 31) + JSONiqTokenizer.MAP1[c1 >> 5]]];
+      }
+      else
+      {
+        if (c0 < 0xdc00)
+        {
+          var c1 = current < size ? input.charCodeAt(current) : 0;
+          if (c1 >= 0xdc00 && c1 < 0xe000)
+          {
+            ++current;
+            c0 = ((c0 & 0x3ff) << 10) + (c1 & 0x3ff) + 0x10000;
+            nonbmp = true;
+          }
+        }
+        var lo = 0, hi = 5;
+        for (var m = 3; ; m = (hi + lo) >> 1)
+        {
+          if (JSONiqTokenizer.MAP2[m] > c0) hi = m - 1;
+          else if (JSONiqTokenizer.MAP2[6 + m] < c0) lo = m + 1;
+          else {charclass = JSONiqTokenizer.MAP2[12 + m]; break;}
+          if (lo > hi) {charclass = 0; break;}
+        }
+      }
+
+      state = code;
+      var i0 = (charclass << 12) + code - 1;
+      code = JSONiqTokenizer.TRANSITION[(i0 & 15) + JSONiqTokenizer.TRANSITION[i0 >> 4]];
+
+      if (code > 4095)
+      {
+        result = code;
+        code &= 4095;
+        end = current;
+      }
+    }
+
+    result >>= 12;
+    if (result == 0)
+    {
+      end = current - 1;
+      var c1 = end < size ? input.charCodeAt(end) : 0;
+      if (c1 >= 0xdc00 && c1 < 0xe000) --end;
+      return error(begin, end, state, -1, -1);
+    }
+
+    if (nonbmp)
+    {
+      for (var i = result >> 9; i > 0; --i)
+      {
+        --end;
+        var c1 = end < size ? input.charCodeAt(end) : 0;
+        if (c1 >= 0xdc00 && c1 < 0xe000) --end;
+      }
+    }
+    else
+    {
+      end -= result >> 9;
+    }
+
+    return (result & 511) - 1;
+  }
+}
+
+JSONiqTokenizer.getTokenSet = function(tokenSetId)
+{
+  var set = [];
+  var s = tokenSetId < 0 ? - tokenSetId : INITIAL[tokenSetId] & 4095;
+  for (var i = 0; i < 276; i += 32)
+  {
+    var j = i;
+    var i0 = (i >> 5) * 2062 + s - 1;
+    var i1 = i0 >> 2;
+    var i2 = i1 >> 2;
+    var f = JSONiqTokenizer.EXPECTED[(i0 & 3) + JSONiqTokenizer.EXPECTED[(i1 & 3) + JSONiqTokenizer.EXPECTED[(i2 & 3) + JSONiqTokenizer.EXPECTED[i2 >> 2]]]];
+    for ( ; f != 0; f >>>= 1, ++j)
+    {
+      if ((f & 1) != 0)
+      {
+        set.push(JSONiqTokenizer.TOKEN[j]);
+      }
+    }
+  }
+  return set;
+};
+
+JSONiqTokenizer.MAP0 =
+[
+  /*   0 */ 66, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5,
+  /*  36 */ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 20, 21, 22, 23, 24,
+  /*  64 */ 25, 26, 27, 28, 29, 30, 27, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 32, 31, 31, 33, 31, 31, 31, 31, 31, 31,
+  /*  91 */ 34, 35, 36, 35, 31, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 31, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+  /* 118 */ 57, 58, 59, 60, 31, 61, 62, 63, 64, 35
+];
+
+JSONiqTokenizer.MAP1 =
+[
+  /*   0 */ 108, 124, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 156, 181, 181, 181, 181,
+  /*  21 */ 181, 214, 215, 213, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214,
+  /*  42 */ 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214,
+  /*  63 */ 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214,
+  /*  84 */ 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, 214,
+  /* 105 */ 214, 214, 214, 247, 261, 277, 293, 309, 347, 363, 379, 416, 416, 416, 408, 331, 323, 331, 323, 331, 331,
+  /* 126 */ 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 433, 433, 433, 433, 433, 433, 433,
+  /* 147 */ 316, 331, 331, 331, 331, 331, 331, 331, 331, 394, 416, 416, 417, 415, 416, 416, 331, 331, 331, 331, 331,
+  /* 168 */ 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 416, 416, 416, 416, 416, 416, 416, 416,
+  /* 189 */ 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416, 416,
+  /* 210 */ 416, 416, 416, 330, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
+  /* 231 */ 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 331, 416, 66, 0, 0, 0, 0, 0, 0, 0, 0,
+  /* 256 */ 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+  /* 290 */ 15, 16, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 27, 31,
+  /* 317 */ 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 35, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
+  /* 344 */ 31, 31, 31, 31, 32, 31, 31, 33, 31, 31, 31, 31, 31, 31, 34, 35, 36, 35, 31, 35, 37, 38, 39, 40, 41, 42, 43,
+  /* 371 */ 44, 45, 31, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 31, 61, 62, 63, 64, 35, 35, 35, 35,
+  /* 398 */ 35, 35, 35, 35, 35, 35, 35, 35, 31, 31, 35, 35, 35, 35, 35, 35, 35, 65, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+  /* 425 */ 35, 35, 35, 35, 35, 35, 35, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, 65
+];
+
+JSONiqTokenizer.MAP2 =
+[
+  /*  0 */ 57344, 63744, 64976, 65008, 65536, 983040, 63743, 64975, 65007, 65533, 983039, 1114111, 35, 31, 35, 31, 31,
+  /* 17 */ 35
+];
+
+JSONiqTokenizer.INITIAL =
+[
+  /*  0 */ 1, 2, 36867, 45060, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
+];
+
+JSONiqTokenizer.TRANSITION =
+[
+  /*     0 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*    15 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*    30 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*    45 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*    60 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*    75 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*    90 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   105 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   120 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   135 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   150 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   165 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   180 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   195 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   210 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   225 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   240 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   255 */ 17590, 22874, 18847, 17152, 19027, 19252, 17687, 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189,
+  /*   270 */ 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 17365, 21855, 18660, 18676, 19025, 17265, 22008,
+  /*   285 */ 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 17470, 17497, 17520, 17251,
+  /*   300 */ 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 18199, 21915,
+  /*   315 */ 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530,
+  /*   330 */ 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 17890, 17922, 18742, 17960, 36550,
+  /*   345 */ 17714, 17976, 18021, 18738, 18065, 36544, 18632, 18081, 18098, 18114, 18159, 18185, 18215, 18094, 18251,
+  /*   360 */ 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858,
+  /*   375 */ 32918, 17756, 18816, 18429, 18445, 18143, 17393, 18500, 18516, 18546, 17590, 17590, 17590, 17590, 17590,
+  /*   390 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   405 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   420 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   435 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   450 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   465 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   480 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   495 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   510 */ 17590, 17590, 18590, 21686, 17152, 19027, 19252, 17687, 19027, 28677, 30771, 36436, 17330, 17349, 18940,
+  /*   525 */ 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 17365, 21855, 18660, 18676, 19025, 17265,
+  /*   540 */ 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 17470, 17497, 17520,
+  /*   555 */ 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 18199,
+  /*   570 */ 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265,
+  /*   585 */ 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 17890, 17922, 18742, 17960,
+  /*   600 */ 36550, 17714, 17976, 18021, 18738, 18065, 36544, 18632, 18081, 18098, 18114, 18159, 18185, 18215, 18094,
+  /*   615 */ 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400,
+  /*   630 */ 17858, 32918, 17756, 18816, 18429, 18445, 18143, 17393, 18500, 18516, 18546, 17590, 17590, 17590, 17590,
+  /*   645 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   660 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   675 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   690 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   705 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   720 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   735 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   750 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   765 */ 17590, 17590, 17590, 20083, 18847, 18648, 19027, 19252, 21242, 19027, 17173, 30771, 36436, 17330, 17349,
+  /*   780 */ 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025,
+  /*   795 */ 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497,
+  /*   810 */ 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417,
+  /*   825 */ 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472,
+  /*   840 */ 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742,
+  /*   855 */ 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185, 18717,
+  /*   870 */ 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163, 30650,
+  /*   885 */ 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590, 17590,
+  /*   900 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   915 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   930 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   945 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   960 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   975 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*   990 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1005 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1020 */ 17590, 17590, 17590, 17590, 18774, 18789, 18805, 19027, 19252, 17687, 19027, 17173, 30771, 36436, 17330,
+  /*  1035 */ 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855, 18660, 18676,
+  /*  1050 */ 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027, 17447, 32909,
+  /*  1065 */ 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504, 17527, 17258,
+  /*  1080 */ 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921, 17617,
+  /*  1095 */ 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175, 17906,
+  /*  1110 */ 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159, 18185,
+  /*  1125 */ 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838, 17163,
+  /*  1140 */ 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590, 17590,
+  /*  1155 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1170 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1185 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1200 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1215 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1230 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1245 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1260 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1275 */ 17590, 17590, 17590, 17590, 17590, 18832, 22889, 18925, 19027, 19252, 17569, 19027, 17173, 30771, 36436,
+  /*  1290 */ 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18956, 21855, 18660,
+  /*  1305 */ 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 19073, 17311, 18669, 19018, 19027, 17447,
+  /*  1320 */ 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 18972, 21862, 17504, 17527,
+  /*  1335 */ 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538, 21921,
+  /*  1350 */ 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481, 19175,
+  /*  1365 */ 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114, 18159,
+  /*  1380 */ 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251, 17838,
+  /*  1395 */ 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546, 17590,
+  /*  1410 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1425 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1440 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1455 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1470 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1485 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1500 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1515 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1530 */ 17590, 17590, 17590, 17590, 17590, 17590, 21818, 18847, 19006, 19027, 19252, 17687, 19027, 17173, 30771,
+  /*  1545 */ 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460, 21855,
+  /*  1560 */ 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018, 19027,
+  /*  1575 */ 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862, 17504,
+  /*  1590 */ 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772, 33538,
+  /*  1605 */ 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595, 17481,
+  /*  1620 */ 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098, 18114,
+  /*  1635 */ 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402, 19251,
+  /*  1650 */ 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516, 18546,
+  /*  1665 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1680 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1695 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1710 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1725 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1740 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1755 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1770 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1785 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21671, 18847, 19006, 19027, 19252, 17687, 19027, 17173,
+  /*  1800 */ 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346, 18937, 18460,
+  /*  1815 */ 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311, 18669, 19018,
+  /*  1830 */ 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585, 21862,
+  /*  1845 */ 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730, 17772,
+  /*  1860 */ 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590, 21595,
+  /*  1875 */ 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081, 18098,
+  /*  1890 */ 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849, 36402,
+  /*  1905 */ 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758, 18516,
+  /*  1920 */ 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1935 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1950 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1965 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1980 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  1995 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2010 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2025 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2040 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 22395, 20098, 18731, 19027, 19252, 17687, 19027,
+  /*  2055 */ 17173, 23525, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 18129, 17308, 17327, 17346, 18937,
+  /*  2070 */ 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 20746, 19130, 17311, 18669,
+  /*  2085 */ 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559, 17585,
+  /*  2100 */ 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703, 17730,
+  /*  2115 */ 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874, 17590,
+  /*  2130 */ 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632, 18081,
+  /*  2145 */ 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384, 17849,
+  /*  2160 */ 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393, 18758,
+  /*  2175 */ 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2190 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2205 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2220 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2235 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2250 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2265 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2280 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2295 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 19043, 18847, 18620, 19027, 19252, 17687,
+  /*  2310 */ 19027, 17173, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327, 17346,
+  /*  2325 */ 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848, 17311,
+  /*  2340 */ 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543, 17559,
+  /*  2355 */ 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368, 17703,
+  /*  2370 */ 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795, 17874,
+  /*  2385 */ 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413, 18632,
+  /*  2400 */ 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354, 18384,
+  /*  2415 */ 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530, 17393,
+  /*  2430 */ 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2445 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2460 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2475 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2490 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2505 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2520 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2535 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2550 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 19100, 22410, 19006, 19027, 19252,
+  /*  2565 */ 17687, 19027, 19084, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308, 17327,
+  /*  2580 */ 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217, 21848,
+  /*  2595 */ 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490, 17543,
+  /*  2610 */ 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661, 18368,
+  /*  2625 */ 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744, 17795,
+  /*  2640 */ 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 18738, 18692, 18413,
+  /*  2655 */ 18632, 18081, 18098, 18114, 18159, 18185, 18717, 18094, 18251, 18292, 18281, 18308, 18005, 18338, 18354,
+  /*  2670 */ 18384, 17849, 36402, 19251, 17838, 17163, 30650, 18400, 17858, 32918, 17645, 18816, 18429, 18445, 18530,
+  /*  2685 */ 17393, 18758, 18516, 18546, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2700 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2715 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2730 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2745 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2760 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2775 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2790 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590,
+  /*  2805 */ 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 17590, 21967, 21982, 19006, 19027,
+  /*  2820 */ 19252, 17687, 19027, 18701, 30771, 36436, 17330, 17349, 18940, 17189, 17208, 17281, 17675, 17991, 17308,
+  /*  2835 */ 17327, 17346, 18937, 18460, 21855, 18660, 18676, 19025, 17265, 22008, 17292, 17421, 21157, 17192, 21217,
+  /*  2850 */ 21848, 17311, 18669, 19018, 19027, 17447, 32909, 17497, 17520, 17251, 36410, 17824, 20322, 20663, 20490,
+  /*  2865 */ 17543, 17559, 17585, 21862, 17504, 17527, 17258, 36417, 21890, 21915, 17611, 36466, 18259, 17633, 17661,
+  /*  2880 */ 18368, 17703, 17730, 17772, 33538, 21921, 17617, 36472, 18265, 36530, 17477, 19171, 17902, 17934, 17744,
+  /*  2895 */ 17795, 17874, 17590, 21595, 17481, 19175, 17906, 18742, 17960, 36550, 17714, 17976, 18021, 1873

<TRUNCATED>

[20/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/diff.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/diff.js b/src/fauxton/assets/js/libs/ace/mode/folding/diff.js
new file mode 100644
index 0000000..23c0e2d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/diff.js
@@ -0,0 +1,69 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var BaseFoldMode = require("./fold_mode").FoldMode;
+var Range = require("../../range").Range;
+
+var FoldMode = exports.FoldMode = function(levels, flag) {
+	this.regExpList = levels;
+	this.flag = flag;
+	this.foldingStartMarker = RegExp("^(" + levels.join("|") + ")", this.flag);
+};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
+        var line = session.getLine(row);
+        var start = {row: row, column: line.length};
+
+        var regList = this.regExpList;
+        for (var i = 1; i <= regList.length; i++) {
+            var re = RegExp("^(" + regList.slice(0, i).join("|") + ")", this.flag);
+            if (re.test(line))
+                break;
+        }
+
+        for (var l = session.getLength(); ++row < l; ) {
+            line = session.getLine(row);
+            if (re.test(line))
+                break;
+        }
+        if (row == start.row + 1)
+            return;
+        return  Range.fromPoints(start, {row: row - 1, column: line.length});
+    };
+
+}).call(FoldMode.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/fold_mode.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/fold_mode.js b/src/fauxton/assets/js/libs/ace/mode/folding/fold_mode.js
new file mode 100644
index 0000000..9272cdc
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/fold_mode.js
@@ -0,0 +1,120 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var Range = require("../../range").Range;
+
+var FoldMode = exports.FoldMode = function() {};
+
+(function() {
+
+    this.foldingStartMarker = null;
+    this.foldingStopMarker = null;
+
+    // must return "" if there's no fold, to enable caching
+    this.getFoldWidget = function(session, foldStyle, row) {
+        var line = session.getLine(row);
+        if (this.foldingStartMarker.test(line))
+            return "start";
+        if (foldStyle == "markbeginend"
+                && this.foldingStopMarker
+                && this.foldingStopMarker.test(line))
+            return "end";
+        return "";
+    };
+
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
+        return null;
+    };
+
+    this.indentationBlock = function(session, row, column) {
+        var re = /\S/;
+        var line = session.getLine(row);
+        var startLevel = line.search(re);
+        if (startLevel == -1)
+            return;
+
+        var startColumn = column || line.length;
+        var maxRow = session.getLength();
+        var startRow = row;
+        var endRow = row;
+
+        while (++row < maxRow) {
+            var level = session.getLine(row).search(re);
+
+            if (level == -1)
+                continue;
+
+            if (level <= startLevel)
+                break;
+
+            endRow = row;
+        }
+
+        if (endRow > startRow) {
+            var endColumn = session.getLine(endRow).length;
+            return new Range(startRow, startColumn, endRow, endColumn);
+        }
+    };
+
+    this.openingBracketBlock = function(session, bracket, row, column, typeRe) {
+        var start = {row: row, column: column + 1};
+        var end = session.$findClosingBracket(bracket, start, typeRe);
+        if (!end)
+            return;
+
+        var fw = session.foldWidgets[end.row];
+        if (fw == null)
+            fw = this.getFoldWidget(session, end.row);
+
+        if (fw == "start" && end.row > start.row) {
+            end.row --;
+            end.column = session.getLine(end.row).length;
+        }
+        return Range.fromPoints(start, end);
+    };
+
+    this.closingBracketBlock = function(session, bracket, row, column, typeRe) {
+        var end = {row: row, column: column};
+        var start = session.$findOpeningBracket(bracket, end);
+
+        if (!start)
+            return;
+
+        start.column++;
+        end.column--;
+
+        return  Range.fromPoints(start, end);
+    };
+}).call(FoldMode.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/html.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/html.js b/src/fauxton/assets/js/libs/ace/mode/folding/html.js
new file mode 100644
index 0000000..fbfa1e9
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/html.js
@@ -0,0 +1,79 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var MixedFoldMode = require("./mixed").FoldMode;
+var XmlFoldMode = require("./xml").FoldMode;
+var CStyleFoldMode = require("./cstyle").FoldMode;
+
+var FoldMode = exports.FoldMode = function() {
+    MixedFoldMode.call(this, new XmlFoldMode({
+        // void elements
+        "area": 1,
+        "base": 1,
+        "br": 1,
+        "col": 1,
+        "command": 1,
+        "embed": 1,
+        "hr": 1,
+        "img": 1,
+        "input": 1,
+        "keygen": 1,
+        "link": 1,
+        "meta": 1,
+        "param": 1,
+        "source": 1,
+        "track": 1,
+        "wbr": 1,
+        
+        // optional tags 
+        "li": 1,
+        "dt": 1,
+        "dd": 1,
+        "p": 1,
+        "rt": 1,
+        "rp": 1,
+        "optgroup": 1,
+        "option": 1,
+        "colgroup": 1,
+        "td": 1,
+        "th": 1
+    }), {
+        "js-": new CStyleFoldMode(),
+        "css-": new CStyleFoldMode()
+    });
+};
+
+oop.inherits(FoldMode, MixedFoldMode);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/html_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/html_test.js b/src/fauxton/assets/js/libs/ace/mode/folding/html_test.js
new file mode 100644
index 0000000..3e42cfe
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/html_test.js
@@ -0,0 +1,162 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined")
+    require("amd-loader");
+
+define(function(require, exports, module) {
+"use strict";
+
+var HtmlMode = require("../html").Mode;
+var EditSession = require("../../edit_session").EditSession;
+var assert = require("../../test/assertions");
+
+module.exports = {
+
+    "test: fold mixed html and javascript": function() {
+        var session = new EditSession([
+            '<script type="text/javascript"> ',
+            'function() foo {',
+            '    var bar = 1;',
+            '}',
+            '</script>'
+        ]);
+        
+        var mode = new HtmlMode();
+        session.setMode(mode);
+        session.setFoldStyle("markbeginend");
+        
+        assert.equal(session.getFoldWidget(0), "start");
+        assert.equal(session.getFoldWidget(1), "start");
+        assert.equal(session.getFoldWidget(2), "");
+        assert.equal(session.getFoldWidget(3), "end");
+        assert.equal(session.getFoldWidget(4), "end");
+        
+        assert.range(session.getFoldWidgetRange(0), 0, 8, 4, 0);
+        assert.range(session.getFoldWidgetRange(4), 0, 8, 4, 0);
+        
+        assert.range(session.getFoldWidgetRange(1), 1, 16, 3, 0);
+        assert.range(session.getFoldWidgetRange(3), 1, 16, 3, 0);
+    },
+    
+    "test: fold mixed html and css": function() {
+        var session = new EditSession([
+            '<style type="text/css">',
+            '    .text-layer {',
+            '        font-family: Monaco, "Courier New", monospace;',
+            '    }',
+            '</style>'
+        ]);
+        
+        var mode = new HtmlMode();
+        session.setMode(mode);
+        session.setFoldStyle("markbeginend");
+        
+        assert.equal(session.getFoldWidget(0), "start");
+        assert.equal(session.getFoldWidget(1), "start");
+        assert.equal(session.getFoldWidget(2), "");
+        assert.equal(session.getFoldWidget(3), "end");
+        assert.equal(session.getFoldWidget(4), "end");
+        
+        assert.range(session.getFoldWidgetRange(0), 0, 7, 4, 0);
+        assert.range(session.getFoldWidgetRange(4), 0, 7, 4, 0);
+        
+        assert.range(session.getFoldWidgetRange(1), 1, 17, 3, 4);
+        assert.range(session.getFoldWidgetRange(3), 1, 17, 3, 4);
+    },
+    
+    "test: fold should skip self closing elements": function() {
+        var session = new EditSession([
+            '<body>',
+            '<br />',
+            '</body>'
+        ]);
+        
+        var mode = new HtmlMode();
+        session.setMode(mode);
+        session.setFoldStyle("markbeginend");
+        
+        assert.equal(session.getFoldWidget(0), "start");
+        assert.equal(session.getFoldWidget(1), "");
+        assert.equal(session.getFoldWidget(2), "end");
+        
+        assert.range(session.getFoldWidgetRange(0), 0, 6, 2, 0);
+        assert.range(session.getFoldWidgetRange(2), 0, 6, 2, 0);
+    },
+    
+    "test: fold should skip void elements": function() {
+        var session = new EditSession([
+            '<body>',
+            '<br>',
+            '</body>'
+        ]);
+        
+        var mode = new HtmlMode();
+        session.setMode(mode);
+        session.setFoldStyle("markbeginend");
+        
+        assert.equal(session.getFoldWidget(0), "start");
+        assert.equal(session.getFoldWidget(1), "");
+        assert.equal(session.getFoldWidget(2), "end");
+        
+        assert.range(session.getFoldWidgetRange(0), 0, 6, 2, 0);
+        assert.range(session.getFoldWidgetRange(2), 0, 6, 2, 0);
+    },
+    
+    "test: fold multiple unclosed elements": function() {
+        var session = new EditSession([
+            '<div>',
+            '<p>',
+            'juhu',
+            '<p>',
+            'kinners',
+            '</div>'
+        ]);
+        
+        var mode = new HtmlMode();
+        session.setMode(mode);
+        session.setFoldStyle("markbeginend");
+        
+        assert.equal(session.getFoldWidget(0), "start");
+        assert.equal(session.getFoldWidget(1), "");
+        assert.equal(session.getFoldWidget(2), "");
+        assert.equal(session.getFoldWidget(3), "");
+        assert.equal(session.getFoldWidget(4), "");
+        assert.equal(session.getFoldWidget(5), "end");
+        
+        assert.range(session.getFoldWidgetRange(0), 0, 5, 5, 0);
+        assert.range(session.getFoldWidgetRange(5), 0, 5, 5, 0);
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main)
+    require("asyncjs").test.testcase(module.exports).exec();

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/ini.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/ini.js b/src/fauxton/assets/js/libs/ace/mode/folding/ini.js
new file mode 100644
index 0000000..ef4eaa0
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/ini.js
@@ -0,0 +1,80 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var Range = require("../../range").Range;
+var BaseFoldMode = require("./fold_mode").FoldMode;
+
+var FoldMode = exports.FoldMode = function() {
+};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+    this.foldingStartMarker = /^\s*\[([^\])]*)]\s*(?:$|[;#])/;
+
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
+        var re = this.foldingStartMarker;
+        var line = session.getLine(row);
+        
+        var m = line.match(re);
+        
+        if (!m) return;
+        
+        var startName = m[1] + ".";
+        
+        var startColumn = line.length;
+        var maxRow = session.getLength();
+        var startRow = row;
+        var endRow = row;
+
+        while (++row < maxRow) {
+            line = session.getLine(row);
+            if (/^\s*$/.test(line))
+                continue;
+            m = line.match(re);
+            if (m && m[1].lastIndexOf(startName, 0) !== 0)
+                break;
+
+            endRow = row;
+        }
+
+        if (endRow > startRow) {
+            var endColumn = session.getLine(endRow).length;
+            return new Range(startRow, startColumn, endRow, endColumn);
+        }
+    };
+
+}).call(FoldMode.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/latex.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/latex.js b/src/fauxton/assets/js/libs/ace/mode/folding/latex.js
new file mode 100644
index 0000000..b80775e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/latex.js
@@ -0,0 +1,162 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var BaseFoldMode = require("./fold_mode").FoldMode;
+var Range = require("../../range").Range;
+var TokenIterator = require("../../token_iterator").TokenIterator;
+
+var FoldMode = exports.FoldMode = function() {};
+
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+    this.foldingStartMarker = /^\s*\\(begin)|(section|subsection)\b|{\s*$/;
+    this.foldingStopMarker = /^\s*\\(end)\b|^\s*}/;
+
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
+        var line = session.doc.getLine(row);
+        var match = this.foldingStartMarker.exec(line);
+        if (match) {
+            if (match[1])
+                return this.latexBlock(session, row, match[0].length - 1);
+            if (match[2])
+                return this.latexSection(session, row, match[0].length - 1);
+
+            return this.openingBracketBlock(session, "{", row, match.index);
+        }
+
+        var match = this.foldingStopMarker.exec(line);
+        if (match) {
+            if (match[1])
+                return this.latexBlock(session, row, match[0].length - 1);
+
+            return this.closingBracketBlock(session, "}", row, match.index + match[0].length);
+        }
+    };
+
+    this.latexBlock = function(session, row, column) {
+        var keywords = {
+            "\\begin": 1,
+            "\\end": -1
+        };
+
+        var stream = new TokenIterator(session, row, column);
+        var token = stream.getCurrentToken();
+        if (!token || token.type !== "keyword")
+            return;
+
+        var val = token.value;
+        var dir = keywords[val];
+
+        var getType = function() {
+            var token = stream.stepForward();
+            var type = token.type == "lparen" ?stream.stepForward().value : "";
+            if (dir === -1) {
+                stream.stepBackward();
+                if (type)
+                    stream.stepBackward();
+            }
+            return type;
+        };
+        var stack = [getType()];
+        var startColumn = dir === -1 ? stream.getCurrentTokenColumn() : session.getLine(row).length;
+        var startRow = row;
+
+        stream.step = dir === -1 ? stream.stepBackward : stream.stepForward;
+        while(token = stream.step()) {
+            if (token.type !== "keyword")
+                continue;
+            var level = keywords[token.value];
+            if (!level)
+                continue;
+            var type = getType();
+            if (level === dir)
+                stack.unshift(type);
+            else if (stack.shift() !== type || !stack.length)
+                break;
+        }
+
+        if (stack.length)
+            return;
+
+        var row = stream.getCurrentTokenRow();
+        if (dir === -1)
+            return new Range(row, session.getLine(row).length, startRow, startColumn);
+        stream.stepBackward();
+        return new Range(startRow, startColumn, row, stream.getCurrentTokenColumn());
+    };
+
+    this.latexSection = function(session, row, column) {
+        var keywords = ["\\subsection", "\\section", "\\begin", "\\end"];
+
+        var stream = new TokenIterator(session, row, column);
+        var token = stream.getCurrentToken();
+        if (!token || token.type != "keyword")
+            return;
+
+        var startLevel = keywords.indexOf(token.value);
+        var stackDepth = 0
+        var endRow = row;
+
+        while(token = stream.stepForward()) {
+            if (token.type !== "keyword")
+                continue;
+            var level = keywords.indexOf(token.value);
+
+            if (level >= 2) {
+                if (!stackDepth)
+                    endRow = stream.getCurrentTokenRow() - 1;
+                stackDepth += level == 2 ? 1 : - 1;
+                if (stackDepth < 0)
+                    break
+            } else if (level >= startLevel)
+                break;
+        }
+
+        if (!stackDepth)
+            endRow = stream.getCurrentTokenRow() - 1;
+
+        while (endRow > row && !/\S/.test(session.getLine(endRow)))
+            endRow--;
+
+        return new Range(
+            row, session.getLine(row).length,
+            endRow, session.getLine(endRow).length
+        );
+    };
+
+}).call(FoldMode.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/lua.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/lua.js b/src/fauxton/assets/js/libs/ace/mode/folding/lua.js
new file mode 100644
index 0000000..f4b5233
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/lua.js
@@ -0,0 +1,163 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var BaseFoldMode = require("./fold_mode").FoldMode;
+var Range = require("../../range").Range;
+var TokenIterator = require("../../token_iterator").TokenIterator;
+
+
+var FoldMode = exports.FoldMode = function() {};
+
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+    this.foldingStartMarker = /\b(function|then|do|repeat)\b|{\s*$|(\[=*\[)/;
+    this.foldingStopMarker = /\bend\b|^\s*}|\]=*\]/;
+
+    this.getFoldWidget = function(session, foldStyle, row) {
+        var line = session.getLine(row);
+        var isStart = this.foldingStartMarker.test(line);
+        var isEnd = this.foldingStopMarker.test(line);
+
+        if (isStart && !isEnd) {
+            var match = line.match(this.foldingStartMarker);
+            if (match[1] == "then" && /\belseif\b/.test(line))
+                return;
+            if (match[1]) {
+                if (session.getTokenAt(row, match.index + 1).type === "keyword")
+                    return "start";
+            } else if (match[2]) {
+                var type = session.bgTokenizer.getState(row) || "";
+                if (type[0] == "bracketedComment" || type[0] == "bracketedString")
+                    return "start";
+            } else {
+                return "start";
+            }
+        }
+        if (foldStyle != "markbeginend" || !isEnd || isStart && isEnd)
+            return "";
+
+        var match = line.match(this.foldingStopMarker);
+        if (match[0] === "end") {
+            if (session.getTokenAt(row, match.index + 1).type === "keyword")
+                return "end";
+        } else if (match[0][0] === "]") {
+            var type = session.bgTokenizer.getState(row - 1) || "";
+            if (type[0] == "bracketedComment" || type[0] == "bracketedString")
+                return "end";
+        } else
+            return "end";
+    };
+
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
+        var line = session.doc.getLine(row);
+        var match = this.foldingStartMarker.exec(line);
+        if (match) {
+            if (match[1])
+                return this.luaBlock(session, row, match.index + 1);
+
+            if (match[2])
+                return session.getCommentFoldRange(row, match.index + 1);
+
+            return this.openingBracketBlock(session, "{", row, match.index);
+        }
+
+        var match = this.foldingStopMarker.exec(line);
+        if (match) {
+            if (match[0] === "end") {
+                if (session.getTokenAt(row, match.index + 1).type === "keyword")
+                    return this.luaBlock(session, row, match.index + 1);
+            }
+
+            if (match[0][0] === "]")
+                return session.getCommentFoldRange(row, match.index + 1);
+
+            return this.closingBracketBlock(session, "}", row, match.index + match[0].length);
+        }
+    };
+
+    this.luaBlock = function(session, row, column) {
+        var stream = new TokenIterator(session, row, column);
+        var indentKeywords = {
+            "function": 1,
+            "do": 1,
+            "then": 1,
+            "elseif": -1,
+            "end": -1,
+            "repeat": 1,
+            "until": -1
+        };
+
+        var token = stream.getCurrentToken();
+        if (!token || token.type != "keyword")
+            return;
+
+        var val = token.value;
+        var stack = [val];
+        var dir = indentKeywords[val];
+
+        if (!dir)
+            return;
+
+        var startColumn = dir === -1 ? stream.getCurrentTokenColumn() : session.getLine(row).length;
+        var startRow = row;
+
+        stream.step = dir === -1 ? stream.stepBackward : stream.stepForward;
+        while(token = stream.step()) {
+            if (token.type !== "keyword")
+                continue;
+            var level = dir * indentKeywords[token.value];
+
+            if (level > 0) {
+                stack.unshift(token.value);
+            } else if (level <= 0) {
+                stack.shift();
+                if (!stack.length && token.value != "elseif")
+                    break;
+                if (level === 0)
+                    stack.unshift(token.value);
+            }
+        }
+
+        var row = stream.getCurrentTokenRow();
+        if (dir === -1)
+            return new Range(row, session.getLine(row).length, startRow, startColumn);
+        else
+            return new Range(startRow, startColumn, row, stream.getCurrentTokenColumn());
+    };
+
+}).call(FoldMode.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/markdown.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/markdown.js b/src/fauxton/assets/js/libs/ace/mode/folding/markdown.js
new file mode 100644
index 0000000..aae7179
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/markdown.js
@@ -0,0 +1,125 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var BaseFoldMode = require("./fold_mode").FoldMode;
+var Range = require("../../range").Range;
+
+var FoldMode = exports.FoldMode = function() {};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+    this.foldingStartMarker = /^(?:[=-]+\s*$|#{1,6} |`{3})/;
+
+    this.getFoldWidget = function(session, foldStyle, row) {
+        var line = session.getLine(row);
+        if (!this.foldingStartMarker.test(line))
+            return "";
+
+        if (line[0] == "`") {
+            if (session.bgTokenizer.getState(row) == "start")
+                return "end";
+            return "start";
+        }
+
+        return "start";
+    };
+
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
+        var line = session.getLine(row);
+        var startColumn = line.length;
+        var maxRow = session.getLength();
+        var startRow = row;
+        var endRow = row;
+        if (!line.match(this.foldingStartMarker))
+            return;
+
+        if (line[0] == "`") {
+            if (session.bgTokenizer.getState(row) !== "start") {
+                while (++row < maxRow) {
+                    line = session.getLine(row);
+                    if (line[0] == "`" & line.substring(0, 3) == "```")
+                        break;
+                }
+                return new Range(startRow, startColumn, row, 0);
+            } else {
+                while (row -- > 0) {
+                    line = session.getLine(row);
+                    if (line[0] == "`" & line.substring(0, 3) == "```")
+                        break;
+                }
+                return new Range(row, line.length, startRow, 0);
+            }
+        }
+
+        var token;
+        function isHeading(row) {
+            token = session.getTokens(row)[0];
+            return token && token.type.lastIndexOf(heading, 0) === 0;
+        }
+
+        var heading = "markup.heading";
+        function getLevel() {
+            var ch = token.value[0];
+            if (ch == "=") return 6;
+            if (ch == "-") return 5;
+            return 7 - token.value.search(/[^#]/);
+        }
+
+        if (isHeading(row)) {
+            var startHeadingLevel = getLevel();
+            while (++row < maxRow) {
+                if (!isHeading(row))
+                    continue;
+                var level = getLevel();
+                if (level >= startHeadingLevel)
+                    break;
+            }
+
+            endRow = row - (!token || ["=", "-"].indexOf(token.value[0]) == -1 ? 1 : 2);
+
+            if (endRow > startRow) {
+                while (endRow > startRow && /^\s*$/.test(session.getLine(endRow)))
+                    endRow--;
+            }
+
+            if (endRow > startRow) {
+                var endColumn = session.getLine(endRow).length;
+                return new Range(startRow, startColumn, endRow, endColumn);
+            }
+        }
+    };
+
+}).call(FoldMode.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/mixed.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/mixed.js b/src/fauxton/assets/js/libs/ace/mode/folding/mixed.js
new file mode 100644
index 0000000..40d2cda
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/mixed.js
@@ -0,0 +1,83 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var BaseFoldMode = require("./fold_mode").FoldMode;
+
+var FoldMode = exports.FoldMode = function(defaultMode, subModes) {
+    this.defaultMode = defaultMode;
+    this.subModes = subModes;
+};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+
+    this.$getMode = function(state) {
+        if (typeof state != "string") 
+            state = state[0];
+        for (var key in this.subModes) {
+            if (state.indexOf(key) === 0)
+                return this.subModes[key];
+        }
+        return null;
+    };
+    
+    this.$tryMode = function(state, session, foldStyle, row) {
+        var mode = this.$getMode(state);
+        return (mode ? mode.getFoldWidget(session, foldStyle, row) : "");
+    };
+
+    this.getFoldWidget = function(session, foldStyle, row) {
+        return (
+            this.$tryMode(session.getState(row-1), session, foldStyle, row) ||
+            this.$tryMode(session.getState(row), session, foldStyle, row) ||
+            this.defaultMode.getFoldWidget(session, foldStyle, row)
+        );
+    };
+
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
+        var mode = this.$getMode(session.getState(row-1));
+        
+        if (!mode || !mode.getFoldWidget(session, foldStyle, row))
+            mode = this.$getMode(session.getState(row));
+        
+        if (!mode || !mode.getFoldWidget(session, foldStyle, row))
+            mode = this.defaultMode;
+        
+        return mode.getFoldWidgetRange(session, foldStyle, row);
+    };
+
+}).call(FoldMode.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/pythonic.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/pythonic.js b/src/fauxton/assets/js/libs/ace/mode/folding/pythonic.js
new file mode 100644
index 0000000..4c7ec11
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/pythonic.js
@@ -0,0 +1,58 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var BaseFoldMode = require("./fold_mode").FoldMode;
+
+var FoldMode = exports.FoldMode = function(markers) {
+    this.foldingStartMarker = new RegExp("([\\[{])(?:\\s*)$|(" + markers + ")(?:\\s*)(?:#.*)?$");
+};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
+        var line = session.getLine(row);
+        var match = line.match(this.foldingStartMarker);
+        if (match) {
+            if (match[1])
+                return this.openingBracketBlock(session, match[1], row, match.index);
+            if (match[2])
+                return this.indentationBlock(session, row, match.index + match[2].length);
+            return this.indentationBlock(session, row);
+        }
+    }
+
+}).call(FoldMode.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/pythonic_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/pythonic_test.js b/src/fauxton/assets/js/libs/ace/mode/folding/pythonic_test.js
new file mode 100644
index 0000000..e30785b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/pythonic_test.js
@@ -0,0 +1,98 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined")
+    require("amd-loader");
+
+define(function(require, exports, module) {
+"use strict";
+
+var PythonMode = require("../python").Mode;
+var EditSession = require("../../edit_session").EditSession;
+var assert = require("../../test/assertions");
+
+module.exports = {
+
+    "test: bracket folding": function() {
+        var session = new EditSession([
+            '[ ',
+            'stuff',
+            ']',
+            '[ ',
+            '{ ',
+            '[  #-'
+        ]);
+
+        var mode = new PythonMode();
+        session.setFoldStyle("markbeginend");
+        session.setMode(mode);
+
+        assert.equal(session.getFoldWidget(0), "start");
+        assert.equal(session.getFoldWidget(1), "");
+        assert.equal(session.getFoldWidget(2), "");
+        assert.equal(session.getFoldWidget(3), "start");
+        assert.equal(session.getFoldWidget(4), "start");
+        assert.equal(session.getFoldWidget(5), "");
+
+        assert.range(session.getFoldWidgetRange(0), 0, 1, 2, 0);
+        assert.equal(session.getFoldWidgetRange(3), null);
+        assert.equal(session.getFoldWidgetRange(5), null);
+    },
+
+    "test: indentation folding": function() {
+        var session = new EditSession([
+            'def a: #',
+            '',
+            ' b:',
+            '  c',
+            ' ',
+            '  c',
+            '',
+            ' ',
+            ''
+        ]);
+
+        var mode = new PythonMode();
+        session.setFoldStyle("markbeginend");
+        session.setMode(mode);
+
+        assert.equal(session.getFoldWidget(0), "start");
+        assert.equal(session.getFoldWidget(1), "");
+        assert.equal(session.getFoldWidget(2), "start");
+
+        assert.range(session.getFoldWidgetRange(0), 0, 6, 5, 3);
+        assert.range(session.getFoldWidgetRange(2), 2, 3, 5, 3);
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main)
+    require("asyncjs").test.testcase(module.exports).exec();

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/velocity.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/velocity.js b/src/fauxton/assets/js/libs/ace/mode/folding/velocity.js
new file mode 100644
index 0000000..ce235b4
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/velocity.js
@@ -0,0 +1,120 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var BaseFoldMode = require("./fold_mode").FoldMode;
+var Range = require("../../range").Range;
+
+var FoldMode = exports.FoldMode = function() {};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
+        var range = this.indentationBlock(session, row);
+        if (range)
+            return range;
+
+        var re = /\S/;
+        var line = session.getLine(row);
+        var startLevel = line.search(re);
+        if (startLevel == -1 || line[startLevel] != "##")
+            return;
+
+        var startColumn = line.length;
+        var maxRow = session.getLength();
+        var startRow = row;
+        var endRow = row;
+
+        while (++row < maxRow) {
+            line = session.getLine(row);
+            var level = line.search(re);
+
+            if (level == -1)
+                continue;
+
+            if (line[level] != "##")
+                break;
+
+            endRow = row;
+        }
+
+        if (endRow > startRow) {
+            var endColumn = session.getLine(endRow).length;
+            return new Range(startRow, startColumn, endRow, endColumn);
+        }
+    };
+
+    // must return "" if there's no fold, to enable caching
+    this.getFoldWidget = function(session, foldStyle, row) {
+        var line = session.getLine(row);
+        var indent = line.search(/\S/);
+        var next = session.getLine(row + 1);
+        var prev = session.getLine(row - 1);
+        var prevIndent = prev.search(/\S/);
+        var nextIndent = next.search(/\S/);
+
+        if (indent == -1) {
+            session.foldWidgets[row - 1] = prevIndent!= -1 && prevIndent < nextIndent ? "start" : "";
+            return "";
+        }
+
+        // documentation comments
+        if (prevIndent == -1) {
+            if (indent == nextIndent && line[indent] == "##" && next[indent] == "##") {
+                session.foldWidgets[row - 1] = "";
+                session.foldWidgets[row + 1] = "";
+                return "start";
+            }
+        } else if (prevIndent == indent && line[indent] == "##" && prev[indent] == "##") {
+            if (session.getLine(row - 2).search(/\S/) == -1) {
+                session.foldWidgets[row - 1] = "start";
+                session.foldWidgets[row + 1] = "";
+                return "";
+            }
+        }
+
+        if (prevIndent!= -1 && prevIndent < indent)
+            session.foldWidgets[row - 1] = "start";
+        else
+            session.foldWidgets[row - 1] = "";
+
+        if (indent < nextIndent)
+            return "start";
+        else
+            return "";
+    };
+
+}).call(FoldMode.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/xml.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/xml.js b/src/fauxton/assets/js/libs/ace/mode/folding/xml.js
new file mode 100644
index 0000000..5e8e4b9
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/xml.js
@@ -0,0 +1,254 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var lang = require("../../lib/lang");
+var Range = require("../../range").Range;
+var BaseFoldMode = require("./fold_mode").FoldMode;
+var TokenIterator = require("../../token_iterator").TokenIterator;
+
+var FoldMode = exports.FoldMode = function(voidElements) {
+    BaseFoldMode.call(this);
+    this.voidElements = voidElements || {};
+};
+oop.inherits(FoldMode, BaseFoldMode);
+
+(function() {
+
+    this.getFoldWidget = function(session, foldStyle, row) {
+        var tag = this._getFirstTagInLine(session, row);
+
+        if (tag.closing)
+            return foldStyle == "markbeginend" ? "end" : "";
+
+        if (!tag.tagName || this.voidElements[tag.tagName.toLowerCase()])
+            return "";
+
+        if (tag.selfClosing)
+            return "";
+
+        if (tag.value.indexOf("/" + tag.tagName) !== -1)
+            return "";
+
+        return "start";
+    };
+    
+    this._getFirstTagInLine = function(session, row) {
+        var tokens = session.getTokens(row);
+        var value = "";
+        for (var i = 0; i < tokens.length; i++) {
+            var token = tokens[i];
+            if (token.type.lastIndexOf("meta.tag", 0) === 0)
+                value += token.value;
+            else
+                value += lang.stringRepeat(" ", token.value.length);
+        }
+        
+        return this._parseTag(value);
+    };
+
+    this.tagRe = /^(\s*)(<?(\/?)([-_a-zA-Z0-9:!]*)\s*(\/?)>?)/;
+    this._parseTag = function(tag) {
+        
+        var match = tag.match(this.tagRe);
+        var column = 0;
+
+        return {
+            value: tag,
+            match: match ? match[2] : "",
+            closing: match ? !!match[3] : false,
+            selfClosing: match ? !!match[5] || match[2] == "/>" : false,
+            tagName: match ? match[4] : "",
+            column: match[1] ? column + match[1].length : column
+        };
+    };
+    
+    /*
+     * reads a full tag and places the iterator after the tag
+     */
+    this._readTagForward = function(iterator) {
+        var token = iterator.getCurrentToken();
+        if (!token)
+            return null;
+            
+        var value = "";
+        var start;
+        
+        do {
+            if (token.type.lastIndexOf("meta.tag", 0) === 0) {
+                if (!start) {
+                    var start = {
+                        row: iterator.getCurrentTokenRow(),
+                        column: iterator.getCurrentTokenColumn()
+                    };
+                }
+                value += token.value;
+                if (value.indexOf(">") !== -1) {
+                    var tag = this._parseTag(value);
+                    tag.start = start;
+                    tag.end = {
+                        row: iterator.getCurrentTokenRow(),
+                        column: iterator.getCurrentTokenColumn() + token.value.length
+                    };
+                    iterator.stepForward();
+                    return tag;
+                }
+            }
+        } while(token = iterator.stepForward());
+        
+        return null;
+    };
+    
+    this._readTagBackward = function(iterator) {
+        var token = iterator.getCurrentToken();
+        if (!token)
+            return null;
+            
+        var value = "";
+        var end;
+
+        do {
+            if (token.type.lastIndexOf("meta.tag", 0) === 0) {
+                if (!end) {
+                    end = {
+                        row: iterator.getCurrentTokenRow(),
+                        column: iterator.getCurrentTokenColumn() + token.value.length
+                    };
+                }
+                value = token.value + value;
+                if (value.indexOf("<") !== -1) {
+                    var tag = this._parseTag(value);
+                    tag.end = end;
+                    tag.start = {
+                        row: iterator.getCurrentTokenRow(),
+                        column: iterator.getCurrentTokenColumn()
+                    };
+                    iterator.stepBackward();
+                    return tag;
+                }
+            }
+        } while(token = iterator.stepBackward());
+        
+        return null;
+    };
+    
+    this._pop = function(stack, tag) {
+        while (stack.length) {
+            
+            var top = stack[stack.length-1];
+            if (!tag || top.tagName == tag.tagName) {
+                return stack.pop();
+            }
+            else if (this.voidElements[tag.tagName]) {
+                return;
+            }
+            else if (this.voidElements[top.tagName]) {
+                stack.pop();
+                continue;
+            } else {
+                return null;
+            }
+        }
+    };
+    
+    this.getFoldWidgetRange = function(session, foldStyle, row) {
+        var firstTag = this._getFirstTagInLine(session, row);
+        
+        if (!firstTag.match)
+            return null;
+        
+        var isBackward = firstTag.closing || firstTag.selfClosing;
+        var stack = [];
+        var tag;
+        
+        if (!isBackward) {
+            var iterator = new TokenIterator(session, row, firstTag.column);
+            var start = {
+                row: row,
+                column: firstTag.column + firstTag.tagName.length + 2
+            };
+            while (tag = this._readTagForward(iterator)) {
+                if (tag.selfClosing) {
+                    if (!stack.length) {
+                        tag.start.column += tag.tagName.length + 2;
+                        tag.end.column -= 2;
+                        return Range.fromPoints(tag.start, tag.end);
+                    } else
+                        continue;
+                }
+                
+                if (tag.closing) {
+                    this._pop(stack, tag);
+                    if (stack.length == 0)
+                        return Range.fromPoints(start, tag.start);
+                }
+                else {
+                    stack.push(tag)
+                }
+            }
+        }
+        else {
+            var iterator = new TokenIterator(session, row, firstTag.column + firstTag.match.length);
+            var end = {
+                row: row,
+                column: firstTag.column
+            };
+            
+            while (tag = this._readTagBackward(iterator)) {
+                if (tag.selfClosing) {
+                    if (!stack.length) {
+                        tag.start.column += tag.tagName.length + 2;
+                        tag.end.column -= 2;
+                        return Range.fromPoints(tag.start, tag.end);
+                    } else
+                        continue;
+                }
+                
+                if (!tag.closing) {
+                    this._pop(stack, tag);
+                    if (stack.length == 0) {
+                        tag.start.column += tag.tagName.length + 2;
+                        return Range.fromPoints(tag.start, end);
+                    }
+                }
+                else {
+                    stack.push(tag)
+                }
+            }
+        }
+        
+    };
+
+}).call(FoldMode.prototype);
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/folding/xml_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/folding/xml_test.js b/src/fauxton/assets/js/libs/ace/mode/folding/xml_test.js
new file mode 100644
index 0000000..ec07cc0
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/folding/xml_test.js
@@ -0,0 +1,110 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined")
+    require("amd-loader");
+
+define(function(require, exports, module) {
+"use strict";
+
+var XmlMode = require("../xml").Mode;
+var EditSession = require("../../edit_session").EditSession;
+var assert = require("../../test/assertions");
+
+module.exports = {
+
+    "test: fold multi line self closing element": function() {
+        var session = new EditSession([
+            '<person',
+            '  firstname="fabian"',
+            '  lastname="jakobs"/>'
+        ]);
+        
+        var mode = new XmlMode();
+        session.setFoldStyle("markbeginend");
+        session.setMode(mode);
+        
+        assert.equal(session.getFoldWidget(0), "start");
+        assert.equal(session.getFoldWidget(1), "");
+        assert.equal(session.getFoldWidget(2), "end");
+        
+        assert.range(session.getFoldWidgetRange(0), 0, 8, 2, 19);
+        assert.range(session.getFoldWidgetRange(2), 0, 8, 2, 19);
+    },
+    
+    "test: fold should skip self closing elements": function() {
+        var session = new EditSession([
+            '<person>',
+            '  <attrib value="fabian"/>',
+            '</person>'
+        ]);
+        
+        var mode = new XmlMode();
+        session.setFoldStyle("markbeginend");
+        session.setMode(mode);
+        
+        assert.equal(session.getFoldWidget(0), "start");
+        assert.equal(session.getFoldWidget(1), "");
+        assert.equal(session.getFoldWidget(2), "end");
+        
+        assert.range(session.getFoldWidgetRange(0), 0, 8, 2, 0);
+        assert.range(session.getFoldWidgetRange(2), 0, 8, 2, 0);
+    },
+    
+    "test: fold should skip multi line self closing elements": function() {
+        var session = new EditSession([
+            '<person>',
+            '  <attib',
+            '     key="name"',
+            '     value="fabian"/>',
+            '</person>'
+        ]);
+        
+        var mode = new XmlMode();
+        session.setMode(mode);
+        session.setFoldStyle("markbeginend");
+        
+        assert.equal(session.getFoldWidget(0), "start");
+        assert.equal(session.getFoldWidget(1), "start");
+        assert.equal(session.getFoldWidget(2), "");
+        assert.equal(session.getFoldWidget(3), "end");
+        assert.equal(session.getFoldWidget(4), "end");
+        
+        assert.range(session.getFoldWidgetRange(0), 0, 8, 4, 0);
+        assert.range(session.getFoldWidgetRange(1), 1, 9, 3, 19);
+        assert.range(session.getFoldWidgetRange(3), 1, 9, 3, 19);
+        assert.range(session.getFoldWidgetRange(4), 0, 8, 4, 0);
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main)
+    require("asyncjs").test.testcase(module.exports).exec();

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/forth.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/forth.js b/src/fauxton/assets/js/libs/ace/mode/forth.js
new file mode 100644
index 0000000..1ee65e2
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/forth.js
@@ -0,0 +1,62 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ *
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var ForthHighlightRules = require("./forth_highlight_rules").ForthHighlightRules;
+// TODO: pick appropriate fold mode
+var FoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = ForthHighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = "(?<=^|\\s)\\.?\\( [^)]*\\)";
+    this.blockComment = {start: "/*", end: "*/"};
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/forth_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/forth_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/forth_highlight_rules.js
new file mode 100644
index 0000000..2fbe76d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/forth_highlight_rules.js
@@ -0,0 +1,164 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* This file was autogenerated from https://raw.github.com/vze26m98/Forth.tmbundle/master/Syntaxes/Forth.tmLanguage (uuid: ) */
+/****************************************************************************************
+ * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
+ * fileTypes                                                                            *
+ ****************************************************************************************/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var ForthHighlightRules = function() {
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = { start: [ { include: '#forth' } ],
+      '#comment': 
+       [ { token: 'comment.line.double-dash.forth',
+           regex: '(?:^|\\s)--\\s.*$',
+           comment: 'line comments for iForth' },
+         { token: 'comment.line.backslash.forth',
+           regex: '(?:^|\\s)\\\\[\\s\\S]*$',
+           comment: 'ANSI line comment' },
+         { token: 'comment.line.backslash-g.forth',
+           regex: '(?:^|\\s)\\\\[Gg] .*$',
+           comment: 'gForth line comment' },
+         { token: 'comment.block.forth',
+           regex: '(?:^|\\s)\\(\\*(?=\\s|$)',
+           push: 
+            [ { token: 'comment.block.forth',
+                regex: '(?:^|\\s)\\*\\)(?=\\s|$)',
+                next: 'pop' },
+              { defaultToken: 'comment.block.forth' } ],
+           comment: 'multiline comments for iForth' },
+         { token: 'comment.block.documentation.forth',
+           regex: '\\bDOC\\b',
+           caseInsensitive: true,
+           push: 
+            [ { token: 'comment.block.documentation.forth',
+                regex: '\\bENDDOC\\b',
+                caseInsensitive: true,
+                next: 'pop' },
+              { defaultToken: 'comment.block.documentation.forth' } ],
+           comment: 'documentation comments for iForth' },
+         { token: 'comment.line.parentheses.forth',
+           regex: '(?:^|\\s)\\.?\\( [^)]*\\)',
+           comment: 'ANSI line comment' } ],
+      '#constant': 
+       [ { token: 'constant.language.forth',
+           regex: '(?:^|\\s)(?:TRUE|FALSE|BL|PI|CELL|C/L|R/O|W/O|R/W)(?=\\s|$)',
+           caseInsensitive: true},
+         { token: 'constant.numeric.forth',
+           regex: '(?:^|\\s)[$#%]?[-+]?[0-9]+(?:\\.[0-9]*e-?[0-9]+|\\.?[0-9a-fA-F]*)(?=\\s|$)'},
+         { token: 'constant.character.forth',
+           regex: '(?:^|\\s)(?:[&^]\\S|(?:"|\')\\S(?:"|\'))(?=\\s|$)'}],
+      '#forth': 
+       [ { include: '#constant' },
+         { include: '#comment' },
+         { include: '#string' },
+         { include: '#word' },
+         { include: '#variable' },
+         { include: '#storage' },
+         { include: '#word-def' } ],
+      '#storage': 
+       [ { token: 'storage.type.forth',
+           regex: '(?:^|\\s)(?:2CONSTANT|2VARIABLE|ALIAS|CONSTANT|CREATE-INTERPRET/COMPILE[:]?|CREATE|DEFER|FCONSTANT|FIELD|FVARIABLE|USER|VALUE|VARIABLE|VOCABULARY)(?=\\s|$)',
+           caseInsensitive: true}],
+      '#string': 
+       [ { token: 'string.quoted.double.forth',
+           regex: '(ABORT" |BREAK" |\\." |C" |0"|S\\\\?" )([^"]+")',
+           caseInsensitive: true},
+         { token: 'string.unquoted.forth',
+           regex: '(?:INCLUDE|NEEDS|REQUIRE|USE)[ ]\\S+(?=\\s|$)',
+           caseInsensitive: true}],
+      '#variable': 
+       [ { token: 'variable.language.forth',
+           regex: '\\b(?:I|J)\\b',
+           caseInsensitive: true } ],
+      '#word': 
+       [ { token: 'keyword.control.immediate.forth',
+           regex: '(?:^|\\s)\\[(?:\\?DO|\\+LOOP|AGAIN|BEGIN|DEFINED|DO|ELSE|ENDIF|FOR|IF|IFDEF|IFUNDEF|LOOP|NEXT|REPEAT|THEN|UNTIL|WHILE)\\](?=\\s|$)',
+           caseInsensitive: true},
+         { token: 'keyword.other.immediate.forth',
+           regex: '(?:^|\\s)(?:COMPILE-ONLY|IMMEDIATE|IS|RESTRICT|TO|WHAT\'S|])(?=\\s|$)',
+           caseInsensitive: true},
+         { token: 'keyword.control.compile-only.forth',
+           regex: '(?:^|\\s)(?:-DO|\\-LOOP|\\?DO|\\?LEAVE|\\+DO|\\+LOOP|ABORT\\"|AGAIN|AHEAD|BEGIN|CASE|DO|ELSE|ENDCASE|ENDIF|ENDOF|ENDTRY\\-IFERROR|ENDTRY|FOR|IF|IFERROR|LEAVE|LOOP|NEXT|RECOVER|REPEAT|RESTORE|THEN|TRY|U\\-DO|U\\+DO|UNTIL|WHILE)(?=\\s|$)',
+           caseInsensitive: true},
+         { token: 'keyword.other.compile-only.forth',
+           regex: '(?:^|\\s)(?:\\?DUP-0=-IF|\\?DUP-IF|\\)|\\[|\\[\'\\]|\\[CHAR\\]|\\[COMPILE\\]|\\[IS\\]|\\[TO\\]|<COMPILATION|<INTERPRETATION|ASSERT\\(|ASSERT0\\(|ASSERT1\\(|ASSERT2\\(|ASSERT3\\(|COMPILATION>|DEFERS|DOES>|INTERPRETATION>|OF|POSTPONE)(?=\\s|$)',
+           caseInsensitive: true},
+         { token: 'keyword.other.non-immediate.forth',
+           regex: '(?:^|\\s)(?:\'|<IS>|<TO>|CHAR|END-STRUCT|INCLUDE[D]?|LOAD|NEEDS|REQUIRE[D]?|REVISION|SEE|STRUCT|THRU|USE)(?=\\s|$)',
+           caseInsensitive: true},
+         { token: 'keyword.other.warning.forth',
+           regex: '(?:^|\\s)(?:~~|BREAK:|BREAK"|DBG)(?=\\s|$)',
+           caseInsensitive: true}],
+      '#word-def': 
+       [ { token: 
+            [ 'keyword.other.compile-only.forth',
+              'keyword.other.compile-only.forth',
+              'meta.block.forth',
+              'entity.name.function.forth' ],
+           regex: '(:NONAME)|(^:|\\s:)(\\s)(\\S+)(?=\\s|$)',
+           caseInsensitive: true,
+           push: 
+            [ { token: 'keyword.other.compile-only.forth',
+                regex: ';(?:CODE)?',
+                caseInsensitive: true,
+                next: 'pop' },
+              { include: '#constant' },
+              { include: '#comment' },
+              { include: '#string' },
+              { include: '#word' },
+              { include: '#variable' },
+              { include: '#storage' },
+              { defaultToken: 'meta.block.forth' } ] } ] }
+    
+    this.normalizeRules();
+};
+
+ForthHighlightRules.metaData = { fileTypes: [ 'frt', 'fs', 'ldr' ],
+      foldingStartMarker: '/\\*\\*|\\{\\s*$',
+      foldingStopMarker: '\\*\\*/|^\\s*\\}',
+      keyEquivalent: '^~F',
+      name: 'Forth',
+      scopeName: 'source.forth' }
+
+
+oop.inherits(ForthHighlightRules, TextHighlightRules);
+
+exports.ForthHighlightRules = ForthHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/ftl.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/ftl.js b/src/fauxton/assets/js/libs/ace/mode/ftl.js
new file mode 100644
index 0000000..a07dcaa
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/ftl.js
@@ -0,0 +1,49 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var FtlHighlightRules = require("./ftl_highlight_rules").FtlHighlightRules;
+
+var Mode = function() {
+    this.HighlightRules = FtlHighlightRules;
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});


[28/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/behaviour/cstyle.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/behaviour/cstyle.js b/src/fauxton/assets/js/libs/ace/mode/behaviour/cstyle.js
new file mode 100644
index 0000000..54f7552
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/behaviour/cstyle.js
@@ -0,0 +1,365 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var Behaviour = require("../behaviour").Behaviour;
+var TokenIterator = require("../../token_iterator").TokenIterator;
+var lang = require("../../lib/lang");
+
+var SAFE_INSERT_IN_TOKENS =
+    ["text", "paren.rparen", "punctuation.operator"];
+var SAFE_INSERT_BEFORE_TOKENS =
+    ["text", "paren.rparen", "punctuation.operator", "comment"];
+
+
+var autoInsertedBrackets = 0;
+var autoInsertedRow = -1;
+var autoInsertedLineEnd = "";
+var maybeInsertedBrackets = 0;
+var maybeInsertedRow = -1;
+var maybeInsertedLineStart = "";
+var maybeInsertedLineEnd = "";
+
+var CstyleBehaviour = function () {
+    
+    CstyleBehaviour.isSaneInsertion = function(editor, session) {
+        var cursor = editor.getCursorPosition();
+        var iterator = new TokenIterator(session, cursor.row, cursor.column);
+        
+        // Don't insert in the middle of a keyword/identifier/lexical
+        if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) {
+            // Look ahead in case we're at the end of a token
+            var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1);
+            if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS))
+                return false;
+        }
+        
+        // Only insert in front of whitespace/comments
+        iterator.stepForward();
+        return iterator.getCurrentTokenRow() !== cursor.row ||
+            this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS);
+    };
+    
+    CstyleBehaviour.$matchTokenType = function(token, types) {
+        return types.indexOf(token.type || token) > -1;
+    };
+    
+    CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) {
+        var cursor = editor.getCursorPosition();
+        var line = session.doc.getLine(cursor.row);
+        // Reset previous state if text or context changed too much
+        if (!this.isAutoInsertedClosing(cursor, line, autoInsertedLineEnd[0]))
+            autoInsertedBrackets = 0;
+        autoInsertedRow = cursor.row;
+        autoInsertedLineEnd = bracket + line.substr(cursor.column);
+        autoInsertedBrackets++;
+    };
+    
+    CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) {
+        var cursor = editor.getCursorPosition();
+        var line = session.doc.getLine(cursor.row);
+        if (!this.isMaybeInsertedClosing(cursor, line))
+            maybeInsertedBrackets = 0;
+        maybeInsertedRow = cursor.row;
+        maybeInsertedLineStart = line.substr(0, cursor.column) + bracket;
+        maybeInsertedLineEnd = line.substr(cursor.column);
+        maybeInsertedBrackets++;
+    };
+    
+    CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) {
+        return autoInsertedBrackets > 0 &&
+            cursor.row === autoInsertedRow &&
+            bracket === autoInsertedLineEnd[0] &&
+            line.substr(cursor.column) === autoInsertedLineEnd;
+    };
+    
+    CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) {
+        return maybeInsertedBrackets > 0 &&
+            cursor.row === maybeInsertedRow &&
+            line.substr(cursor.column) === maybeInsertedLineEnd &&
+            line.substr(0, cursor.column) == maybeInsertedLineStart;
+    };
+    
+    CstyleBehaviour.popAutoInsertedClosing = function() {
+        autoInsertedLineEnd = autoInsertedLineEnd.substr(1);
+        autoInsertedBrackets--;
+    };
+    
+    CstyleBehaviour.clearMaybeInsertedClosing = function() {
+        maybeInsertedBrackets = 0;
+        maybeInsertedRow = -1;
+    };
+
+    this.add("braces", "insertion", function (state, action, editor, session, text) {
+        var cursor = editor.getCursorPosition();
+        var line = session.doc.getLine(cursor.row);
+        if (text == '{') {
+            var selection = editor.getSelectionRange();
+            var selected = session.doc.getTextRange(selection);
+            if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) {
+                return {
+                    text: '{' + selected + '}',
+                    selection: false
+                };
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
+                if (/[\]\}\)]/.test(line[cursor.column])) {
+                    CstyleBehaviour.recordAutoInsert(editor, session, "}");
+                    return {
+                        text: '{}',
+                        selection: [1, 1]
+                    };
+                } else {
+                    CstyleBehaviour.recordMaybeInsert(editor, session, "{");
+                    return {
+                        text: '{',
+                        selection: [1, 1]
+                    };
+                }
+            }
+        } else if (text == '}') {
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
+            if (rightChar == '}') {
+                var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row});
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
+                    CstyleBehaviour.popAutoInsertedClosing();
+                    return {
+                        text: '',
+                        selection: [1, 1]
+                    };
+                }
+            }
+        } else if (text == "\n" || text == "\r\n") {
+            var closing = "";
+            if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) {
+                closing = lang.stringRepeat("}", maybeInsertedBrackets);
+                CstyleBehaviour.clearMaybeInsertedClosing();
+            }
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
+            if (rightChar == '}' || closing !== "") {
+                var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column}, '}');
+                if (!openBracePos)
+                     return null;
+
+                var indent = this.getNextLineIndent(state, line.substring(0, cursor.column), session.getTabString());
+                var next_indent = this.$getIndent(line);
+
+                return {
+                    text: '\n' + indent + '\n' + next_indent + closing,
+                    selection: [1, indent.length, 1, indent.length]
+                };
+            }
+        }
+    });
+
+    this.add("braces", "deletion", function (state, action, editor, session, range) {
+        var selected = session.doc.getTextRange(range);
+        if (!range.isMultiLine() && selected == '{') {
+            var line = session.doc.getLine(range.start.row);
+            var rightChar = line.substring(range.end.column, range.end.column + 1);
+            if (rightChar == '}') {
+                range.end.column++;
+                return range;
+            } else {
+                maybeInsertedBrackets--;
+            }
+        }
+    });
+
+    this.add("parens", "insertion", function (state, action, editor, session, text) {
+        if (text == '(') {
+            var selection = editor.getSelectionRange();
+            var selected = session.doc.getTextRange(selection);
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
+                return {
+                    text: '(' + selected + ')',
+                    selection: false
+                };
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
+                CstyleBehaviour.recordAutoInsert(editor, session, ")");
+                return {
+                    text: '()',
+                    selection: [1, 1]
+                };
+            }
+        } else if (text == ')') {
+            var cursor = editor.getCursorPosition();
+            var line = session.doc.getLine(cursor.row);
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
+            if (rightChar == ')') {
+                var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row});
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
+                    CstyleBehaviour.popAutoInsertedClosing();
+                    return {
+                        text: '',
+                        selection: [1, 1]
+                    };
+                }
+            }
+        }
+    });
+
+    this.add("parens", "deletion", function (state, action, editor, session, range) {
+        var selected = session.doc.getTextRange(range);
+        if (!range.isMultiLine() && selected == '(') {
+            var line = session.doc.getLine(range.start.row);
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
+            if (rightChar == ')') {
+                range.end.column++;
+                return range;
+            }
+        }
+    });
+
+    this.add("brackets", "insertion", function (state, action, editor, session, text) {
+        if (text == '[') {
+            var selection = editor.getSelectionRange();
+            var selected = session.doc.getTextRange(selection);
+            if (selected !== "" && editor.getWrapBehavioursEnabled()) {
+                return {
+                    text: '[' + selected + ']',
+                    selection: false
+                };
+            } else if (CstyleBehaviour.isSaneInsertion(editor, session)) {
+                CstyleBehaviour.recordAutoInsert(editor, session, "]");
+                return {
+                    text: '[]',
+                    selection: [1, 1]
+                };
+            }
+        } else if (text == ']') {
+            var cursor = editor.getCursorPosition();
+            var line = session.doc.getLine(cursor.row);
+            var rightChar = line.substring(cursor.column, cursor.column + 1);
+            if (rightChar == ']') {
+                var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row});
+                if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) {
+                    CstyleBehaviour.popAutoInsertedClosing();
+                    return {
+                        text: '',
+                        selection: [1, 1]
+                    };
+                }
+            }
+        }
+    });
+
+    this.add("brackets", "deletion", function (state, action, editor, session, range) {
+        var selected = session.doc.getTextRange(range);
+        if (!range.isMultiLine() && selected == '[') {
+            var line = session.doc.getLine(range.start.row);
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
+            if (rightChar == ']') {
+                range.end.column++;
+                return range;
+            }
+        }
+    });
+
+    this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
+        if (text == '"' || text == "'") {
+            var quote = text;
+            var selection = editor.getSelectionRange();
+            var selected = session.doc.getTextRange(selection);
+            if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) {
+                return {
+                    text: quote + selected + quote,
+                    selection: false
+                };
+            } else {
+                var cursor = editor.getCursorPosition();
+                var line = session.doc.getLine(cursor.row);
+                var leftChar = line.substring(cursor.column-1, cursor.column);
+
+                // We're escaped.
+                if (leftChar == '\\') {
+                    return null;
+                }
+
+                // Find what token we're inside.
+                var tokens = session.getTokens(selection.start.row);
+                var col = 0, token;
+                var quotepos = -1; // Track whether we're inside an open quote.
+
+                for (var x = 0; x < tokens.length; x++) {
+                    token = tokens[x];
+                    if (token.type == "string") {
+                      quotepos = -1;
+                    } else if (quotepos < 0) {
+                      quotepos = token.value.indexOf(quote);
+                    }
+                    if ((token.value.length + col) > selection.start.column) {
+                        break;
+                    }
+                    col += tokens[x].value.length;
+                }
+
+                // Try and be smart about when we auto insert.
+                if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
+                    if (!CstyleBehaviour.isSaneInsertion(editor, session))
+                        return;
+                    return {
+                        text: quote + quote,
+                        selection: [1,1]
+                    };
+                } else if (token && token.type === "string") {
+                    // Ignore input and move right one if we're typing over the closing quote.
+                    var rightChar = line.substring(cursor.column, cursor.column + 1);
+                    if (rightChar == quote) {
+                        return {
+                            text: '',
+                            selection: [1, 1]
+                        };
+                    }
+                }
+            }
+        }
+    });
+
+    this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
+        var selected = session.doc.getTextRange(range);
+        if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
+            var line = session.doc.getLine(range.start.row);
+            var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
+            if (rightChar == selected) {
+                range.end.column++;
+                return range;
+            }
+        }
+    });
+
+};
+
+oop.inherits(CstyleBehaviour, Behaviour);
+
+exports.CstyleBehaviour = CstyleBehaviour;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/behaviour/html.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/behaviour/html.js b/src/fauxton/assets/js/libs/ace/mode/behaviour/html.js
new file mode 100644
index 0000000..1d500e0
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/behaviour/html.js
@@ -0,0 +1,88 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var XmlBehaviour = require("../behaviour/xml").XmlBehaviour;
+var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
+var TokenIterator = require("../../token_iterator").TokenIterator;
+var voidElements = ['area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'];
+
+function hasType(token, type) {
+    var tokenTypes = token.type.split('.');
+    return type.split('.').every(function(type){
+        return (tokenTypes.indexOf(type) !== -1);
+    });
+    return hasType;
+}
+
+var HtmlBehaviour = function () {
+
+    this.inherit(XmlBehaviour); // Get xml behaviour
+    
+    this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
+        if (text == '>') {
+            var position = editor.getCursorPosition();
+            var iterator = new TokenIterator(session, position.row, position.column);
+            var token = iterator.getCurrentToken();
+
+            if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column)
+                return;
+            var atCursor = false;
+            if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
+                do {
+                    token = iterator.stepBackward();
+                } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
+            } else {
+                atCursor = true;
+            }
+            if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) {
+                return;
+            }
+            var element = token.value;
+            if (atCursor){
+                var element = element.substring(0, position.column - token.start);
+            }
+            if (voidElements.indexOf(element) !== -1){
+                return;
+            }
+            return {
+               text: '>' + '</' + element + '>',
+               selection: [1, 1]
+            }
+        }
+    });
+}
+oop.inherits(HtmlBehaviour, XmlBehaviour);
+
+exports.HtmlBehaviour = HtmlBehaviour;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/behaviour/xml.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/behaviour/xml.js b/src/fauxton/assets/js/libs/ace/mode/behaviour/xml.js
new file mode 100644
index 0000000..4726130
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/behaviour/xml.js
@@ -0,0 +1,103 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../../lib/oop");
+var Behaviour = require("../behaviour").Behaviour;
+var CstyleBehaviour = require("./cstyle").CstyleBehaviour;
+var TokenIterator = require("../../token_iterator").TokenIterator;
+
+function hasType(token, type) {
+    var tokenTypes = token.type.split('.');
+    return type.split('.').every(function(type){
+        return (tokenTypes.indexOf(type) !== -1);
+    });
+    return hasType;
+}
+
+var XmlBehaviour = function () {
+    
+    this.inherit(CstyleBehaviour, ["string_dquotes"]); // Get string behaviour
+    
+    this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
+        if (text == '>') {
+            var position = editor.getCursorPosition();
+            var iterator = new TokenIterator(session, position.row, position.column);
+            var token = iterator.getCurrentToken();
+
+            if (token && hasType(token, 'string') && iterator.getCurrentTokenColumn() + token.value.length > position.column)
+                return;
+            var atCursor = false;
+            if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
+                do {
+                    token = iterator.stepBackward();
+                } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
+            } else {
+                atCursor = true;
+            }
+            if (!token || !hasType(token, 'meta.tag.name') || iterator.stepBackward().value.match('/')) {
+                return;
+            }
+            var tag = token.value;
+            if (atCursor){
+                var tag = tag.substring(0, position.column - token.start);
+            }
+
+            return {
+               text: '>' + '</' + tag + '>',
+               selection: [1, 1]
+            }
+        }
+    });
+
+    this.add('autoindent', 'insertion', function (state, action, editor, session, text) {
+        if (text == "\n") {
+            var cursor = editor.getCursorPosition();
+            var line = session.getLine(cursor.row);
+            var rightChars = line.substring(cursor.column, cursor.column + 2);
+            if (rightChars == '</') {
+                var next_indent = this.$getIndent(line);
+                var indent = next_indent + session.getTabString();
+
+                return {
+                    text: '\n' + indent + '\n' + next_indent,
+                    selection: [1, indent.length, 1, indent.length]
+                }
+            }
+        }
+    });
+    
+}
+oop.inherits(XmlBehaviour, Behaviour);
+
+exports.XmlBehaviour = XmlBehaviour;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/behaviour/xquery.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/behaviour/xquery.js b/src/fauxton/assets/js/libs/ace/mode/behaviour/xquery.js
new file mode 100644
index 0000000..f9bfb3f
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/behaviour/xquery.js
@@ -0,0 +1,92 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+define(function(require, exports, module) {
+"use strict";
+
+  var oop = require("../../lib/oop");
+  var Behaviour = require('../behaviour').Behaviour;
+  var CstyleBehaviour = require('./cstyle').CstyleBehaviour;
+  var XmlBehaviour = require("../behaviour/xml").XmlBehaviour;
+  var TokenIterator = require("../../token_iterator").TokenIterator;
+
+function hasType(token, type) {
+    var hasType = true;
+    var typeList = token.type.split('.');
+    var needleList = type.split('.');
+    needleList.forEach(function(needle){
+        if (typeList.indexOf(needle) == -1) {
+            hasType = false;
+            return false;
+        }
+    });
+    return hasType;
+}
+ 
+  var XQueryBehaviour = function () {
+      
+      this.inherit(CstyleBehaviour, ["braces", "parens", "string_dquotes"]); // Get string behaviour
+      this.inherit(XmlBehaviour); // Get xml behaviour
+      
+      this.add("autoclosing", "insertion", function (state, action, editor, session, text) {
+        if (text == '>') {
+            var position = editor.getCursorPosition();
+            var iterator = new TokenIterator(session, position.row, position.column);
+            var token = iterator.getCurrentToken();
+            var atCursor = false;
+            var state = JSON.parse(state).pop();
+            if ((token && token.value === '>') || state !== "StartTag") return;
+            if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){
+                do {
+                    token = iterator.stepBackward();
+                } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text')));
+            } else {
+                atCursor = true;
+            }
+            var previous = iterator.stepBackward();
+            if (!token || !hasType(token, 'meta.tag') || (previous !== null && previous.value.match('/'))) {
+                return
+            }
+            var tag = token.value.substring(1);
+            if (atCursor){
+                var tag = tag.substring(0, position.column - token.start);
+            }
+
+            return {
+               text: '>' + '</' + tag + '>',
+               selection: [1, 1]
+            }
+        }
+    });
+
+  }
+  oop.inherits(XQueryBehaviour, Behaviour);
+
+  exports.XQueryBehaviour = XQueryBehaviour;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/c9search.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/c9search.js b/src/fauxton/assets/js/libs/ace/mode/c9search.js
new file mode 100644
index 0000000..18cfdd4
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/c9search.js
@@ -0,0 +1,67 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var C9SearchHighlightRules = require("./c9search_highlight_rules").C9SearchHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var C9StyleFoldMode = require("./folding/c9search").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = C9SearchHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+    this.foldingRules = new C9StyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/c9search_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/c9search_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/c9search_highlight_rules.js
new file mode 100644
index 0000000..df31112
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/c9search_highlight_rules.js
@@ -0,0 +1,59 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var C9SearchHighlightRules = function() {
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+    this.$rules = {
+        "start" : [
+            {
+                token : ["c9searchresults.constant.numeric", "c9searchresults.text", "c9searchresults.text"],
+                regex : "(^\\s+[0-9]+)(:\\s*)(.+)"
+            },
+            {
+                token : ["string", "text"], // single line
+                regex : "(.+)(:$)"
+            }
+        ]
+    };
+};
+
+oop.inherits(C9SearchHighlightRules, TextHighlightRules);
+
+exports.C9SearchHighlightRules = C9SearchHighlightRules;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/c_cpp.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/c_cpp.js b/src/fauxton/assets/js/libs/ace/mode/c_cpp.js
new file mode 100644
index 0000000..08ccf0b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/c_cpp.js
@@ -0,0 +1,101 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var Range = require("../range").Range;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = c_cppHighlightRules;
+
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new CstyleBehaviour();
+
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = "//";
+    this.blockComment = {start: "/*", end: "*/"};
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+        var endState = tokenizedLine.state;
+
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+
+        if (state == "start") {
+            var match = line.match(/^.*[\{\(\[]\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        } else if (state == "doc-start") {
+            if (endState == "start") {
+                return "";
+            }
+            var match = line.match(/^\s*(\/?)\*/);
+            if (match) {
+                if (match[1]) {
+                    indent += " ";
+                }
+                indent += "* ";
+            }
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/c_cpp_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/c_cpp_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/c_cpp_highlight_rules.js
new file mode 100644
index 0000000..d1de84a
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/c_cpp_highlight_rules.js
@@ -0,0 +1,183 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+// used by objective-c
+var cFunctions = exports.cFunctions = "\\s*\\bhypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|di
 git|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:i
 nt(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len)))\\b"
+
+var c_cppHighlightRules = function() {
+
+    var keywordControls = (
+        "break|case|continue|default|do|else|for|goto|if|_Pragma|" +
+        "return|switch|while|catch|operator|try|throw|using"
+    );
+    
+    var storageType = (
+        "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" +
+        "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" +
+        "class|wchar_t|template"
+    );
+
+    var storageModifiers = (
+        "const|extern|register|restrict|static|volatile|inline|private:|" +
+        "protected:|public:|friend|explicit|virtual|export|mutable|typename"
+    );
+
+    var keywordOperators = (
+        "and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq" +
+        "const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace"
+    );
+
+    var builtinConstants = (
+        "NULL|true|false|TRUE|FALSE"
+    );
+
+    var keywordMapper = this.$keywords = this.createKeywordMapper({
+        "keyword.control" : keywordControls,
+        "storage.type" : storageType,
+        "storage.modifier" : storageModifiers,
+        "keyword.operator" : keywordOperators,
+        "variable.language": "this",
+        "constant.language": builtinConstants
+    }, "identifier");
+
+    var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\d\\$_\u00a1-\uffff]*\\b";
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "start" : [
+            {
+                token : "comment",
+                regex : "\\/\\/.*$"
+            },
+            DocCommentHighlightRules.getStartRule("doc-start"),
+            {
+                token : "comment", // multi line comment
+                regex : "\\/\\*",
+                next : "comment"
+            }, {
+                token : "string", // single line
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+            }, {
+                token : "string", // multi line string start
+                regex : '["].*\\\\$',
+                next : "qqstring"
+            }, {
+                token : "string", // single line
+                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+            }, {
+                token : "string", // multi line string start
+                regex : "['].*\\\\$",
+                next : "qstring"
+            }, {
+                token : "constant.numeric", // hex
+                regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
+            }, {
+                token : "constant.numeric", // float
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
+            }, {
+                token : "keyword", // pre-compiler directives
+                regex : "#\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\b",
+                next  : "directive"
+            }, {
+                token : "keyword", // special case pre-compiler directive
+                regex : "(?:#\\s*endif)\\b"
+            }, {
+                token : "support.function.C99.c",
+                regex : cFunctions
+            }, {
+                token : keywordMapper,
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+            }, {
+                token : "keyword.operator",
+                regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"
+            }, {
+              token : "punctuation.operator",
+              regex : "\\?|\\:|\\,|\\;|\\."
+            }, {
+                token : "paren.lparen",
+                regex : "[[({]"
+            }, {
+                token : "paren.rparen",
+                regex : "[\\])}]"
+            }, {
+                token : "text",
+                regex : "\\s+"
+            }
+        ],
+        "comment" : [
+            {
+                token : "comment", // closing comment
+                regex : ".*?\\*\\/",
+                next : "start"
+            }, {
+                token : "comment", // comment spanning whole line
+                regex : ".+"
+            }
+        ],
+        "qqstring" : [
+            {
+                token : "string",
+                regex : '(?:(?:\\\\.)|(?:[^"\\\\]))*?"',
+                next : "start"
+            }, {
+                token : "string",
+                regex : '.+'
+            }
+        ],
+        "qstring" : [
+            {
+                token : "string",
+                regex : "(?:(?:\\\\.)|(?:[^'\\\\]))*?'",
+                next : "start"
+            }, {
+                token : "string",
+                regex : '.+'
+            }
+        ],
+        "directive" : [
+            {
+                token : "constant.other.multiline",
+                regex : /\\/
+            },
+            {
+                token : "constant.other.multiline",
+                regex : /.*\\/
+            },
+            {
+                token : "constant.other",
+                regex : "\\s*<.+?>",
+                next : "start"
+            },
+            {
+                token : "constant.other", // single line
+                regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]',
+                next : "start"
+            }, 
+            {
+                token : "constant.other", // single line
+                regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']",
+                next : "start"
+            },
+            // "\" implies multiline, while "/" implies comment
+            {
+                token : "constant.other",
+                regex : /[^\\\/]+/,
+                next : "start"
+            }
+        ]
+    };
+
+    this.embedRules(DocCommentHighlightRules, "doc-",
+        [ DocCommentHighlightRules.getEndRule("start") ]);
+};
+
+oop.inherits(c_cppHighlightRules, TextHighlightRules);
+
+exports.c_cppHighlightRules = c_cppHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/clojure.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/clojure.js b/src/fauxton/assets/js/libs/ace/mode/clojure.js
new file mode 100644
index 0000000..71f842e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/clojure.js
@@ -0,0 +1,86 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var ClojureHighlightRules = require("./clojure_highlight_rules").ClojureHighlightRules;
+var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensOutdent;
+var Range = require("../range").Range;
+
+var Mode = function() {
+    this.HighlightRules = ClojureHighlightRules;
+    this.$outdent = new MatchingParensOutdent();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = ";";
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+        
+        if (state == "start") {
+            var match = line.match(/[\(\[]/);
+            if (match) {
+                indent += "  ";
+            }
+            match = line.match(/[\)]/);
+            if (match) {
+              indent = "";
+            }
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/clojure_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/clojure_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/clojure_highlight_rules.js
new file mode 100644
index 0000000..f7e28d8
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/clojure_highlight_rules.js
@@ -0,0 +1,200 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+
+
+var ClojureHighlightRules = function() {
+
+    var builtinFunctions = (
+        '* *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* ' +
+        '*command-line-args* *compile-files* *compile-path* *e *err* *file* ' +
+        '*flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* ' +
+        '*print-dup* *print-length* *print-level* *print-meta* *print-readably* ' +
+        '*read-eval* *source-path* *use-context-classloader* ' +
+        '*warn-on-reflection* + - -> ->> .. / < <= = ' +
+        '== > &gt; >= &gt;= accessor aclone ' +
+        'add-classpath add-watch agent agent-errors aget alength alias all-ns ' +
+        'alter alter-meta! alter-var-root amap ancestors and apply areduce ' +
+        'array-map aset aset-boolean aset-byte aset-char aset-double aset-float ' +
+        'aset-int aset-long aset-short assert assoc assoc! assoc-in associative? ' +
+        'atom await await-for await1 bases bean bigdec bigint binding bit-and ' +
+        'bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left ' +
+        'bit-shift-right bit-test bit-xor boolean boolean-array booleans ' +
+        'bound-fn bound-fn* butlast byte byte-array bytes cast char char-array ' +
+        'char-escape-string char-name-string char? chars chunk chunk-append ' +
+        'chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? ' +
+        'class class? clear-agent-errors clojure-version coll? comment commute ' +
+        'comp comparator compare compare-and-set! compile complement concat cond ' +
+        'condp conj conj! cons constantly construct-proxy contains? count ' +
+        'counted? create-ns create-struct cycle dec decimal? declare definline ' +
+        'defmacro defmethod defmulti defn defn- defonce defstruct delay delay? ' +
+        'deliver deref derive descendants destructure disj disj! dissoc dissoc! ' +
+        'distinct distinct? doall doc dorun doseq dosync dotimes doto double ' +
+        'double-array doubles drop drop-last drop-while empty empty? ensure ' +
+        'enumeration-seq eval even? every? false? ffirst file-seq filter find ' +
+        'find-doc find-ns find-var first float float-array float? floats flush ' +
+        'fn fn? fnext for force format future future-call future-cancel ' +
+        'future-cancelled? future-done? future? gen-class gen-interface gensym ' +
+        'get get-in get-method get-proxy-class get-thread-bindings get-validator ' +
+        'hash hash-map hash-set identical? identity if-let if-not ifn? import ' +
+        'in-ns inc init-proxy instance? int int-array integer? interleave intern ' +
+        'interpose into into-array ints io! isa? iterate iterator-seq juxt key ' +
+        'keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list ' +
+        'list* list? load load-file load-reader load-string loaded-libs locking ' +
+        'long long-array longs loop macroexpand macroexpand-1 make-array ' +
+        'make-hierarchy map map? mapcat max max-key memfn memoize merge ' +
+        'merge-with meta method-sig methods min min-key mod name namespace neg? ' +
+        'newline next nfirst nil? nnext not not-any? not-empty not-every? not= ' +
+        'ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ' +
+        'ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? ' +
+        'or parents partial partition pcalls peek persistent! pmap pop pop! ' +
+        'pop-thread-bindings pos? pr pr-str prefer-method prefers ' +
+        'primitives-classnames print print-ctor print-doc print-dup print-method ' +
+        'print-namespace-doc print-simple print-special-doc print-str printf ' +
+        'println println-str prn prn-str promise proxy proxy-call-with-super ' +
+        'proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot ' +
+        'rand rand-int range ratio? rational? rationalize re-find re-groups ' +
+        're-matcher re-matches re-pattern re-seq read read-line read-string ' +
+        'reduce ref ref-history-count ref-max-history ref-min-history ref-set ' +
+        'refer refer-clojure release-pending-sends rem remove remove-method ' +
+        'remove-ns remove-watch repeat repeatedly replace replicate require ' +
+        'reset! reset-meta! resolve rest resultset-seq reverse reversible? rseq ' +
+        'rsubseq second select-keys send send-off seq seq? seque sequence ' +
+        'sequential? set set-validator! set? short short-array shorts ' +
+        'shutdown-agents slurp some sort sort-by sorted-map sorted-map-by ' +
+        'sorted-set sorted-set-by sorted? special-form-anchor special-symbol? ' +
+        'split-at split-with str stream? string? struct struct-map subs subseq ' +
+        'subvec supers swap! symbol symbol? sync syntax-symbol-anchor take ' +
+        'take-last take-nth take-while test the-ns time to-array to-array-2d ' +
+        'trampoline transient tree-seq true? type unchecked-add unchecked-dec ' +
+        'unchecked-divide unchecked-inc unchecked-multiply unchecked-negate ' +
+        'unchecked-remainder unchecked-subtract underive unquote ' +
+        'unquote-splicing update-in update-proxy use val vals var-get var-set ' +
+        'var? vary-meta vec vector vector? when when-first when-let when-not ' +
+        'while with-bindings with-bindings* with-in-str with-loading-context ' +
+        'with-local-vars with-meta with-open with-out-str with-precision xml-seq ' +
+        'zero? zipmap'
+    );
+
+    var keywords = ('throw try var ' +
+        'def do fn if let loop monitor-enter monitor-exit new quote recur set!'
+    );
+
+    var buildinConstants = ("true false nil");
+
+    var keywordMapper = this.createKeywordMapper({
+        "keyword": keywords,
+        "constant.language": buildinConstants,
+        "support.function": builtinFunctions
+    }, "identifier", false, " ");
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "start" : [
+            {
+                token : "comment",
+                regex : ";.*$"
+            }, {
+                token : "keyword", //parens
+                regex : "[\\(|\\)]"
+            }, {
+                token : "keyword", //lists
+                regex : "[\\'\\(]"
+            }, {
+                token : "keyword", //vectors
+                regex : "[\\[|\\]]"
+            }, {
+                token : "keyword", //sets and maps
+                regex : "[\\{|\\}|\\#\\{|\\#\\}]"
+            }, {
+                    token : "keyword", // ampersands
+                    regex : '[\\&]'
+            }, {
+                    token : "keyword", // metadata
+                    regex : '[\\#\\^\\{]'
+            }, {
+                    token : "keyword", // anonymous fn syntactic sugar
+                    regex : '[\\%]'
+            }, {
+                    token : "keyword", // deref reader macro
+                    regex : '[@]'
+            }, {
+                token : "constant.numeric", // hex
+                regex : "0[xX][0-9a-fA-F]+\\b"
+            }, {
+                token : "constant.numeric", // float
+                regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+            }, {
+                token : "constant.language",
+                regex : '[!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+||=|!=|<=|>=|<>|<|>|!|&&]'
+            }, {
+                token : keywordMapper,
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$\\-]*\\b"
+            }, {
+                token : "string", // single line
+                regex : '"',
+                next: "string"
+            }, {
+                token : "constant", // symbol
+                regex : /:[^()\[\]{}'"\^%`,;\s]+/
+            }, {
+                token : "string.regexp", //Regular Expressions
+                regex : '/#"(?:\\.|(?:\\\")|[^\""\n])*"/g'
+            }
+
+        ],
+        "string" : [
+            {
+                token : "constant.language.escape",                
+                regex : "\\\\.|\\\\$"
+            }, {
+                token : "string",                
+                regex : '[^"\\\\]+'
+            }, {
+                token : "string",
+                regex : '"',
+                next : "start"
+            }
+        ]
+    };
+};
+
+oop.inherits(ClojureHighlightRules, TextHighlightRules);
+
+exports.ClojureHighlightRules = ClojureHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/cobol.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/cobol.js b/src/fauxton/assets/js/libs/ace/mode/cobol.js
new file mode 100644
index 0000000..a705d9b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/cobol.js
@@ -0,0 +1,53 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var CobolHighlightRules = require("./cobol_highlight_rules").CobolHighlightRules;
+var Range = require("../range").Range;
+
+var Mode = function() {
+    this.HighlightRules = CobolHighlightRules;
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = "*";
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/cobol_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/cobol_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/cobol_highlight_rules.js
new file mode 100644
index 0000000..36335c9
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/cobol_highlight_rules.js
@@ -0,0 +1,100 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var CobolHighlightRules = function() {
+var keywords = "ACCEPT|MERGE|SUM|ADD||MESSAGE|TABLE|ADVANCING|MODE|TAPE|" +
+"AFTER|MULTIPLY|TEST|ALL|NEGATIVE|TEXT|ALPHABET|NEXT|THAN|" +
+"ALSO|NO|THEN|ALTERNATE|NOT|THROUGH|AND|NUMBER|THRU|ANY|OCCURS|" +
+"TIME|ARE|OF|TO|AREA|OFF|TOP||ASCENDING|OMITTED|TRUE|ASSIGN|ON|TYPE|AT|OPEN|" +
+"UNIT|AUTHOR|OR|UNTIL|BEFORE|OTHER|UP|BLANK|OUTPUT|USE|BLOCK|PAGE|USING|BOTTOM|" +
+"PERFORM|VALUE|BY|PIC|VALUES|CALL|PICTURE|WHEN|CANCEL|PLUS|WITH|CD|POINTER|WRITE|" +
+"CHARACTER|POSITION||ZERO|CLOSE|POSITIVE|ZEROS|COLUMN|PROCEDURE|ZEROES|COMMA|PROGRAM|" +
+"COMMON|PROGRAM-ID|COMMUNICATION|QUOTE|COMP|RANDOM|COMPUTE|READ|CONTAINS|RECEIVE|CONFIGURATION|" +
+"RECORD|CONTINUE|REDEFINES|CONTROL|REFERENCE|COPY|REMAINDER|COUNT|REPLACE|DATA|REPORT|DATE|RESERVE|" +
+"DAY|RESET|DELETE|RETURN|DESTINATION|REWIND|DISABLE|REWRITE|DISPLAY|RIGHT|DIVIDE|RUN|DOWN|SAME|" +
+"ELSE|SEARCH|ENABLE|SECTION|END|SELECT|ENVIRONMENT|SENTENCE|EQUAL|SET|ERROR|SIGN|EXIT|SEQUENTIAL|" +
+"EXTERNAL|SIZE|FLASE|SORT|FILE|SOURCE|LENGTH|SPACE|LESS|STANDARD|LIMIT|START|LINE|STOP|LOCK|STRING|LOW-VALUE|SUBTRACT";
+
+    var builtinConstants = (
+        "true|false|null"
+    );
+
+    var builtinFunctions = (
+        "count|min|max|avg|sum|rank|now|coalesce|main"
+    );
+
+    var keywordMapper = this.createKeywordMapper({
+        "support.function": builtinFunctions,
+        "keyword": keywords,
+        "constant.language": builtinConstants
+    }, "identifier", true);
+
+    this.$rules = {
+        "start" : [ {
+            token : "comment",
+            regex : "\\*.*$"
+        }, {
+            token : "string",           // " string
+            regex : '".*?"'
+        }, {
+            token : "string",           // ' string
+            regex : "'.*?'"
+        }, {
+            token : "constant.numeric", // float
+            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+        }, {
+            token : keywordMapper,
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        }, {
+            token : "keyword.operator",
+            regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|="
+        }, {
+            token : "paren.lparen",
+            regex : "[\\(]"
+        }, {
+            token : "paren.rparen",
+            regex : "[\\)]"
+        }, {
+            token : "text",
+            regex : "\\s+"
+        } ]
+    };
+};
+
+oop.inherits(CobolHighlightRules, TextHighlightRules);
+
+exports.CobolHighlightRules = CobolHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/coffee.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/coffee.js b/src/fauxton/assets/js/libs/ace/mode/coffee.js
new file mode 100644
index 0000000..72ed096
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/coffee.js
@@ -0,0 +1,114 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var Tokenizer = require("../tokenizer").Tokenizer;
+var Rules = require("./coffee_highlight_rules").CoffeeHighlightRules;
+var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var FoldMode = require("./folding/coffee").FoldMode;
+var Range = require("../range").Range;
+var TextMode = require("./text").Mode;
+var WorkerClient = require("../worker/worker_client").WorkerClient;
+var oop = require("../lib/oop");
+
+function Mode() {
+    this.HighlightRules = Rules;
+    this.$outdent = new Outdent();
+    this.foldingRules = new FoldMode();
+}
+
+oop.inherits(Mode, TextMode);
+
+(function() {
+    
+    var indenter = /(?:[({[=:]|[-=]>|\b(?:else|switch|try|catch(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$/;
+    var commentLine = /^(\s*)#/;
+    var hereComment = /^\s*###(?!#)/;
+    var indentation = /^\s*/;
+    
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+        var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
+    
+        if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
+            state === 'start' && indenter.test(line))
+            indent += tab;
+        return indent;
+    };
+    
+    this.toggleCommentLines = function(state, doc, startRow, endRow){
+        console.log("toggle");
+        var range = new Range(0, 0, 0, 0);
+        for (var i = startRow; i <= endRow; ++i) {
+            var line = doc.getLine(i);
+            if (hereComment.test(line))
+                continue;
+                
+            if (commentLine.test(line))
+                line = line.replace(commentLine, '$1');
+            else
+                line = line.replace(indentation, '$&#');
+    
+            range.end.row = range.start.row = i;
+            range.end.column = line.length + 1;
+            doc.replace(range, line);
+        }
+    };
+    
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+    
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+    
+    this.createWorker = function(session) {
+        var worker = new WorkerClient(["ace"], "ace/mode/coffee_worker", "Worker");
+        worker.attachToDocument(session.getDocument());
+        
+        worker.on("error", function(e) {
+            session.setAnnotations([e.data]);
+        });
+        
+        worker.on("ok", function(e) {
+            session.clearAnnotations();
+        });
+        
+        return worker;
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/coffee/coffee-script.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/coffee/coffee-script.js b/src/fauxton/assets/js/libs/ace/mode/coffee/coffee-script.js
new file mode 100644
index 0000000..9e9719f
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/coffee/coffee-script.js
@@ -0,0 +1,62 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+
+    var Lexer = require("./lexer").Lexer;
+    var parser = require("./parser");
+
+    var lexer = new Lexer();
+    parser.lexer = {
+        lex: function() {
+            var tag, token;
+            token = this.tokens[this.pos++];
+            if (token) {
+                tag = token[0], this.yytext = token[1], this.yylloc = token[2];
+                this.yylineno = this.yylloc.first_line;
+            } else {
+                tag = '';
+            }
+            return tag;
+        },
+        setInput: function(tokens) {
+            this.tokens = tokens;
+            return this.pos = 0;
+        },
+        upcomingInput: function() {
+            return "";
+        }
+    };
+    parser.yy = require('./nodes');
+
+    exports.parse = function(code) {
+        return parser.parse(lexer.tokenize(code));
+    };
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/coffee/helpers.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/coffee/helpers.js b/src/fauxton/assets/js/libs/ace/mode/coffee/helpers.js
new file mode 100644
index 0000000..fe73f2b
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/coffee/helpers.js
@@ -0,0 +1,271 @@
+/**
+ * Copyright (c) 2009-2013 Jeremy Ashkenas
+ * 
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ * 
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ * 
+ */
+
+define(function(require, exports, module) {
+// Generated by CoffeeScript 1.6.3
+
+  var buildLocationData, extend, flatten, last, repeat, syntaxErrorToString, _ref;
+
+  exports.starts = function(string, literal, start) {
+    return literal === string.substr(start, literal.length);
+  };
+
+  exports.ends = function(string, literal, back) {
+    var len;
+    len = literal.length;
+    return literal === string.substr(string.length - len - (back || 0), len);
+  };
+
+  exports.repeat = repeat = function(str, n) {
+    var res;
+    res = '';
+    while (n > 0) {
+      if (n & 1) {
+        res += str;
+      }
+      n >>>= 1;
+      str += str;
+    }
+    return res;
+  };
+
+  exports.compact = function(array) {
+    var item, _i, _len, _results;
+    _results = [];
+    for (_i = 0, _len = array.length; _i < _len; _i++) {
+      item = array[_i];
+      if (item) {
+        _results.push(item);
+      }
+    }
+    return _results;
+  };
+
+  exports.count = function(string, substr) {
+    var num, pos;
+    num = pos = 0;
+    if (!substr.length) {
+      return 1 / 0;
+    }
+    while (pos = 1 + string.indexOf(substr, pos)) {
+      num++;
+    }
+    return num;
+  };
+
+  exports.merge = function(options, overrides) {
+    return extend(extend({}, options), overrides);
+  };
+
+  extend = exports.extend = function(object, properties) {
+    var key, val;
+    for (key in properties) {
+      val = properties[key];
+      object[key] = val;
+    }
+    return object;
+  };
+
+  exports.flatten = flatten = function(array) {
+    var element, flattened, _i, _len;
+    flattened = [];
+    for (_i = 0, _len = array.length; _i < _len; _i++) {
+      element = array[_i];
+      if (element instanceof Array) {
+        flattened = flattened.concat(flatten(element));
+      } else {
+        flattened.push(element);
+      }
+    }
+    return flattened;
+  };
+
+  exports.del = function(obj, key) {
+    var val;
+    val = obj[key];
+    delete obj[key];
+    return val;
+  };
+
+  exports.last = last = function(array, back) {
+    return array[array.length - (back || 0) - 1];
+  };
+
+  exports.some = (_ref = Array.prototype.some) != null ? _ref : function(fn) {
+    var e, _i, _len;
+    for (_i = 0, _len = this.length; _i < _len; _i++) {
+      e = this[_i];
+      if (fn(e)) {
+        return true;
+      }
+    }
+    return false;
+  };
+
+  exports.invertLiterate = function(code) {
+    var line, lines, maybe_code;
+    maybe_code = true;
+    lines = (function() {
+      var _i, _len, _ref1, _results;
+      _ref1 = code.split('\n');
+      _results = [];
+      for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
+        line = _ref1[_i];
+        if (maybe_code && /^([ ]{4}|[ ]{0,3}\t)/.test(line)) {
+          _results.push(line);
+        } else if (maybe_code = /^\s*$/.test(line)) {
+          _results.push(line);
+        } else {
+          _results.push('# ' + line);
+        }
+      }
+      return _results;
+    })();
+    return lines.join('\n');
+  };
+
+  buildLocationData = function(first, last) {
+    if (!last) {
+      return first;
+    } else {
+      return {
+        first_line: first.first_line,
+        first_column: first.first_column,
+        last_line: last.last_line,
+        last_column: last.last_column
+      };
+    }
+  };
+
+  exports.addLocationDataFn = function(first, last) {
+    return function(obj) {
+      if (((typeof obj) === 'object') && (!!obj['updateLocationDataIfMissing'])) {
+        obj.updateLocationDataIfMissing(buildLocationData(first, last));
+      }
+      return obj;
+    };
+  };
+
+  exports.locationDataToString = function(obj) {
+    var locationData;
+    if (("2" in obj) && ("first_line" in obj[2])) {
+      locationData = obj[2];
+    } else if ("first_line" in obj) {
+      locationData = obj;
+    }
+    if (locationData) {
+      return ("" + (locationData.first_line + 1) + ":" + (locationData.first_column + 1) + "-") + ("" + (locationData.last_line + 1) + ":" + (locationData.last_column + 1));
+    } else {
+      return "No location data";
+    }
+  };
+
+  exports.baseFileName = function(file, stripExt, useWinPathSep) {
+    var parts, pathSep;
+    if (stripExt == null) {
+      stripExt = false;
+    }
+    if (useWinPathSep == null) {
+      useWinPathSep = false;
+    }
+    pathSep = useWinPathSep ? /\\|\// : /\//;
+    parts = file.split(pathSep);
+    file = parts[parts.length - 1];
+    if (!stripExt) {
+      return file;
+    }
+    parts = file.split('.');
+    parts.pop();
+    if (parts[parts.length - 1] === 'coffee' && parts.length > 1) {
+      parts.pop();
+    }
+    return parts.join('.');
+  };
+
+  exports.isCoffee = function(file) {
+    return /\.((lit)?coffee|coffee\.md)$/.test(file);
+  };
+
+  exports.isLiterate = function(file) {
+    return /\.(litcoffee|coffee\.md)$/.test(file);
+  };
+
+  exports.throwSyntaxError = function(message, location) {
+    var error;
+    if (location.last_line == null) {
+      location.last_line = location.first_line;
+    }
+    if (location.last_column == null) {
+      location.last_column = location.first_column;
+    }
+    error = new SyntaxError(message);
+    error.location = location;
+    error.toString = syntaxErrorToString;
+    error.stack = error.toString();
+    throw error;
+  };
+
+  exports.updateSyntaxError = function(error, code, filename) {
+    if (error.toString === syntaxErrorToString) {
+      error.code || (error.code = code);
+      error.filename || (error.filename = filename);
+      error.stack = error.toString();
+    }
+    return error;
+  };
+
+  syntaxErrorToString = function() {
+    var codeLine, colorize, colorsEnabled, end, filename, first_column, first_line, last_column, last_line, marker, start, _ref1, _ref2;
+    if (!(this.code && this.location)) {
+      return Error.prototype.toString.call(this);
+    }
+    _ref1 = this.location, first_line = _ref1.first_line, first_column = _ref1.first_column, last_line = _ref1.last_line, last_column = _ref1.last_column;
+    if (last_line == null) {
+      last_line = first_line;
+    }
+    if (last_column == null) {
+      last_column = first_column;
+    }
+    filename = this.filename || '[stdin]';
+    codeLine = this.code.split('\n')[first_line];
+    start = first_column;
+    end = first_line === last_line ? last_column + 1 : codeLine.length;
+    marker = repeat(' ', start) + repeat('^', end - start);
+    if (typeof process !== "undefined" && process !== null) {
+      colorsEnabled = process.stdout.isTTY && !process.env.NODE_DISABLE_COLORS;
+    }
+    if ((_ref2 = this.colorful) != null ? _ref2 : colorsEnabled) {
+      colorize = function(str) {
+        return "\x1B[1;31m" + str + "\x1B[0m";
+      };
+      codeLine = codeLine.slice(0, start) + colorize(codeLine.slice(start, end)) + codeLine.slice(end);
+      marker = colorize(marker);
+    }
+    return "" + filename + ":" + (first_line + 1) + ":" + (first_column + 1) + ": error: " + this.message + "\n" + codeLine + "\n" + marker;
+  };
+
+
+});
\ No newline at end of file


[15/51] [partial] working replacement

Posted by ga...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/julia.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/julia.js b/src/fauxton/assets/js/libs/ace/mode/julia.js
new file mode 100644
index 0000000..a85ba2f
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/julia.js
@@ -0,0 +1,62 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ *
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var JuliaHighlightRules = require("./julia_highlight_rules").JuliaHighlightRules;
+// TODO: pick appropriate fold mode
+var FoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = JuliaHighlightRules;
+    this.foldingRules = new FoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = "#";
+    this.blockComment = "";
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/julia_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/julia_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/julia_highlight_rules.js
new file mode 100644
index 0000000..fabec1e
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/julia_highlight_rules.js
@@ -0,0 +1,170 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* This file was autogenerated from https://raw.github.com/JuliaLang/julia/master/contrib/Julia.tmbundle/Syntaxes/Julia.tmLanguage (uuid: ) */
+/****************************************************************************************
+ * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
+ * fileTypes                                                                            *
+ ****************************************************************************************/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var JuliaHighlightRules = function() {
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = { start: 
+       [ { include: '#function_decl' },
+         { include: '#function_call' },
+         { include: '#type_decl' },
+         { include: '#keyword' },
+         { include: '#operator' },
+         { include: '#number' },
+         { include: '#string' },
+         { include: '#comment' } ],
+      '#bracket': 
+       [ { token: 'keyword.bracket.julia',
+           regex: '\\(|\\)|\\[|\\]|\\{|\\}|,' } ],
+      '#comment': 
+       [ { token: 
+            [ 'punctuation.definition.comment.julia',
+              'comment.line.number-sign.julia' ],
+           regex: '(#)(?!\\{)(.*$)'} ],
+      '#function_call': 
+       [ { token: [ 'support.function.julia', 'text' ],
+           regex: '([a-zA-Z0-9_]+!?)(\\w*\\()'} ],
+      '#function_decl': 
+       [ { token: [ 'keyword.other.julia', 'meta.function.julia',
+               'entity.name.function.julia', 'meta.function.julia','text' ],
+           regex: '(function|macro)(\\s*)([a-zA-Z0-9_\\{]+!?)(\\w*)([(\\\\{])'} ],
+      '#keyword':
+       [ { token: 'keyword.other.julia',
+           regex: '\\b(?:function|type|immutable|macro|quote|abstract|bitstype|typealias|module|baremodule|new)\\b' },
+         { token: 'keyword.control.julia',
+           regex: '\\b(?:if|else|elseif|while|for|in|begin|let|end|do|try|catch|finally|return|break|continue)\\b' },
+         { token: 'storage.modifier.variable.julia',
+           regex: '\\b(?:global|local|const|export|import|importall|using)\\b' },
+         { token: 'variable.macro.julia', regex: '@\\w+\\b' } ],
+      '#number': 
+       [ { token: 'constant.numeric.julia',
+           regex: '\\b0(?:x|X)[0-9a-fA-F]*|(?:\\b[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:(?:e|E)(?:\\+|-)?[0-9]*)?(?:im)?|\\bInf(?:32)?\\b|\\bNaN(?:32)?\\b|\\btrue\\b|\\bfalse\\b' } ],
+      '#operator': 
+       [ { token: 'keyword.operator.update.julia',
+           regex: '=|:=|\\+=|-=|\\*=|/=|//=|\\.//=|\\.\\*=|\\\\=|\\.\\\\=|^=|\\.^=|%=|\\|=|&=|\\$=|<<=|>>=' },
+         { token: 'keyword.operator.ternary.julia', regex: '\\?|:' },
+         { token: 'keyword.operator.boolean.julia',
+           regex: '\\|\\||&&|!' },
+         { token: 'keyword.operator.arrow.julia', regex: '->|<-|-->' },
+         { token: 'keyword.operator.relation.julia',
+           regex: '>|<|>=|<=|==|!=|\\.>|\\.<|\\.>=|\\.>=|\\.==|\\.!=|\\.=|\\.!|<:|:>' },
+         { token: 'keyword.operator.range.julia', regex: ':' },
+         { token: 'keyword.operator.shift.julia', regex: '<<|>>' },
+         { token: 'keyword.operator.bitwise.julia', regex: '\\||\\&|~' },
+         { token: 'keyword.operator.arithmetic.julia',
+           regex: '\\+|-|\\*|\\.\\*|/|\\./|//|\\.//|%|\\.%|\\\\|\\.\\\\|\\^|\\.\\^' },
+         { token: 'keyword.operator.isa.julia', regex: '::' },
+         { token: 'keyword.operator.dots.julia',
+           regex: '\\.(?=[a-zA-Z])|\\.\\.+' },
+         { token: 'keyword.operator.interpolation.julia',
+           regex: '\\$#?(?=.)' },
+         { token: [ 'variable', 'keyword.operator.transposed-variable.julia' ],
+           regex: '(\\w+)((?:\'|\\.\')*\\.?\')' },
+         { token: 'text',
+           regex: '\\[|\\('},
+         { token: [ 'text', 'keyword.operator.transposed-matrix.julia' ],
+            regex: "([\\]\\)])((?:'|\\.')*\\.?')"} ],
+      '#string': 
+       [ { token: 'punctuation.definition.string.begin.julia',
+           regex: '\'',
+           push: 
+            [ { token: 'punctuation.definition.string.end.julia',
+                regex: '\'',
+                next: 'pop' },
+              { include: '#string_escaped_char' },
+              { defaultToken: 'string.quoted.single.julia' } ] },
+         { token: 'punctuation.definition.string.begin.julia',
+           regex: '"',
+           push: 
+            [ { token: 'punctuation.definition.string.end.julia',
+                regex: '"',
+                next: 'pop' },
+              { include: '#string_escaped_char' },
+              { defaultToken: 'string.quoted.double.julia' } ] },
+         { token: 'punctuation.definition.string.begin.julia',
+           regex: '\\b\\w+"',
+           push: 
+            [ { token: 'punctuation.definition.string.end.julia',
+                regex: '"\\w*',
+                next: 'pop' },
+              { include: '#string_custom_escaped_char' },
+              { defaultToken: 'string.quoted.custom-double.julia' } ] },
+         { token: 'punctuation.definition.string.begin.julia',
+           regex: '`',
+           push: 
+            [ { token: 'punctuation.definition.string.end.julia',
+                regex: '`',
+                next: 'pop' },
+              { include: '#string_escaped_char' },
+              { defaultToken: 'string.quoted.backtick.julia' } ] } ],
+      '#string_custom_escaped_char': [ { token: 'constant.character.escape.julia', regex: '\\\\"' } ],
+      '#string_escaped_char': 
+       [ { token: 'constant.character.escape.julia',
+           regex: '\\\\(?:\\\\|[0-3]\\d{,2}|[4-7]\\d?|x[a-fA-F0-9]{,2}|u[a-fA-F0-9]{,4}|U[a-fA-F0-9]{,8}|.)' } ],
+      '#type_decl': 
+       [ { token: 
+            [ 'keyword.control.type.julia',
+              'meta.type.julia',
+              'entity.name.type.julia',
+              'entity.other.inherited-class.julia',
+              'punctuation.separator.inheritance.julia',
+              'entity.other.inherited-class.julia' ],
+           regex: '(type|immutable)(\\s+)([a-zA-Z0-9_]+)(?:(\\s*)(<:)(\\s*[.a-zA-Z0-9_:]+))?' },
+         { token: [ 'other.typed-variable.julia', 'support.type.julia' ],
+           regex: '([a-zA-Z0-9_]+)(::[a-zA-Z0-9_{}]+)' } ] }
+    
+    this.normalizeRules();
+};
+
+JuliaHighlightRules.metaData = { fileTypes: [ 'jl' ],
+      firstLineMatch: '^#!.*\\bjulia\\s*$',
+      foldingStartMarker: '^\\s*(?:if|while|for|begin|function|macro|module|baremodule|type|immutable|let)\\b(?!.*\\bend\\b).*$',
+      foldingStopMarker: '^\\s*(?:end)\\b.*$',
+      name: 'Julia',
+      scopeName: 'source.julia' }
+
+
+oop.inherits(JuliaHighlightRules, TextHighlightRules);
+
+exports.JuliaHighlightRules = JuliaHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/latex.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/latex.js b/src/fauxton/assets/js/libs/ace/mode/latex.js
new file mode 100644
index 0000000..6d932a6
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/latex.js
@@ -0,0 +1,24 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var LatexHighlightRules = require("./latex_highlight_rules").LatexHighlightRules;
+var LatexFoldMode = require("./folding/latex").FoldMode;
+var Range = require("../range").Range;
+
+var Mode = function() {
+    this.HighlightRules = LatexHighlightRules;
+    this.foldingRules = new LatexFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = "%";
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/latex_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/latex_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/latex_highlight_rules.js
new file mode 100644
index 0000000..3057c0d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/latex_highlight_rules.js
@@ -0,0 +1,38 @@
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var LatexHighlightRules = function() {   
+    this.$rules = {
+        "start" : [{
+            // A tex command e.g. \foo
+            token : "keyword",
+            regex : "\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"
+        }, {
+            // Curly and square braces
+            token : "lparen",
+            regex : "[[({]"
+        }, {
+            // Curly and square braces
+            token : "rparen",
+            regex : "[\\])}]"
+        }, {
+            // Inline math between two $ symbols
+            token : "string",
+            regex : "\\$(?:(?:\\\\.)|(?:[^\\$\\\\]))*?\\$"
+        }, {
+            // A comment. Tex comments start with % and go to 
+            // the end of the line
+            token : "comment",
+            regex : "%.*$"
+        }]
+    };
+};
+
+oop.inherits(LatexHighlightRules, TextHighlightRules);
+
+exports.LatexHighlightRules = LatexHighlightRules;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/less.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/less.js b/src/fauxton/assets/js/libs/ace/mode/less.js
new file mode 100644
index 0000000..ac40a0a
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/less.js
@@ -0,0 +1,84 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var LessHighlightRules = require("./less_highlight_rules").LessHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var CssBehaviour = require("./behaviour/css").CssBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+
+var Mode = function() {
+    this.HighlightRules = LessHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new CssBehaviour();
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = "//";
+    this.blockComment = {start: "/*", end: "*/"};
+    
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        // ignore braces in comments
+        var tokens = this.getTokenizer().getLineTokens(line, state).tokens;
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+
+        var match = line.match(/^.*\{\s*$/);
+        if (match) {
+            indent += tab;
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/less_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/less_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/less_highlight_rules.js
new file mode 100644
index 0000000..d39bdea
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/less_highlight_rules.js
@@ -0,0 +1,271 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var lang = require("../lib/lang");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var LessHighlightRules = function() {
+    
+    var properties = lang.arrayToMap( (function () {
+
+        var browserPrefix = ("-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-").split("|");
+        
+        var prefixProperties = ("appearance|background-clip|background-inline-policy|background-origin|" + 
+             "background-size|binding|border-bottom-colors|border-left-colors|" + 
+             "border-right-colors|border-top-colors|border-end|border-end-color|" + 
+             "border-end-style|border-end-width|border-image|border-start|" + 
+             "border-start-color|border-start-style|border-start-width|box-align|" + 
+             "box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|" + 
+             "box-pack|box-sizing|column-count|column-gap|column-width|column-rule|" + 
+             "column-rule-width|column-rule-style|column-rule-color|float-edge|" + 
+             "font-feature-settings|font-language-override|force-broken-image-icon|" + 
+             "image-region|margin-end|margin-start|opacity|outline|outline-color|" + 
+             "outline-offset|outline-radius|outline-radius-bottomleft|" + 
+             "outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|" + 
+             "outline-style|outline-width|padding-end|padding-start|stack-sizing|" + 
+             "tab-size|text-blink|text-decoration-color|text-decoration-line|" + 
+             "text-decoration-style|transform|transform-origin|transition|" + 
+             "transition-delay|transition-duration|transition-property|" + 
+             "transition-timing-function|user-focus|user-input|user-modify|user-select|" +
+             "window-shadow|border-radius").split("|");
+        
+        var properties = ("azimuth|background-attachment|background-color|background-image|" +
+            "background-position|background-repeat|background|border-bottom-color|" +
+            "border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
+            "border-color|border-left-color|border-left-style|border-left-width|" +
+            "border-left|border-right-color|border-right-style|border-right-width|" +
+            "border-right|border-spacing|border-style|border-top-color|" +
+            "border-top-style|border-top-width|border-top|border-width|border|" +
+            "bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
+            "counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
+            "elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
+            "font-stretch|font-style|font-variant|font-weight|font|height|left|" +
+            "letter-spacing|line-height|list-style-image|list-style-position|" +
+            "list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
+            "margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
+            "min-width|opacity|orphans|outline-color|" +
+            "outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
+            "padding-left|padding-right|padding-top|padding|page-break-after|" +
+            "page-break-before|page-break-inside|page|pause-after|pause-before|" +
+            "pause|pitch-range|pitch|play-during|position|quotes|richness|right|" +
+            "size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
+            "stress|table-layout|text-align|text-decoration|text-indent|" +
+            "text-shadow|text-transform|top|unicode-bidi|vertical-align|" +
+            "visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
+            "z-index").split("|");
+          
+        //The return array     
+        var ret = [];
+        
+        //All prefixProperties will get the browserPrefix in
+        //the begning by join the prefixProperties array with the value of browserPrefix
+        for (var i=0, ln=browserPrefix.length; i<ln; i++) {
+            Array.prototype.push.apply(
+                ret,
+                (( browserPrefix[i] + prefixProperties.join("|" + browserPrefix[i]) ).split("|"))
+            );
+        }
+        
+        //Add also prefixProperties and properties without any browser prefix
+        Array.prototype.push.apply(ret, prefixProperties);
+        Array.prototype.push.apply(ret, properties);
+        
+        return ret;
+        
+    })() );
+    
+
+
+    var functions = lang.arrayToMap(
+        ("hsl|hsla|rgb|rgba|url|attr|counter|counters|lighten|darken|saturate|" +
+        "desaturate|fadein|fadeout|fade|spin|mix|hue|saturation|lightness|" +
+        "alpha|round|ceil|floor|percentage|color|iscolor|isnumber|isstring|" +
+        "iskeyword|isurl|ispixel|ispercentage|isem").split("|")
+    );
+
+    var constants = lang.arrayToMap(
+        ("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
+        "block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
+        "char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
+        "decimal-leading-zero|decimal|default|disabled|disc|" +
+        "distribute-all-lines|distribute-letter|distribute-space|" +
+        "distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
+        "hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
+        "ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
+        "ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
+        "inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
+        "keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
+        "lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
+        "medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
+        "nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
+        "overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
+        "ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
+        "solid|square|static|strict|super|sw-resize|table-footer-group|" +
+        "table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
+        "transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
+        "vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
+        "zero").split("|")
+    );
+
+    var colors = lang.arrayToMap(
+        ("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
+        "purple|red|silver|teal|white|yellow").split("|")
+    );
+    
+    var keywords = lang.arrayToMap(
+        ("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|" +
+        "@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|" +
+        "def|end|declare|when|not|and").split("|")
+    );
+    
+    var tags = lang.arrayToMap(
+        ("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" + 
+         "big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" + 
+         "command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" + 
+         "figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" + 
+         "header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" + 
+         "link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" + 
+         "option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" + 
+         "small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" + 
+         "textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
+    );
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = {
+        "start" : [
+            {
+                token : "comment",
+                regex : "\\/\\/.*$"
+            },
+            {
+                token : "comment", // multi line comment
+                regex : "\\/\\*",
+                next : "comment"
+            }, {
+                token : "string", // single line
+                regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+            }, {
+                token : "string", // single line
+                regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+            }, {
+                token : "constant.numeric",
+                regex : numRe + "(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)"
+            }, {
+                token : "constant.numeric", // hex6 color
+                regex : "#[a-f0-9]{6}"
+            }, {
+                token : "constant.numeric", // hex3 color
+                regex : "#[a-f0-9]{3}"
+            }, {
+                token : "constant.numeric",
+                regex : numRe
+            }, {
+                token : function(value) {
+                    if (keywords.hasOwnProperty(value))
+                        return "keyword";
+                    else
+                        return "variable";
+                },
+                regex : "@[a-z0-9_\\-@]*\\b"
+            }, {
+                token : function(value) {
+                    if (properties.hasOwnProperty(value.toLowerCase()))
+                        return "support.type";
+                    else if (keywords.hasOwnProperty(value))
+                        return "keyword";
+                    else if (constants.hasOwnProperty(value))
+                        return "constant.language";
+                    else if (functions.hasOwnProperty(value))
+                        return "support.function";
+                    else if (colors.hasOwnProperty(value.toLowerCase()))
+                        return "support.constant.color";
+                    else if (tags.hasOwnProperty(value.toLowerCase()))
+                        return "variable.language";
+                    else
+                        return "text";
+                },
+                regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
+            }, {
+                token: "variable.language",
+                regex: "#[a-z0-9-_]+"
+            }, {
+                token: "variable.language",
+                regex: "\\.[a-z0-9-_]+"
+            }, {
+                token: "variable.language",
+                regex: ":[a-z0-9-_]+"
+            }, {
+                token: "constant",
+                regex: "[a-z0-9-_]+"
+            }, {
+                token : "keyword.operator",
+                regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*"
+            }, {
+                token : "paren.lparen",
+                regex : "[[({]"
+            }, {
+                token : "paren.rparen",
+                regex : "[\\])}]"
+            }, {
+                token : "text",
+                regex : "\\s+"
+            }, {
+                caseInsensitive: true
+            }
+        ],
+        "comment" : [
+            {
+                token : "comment", // closing comment
+                regex : ".*?\\*\\/",
+                next : "start"
+            }, {
+                token : "comment", // comment spanning whole line
+                regex : ".+"
+            }
+        ]
+    };
+};
+
+oop.inherits(LessHighlightRules, TextHighlightRules);
+
+exports.LessHighlightRules = LessHighlightRules;
+
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/liquid.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/liquid.js b/src/fauxton/assets/js/libs/ace/mode/liquid.js
new file mode 100644
index 0000000..490be89
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/liquid.js
@@ -0,0 +1,82 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var LiquidHighlightRules = require("./liquid_highlight_rules").LiquidHighlightRules;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var Range = require("../range").Range;
+
+var Mode = function() {
+    this.HighlightRules = LiquidHighlightRules;
+    this.$outdent = new MatchingBraceOutdent();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.blockComment = {start: "<!--", end: "-->"};
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+        var endState = tokenizedLine.state;
+
+        if (tokens.length && tokens[tokens.length-1].type == "comment") {
+            return indent;
+        }
+
+        if (state == "start") {
+            var match = line.match(/^.*[\{\(\[]\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/liquid_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/liquid_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/liquid_highlight_rules.js
new file mode 100644
index 0000000..50a9376
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/liquid_highlight_rules.js
@@ -0,0 +1,131 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
+
+var LiquidHighlightRules = function() {
+    HtmlHighlightRules.call(this);
+
+    // see: https://developer.mozilla.org/en/Liquid/Reference/Global_Objects
+    var functions = (
+      // Standard Filters
+        "date|capitalize|downcase|upcase|first|last|join|sort|map|size|escape|" +
+         "escape_once|strip_html|strip_newlines|newline_to_br|replace|replace_first|" +
+         "truncate|truncatewords|prepend|append|minus|plus|times|divided_by|split"
+    );
+
+    var keywords = (
+      // Standard Tags
+        "capture|endcapture|case|endcase|when|comment|endcomment|" +
+        "cycle|for|endfor|in|reversed|if|endif|else|elsif|include|endinclude|unless|endunless|" +
+      // Commonly used tags
+        "style|text|image|widget|plugin|marker|endmarker|tablerow|endtablerow"
+    );
+
+    var builtinVariables = 'forloop|tablerowloop';
+        // "forloop\\.(length|index|index0|rindex|rindex0|first|last)|limit|offset|range" +
+        // "tablerowloop\\.(length|index|index0|rindex|rindex0|first|last|col|col0|"+
+        // "col_first|col_last)"
+
+    var definitions = ("assign");
+
+    var keywordMapper = this.createKeywordMapper({
+        "variable.language": builtinVariables,
+        "keyword": keywords,
+        "support.function": functions,
+        "keyword.definition": definitions
+    }, "identifier");
+
+    // add liquid start tags to the HTML start tags
+    for (var rule in this.$rules) {
+        this.$rules[rule].unshift({
+            token : "variable",
+            regex : "{%",
+            push : "liquid-start"
+        }, {
+            token : "variable",
+            regex : "{{",
+            push : "liquid-start"
+        });
+    }
+
+    this.addRules({
+        "liquid-start" : [{
+            token: "variable",
+            regex: "}}",
+            next: "pop"
+        }, {
+            token: "variable",
+            regex: "%}",
+            next: "pop"
+        }, {
+            token : "string", // single line
+            regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
+        }, {
+            token : "string", // single line
+            regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
+        }, {
+            token : "constant.numeric", // hex
+            regex : "0[xX][0-9a-fA-F]+\\b"
+        }, {
+            token : "constant.numeric", // float
+            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
+        }, {
+            token : "constant.language.boolean",
+            regex : "(?:true|false)\\b"
+        }, {
+            token : keywordMapper,
+            regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        }, {
+            token : "keyword.operator",
+            regex : "\/|\\*|\\-|\\+|=|!=|\\?\\:"
+        }, {
+            token : "paren.lparen",
+            regex : /[\[\({]/
+        }, {
+            token : "paren.rparen",
+            regex : /[\])}]/
+        }, {
+            token : "text",
+            regex : "\\s+"
+        }]
+    });
+
+    this.normalizeRules();
+};
+oop.inherits(LiquidHighlightRules, TextHighlightRules);
+
+exports.LiquidHighlightRules = LiquidHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/lisp.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/lisp.js b/src/fauxton/assets/js/libs/ace/mode/lisp.js
new file mode 100644
index 0000000..3762c17
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/lisp.js
@@ -0,0 +1,56 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+  THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
+*/
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var LispHighlightRules = require("./lisp_highlight_rules").LispHighlightRules;
+
+var Mode = function() {
+    this.HighlightRules = LispHighlightRules;
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+       
+    this.lineCommentStart = ";";
+    
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/lisp_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/lisp_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/lisp_highlight_rules.js
new file mode 100644
index 0000000..06f7344
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/lisp_highlight_rules.js
@@ -0,0 +1,124 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ * Contributor(s):
+ * 
+ * Garen J. Torikian <gjtorikian @ gmail DOT com>
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+ /*
+  THIS FILE WAS AUTOGENERATED BY Lisp.tmlanguage (UUID: 00D451C9-6B1D-11D9-8DFA-000D93589AF6) */
+
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var LispHighlightRules = function() {
+    var keywordControl = "case|do|let|loop|if|else|when";
+    var keywordOperator = "eq|neq|and|or";
+    var constantLanguage = "null|nil";
+    var supportFunctions = "cons|car|cdr|cond|lambda|format|setq|setf|quote|eval|append|list|listp|memberp|t|load|progn";
+
+    var keywordMapper = this.createKeywordMapper({
+        "keyword.control": keywordControl,
+        "keyword.operator": keywordOperator,
+        "constant.language": constantLanguage,
+        "support.function": supportFunctions
+    }, "identifier", true);
+
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = 
+        {
+    "start": [
+        {
+            token : "comment",
+            regex : ";.*$"
+        },
+        {
+            token: ["storage.type.function-type.lisp", "text", "entity.name.function.lisp"],
+            regex: "(?:\\b(?:(defun|defmethod|defmacro))\\b)(\\s+)((?:\\w|\\-|\\!|\\?)*)"
+        },
+        {
+            token: ["punctuation.definition.constant.character.lisp", "constant.character.lisp"],
+            regex: "(#)((?:\\w|[\\\\+-=<>'\"&#])+)"
+        },
+        {
+            token: ["punctuation.definition.variable.lisp", "variable.other.global.lisp", "punctuation.definition.variable.lisp"],
+            regex: "(\\*)(\\S*)(\\*)"
+        },
+        {
+            token : "constant.numeric", // hex
+            regex : "0[xX][0-9a-fA-F]+(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
+        }, 
+        {
+            token : "constant.numeric", // float
+            regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b"
+        },
+        {
+                token : keywordMapper,
+                regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
+        },
+        {
+            token : "string",
+            regex : '"(?=.)',
+            next  : "qqstring"
+        }
+    ],
+    "qqstring": [
+        {
+            token: "constant.character.escape.lisp",
+            regex: "\\\\."
+        },
+        {
+            token : "string",
+            regex : '[^"\\\\]+'
+        }, {
+            token : "string",
+            regex : "\\\\$",
+            next  : "qqstring"
+        }, {
+            token : "string",
+            regex : '"|$',
+            next  : "start"
+        }
+    ]
+}
+
+};
+
+oop.inherits(LispHighlightRules, TextHighlightRules);
+
+exports.LispHighlightRules = LispHighlightRules;
+});

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/livescript.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/livescript.js b/src/fauxton/assets/js/libs/ace/mode/livescript.js
new file mode 100644
index 0000000..5f759d9
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/livescript.js
@@ -0,0 +1,248 @@
+define(function(require, exports, module){
+  var identifier, LiveScriptMode, keywordend, stringfill;
+  identifier = '(?![\\d\\s])[$\\w\\xAA-\\uFFDC](?:(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])*';
+  exports.Mode = LiveScriptMode = (function(superclass){
+    var indenter, prototype = extend$((import$(LiveScriptMode, superclass).displayName = 'LiveScriptMode', LiveScriptMode), superclass).prototype, constructor = LiveScriptMode;
+    function LiveScriptMode(){
+      var that;
+      this.$tokenizer = new (require('../tokenizer')).Tokenizer(LiveScriptMode.Rules);
+      if (that = require('../mode/matching_brace_outdent')) {
+        this.$outdent = new that.MatchingBraceOutdent;
+      }
+    }
+    indenter = RegExp('(?:[({[=:]|[-~]>|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*' + identifier + ')?))\\s*$');
+    prototype.getNextLineIndent = function(state, line, tab){
+      var indent, tokens;
+      indent = this.$getIndent(line);
+      tokens = this.$tokenizer.getLineTokens(line, state).tokens;
+      if (!(tokens.length && tokens[tokens.length - 1].type === 'comment')) {
+        if (state === 'start' && indenter.test(line)) {
+          indent += tab;
+        }
+      }
+      return indent;
+    };
+    prototype.toggleCommentLines = function(state, doc, startRow, endRow){
+      var comment, range, i$, i, out, line;
+      comment = /^(\s*)#/;
+      range = new (require('../range')).Range(0, 0, 0, 0);
+      for (i$ = startRow; i$ <= endRow; ++i$) {
+        i = i$;
+        if (out = comment.test(line = doc.getLine(i))) {
+          line = line.replace(comment, '$1');
+        } else {
+          line = line.replace(/^\s*/, '$&#');
+        }
+        range.end.row = range.start.row = i;
+        range.end.column = line.length + 1;
+        doc.replace(range, line);
+      }
+      return 1 - out * 2;
+    };
+    prototype.checkOutdent = function(state, line, input){
+      var ref$;
+      return (ref$ = this.$outdent) != null ? ref$.checkOutdent(line, input) : void 8;
+    };
+    prototype.autoOutdent = function(state, doc, row){
+      var ref$;
+      return (ref$ = this.$outdent) != null ? ref$.autoOutdent(doc, row) : void 8;
+    };
+    return LiveScriptMode;
+  }(require('../mode/text').Mode));
+  keywordend = '(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))';
+  stringfill = {
+    token: 'string',
+    regex: '.+'
+  };
+  LiveScriptMode.Rules = {
+    start: [
+      {
+        token: 'keyword',
+        regex: '(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var|loop)' + keywordend
+      }, {
+        token: 'constant.language',
+        regex: '(?:true|false|yes|no|on|off|null|void|undefined)' + keywordend
+      }, {
+        token: 'invalid.illegal',
+        regex: '(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)' + keywordend
+      }, {
+        token: 'language.support.class',
+        regex: '(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)' + keywordend
+      }, {
+        token: 'language.support.function',
+        regex: '(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)' + keywordend
+      }, {
+        token: 'variable.language',
+        regex: '(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)' + keywordend
+      }, {
+        token: 'identifier',
+        regex: identifier + '\\s*:(?![:=])'
+      }, {
+        token: 'variable',
+        regex: identifier
+      }, {
+        token: 'keyword.operator',
+        regex: '(?:\\.{3}|\\s+\\?)'
+      }, {
+        token: 'keyword.variable',
+        regex: '(?:@+|::|\\.\\.)',
+        next: 'key'
+      }, {
+        token: 'keyword.operator',
+        regex: '\\.\\s*',
+        next: 'key'
+      }, {
+        token: 'string',
+        regex: '\\\\\\S[^\\s,;)}\\]]*'
+      }, {
+        token: 'string.doc',
+        regex: '\'\'\'',
+        next: 'qdoc'
+      }, {
+        token: 'string.doc',
+        regex: '"""',
+        next: 'qqdoc'
+      }, {
+        token: 'string',
+        regex: '\'',
+        next: 'qstring'
+      }, {
+        token: 'string',
+        regex: '"',
+        next: 'qqstring'
+      }, {
+        token: 'string',
+        regex: '`',
+        next: 'js'
+      }, {
+        token: 'string',
+        regex: '<\\[',
+        next: 'words'
+      }, {
+        token: 'string.regex',
+        regex: '//',
+        next: 'heregex'
+      }, {
+        token: 'comment.doc',
+        regex: '/\\*',
+        next: 'comment'
+      }, {
+        token: 'comment',
+        regex: '#.*'
+      }, {
+        token: 'string.regex',
+        regex: '\\/(?:[^[\\/\\n\\\\]*(?:(?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[\\/\\n\\\\]*)*)\\/[gimy$]{0,4}',
+        next: 'key'
+      }, {
+        token: 'constant.numeric',
+        regex: '(?:0x[\\da-fA-F][\\da-fA-F_]*|(?:[2-9]|[12]\\d|3[0-6])r[\\da-zA-Z][\\da-zA-Z_]*|(?:\\d[\\d_]*(?:\\.\\d[\\d_]*)?|\\.\\d[\\d_]*)(?:e[+-]?\\d[\\d_]*)?[\\w$]*)'
+      }, {
+        token: 'lparen',
+        regex: '[({[]'
+      }, {
+        token: 'rparen',
+        regex: '[)}\\]]',
+        next: 'key'
+      }, {
+        token: 'keyword.operator',
+        regex: '\\S+'
+      }, {
+        token: 'text',
+        regex: '\\s+'
+      }
+    ],
+    heregex: [
+      {
+        token: 'string.regex',
+        regex: '.*?//[gimy$?]{0,4}',
+        next: 'start'
+      }, {
+        token: 'string.regex',
+        regex: '\\s*#{'
+      }, {
+        token: 'comment.regex',
+        regex: '\\s+(?:#.*)?'
+      }, {
+        token: 'string.regex',
+        regex: '\\S+'
+      }
+    ],
+    key: [
+      {
+        token: 'keyword.operator',
+        regex: '[.?@!]+'
+      }, {
+        token: 'identifier',
+        regex: identifier,
+        next: 'start'
+      }, {
+        token: 'text',
+        regex: '.',
+        next: 'start'
+      }
+    ],
+    comment: [
+      {
+        token: 'comment.doc',
+        regex: '.*?\\*/',
+        next: 'start'
+      }, {
+        token: 'comment.doc',
+        regex: '.+'
+      }
+    ],
+    qdoc: [
+      {
+        token: 'string',
+        regex: ".*?'''",
+        next: 'key'
+      }, stringfill
+    ],
+    qqdoc: [
+      {
+        token: 'string',
+        regex: '.*?"""',
+        next: 'key'
+      }, stringfill
+    ],
+    qstring: [
+      {
+        token: 'string',
+        regex: '[^\\\\\']*(?:\\\\.[^\\\\\']*)*\'',
+        next: 'key'
+      }, stringfill
+    ],
+    qqstring: [
+      {
+        token: 'string',
+        regex: '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
+        next: 'key'
+      }, stringfill
+    ],
+    js: [
+      {
+        token: 'string',
+        regex: '[^\\\\`]*(?:\\\\.[^\\\\`]*)*`',
+        next: 'key'
+      }, stringfill
+    ],
+    words: [
+      {
+        token: 'string',
+        regex: '.*?\\]>',
+        next: 'key'
+      }, stringfill
+    ]
+  };
+function extend$(sub, sup){
+  function fun(){} fun.prototype = (sub.superclass = sup).prototype;
+  (sub.prototype = new fun).constructor = sub;
+  if (typeof sup.extended == 'function') sup.extended(sub);
+  return sub;
+}
+function import$(obj, src){
+  var own = {}.hasOwnProperty;
+  for (var key in src) if (own.call(src, key)) obj[key] = src[key];
+  return obj;
+}
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/logiql.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/logiql.js b/src/fauxton/assets/js/libs/ace/mode/logiql.js
new file mode 100644
index 0000000..5abf7c8
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/logiql.js
@@ -0,0 +1,139 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextMode = require("./text").Mode;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var LogiQLHighlightRules = require("./logiql_highlight_rules").LogiQLHighlightRules;
+var FoldMode = require("./folding/coffee").FoldMode;
+var TokenIterator = require("../token_iterator").TokenIterator;
+var Range = require("../range").Range;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+
+var Mode = function() {
+    this.HighlightRules = LogiQLHighlightRules;
+    this.foldingRules = new FoldMode();
+    this.$outdent = new MatchingBraceOutdent();
+    this.$behaviour = new CstyleBehaviour();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+    this.lineCommentStart = "//";
+    this.blockComment = {start: "/*", end: "*/"};
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+        var endState = tokenizedLine.state;
+        if (/comment|string/.test(endState))  
+            return indent;
+        if (tokens.length && tokens[tokens.length - 1].type == "comment.single")
+            return indent;
+
+        var match = line.match();
+        if (/(-->|<--|<-|->|{)\s*$/.test(line))
+            indent += tab;
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        if (this.$outdent.checkOutdent(line, input))
+            return true;
+
+        if (input !== "\n" && input !== "\r\n")
+            return false;
+            
+        if (!/^\s+/.test(line))
+            return false;
+
+        return true;
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        if (this.$outdent.autoOutdent(doc, row))
+            return;
+        var prevLine = doc.getLine(row);
+        var match = prevLine.match(/^\s+/);
+        var column = prevLine.lastIndexOf(".") + 1;
+        if (!match || !row || !column) return 0;
+
+        var line = doc.getLine(row + 1);
+        var startRange = this.getMatching(doc, {row: row, column: column});
+        if (!startRange || startRange.start.row == row) return 0;
+
+        column = match[0].length;
+        var indent = this.$getIndent(doc.getLine(startRange.start.row));
+        doc.replace(new Range(row + 1, 0, row + 1, column), indent);
+    };
+
+    this.getMatching = function(session, row, column) {
+        if (row == undefined)
+            row = session.selection.lead
+        if (typeof row == "object") {
+            column = row.column;
+            row = row.row;
+        }
+
+        var startToken = session.getTokenAt(row, column);
+        var KW_START = "keyword.start", KW_END = "keyword.end";
+        var tok;
+        if (!startToken)
+            return;
+        if (startToken.type == KW_START) {
+            var it = new TokenIterator(session, row, column);
+            it.step = it.stepForward;
+        } else if (startToken.type == KW_END) {
+            var it = new TokenIterator(session, row, column);
+            it.step = it.stepBackward;
+        } else
+            return;
+
+        while (tok = it.step()) {
+            if (tok.type == KW_START || tok.type == KW_END)
+                break;
+        }
+        if (!tok || tok.type == startToken.type)
+            return;
+
+        var col = it.getCurrentTokenColumn();
+        var row = it.getCurrentTokenRow();
+        return new Range(row, col, row, col + tok.value.length);
+    };
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/logiql_highlight_rules.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/logiql_highlight_rules.js b/src/fauxton/assets/js/libs/ace/mode/logiql_highlight_rules.js
new file mode 100644
index 0000000..f4e505d
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/logiql_highlight_rules.js
@@ -0,0 +1,119 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2012, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/* THIS FILE WAS AUTOGENERATED FROM tool\LogicBlox.tmbundle\Syntaxes\LogicBlox.tmLanguage (UUID: 59bf5022-e261-453f-b1cb-9f9fa0712413) */
+
+define(function(require, exports, module) {
+"use strict";
+
+var oop = require("../lib/oop");
+var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
+
+var LogiQLHighlightRules = function() {
+    // regexp must not have capturing parentheses. Use (?:) instead.
+    // regexps are ordered -> the first match is used
+
+    this.$rules = { start: 
+       [ { token: 'comment.block',
+           regex: '/\\*',
+           push: 
+            [ { token: 'comment.block', regex: '\\*/', next: 'pop' },
+              { defaultToken: 'comment.block' } ],
+           //A block comment.
+            },
+         { token: 'comment.single',
+           regex: '//.*',
+           //A single line comment.
+            },
+         { token: 'constant.numeric',
+           regex: '\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?[fd]?',
+           //An integer constant.
+           //Or a Real number.
+            },
+         { token: 'string',
+           regex: '"',
+           push: 
+            [ { token: 'string', regex: '"', next: 'pop' },
+              { defaultToken: 'string' } ],
+           //Strings
+            },
+         { token: 'constant.language',
+           regex: '\\b(true|false)\\b',
+           //Boolean values.
+            },
+         { token: 'entity.name.type.logicblox',
+           regex: '`[a-zA-Z_:]+(\\d|\\a)*\\b',
+           //LogicBlox Symbol
+            },
+         { token: 'keyword.start', regex: '->',  comment: 'Constraint' },
+         { token: 'keyword.start', regex: '-->', comment: 'Level 1 Constraint'},
+         { token: 'keyword.start', regex: '<-',  comment: 'Rule' },
+         { token: 'keyword.start', regex: '<--', comment: 'Level 1 Rule' },
+         { token: 'keyword.end',   regex: '\\.', comment: 'Terminator' },
+         { token: 'keyword.other', regex: '!',   comment: 'Negation' },
+         { token: 'keyword.other', regex: ',',   comment: 'Conjunction' },
+         { token: 'keyword.other', regex: ';',   comment: 'Disjunction' },
+         { token: 'keyword.operator', regex: '<=|>=|!=|<|>', comment: 'Equality'},
+         { token: 'keyword.other', regex: '@', comment: 'Equality' },
+         { token: 'keyword.operator', regex: '\\+|-|\\*|/', comment: 'Arithmetic operations'},
+         { token: 'keyword', regex: '::', comment: 'Colon colon' },
+         { token: 'support.function',
+           regex: '\\b(agg\\s*<<)',
+           push: 
+            [ { include: '$self' },
+              { token: 'support.function',
+                regex: '>>',
+                next: 'pop' } ],
+            //Aggregations
+            },
+         { token: 'storage.modifier',
+           regex: '\\b(lang:[\\w:]*)',
+           //All the lang system predicates
+            },
+         { token: [ 'storage.type', 'text' ],
+           regex: '(export|sealed|clauses|block|alias)(\\s*\\()(?=`)',
+           //Module keywords
+            },
+         { token: 'entity.name',
+           regex: '[a-zA-Z_][a-zA-Z_0-9:]*(@prev|@init|@final)?(?=(\\(|\\[))',
+           //A predicate name.
+            },
+         { token: 'variable.parameter',
+           regex: '([a-zA-Z][a-zA-Z_0-9]*|_)\\s*(?=(,|\\.|<-|->|\\)|\\]|=))',
+           //A variable to a functional predicate.
+            } ] }
+    
+    this.normalizeRules();
+};
+
+oop.inherits(LogiQLHighlightRules, TextHighlightRules);
+
+exports.LogiQLHighlightRules = LogiQLHighlightRules;
+});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/logiql_test.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/logiql_test.js b/src/fauxton/assets/js/libs/ace/mode/logiql_test.js
new file mode 100644
index 0000000..3e66182
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/logiql_test.js
@@ -0,0 +1,99 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2010, Ajax.org B.V.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+if (typeof process !== "undefined") {
+    require("amd-loader");
+}
+
+define(function(require, exports, module) {
+"use strict";
+
+var EditSession = require("../edit_session").EditSession;
+var Tokenizer = require("../tokenizer").Tokenizer;
+var LogiQLMode = require("./logiql").Mode;
+var assert = require("../test/assertions");
+
+module.exports = {
+    setUp : function() {    
+        this.mode = new LogiQLMode();
+    },
+
+    "test: toggle comment lines should prepend '//' to each line" : function() {
+        var session = new EditSession(["    abc", "cde", "fg"]);
+
+        this.mode.toggleCommentLines("start", session, 0, 1);
+        assert.equal(["//     abc", "// cde", "fg"].join("\n"), session.toString());
+    },
+
+    "test: auto indent after ->" : function() {
+        assert.equal("  ", this.mode.getNextLineIndent("start", "parent(a, b) ->", "  "));
+    },
+    
+    "test: auto indent after <--" : function() {
+        assert.equal("  ", this.mode.getNextLineIndent("start", "foo <--    ", "  "));
+    },
+
+    "test: no auto indent in multi line comment" : function() {
+        assert.equal("", this.mode.getNextLineIndent("start", "/* -->", "  "));
+        assert.equal("  ", this.mode.getNextLineIndent("start", "  /* ->", "    "));
+        assert.equal("  ", this.mode.getNextLineIndent("comment.block", "  abcd", "  "));
+    },
+
+    "test: no auto indent after -> in single line comment" : function() {
+        assert.equal("", this.mode.getNextLineIndent("start", "//->", "  "));
+        assert.equal("  ", this.mode.getNextLineIndent("start", "  //->", "  "));
+    },
+
+    "test: trigger outdent if line ends with ." : function() {
+        assert.ok(this.mode.checkOutdent("start", "   ", "\n"));
+        assert.ok(this.mode.checkOutdent("start", " a  ", "\r\n"));
+        assert.ok(!this.mode.checkOutdent("start", "", "}"));
+        assert.ok(!this.mode.checkOutdent("start", "   ", "a }"));
+        assert.ok(!this.mode.checkOutdent("start", "   }", "}"));
+    },
+
+    "test: auto outdent should indent the line with the same indent as the line with the matching ->" : function() {
+        var session = new EditSession(["  bar (a, b) ->", "  foo(a)[1.2]", "    bla.", "    "], new LogiQLMode());
+        this.mode.autoOutdent("start", session, 2);
+        assert.equal("  ", session.getLine(3));
+    },
+
+    "test: no auto outdent if no matching brace is found" : function() {
+        var session = new EditSession(["  bar (a, b) ->", "  foo(a)[1.2].", "    bla.", "    "], new LogiQLMode());
+        this.mode.autoOutdent("start", session, 2);
+        assert.equal("    ", session.getLine(3));
+    }
+};
+
+});
+
+if (typeof module !== "undefined" && module === require.main) {
+    require("asyncjs").test.testcase(module.exports).exec()
+}

http://git-wip-us.apache.org/repos/asf/couchdb/blob/9abd128c/src/fauxton/assets/js/libs/ace/mode/lsl.js
----------------------------------------------------------------------
diff --git a/src/fauxton/assets/js/libs/ace/mode/lsl.js b/src/fauxton/assets/js/libs/ace/mode/lsl.js
new file mode 100644
index 0000000..49ecd53
--- /dev/null
+++ b/src/fauxton/assets/js/libs/ace/mode/lsl.js
@@ -0,0 +1,92 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Distributed under the BSD license:
+ *
+ * Copyright (c) 2013, Ajax.org B.V.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of Ajax.org B.V. nor the
+ *       names of its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+define(function(require, exports, module) {
+"use strict";
+
+var Tokenizer = require("../tokenizer").Tokenizer;
+var Rules = require("./lsl_highlight_rules").LSLHighlightRules;
+var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent;
+var Range = require("../range").Range;
+var TextMode = require("./text").Mode;
+var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
+var CStyleFoldMode = require("./folding/cstyle").FoldMode;
+var oop = require("../lib/oop");
+
+var Mode = function() {
+    this.HighlightRules = Rules;
+    this.$outdent = new Outdent();
+    this.$behaviour = new CstyleBehaviour();
+    this.foldingRules = new CStyleFoldMode();
+};
+oop.inherits(Mode, TextMode);
+
+(function() {
+
+    this.lineCommentStart = ["//"];
+
+    this.blockComment = {
+        start: "/*",
+        end: "*/"
+    };
+
+    this.getNextLineIndent = function(state, line, tab) {
+        var indent = this.$getIndent(line);
+
+        var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
+        var tokens = tokenizedLine.tokens;
+        var endState = tokenizedLine.state;
+
+        if (tokens.length && tokens[tokens.length-1].type === "comment.block.lsl") {
+            return indent;
+        }
+
+        if (state === "start") {
+            var match = line.match(/^.*[\{\(\[]\s*$/);
+            if (match) {
+                indent += tab;
+            }
+        }
+
+        return indent;
+    };
+
+    this.checkOutdent = function(state, line, input) {
+        return this.$outdent.checkOutdent(line, input);
+    };
+
+    this.autoOutdent = function(state, doc, row) {
+        this.$outdent.autoOutdent(doc, row);
+    };
+
+}).call(Mode.prototype);
+
+exports.Mode = Mode;
+});