codemirror-rails 3.02 → 3.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +1 -1
- data/LICENSE +1 -1
- data/codemirror-rails.gemspec +1 -0
- data/doc/CodeMirror-LICENSE +5 -1
- data/lib/codemirror/rails/version.rb +2 -2
- data/vendor/assets/javascripts/codemirror/{utils → addons/dialog}/dialog.js +4 -0
- data/vendor/assets/javascripts/codemirror/addons/display/placeholder.js +54 -0
- data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +54 -0
- data/vendor/assets/javascripts/codemirror/{utils → addons/edit}/closetag.js +9 -8
- data/vendor/assets/javascripts/codemirror/{utils → addons/edit}/continuecomment.js +12 -4
- data/vendor/assets/javascripts/codemirror/addons/edit/continuelist.js +25 -0
- data/vendor/assets/javascripts/codemirror/{utils → addons/edit}/matchbrackets.js +30 -11
- data/vendor/assets/javascripts/codemirror/addons/fold/brace-fold.js +31 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/foldcode.js +32 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/indent-fold.js +11 -0
- data/vendor/assets/javascripts/codemirror/addons/fold/xml-fold.js +64 -0
- data/vendor/assets/javascripts/codemirror/addons/hint/html-hint.js +582 -0
- data/vendor/assets/javascripts/codemirror/{utils → addons/hint}/javascript-hint.js +15 -11
- data/vendor/assets/javascripts/codemirror/{utils → addons/hint}/pig-hint.js +19 -19
- data/vendor/assets/javascripts/codemirror/{utils → addons/hint}/python-hint.js +2 -2
- data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +180 -0
- data/vendor/assets/javascripts/codemirror/{utils → addons/hint}/xml-hint.js +5 -18
- data/vendor/assets/javascripts/codemirror/addons/lint/javascript-lint.js +127 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/json-lint.js +14 -0
- data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +197 -0
- data/vendor/assets/javascripts/codemirror/{utils → addons/mode}/loadmode.js +0 -0
- data/vendor/assets/javascripts/codemirror/{utils → addons/mode}/multiplex.js +2 -2
- data/vendor/assets/javascripts/codemirror/{utils → addons/mode}/overlay.js +2 -2
- data/vendor/assets/javascripts/codemirror/{utils → addons/runmode}/colorize.js +0 -0
- data/vendor/assets/javascripts/codemirror/{utils → addons/runmode}/runmode-standalone.js +2 -3
- data/vendor/assets/javascripts/codemirror/{utils → addons/runmode}/runmode.js +0 -0
- data/vendor/assets/javascripts/codemirror/addons/runmode/runmode.node.js +89 -0
- data/vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js +60 -0
- data/vendor/assets/javascripts/codemirror/{utils → addons/search}/search.js +5 -5
- data/vendor/assets/javascripts/codemirror/{utils → addons/search}/searchcursor.js +37 -30
- data/vendor/assets/javascripts/codemirror/addons/selection/active-line.js +39 -0
- data/vendor/assets/javascripts/codemirror/addons/selection/mark-selection.js +34 -0
- data/vendor/assets/javascripts/codemirror/keymaps/vim.js +721 -188
- data/vendor/assets/javascripts/codemirror/modes/asterisk.js +6 -6
- data/vendor/assets/javascripts/codemirror/modes/clike.js +14 -14
- data/vendor/assets/javascripts/codemirror/modes/clojure.js +23 -7
- data/vendor/assets/javascripts/codemirror/modes/coffeescript.js +2 -2
- data/vendor/assets/javascripts/codemirror/modes/css.js +337 -235
- data/vendor/assets/javascripts/codemirror/modes/ecl.js +12 -12
- data/vendor/assets/javascripts/codemirror/modes/erlang.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/gas.js +326 -0
- data/vendor/assets/javascripts/codemirror/modes/gfm.js +1 -0
- data/vendor/assets/javascripts/codemirror/modes/haskell.js +26 -26
- data/vendor/assets/javascripts/codemirror/modes/haxe.js +17 -17
- data/vendor/assets/javascripts/codemirror/modes/htmlembedded.js +6 -6
- data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +43 -23
- data/vendor/assets/javascripts/codemirror/modes/javascript.js +78 -33
- data/vendor/assets/javascripts/codemirror/modes/jinja2.js +2 -2
- data/vendor/assets/javascripts/codemirror/modes/less.js +38 -38
- data/vendor/assets/javascripts/codemirror/modes/livescript.js +267 -0
- data/vendor/assets/javascripts/codemirror/modes/lua.js +7 -7
- data/vendor/assets/javascripts/codemirror/modes/markdown.js +108 -57
- data/vendor/assets/javascripts/codemirror/modes/mirc.js +177 -0
- data/vendor/assets/javascripts/codemirror/modes/ntriples.js +22 -22
- data/vendor/assets/javascripts/codemirror/modes/ocaml.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/perl.js +791 -791
- data/vendor/assets/javascripts/codemirror/modes/php.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/pig.js +163 -163
- data/vendor/assets/javascripts/codemirror/modes/python.js +31 -31
- data/vendor/assets/javascripts/codemirror/modes/q.js +124 -0
- data/vendor/assets/javascripts/codemirror/modes/rst.js +486 -250
- data/vendor/assets/javascripts/codemirror/modes/sass.js +3 -3
- data/vendor/assets/javascripts/codemirror/modes/scss_test.js +80 -0
- data/vendor/assets/javascripts/codemirror/modes/shell.js +2 -2
- data/vendor/assets/javascripts/codemirror/modes/sieve.js +10 -10
- data/vendor/assets/javascripts/codemirror/modes/smalltalk.js +129 -129
- data/vendor/assets/javascripts/codemirror/modes/smarty.js +3 -3
- data/vendor/assets/javascripts/codemirror/modes/sparql.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/sql.js +23 -23
- data/vendor/assets/javascripts/codemirror/modes/stex.js +192 -121
- data/vendor/assets/javascripts/codemirror/modes/tcl.js +131 -0
- data/vendor/assets/javascripts/codemirror/modes/test.js +64 -0
- data/vendor/assets/javascripts/codemirror/modes/tiddlywiki.js +345 -345
- data/vendor/assets/javascripts/codemirror/modes/tiki.js +297 -298
- data/vendor/assets/javascripts/codemirror/modes/turtle.js +145 -0
- data/vendor/assets/javascripts/codemirror/modes/vb.js +31 -32
- data/vendor/assets/javascripts/codemirror/modes/vbscript.js +4 -4
- data/vendor/assets/javascripts/codemirror/modes/xml.js +10 -6
- data/vendor/assets/javascripts/codemirror/modes/xquery.js +55 -55
- data/vendor/assets/javascripts/codemirror/modes/yaml.js +90 -90
- data/vendor/assets/javascripts/codemirror/modes/z80.js +82 -110
- data/vendor/assets/javascripts/codemirror.js +1914 -1115
- data/vendor/assets/stylesheets/codemirror/{utils → addons/dialog}/dialog.css +0 -0
- data/vendor/assets/stylesheets/codemirror/addons/hint/show-hint.css +38 -0
- data/vendor/assets/stylesheets/codemirror/addons/lint/lint.css +96 -0
- data/vendor/assets/stylesheets/codemirror/modes/tiki.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/ambiance-mobile.css +0 -1
- data/vendor/assets/stylesheets/codemirror/themes/ambiance.css +0 -1
- data/vendor/assets/stylesheets/codemirror/themes/eclipse.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/erlang-dark.css +5 -5
- data/vendor/assets/stylesheets/codemirror/themes/midnight.css +52 -0
- data/vendor/assets/stylesheets/codemirror/themes/xq-light.css +43 -0
- data/vendor/assets/stylesheets/codemirror.css +16 -10
- metadata +60 -52
- data/vendor/assets/javascripts/codemirror/modes/mysql.js +0 -203
- data/vendor/assets/javascripts/codemirror/modes/plsql.js +0 -216
- data/vendor/assets/javascripts/codemirror/utils/collapserange.js +0 -68
- data/vendor/assets/javascripts/codemirror/utils/continuelist.js +0 -28
- data/vendor/assets/javascripts/codemirror/utils/foldcode.js +0 -183
- data/vendor/assets/javascripts/codemirror/utils/formatting.js +0 -114
- data/vendor/assets/javascripts/codemirror/utils/match-highlighter.js +0 -46
- data/vendor/assets/javascripts/codemirror/utils/simple-hint.js +0 -102
- data/vendor/assets/stylesheets/codemirror/utils/simple-hint.css +0 -16
@@ -75,18 +75,18 @@ CodeMirror.defineMode("ecl", function(config) {
|
|
75
75
|
} else if (builtin.propertyIsEnumerable(cur)) {
|
76
76
|
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
|
77
77
|
return "builtin";
|
78
|
-
} else { //Data types are of from KEYWORD##
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
78
|
+
} else { //Data types are of from KEYWORD##
|
79
|
+
var i = cur.length - 1;
|
80
|
+
while(i >= 0 && (!isNaN(cur[i]) || cur[i] == '_'))
|
81
|
+
--i;
|
82
|
+
|
83
|
+
if (i > 0) {
|
84
|
+
var cur2 = cur.substr(0, i + 1);
|
85
|
+
if (variable_3.propertyIsEnumerable(cur2)) {
|
86
|
+
if (blockKeywords.propertyIsEnumerable(cur2)) curPunc = "newstatement";
|
87
|
+
return "variable-3";
|
88
|
+
}
|
89
|
+
}
|
90
90
|
}
|
91
91
|
if (atoms.propertyIsEnumerable(cur)) return "atom";
|
92
92
|
return null;
|
@@ -0,0 +1,326 @@
|
|
1
|
+
CodeMirror.defineMode("gas", function(_config, parserConfig) {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
// If an architecture is specified, its initialization function may
|
5
|
+
// populate this array with custom parsing functions which will be
|
6
|
+
// tried in the event that the standard functions do not find a match.
|
7
|
+
var custom = [];
|
8
|
+
|
9
|
+
// The symbol used to start a line comment changes based on the target
|
10
|
+
// architecture.
|
11
|
+
// If no architecture is pased in "parserConfig" then only multiline
|
12
|
+
// comments will have syntax support.
|
13
|
+
var lineCommentStartSymbol = "";
|
14
|
+
|
15
|
+
// These directives are architecture independent.
|
16
|
+
// Machine specific directives should go in their respective
|
17
|
+
// architecture initialization function.
|
18
|
+
// Reference:
|
19
|
+
// http://sourceware.org/binutils/docs/as/Pseudo-Ops.html#Pseudo-Ops
|
20
|
+
var directives = {
|
21
|
+
".abort" : "builtin",
|
22
|
+
".align" : "builtin",
|
23
|
+
".altmacro" : "builtin",
|
24
|
+
".ascii" : "builtin",
|
25
|
+
".asciz" : "builtin",
|
26
|
+
".balign" : "builtin",
|
27
|
+
".balignw" : "builtin",
|
28
|
+
".balignl" : "builtin",
|
29
|
+
".bundle_align_mode" : "builtin",
|
30
|
+
".bundle_lock" : "builtin",
|
31
|
+
".bundle_unlock" : "builtin",
|
32
|
+
".byte" : "builtin",
|
33
|
+
".cfi_startproc" : "builtin",
|
34
|
+
".comm" : "builtin",
|
35
|
+
".data" : "builtin",
|
36
|
+
".def" : "builtin",
|
37
|
+
".desc" : "builtin",
|
38
|
+
".dim" : "builtin",
|
39
|
+
".double" : "builtin",
|
40
|
+
".eject" : "builtin",
|
41
|
+
".else" : "builtin",
|
42
|
+
".elseif" : "builtin",
|
43
|
+
".end" : "builtin",
|
44
|
+
".endef" : "builtin",
|
45
|
+
".endfunc" : "builtin",
|
46
|
+
".endif" : "builtin",
|
47
|
+
".equ" : "builtin",
|
48
|
+
".equiv" : "builtin",
|
49
|
+
".eqv" : "builtin",
|
50
|
+
".err" : "builtin",
|
51
|
+
".error" : "builtin",
|
52
|
+
".exitm" : "builtin",
|
53
|
+
".extern" : "builtin",
|
54
|
+
".fail" : "builtin",
|
55
|
+
".file" : "builtin",
|
56
|
+
".fill" : "builtin",
|
57
|
+
".float" : "builtin",
|
58
|
+
".func" : "builtin",
|
59
|
+
".global" : "builtin",
|
60
|
+
".gnu_attribute" : "builtin",
|
61
|
+
".hidden" : "builtin",
|
62
|
+
".hword" : "builtin",
|
63
|
+
".ident" : "builtin",
|
64
|
+
".if" : "builtin",
|
65
|
+
".incbin" : "builtin",
|
66
|
+
".include" : "builtin",
|
67
|
+
".int" : "builtin",
|
68
|
+
".internal" : "builtin",
|
69
|
+
".irp" : "builtin",
|
70
|
+
".irpc" : "builtin",
|
71
|
+
".lcomm" : "builtin",
|
72
|
+
".lflags" : "builtin",
|
73
|
+
".line" : "builtin",
|
74
|
+
".linkonce" : "builtin",
|
75
|
+
".list" : "builtin",
|
76
|
+
".ln" : "builtin",
|
77
|
+
".loc" : "builtin",
|
78
|
+
".loc_mark_labels" : "builtin",
|
79
|
+
".local" : "builtin",
|
80
|
+
".long" : "builtin",
|
81
|
+
".macro" : "builtin",
|
82
|
+
".mri" : "builtin",
|
83
|
+
".noaltmacro" : "builtin",
|
84
|
+
".nolist" : "builtin",
|
85
|
+
".octa" : "builtin",
|
86
|
+
".offset" : "builtin",
|
87
|
+
".org" : "builtin",
|
88
|
+
".p2align" : "builtin",
|
89
|
+
".popsection" : "builtin",
|
90
|
+
".previous" : "builtin",
|
91
|
+
".print" : "builtin",
|
92
|
+
".protected" : "builtin",
|
93
|
+
".psize" : "builtin",
|
94
|
+
".purgem" : "builtin",
|
95
|
+
".pushsection" : "builtin",
|
96
|
+
".quad" : "builtin",
|
97
|
+
".reloc" : "builtin",
|
98
|
+
".rept" : "builtin",
|
99
|
+
".sbttl" : "builtin",
|
100
|
+
".scl" : "builtin",
|
101
|
+
".section" : "builtin",
|
102
|
+
".set" : "builtin",
|
103
|
+
".short" : "builtin",
|
104
|
+
".single" : "builtin",
|
105
|
+
".size" : "builtin",
|
106
|
+
".skip" : "builtin",
|
107
|
+
".sleb128" : "builtin",
|
108
|
+
".space" : "builtin",
|
109
|
+
".stab" : "builtin",
|
110
|
+
".string" : "builtin",
|
111
|
+
".struct" : "builtin",
|
112
|
+
".subsection" : "builtin",
|
113
|
+
".symver" : "builtin",
|
114
|
+
".tag" : "builtin",
|
115
|
+
".text" : "builtin",
|
116
|
+
".title" : "builtin",
|
117
|
+
".type" : "builtin",
|
118
|
+
".uleb128" : "builtin",
|
119
|
+
".val" : "builtin",
|
120
|
+
".version" : "builtin",
|
121
|
+
".vtable_entry" : "builtin",
|
122
|
+
".vtable_inherit" : "builtin",
|
123
|
+
".warning" : "builtin",
|
124
|
+
".weak" : "builtin",
|
125
|
+
".weakref" : "builtin",
|
126
|
+
".word" : "builtin"
|
127
|
+
};
|
128
|
+
|
129
|
+
var registers = {};
|
130
|
+
|
131
|
+
function x86(_parserConfig) {
|
132
|
+
lineCommentStartSymbol = "#";
|
133
|
+
|
134
|
+
registers.ax = "variable";
|
135
|
+
registers.eax = "variable-2";
|
136
|
+
registers.rax = "variable-3";
|
137
|
+
|
138
|
+
registers.bx = "variable";
|
139
|
+
registers.ebx = "variable-2";
|
140
|
+
registers.rbx = "variable-3";
|
141
|
+
|
142
|
+
registers.cx = "variable";
|
143
|
+
registers.ecx = "variable-2";
|
144
|
+
registers.rcx = "variable-3";
|
145
|
+
|
146
|
+
registers.dx = "variable";
|
147
|
+
registers.edx = "variable-2";
|
148
|
+
registers.rdx = "variable-3";
|
149
|
+
|
150
|
+
registers.si = "variable";
|
151
|
+
registers.esi = "variable-2";
|
152
|
+
registers.rsi = "variable-3";
|
153
|
+
|
154
|
+
registers.di = "variable";
|
155
|
+
registers.edi = "variable-2";
|
156
|
+
registers.rdi = "variable-3";
|
157
|
+
|
158
|
+
registers.sp = "variable";
|
159
|
+
registers.esp = "variable-2";
|
160
|
+
registers.rsp = "variable-3";
|
161
|
+
|
162
|
+
registers.bp = "variable";
|
163
|
+
registers.ebp = "variable-2";
|
164
|
+
registers.rbp = "variable-3";
|
165
|
+
|
166
|
+
registers.ip = "variable";
|
167
|
+
registers.eip = "variable-2";
|
168
|
+
registers.rip = "variable-3";
|
169
|
+
|
170
|
+
registers.cs = "keyword";
|
171
|
+
registers.ds = "keyword";
|
172
|
+
registers.ss = "keyword";
|
173
|
+
registers.es = "keyword";
|
174
|
+
registers.fs = "keyword";
|
175
|
+
registers.gs = "keyword";
|
176
|
+
}
|
177
|
+
|
178
|
+
function armv6(_parserConfig) {
|
179
|
+
// Reference:
|
180
|
+
// http://infocenter.arm.com/help/topic/com.arm.doc.qrc0001l/QRC0001_UAL.pdf
|
181
|
+
// http://infocenter.arm.com/help/topic/com.arm.doc.ddi0301h/DDI0301H_arm1176jzfs_r0p7_trm.pdf
|
182
|
+
lineCommentStartSymbol = "@";
|
183
|
+
directives.syntax = "builtin";
|
184
|
+
|
185
|
+
registers.r0 = "variable";
|
186
|
+
registers.r1 = "variable";
|
187
|
+
registers.r2 = "variable";
|
188
|
+
registers.r3 = "variable";
|
189
|
+
registers.r4 = "variable";
|
190
|
+
registers.r5 = "variable";
|
191
|
+
registers.r6 = "variable";
|
192
|
+
registers.r7 = "variable";
|
193
|
+
registers.r8 = "variable";
|
194
|
+
registers.r9 = "variable";
|
195
|
+
registers.r10 = "variable";
|
196
|
+
registers.r11 = "variable";
|
197
|
+
registers.r12 = "variable";
|
198
|
+
|
199
|
+
registers.sp = "variable-2";
|
200
|
+
registers.lr = "variable-2";
|
201
|
+
registers.pc = "variable-2";
|
202
|
+
registers.r13 = registers.sp;
|
203
|
+
registers.r14 = registers.lr;
|
204
|
+
registers.r15 = registers.pc;
|
205
|
+
|
206
|
+
custom.push(function(ch, stream) {
|
207
|
+
if (ch === '#') {
|
208
|
+
stream.eatWhile(/\w/);
|
209
|
+
return "number";
|
210
|
+
}
|
211
|
+
});
|
212
|
+
}
|
213
|
+
|
214
|
+
var arch = parserConfig.architecture.toLowerCase();
|
215
|
+
if (arch === "x86") {
|
216
|
+
x86(parserConfig);
|
217
|
+
} else if (arch === "arm" || arch === "armv6") {
|
218
|
+
armv6(parserConfig);
|
219
|
+
}
|
220
|
+
|
221
|
+
function nextUntilUnescaped(stream, end) {
|
222
|
+
var escaped = false, next;
|
223
|
+
while ((next = stream.next()) != null) {
|
224
|
+
if (next === end && !escaped) {
|
225
|
+
return false;
|
226
|
+
}
|
227
|
+
escaped = !escaped && next === "\\";
|
228
|
+
}
|
229
|
+
return escaped;
|
230
|
+
}
|
231
|
+
|
232
|
+
function clikeComment(stream, state) {
|
233
|
+
var maybeEnd = false, ch;
|
234
|
+
while ((ch = stream.next()) != null) {
|
235
|
+
if (ch === "/" && maybeEnd) {
|
236
|
+
state.tokenize = null;
|
237
|
+
break;
|
238
|
+
}
|
239
|
+
maybeEnd = (ch === "*");
|
240
|
+
}
|
241
|
+
return "comment";
|
242
|
+
}
|
243
|
+
|
244
|
+
return {
|
245
|
+
startState: function() {
|
246
|
+
return {
|
247
|
+
tokenize: null
|
248
|
+
};
|
249
|
+
},
|
250
|
+
|
251
|
+
token: function(stream, state) {
|
252
|
+
if (state.tokenize) {
|
253
|
+
return state.tokenize(stream, state);
|
254
|
+
}
|
255
|
+
|
256
|
+
if (stream.eatSpace()) {
|
257
|
+
return null;
|
258
|
+
}
|
259
|
+
|
260
|
+
var style, cur, ch = stream.next();
|
261
|
+
|
262
|
+
if (ch === "/") {
|
263
|
+
if (stream.eat("*")) {
|
264
|
+
state.tokenize = clikeComment;
|
265
|
+
return clikeComment(stream, state);
|
266
|
+
}
|
267
|
+
}
|
268
|
+
|
269
|
+
if (ch === lineCommentStartSymbol) {
|
270
|
+
stream.skipToEnd();
|
271
|
+
return "comment";
|
272
|
+
}
|
273
|
+
|
274
|
+
if (ch === '"') {
|
275
|
+
nextUntilUnescaped(stream, '"');
|
276
|
+
return "string";
|
277
|
+
}
|
278
|
+
|
279
|
+
if (ch === '.') {
|
280
|
+
stream.eatWhile(/\w/);
|
281
|
+
cur = stream.current().toLowerCase();
|
282
|
+
style = directives[cur];
|
283
|
+
return style || null;
|
284
|
+
}
|
285
|
+
|
286
|
+
if (ch === '=') {
|
287
|
+
stream.eatWhile(/\w/);
|
288
|
+
return "tag";
|
289
|
+
}
|
290
|
+
|
291
|
+
if (ch === '{') {
|
292
|
+
return "braket";
|
293
|
+
}
|
294
|
+
|
295
|
+
if (ch === '}') {
|
296
|
+
return "braket";
|
297
|
+
}
|
298
|
+
|
299
|
+
if (/\d/.test(ch)) {
|
300
|
+
if (ch === "0" && stream.eat("x")) {
|
301
|
+
stream.eatWhile(/[0-9a-fA-F]/);
|
302
|
+
return "number";
|
303
|
+
}
|
304
|
+
stream.eatWhile(/\d/);
|
305
|
+
return "number";
|
306
|
+
}
|
307
|
+
|
308
|
+
if (/\w/.test(ch)) {
|
309
|
+
stream.eatWhile(/\w/);
|
310
|
+
if (stream.eat(":")) {
|
311
|
+
return 'tag';
|
312
|
+
}
|
313
|
+
cur = stream.current().toLowerCase();
|
314
|
+
style = registers[cur];
|
315
|
+
return style || null;
|
316
|
+
}
|
317
|
+
|
318
|
+
for (var i = 0; i < custom.length; i++) {
|
319
|
+
style = custom[i](ch, stream, state);
|
320
|
+
if (style) {
|
321
|
+
return style;
|
322
|
+
}
|
323
|
+
}
|
324
|
+
}
|
325
|
+
};
|
326
|
+
});
|
@@ -89,6 +89,7 @@ CodeMirror.defineMode("gfm", function(config) {
|
|
89
89
|
CodeMirror.defineMIME("gfmBase", {
|
90
90
|
name: "markdown",
|
91
91
|
underscoresBreakWords: false,
|
92
|
+
taskLists: true,
|
92
93
|
fencedCodeBlocks: true
|
93
94
|
});
|
94
95
|
return CodeMirror.overlayMode(CodeMirror.getMode(config, "gfmBase"), gfmOverlay);
|
@@ -4,7 +4,7 @@ CodeMirror.defineMode("haskell", function() {
|
|
4
4
|
setState(f);
|
5
5
|
return f(source, setState);
|
6
6
|
}
|
7
|
-
|
7
|
+
|
8
8
|
// These should all be Unicode extended, as per the Haskell 2010 report
|
9
9
|
var smallRE = /[a-z_]/;
|
10
10
|
var largeRE = /[A-Z]/;
|
@@ -15,12 +15,12 @@ CodeMirror.defineMode("haskell", function() {
|
|
15
15
|
var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:]/;
|
16
16
|
var specialRE = /[(),;[\]`{}]/;
|
17
17
|
var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer
|
18
|
-
|
18
|
+
|
19
19
|
function normal(source, setState) {
|
20
20
|
if (source.eatWhile(whiteCharRE)) {
|
21
21
|
return null;
|
22
22
|
}
|
23
|
-
|
23
|
+
|
24
24
|
var ch = source.next();
|
25
25
|
if (specialRE.test(ch)) {
|
26
26
|
if (ch == '{' && source.eat('-')) {
|
@@ -32,7 +32,7 @@ CodeMirror.defineMode("haskell", function() {
|
|
32
32
|
}
|
33
33
|
return null;
|
34
34
|
}
|
35
|
-
|
35
|
+
|
36
36
|
if (ch == '\'') {
|
37
37
|
if (source.eat('\\')) {
|
38
38
|
source.next(); // should handle other escapes here
|
@@ -45,11 +45,11 @@ CodeMirror.defineMode("haskell", function() {
|
|
45
45
|
}
|
46
46
|
return "error";
|
47
47
|
}
|
48
|
-
|
48
|
+
|
49
49
|
if (ch == '"') {
|
50
50
|
return switchState(source, setState, stringLiteral);
|
51
51
|
}
|
52
|
-
|
52
|
+
|
53
53
|
if (largeRE.test(ch)) {
|
54
54
|
source.eatWhile(idRE);
|
55
55
|
if (source.eat('.')) {
|
@@ -57,12 +57,12 @@ CodeMirror.defineMode("haskell", function() {
|
|
57
57
|
}
|
58
58
|
return "variable-2";
|
59
59
|
}
|
60
|
-
|
60
|
+
|
61
61
|
if (smallRE.test(ch)) {
|
62
62
|
source.eatWhile(idRE);
|
63
63
|
return "variable";
|
64
64
|
}
|
65
|
-
|
65
|
+
|
66
66
|
if (digitRE.test(ch)) {
|
67
67
|
if (ch == '0') {
|
68
68
|
if (source.eat(/[xX]/)) {
|
@@ -87,7 +87,7 @@ CodeMirror.defineMode("haskell", function() {
|
|
87
87
|
}
|
88
88
|
return t;
|
89
89
|
}
|
90
|
-
|
90
|
+
|
91
91
|
if (symbolRE.test(ch)) {
|
92
92
|
if (ch == '-' && source.eat(/-/)) {
|
93
93
|
source.eatWhile(/-/);
|
@@ -101,12 +101,12 @@ CodeMirror.defineMode("haskell", function() {
|
|
101
101
|
t = "variable-2";
|
102
102
|
}
|
103
103
|
source.eatWhile(symbolRE);
|
104
|
-
return t;
|
104
|
+
return t;
|
105
105
|
}
|
106
|
-
|
106
|
+
|
107
107
|
return "error";
|
108
108
|
}
|
109
|
-
|
109
|
+
|
110
110
|
function ncomment(type, nest) {
|
111
111
|
if (nest == 0) {
|
112
112
|
return normal;
|
@@ -130,7 +130,7 @@ CodeMirror.defineMode("haskell", function() {
|
|
130
130
|
return type;
|
131
131
|
};
|
132
132
|
}
|
133
|
-
|
133
|
+
|
134
134
|
function stringLiteral(source, setState) {
|
135
135
|
while (!source.eol()) {
|
136
136
|
var ch = source.next();
|
@@ -153,7 +153,7 @@ CodeMirror.defineMode("haskell", function() {
|
|
153
153
|
setState(normal);
|
154
154
|
return "error";
|
155
155
|
}
|
156
|
-
|
156
|
+
|
157
157
|
function stringGap(source, setState) {
|
158
158
|
if (source.eat('\\')) {
|
159
159
|
return switchState(source, setState, stringLiteral);
|
@@ -162,8 +162,8 @@ CodeMirror.defineMode("haskell", function() {
|
|
162
162
|
setState(normal);
|
163
163
|
return "error";
|
164
164
|
}
|
165
|
-
|
166
|
-
|
165
|
+
|
166
|
+
|
167
167
|
var wellKnownWords = (function() {
|
168
168
|
var wkw = {};
|
169
169
|
function setType(t) {
|
@@ -172,19 +172,19 @@ CodeMirror.defineMode("haskell", function() {
|
|
172
172
|
wkw[arguments[i]] = t;
|
173
173
|
};
|
174
174
|
}
|
175
|
-
|
175
|
+
|
176
176
|
setType("keyword")(
|
177
177
|
"case", "class", "data", "default", "deriving", "do", "else", "foreign",
|
178
178
|
"if", "import", "in", "infix", "infixl", "infixr", "instance", "let",
|
179
179
|
"module", "newtype", "of", "then", "type", "where", "_");
|
180
|
-
|
180
|
+
|
181
181
|
setType("keyword")(
|
182
182
|
"\.\.", ":", "::", "=", "\\", "\"", "<-", "->", "@", "~", "=>");
|
183
|
-
|
183
|
+
|
184
184
|
setType("builtin")(
|
185
185
|
"!!", "$!", "$", "&&", "+", "++", "-", ".", "/", "/=", "<", "<=", "=<<",
|
186
186
|
"==", ">", ">=", ">>", ">>=", "^", "^^", "||", "*", "**");
|
187
|
-
|
187
|
+
|
188
188
|
setType("builtin")(
|
189
189
|
"Bool", "Bounded", "Char", "Double", "EQ", "Either", "Enum", "Eq",
|
190
190
|
"False", "FilePath", "Float", "Floating", "Fractional", "Functor", "GT",
|
@@ -192,7 +192,7 @@ CodeMirror.defineMode("haskell", function() {
|
|
192
192
|
"Maybe", "Monad", "Nothing", "Num", "Ord", "Ordering", "Rational", "Read",
|
193
193
|
"ReadS", "Real", "RealFloat", "RealFrac", "Right", "Show", "ShowS",
|
194
194
|
"String", "True");
|
195
|
-
|
195
|
+
|
196
196
|
setType("builtin")(
|
197
197
|
"abs", "acos", "acosh", "all", "and", "any", "appendFile", "asTypeOf",
|
198
198
|
"asin", "asinh", "atan", "atan2", "atanh", "break", "catch", "ceiling",
|
@@ -220,16 +220,16 @@ CodeMirror.defineMode("haskell", function() {
|
|
220
220
|
"toRational", "truncate", "uncurry", "undefined", "unlines", "until",
|
221
221
|
"unwords", "unzip", "unzip3", "userError", "words", "writeFile", "zip",
|
222
222
|
"zip3", "zipWith", "zipWith3");
|
223
|
-
|
223
|
+
|
224
224
|
return wkw;
|
225
225
|
})();
|
226
|
-
|
227
|
-
|
228
|
-
|
226
|
+
|
227
|
+
|
228
|
+
|
229
229
|
return {
|
230
230
|
startState: function () { return { f: normal }; },
|
231
231
|
copyState: function (s) { return { f: s.f }; },
|
232
|
-
|
232
|
+
|
233
233
|
token: function(stream, state) {
|
234
234
|
var t = state.f(stream, function(s) { state.f = s; });
|
235
235
|
var w = stream.current();
|
@@ -1,6 +1,6 @@
|
|
1
1
|
CodeMirror.defineMode("haxe", function(config, parserConfig) {
|
2
2
|
var indentUnit = config.indentUnit;
|
3
|
-
|
3
|
+
|
4
4
|
// Tokenizer
|
5
5
|
|
6
6
|
var keywords = function(){
|
@@ -12,10 +12,10 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
|
|
12
12
|
"if": A, "while": A, "else": B, "do": B, "try": B,
|
13
13
|
"return": C, "break": C, "continue": C, "new": C, "throw": C,
|
14
14
|
"var": kw("var"), "inline":attribute, "static": attribute, "using":kw("import"),
|
15
|
-
"public": attribute, "private": attribute, "cast": kw("cast"), "import": kw("import"), "macro": kw("macro"),
|
15
|
+
"public": attribute, "private": attribute, "cast": kw("cast"), "import": kw("import"), "macro": kw("macro"),
|
16
16
|
"function": kw("function"), "catch": kw("catch"), "untyped": kw("untyped"), "callback": kw("cb"),
|
17
17
|
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
|
18
|
-
"in": operator, "never": kw("property_access"), "trace":kw("trace"),
|
18
|
+
"in": operator, "never": kw("property_access"), "trace":kw("trace"),
|
19
19
|
"class": type, "enum":type, "interface":type, "typedef":type, "extends":type, "implements":type, "dynamic":type,
|
20
20
|
"true": atom, "false": atom, "null": atom
|
21
21
|
};
|
@@ -55,14 +55,14 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
|
|
55
55
|
else if (ch == "0" && stream.eat(/x/i)) {
|
56
56
|
stream.eatWhile(/[\da-f]/i);
|
57
57
|
return ret("number", "number");
|
58
|
-
}
|
58
|
+
}
|
59
59
|
else if (/\d/.test(ch) || ch == "-" && stream.eat(/\d/)) {
|
60
60
|
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
|
61
61
|
return ret("number", "number");
|
62
62
|
}
|
63
63
|
else if (state.reAllowed && (ch == "~" && stream.eat(/\//))) {
|
64
64
|
nextUntilUnescaped(stream, "/");
|
65
|
-
stream.eatWhile(/[gimsu]/);
|
65
|
+
stream.eatWhile(/[gimsu]/);
|
66
66
|
return ret("regexp", "string-2");
|
67
67
|
}
|
68
68
|
else if (ch == "/") {
|
@@ -146,13 +146,13 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
|
|
146
146
|
for (var v = state.localVars; v; v = v.next)
|
147
147
|
if (v.name == varname) return true;
|
148
148
|
}
|
149
|
-
|
149
|
+
|
150
150
|
function parseHaxe(state, style, type, content, stream) {
|
151
151
|
var cc = state.cc;
|
152
152
|
// Communicate our context to the combinators.
|
153
153
|
// (Less wasteful than consing up a hundred closures on every call.)
|
154
154
|
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
|
155
|
-
|
155
|
+
|
156
156
|
if (!state.lexical.hasOwnProperty("align"))
|
157
157
|
state.lexical.align = true;
|
158
158
|
|
@@ -168,7 +168,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
|
|
168
168
|
}
|
169
169
|
}
|
170
170
|
}
|
171
|
-
|
171
|
+
|
172
172
|
function imported(state, typename)
|
173
173
|
{
|
174
174
|
if (/[a-z]/.test(typename.charAt(0)))
|
@@ -177,8 +177,8 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
|
|
177
177
|
for (var i = 0; i<len; i++)
|
178
178
|
if(state.importedtypes[i]==typename) return true;
|
179
179
|
}
|
180
|
-
|
181
|
-
|
180
|
+
|
181
|
+
|
182
182
|
function registerimport(importname) {
|
183
183
|
var state = cx.state;
|
184
184
|
for (var t = state.importedtypes; t; t = t.next)
|
@@ -235,7 +235,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
|
|
235
235
|
poplex.lex = true;
|
236
236
|
|
237
237
|
function expect(wanted) {
|
238
|
-
return function
|
238
|
+
return function(type) {
|
239
239
|
if (type == wanted) return cont();
|
240
240
|
else if (wanted == ";") return pass();
|
241
241
|
else return cont(arguments.callee);
|
@@ -278,7 +278,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
|
|
278
278
|
if (type.match(/[;\}\)\],]/)) return pass();
|
279
279
|
return pass(expression);
|
280
280
|
}
|
281
|
-
|
281
|
+
|
282
282
|
function maybeoperator(type, value) {
|
283
283
|
if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator);
|
284
284
|
if (type == "operator" || type == ":") return cont(expression);
|
@@ -302,17 +302,17 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
|
|
302
302
|
function metaargs(type) {
|
303
303
|
if(type == "variable") return cont();
|
304
304
|
}
|
305
|
-
|
305
|
+
|
306
306
|
function importdef (type, value) {
|
307
307
|
if(type == "variable" && /[A-Z]/.test(value.charAt(0))) { registerimport(value); return cont(); }
|
308
308
|
else if(type == "variable" || type == "property" || type == ".") return cont(importdef);
|
309
309
|
}
|
310
|
-
|
310
|
+
|
311
311
|
function typedef (type, value)
|
312
312
|
{
|
313
313
|
if(type == "variable" && /[A-Z]/.test(value.charAt(0))) { registerimport(value); return cont(); }
|
314
314
|
}
|
315
|
-
|
315
|
+
|
316
316
|
function maybelabel(type) {
|
317
317
|
if (type == ":") return cont(poplex, statement);
|
318
318
|
return pass(maybeoperator, expect(";"), poplex);
|
@@ -330,7 +330,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
|
|
330
330
|
if (type == end) return cont();
|
331
331
|
return cont(expect(end));
|
332
332
|
}
|
333
|
-
return function
|
333
|
+
return function(type) {
|
334
334
|
if (type == end) return cont();
|
335
335
|
else return pass(what, proceed);
|
336
336
|
};
|
@@ -388,7 +388,7 @@ CodeMirror.defineMode("haxe", function(config, parserConfig) {
|
|
388
388
|
cc: [],
|
389
389
|
lexical: new HaxeLexical((basecolumn || 0) - indentUnit, 0, "block", false),
|
390
390
|
localVars: parserConfig.localVars,
|
391
|
-
importedtypes: defaulttypes,
|
391
|
+
importedtypes: defaulttypes,
|
392
392
|
context: parserConfig.localVars && {vars: parserConfig.localVars},
|
393
393
|
indented: 0
|
394
394
|
};
|