Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/wp-file-.../lib/codemirr.../mode/swift
File: swift.js
// CodeMirror, copyright (c) by Marijn Haverbeke and others
[0] Fix | Delete
// Distributed under an MIT license: http://codemirror.net/LICENSE
[1] Fix | Delete
[2] Fix | Delete
// Swift mode created by Michael Kaminsky https://github.com/mkaminsky11
[3] Fix | Delete
[4] Fix | Delete
(function(mod) {
[5] Fix | Delete
if (typeof exports == "object" && typeof module == "object")
[6] Fix | Delete
mod(require("../../lib/codemirror"))
[7] Fix | Delete
else if (typeof define == "function" && define.amd)
[8] Fix | Delete
define(["../../lib/codemirror"], mod)
[9] Fix | Delete
else
[10] Fix | Delete
mod(CodeMirror)
[11] Fix | Delete
})(function(CodeMirror) {
[12] Fix | Delete
"use strict"
[13] Fix | Delete
[14] Fix | Delete
function wordSet(words) {
[15] Fix | Delete
var set = {}
[16] Fix | Delete
for (var i = 0; i < words.length; i++) set[words[i]] = true
[17] Fix | Delete
return set
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
var keywords = wordSet(["var","let","class","deinit","enum","extension","func","import","init","protocol",
[21] Fix | Delete
"static","struct","subscript","typealias","as","dynamicType","is","new","super",
[22] Fix | Delete
"self","Self","Type","__COLUMN__","__FILE__","__FUNCTION__","__LINE__","break","case",
[23] Fix | Delete
"continue","default","do","else","fallthrough","if","in","for","return","switch",
[24] Fix | Delete
"where","while","associativity","didSet","get","infix","inout","left","mutating",
[25] Fix | Delete
"none","nonmutating","operator","override","postfix","precedence","prefix","right",
[26] Fix | Delete
"set","unowned","weak","willSet"])
[27] Fix | Delete
var definingKeywords = wordSet(["var","let","class","enum","extension","func","import","protocol","struct",
[28] Fix | Delete
"typealias","dynamicType","for"])
[29] Fix | Delete
var atoms = wordSet(["Infinity","NaN","undefined","null","true","false","on","off","yes","no","nil","null",
[30] Fix | Delete
"this","super"])
[31] Fix | Delete
var types = wordSet(["String","bool","int","string","double","Double","Int","Float","float","public",
[32] Fix | Delete
"private","extension"])
[33] Fix | Delete
var operators = "+-/*%=|&<>#"
[34] Fix | Delete
var punc = ";,.(){}[]"
[35] Fix | Delete
var number = /^-?(?:(?:[\d_]+\.[_\d]*|\.[_\d]+|0o[0-7_\.]+|0b[01_\.]+)(?:e-?[\d_]+)?|0x[\d_a-f\.]+(?:p-?[\d_]+)?)/i
[36] Fix | Delete
var identifier = /^[_A-Za-z$][_A-Za-z$0-9]*/
[37] Fix | Delete
var property = /^[@\.][_A-Za-z$][_A-Za-z$0-9]*/
[38] Fix | Delete
var regexp = /^\/(?!\s)(?:\/\/)?(?:\\.|[^\/])+\//
[39] Fix | Delete
[40] Fix | Delete
function tokenBase(stream, state, prev) {
[41] Fix | Delete
if (stream.sol()) state.indented = stream.indentation()
[42] Fix | Delete
if (stream.eatSpace()) return null
[43] Fix | Delete
[44] Fix | Delete
var ch = stream.peek()
[45] Fix | Delete
if (ch == "/") {
[46] Fix | Delete
if (stream.match("//")) {
[47] Fix | Delete
stream.skipToEnd()
[48] Fix | Delete
return "comment"
[49] Fix | Delete
}
[50] Fix | Delete
if (stream.match("/*")) {
[51] Fix | Delete
state.tokenize.push(tokenComment)
[52] Fix | Delete
return tokenComment(stream, state)
[53] Fix | Delete
}
[54] Fix | Delete
if (stream.match(regexp)) return "string-2"
[55] Fix | Delete
}
[56] Fix | Delete
if (operators.indexOf(ch) > -1) {
[57] Fix | Delete
stream.next()
[58] Fix | Delete
return "operator"
[59] Fix | Delete
}
[60] Fix | Delete
if (punc.indexOf(ch) > -1) {
[61] Fix | Delete
stream.next()
[62] Fix | Delete
stream.match("..")
[63] Fix | Delete
return "punctuation"
[64] Fix | Delete
}
[65] Fix | Delete
if (ch == '"' || ch == "'") {
[66] Fix | Delete
stream.next()
[67] Fix | Delete
var tokenize = tokenString(ch)
[68] Fix | Delete
state.tokenize.push(tokenize)
[69] Fix | Delete
return tokenize(stream, state)
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
if (stream.match(number)) return "number"
[73] Fix | Delete
if (stream.match(property)) return "property"
[74] Fix | Delete
[75] Fix | Delete
if (stream.match(identifier)) {
[76] Fix | Delete
var ident = stream.current()
[77] Fix | Delete
if (keywords.hasOwnProperty(ident)) {
[78] Fix | Delete
if (definingKeywords.hasOwnProperty(ident))
[79] Fix | Delete
state.prev = "define"
[80] Fix | Delete
return "keyword"
[81] Fix | Delete
}
[82] Fix | Delete
if (types.hasOwnProperty(ident)) return "variable-2"
[83] Fix | Delete
if (atoms.hasOwnProperty(ident)) return "atom"
[84] Fix | Delete
if (prev == "define") return "def"
[85] Fix | Delete
return "variable"
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
stream.next()
[89] Fix | Delete
return null
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
function tokenUntilClosingParen() {
[93] Fix | Delete
var depth = 0
[94] Fix | Delete
return function(stream, state, prev) {
[95] Fix | Delete
var inner = tokenBase(stream, state, prev)
[96] Fix | Delete
if (inner == "punctuation") {
[97] Fix | Delete
if (stream.current() == "(") ++depth
[98] Fix | Delete
else if (stream.current() == ")") {
[99] Fix | Delete
if (depth == 0) {
[100] Fix | Delete
stream.backUp(1)
[101] Fix | Delete
state.tokenize.pop()
[102] Fix | Delete
return state.tokenize[state.tokenize.length - 1](stream, state)
[103] Fix | Delete
}
[104] Fix | Delete
else --depth
[105] Fix | Delete
}
[106] Fix | Delete
}
[107] Fix | Delete
return inner
[108] Fix | Delete
}
[109] Fix | Delete
}
[110] Fix | Delete
[111] Fix | Delete
function tokenString(quote) {
[112] Fix | Delete
return function(stream, state) {
[113] Fix | Delete
var ch, escaped = false
[114] Fix | Delete
while (ch = stream.next()) {
[115] Fix | Delete
if (escaped) {
[116] Fix | Delete
if (ch == "(") {
[117] Fix | Delete
state.tokenize.push(tokenUntilClosingParen())
[118] Fix | Delete
return "string"
[119] Fix | Delete
}
[120] Fix | Delete
escaped = false
[121] Fix | Delete
} else if (ch == quote) {
[122] Fix | Delete
break
[123] Fix | Delete
} else {
[124] Fix | Delete
escaped = ch == "\\"
[125] Fix | Delete
}
[126] Fix | Delete
}
[127] Fix | Delete
state.tokenize.pop()
[128] Fix | Delete
return "string"
[129] Fix | Delete
}
[130] Fix | Delete
}
[131] Fix | Delete
[132] Fix | Delete
function tokenComment(stream, state) {
[133] Fix | Delete
stream.match(/^(?:[^*]|\*(?!\/))*/)
[134] Fix | Delete
if (stream.match("*/")) state.tokenize.pop()
[135] Fix | Delete
return "comment"
[136] Fix | Delete
}
[137] Fix | Delete
[138] Fix | Delete
function Context(prev, align, indented) {
[139] Fix | Delete
this.prev = prev
[140] Fix | Delete
this.align = align
[141] Fix | Delete
this.indented = indented
[142] Fix | Delete
}
[143] Fix | Delete
[144] Fix | Delete
function pushContext(state, stream) {
[145] Fix | Delete
var align = stream.match(/^\s*($|\/[\/\*])/, false) ? null : stream.column() + 1
[146] Fix | Delete
state.context = new Context(state.context, align, state.indented)
[147] Fix | Delete
}
[148] Fix | Delete
[149] Fix | Delete
function popContext(state) {
[150] Fix | Delete
if (state.context) {
[151] Fix | Delete
state.indented = state.context.indented
[152] Fix | Delete
state.context = state.context.prev
[153] Fix | Delete
}
[154] Fix | Delete
}
[155] Fix | Delete
[156] Fix | Delete
CodeMirror.defineMode("swift", function(config) {
[157] Fix | Delete
return {
[158] Fix | Delete
startState: function() {
[159] Fix | Delete
return {
[160] Fix | Delete
prev: null,
[161] Fix | Delete
context: null,
[162] Fix | Delete
indented: 0,
[163] Fix | Delete
tokenize: []
[164] Fix | Delete
}
[165] Fix | Delete
},
[166] Fix | Delete
[167] Fix | Delete
token: function(stream, state) {
[168] Fix | Delete
var prev = state.prev
[169] Fix | Delete
state.prev = null
[170] Fix | Delete
var tokenize = state.tokenize[state.tokenize.length - 1] || tokenBase
[171] Fix | Delete
var style = tokenize(stream, state, prev)
[172] Fix | Delete
if (!style || style == "comment") state.prev = prev
[173] Fix | Delete
else if (!state.prev) state.prev = style
[174] Fix | Delete
[175] Fix | Delete
if (style == "punctuation") {
[176] Fix | Delete
var bracket = /[\(\[\{]|([\]\)\}])/.exec(stream.current())
[177] Fix | Delete
if (bracket) (bracket[1] ? popContext : pushContext)(state, stream)
[178] Fix | Delete
}
[179] Fix | Delete
[180] Fix | Delete
return style
[181] Fix | Delete
},
[182] Fix | Delete
[183] Fix | Delete
indent: function(state, textAfter) {
[184] Fix | Delete
var cx = state.context
[185] Fix | Delete
if (!cx) return 0
[186] Fix | Delete
var closing = /^[\]\}\)]/.test(textAfter)
[187] Fix | Delete
if (cx.align != null) return cx.align - (closing ? 1 : 0)
[188] Fix | Delete
return cx.indented + (closing ? 0 : config.indentUnit)
[189] Fix | Delete
},
[190] Fix | Delete
[191] Fix | Delete
electricInput: /^\s*[\)\}\]]$/,
[192] Fix | Delete
[193] Fix | Delete
lineComment: "//",
[194] Fix | Delete
blockCommentStart: "/*",
[195] Fix | Delete
blockCommentEnd: "*/"
[196] Fix | Delete
}
[197] Fix | Delete
})
[198] Fix | Delete
[199] Fix | Delete
CodeMirror.defineMIME("text/x-swift","swift")
[200] Fix | Delete
});
[201] Fix | Delete
[202] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function