'use strict';(function(d){"object"==typeof exports&&"object"==typeof module?d(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],d):d(CodeMirror)})(function(d){function f(a){for(var b={},c=0;c<a.length;c++)b[a[c]]=!0;return b}function k(a,b,c){a.sol()&&(b.indented=a.indentation());if(a.eatSpace())return null;var e=a.peek();if("/"==e){if(a.match("//"))return a.skipToEnd(),"comment";if(a.match("/*"))return b.tokenize.push(g),g(a,b)}if(a.match(l))return"builtin";
if(a.match(m))return"attribute";if(a.match(n)||a.match(p)||a.match(q)||a.match(r))return"number";if(a.match(t))return"property";if(-1<"+-/*%=|&<>~^?!".indexOf(e))return a.next(),"operator";if(-1<":;,.(){}[]".indexOf(e))return a.next(),a.match(".."),"punctuation";if(e=a.match(/("""|"|')/))return c=u.bind(null,e[0]),b.tokenize.push(c),c(a,b);if(a.match(v))return a=a.current(),w.hasOwnProperty(a)?"variable-2":x.hasOwnProperty(a)?"atom":y.hasOwnProperty(a)?(z.hasOwnProperty(a)&&(b.prev="define"),"keyword"):
"define"==c?"def":"variable";a.next();return null}function A(){var a=0;return function(b,c,e){e=k(b,c,e);if("punctuation"==e)if("("==b.current())++a;else if(")"==b.current()){if(0==a)return b.backUp(1),c.tokenize.pop(),c.tokenize[c.tokenize.length-1](b,c);--a}return e}}function u(a,b,c){for(var e=1==a.length,h,d=!1;h=b.peek();)if(d){b.next();if("("==h)return c.tokenize.push(A()),"string";d=!1}else{if(b.match(a))return c.tokenize.pop(),"string";b.next();d="\\"==h}e&&c.tokenize.pop();return"string"}
function g(a,b){for(var c;;){a.match(/^[^/*]+/,!0);c=a.next();if(!c)break;"/"===c&&a.eat("*")?b.tokenize.push(g):"*"===c&&a.eat("/")&&b.tokenize.pop()}return"comment"}function B(a,b,c){this.prev=a;this.align=b;this.indented=c}function C(a,b){b=b.match(/^\s*($|\/[\/\*])/,!1)?null:b.column()+1;a.context=new B(a.context,b,a.indented)}function D(a){a.context&&(a.indented=a.context.indented,a.context=a.context.prev)}var y=f("_ var let 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 catch do rethrows throw throws 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__".split(" ")),
z=f("var let class enum extension import protocol struct func typealias associatedtype for".split(" ")),x=f("true false nil self super _".split(" ")),w=f("Array Bool Character Dictionary Double Float Int Int8 Int16 Int32 Int64 Never Optional Set String UInt8 UInt16 UInt32 UInt64 Void".split(" ")),n=/^\-?0b[01][01_]*/,p=/^\-?0o[0-7][0-7_]*/,q=/^\-?0x[\dA-Fa-f][\dA-Fa-f_]*(?:(?:\.[\dA-Fa-f][\dA-Fa-f_]*)?[Pp]\-?\d[\d_]*)?/,r=/^\-?\d[\d_]*(?:\.\d[\d_]*)?(?:[Ee]\-?\d[\d_]*)?/,v=/^\$\d+|(`?)[_A-Za-z][_A-Za-z$0-9]*\1/,
t=/^\.(?:\$\d+|(`?)[_A-Za-z][_A-Za-z$0-9]*\1)/,l=/^#[A-Za-z]+/,m=/^@(?:\$\d+|(`?)[_A-Za-z][_A-Za-z$0-9]*\1)/;d.defineMode("swift",function(a){return{startState:function(){return{prev:null,context:null,indented:0,tokenize:[]}},token:function(a,c){var b=c.prev;c.prev=null;var d=(c.tokenize[c.tokenize.length-1]||k)(a,c,b);d&&"comment"!=d?c.prev||(c.prev=d):c.prev=b;"punctuation"==d&&(b=/[\(\[\{]|([\]\)\}])/.exec(a.current()))&&(b[1]?D:C)(c,a);return d},indent:function(b,c){b=b.context;if(!b)return 0;
c=/^[\]\}\)]/.test(c);return null!=b.align?b.align-(c?1:0):b.indented+(c?0:a.indentUnit)},electricInput:/^\s*[\)\}\]]$/,lineComment:"//",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace",closeBrackets:"()[]{}''\"\"``"}});d.defineMIME("text/x-swift","swift")});
