!function (e) { "object" == typeof exports && "object" == typeof module ? e(require("../../lib/codemirror")) : "function" == typeof define && define.amd ? define(["../../lib/codemirror"], e) : e(CodeMirror) }(function (e) { "use strict"; function t(e) { for (var t = {}, n = 0; n < e.length; n++)t[e[n]] = !0; return t } var i = t(["_", "var", "let", "actor", "class", "enum", "extension", "import", "protocol", "struct", "func", "typealias", "associatedtype", "open", "public", "internal", "fileprivate", "private", "deinit", "init", "new", "override", "self", "subscript", "super", "convenience", "dynamic", "final", "indirect", "lazy", "required", "static", "unowned", "unowned(safe)", "unowned(unsafe)", "weak", "as", "is", "break", "case", "continue", "default", "else", "fallthrough", "for", "guard", "if", "in", "repeat", "switch", "where", "while", "defer", "return", "inout", "mutating", "nonmutating", "isolated", "nonisolated", "catch", "do", "rethrows", "throw", "throws", "async", "await", "try", "didSet", "get", "set", "willSet", "assignment", "associativity", "infix", "left", "none", "operator", "postfix", "precedence", "precedencegroup", "prefix", "right", "Any", "AnyObject", "Type", "dynamicType", "Self", "Protocol", "__COLUMN__", "__FILE__", "__FUNCTION__", "__LINE__"]), o = t(["var", "let", "actor", "class", "enum", "extension", "import", "protocol", "struct", "func", "typealias", "associatedtype", "for"]), a = t(["true", "false", "nil", "self", "super", "_"]), c = t(["Array", "Bool", "Character", "Dictionary", "Double", "Float", "Int", "Int8", "Int16", "Int32", "Int64", "Never", "Optional", "Set", "String", "UInt8", "UInt16", "UInt32", "UInt64", "Void"]), u = /^\-?0b[01][01_]*/, d = /^\-?0o[0-7][0-7_]*/, f = /^\-?0x[\dA-Fa-f][\dA-Fa-f_]*(?:(?:\.[\dA-Fa-f][\dA-Fa-f_]*)?[Pp]\-?\d[\d_]*)?/, l = /^\-?\d[\d_]*(?:\.\d[\d_]*)?(?:[Ee]\-?\d[\d_]*)?/, s = /^\$\d+|(`?)[_A-Za-z][_A-Za-z$0-9]*\1/, p = /^\.(?:\$\d+|(`?)[_A-Za-z][_A-Za-z$0-9]*\1)/, m = /^\#[A-Za-z]+/, h = /^@(?:\$\d+|(`?)[_A-Za-z][_A-Za-z$0-9]*\1)/; function _(e, t, n) { if (e.sol() && (t.indented = e.indentation()), e.eatSpace()) return null; var r = e.peek(); if ("/" == r) { if (e.match("//")) return e.skipToEnd(), "comment"; if (e.match("/*")) return t.tokenize.push(v), v(e, t) } return e.match(m) ? "builtin" : e.match(h) ? "attribute" : e.match(u) || e.match(d) || e.match(f) || e.match(l) ? "number" : e.match(p) ? "property" : -1 < "+-/*%=|&<>~^?!".indexOf(r) ? (e.next(), "operator") : -1 < ":;,.(){}[]".indexOf(r) ? (e.next(), e.match(".."), "punctuation") : (r = e.match(/("""|"|')/)) ? (r = function (e, t, n) { var r, i = 1 == e.length, o = !1; for (; r = t.peek();)if (o) { if (t.next(), "(" == r) return n.tokenize.push(function () { var r = 0; return function (e, t, n) { n = _(e, t, n); if ("punctuation" == n) if ("(" == e.current()) ++r; else if (")" == e.current()) { if (0 == r) return e.backUp(1), t.tokenize.pop(), t.tokenize[t.tokenize.length - 1](e, t); --r } return n } }()), "string"; o = !1 } else { if (t.match(e)) return n.tokenize.pop(), "string"; t.next(), o = "\\" == r } i && n.tokenize.pop(); return "string" }.bind(null, r[0]), t.tokenize.push(r), r(e, t)) : e.match(s) ? (r = e.current(), c.hasOwnProperty(r) ? "variable-2" : a.hasOwnProperty(r) ? "atom" : i.hasOwnProperty(r) ? (o.hasOwnProperty(r) && (t.prev = "define"), "keyword") : "define" == n ? "def" : "variable") : (e.next(), null) } function v(e, t) { for (var n; n = e.next();)if ("/" === n && e.eat("*")) t.tokenize.push(v); else if ("*" === n && e.eat("/")) { t.tokenize.pop(); break } return "comment" } function x(e, t, n) { this.prev = e, this.align = t, this.indented = n } e.defineMode("swift", function (n) { return { startState: function () { return { prev: null, context: null, indented: 0, tokenize: [] } }, token: function (e, t) { var n = t.prev; t.prev = null; var r = (t.tokenize[t.tokenize.length - 1] || _)(e, t, n); return r && "comment" != r ? t.prev || (t.prev = r) : t.prev = n, "punctuation" == r && (n = /[\(\[\{]|([\]\)\}])/.exec(e.current())) && (n[1] ? function (e) { e.context && (e.indented = e.context.indented, e.context = e.context.prev) } : function (e, t) { t = t.match(/^\s*($|\/[\/\*])/, !1) ? null : t.column() + 1, e.context = new x(e.context, t, e.indented) })(t, e), r }, indent: function (e, t) { e = e.context; if (!e) return 0; t = /^[\]\}\)]/.test(t); return null != e.align ? e.align - (t ? 1 : 0) : e.indented + (t ? 0 : n.indentUnit) }, electricInput: /^\s*[\)\}\]]$/, lineComment: "//", blockCommentStart: "/*", blockCommentEnd: "*/", fold: "brace", closeBrackets: "()[]{}''\"\"``" } }), e.defineMIME("text/x-swift", "swift") });