Fix: merge conflict
[myslice.git] / to-be-integrated / third-party / codemirror-3.15 / mode / diff / diff.js
1 CodeMirror.defineMode("diff", function() {
2
3   var TOKEN_NAMES = {
4     '+': 'positive',
5     '-': 'negative',
6     '@': 'meta'
7   };
8
9   return {
10     token: function(stream) {
11       var tw_pos = stream.string.search(/[\t ]+?$/);
12
13       if (!stream.sol() || tw_pos === 0) {
14         stream.skipToEnd();
15         return ("error " + (
16           TOKEN_NAMES[stream.string.charAt(0)] || '')).replace(/ $/, '');
17       }
18
19       var token_name = TOKEN_NAMES[stream.peek()] || stream.skipToEnd();
20
21       if (tw_pos === -1) {
22         stream.skipToEnd();
23       } else {
24         stream.pos = tw_pos;
25       }
26
27       return token_name;
28     }
29   };
30 });
31
32 CodeMirror.defineMIME("text/x-diff", "diff");