?
Path : /home/admin/public_html/old/media/editors/codemirror/mode/swift/ |
Current File : /home/admin/public_html/old/media/editors/codemirror/mode/swift/swift.min.js |
!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";function b(a){for(var b={},c=0;c<a.length;c++)b[a[c]]=!0;return b}function c(a,b,c){if(a.sol()&&(b.indented=a.indentation()),a.eatSpace())return null;var d=a.peek();if("/"==d){if(a.match("//"))return a.skipToEnd(),"comment";if(a.match("/*"))return b.tokenize.push(f),f(a,b);if(a.match(s))return"string-2"}if(n.indexOf(d)>-1)return a.next(),"operator";if(o.indexOf(d)>-1)return a.next(),a.match(".."),"punctuation";if('"'==d||"'"==d){a.next();var g=e(d);return b.tokenize.push(g),g(a,b)}if(a.match(p))return"number";if(a.match(r))return"property";if(a.match(q)){var h=a.current();return j.hasOwnProperty(h)?(k.hasOwnProperty(h)&&(b.prev="define"),"keyword"):m.hasOwnProperty(h)?"variable-2":l.hasOwnProperty(h)?"atom":"define"==c?"def":"variable"}return a.next(),null}function d(){var a=0;return function(b,d,e){var f=c(b,d,e);if("punctuation"==f)if("("==b.current())++a;else if(")"==b.current()){if(0==a)return b.backUp(1),d.tokenize.pop(),d.tokenize[d.tokenize.length-1](b,d);--a}return f}}function e(a){return function(b,c){for(var e,f=!1;e=b.next();)if(f){if("("==e)return c.tokenize.push(d()),"string";f=!1}else{if(e==a)break;f="\\"==e}return c.tokenize.pop(),"string"}}function f(a,b){return a.match(/^(?:[^*]|\*(?!\/))*/),a.match("*/")&&b.tokenize.pop(),"comment"}function g(a,b,c){this.prev=a,this.align=b,this.indented=c}function h(a,b){var c=b.match(/^\s*($|\/[\/\*])/,!1)?null:b.column()+1;a.context=new g(a.context,c,a.indented)}function i(a){a.context&&(a.indented=a.context.indented,a.context=a.context.prev)}var j=b(["var","let","class","deinit","enum","extension","func","import","init","protocol","static","struct","subscript","typealias","as","dynamicType","is","new","super","self","Self","Type","__COLUMN__","__FILE__","__FUNCTION__","__LINE__","break","case","continue","default","do","else","fallthrough","if","in","for","return","switch","where","while","associativity","didSet","get","infix","inout","left","mutating","none","nonmutating","operator","override","postfix","precedence","prefix","right","set","unowned","weak","willSet"]),k=b(["var","let","class","enum","extension","func","import","protocol","struct","typealias","dynamicType","for"]),l=b(["Infinity","NaN","undefined","null","true","false","on","off","yes","no","nil","null","this","super"]),m=b(["String","bool","int","string","double","Double","Int","Float","float","public","private","extension"]),n="+-/*%=|&<>#",o=";,.(){}[]",p=/^-?(?:(?:[\d_]+\.[_\d]*|\.[_\d]+|0o[0-7_\.]+|0b[01_\.]+)(?:e-?[\d_]+)?|0x[\d_a-f\.]+(?:p-?[\d_]+)?)/i,q=/^[_A-Za-z$][_A-Za-z$0-9]*/,r=/^[@\.][_A-Za-z$][_A-Za-z$0-9]*/,s=/^\/(?!\s)(?:\/\/)?(?:\\.|[^\/])+\//;a.defineMode("swift",function(a){return{startState:function(){return{prev:null,context:null,indented:0,tokenize:[]}},token:function(a,b){var d=b.prev;b.prev=null;var e=b.tokenize[b.tokenize.length-1]||c,f=e(a,b,d);if(f&&"comment"!=f?b.prev||(b.prev=f):b.prev=d,"punctuation"==f){var g=/[\(\[\{]|([\]\)\}])/.exec(a.current());g&&(g[1]?i:h)(b,a)}return f},indent:function(b,c){var d=b.context;if(!d)return 0;var e=/^[\]\}\)]/.test(c);return null!=d.align?d.align-(e?1:0):d.indented+(e?0:a.indentUnit)},electricInput:/^\s*[\)\}\]]$/,lineComment:"//",blockCommentStart:"/*",blockCommentEnd:"*/"}}),a.defineMIME("text/x-swift","swift")});