codemirror-rails 5.13.2 → 5.15.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/codemirror/rails/version.rb +2 -2
- data/vendor/assets/javascripts/codemirror.js +55 -42
- data/vendor/assets/javascripts/codemirror/addons/comment/comment.js +9 -2
- data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +1 -1
- data/vendor/assets/javascripts/codemirror/addons/fold/brace-fold.js +8 -8
- data/vendor/assets/javascripts/codemirror/addons/fold/xml-fold.js +3 -3
- data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +25 -38
- data/vendor/assets/javascripts/codemirror/addons/hint/sql-hint.js +2 -2
- data/vendor/assets/javascripts/codemirror/addons/lint/lint.js +2 -1
- data/vendor/assets/javascripts/codemirror/addons/scroll/simplescrollbars.js +9 -6
- data/vendor/assets/javascripts/codemirror/addons/search/match-highlighter.js +24 -27
- data/vendor/assets/javascripts/codemirror/addons/search/search.js +5 -2
- data/vendor/assets/javascripts/codemirror/addons/tern/tern.js +2 -2
- data/vendor/assets/javascripts/codemirror/keymaps/sublime.js +3 -21
- data/vendor/assets/javascripts/codemirror/keymaps/vim.js +24 -25
- data/vendor/assets/javascripts/codemirror/modes/clike.js +34 -29
- data/vendor/assets/javascripts/codemirror/modes/clojure.js +59 -3
- data/vendor/assets/javascripts/codemirror/modes/crystal.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/css.js +6 -6
- data/vendor/assets/javascripts/codemirror/modes/django.js +8 -8
- data/vendor/assets/javascripts/codemirror/modes/dtd.js +6 -6
- data/vendor/assets/javascripts/codemirror/modes/ebnf.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/haml.js +3 -3
- data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/jade.js +3 -3
- data/vendor/assets/javascripts/codemirror/modes/javascript.js +15 -9
- data/vendor/assets/javascripts/codemirror/modes/markdown.js +11 -21
- data/vendor/assets/javascripts/codemirror/modes/mathematica.js +1 -0
- data/vendor/assets/javascripts/codemirror/modes/mbox.js +129 -0
- data/vendor/assets/javascripts/codemirror/modes/pegjs.js +6 -6
- data/vendor/assets/javascripts/codemirror/modes/perl.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/php.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/powershell.js +396 -0
- data/vendor/assets/javascripts/codemirror/modes/properties.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/puppet.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/python.js +20 -28
- data/vendor/assets/javascripts/codemirror/modes/sas.js +315 -0
- data/vendor/assets/javascripts/codemirror/modes/slim.js +4 -4
- data/vendor/assets/javascripts/codemirror/modes/sparql.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/sql.js +10 -2
- data/vendor/assets/javascripts/codemirror/modes/tiddlywiki.js +78 -128
- data/vendor/assets/javascripts/codemirror/modes/verilog.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/vhdl.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/webidl.js +195 -0
- data/vendor/assets/javascripts/codemirror/modes/xquery.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/yacas.js +204 -0
- data/vendor/assets/stylesheets/codemirror.css +1 -1
- data/vendor/assets/stylesheets/codemirror/addons/lint/lint.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/icecoder.css +4 -4
- metadata +6 -1
@@ -31,14 +31,70 @@ CodeMirror.defineMode("clojure", function (options) {
|
|
31
31
|
var atoms = makeKeywords("true false nil");
|
32
32
|
|
33
33
|
var keywords = makeKeywords(
|
34
|
-
"defn defn- def def- defonce defmulti defmethod defmacro defstruct deftype defprotocol defrecord defproject deftest
|
34
|
+
"defn defn- def def- defonce defmulti defmethod defmacro defstruct deftype defprotocol defrecord defproject deftest " +
|
35
|
+
"slice defalias defhinted defmacro- defn-memo defnk defnk defonce- defunbound defunbound- defvar defvar- let letfn " +
|
36
|
+
"do case cond condp for loop recur when when-not when-let when-first if if-let if-not . .. -> ->> doto and or dosync " +
|
37
|
+
"doseq dotimes dorun doall load import unimport ns in-ns refer try catch finally throw with-open with-local-vars " +
|
38
|
+
"binding gen-class gen-and-load-class gen-and-save-class handler-case handle");
|
35
39
|
|
36
40
|
var builtins = makeKeywords(
|
37
|
-
"* *' *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* *command-line-args* *compile-files*
|
41
|
+
"* *' *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* *command-line-args* *compile-files* " +
|
42
|
+
"*compile-path* *compiler-options* *data-readers* *e *err* *file* *flush-on-newline* *fn-loader* *in* " +
|
43
|
+
"*math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* " +
|
44
|
+
"*source-path* *unchecked-math* *use-context-classloader* *verbose-defrecords* *warn-on-reflection* + +' - -' -> " +
|
45
|
+
"->> ->ArrayChunk ->Vec ->VecNode ->VecSeq -cache-protocol-fn -reset-methods .. / < <= = == > >= EMPTY-NODE accessor " +
|
46
|
+
"aclone add-classpath add-watch agent agent-error agent-errors aget alength alias all-ns alter alter-meta! " +
|
47
|
+
"alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double " +
|
48
|
+
"aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 " +
|
49
|
+
"bases bean bigdec bigint biginteger binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set " +
|
50
|
+
"bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* bound? butlast " +
|
51
|
+
"byte byte-array bytes case cat cast char char-array char-escape-string char-name-string char? chars chunk chunk-append " +
|
52
|
+
"chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors " +
|
53
|
+
"clojure-version coll? comment commute comp comparator compare compare-and-set! compile complement completing concat cond condp " +
|
54
|
+
"conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec dec' decimal? " +
|
55
|
+
"declare dedupe default-data-readers definline definterface defmacro defmethod defmulti defn defn- defonce defprotocol " +
|
56
|
+
"defrecord defstruct deftype delay delay? deliver denominator deref derive descendants destructure disj disj! dissoc " +
|
57
|
+
"dissoc! distinct distinct? doall dorun doseq dosync dotimes doto double double-array doubles drop drop-last " +
|
58
|
+
"drop-while eduction empty empty? ensure enumeration-seq error-handler error-mode eval even? every-pred every? ex-data ex-info " +
|
59
|
+
"extend extend-protocol extend-type extenders extends? false? ffirst file-seq filter filterv find find-keyword " +
|
60
|
+
"find-ns find-protocol-impl find-protocol-method find-var first flatten float float-array float? floats flush fn fn? " +
|
61
|
+
"fnext fnil for force format frequencies future future-call future-cancel future-cancelled? future-done? future? " +
|
62
|
+
"gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator group-by hash " +
|
63
|
+
"hash-combine hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc inc' init-proxy instance? " +
|
64
|
+
"int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt keep " +
|
65
|
+
"keep-indexed key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file " +
|
66
|
+
"load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array " +
|
67
|
+
"make-hierarchy map map-indexed map? mapcat mapv max max-key memfn memoize merge merge-with meta method-sig methods " +
|
68
|
+
"min min-key mod munge name namespace namespace-munge neg? newline next nfirst nil? nnext not not-any? not-empty " +
|
69
|
+
"not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias " +
|
70
|
+
"ns-unmap nth nthnext nthrest num number? numerator object-array odd? or parents partial partition partition-all " +
|
71
|
+
"partition-by pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers " +
|
72
|
+
"primitives-classnames print print-ctor print-dup print-method print-simple print-str printf println println-str " +
|
73
|
+
"prn prn-str promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super push-thread-bindings pvalues " +
|
74
|
+
"quot rand rand-int rand-nth random-sample range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern " +
|
75
|
+
"re-seq read read-line read-string realized? reduce reduce-kv reductions ref ref-history-count ref-max-history " +
|
76
|
+
"ref-min-history ref-set refer refer-clojure reify release-pending-sends rem remove remove-all-methods " +
|
77
|
+
"remove-method remove-ns remove-watch repeat repeatedly replace replicate require reset! reset-meta! resolve rest " +
|
78
|
+
"restart-agent resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off seq seq? " +
|
79
|
+
"seque sequence sequential? set set-error-handler! set-error-mode! set-validator! set? short short-array shorts " +
|
80
|
+
"shuffle shutdown-agents slurp some some-fn sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? " +
|
81
|
+
"special-symbol? spit split-at split-with str string? struct struct-map subs subseq subvec supers swap! symbol " +
|
82
|
+
"symbol? sync take take-last take-nth take-while test the-ns thread-bound? time to-array to-array-2d trampoline transduce " +
|
83
|
+
"transient tree-seq true? type unchecked-add unchecked-add-int unchecked-byte unchecked-char unchecked-dec " +
|
84
|
+
"unchecked-dec-int unchecked-divide-int unchecked-double unchecked-float unchecked-inc unchecked-inc-int " +
|
85
|
+
"unchecked-int unchecked-long unchecked-multiply unchecked-multiply-int unchecked-negate unchecked-negate-int "+
|
86
|
+
"unchecked-remainder-int unchecked-short unchecked-subtract unchecked-subtract-int underive unquote " +
|
87
|
+
"unquote-splicing update update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector-of " +
|
88
|
+
"vector? volatile! volatile? vreset! vswap! when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context " +
|
89
|
+
"with-local-vars with-meta with-open with-out-str with-precision with-redefs with-redefs-fn xml-seq zero? zipmap " +
|
90
|
+
"*default-data-reader-fn* as-> cond-> cond->> reduced reduced? send-via set-agent-send-executor! " +
|
91
|
+
"set-agent-send-off-executor! some-> some->>");
|
38
92
|
|
39
93
|
var indentKeys = makeKeywords(
|
40
94
|
// Built-ins
|
41
|
-
"ns fn def defn defmethod bound-fn if if-not case condp when while when-not when-first do future comment doto
|
95
|
+
"ns fn def defn defmethod bound-fn if if-not case condp when while when-not when-first do future comment doto " +
|
96
|
+
"locking proxy with-open with-precision reify deftype defrecord defprotocol extend extend-protocol extend-type " +
|
97
|
+
"try catch " +
|
42
98
|
|
43
99
|
// Binding forms
|
44
100
|
"let letfn binding loop for doseq dotimes when-let if-let " +
|
@@ -484,9 +484,9 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
|
|
484
484
|
"font-variant-alternates", "font-variant-caps", "font-variant-east-asian",
|
485
485
|
"font-variant-ligatures", "font-variant-numeric", "font-variant-position",
|
486
486
|
"font-weight", "grid", "grid-area", "grid-auto-columns", "grid-auto-flow",
|
487
|
-
"grid-auto-
|
488
|
-
"grid-column-start", "grid-row", "grid-row-end", "grid-row-
|
489
|
-
"grid-template", "grid-template-areas", "grid-template-columns",
|
487
|
+
"grid-auto-rows", "grid-column", "grid-column-end", "grid-column-gap",
|
488
|
+
"grid-column-start", "grid-gap", "grid-row", "grid-row-end", "grid-row-gap",
|
489
|
+
"grid-row-start", "grid-template", "grid-template-areas", "grid-template-columns",
|
490
490
|
"grid-template-rows", "hanging-punctuation", "height", "hyphens",
|
491
491
|
"icon", "image-orientation", "image-rendering", "image-resolution",
|
492
492
|
"inline-box-align", "justify-content", "left", "letter-spacing",
|
@@ -601,7 +601,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
|
|
601
601
|
"compact", "condensed", "contain", "content",
|
602
602
|
"content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop",
|
603
603
|
"cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal",
|
604
|
-
"decimal-leading-zero", "default", "default-button", "destination-atop",
|
604
|
+
"decimal-leading-zero", "default", "default-button", "dense", "destination-atop",
|
605
605
|
"destination-in", "destination-out", "destination-over", "devanagari", "difference",
|
606
606
|
"disc", "discard", "disclosure-closed", "disclosure-open", "document",
|
607
607
|
"dot-dash", "dot-dot-dash",
|
@@ -615,13 +615,13 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
|
|
615
615
|
"ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig",
|
616
616
|
"ethiopic-numeric", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed",
|
617
617
|
"extra-expanded", "fantasy", "fast", "fill", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes",
|
618
|
-
"forwards", "from", "geometricPrecision", "georgian", "graytext", "groove",
|
618
|
+
"forwards", "from", "geometricPrecision", "georgian", "graytext", "grid", "groove",
|
619
619
|
"gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew",
|
620
620
|
"help", "hidden", "hide", "higher", "highlight", "highlighttext",
|
621
621
|
"hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "icon", "ignore",
|
622
622
|
"inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite",
|
623
623
|
"infobackground", "infotext", "inherit", "initial", "inline", "inline-axis",
|
624
|
-
"inline-block", "inline-flex", "inline-table", "inset", "inside", "intrinsic", "invert",
|
624
|
+
"inline-block", "inline-flex", "inline-grid", "inline-table", "inset", "inside", "intrinsic", "invert",
|
625
625
|
"italic", "japanese-formal", "japanese-informal", "justify", "kannada",
|
626
626
|
"katakana", "katakana-iroha", "keep-all", "khmer",
|
627
627
|
"korean-hangul-formal", "korean-hanja-formal", "korean-hanja-informal",
|
@@ -66,11 +66,11 @@
|
|
66
66
|
}
|
67
67
|
|
68
68
|
// A string can be included in either single or double quotes (this is
|
69
|
-
// the
|
69
|
+
// the delimiter). Mark everything as a string until the start delimiter
|
70
70
|
// occurs again.
|
71
|
-
function inString (
|
71
|
+
function inString (delimiter, previousTokenizer) {
|
72
72
|
return function (stream, state) {
|
73
|
-
if (!state.escapeNext && stream.eat(
|
73
|
+
if (!state.escapeNext && stream.eat(delimiter)) {
|
74
74
|
state.tokenize = previousTokenizer;
|
75
75
|
} else {
|
76
76
|
if (state.escapeNext) {
|
@@ -80,7 +80,7 @@
|
|
80
80
|
var ch = stream.next();
|
81
81
|
|
82
82
|
// Take into account the backslash for escaping characters, such as
|
83
|
-
// the string
|
83
|
+
// the string delimiter.
|
84
84
|
if (ch == "\\") {
|
85
85
|
state.escapeNext = true;
|
86
86
|
}
|
@@ -100,7 +100,7 @@
|
|
100
100
|
return "null";
|
101
101
|
}
|
102
102
|
|
103
|
-
// Dot
|
103
|
+
// Dot followed by a non-word character should be considered an error.
|
104
104
|
if (stream.match(/\.\W+/)) {
|
105
105
|
return "error";
|
106
106
|
} else if (stream.eat(".")) {
|
@@ -119,7 +119,7 @@
|
|
119
119
|
return "null";
|
120
120
|
}
|
121
121
|
|
122
|
-
// Pipe
|
122
|
+
// Pipe followed by a non-word character should be considered an error.
|
123
123
|
if (stream.match(/\.\W+/)) {
|
124
124
|
return "error";
|
125
125
|
} else if (stream.eat("|")) {
|
@@ -199,7 +199,7 @@
|
|
199
199
|
return "null";
|
200
200
|
}
|
201
201
|
|
202
|
-
// Dot
|
202
|
+
// Dot followed by a non-word character should be considered an error.
|
203
203
|
if (stream.match(/\.\W+/)) {
|
204
204
|
return "error";
|
205
205
|
} else if (stream.eat(".")) {
|
@@ -218,7 +218,7 @@
|
|
218
218
|
return "null";
|
219
219
|
}
|
220
220
|
|
221
|
-
// Pipe
|
221
|
+
// Pipe followed by a non-word character should be considered an error.
|
222
222
|
if (stream.match(/\.\W+/)) {
|
223
223
|
return "error";
|
224
224
|
} else if (stream.eat("|")) {
|
@@ -114,17 +114,17 @@ CodeMirror.defineMode("dtd", function(config) {
|
|
114
114
|
|
115
115
|
if( textAfter.match(/\]\s+|\]/) )n=n-1;
|
116
116
|
else if(textAfter.substr(textAfter.length-1, textAfter.length) === ">"){
|
117
|
-
if(textAfter.substr(0,1) === "<")
|
118
|
-
else if( type == "doindent" && textAfter.length > 1 )
|
117
|
+
if(textAfter.substr(0,1) === "<") {}
|
118
|
+
else if( type == "doindent" && textAfter.length > 1 ) {}
|
119
119
|
else if( type == "doindent")n--;
|
120
|
-
else if( type == ">" && textAfter.length > 1)
|
121
|
-
else if( type == "tag" && textAfter !== ">")
|
120
|
+
else if( type == ">" && textAfter.length > 1) {}
|
121
|
+
else if( type == "tag" && textAfter !== ">") {}
|
122
122
|
else if( type == "tag" && state.stack[state.stack.length-1] == "rule")n--;
|
123
123
|
else if( type == "tag")n++;
|
124
124
|
else if( textAfter === ">" && state.stack[state.stack.length-1] == "rule" && type === ">")n--;
|
125
|
-
else if( textAfter === ">" && state.stack[state.stack.length-1] == "rule")
|
125
|
+
else if( textAfter === ">" && state.stack[state.stack.length-1] == "rule") {}
|
126
126
|
else if( textAfter.substr(0,1) !== "<" && textAfter.substr(0,1) === ">" )n=n-1;
|
127
|
-
else if( textAfter === ">")
|
127
|
+
else if( textAfter === ">") {}
|
128
128
|
else n=n-1;
|
129
129
|
//over rule them all
|
130
130
|
if(type == null || type == "]")n--;
|
@@ -94,7 +94,7 @@
|
|
94
94
|
|
95
95
|
if (bracesMode !== null && (state.braced || peek === "{")) {
|
96
96
|
if (state.localState === null)
|
97
|
-
state.localState =
|
97
|
+
state.localState = CodeMirror.startState(bracesMode);
|
98
98
|
|
99
99
|
var token = bracesMode.token(stream, state.localState),
|
100
100
|
text = stream.current();
|
@@ -11,7 +11,7 @@
|
|
11
11
|
})(function(CodeMirror) {
|
12
12
|
"use strict";
|
13
13
|
|
14
|
-
// full haml mode. This handled
|
14
|
+
// full haml mode. This handled embedded ruby and html fragments too
|
15
15
|
CodeMirror.defineMode("haml", function(config) {
|
16
16
|
var htmlMode = CodeMirror.getMode(config, {name: "htmlmixed"});
|
17
17
|
var rubyMode = CodeMirror.getMode(config, "ruby");
|
@@ -98,8 +98,8 @@
|
|
98
98
|
return {
|
99
99
|
// default to html mode
|
100
100
|
startState: function() {
|
101
|
-
var htmlState =
|
102
|
-
var rubyState =
|
101
|
+
var htmlState = CodeMirror.startState(htmlMode);
|
102
|
+
var rubyState = CodeMirror.startState(rubyMode);
|
103
103
|
return {
|
104
104
|
htmlState: htmlState,
|
105
105
|
rubyState: rubyState,
|
@@ -36,7 +36,7 @@ CodeMirror.defineMode('jade', function (config) {
|
|
36
36
|
this.isInterpolating = false;
|
37
37
|
this.interpolationNesting = 0;
|
38
38
|
|
39
|
-
this.jsState =
|
39
|
+
this.jsState = CodeMirror.startState(jsMode);
|
40
40
|
|
41
41
|
this.restOfLine = '';
|
42
42
|
|
@@ -386,7 +386,7 @@ CodeMirror.defineMode('jade', function (config) {
|
|
386
386
|
if (state.inAttributeName && stream.match(/^[^=,\)!]+/)) {
|
387
387
|
if (stream.peek() === '=' || stream.peek() === '!') {
|
388
388
|
state.inAttributeName = false;
|
389
|
-
state.jsState =
|
389
|
+
state.jsState = CodeMirror.startState(jsMode);
|
390
390
|
if (state.lastTag === 'script' && stream.current().trim().toLowerCase() === 'type') {
|
391
391
|
state.attributeIsType = true;
|
392
392
|
} else {
|
@@ -492,7 +492,7 @@ CodeMirror.defineMode('jade', function (config) {
|
|
492
492
|
if (stream.indentation() > state.indentOf || (state.innerModeForLine && !stream.sol()) || force) {
|
493
493
|
if (state.innerMode) {
|
494
494
|
if (!state.innerState) {
|
495
|
-
state.innerState = state.innerMode.startState ? state.innerMode
|
495
|
+
state.innerState = state.innerMode.startState ? CodeMirror.startState(state.innerMode, stream.indentation()) : {};
|
496
496
|
}
|
497
497
|
return stream.hideFirstChars(state.indentOf + 2, function () {
|
498
498
|
return state.innerMode.token(stream, state.innerState) || true;
|
@@ -42,7 +42,8 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|
42
42
|
"in": operator, "typeof": operator, "instanceof": operator,
|
43
43
|
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
|
44
44
|
"this": kw("this"), "class": kw("class"), "super": kw("atom"),
|
45
|
-
"yield": C, "export": kw("export"), "import": kw("import"), "extends": C
|
45
|
+
"yield": C, "export": kw("export"), "import": kw("import"), "extends": C,
|
46
|
+
"await": C, "async": kw("async")
|
46
47
|
};
|
47
48
|
|
48
49
|
// Extend the 'normal' keywords with the TypeScript language extensions
|
@@ -366,6 +367,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|
366
367
|
if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
|
367
368
|
if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
|
368
369
|
if (type == "module") return cont(pushlex("form"), pattern, pushlex("}"), expect("{"), block, poplex, poplex)
|
370
|
+
if (type == "async") return cont(statement)
|
369
371
|
return pass(pushlex("stat"), expression, expect(";"), poplex);
|
370
372
|
}
|
371
373
|
function expression(type) {
|
@@ -488,17 +490,17 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|
488
490
|
if (type == "(") return pass(functiondef);
|
489
491
|
}
|
490
492
|
function commasep(what, end) {
|
491
|
-
function proceed(type) {
|
493
|
+
function proceed(type, value) {
|
492
494
|
if (type == ",") {
|
493
495
|
var lex = cx.state.lexical;
|
494
496
|
if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
|
495
497
|
return cont(what, proceed);
|
496
498
|
}
|
497
|
-
if (type == end) return cont();
|
499
|
+
if (type == end || value == end) return cont();
|
498
500
|
return cont(expect(end));
|
499
501
|
}
|
500
|
-
return function(type) {
|
501
|
-
if (type == end) return cont();
|
502
|
+
return function(type, value) {
|
503
|
+
if (type == end || value == end) return cont();
|
502
504
|
return pass(what, proceed);
|
503
505
|
};
|
504
506
|
}
|
@@ -512,13 +514,17 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|
512
514
|
return pass(statement, block);
|
513
515
|
}
|
514
516
|
function maybetype(type) {
|
515
|
-
if (isTS && type == ":") return cont(
|
517
|
+
if (isTS && type == ":") return cont(typeexpr);
|
516
518
|
}
|
517
519
|
function maybedefault(_, value) {
|
518
520
|
if (value == "=") return cont(expressionNoComma);
|
519
521
|
}
|
520
|
-
function
|
521
|
-
if (type == "variable") {cx.marked = "variable-3"; return cont();}
|
522
|
+
function typeexpr(type) {
|
523
|
+
if (type == "variable") {cx.marked = "variable-3"; return cont(afterType);}
|
524
|
+
}
|
525
|
+
function afterType(type, value) {
|
526
|
+
if (value == "<") return cont(commasep(typeexpr, ">"), afterType)
|
527
|
+
if (type == "[") return cont(expect("]"), afterType)
|
522
528
|
}
|
523
529
|
function vardef() {
|
524
530
|
return pass(pattern, maybetype, maybeAssign, vardefCont);
|
@@ -573,7 +579,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|
573
579
|
function functiondef(type, value) {
|
574
580
|
if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
|
575
581
|
if (type == "variable") {register(value); return cont(functiondef);}
|
576
|
-
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, statement, popcontext);
|
582
|
+
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, maybetype, statement, popcontext);
|
577
583
|
}
|
578
584
|
function funarg(type) {
|
579
585
|
if (type == "spread") return cont(funarg);
|
@@ -88,7 +88,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|
88
88
|
, setextHeaderRE = /^ *(?:\={1,}|-{1,})\s*$/
|
89
89
|
, textRE = /^[^#!\[\]*_\\<>` "'(~]+/
|
90
90
|
, fencedCodeRE = new RegExp("^(" + (modeCfg.fencedCodeBlocks === true ? "~~~+|```+" : modeCfg.fencedCodeBlocks) +
|
91
|
-
")[ \\t]*([\\w
|
91
|
+
")[ \\t]*([\\w+#\-]*)");
|
92
92
|
|
93
93
|
function switchInline(stream, state, f) {
|
94
94
|
state.f = state.inline = f;
|
@@ -218,7 +218,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|
218
218
|
state.fencedChars = match[1]
|
219
219
|
// try switching mode
|
220
220
|
state.localMode = getMode(match[2]);
|
221
|
-
if (state.localMode) state.localState = state.localMode
|
221
|
+
if (state.localMode) state.localState = CodeMirror.startState(state.localMode);
|
222
222
|
state.f = state.block = local;
|
223
223
|
if (modeCfg.highlightFormatting) state.formatting = "code-block";
|
224
224
|
state.code = -1
|
@@ -437,13 +437,13 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|
437
437
|
return tokenTypes.image;
|
438
438
|
}
|
439
439
|
|
440
|
-
if (ch === '[' && stream.match(
|
440
|
+
if (ch === '[' && stream.match(/[^\]]*\](\(.*\)| ?\[.*?\])/, false)) {
|
441
441
|
state.linkText = true;
|
442
442
|
if (modeCfg.highlightFormatting) state.formatting = "link";
|
443
443
|
return getType(state);
|
444
444
|
}
|
445
445
|
|
446
|
-
if (ch === ']' && state.linkText && stream.match(/\(
|
446
|
+
if (ch === ']' && state.linkText && stream.match(/\(.*?\)| ?\[.*?\]/, false)) {
|
447
447
|
if (modeCfg.highlightFormatting) state.formatting = "link";
|
448
448
|
var type = getType(state);
|
449
449
|
state.linkText = false;
|
@@ -596,7 +596,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|
596
596
|
}
|
597
597
|
var ch = stream.next();
|
598
598
|
if (ch === '(' || ch === '[') {
|
599
|
-
state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]");
|
599
|
+
state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]", 0);
|
600
600
|
if (modeCfg.highlightFormatting) state.formatting = "link-string";
|
601
601
|
state.linkHref = true;
|
602
602
|
return getType(state);
|
@@ -604,6 +604,11 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|
604
604
|
return 'error';
|
605
605
|
}
|
606
606
|
|
607
|
+
var linkRE = {
|
608
|
+
")": /^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,
|
609
|
+
"]": /^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\\]]|\\.)*\])*?(?=\])/
|
610
|
+
}
|
611
|
+
|
607
612
|
function getLinkHrefInside(endChar) {
|
608
613
|
return function(stream, state) {
|
609
614
|
var ch = stream.next();
|
@@ -616,10 +621,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|
616
621
|
return returnState;
|
617
622
|
}
|
618
623
|
|
619
|
-
|
620
|
-
stream.backUp(1);
|
621
|
-
}
|
622
|
-
|
624
|
+
stream.match(linkRE[endChar])
|
623
625
|
state.linkHref = true;
|
624
626
|
return getType(state);
|
625
627
|
};
|
@@ -667,18 +669,6 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
|
667
669
|
return tokenTypes.linkHref + " url";
|
668
670
|
}
|
669
671
|
|
670
|
-
var savedInlineRE = [];
|
671
|
-
function inlineRE(endChar) {
|
672
|
-
if (!savedInlineRE[endChar]) {
|
673
|
-
// Escape endChar for RegExp (taken from http://stackoverflow.com/a/494122/526741)
|
674
|
-
endChar = (endChar+'').replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
|
675
|
-
// Match any non-endChar, escaped character, as well as the closing
|
676
|
-
// endChar.
|
677
|
-
savedInlineRE[endChar] = new RegExp('^(?:[^\\\\]|\\\\.)*?(' + endChar + ')');
|
678
|
-
}
|
679
|
-
return savedInlineRE[endChar];
|
680
|
-
}
|
681
|
-
|
682
672
|
var mode = {
|
683
673
|
startState: function() {
|
684
674
|
return {
|
@@ -0,0 +1,129 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
var rfc2822 = [
|
15
|
+
"From", "Sender", "Reply-To", "To", "Cc", "Bcc", "Message-ID",
|
16
|
+
"In-Reply-To", "References", "Resent-From", "Resent-Sender", "Resent-To",
|
17
|
+
"Resent-Cc", "Resent-Bcc", "Resent-Message-ID", "Return-Path", "Received"
|
18
|
+
];
|
19
|
+
var rfc2822NoEmail = [
|
20
|
+
"Date", "Subject", "Comments", "Keywords", "Resent-Date"
|
21
|
+
];
|
22
|
+
|
23
|
+
CodeMirror.registerHelper("hintWords", "mbox", rfc2822.concat(rfc2822NoEmail));
|
24
|
+
|
25
|
+
var whitespace = /^[ \t]/;
|
26
|
+
var separator = /^From /; // See RFC 4155
|
27
|
+
var rfc2822Header = new RegExp("^(" + rfc2822.join("|") + "): ");
|
28
|
+
var rfc2822HeaderNoEmail = new RegExp("^(" + rfc2822NoEmail.join("|") + "): ");
|
29
|
+
var header = /^[^:]+:/; // Optional fields defined in RFC 2822
|
30
|
+
var email = /^[^ ]+@[^ ]+/;
|
31
|
+
var untilEmail = /^.*?(?=[^ ]+?@[^ ]+)/;
|
32
|
+
var bracketedEmail = /^<.*?>/;
|
33
|
+
var untilBracketedEmail = /^.*?(?=<.*>)/;
|
34
|
+
|
35
|
+
function styleForHeader(header) {
|
36
|
+
if (header === "Subject") return "header";
|
37
|
+
return "string";
|
38
|
+
}
|
39
|
+
|
40
|
+
function readToken(stream, state) {
|
41
|
+
if (stream.sol()) {
|
42
|
+
// From last line
|
43
|
+
state.inSeparator = false;
|
44
|
+
if (state.inHeader && stream.match(whitespace)) {
|
45
|
+
// Header folding
|
46
|
+
return null;
|
47
|
+
} else {
|
48
|
+
state.inHeader = false;
|
49
|
+
state.header = null;
|
50
|
+
}
|
51
|
+
|
52
|
+
if (stream.match(separator)) {
|
53
|
+
state.inHeaders = true;
|
54
|
+
state.inSeparator = true;
|
55
|
+
return "atom";
|
56
|
+
}
|
57
|
+
|
58
|
+
var match;
|
59
|
+
var emailPermitted = false;
|
60
|
+
if ((match = stream.match(rfc2822HeaderNoEmail)) ||
|
61
|
+
(emailPermitted = true) && (match = stream.match(rfc2822Header))) {
|
62
|
+
state.inHeaders = true;
|
63
|
+
state.inHeader = true;
|
64
|
+
state.emailPermitted = emailPermitted;
|
65
|
+
state.header = match[1];
|
66
|
+
return "atom";
|
67
|
+
}
|
68
|
+
|
69
|
+
// Use vim's heuristics: recognize custom headers only if the line is in a
|
70
|
+
// block of legitimate headers.
|
71
|
+
if (state.inHeaders && (match = stream.match(header))) {
|
72
|
+
state.inHeader = true;
|
73
|
+
state.emailPermitted = true;
|
74
|
+
state.header = match[1];
|
75
|
+
return "atom";
|
76
|
+
}
|
77
|
+
|
78
|
+
state.inHeaders = false;
|
79
|
+
stream.skipToEnd();
|
80
|
+
return null;
|
81
|
+
}
|
82
|
+
|
83
|
+
if (state.inSeparator) {
|
84
|
+
if (stream.match(email)) return "link";
|
85
|
+
if (stream.match(untilEmail)) return "atom";
|
86
|
+
stream.skipToEnd();
|
87
|
+
return "atom";
|
88
|
+
}
|
89
|
+
|
90
|
+
if (state.inHeader) {
|
91
|
+
var style = styleForHeader(state.header);
|
92
|
+
|
93
|
+
if (state.emailPermitted) {
|
94
|
+
if (stream.match(bracketedEmail)) return style + " link";
|
95
|
+
if (stream.match(untilBracketedEmail)) return style;
|
96
|
+
}
|
97
|
+
stream.skipToEnd();
|
98
|
+
return style;
|
99
|
+
}
|
100
|
+
|
101
|
+
stream.skipToEnd();
|
102
|
+
return null;
|
103
|
+
};
|
104
|
+
|
105
|
+
CodeMirror.defineMode("mbox", function() {
|
106
|
+
return {
|
107
|
+
startState: function() {
|
108
|
+
return {
|
109
|
+
// Is in a mbox separator
|
110
|
+
inSeparator: false,
|
111
|
+
// Is in a mail header
|
112
|
+
inHeader: false,
|
113
|
+
// If bracketed email is permitted. Only applicable when inHeader
|
114
|
+
emailPermitted: false,
|
115
|
+
// Name of current header
|
116
|
+
header: null,
|
117
|
+
// Is in a region of mail headers
|
118
|
+
inHeaders: false
|
119
|
+
};
|
120
|
+
},
|
121
|
+
token: readToken,
|
122
|
+
blankLine: function(state) {
|
123
|
+
state.inHeaders = state.inSeparator = state.inHeader = false;
|
124
|
+
}
|
125
|
+
};
|
126
|
+
});
|
127
|
+
|
128
|
+
CodeMirror.defineMIME("application/mbox", "mbox");
|
129
|
+
});
|