Edit File by line
/home/barbar84/www/wp-conte.../plugins/wp-file-.../lib/codemirr.../mode/mllike
File: mllike.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
(function(mod) {
[3] Fix | Delete
if (typeof exports == "object" && typeof module == "object") // CommonJS
[4] Fix | Delete
mod(require("../../lib/codemirror"));
[5] Fix | Delete
else if (typeof define == "function" && define.amd) // AMD
[6] Fix | Delete
define(["../../lib/codemirror"], mod);
[7] Fix | Delete
else // Plain browser env
[8] Fix | Delete
mod(CodeMirror);
[9] Fix | Delete
})(function(CodeMirror) {
[10] Fix | Delete
"use strict";
[11] Fix | Delete
[12] Fix | Delete
CodeMirror.defineMode('mllike', function(_config, parserConfig) {
[13] Fix | Delete
var words = {
[14] Fix | Delete
'let': 'keyword',
[15] Fix | Delete
'rec': 'keyword',
[16] Fix | Delete
'in': 'keyword',
[17] Fix | Delete
'of': 'keyword',
[18] Fix | Delete
'and': 'keyword',
[19] Fix | Delete
'if': 'keyword',
[20] Fix | Delete
'then': 'keyword',
[21] Fix | Delete
'else': 'keyword',
[22] Fix | Delete
'for': 'keyword',
[23] Fix | Delete
'to': 'keyword',
[24] Fix | Delete
'while': 'keyword',
[25] Fix | Delete
'do': 'keyword',
[26] Fix | Delete
'done': 'keyword',
[27] Fix | Delete
'fun': 'keyword',
[28] Fix | Delete
'function': 'keyword',
[29] Fix | Delete
'val': 'keyword',
[30] Fix | Delete
'type': 'keyword',
[31] Fix | Delete
'mutable': 'keyword',
[32] Fix | Delete
'match': 'keyword',
[33] Fix | Delete
'with': 'keyword',
[34] Fix | Delete
'try': 'keyword',
[35] Fix | Delete
'open': 'builtin',
[36] Fix | Delete
'ignore': 'builtin',
[37] Fix | Delete
'begin': 'keyword',
[38] Fix | Delete
'end': 'keyword'
[39] Fix | Delete
};
[40] Fix | Delete
[41] Fix | Delete
var extraWords = parserConfig.extraWords || {};
[42] Fix | Delete
for (var prop in extraWords) {
[43] Fix | Delete
if (extraWords.hasOwnProperty(prop)) {
[44] Fix | Delete
words[prop] = parserConfig.extraWords[prop];
[45] Fix | Delete
}
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
function tokenBase(stream, state) {
[49] Fix | Delete
var ch = stream.next();
[50] Fix | Delete
[51] Fix | Delete
if (ch === '"') {
[52] Fix | Delete
state.tokenize = tokenString;
[53] Fix | Delete
return state.tokenize(stream, state);
[54] Fix | Delete
}
[55] Fix | Delete
if (ch === '(') {
[56] Fix | Delete
if (stream.eat('*')) {
[57] Fix | Delete
state.commentLevel++;
[58] Fix | Delete
state.tokenize = tokenComment;
[59] Fix | Delete
return state.tokenize(stream, state);
[60] Fix | Delete
}
[61] Fix | Delete
}
[62] Fix | Delete
if (ch === '~') {
[63] Fix | Delete
stream.eatWhile(/\w/);
[64] Fix | Delete
return 'variable-2';
[65] Fix | Delete
}
[66] Fix | Delete
if (ch === '`') {
[67] Fix | Delete
stream.eatWhile(/\w/);
[68] Fix | Delete
return 'quote';
[69] Fix | Delete
}
[70] Fix | Delete
if (ch === '/' && parserConfig.slashComments && stream.eat('/')) {
[71] Fix | Delete
stream.skipToEnd();
[72] Fix | Delete
return 'comment';
[73] Fix | Delete
}
[74] Fix | Delete
if (/\d/.test(ch)) {
[75] Fix | Delete
stream.eatWhile(/[\d]/);
[76] Fix | Delete
if (stream.eat('.')) {
[77] Fix | Delete
stream.eatWhile(/[\d]/);
[78] Fix | Delete
}
[79] Fix | Delete
return 'number';
[80] Fix | Delete
}
[81] Fix | Delete
if ( /[+\-*&%=<>!?|]/.test(ch)) {
[82] Fix | Delete
return 'operator';
[83] Fix | Delete
}
[84] Fix | Delete
stream.eatWhile(/\w/);
[85] Fix | Delete
var cur = stream.current();
[86] Fix | Delete
return words.hasOwnProperty(cur) ? words[cur] : 'variable';
[87] Fix | Delete
}
[88] Fix | Delete
[89] Fix | Delete
function tokenString(stream, state) {
[90] Fix | Delete
var next, end = false, escaped = false;
[91] Fix | Delete
while ((next = stream.next()) != null) {
[92] Fix | Delete
if (next === '"' && !escaped) {
[93] Fix | Delete
end = true;
[94] Fix | Delete
break;
[95] Fix | Delete
}
[96] Fix | Delete
escaped = !escaped && next === '\\';
[97] Fix | Delete
}
[98] Fix | Delete
if (end && !escaped) {
[99] Fix | Delete
state.tokenize = tokenBase;
[100] Fix | Delete
}
[101] Fix | Delete
return 'string';
[102] Fix | Delete
};
[103] Fix | Delete
[104] Fix | Delete
function tokenComment(stream, state) {
[105] Fix | Delete
var prev, next;
[106] Fix | Delete
while(state.commentLevel > 0 && (next = stream.next()) != null) {
[107] Fix | Delete
if (prev === '(' && next === '*') state.commentLevel++;
[108] Fix | Delete
if (prev === '*' && next === ')') state.commentLevel--;
[109] Fix | Delete
prev = next;
[110] Fix | Delete
}
[111] Fix | Delete
if (state.commentLevel <= 0) {
[112] Fix | Delete
state.tokenize = tokenBase;
[113] Fix | Delete
}
[114] Fix | Delete
return 'comment';
[115] Fix | Delete
}
[116] Fix | Delete
[117] Fix | Delete
return {
[118] Fix | Delete
startState: function() {return {tokenize: tokenBase, commentLevel: 0};},
[119] Fix | Delete
token: function(stream, state) {
[120] Fix | Delete
if (stream.eatSpace()) return null;
[121] Fix | Delete
return state.tokenize(stream, state);
[122] Fix | Delete
},
[123] Fix | Delete
[124] Fix | Delete
blockCommentStart: "(*",
[125] Fix | Delete
blockCommentEnd: "*)",
[126] Fix | Delete
lineComment: parserConfig.slashComments ? "//" : null
[127] Fix | Delete
};
[128] Fix | Delete
});
[129] Fix | Delete
[130] Fix | Delete
CodeMirror.defineMIME('text/x-ocaml', {
[131] Fix | Delete
name: 'mllike',
[132] Fix | Delete
extraWords: {
[133] Fix | Delete
'succ': 'keyword',
[134] Fix | Delete
'trace': 'builtin',
[135] Fix | Delete
'exit': 'builtin',
[136] Fix | Delete
'print_string': 'builtin',
[137] Fix | Delete
'print_endline': 'builtin',
[138] Fix | Delete
'true': 'atom',
[139] Fix | Delete
'false': 'atom',
[140] Fix | Delete
'raise': 'keyword'
[141] Fix | Delete
}
[142] Fix | Delete
});
[143] Fix | Delete
[144] Fix | Delete
CodeMirror.defineMIME('text/x-fsharp', {
[145] Fix | Delete
name: 'mllike',
[146] Fix | Delete
extraWords: {
[147] Fix | Delete
'abstract': 'keyword',
[148] Fix | Delete
'as': 'keyword',
[149] Fix | Delete
'assert': 'keyword',
[150] Fix | Delete
'base': 'keyword',
[151] Fix | Delete
'class': 'keyword',
[152] Fix | Delete
'default': 'keyword',
[153] Fix | Delete
'delegate': 'keyword',
[154] Fix | Delete
'downcast': 'keyword',
[155] Fix | Delete
'downto': 'keyword',
[156] Fix | Delete
'elif': 'keyword',
[157] Fix | Delete
'exception': 'keyword',
[158] Fix | Delete
'extern': 'keyword',
[159] Fix | Delete
'finally': 'keyword',
[160] Fix | Delete
'global': 'keyword',
[161] Fix | Delete
'inherit': 'keyword',
[162] Fix | Delete
'inline': 'keyword',
[163] Fix | Delete
'interface': 'keyword',
[164] Fix | Delete
'internal': 'keyword',
[165] Fix | Delete
'lazy': 'keyword',
[166] Fix | Delete
'let!': 'keyword',
[167] Fix | Delete
'member' : 'keyword',
[168] Fix | Delete
'module': 'keyword',
[169] Fix | Delete
'namespace': 'keyword',
[170] Fix | Delete
'new': 'keyword',
[171] Fix | Delete
'null': 'keyword',
[172] Fix | Delete
'override': 'keyword',
[173] Fix | Delete
'private': 'keyword',
[174] Fix | Delete
'public': 'keyword',
[175] Fix | Delete
'return': 'keyword',
[176] Fix | Delete
'return!': 'keyword',
[177] Fix | Delete
'select': 'keyword',
[178] Fix | Delete
'static': 'keyword',
[179] Fix | Delete
'struct': 'keyword',
[180] Fix | Delete
'upcast': 'keyword',
[181] Fix | Delete
'use': 'keyword',
[182] Fix | Delete
'use!': 'keyword',
[183] Fix | Delete
'val': 'keyword',
[184] Fix | Delete
'when': 'keyword',
[185] Fix | Delete
'yield': 'keyword',
[186] Fix | Delete
'yield!': 'keyword',
[187] Fix | Delete
[188] Fix | Delete
'List': 'builtin',
[189] Fix | Delete
'Seq': 'builtin',
[190] Fix | Delete
'Map': 'builtin',
[191] Fix | Delete
'Set': 'builtin',
[192] Fix | Delete
'int': 'builtin',
[193] Fix | Delete
'string': 'builtin',
[194] Fix | Delete
'raise': 'builtin',
[195] Fix | Delete
'failwith': 'builtin',
[196] Fix | Delete
'not': 'builtin',
[197] Fix | Delete
'true': 'builtin',
[198] Fix | Delete
'false': 'builtin'
[199] Fix | Delete
},
[200] Fix | Delete
slashComments: true
[201] Fix | Delete
});
[202] Fix | Delete
[203] Fix | Delete
});
[204] Fix | Delete
[205] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function