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:40:06 UTC

[21/51] [partial] working replacement

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();