codemirror-rails 2.3 → 2.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/README.md +0 -16
  2. data/codemirror-rails.gemspec +1 -1
  3. data/lib/codemirror/rails/version.rb +2 -2
  4. data/vendor/assets/javascripts/codemirror.js +323 -687
  5. data/vendor/assets/javascripts/codemirror/modes/clike.js +3 -40
  6. data/vendor/assets/javascripts/codemirror/modes/clojure.js +14 -14
  7. data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +0 -6
  8. data/vendor/assets/javascripts/codemirror/modes/css.js +1 -1
  9. data/vendor/assets/javascripts/codemirror/modes/diff.js +5 -24
  10. data/vendor/assets/javascripts/codemirror/modes/gfm.js +4 -40
  11. data/vendor/assets/javascripts/codemirror/modes/go.js +22 -20
  12. data/vendor/assets/javascripts/codemirror/modes/htmlembedded.js +1 -1
  13. data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +2 -4
  14. data/vendor/assets/javascripts/codemirror/modes/javascript.js +7 -8
  15. data/vendor/assets/javascripts/codemirror/modes/less.js +54 -100
  16. data/vendor/assets/javascripts/codemirror/modes/markdown.js +49 -52
  17. data/vendor/assets/javascripts/codemirror/modes/pascal.js +46 -2
  18. data/vendor/assets/javascripts/codemirror/modes/perl.js +1 -1
  19. data/vendor/assets/javascripts/codemirror/modes/php.js +25 -54
  20. data/vendor/assets/javascripts/codemirror/modes/python.js +16 -14
  21. data/vendor/assets/javascripts/codemirror/modes/rpm-spec.js +1 -1
  22. data/vendor/assets/javascripts/codemirror/modes/rst.js +1 -1
  23. data/vendor/assets/javascripts/codemirror/modes/ruby.js +9 -4
  24. data/vendor/assets/javascripts/codemirror/modes/scheme.js +46 -74
  25. data/vendor/assets/javascripts/codemirror/modes/smalltalk.js +16 -16
  26. data/vendor/assets/javascripts/codemirror/modes/stex.js +6 -21
  27. data/vendor/assets/javascripts/codemirror/modes/tiddlywiki.js +45 -55
  28. data/vendor/assets/javascripts/codemirror/modes/xml.js +14 -79
  29. data/vendor/assets/javascripts/codemirror/{utils/overlay.js → overlay.js} +2 -3
  30. data/vendor/assets/javascripts/codemirror/runmode.js +27 -0
  31. data/vendor/assets/stylesheets/codemirror.css +2 -63
  32. data/vendor/assets/stylesheets/codemirror/modes/tiddlywiki.css +21 -14
  33. data/vendor/assets/stylesheets/codemirror/themes/eclipse.css +1 -1
  34. data/vendor/assets/stylesheets/codemirror/themes/elegant.css +2 -2
  35. data/vendor/assets/stylesheets/codemirror/themes/neat.css +3 -3
  36. data/vendor/assets/stylesheets/codemirror/themes/night.css +1 -1
  37. data/vendor/assets/stylesheets/codemirror/themes/rubyblue.css +2 -2
  38. metadata +6 -39
  39. data/vendor/assets/javascripts/codemirror/keymaps/emacs.js +0 -29
  40. data/vendor/assets/javascripts/codemirror/keymaps/vim.js +0 -766
  41. data/vendor/assets/javascripts/codemirror/modes/ecl.js +0 -203
  42. data/vendor/assets/javascripts/codemirror/modes/erlang.js +0 -251
  43. data/vendor/assets/javascripts/codemirror/modes/pig.js +0 -172
  44. data/vendor/assets/javascripts/codemirror/modes/properties.js +0 -63
  45. data/vendor/assets/javascripts/codemirror/modes/shell.js +0 -103
  46. data/vendor/assets/javascripts/codemirror/modes/smarty.js +0 -148
  47. data/vendor/assets/javascripts/codemirror/modes/tiki.js +0 -316
  48. data/vendor/assets/javascripts/codemirror/modes/vbscript.js +0 -26
  49. data/vendor/assets/javascripts/codemirror/modes/xquery.js +0 -448
  50. data/vendor/assets/javascripts/codemirror/utils/closetag.js +0 -146
  51. data/vendor/assets/javascripts/codemirror/utils/dialog.js +0 -63
  52. data/vendor/assets/javascripts/codemirror/utils/foldcode.js +0 -196
  53. data/vendor/assets/javascripts/codemirror/utils/formatting.js +0 -297
  54. data/vendor/assets/javascripts/codemirror/utils/javascript-hint.js +0 -134
  55. data/vendor/assets/javascripts/codemirror/utils/loadmode.js +0 -51
  56. data/vendor/assets/javascripts/codemirror/utils/match-highlighter.js +0 -44
  57. data/vendor/assets/javascripts/codemirror/utils/multiplex.js +0 -72
  58. data/vendor/assets/javascripts/codemirror/utils/pig-hint.js +0 -123
  59. data/vendor/assets/javascripts/codemirror/utils/runmode.js +0 -49
  60. data/vendor/assets/javascripts/codemirror/utils/search.js +0 -118
  61. data/vendor/assets/javascripts/codemirror/utils/searchcursor.js +0 -117
  62. data/vendor/assets/javascripts/codemirror/utils/simple-hint.js +0 -72
  63. data/vendor/assets/stylesheets/codemirror/modes/tiki.css +0 -26
  64. data/vendor/assets/stylesheets/codemirror/themes/ambiance.css +0 -81
  65. data/vendor/assets/stylesheets/codemirror/themes/blackboard.css +0 -25
  66. data/vendor/assets/stylesheets/codemirror/themes/erlang-dark.css +0 -21
  67. data/vendor/assets/stylesheets/codemirror/themes/lesser-dark.css +0 -44
  68. data/vendor/assets/stylesheets/codemirror/themes/vibrant-ink.css +0 -27
  69. data/vendor/assets/stylesheets/codemirror/themes/xq-dark.css +0 -46
  70. data/vendor/assets/stylesheets/codemirror/utils/dialog.css +0 -23
  71. data/vendor/assets/stylesheets/codemirror/utils/simple-hint.css +0 -16
@@ -1,134 +0,0 @@
1
- (function () {
2
- function forEach(arr, f) {
3
- for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
4
- }
5
-
6
- function arrayContains(arr, item) {
7
- if (!Array.prototype.indexOf) {
8
- var i = arr.length;
9
- while (i--) {
10
- if (arr[i] === item) {
11
- return true;
12
- }
13
- }
14
- return false;
15
- }
16
- return arr.indexOf(item) != -1;
17
- }
18
-
19
- function scriptHint(editor, keywords, getToken) {
20
- // Find the token at the cursor
21
- var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
22
- // If it's not a 'word-style' token, ignore the token.
23
- if (!/^[\w$_]*$/.test(token.string)) {
24
- token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
25
- className: token.string == "." ? "property" : null};
26
- }
27
- // If it is a property, find out what it is a property of.
28
- while (tprop.className == "property") {
29
- tprop = getToken(editor, {line: cur.line, ch: tprop.start});
30
- if (tprop.string != ".") return;
31
- tprop = getToken(editor, {line: cur.line, ch: tprop.start});
32
- if (tprop.string == ')') {
33
- var level = 1;
34
- do {
35
- tprop = getToken(editor, {line: cur.line, ch: tprop.start});
36
- switch (tprop.string) {
37
- case ')': level++; break;
38
- case '(': level--; break;
39
- default: break;
40
- }
41
- } while (level > 0)
42
- tprop = getToken(editor, {line: cur.line, ch: tprop.start});
43
- if (tprop.className == 'variable')
44
- tprop.className = 'function';
45
- else return; // no clue
46
- }
47
- if (!context) var context = [];
48
- context.push(tprop);
49
- }
50
- return {list: getCompletions(token, context, keywords),
51
- from: {line: cur.line, ch: token.start},
52
- to: {line: cur.line, ch: token.end}};
53
- }
54
-
55
- CodeMirror.javascriptHint = function(editor) {
56
- return scriptHint(editor, javascriptKeywords,
57
- function (e, cur) {return e.getTokenAt(cur);});
58
- }
59
-
60
- function getCoffeeScriptToken(editor, cur) {
61
- // This getToken, it is for coffeescript, imitates the behavior of
62
- // getTokenAt method in javascript.js, that is, returning "property"
63
- // type and treat "." as indepenent token.
64
- var token = editor.getTokenAt(cur);
65
- if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') {
66
- token.end = token.start;
67
- token.string = '.';
68
- token.className = "property";
69
- }
70
- else if (/^\.[\w$_]*$/.test(token.string)) {
71
- token.className = "property";
72
- token.start++;
73
- token.string = token.string.replace(/\./, '');
74
- }
75
- return token;
76
- }
77
-
78
- CodeMirror.coffeescriptHint = function(editor) {
79
- return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken);
80
- }
81
-
82
- var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " +
83
- "toUpperCase toLowerCase split concat match replace search").split(" ");
84
- var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " +
85
- "lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");
86
- var funcProps = "prototype apply call bind".split(" ");
87
- var javascriptKeywords = ("break case catch continue debugger default delete do else false finally for function " +
88
- "if in instanceof new null return switch throw true try typeof var void while with").split(" ");
89
- var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " +
90
- "if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");
91
-
92
- function getCompletions(token, context, keywords) {
93
- var found = [], start = token.string;
94
- function maybeAdd(str) {
95
- if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str);
96
- }
97
- function gatherCompletions(obj) {
98
- if (typeof obj == "string") forEach(stringProps, maybeAdd);
99
- else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
100
- else if (obj instanceof Function) forEach(funcProps, maybeAdd);
101
- for (var name in obj) maybeAdd(name);
102
- }
103
-
104
- if (context) {
105
- // If this is a property, see if it belongs to some object we can
106
- // find in the current environment.
107
- var obj = context.pop(), base;
108
- if (obj.className == "variable")
109
- base = window[obj.string];
110
- else if (obj.className == "string")
111
- base = "";
112
- else if (obj.className == "atom")
113
- base = 1;
114
- else if (obj.className == "function") {
115
- if (window.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
116
- (typeof window.jQuery == 'function'))
117
- base = window.jQuery();
118
- else if (window._ != null && (obj.string == '_') && (typeof window._ == 'function'))
119
- base = window._();
120
- }
121
- while (base != null && context.length)
122
- base = base[context.pop().string];
123
- if (base != null) gatherCompletions(base);
124
- }
125
- else {
126
- // If not, just look in the window object and any local scope
127
- // (reading into JS mode internals to get at the local variables)
128
- for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
129
- gatherCompletions(window);
130
- forEach(keywords, maybeAdd);
131
- }
132
- return found;
133
- }
134
- })();
@@ -1,51 +0,0 @@
1
- (function() {
2
- if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js";
3
-
4
- var loading = {};
5
- function splitCallback(cont, n) {
6
- var countDown = n;
7
- return function() { if (--countDown == 0) cont(); }
8
- }
9
- function ensureDeps(mode, cont) {
10
- var deps = CodeMirror.modes[mode].dependencies;
11
- if (!deps) return cont();
12
- var missing = [];
13
- for (var i = 0; i < deps.length; ++i) {
14
- if (!CodeMirror.modes.hasOwnProperty(deps[i]))
15
- missing.push(deps[i]);
16
- }
17
- if (!missing.length) return cont();
18
- var split = splitCallback(cont, missing.length);
19
- for (var i = 0; i < missing.length; ++i)
20
- CodeMirror.requireMode(missing[i], split);
21
- }
22
-
23
- CodeMirror.requireMode = function(mode, cont) {
24
- if (typeof mode != "string") mode = mode.name;
25
- if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont);
26
- if (loading.hasOwnProperty(mode)) return loading[mode].push(cont);
27
-
28
- var script = document.createElement("script");
29
- script.src = CodeMirror.modeURL.replace(/%N/g, mode);
30
- var others = document.getElementsByTagName("script")[0];
31
- others.parentNode.insertBefore(script, others);
32
- var list = loading[mode] = [cont];
33
- var count = 0, poll = setInterval(function() {
34
- if (++count > 100) return clearInterval(poll);
35
- if (CodeMirror.modes.hasOwnProperty(mode)) {
36
- clearInterval(poll);
37
- loading[mode] = null;
38
- ensureDeps(mode, function() {
39
- for (var i = 0; i < list.length; ++i) list[i]();
40
- });
41
- }
42
- }, 200);
43
- };
44
-
45
- CodeMirror.autoLoadMode = function(instance, mode) {
46
- if (!CodeMirror.modes.hasOwnProperty(mode))
47
- CodeMirror.requireMode(mode, function() {
48
- instance.setOption("mode", instance.getOption("mode"));
49
- });
50
- };
51
- }());
@@ -1,44 +0,0 @@
1
- // Define match-highlighter commands. Depends on searchcursor.js
2
- // Use by attaching the following function call to the onCursorActivity event:
3
- //myCodeMirror.matchHighlight(minChars);
4
- // And including a special span.CodeMirror-matchhighlight css class (also optionally a separate one for .CodeMirror-focused -- see demo matchhighlighter.html)
5
-
6
- (function() {
7
- var DEFAULT_MIN_CHARS = 2;
8
-
9
- function MatchHighlightState() {
10
- this.marked = [];
11
- }
12
- function getMatchHighlightState(cm) {
13
- return cm._matchHighlightState || (cm._matchHighlightState = new MatchHighlightState());
14
- }
15
-
16
- function clearMarks(cm) {
17
- var state = getMatchHighlightState(cm);
18
- for (var i = 0; i < state.marked.length; ++i)
19
- state.marked[i].clear();
20
- state.marked = [];
21
- }
22
-
23
- function markDocument(cm, className, minChars) {
24
- clearMarks(cm);
25
- minChars = (typeof minChars !== 'undefined' ? minChars : DEFAULT_MIN_CHARS);
26
- if (cm.somethingSelected() && cm.getSelection().replace(/^\s+|\s+$/g, "").length >= minChars) {
27
- var state = getMatchHighlightState(cm);
28
- var query = cm.getSelection();
29
- cm.operation(function() {
30
- if (cm.lineCount() < 2000) { // This is too expensive on big documents.
31
- for (var cursor = cm.getSearchCursor(query); cursor.findNext();) {
32
- //Only apply matchhighlight to the matches other than the one actually selected
33
- if (!(cursor.from().line === cm.getCursor(true).line && cursor.from().ch === cm.getCursor(true).ch))
34
- state.marked.push(cm.markText(cursor.from(), cursor.to(), className));
35
- }
36
- }
37
- });
38
- }
39
- }
40
-
41
- CodeMirror.defineExtension("matchHighlight", function(className, minChars) {
42
- markDocument(this, className, minChars);
43
- });
44
- })();
@@ -1,72 +0,0 @@
1
- CodeMirror.multiplexingMode = function(outer /*, others */) {
2
- // Others should be {open, close, mode [, delimStyle]} objects
3
- var others = Array.prototype.slice.call(arguments, 1);
4
- var n_others = others.length;
5
-
6
- return {
7
- startState: function() {
8
- return {
9
- outer: CodeMirror.startState(outer),
10
- innerActive: null,
11
- inner: null
12
- };
13
- },
14
-
15
- copyState: function(state) {
16
- return {
17
- outer: CodeMirror.copyState(outer, state.outer),
18
- innerActive: state.innerActive,
19
- inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner)
20
- };
21
- },
22
-
23
- token: function(stream, state) {
24
- if (!state.innerActive) {
25
- for (var i = 0; i < n_others; ++i) {
26
- var other = others[i];
27
- if (stream.match(other.open)) {
28
- state.innerActive = other;
29
- state.inner = CodeMirror.startState(other.mode);
30
- return other.delimStyle;
31
- }
32
- }
33
- var outerToken = outer.token(stream, state.outer);
34
- var cur = stream.current();
35
- for (var i = 0; i < n_others; ++i) {
36
- var other = others[i], found = cur.indexOf(other.open);
37
- if (found > -1) {
38
- stream.backUp(cur.length - found);
39
- cur = cur.slice(0, found);
40
- }
41
- }
42
- return outerToken;
43
- } else {
44
- var curInner = state.innerActive;
45
- if (stream.match(curInner.close)) {
46
- state.innerActive = state.inner = null;
47
- return curInner.delimStyle;
48
- }
49
- var innerToken = curInner.mode.token(stream, state.inner);
50
- var cur = stream.current(), found = cur.indexOf(curInner.close);
51
- if (found > -1) stream.backUp(cur.length - found);
52
- return innerToken;
53
- }
54
- },
55
-
56
- indent: function(state, textAfter) {
57
- var mode = state.innerActive || outer;
58
- if (!mode.indent) return CodeMirror.Pass;
59
- return mode.indent(state.innerActive ? state.inner : state.outer, textAfter);
60
- },
61
-
62
- compareStates: function(a, b) {
63
- if (a.innerActive != b.innerActive) return false;
64
- var mode = a.innerActive || outer;
65
- if (!mode.compareStates) return CodeMirror.Pass;
66
- return mode.compareStates(a.innerActive ? a.inner : a.outer,
67
- b.innerActive ? b.inner : b.outer);
68
- },
69
-
70
- electricChars: outer.electricChars
71
- };
72
- };
@@ -1,123 +0,0 @@
1
- (function () {
2
- function forEach(arr, f) {
3
- for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
4
- }
5
-
6
- function arrayContains(arr, item) {
7
- if (!Array.prototype.indexOf) {
8
- var i = arr.length;
9
- while (i--) {
10
- if (arr[i] === item) {
11
- return true;
12
- }
13
- }
14
- return false;
15
- }
16
- return arr.indexOf(item) != -1;
17
- }
18
-
19
- function scriptHint(editor, keywords, getToken) {
20
- // Find the token at the cursor
21
- var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token;
22
- // If it's not a 'word-style' token, ignore the token.
23
-
24
- if (!/^[\w$_]*$/.test(token.string)) {
25
- token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state,
26
- className: token.string == ":" ? "pig-type" : null};
27
- }
28
-
29
- if (!context) var context = [];
30
- context.push(tprop);
31
-
32
- completionList = getCompletions(token, context);
33
- completionList = completionList.sort();
34
- //prevent autocomplete for last word, instead show dropdown with one word
35
- if(completionList.length == 1) {
36
- completionList.push(" ");
37
- }
38
-
39
- return {list: completionList,
40
- from: {line: cur.line, ch: token.start},
41
- to: {line: cur.line, ch: token.end}};
42
- }
43
-
44
- CodeMirror.pigHint = function(editor) {
45
- return scriptHint(editor, pigKeywordsU, function (e, cur) {return e.getTokenAt(cur);});
46
- }
47
-
48
- function toTitleCase(str) {
49
- return str.replace(/(?:^|\s)\w/g, function(match) {
50
- return match.toUpperCase();
51
- });
52
- }
53
-
54
- var pigKeywords = "VOID IMPORT RETURNS DEFINE LOAD FILTER FOREACH ORDER CUBE DISTINCT COGROUP "
55
- + "JOIN CROSS UNION SPLIT INTO IF OTHERWISE ALL AS BY USING INNER OUTER ONSCHEMA PARALLEL "
56
- + "PARTITION GROUP AND OR NOT GENERATE FLATTEN ASC DESC IS STREAM THROUGH STORE MAPREDUCE "
57
- + "SHIP CACHE INPUT OUTPUT STDERROR STDIN STDOUT LIMIT SAMPLE LEFT RIGHT FULL EQ GT LT GTE LTE "
58
- + "NEQ MATCHES TRUE FALSE";
59
- var pigKeywordsU = pigKeywords.split(" ");
60
- var pigKeywordsL = pigKeywords.toLowerCase().split(" ");
61
-
62
- var pigTypes = "BOOLEAN INT LONG FLOAT DOUBLE CHARARRAY BYTEARRAY BAG TUPLE MAP";
63
- var pigTypesU = pigTypes.split(" ");
64
- var pigTypesL = pigTypes.toLowerCase().split(" ");
65
-
66
- var pigBuiltins = "ABS ACOS ARITY ASIN ATAN AVG BAGSIZE BINSTORAGE BLOOM BUILDBLOOM CBRT CEIL "
67
- + "CONCAT COR COS COSH COUNT COUNT_STAR COV CONSTANTSIZE CUBEDIMENSIONS DIFF DISTINCT DOUBLEABS "
68
- + "DOUBLEAVG DOUBLEBASE DOUBLEMAX DOUBLEMIN DOUBLEROUND DOUBLESUM EXP FLOOR FLOATABS FLOATAVG "
69
- + "FLOATMAX FLOATMIN FLOATROUND FLOATSUM GENERICINVOKER INDEXOF INTABS INTAVG INTMAX INTMIN "
70
- + "INTSUM INVOKEFORDOUBLE INVOKEFORFLOAT INVOKEFORINT INVOKEFORLONG INVOKEFORSTRING INVOKER "
71
- + "ISEMPTY JSONLOADER JSONMETADATA JSONSTORAGE LAST_INDEX_OF LCFIRST LOG LOG10 LOWER LONGABS "
72
- + "LONGAVG LONGMAX LONGMIN LONGSUM MAX MIN MAPSIZE MONITOREDUDF NONDETERMINISTIC OUTPUTSCHEMA "
73
- + "PIGSTORAGE PIGSTREAMING RANDOM REGEX_EXTRACT REGEX_EXTRACT_ALL REPLACE ROUND SIN SINH SIZE "
74
- + "SQRT STRSPLIT SUBSTRING SUM STRINGCONCAT STRINGMAX STRINGMIN STRINGSIZE TAN TANH TOBAG "
75
- + "TOKENIZE TOMAP TOP TOTUPLE TRIM TEXTLOADER TUPLESIZE UCFIRST UPPER UTF8STORAGECONVERTER";
76
- var pigBuiltinsU = pigBuiltins.split(" ").join("() ").split(" ");
77
- var pigBuiltinsL = pigBuiltins.toLowerCase().split(" ").join("() ").split(" ");
78
- var pigBuiltinsC = ("BagSize BinStorage Bloom BuildBloom ConstantSize CubeDimensions DoubleAbs "
79
- + "DoubleAvg DoubleBase DoubleMax DoubleMin DoubleRound DoubleSum FloatAbs FloatAvg FloatMax "
80
- + "FloatMin FloatRound FloatSum GenericInvoker IntAbs IntAvg IntMax IntMin IntSum "
81
- + "InvokeForDouble InvokeForFloat InvokeForInt InvokeForLong InvokeForString Invoker "
82
- + "IsEmpty JsonLoader JsonMetadata JsonStorage LongAbs LongAvg LongMax LongMin LongSum MapSize "
83
- + "MonitoredUDF Nondeterministic OutputSchema PigStorage PigStreaming StringConcat StringMax "
84
- + "StringMin StringSize TextLoader TupleSize Utf8StorageConverter").split(" ").join("() ").split(" ");
85
-
86
- function getCompletions(token, context) {
87
- var found = [], start = token.string;
88
- function maybeAdd(str) {
89
- if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str);
90
- }
91
-
92
- function gatherCompletions(obj) {
93
- if(obj == ":") {
94
- forEach(pigTypesL, maybeAdd);
95
- }
96
- else {
97
- forEach(pigBuiltinsU, maybeAdd);
98
- forEach(pigBuiltinsL, maybeAdd);
99
- forEach(pigBuiltinsC, maybeAdd);
100
- forEach(pigTypesU, maybeAdd);
101
- forEach(pigTypesL, maybeAdd);
102
- forEach(pigKeywordsU, maybeAdd);
103
- forEach(pigKeywordsL, maybeAdd);
104
- }
105
- }
106
-
107
- if (context) {
108
- // If this is a property, see if it belongs to some object we can
109
- // find in the current environment.
110
- var obj = context.pop(), base;
111
-
112
- if (obj.className == "pig-word")
113
- base = obj.string;
114
- else if(obj.className == "pig-type")
115
- base = ":" + obj.string;
116
-
117
- while (base != null && context.length)
118
- base = base[context.pop().string];
119
- if (base != null) gatherCompletions(base);
120
- }
121
- return found;
122
- }
123
- })();
@@ -1,49 +0,0 @@
1
- CodeMirror.runMode = function(string, modespec, callback, options) {
2
- var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
3
- var isNode = callback.nodeType == 1;
4
- var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
5
- if (isNode) {
6
- var node = callback, accum = [], col = 0;
7
- callback = function(text, style) {
8
- if (text == "\n") {
9
- accum.push("<br>");
10
- col = 0;
11
- return;
12
- }
13
- var escaped = "";
14
- // HTML-escape and replace tabs
15
- for (var pos = 0;;) {
16
- var idx = text.indexOf("\t", pos);
17
- if (idx == -1) {
18
- escaped += CodeMirror.htmlEscape(text.slice(pos));
19
- col += text.length - pos;
20
- break;
21
- } else {
22
- col += idx - pos;
23
- escaped += CodeMirror.htmlEscape(text.slice(pos, idx));
24
- var size = tabSize - col % tabSize;
25
- col += size;
26
- for (var i = 0; i < size; ++i) escaped += " ";
27
- pos = idx + 1;
28
- }
29
- }
30
-
31
- if (style)
32
- accum.push("<span class=\"cm-" + CodeMirror.htmlEscape(style) + "\">" + escaped + "</span>");
33
- else
34
- accum.push(escaped);
35
- }
36
- }
37
- var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode);
38
- for (var i = 0, e = lines.length; i < e; ++i) {
39
- if (i) callback("\n");
40
- var stream = new CodeMirror.StringStream(lines[i]);
41
- while (!stream.eol()) {
42
- var style = mode.token(stream, state);
43
- callback(stream.current(), style, i, stream.start);
44
- stream.start = stream.pos;
45
- }
46
- }
47
- if (isNode)
48
- node.innerHTML = accum.join("");
49
- };