From 70c929241391a465a1e818dcb41af30dd176bc34 Mon Sep 17 00:00:00 2001 From: zadam Date: Sat, 15 Oct 2022 12:22:09 +0200 Subject: [PATCH] codemirror 5.65.9 --- .../codemirror/addon/display/placeholder.js | 2 +- .../codemirror/addon/edit/matchbrackets.js | 2 +- libraries/codemirror/addon/edit/matchtags.js | 2 +- libraries/codemirror/addon/fold/xml-fold.js | 2 +- libraries/codemirror/addon/lint/lint.css | 8 + libraries/codemirror/addon/lint/lint.js | 70 +++- libraries/codemirror/addon/mode/loadmode.js | 2 +- libraries/codemirror/addon/mode/simple.js | 3 +- .../addon/search/match-highlighter.js | 2 +- libraries/codemirror/codemirror.css | 22 +- libraries/codemirror/codemirror.js | 253 +++++++---- libraries/codemirror/keymap/vim.js | 394 ++++++++++++++---- libraries/codemirror/mode/apl/apl.js | 2 +- .../codemirror/mode/asciiarmor/asciiarmor.js | 2 +- libraries/codemirror/mode/asn.1/asn.1.js | 2 +- .../codemirror/mode/asterisk/asterisk.js | 2 +- .../codemirror/mode/brainfuck/brainfuck.js | 2 +- libraries/codemirror/mode/clike/clike.js | 11 +- libraries/codemirror/mode/clojure/clojure.js | 2 +- libraries/codemirror/mode/cmake/cmake.js | 2 +- libraries/codemirror/mode/cobol/cobol.js | 4 +- .../mode/coffeescript/coffeescript.js | 2 +- .../codemirror/mode/commonlisp/commonlisp.js | 3 +- libraries/codemirror/mode/crystal/crystal.js | 6 +- libraries/codemirror/mode/css/css.js | 66 ++- libraries/codemirror/mode/cypher/cypher.js | 3 +- libraries/codemirror/mode/d/d.js | 2 +- libraries/codemirror/mode/dart/dart.js | 2 +- libraries/codemirror/mode/diff/diff.js | 2 +- libraries/codemirror/mode/django/django.js | 2 +- .../codemirror/mode/dockerfile/dockerfile.js | 2 +- libraries/codemirror/mode/dtd/dtd.js | 2 +- libraries/codemirror/mode/dylan/dylan.js | 2 +- libraries/codemirror/mode/ebnf/ebnf.js | 2 +- libraries/codemirror/mode/ecl/ecl.js | 2 +- libraries/codemirror/mode/eiffel/eiffel.js | 2 +- libraries/codemirror/mode/elm/elm.js | 4 +- libraries/codemirror/mode/erlang/erlang.js | 2 +- libraries/codemirror/mode/factor/factor.js | 4 +- libraries/codemirror/mode/fcl/fcl.js | 2 +- libraries/codemirror/mode/forth/forth.js | 2 +- libraries/codemirror/mode/fortran/fortran.js | 4 +- libraries/codemirror/mode/gas/gas.js | 10 +- libraries/codemirror/mode/gfm/gfm.js | 2 +- libraries/codemirror/mode/gherkin/gherkin.js | 2 +- libraries/codemirror/mode/go/go.js | 4 +- libraries/codemirror/mode/groovy/groovy.js | 22 +- libraries/codemirror/mode/haml/haml.js | 2 +- .../codemirror/mode/handlebars/handlebars.js | 2 +- .../mode/haskell-literate/haskell-literate.js | 2 +- libraries/codemirror/mode/haskell/haskell.js | 2 +- libraries/codemirror/mode/haxe/haxe.js | 2 +- .../mode/htmlembedded/htmlembedded.js | 2 +- .../codemirror/mode/htmlmixed/htmlmixed.js | 4 +- libraries/codemirror/mode/http/http.js | 2 +- libraries/codemirror/mode/idl/idl.js | 2 +- .../codemirror/mode/javascript/javascript.js | 29 +- libraries/codemirror/mode/jinja2/jinja2.js | 71 +++- libraries/codemirror/mode/jsx/jsx.js | 4 +- libraries/codemirror/mode/julia/julia.js | 34 +- .../codemirror/mode/livescript/livescript.js | 2 +- libraries/codemirror/mode/lua/lua.js | 2 +- .../codemirror/mode/markdown/markdown.js | 2 +- .../mode/mathematica/mathematica.js | 2 +- libraries/codemirror/mode/mbox/mbox.js | 2 +- libraries/codemirror/mode/meta.js | 10 +- libraries/codemirror/mode/mirc/mirc.js | 2 +- libraries/codemirror/mode/mllike/mllike.js | 4 +- .../codemirror/mode/modelica/modelica.js | 2 +- libraries/codemirror/mode/mscgen/mscgen.js | 2 +- libraries/codemirror/mode/mumps/mumps.js | 2 +- libraries/codemirror/mode/nginx/nginx.js | 2 +- libraries/codemirror/mode/nsis/nsis.js | 42 +- .../codemirror/mode/ntriples/ntriples.js | 2 +- libraries/codemirror/mode/octave/octave.js | 2 +- libraries/codemirror/mode/oz/oz.js | 2 +- libraries/codemirror/mode/pascal/pascal.js | 2 +- libraries/codemirror/mode/pegjs/pegjs.js | 2 +- libraries/codemirror/mode/perl/perl.js | 7 +- libraries/codemirror/mode/php/php.js | 10 +- libraries/codemirror/mode/pig/pig.js | 2 +- .../codemirror/mode/powershell/powershell.js | 2 +- .../codemirror/mode/properties/properties.js | 2 +- .../codemirror/mode/protobuf/protobuf.js | 2 +- libraries/codemirror/mode/pug/pug.js | 2 +- libraries/codemirror/mode/puppet/puppet.js | 2 +- libraries/codemirror/mode/python/python.js | 27 +- libraries/codemirror/mode/q/q.js | 2 +- libraries/codemirror/mode/r/r.js | 6 +- libraries/codemirror/mode/rpm/rpm.js | 2 +- libraries/codemirror/mode/rst/rst.js | 2 +- libraries/codemirror/mode/ruby/ruby.js | 4 +- libraries/codemirror/mode/rust/rust.js | 2 +- libraries/codemirror/mode/sas/sas.js | 2 +- libraries/codemirror/mode/sass/sass.js | 2 +- libraries/codemirror/mode/scheme/scheme.js | 41 +- libraries/codemirror/mode/shell/shell.js | 2 +- libraries/codemirror/mode/sieve/sieve.js | 2 +- libraries/codemirror/mode/slim/slim.js | 2 +- .../codemirror/mode/smalltalk/smalltalk.js | 2 +- libraries/codemirror/mode/smarty/smarty.js | 2 +- libraries/codemirror/mode/solr/solr.js | 2 +- libraries/codemirror/mode/soy/soy.js | 42 +- libraries/codemirror/mode/sparql/sparql.js | 13 +- .../mode/spreadsheet/spreadsheet.js | 2 +- libraries/codemirror/mode/sql/sql.js | 66 ++- libraries/codemirror/mode/stex/stex.js | 2 +- libraries/codemirror/mode/stylus/stylus.js | 6 +- libraries/codemirror/mode/swift/swift.js | 14 +- libraries/codemirror/mode/tcl/tcl.js | 2 +- libraries/codemirror/mode/textile/textile.js | 2 +- .../codemirror/mode/tiddlywiki/tiddlywiki.js | 2 +- libraries/codemirror/mode/tiki/tiki.js | 2 +- libraries/codemirror/mode/toml/toml.js | 2 +- libraries/codemirror/mode/tornado/tornado.js | 2 +- libraries/codemirror/mode/troff/troff.js | 2 +- .../codemirror/mode/ttcn-cfg/ttcn-cfg.js | 2 +- libraries/codemirror/mode/ttcn/ttcn.js | 2 +- libraries/codemirror/mode/turtle/turtle.js | 2 +- libraries/codemirror/mode/twig/twig.js | 2 +- libraries/codemirror/mode/vb/vb.js | 2 +- .../codemirror/mode/vbscript/vbscript.js | 2 +- .../codemirror/mode/velocity/velocity.js | 3 +- libraries/codemirror/mode/verilog/verilog.js | 2 +- libraries/codemirror/mode/vhdl/vhdl.js | 2 +- libraries/codemirror/mode/vue/vue.js | 2 +- libraries/codemirror/mode/wast/wast.js | 8 +- libraries/codemirror/mode/webidl/webidl.js | 2 +- libraries/codemirror/mode/xml/xml.js | 20 +- libraries/codemirror/mode/xquery/xquery.js | 2 +- libraries/codemirror/mode/yacas/yacas.js | 2 +- .../mode/yaml-frontmatter/yaml-frontmatter.js | 30 +- libraries/codemirror/mode/yaml/yaml.js | 2 +- libraries/codemirror/mode/z80/z80.js | 2 +- 134 files changed, 1051 insertions(+), 521 deletions(-) diff --git a/libraries/codemirror/addon/display/placeholder.js b/libraries/codemirror/addon/display/placeholder.js index cfb8341db..7848f5146 100644 --- a/libraries/codemirror/addon/display/placeholder.js +++ b/libraries/codemirror/addon/display/placeholder.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/addon/edit/matchbrackets.js b/libraries/codemirror/addon/edit/matchbrackets.js index 43dc8840f..c342910ed 100644 --- a/libraries/codemirror/addon/edit/matchbrackets.js +++ b/libraries/codemirror/addon/edit/matchbrackets.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/addon/edit/matchtags.js b/libraries/codemirror/addon/edit/matchtags.js index 2203d9390..afa6105f8 100644 --- a/libraries/codemirror/addon/edit/matchtags.js +++ b/libraries/codemirror/addon/edit/matchtags.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/addon/fold/xml-fold.js b/libraries/codemirror/addon/fold/xml-fold.js index 13bc3838b..5450d374a 100644 --- a/libraries/codemirror/addon/fold/xml-fold.js +++ b/libraries/codemirror/addon/fold/xml-fold.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/addon/lint/lint.css b/libraries/codemirror/addon/lint/lint.css index 087186595..e1560db98 100644 --- a/libraries/codemirror/addon/lint/lint.css +++ b/libraries/codemirror/addon/lint/lint.css @@ -69,3 +69,11 @@ background-position: right bottom; width: 100%; height: 100%; } + +.CodeMirror-lint-line-error { + background-color: rgba(183, 76, 81, 0.08); +} + +.CodeMirror-lint-line-warning { + background-color: rgba(255, 211, 0, 0.1); +} diff --git a/libraries/codemirror/addon/lint/lint.js b/libraries/codemirror/addon/lint/lint.js index 395f0d931..7b40e10e9 100644 --- a/libraries/codemirror/addon/lint/lint.js +++ b/libraries/codemirror/addon/lint/lint.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -11,6 +11,7 @@ })(function(CodeMirror) { "use strict"; var GUTTER_ID = "CodeMirror-lint-markers"; + var LINT_LINE_ID = "CodeMirror-lint-line-"; function showTooltip(cm, e, content) { var tt = document.createElement("div"); @@ -58,29 +59,54 @@ CodeMirror.on(node, "mouseout", hide); } - function LintState(cm, options, hasGutter) { + function LintState(cm, conf, hasGutter) { this.marked = []; - this.options = options; + if (conf instanceof Function) conf = {getAnnotations: conf}; + if (!conf || conf === true) conf = {}; + this.options = {}; + this.linterOptions = conf.options || {}; + for (var prop in defaults) this.options[prop] = defaults[prop]; + for (var prop in conf) { + if (defaults.hasOwnProperty(prop)) { + if (conf[prop] != null) this.options[prop] = conf[prop]; + } else if (!conf.options) { + this.linterOptions[prop] = conf[prop]; + } + } this.timeout = null; this.hasGutter = hasGutter; this.onMouseOver = function(e) { onMouseOver(cm, e); }; this.waitingFor = 0 } - function parseOptions(_cm, options) { - if (options instanceof Function) return {getAnnotations: options}; - if (!options || options === true) options = {}; - return options; + var defaults = { + highlightLines: false, + tooltips: true, + delay: 500, + lintOnChange: true, + getAnnotations: null, + async: false, + selfContain: null, + formatAnnotation: null, + onUpdateLinting: null } function clearMarks(cm) { var state = cm.state.lint; if (state.hasGutter) cm.clearGutter(GUTTER_ID); + if (state.options.highlightLines) clearErrorLines(cm); for (var i = 0; i < state.marked.length; ++i) state.marked[i].clear(); state.marked.length = 0; } + function clearErrorLines(cm) { + cm.eachLine(function(line) { + var has = line.wrapClass && /\bCodeMirror-lint-line-\w+\b/.exec(line.wrapClass); + if (has) cm.removeLineClass(line, "wrap", has[0]); + }) + } + function makeMarker(cm, labels, severity, multiple, tooltips) { var marker = document.createElement("div"), inner = marker; marker.className = "CodeMirror-lint-marker CodeMirror-lint-marker-" + severity; @@ -123,7 +149,7 @@ return tip; } - function lintAsync(cm, getAnnotations, passOptions) { + function lintAsync(cm, getAnnotations) { var state = cm.state.lint var id = ++state.waitingFor function abort() { @@ -136,22 +162,23 @@ if (state.waitingFor != id) return if (arg2 && annotations instanceof CodeMirror) annotations = arg2 cm.operation(function() {updateLinting(cm, annotations)}) - }, passOptions, cm); + }, state.linterOptions, cm); } function startLinting(cm) { - var state = cm.state.lint, options = state.options; + var state = cm.state.lint; + if (!state) return; + var options = state.options; /* * Passing rules in `options` property prevents JSHint (and other linters) from complaining * about unrecognized rules like `onUpdateLinting`, `delay`, `lintOnChange`, etc. */ - var passOptions = options.options || options; var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint"); if (!getAnnotations) return; if (options.async || getAnnotations.async) { - lintAsync(cm, getAnnotations, passOptions) + lintAsync(cm, getAnnotations) } else { - var annotations = getAnnotations(cm.getValue(), passOptions, cm); + var annotations = getAnnotations(cm.getValue(), state.linterOptions, cm); if (!annotations) return; if (annotations.then) annotations.then(function(issues) { cm.operation(function() {updateLinting(cm, issues)}) @@ -161,8 +188,10 @@ } function updateLinting(cm, annotationsNotSorted) { + var state = cm.state.lint; + if (!state) return; + var options = state.options; clearMarks(cm); - var state = cm.state.lint, options = state.options; var annotations = groupByLine(annotationsNotSorted); @@ -194,7 +223,10 @@ // use original annotations[line] to show multiple messages if (state.hasGutter) cm.setGutterMarker(line, GUTTER_ID, makeMarker(cm, tipLabel, maxSeverity, annotations[line].length > 1, - state.options.tooltips)); + options.tooltips)); + + if (options.highlightLines) + cm.addLineClass(line, "wrap", LINT_LINE_ID + maxSeverity); } if (options.onUpdateLinting) options.onUpdateLinting(annotationsNotSorted, annotations, cm); } @@ -203,7 +235,7 @@ var state = cm.state.lint; if (!state) return; clearTimeout(state.timeout); - state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500); + state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay); } function popupTooltips(cm, annotations, e) { @@ -243,8 +275,8 @@ if (val) { var gutters = cm.getOption("gutters"), hasLintGutter = false; for (var i = 0; i < gutters.length; ++i) if (gutters[i] == GUTTER_ID) hasLintGutter = true; - var state = cm.state.lint = new LintState(cm, parseOptions(cm, val), hasLintGutter); - if (state.options.lintOnChange !== false) + var state = cm.state.lint = new LintState(cm, val, hasLintGutter); + if (state.options.lintOnChange) cm.on("change", onChange); if (state.options.tooltips != false && state.options.tooltips != "gutter") CodeMirror.on(cm.getWrapperElement(), "mouseover", state.onMouseOver); @@ -254,6 +286,6 @@ }); CodeMirror.defineExtension("performLint", function() { - if (this.state.lint) startLinting(this); + startLinting(this); }); }); diff --git a/libraries/codemirror/addon/mode/loadmode.js b/libraries/codemirror/addon/mode/loadmode.js index fc695d0c3..ee1c1518f 100644 --- a/libraries/codemirror/addon/mode/loadmode.js +++ b/libraries/codemirror/addon/mode/loadmode.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/addon/mode/simple.js b/libraries/codemirror/addon/mode/simple.js index a1c626417..1f0e0beb7 100644 --- a/libraries/codemirror/addon/mode/simple.js +++ b/libraries/codemirror/addon/mode/simple.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -68,6 +68,7 @@ var flags = ""; if (val instanceof RegExp) { if (val.ignoreCase) flags = "i"; + if (val.unicode) flags += "u" val = val.source; } else { val = String(val); diff --git a/libraries/codemirror/addon/search/match-highlighter.js b/libraries/codemirror/addon/search/match-highlighter.js index 9b181ebc0..f7e7fb3a1 100644 --- a/libraries/codemirror/addon/search/match-highlighter.js +++ b/libraries/codemirror/addon/search/match-highlighter.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE // Highlighting text that matches the selection // diff --git a/libraries/codemirror/codemirror.css b/libraries/codemirror/codemirror.css index a64f97c77..f4d5718a7 100644 --- a/libraries/codemirror/codemirror.css +++ b/libraries/codemirror/codemirror.css @@ -60,20 +60,13 @@ .cm-fat-cursor div.CodeMirror-cursors { z-index: 1; } -.cm-fat-cursor-mark { - background-color: rgba(20, 255, 20, 0.5); - -webkit-animation: blink 1.06s steps(1) infinite; - -moz-animation: blink 1.06s steps(1) infinite; - animation: blink 1.06s steps(1) infinite; -} -.cm-animate-fat-cursor { - width: auto; - border: 0; - -webkit-animation: blink 1.06s steps(1) infinite; - -moz-animation: blink 1.06s steps(1) infinite; - animation: blink 1.06s steps(1) infinite; - background-color: #7e7; -} +.cm-fat-cursor .CodeMirror-line::selection, +.cm-fat-cursor .CodeMirror-line > span::selection, +.cm-fat-cursor .CodeMirror-line > span > span::selection { background: transparent; } +.cm-fat-cursor .CodeMirror-line::-moz-selection, +.cm-fat-cursor .CodeMirror-line > span::-moz-selection, +.cm-fat-cursor .CodeMirror-line > span > span::-moz-selection { background: transparent; } +.cm-fat-cursor { caret-color: transparent; } @-moz-keyframes blink { 0% {} 50% { background-color: transparent; } @@ -171,6 +164,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;} height: 100%; outline: none; /* Prevent dragging from highlighting the element */ position: relative; + z-index: 0; } .CodeMirror-sizer { position: relative; diff --git a/libraries/codemirror/codemirror.js b/libraries/codemirror/codemirror.js index 055963b04..5ca96da45 100644 --- a/libraries/codemirror/codemirror.js +++ b/libraries/codemirror/codemirror.js @@ -1,7 +1,7 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE -// This is CodeMirror (https://codemirror.net), a code editor +// This is CodeMirror (https://codemirror.net/5), a code editor // implemented in JavaScript on top of the browser's DOM. // // You can find some technical background for some of the code below @@ -26,7 +26,8 @@ var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]); var webkit = !edge && /WebKit\//.test(userAgent); var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent); - var chrome = !edge && /Chrome\//.test(userAgent); + var chrome = !edge && /Chrome\/(\d+)/.exec(userAgent); + var chrome_version = chrome && +chrome[1]; var presto = /Opera\//.test(userAgent); var safari = /Apple Computer/.test(navigator.vendor); var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent); @@ -111,15 +112,15 @@ } while (child = child.parentNode) } - function activeElt() { + function activeElt(doc) { // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement. // IE < 10 will throw when accessed while the page is loading or in an iframe. // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable. var activeElement; try { - activeElement = document.activeElement; + activeElement = doc.activeElement; } catch(e) { - activeElement = document.body || null; + activeElement = doc.body || null; } while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement) { activeElement = activeElement.shadowRoot.activeElement; } @@ -143,6 +144,10 @@ else if (ie) // Suppress mysterious IE10 errors { selectInput = function(node) { try { node.select(); } catch(_e) {} }; } + function doc(cm) { return cm.display.wrapper.ownerDocument } + + function win(cm) { return doc(cm).defaultView } + function bind(f) { var args = Array.prototype.slice.call(arguments, 1); return function(){return f.apply(null, args)} @@ -1311,6 +1316,7 @@ if (span.marker == marker) { return span } } } } + // Remove a span from an array, returning undefined if no spans are // left (we don't store arrays for lines without spans). function removeMarkedSpan(spans, span) { @@ -1319,9 +1325,16 @@ { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } } return r } + // Add a span to a line. - function addMarkedSpan(line, span) { - line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]; + function addMarkedSpan(line, span, op) { + var inThisOp = op && window.WeakSet && (op.markedSpans || (op.markedSpans = new WeakSet)); + if (inThisOp && line.markedSpans && inThisOp.has(line.markedSpans)) { + line.markedSpans.push(span); + } else { + line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]; + if (inThisOp) { inThisOp.add(line.markedSpans); } + } span.marker.attachLine(line); } @@ -2186,6 +2199,7 @@ if (cm.options.lineNumbers || markers) { var wrap$1 = ensureLineWrapped(lineView); var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px")); + gutterWrap.setAttribute("aria-hidden", "true"); cm.display.input.setUneditable(gutterWrap); wrap$1.insertBefore(gutterWrap, lineView.text); if (lineView.line.gutterClass) @@ -2342,12 +2356,14 @@ function mapFromLineView(lineView, line, lineN) { if (lineView.line == line) { return {map: lineView.measure.map, cache: lineView.measure.cache} } - for (var i = 0; i < lineView.rest.length; i++) - { if (lineView.rest[i] == line) - { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } } - for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) - { if (lineNo(lineView.rest[i$1]) > lineN) - { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } } + if (lineView.rest) { + for (var i = 0; i < lineView.rest.length; i++) + { if (lineView.rest[i] == line) + { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } } + for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) + { if (lineNo(lineView.rest[i$1]) > lineN) + { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } } + } } // Render a line into the hidden node display.externalMeasured. Used @@ -2561,22 +2577,24 @@ cm.display.lineNumChars = null; } - function pageScrollX() { + function pageScrollX(doc) { // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206 // which causes page_Offset and bounding client rects to use // different reference viewports and invalidate our calculations. - if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) } - return window.pageXOffset || (document.documentElement || document.body).scrollLeft + if (chrome && android) { return -(doc.body.getBoundingClientRect().left - parseInt(getComputedStyle(doc.body).marginLeft)) } + return doc.defaultView.pageXOffset || (doc.documentElement || doc.body).scrollLeft } - function pageScrollY() { - if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) } - return window.pageYOffset || (document.documentElement || document.body).scrollTop + function pageScrollY(doc) { + if (chrome && android) { return -(doc.body.getBoundingClientRect().top - parseInt(getComputedStyle(doc.body).marginTop)) } + return doc.defaultView.pageYOffset || (doc.documentElement || doc.body).scrollTop } function widgetTopHeight(lineObj) { + var ref = visualLine(lineObj); + var widgets = ref.widgets; var height = 0; - if (lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above) - { height += widgetHeight(lineObj.widgets[i]); } } } + if (widgets) { for (var i = 0; i < widgets.length; ++i) { if (widgets[i].above) + { height += widgetHeight(widgets[i]); } } } return height } @@ -2596,8 +2614,8 @@ else { yOff -= cm.display.viewOffset; } if (context == "page" || context == "window") { var lOff = cm.display.lineSpace.getBoundingClientRect(); - yOff += lOff.top + (context == "window" ? 0 : pageScrollY()); - var xOff = lOff.left + (context == "window" ? 0 : pageScrollX()); + yOff += lOff.top + (context == "window" ? 0 : pageScrollY(doc(cm))); + var xOff = lOff.left + (context == "window" ? 0 : pageScrollX(doc(cm))); rect.left += xOff; rect.right += xOff; } rect.top += yOff; rect.bottom += yOff; @@ -2611,8 +2629,8 @@ var left = coords.left, top = coords.top; // First move into "page" coordinate system if (context == "page") { - left -= pageScrollX(); - top -= pageScrollY(); + left -= pageScrollX(doc(cm)); + top -= pageScrollY(doc(cm)); } else if (context == "local" || !context) { var localBox = cm.display.sizer.getBoundingClientRect(); left += localBox.left; @@ -3141,13 +3159,19 @@ var curFragment = result.cursors = document.createDocumentFragment(); var selFragment = result.selection = document.createDocumentFragment(); + var customCursor = cm.options.$customCursor; + if (customCursor) { primary = true; } for (var i = 0; i < doc.sel.ranges.length; i++) { if (!primary && i == doc.sel.primIndex) { continue } var range = doc.sel.ranges[i]; if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue } var collapsed = range.empty(); - if (collapsed || cm.options.showCursorWhenSelecting) - { drawSelectionCursor(cm, range.head, curFragment); } + if (customCursor) { + var head = customCursor(cm, range); + if (head) { drawSelectionCursor(cm, head, curFragment); } + } else if (collapsed || cm.options.showCursorWhenSelecting) { + drawSelectionCursor(cm, range.head, curFragment); + } if (!collapsed) { drawSelectionRange(cm, range, selFragment); } } @@ -3163,6 +3187,12 @@ cursor.style.top = pos.top + "px"; cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px"; + if (/\bcm-fat-cursor\b/.test(cm.getWrapperElement().className)) { + var charPos = charCoords(cm, head, "div", null, null); + var width = charPos.right - charPos.left; + cursor.style.width = (width > 0 ? width : cm.defaultCharWidth()) + "px"; + } + if (pos.other) { // Secondary cursor, shown when on a 'jump' in bi-directional text var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor")); @@ -3335,10 +3365,14 @@ function updateHeightsInViewport(cm) { var display = cm.display; var prevBottom = display.lineDiv.offsetTop; + var viewTop = Math.max(0, display.scroller.getBoundingClientRect().top); + var oldHeight = display.lineDiv.getBoundingClientRect().top; + var mustScroll = 0; for (var i = 0; i < display.view.length; i++) { var cur = display.view[i], wrapping = cm.options.lineWrapping; var height = (void 0), width = 0; if (cur.hidden) { continue } + oldHeight += cur.line.height; if (ie && ie_version < 8) { var bot = cur.node.offsetTop + cur.node.offsetHeight; height = bot - prevBottom; @@ -3353,6 +3387,7 @@ } var diff = cur.line.height - height; if (diff > .005 || diff < -.005) { + if (oldHeight < viewTop) { mustScroll -= diff; } updateLineHeight(cur.line, height); updateWidgetHeight(cur.line); if (cur.rest) { for (var j = 0; j < cur.rest.length; j++) @@ -3367,6 +3402,7 @@ } } } + if (Math.abs(mustScroll) > 2) { display.scroller.scrollTop += mustScroll; } } // Read and store the height of line widgets associated with the @@ -3410,8 +3446,9 @@ if (signalDOMEvent(cm, "scrollCursorIntoView")) { return } var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null; + var doc = display.wrapper.ownerDocument; if (rect.top + box.top < 0) { doScroll = true; } - else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; } + else if (rect.bottom + box.top > (doc.defaultView.innerHeight || doc.documentElement.clientHeight)) { doScroll = false; } if (doScroll != null && !phantom) { var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;")); cm.display.lineSpace.appendChild(scrollNode); @@ -3430,8 +3467,8 @@ // Set pos and end to the cursor positions around the character pos sticks to // If pos.sticky == "before", that is around pos.ch - 1, otherwise around pos.ch // If pos == Pos(_, 0, "before"), pos and end are unchanged - pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos; end = pos.sticky == "before" ? Pos(pos.line, pos.ch + 1, "before") : pos; + pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos; } for (var limit = 0; limit < 5; limit++) { var changed = false; @@ -3627,6 +3664,7 @@ this.vert.firstChild.style.height = Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px"; } else { + this.vert.scrollTop = 0; this.vert.style.display = ""; this.vert.firstChild.style.height = "0"; } @@ -3664,13 +3702,13 @@ NativeScrollbars.prototype.zeroWidthHack = function () { var w = mac && !mac_geMountainLion ? "12px" : "18px"; this.horiz.style.height = this.vert.style.width = w; - this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none"; + this.horiz.style.visibility = this.vert.style.visibility = "hidden"; this.disableHoriz = new Delayed; this.disableVert = new Delayed; }; NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) { - bar.style.pointerEvents = "auto"; + bar.style.visibility = ""; function maybeDisable() { // To find out whether the scrollbar is still visible, we // check whether the element under the pixel in the bottom @@ -3681,7 +3719,7 @@ var box = bar.getBoundingClientRect(); var elt = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2) : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1); - if (elt != bar) { bar.style.pointerEvents = "none"; } + if (elt != bar) { bar.style.visibility = "hidden"; } else { delay.set(1000, maybeDisable); } } delay.set(1000, maybeDisable); @@ -3782,7 +3820,8 @@ scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet scrollToPos: null, // Used to scroll to a specific position focus: false, - id: ++nextOpId // Unique ID + id: ++nextOpId, // Unique ID + markArrays: null // Used by addMarkedSpan }; pushOperation(cm.curOp); } @@ -3861,7 +3900,7 @@ cm.display.maxLineChanged = false; } - var takeFocus = op.focus && op.focus == activeElt(); + var takeFocus = op.focus && op.focus == activeElt(doc(cm)); if (op.preparedSelection) { cm.display.input.showSelection(op.preparedSelection, takeFocus); } if (op.updatedDisplay || op.startHeight != cm.doc.height) @@ -4038,11 +4077,11 @@ function selectionSnapshot(cm) { if (cm.hasFocus()) { return null } - var active = activeElt(); + var active = activeElt(doc(cm)); if (!active || !contains(cm.display.lineDiv, active)) { return null } var result = {activeElt: active}; if (window.getSelection) { - var sel = window.getSelection(); + var sel = win(cm).getSelection(); if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) { result.anchorNode = sel.anchorNode; result.anchorOffset = sel.anchorOffset; @@ -4054,11 +4093,12 @@ } function restoreSelection(snapshot) { - if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return } + if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt(snapshot.activeElt.ownerDocument)) { return } snapshot.activeElt.focus(); if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) && snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) { - var sel = window.getSelection(), range = document.createRange(); + var doc = snapshot.activeElt.ownerDocument; + var sel = doc.defaultView.getSelection(), range = doc.createRange(); range.setEnd(snapshot.anchorNode, snapshot.anchorOffset); range.collapse(false); sel.removeAllRanges(); @@ -4235,6 +4275,8 @@ function updateGutterSpace(display) { var width = display.gutters.offsetWidth; display.sizer.style.marginLeft = width + "px"; + // Send an event to consumers responding to changes in gutter width. + signalLater(display, "gutterChanged", display); } function setDocumentHeight(cm, measure) { @@ -4373,6 +4415,12 @@ d.scroller.setAttribute("tabIndex", "-1"); // The element in which the editor lives. d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror"); + // See #6982. FIXME remove when this has been fixed for a while in Chrome + if (chrome && chrome_version >= 105) { d.wrapper.style.clipPath = "inset(0px)"; } + + // This attribute is respected by automatic translation systems such as Google Translate, + // and may also be respected by tools used by human translators. + d.wrapper.setAttribute('translate', 'no'); // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported) if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; } @@ -4470,7 +4518,24 @@ } function onScrollWheel(cm, e) { + // On Chrome 102, viewport updates somehow stop wheel-based + // scrolling. Turning off pointer events during the scroll seems + // to avoid the issue. + if (chrome && chrome_version == 102) { + if (cm.display.chromeScrollHack == null) { cm.display.sizer.style.pointerEvents = "none"; } + else { clearTimeout(cm.display.chromeScrollHack); } + cm.display.chromeScrollHack = setTimeout(function () { + cm.display.chromeScrollHack = null; + cm.display.sizer.style.pointerEvents = ""; + }, 100); + } var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y; + var pixelsPerUnit = wheelPixelsPerUnit; + if (e.deltaMode === 0) { + dx = e.deltaX; + dy = e.deltaY; + pixelsPerUnit = 1; + } var display = cm.display, scroll = display.scroller; // Quit if there's nothing to scroll here @@ -4499,10 +4564,10 @@ // estimated pixels/delta value, we just handle horizontal // scrolling entirely here. It'll be slightly off from native, but // better than glitching out. - if (dx && !gecko && !presto && wheelPixelsPerUnit != null) { + if (dx && !gecko && !presto && pixelsPerUnit != null) { if (dy && canScrollY) - { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)); } - setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit)); + { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * pixelsPerUnit)); } + setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * pixelsPerUnit)); // Only prevent default scrolling if vertical scrolling is // actually possible. Otherwise, it causes vertical scroll // jitter on OSX trackpads when deltaX is small and deltaY @@ -4515,15 +4580,15 @@ // 'Project' the visible viewport to cover the area that is being // scrolled into view (if we know enough to estimate it). - if (dy && wheelPixelsPerUnit != null) { - var pixels = dy * wheelPixelsPerUnit; + if (dy && pixelsPerUnit != null) { + var pixels = dy * pixelsPerUnit; var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight; if (pixels < 0) { top = Math.max(0, top + pixels - 50); } else { bot = Math.min(cm.doc.height, bot + pixels + 50); } updateDisplaySimple(cm, {top: top, bottom: bot}); } - if (wheelSamples < 20) { + if (wheelSamples < 20 && e.deltaMode !== 0) { if (display.wheelStartX == null) { display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop; display.wheelDX = dx; display.wheelDY = dy; @@ -4782,6 +4847,7 @@ estimateLineHeights(cm); loadMode(cm); setDirectionClass(cm); + cm.options.direction = doc.direction; if (!cm.options.lineWrapping) { findMaxLine(cm); } cm.options.mode = doc.modeOption; regChange(cm); @@ -5146,7 +5212,7 @@ var range = sel.ranges[i]; var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]; var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear); - var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear); + var newHead = range.head == range.anchor ? newAnchor : skipAtomic(doc, range.head, old && old.head, bias, mayClear); if (out || newAnchor != range.anchor || newHead != range.head) { if (!out) { out = sel.ranges.slice(0, i); } out[i] = new Range(newAnchor, newHead); @@ -5958,7 +6024,7 @@ if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); } addMarkedSpan(line, new MarkedSpan(marker, curLine == from.line ? from.ch : null, - curLine == to.line ? to.ch : null)); + curLine == to.line ? to.ch : null), doc.cm && doc.cm.curOp); ++curLine; }); // lineIsHidden depends on the presence of the spans, so needs a second pass @@ -6130,6 +6196,7 @@ getRange: function(from, to, lineSep) { var lines = getBetween(this, clipPos(this, from), clipPos(this, to)); if (lineSep === false) { return lines } + if (lineSep === '') { return lines.join('') } return lines.join(lineSep || this.lineSeparator()) }, @@ -6684,10 +6751,9 @@ // Very basic readline/emacs-style bindings, which are standard on Mac. keyMap.emacsy = { "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown", - "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd", - "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore", - "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars", - "Ctrl-O": "openLine" + "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd", "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", + "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", + "Ctrl-T": "transposeChars", "Ctrl-O": "openLine" }; keyMap.macDefault = { "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo", @@ -7198,7 +7264,7 @@ function onKeyDown(e) { var cm = this; if (e.target && e.target != cm.display.input.getField()) { return } - cm.curOp.focus = activeElt(); + cm.curOp.focus = activeElt(doc(cm)); if (signalDOMEvent(cm, e)) { return } // IE does strange things with escape. if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; } @@ -7305,7 +7371,7 @@ } if (clickInGutter(cm, e)) { return } var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : "single"; - window.focus(); + win(cm).focus(); // #3261: make sure, that we're not starting a second selection if (button == 1 && cm.state.selectingText) @@ -7360,7 +7426,7 @@ function leftButtonDown(cm, pos, repeat, event) { if (ie) { setTimeout(bind(ensureFocus, cm), 0); } - else { cm.curOp.focus = activeElt(); } + else { cm.curOp.focus = activeElt(doc(cm)); } var behavior = configureMouse(cm, repeat, event); @@ -7430,19 +7496,19 @@ // Normal selection, as opposed to text dragging. function leftButtonSelect(cm, event, start, behavior) { if (ie) { delayBlurEvent(cm); } - var display = cm.display, doc = cm.doc; + var display = cm.display, doc$1 = cm.doc; e_preventDefault(event); - var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges; + var ourRange, ourIndex, startSel = doc$1.sel, ranges = startSel.ranges; if (behavior.addNew && !behavior.extend) { - ourIndex = doc.sel.contains(start); + ourIndex = doc$1.sel.contains(start); if (ourIndex > -1) { ourRange = ranges[ourIndex]; } else { ourRange = new Range(start, start); } } else { - ourRange = doc.sel.primary(); - ourIndex = doc.sel.primIndex; + ourRange = doc$1.sel.primary(); + ourIndex = doc$1.sel.primIndex; } if (behavior.unit == "rectangle") { @@ -7459,18 +7525,18 @@ if (!behavior.addNew) { ourIndex = 0; - setSelection(doc, new Selection([ourRange], 0), sel_mouse); - startSel = doc.sel; + setSelection(doc$1, new Selection([ourRange], 0), sel_mouse); + startSel = doc$1.sel; } else if (ourIndex == -1) { ourIndex = ranges.length; - setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex), + setSelection(doc$1, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex), {scroll: false, origin: "*mouse"}); } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == "char" && !behavior.extend) { - setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0), + setSelection(doc$1, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0), {scroll: false, origin: "*mouse"}); - startSel = doc.sel; + startSel = doc$1.sel; } else { - replaceOneSelection(doc, ourIndex, ourRange, sel_mouse); + replaceOneSelection(doc$1, ourIndex, ourRange, sel_mouse); } var lastPos = start; @@ -7480,19 +7546,19 @@ if (behavior.unit == "rectangle") { var ranges = [], tabSize = cm.options.tabSize; - var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize); - var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize); + var startCol = countColumn(getLine(doc$1, start.line).text, start.ch, tabSize); + var posCol = countColumn(getLine(doc$1, pos.line).text, pos.ch, tabSize); var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol); for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line)); line <= end; line++) { - var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize); + var text = getLine(doc$1, line).text, leftPos = findColumn(text, left, tabSize); if (left == right) { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); } else if (text.length > leftPos) { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); } } if (!ranges.length) { ranges.push(new Range(start, start)); } - setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex), + setSelection(doc$1, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex), {origin: "*mouse", scroll: false}); cm.scrollIntoView(pos); } else { @@ -7507,8 +7573,8 @@ anchor = maxPos(oldRange.to(), range.head); } var ranges$1 = startSel.ranges.slice(0); - ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head)); - setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse); + ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc$1, anchor), head)); + setSelection(doc$1, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse); } } @@ -7524,9 +7590,9 @@ var cur = posFromMouse(cm, e, true, behavior.unit == "rectangle"); if (!cur) { return } if (cmp(cur, lastPos) != 0) { - cm.curOp.focus = activeElt(); + cm.curOp.focus = activeElt(doc(cm)); extendTo(cur); - var visible = visibleLines(display, doc); + var visible = visibleLines(display, doc$1); if (cur.line >= visible.to || cur.line < visible.from) { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); } } else { @@ -7551,7 +7617,7 @@ } off(display.wrapper.ownerDocument, "mousemove", move); off(display.wrapper.ownerDocument, "mouseup", up); - doc.history.lastSelOrigin = null; + doc$1.history.lastSelOrigin = null; } var move = operation(cm, function (e) { @@ -7708,7 +7774,7 @@ for (var i = newBreaks.length - 1; i >= 0; i--) { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); } }); - option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, function (cm, val, old) { + option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g, function (cm, val, old) { cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g"); if (old != Init) { cm.refresh(); } }); @@ -8151,7 +8217,7 @@ var pasted = e.clipboardData && e.clipboardData.getData("Text"); if (pasted) { e.preventDefault(); - if (!cm.isReadOnly() && !cm.options.disableInput) + if (!cm.isReadOnly() && !cm.options.disableInput && cm.hasFocus()) { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); } return true } @@ -8199,7 +8265,7 @@ } function hiddenTextarea() { - var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"); + var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"); var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;"); // The textarea is kept positioned near the cursor to prevent the // fact that it'll be scrolled into view on input from scrolling @@ -8228,7 +8294,7 @@ CodeMirror.prototype = { constructor: CodeMirror, - focus: function(){window.focus(); this.display.input.focus();}, + focus: function(){win(this).focus(); this.display.input.focus();}, setOption: function(option, value) { var options = this.options, old = options[option]; @@ -8552,7 +8618,7 @@ signal(this, "overwriteToggle", this, this.state.overwrite); }, - hasFocus: function() { return this.display.input.getField() == activeElt() }, + hasFocus: function() { return this.display.input.getField() == activeElt(doc(this)) }, isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) }, scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }), @@ -8733,7 +8799,7 @@ function findPosV(cm, pos, dir, unit) { var doc = cm.doc, x = pos.left, y; if (unit == "page") { - var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight); + var pageSize = Math.min(cm.display.wrapper.clientHeight, win(cm).innerHeight || doc(cm).documentElement.clientHeight); var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3); y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount; @@ -8833,7 +8899,7 @@ var kludge = hiddenTextarea(), te = kludge.firstChild; cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild); te.value = lastCopied.text.join("\n"); - var hadFocus = document.activeElement; + var hadFocus = activeElt(div.ownerDocument); selectInput(te); setTimeout(function () { cm.display.lineSpace.removeChild(kludge); @@ -8856,7 +8922,7 @@ ContentEditableInput.prototype.prepareSelection = function () { var result = prepareSelection(this.cm, false); - result.focus = document.activeElement == this.div; + result.focus = activeElt(this.div.ownerDocument) == this.div; return result }; @@ -8952,7 +9018,7 @@ ContentEditableInput.prototype.focus = function () { if (this.cm.options.readOnly != "nocursor") { - if (!this.selectionInEditor() || document.activeElement != this.div) + if (!this.selectionInEditor() || activeElt(this.div.ownerDocument) != this.div) { this.showSelection(this.prepareSelection(), true); } this.div.focus(); } @@ -8963,9 +9029,11 @@ ContentEditableInput.prototype.supportsTouch = function () { return true }; ContentEditableInput.prototype.receivedFocus = function () { + var this$1 = this; + var input = this; if (this.selectionInEditor()) - { this.pollSelection(); } + { setTimeout(function () { return this$1.pollSelection(); }, 20); } else { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); } @@ -9302,6 +9370,7 @@ // Used to work around IE issue with selection being forgotten when focus moves away from textarea this.hasSelection = false; this.composing = null; + this.resetting = false; }; TextareaInput.prototype.init = function (display) { @@ -9434,8 +9503,9 @@ // Reset the input to correspond to the selection (or to be empty, // when not typing and nothing is selected) TextareaInput.prototype.reset = function (typing) { - if (this.contextMenuPending || this.composing) { return } + if (this.contextMenuPending || this.composing && typing) { return } var cm = this.cm; + this.resetting = true; if (cm.somethingSelected()) { this.prevInput = ""; var content = cm.getSelection(); @@ -9446,6 +9516,7 @@ this.prevInput = this.textarea.value = ""; if (ie && ie_version >= 9) { this.hasSelection = null; } } + this.resetting = false; }; TextareaInput.prototype.getField = function () { return this.textarea }; @@ -9453,7 +9524,7 @@ TextareaInput.prototype.supportsTouch = function () { return false }; TextareaInput.prototype.focus = function () { - if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) { + if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt(this.textarea.ownerDocument) != this.textarea)) { try { this.textarea.focus(); } catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM } @@ -9507,7 +9578,7 @@ // possible when it is clear that nothing happened. hasSelection // will be the case when there is a lot of text in the textarea, // in which case reading its value would be expensive. - if (this.contextMenuPending || !cm.state.focused || + if (this.contextMenuPending || this.resetting || !cm.state.focused || (hasSelection(input) && !prevInput && !this.composing) || cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq) { return false } @@ -9576,9 +9647,9 @@ input.wrapper.style.cssText = "position: static"; te.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"; var oldScrollY; - if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712) + if (webkit) { oldScrollY = te.ownerDocument.defaultView.scrollY; } // Work around Chrome issue (#2712) display.input.focus(); - if (webkit) { window.scrollTo(null, oldScrollY); } + if (webkit) { te.ownerDocument.defaultView.scrollTo(null, oldScrollY); } display.input.reset(); // Adds "Select all" to context menu in FF if (!cm.somethingSelected()) { te.value = input.prevInput = " "; } @@ -9660,7 +9731,7 @@ // Set autofocus to true if this textarea is focused, or if it has // autofocus and no other element is focused. if (options.autofocus == null) { - var hasFocus = activeElt(); + var hasFocus = activeElt(textarea.ownerDocument); options.autofocus = hasFocus == textarea || textarea.getAttribute("autofocus") != null && hasFocus == document.body; } @@ -9794,7 +9865,7 @@ addLegacyProps(CodeMirror); - CodeMirror.version = "5.60.0"; + CodeMirror.version = "5.65.9"; return CodeMirror; diff --git a/libraries/codemirror/keymap/vim.js b/libraries/codemirror/keymap/vim.js index 1cf9636fd..67b245b21 100644 --- a/libraries/codemirror/keymap/vim.js +++ b/libraries/codemirror/keymap/vim.js @@ -1,5 +1,14 @@ -// CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../lib/codemirror"), require("../addon/search/searchcursor"), require("../addon/dialog/dialog"), require("../addon/edit/matchbrackets.js")); + else if (typeof define == "function" && define.amd) // AMD + define(["../lib/codemirror", "../addon/search/searchcursor", "../addon/dialog/dialog", "../addon/edit/matchbrackets"], mod); + else // Plain browser env + mod(CodeMirror); + })(function(CodeMirror) { + 'use strict'; + // CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: https://codemirror.net/5/LICENSE /** * Supported keybindings: @@ -34,15 +43,7 @@ * 9. Ex command implementations. */ -(function(mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - mod(require("../lib/codemirror"), require("../addon/search/searchcursor"), require("../addon/dialog/dialog"), require("../addon/edit/matchbrackets.js")); - else if (typeof define == "function" && define.amd) // AMD - define(["../lib/codemirror", "../addon/search/searchcursor", "../addon/dialog/dialog", "../addon/edit/matchbrackets"], mod); - else // Plain browser env - mod(CodeMirror); -})(function(CodeMirror) { - 'use strict'; +function initVim$1(CodeMirror) { var Pos = CodeMirror.Pos; @@ -87,6 +88,8 @@ { keys: '', type: 'keyToKey', toKeys: '' }, { keys: '', type: 'keyToKey', toKeys: '', context: 'insert' }, { keys: '', type: 'keyToKey', toKeys: '', context: 'insert' }, + { keys: '', type: 'keyToKey', toKeys: '' }, // ipad keyboard sends C-Esc instead of C-[ + { keys: '', type: 'keyToKey', toKeys: '', context: 'insert' }, { keys: 's', type: 'keyToKey', toKeys: 'cl', context: 'normal' }, { keys: 's', type: 'keyToKey', toKeys: 'c', context: 'visual'}, { keys: 'S', type: 'keyToKey', toKeys: 'cc', context: 'normal' }, @@ -225,8 +228,8 @@ { keys: 'z.', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }, motion: 'moveToFirstNonWhiteSpaceCharacter' }, { keys: 'zt', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }}, { keys: 'z', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }, motion: 'moveToFirstNonWhiteSpaceCharacter' }, - { keys: 'z-', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }}, - { keys: 'zb', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }, motion: 'moveToFirstNonWhiteSpaceCharacter' }, + { keys: 'zb', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }}, + { keys: 'z-', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }, motion: 'moveToFirstNonWhiteSpaceCharacter' }, { keys: '.', type: 'action', action: 'repeatLastEdit' }, { keys: '', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: true, backtrack: false}}, { keys: '', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: false, backtrack: false}}, @@ -276,7 +279,6 @@ { name: 'global', shortName: 'g' } ]; - var Vim = function() { function enterVimMode(cm) { cm.setOption('disableInput', true); cm.setOption('showCursorWhenSelecting', false); @@ -642,8 +644,8 @@ register.clear(); this.latestRegister = registerName; if (cm.openDialog) { - this.onRecordingDone = cm.openDialog( - document.createTextNode('(recording)['+registerName+']'), null, {bottom:true}); + var template = dom('span', {class: 'cm-vim-message'}, 'recording @' + registerName); + this.onRecordingDone = cm.openDialog(template, null, {bottom:true}); } this.isRecording = true; } @@ -716,7 +718,8 @@ } var lastInsertModeKeyTimer; - var vimApi= { + var vimApi = { + enterVimMode: enterVimMode, buildKeyMap: function() { // TODO: Convert keymap into dictionary format for fast lookup. }, @@ -838,6 +841,8 @@ return command(); } }, + multiSelectHandleKey: multiSelectHandleKey, + /** * This is the outermost function called by CodeMirror, after keys have * been mapped to their Vim equivalents. @@ -865,13 +870,17 @@ } function handleEsc() { if (key == '') { - // Clear input state and get back to normal mode. - clearInputState(cm); if (vim.visualMode) { + // Get back to normal mode. exitVisualMode(cm); } else if (vim.insertMode) { + // Get back to normal mode. exitInsertMode(cm); + } else { + // We're already in normal mode. Let '' be handled normally. + return; } + clearInputState(cm); return true; } } @@ -939,9 +948,10 @@ var match = commandDispatcher.matchCommand(mainKey, defaultKeymap, vim.inputState, context); if (match.type == 'none') { clearInputState(cm); return false; } else if (match.type == 'partial') { return true; } + else if (match.type == 'clear') { clearInputState(cm); return true; } vim.inputState.keyBuffer = ''; - var keysMatcher = /^(\d*)(.*)$/.exec(keys); + keysMatcher = /^(\d*)(.*)$/.exec(keys); if (keysMatcher[1] && keysMatcher[1] != '0') { vim.inputState.pushRepeatDigit(keysMatcher[1]); } @@ -1243,7 +1253,7 @@ } if (bestMatch.keys.slice(-11) == '') { var character = lastChar(keys); - if (!character) return {type: 'none'}; + if (!character || character.length > 1) return {type: 'clear'}; inputState.selectedCharacter = character; } return {type: 'full', command: bestMatch}; @@ -1270,8 +1280,6 @@ case 'keyToEx': this.processEx(cm, vim, command); break; - default: - break; } }, processMotion: function(cm, vim, command) { @@ -1487,6 +1495,7 @@ vimGlobalState.exCommandHistoryController.pushInput(input); vimGlobalState.exCommandHistoryController.reset(); exCommandDispatcher.processCommand(cm, input); + clearInputState(cm); } function onPromptKeyDown(e, input, close) { var keyName = CodeMirror.keyName(e), up, offset; @@ -2007,7 +2016,7 @@ } var orig = cm.charCoords(head, 'local'); motionArgs.repeat = repeat; - var curEnd = motions.moveByDisplayLines(cm, head, motionArgs, vim); + curEnd = motions.moveByDisplayLines(cm, head, motionArgs, vim); if (!curEnd) { return null; } @@ -2150,6 +2159,20 @@ } } else if (character === 't') { tmp = expandTagUnderCursor(cm, head, inclusive); + } else if (character === 's') { + // account for cursor on end of sentence symbol + var content = cm.getLine(head.line); + if (head.ch > 0 && isEndOfSentenceSymbol(content[head.ch])) { + head.ch -= 1; + } + var end = getSentence(cm, head, motionArgs.repeat, 1, inclusive); + var start = getSentence(cm, head, motionArgs.repeat, -1, inclusive); + // closer vim behaviour, 'a' only takes the space after the sentence if there is one before and after + if (isWhiteSpaceString(cm.getLine(start.line)[start.ch]) + && isWhiteSpaceString(cm.getLine(end.line)[end.ch -1])) { + start = {line: start.line, ch: start.ch + 1}; + } + tmp = {start: start, end: end}; } else { // No text object defined for this, don't move. return null; @@ -2232,7 +2255,7 @@ } else if (args.fullLine) { head.ch = Number.MAX_VALUE; head.line--; - cm.setSelection(anchor, head) + cm.setSelection(anchor, head); text = cm.getSelection(); cm.replaceSelection(""); finalHead = anchor; @@ -2284,22 +2307,30 @@ }, indent: function(cm, args, ranges) { var vim = cm.state.vim; - var startLine = ranges[0].anchor.line; - var endLine = vim.visualBlock ? - ranges[ranges.length - 1].anchor.line : - ranges[0].head.line; - // In visual mode, n> shifts the selection right n times, instead of - // shifting n lines right once. - var repeat = (vim.visualMode) ? args.repeat : 1; - if (args.linewise) { - // The only way to delete a newline is to delete until the start of - // the next line, so in linewise mode evalInput will include the next - // line. We don't want this in indent, so we go back a line. - endLine--; - } - for (var i = startLine; i <= endLine; i++) { + if (cm.indentMore) { + var repeat = (vim.visualMode) ? args.repeat : 1; for (var j = 0; j < repeat; j++) { - cm.indentLine(i, args.indentRight); + if (args.indentRight) cm.indentMore(); + else cm.indentLess(); + } + } else { + var startLine = ranges[0].anchor.line; + var endLine = vim.visualBlock ? + ranges[ranges.length - 1].anchor.line : + ranges[0].head.line; + // In visual mode, n> shifts the selection right n times, instead of + // shifting n lines right once. + var repeat = (vim.visualMode) ? args.repeat : 1; + if (args.linewise) { + // The only way to delete a newline is to delete until the start of + // the next line, so in linewise mode evalInput will include the next + // line. We don't want this in indent, so we go back a line. + endLine--; + } + for (var i = startLine; i <= endLine; i++) { + for (var j = 0; j < repeat; j++) { + cm.indentLine(i, args.indentRight); + } } } return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor); @@ -2412,11 +2443,14 @@ var charCoords = cm.charCoords(new Pos(lineNum, 0), 'local'); var height = cm.getScrollInfo().clientHeight; var y = charCoords.top; - var lineHeight = charCoords.bottom - y; switch (actionArgs.position) { - case 'center': y = y - (height / 2) + lineHeight; + case 'center': y = charCoords.bottom - height / 2; break; - case 'bottom': y = y - height + lineHeight; + case 'bottom': + var lineLastCharPos = new Pos(lineNum, cm.getLine(lineNum).length - 1); + var lineLastCharCoords = cm.charCoords(lineLastCharPos, 'local'); + var lineHeight = lineLastCharCoords.bottom - y; + y = y - height + lineHeight; break; } cm.scrollTo(null, y); @@ -2866,13 +2900,13 @@ } if (!actionArgs.backtrack && (end <= cur.ch))return; if (match) { - var baseStr = match[2] || match[4] - var digits = match[3] || match[5] + var baseStr = match[2] || match[4]; + var digits = match[3] || match[5]; var increment = actionArgs.increase ? 1 : -1; var base = {'0b': 2, '0': 8, '': 10, '0x': 16}[baseStr.toLowerCase()]; var number = parseInt(match[1] + digits, base) + (increment * actionArgs.repeat); numberStr = number.toString(base); - var zeroPadding = baseStr ? new Array(digits.length - numberStr.length + 1 + match[1].length).join('0') : '' + var zeroPadding = baseStr ? new Array(digits.length - numberStr.length + 1 + match[1].length).join('0') : ''; if (numberStr.charAt(0) === '-') { numberStr = '-' + baseStr + zeroPadding + numberStr.substr(1); } else { @@ -3244,9 +3278,8 @@ fromCh = anchor.ch, bottom = Math.max(anchor.line, head.line), toCh = head.ch; - if (fromCh < toCh) { toCh += 1 } - else { fromCh += 1 }; - var height = bottom - top + 1; + if (fromCh < toCh) { toCh += 1; } + else { fromCh += 1; } var height = bottom - top + 1; var primary = head.line == top ? 0 : height - 1; var ranges = []; for (var i = 0; i < height; i++) { @@ -3798,21 +3831,156 @@ start = new Pos(i, 0); return { start: start, end: end }; } - - function findSentence(cm, cur, repeat, dir) { - - /* - Takes an index object - { - line: the line string, - ln: line number, - pos: index in line, - dir: direction of traversal (-1 or 1) + function getSentence(cm, cur, repeat, dir, inclusive /*includes whitespace*/) { + /* + Takes an index object + { + line: the line string, + ln: line number, + pos: index in line, + dir: direction of traversal (-1 or 1) + } + and modifies the pos member to represent the + next valid position or sets the line to null if there are + no more valid positions. + */ + function nextChar(curr) { + if (curr.pos + curr.dir < 0 || curr.pos + curr.dir >= curr.line.length) { + curr.line = null; } - and modifies the line, ln, and pos members to represent the - next valid position or sets them to null if there are - no more valid positions. - */ + else { + curr.pos += curr.dir; + } + } + /* + Performs one iteration of traversal in forward direction + Returns an index object of the new location + */ + function forward(cm, ln, pos, dir) { + var line = cm.getLine(ln); + + var curr = { + line: line, + ln: ln, + pos: pos, + dir: dir, + }; + + if (curr.line === "") { + return { ln: curr.ln, pos: curr.pos }; + } + + var lastSentencePos = curr.pos; + + // Move one step to skip character we start on + nextChar(curr); + + while (curr.line !== null) { + lastSentencePos = curr.pos; + if (isEndOfSentenceSymbol(curr.line[curr.pos])) { + if (!inclusive) { + return { ln: curr.ln, pos: curr.pos + 1 }; + } else { + nextChar(curr); + while (curr.line !== null ) { + if (isWhiteSpaceString(curr.line[curr.pos])) { + lastSentencePos = curr.pos; + nextChar(curr); + } else { + break; + } + } + return { ln: curr.ln, pos: lastSentencePos + 1, }; + } + } + nextChar(curr); + } + return { ln: curr.ln, pos: lastSentencePos + 1 }; + } + + /* + Performs one iteration of traversal in reverse direction + Returns an index object of the new location + */ + function reverse(cm, ln, pos, dir) { + var line = cm.getLine(ln); + + var curr = { + line: line, + ln: ln, + pos: pos, + dir: dir, + }; + + if (curr.line === "") { + return { ln: curr.ln, pos: curr.pos }; + } + + var lastSentencePos = curr.pos; + + // Move one step to skip character we start on + nextChar(curr); + + while (curr.line !== null) { + if (!isWhiteSpaceString(curr.line[curr.pos]) && !isEndOfSentenceSymbol(curr.line[curr.pos])) { + lastSentencePos = curr.pos; + } + + else if (isEndOfSentenceSymbol(curr.line[curr.pos]) ) { + if (!inclusive) { + return { ln: curr.ln, pos: lastSentencePos }; + } else { + if (isWhiteSpaceString(curr.line[curr.pos + 1])) { + return { ln: curr.ln, pos: curr.pos + 1, }; + } else { + return {ln: curr.ln, pos: lastSentencePos}; + } + } + } + + nextChar(curr); + } + curr.line = line; + if (inclusive && isWhiteSpaceString(curr.line[curr.pos])) { + return { ln: curr.ln, pos: curr.pos }; + } else { + return { ln: curr.ln, pos: lastSentencePos }; + } + + } + + var curr_index = { + ln: cur.line, + pos: cur.ch, + }; + + while (repeat > 0) { + if (dir < 0) { + curr_index = reverse(cm, curr_index.ln, curr_index.pos, dir); + } + else { + curr_index = forward(cm, curr_index.ln, curr_index.pos, dir); + } + repeat--; + } + + return new Pos(curr_index.ln, curr_index.pos); + } + + function findSentence(cm, cur, repeat, dir) { + + /* + Takes an index object + { + line: the line string, + ln: line number, + pos: index in line, + dir: direction of traversal (-1 or 1) + } + and modifies the line, ln, and pos members to represent the + next valid position or sets them to null if there are + no more valid positions. + */ function nextChar(cm, idx) { if (idx.pos + idx.dir < 0 || idx.pos + idx.dir >= idx.line.length) { idx.ln += idx.dir; @@ -3843,12 +4011,12 @@ ln: ln, pos: pos, dir: dir, - } + }; var last_valid = { ln: curr.ln, pos: curr.pos, - } + }; var skip_empty_lines = (curr.line === ""); @@ -3904,7 +4072,7 @@ ln: ln, pos: pos, dir: dir, - } + }; var last_valid = { ln: curr.ln, @@ -3933,7 +4101,7 @@ } else if (curr.line !== "" && !isWhiteSpaceString(curr.line[curr.pos])) { skip_empty_lines = false; - last_valid = { ln: curr.ln, pos: curr.pos } + last_valid = { ln: curr.ln, pos: curr.pos }; } nextChar(cm, curr); @@ -4325,7 +4493,7 @@ } function showConfirm(cm, template) { - var pre = dom('pre', {$color: 'red', class: 'cm-vim-message'}, template); + var pre = dom('div', {$color: 'red', $whiteSpace: 'pre', class: 'cm-vim-message'}, template); if (cm.openNotification) { cm.openNotification(pre, {bottom: true, duration: 5000}); } else { @@ -4920,7 +5088,7 @@ for (var registerName in registers) { var text = registers[registerName].toString(); if (text.length) { - regInfo += '"' + registerName + ' ' + text + '\n' + regInfo += '"' + registerName + ' ' + text + '\n'; } } } else { @@ -4932,7 +5100,7 @@ continue; } var register = registers[registerName] || new Register(); - regInfo += '"' + registerName + ' ' + register.toString() + '\n' + regInfo += '"' + registerName + ' ' + register.toString() + '\n'; } } showConfirm(cm, regInfo); @@ -5726,9 +5894,85 @@ } } + // multiselect support + function cloneVimState(state) { + var n = new state.constructor(); + Object.keys(state).forEach(function(key) { + var o = state[key]; + if (Array.isArray(o)) + o = o.slice(); + else if (o && typeof o == "object" && o.constructor != Object) + o = cloneVimState(o); + n[key] = o; + }); + if (state.sel) { + n.sel = { + head: state.sel.head && copyCursor(state.sel.head), + anchor: state.sel.anchor && copyCursor(state.sel.anchor) + }; + } + return n; + } + function multiSelectHandleKey(cm, key, origin) { + var isHandled = false; + var vim = vimApi.maybeInitVimState_(cm); + var visualBlock = vim.visualBlock || vim.wasInVisualBlock; + + var wasMultiselect = cm.isInMultiSelectMode(); + if (vim.wasInVisualBlock && !wasMultiselect) { + vim.wasInVisualBlock = false; + } else if (wasMultiselect && vim.visualBlock) { + vim.wasInVisualBlock = true; + } + + if (key == '' && !vim.insertMode && !vim.visualMode && wasMultiselect && vim.status == "") { + // allow editor to exit multiselect + clearInputState(cm); + } else if (visualBlock || !wasMultiselect || cm.inVirtualSelectionMode) { + isHandled = vimApi.handleKey(cm, key, origin); + } else { + var old = cloneVimState(vim); + + cm.operation(function() { + cm.curOp.isVimOp = true; + cm.forEachSelection(function() { + var head = cm.getCursor("head"); + var anchor = cm.getCursor("anchor"); + var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0; + var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0; + head = offsetCursor(head, 0, headOffset); + anchor = offsetCursor(anchor, 0, anchorOffset); + cm.state.vim.sel.head = head; + cm.state.vim.sel.anchor = anchor; + + isHandled = vimApi.handleKey(cm, key, origin); + if (cm.virtualSelection) { + cm.state.vim = cloneVimState(old); + } + }); + if (cm.curOp.cursorActivity && !isHandled) + cm.curOp.cursorActivity = false; + cm.state.vim = vim; + }, true); + } + // some commands may bring visualMode and selection out of sync + if (isHandled && !vim.visualMode && !vim.insert && vim.visualMode != cm.somethingSelected()) { + handleExternalSelection(cm, vim); + } + return isHandled; + } resetVimGlobalState(); - return vimApi; - }; - // Initialize Vim and make it available as an API. - CodeMirror.Vim = Vim(); -}); + + return vimApi; +} + +function initVim(CodeMirror5) { + CodeMirror5.Vim = initVim$1(CodeMirror5); + return CodeMirror5.Vim; +} + + + + CodeMirror.Vim = initVim(CodeMirror); + }); + \ No newline at end of file diff --git a/libraries/codemirror/mode/apl/apl.js b/libraries/codemirror/mode/apl/apl.js index b1955f6c9..667aa792e 100644 --- a/libraries/codemirror/mode/apl/apl.js +++ b/libraries/codemirror/mode/apl/apl.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/asciiarmor/asciiarmor.js b/libraries/codemirror/mode/asciiarmor/asciiarmor.js index f560f4242..a8ef077c3 100644 --- a/libraries/codemirror/mode/asciiarmor/asciiarmor.js +++ b/libraries/codemirror/mode/asciiarmor/asciiarmor.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/asn.1/asn.1.js b/libraries/codemirror/mode/asn.1/asn.1.js index df1330b68..ab63acc2f 100644 --- a/libraries/codemirror/mode/asn.1/asn.1.js +++ b/libraries/codemirror/mode/asn.1/asn.1.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/asterisk/asterisk.js b/libraries/codemirror/mode/asterisk/asterisk.js index 49a727019..16b982787 100644 --- a/libraries/codemirror/mode/asterisk/asterisk.js +++ b/libraries/codemirror/mode/asterisk/asterisk.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE /* * ===================================================================================== diff --git a/libraries/codemirror/mode/brainfuck/brainfuck.js b/libraries/codemirror/mode/brainfuck/brainfuck.js index af6d889ae..b5a30f811 100644 --- a/libraries/codemirror/mode/brainfuck/brainfuck.js +++ b/libraries/codemirror/mode/brainfuck/brainfuck.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE // Brainfuck mode created by Michael Kaminsky https://github.com/mkaminsky11 diff --git a/libraries/codemirror/mode/clike/clike.js b/libraries/codemirror/mode/clike/clike.js index 05b8f77f1..748909efe 100644 --- a/libraries/codemirror/mode/clike/clike.js +++ b/libraries/codemirror/mode/clike/clike.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -484,7 +484,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { "instanceof interface native new package private protected public " + "return static strictfp super switch synchronized this throw throws transient " + "try volatile while @interface"), - types: words("byte short int long float double boolean char void Boolean Byte Character Double Float " + + types: words("var byte short int long float double boolean char void Boolean Byte Character Double Float " + "Integer Long Number Object Short String StringBuffer StringBuilder Void"), blockKeywords: words("catch class do else finally for if switch try while"), defKeywords: words("class interface enum @interface"), @@ -498,6 +498,11 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { stream.eatWhile(/[\w\$_]/); return "meta"; + }, + '"': function(stream, state) { + if (!stream.match(/""$/)) return false; + state.tokenize = tokenTripleString; + return state.tokenize(stream, state); } }, modeProps: {fold: ["brace", "import"]} @@ -659,7 +664,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { "file import where by get set abstract enum open inner override private public internal " + "protected catch finally out final vararg reified dynamic companion constructor init " + "sealed field property receiver param sparam lateinit data inline noinline tailrec " + - "external annotation crossinline const operator infix suspend actual expect setparam" + "external annotation crossinline const operator infix suspend actual expect setparam value" ), types: words( /* package java.lang */ diff --git a/libraries/codemirror/mode/clojure/clojure.js b/libraries/codemirror/mode/clojure/clojure.js index 0b9d6acc3..330516580 100644 --- a/libraries/codemirror/mode/clojure/clojure.js +++ b/libraries/codemirror/mode/clojure/clojure.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports === "object" && typeof module === "object") // CommonJS diff --git a/libraries/codemirror/mode/cmake/cmake.js b/libraries/codemirror/mode/cmake/cmake.js index 496c71d1f..f08c7d78b 100644 --- a/libraries/codemirror/mode/cmake/cmake.js +++ b/libraries/codemirror/mode/cmake/cmake.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") diff --git a/libraries/codemirror/mode/cobol/cobol.js b/libraries/codemirror/mode/cobol/cobol.js index 275857b4b..3e735f08c 100644 --- a/libraries/codemirror/mode/cobol/cobol.js +++ b/libraries/codemirror/mode/cobol/cobol.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE /** * Author: Gautam Mehta @@ -195,7 +195,7 @@ CodeMirror.defineMode("cobol", function () { case "string": // multi-line string parsing mode var next = false; while ((next = stream.next()) != null) { - if (next == "\"" || next == "\'") { + if ((next == "\"" || next == "\'") && !stream.match(/['"]/, false)) { state.mode = false; break; } diff --git a/libraries/codemirror/mode/coffeescript/coffeescript.js b/libraries/codemirror/mode/coffeescript/coffeescript.js index a54e9d5ed..56098726e 100644 --- a/libraries/codemirror/mode/coffeescript/coffeescript.js +++ b/libraries/codemirror/mode/coffeescript/coffeescript.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE /** * Link to the project's GitHub page: diff --git a/libraries/codemirror/mode/commonlisp/commonlisp.js b/libraries/codemirror/mode/commonlisp/commonlisp.js index 52abbb25c..c60ff6d6f 100644 --- a/libraries/codemirror/mode/commonlisp/commonlisp.js +++ b/libraries/codemirror/mode/commonlisp/commonlisp.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -114,6 +114,7 @@ CodeMirror.defineMode("commonlisp", function (config) { closeBrackets: {pairs: "()[]{}\"\""}, lineComment: ";;", + fold: "brace-paren", blockCommentStart: "#|", blockCommentEnd: "|#" }; diff --git a/libraries/codemirror/mode/crystal/crystal.js b/libraries/codemirror/mode/crystal/crystal.js index 14dea98e2..73b0dbe13 100644 --- a/libraries/codemirror/mode/crystal/crystal.js +++ b/libraries/codemirror/mode/crystal/crystal.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -164,10 +164,10 @@ } else { if(delim = stream.match(/^%([^\w\s=])/)) { delim = delim[1]; - } else if (stream.match(/^%[a-zA-Z0-9_\u009F-\uFFFF]*/)) { + } else if (stream.match(/^%[a-zA-Z_\u009F-\uFFFF][\w\u009F-\uFFFF]*/)) { // Macro variables return "meta"; - } else { + } else if (stream.eat('%')) { // '%' operator return "operator"; } diff --git a/libraries/codemirror/mode/css/css.js b/libraries/codemirror/mode/css/css.js index 88a869bfe..b0721b419 100644 --- a/libraries/codemirror/mode/css/css.js +++ b/libraries/codemirror/mode/css/css.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -228,7 +228,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { if (type == "}" || type == "{") return popAndPass(type, stream, state); if (type == "(") return pushContext(state, stream, "parens"); - if (type == "hash" && !/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(stream.current())) { + if (type == "hash" && !/^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(stream.current())) { override += " error"; } else if (type == "word") { wordAsValue(stream); @@ -443,13 +443,15 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "monochrome", "min-monochrome", "max-monochrome", "resolution", "min-resolution", "max-resolution", "scan", "grid", "orientation", "device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio", - "pointer", "any-pointer", "hover", "any-hover", "prefers-color-scheme" + "pointer", "any-pointer", "hover", "any-hover", "prefers-color-scheme", + "dynamic-range", "video-dynamic-range" ], mediaFeatures = keySet(mediaFeatures_); var mediaValueKeywords_ = [ "landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover", "interlace", "progressive", - "dark", "light" + "dark", "light", + "standard", "high" ], mediaValueKeywords = keySet(mediaValueKeywords_); var propertyKeywords_ = [ @@ -482,7 +484,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "cue-before", "cursor", "direction", "display", "dominant-baseline", "drop-initial-after-adjust", "drop-initial-after-align", "drop-initial-before-adjust", "drop-initial-before-align", "drop-initial-size", - "drop-initial-value", "elevation", "empty-cells", "fit", "fit-position", + "drop-initial-value", "elevation", "empty-cells", "fit", "fit-content", "fit-position", "flex", "flex-basis", "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap", "float", "float-offset", "flow-from", "flow-into", "font", "font-family", "font-feature-settings", "font-kerning", @@ -564,7 +566,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { ], propertyKeywords = keySet(propertyKeywords_); var nonStandardPropertyKeywords_ = [ - "border-block", "border-block-color", "border-block-end", + "accent-color", "aspect-ratio", "border-block", "border-block-color", "border-block-end", "border-block-end-color", "border-block-end-style", "border-block-end-width", "border-block-start", "border-block-start-color", "border-block-start-style", "border-block-start-width", "border-block-style", "border-block-width", @@ -572,9 +574,9 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "border-inline-end-color", "border-inline-end-style", "border-inline-end-width", "border-inline-start", "border-inline-start-color", "border-inline-start-style", "border-inline-start-width", - "border-inline-style", "border-inline-width", "margin-block", + "border-inline-style", "border-inline-width", "content-visibility", "margin-block", "margin-block-end", "margin-block-start", "margin-inline", "margin-inline-end", - "margin-inline-start", "padding-block", "padding-block-end", + "margin-inline-start", "overflow-anchor", "overscroll-behavior", "padding-block", "padding-block-end", "padding-block-start", "padding-inline", "padding-inline-end", "padding-inline-start", "scroll-snap-stop", "scrollbar-3d-light-color", "scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color", @@ -598,16 +600,16 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", - "darkgray", "darkgreen", "darkkhaki", "darkmagenta", "darkolivegreen", + "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", - "darkslateblue", "darkslategray", "darkturquoise", "darkviolet", - "deeppink", "deepskyblue", "dimgray", "dodgerblue", "firebrick", + "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", + "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", - "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightpink", - "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", + "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", + "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", @@ -617,7 +619,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", - "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", + "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen" ], colorKeywords = keySet(colorKeywords_); @@ -628,21 +630,21 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "always", "amharic", "amharic-abegede", "antialiased", "appworkspace", "arabic-indic", "armenian", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page", "avoid-region", "axis-pan", "background", "backwards", "baseline", "below", "bidi-override", "binary", - "bengali", "blink", "block", "block-axis", "bold", "bolder", "border", "border-box", - "both", "bottom", "break", "break-all", "break-word", "bullets", "button", "button-bevel", + "bengali", "blink", "block", "block-axis", "blur", "bold", "bolder", "border", "border-box", + "both", "bottom", "break", "break-all", "break-word", "brightness", "bullets", "button", "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian", "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret", "cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch", "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote", "col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse", - "compact", "condensed", "contain", "content", "contents", - "content-box", "context-menu", "continuous", "copy", "counter", "counters", "cover", "crop", - "cross", "crosshair", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal", + "compact", "condensed", "conic-gradient", "contain", "content", "contents", + "content-box", "context-menu", "continuous", "contrast", "copy", "counter", "counters", "cover", "crop", + "cross", "crosshair", "cubic-bezier", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal", "decimal-leading-zero", "default", "default-button", "dense", "destination-atop", "destination-in", "destination-out", "destination-over", "devanagari", "difference", "disc", "discard", "disclosure-closed", "disclosure-open", "document", "dot-dash", "dot-dot-dash", - "dotted", "double", "down", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", + "dotted", "double", "down", "drop-shadow", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out", "element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede", "ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er", "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er", @@ -652,10 +654,10 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig", "ethiopic-numeric", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed", "extra-expanded", "fantasy", "fast", "fill", "fill-box", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes", - "forwards", "from", "geometricPrecision", "georgian", "graytext", "grid", "groove", + "forwards", "from", "geometricPrecision", "georgian", "grayscale", "graytext", "grid", "groove", "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew", "help", "hidden", "hide", "higher", "highlight", "highlighttext", - "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "icon", "ignore", + "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "hue-rotate", "icon", "ignore", "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite", "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis", "inline-block", "inline-flex", "inline-grid", "inline-table", "inset", "inside", "intrinsic", "invert", @@ -667,14 +669,10 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian", "lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian", "lower-roman", "lowercase", "ltr", "luminosity", "malayalam", "manipulation", "match", "matrix", "matrix3d", - "media-controls-background", "media-current-time-display", - "media-fullscreen-button", "media-mute-button", "media-play-button", - "media-return-to-realtime-button", "media-rewind-button", - "media-seek-back-button", "media-seek-forward-button", "media-slider", - "media-sliderthumb", "media-time-remaining-display", "media-volume-slider", - "media-volume-slider-container", "media-volume-sliderthumb", "medium", - "menu", "menulist", "menulist-button", "menulist-text", - "menulist-textfield", "menutext", "message-box", "middle", "min-intrinsic", + "media-play-button", "media-slider", "media-sliderthumb", + "media-volume-slider", "media-volume-sliderthumb", "medium", + "menu", "menulist", "menulist-button", + "menutext", "message-box", "middle", "min-intrinsic", "mix", "mongolian", "monospace", "move", "multiple", "multiple_mask_images", "multiply", "myanmar", "n-resize", "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop", "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap", @@ -685,15 +683,15 @@ CodeMirror.defineMode("css", function(config, parserConfig) { "pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d", "progress", "push-button", "radial-gradient", "radio", "read-only", "read-write", "read-write-plaintext-only", "rectangle", "region", - "relative", "repeat", "repeating-linear-gradient", - "repeating-radial-gradient", "repeat-x", "repeat-y", "reset", "reverse", + "relative", "repeat", "repeating-linear-gradient", "repeating-radial-gradient", + "repeating-conic-gradient", "repeat-x", "repeat-y", "reset", "reverse", "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY", "rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running", - "s-resize", "sans-serif", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen", + "s-resize", "sans-serif", "saturate", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen", "scroll", "scrollbar", "scroll-position", "se-resize", "searchfield", "searchfield-cancel-button", "searchfield-decoration", "searchfield-results-button", "searchfield-results-decoration", "self-start", "self-end", - "semi-condensed", "semi-expanded", "separate", "serif", "show", "sidama", + "semi-condensed", "semi-expanded", "separate", "sepia", "serif", "show", "sidama", "simp-chinese-formal", "simp-chinese-informal", "single", "skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal", "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow", diff --git a/libraries/codemirror/mode/cypher/cypher.js b/libraries/codemirror/mode/cypher/cypher.js index 6d88fa0ed..df8cf4339 100644 --- a/libraries/codemirror/mode/cypher/cypher.js +++ b/libraries/codemirror/mode/cypher/cypher.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE // By the Neo4j Team and contributors. // https://github.com/neo4j-contrib/CodeMirror @@ -19,6 +19,7 @@ CodeMirror.defineMode("cypher", function(config) { var tokenBase = function(stream/*, state*/) { + curPunc = null var ch = stream.next(); if (ch ==='"') { stream.match(/^[^"]*"/); diff --git a/libraries/codemirror/mode/d/d.js b/libraries/codemirror/mode/d/d.js index efab57063..29b8995dc 100644 --- a/libraries/codemirror/mode/d/d.js +++ b/libraries/codemirror/mode/d/d.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/dart/dart.js b/libraries/codemirror/mode/dart/dart.js index fe64517a5..340076712 100644 --- a/libraries/codemirror/mode/dart/dart.js +++ b/libraries/codemirror/mode/dart/dart.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/diff/diff.js b/libraries/codemirror/mode/diff/diff.js index a30fd37a5..21631bf3e 100644 --- a/libraries/codemirror/mode/diff/diff.js +++ b/libraries/codemirror/mode/diff/diff.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/django/django.js b/libraries/codemirror/mode/django/django.js index 07be12398..aca331933 100644 --- a/libraries/codemirror/mode/django/django.js +++ b/libraries/codemirror/mode/django/django.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/dockerfile/dockerfile.js b/libraries/codemirror/mode/dockerfile/dockerfile.js index 983170f51..41d90853a 100644 --- a/libraries/codemirror/mode/dockerfile/dockerfile.js +++ b/libraries/codemirror/mode/dockerfile/dockerfile.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/dtd/dtd.js b/libraries/codemirror/mode/dtd/dtd.js index 1bff91cba..08f65ed68 100644 --- a/libraries/codemirror/mode/dtd/dtd.js +++ b/libraries/codemirror/mode/dtd/dtd.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE /* DTD mode diff --git a/libraries/codemirror/mode/dylan/dylan.js b/libraries/codemirror/mode/dylan/dylan.js index 6725edccc..fd45659b1 100644 --- a/libraries/codemirror/mode/dylan/dylan.js +++ b/libraries/codemirror/mode/dylan/dylan.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/ebnf/ebnf.js b/libraries/codemirror/mode/ebnf/ebnf.js index d8fb3f3a2..ecd6bc793 100644 --- a/libraries/codemirror/mode/ebnf/ebnf.js +++ b/libraries/codemirror/mode/ebnf/ebnf.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/ecl/ecl.js b/libraries/codemirror/mode/ecl/ecl.js index 9af8aee18..66de133a0 100644 --- a/libraries/codemirror/mode/ecl/ecl.js +++ b/libraries/codemirror/mode/ecl/ecl.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/eiffel/eiffel.js b/libraries/codemirror/mode/eiffel/eiffel.js index f6f3f458b..d6fd23c3f 100644 --- a/libraries/codemirror/mode/eiffel/eiffel.js +++ b/libraries/codemirror/mode/eiffel/eiffel.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/elm/elm.js b/libraries/codemirror/mode/elm/elm.js index 6ce940fe8..e41dfb06d 100644 --- a/libraries/codemirror/mode/elm/elm.js +++ b/libraries/codemirror/mode/elm/elm.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: http://codemirror.net/LICENSE +// Distributed under an MIT license: http://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -230,6 +230,8 @@ startState: function () { return { f: normal() }; }, copyState: function (s) { return { f: s.f }; }, + lineComment: '--', + token: function(stream, state) { var type = state.f(stream, function(s) { state.f = s; }); var word = stream.current(); diff --git a/libraries/codemirror/mode/erlang/erlang.js b/libraries/codemirror/mode/erlang/erlang.js index d827296f3..914276d4a 100644 --- a/libraries/codemirror/mode/erlang/erlang.js +++ b/libraries/codemirror/mode/erlang/erlang.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE /*jshint unused:true, eqnull:true, curly:true, bitwise:true */ /*jshint undef:true, latedef:true, trailing:true */ diff --git a/libraries/codemirror/mode/factor/factor.js b/libraries/codemirror/mode/factor/factor.js index 4c876d4d2..5111447ef 100644 --- a/libraries/codemirror/mode/factor/factor.js +++ b/libraries/codemirror/mode/factor/factor.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE // Factor syntax highlight - simple mode // @@ -77,7 +77,7 @@ // specific to simple modes. meta: { dontIndentStates: ["start", "vocabulary", "string", "string3", "stack"], - lineComment: [ "!", "#!" ] + lineComment: "!" } }); diff --git a/libraries/codemirror/mode/fcl/fcl.js b/libraries/codemirror/mode/fcl/fcl.js index 2d3f2001d..07f3ef1b2 100644 --- a/libraries/codemirror/mode/fcl/fcl.js +++ b/libraries/codemirror/mode/fcl/fcl.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/forth/forth.js b/libraries/codemirror/mode/forth/forth.js index f2caa27af..36959ae40 100644 --- a/libraries/codemirror/mode/forth/forth.js +++ b/libraries/codemirror/mode/forth/forth.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE // Author: Aliaksei Chapyzhenka diff --git a/libraries/codemirror/mode/fortran/fortran.js b/libraries/codemirror/mode/fortran/fortran.js index 85bacc42c..1ca5b7bec 100644 --- a/libraries/codemirror/mode/fortran/fortran.js +++ b/libraries/codemirror/mode/fortran/fortran.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -112,7 +112,7 @@ CodeMirror.defineMode("fortran", function() { "c_short", "c_signed_char", "c_size_t", "character", "complex", "double", "integer", "logical", "real"]); var isOperatorChar = /[+\-*&=<>\/\:]/; - var litOperator = new RegExp("(\.and\.|\.or\.|\.eq\.|\.lt\.|\.le\.|\.gt\.|\.ge\.|\.ne\.|\.not\.|\.eqv\.|\.neqv\.)", "i"); + var litOperator = /^\.(and|or|eq|lt|le|gt|ge|ne|not|eqv|neqv)\./i; function tokenBase(stream, state) { diff --git a/libraries/codemirror/mode/gas/gas.js b/libraries/codemirror/mode/gas/gas.js index b3515abe7..db09a8af0 100644 --- a/libraries/codemirror/mode/gas/gas.js +++ b/libraries/codemirror/mode/gas/gas.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -144,18 +144,26 @@ CodeMirror.defineMode("gas", function(_config, parserConfig) { function x86(_parserConfig) { lineCommentStartSymbol = "#"; + registers.al = "variable"; + registers.ah = "variable"; registers.ax = "variable"; registers.eax = "variable-2"; registers.rax = "variable-3"; + registers.bl = "variable"; + registers.bh = "variable"; registers.bx = "variable"; registers.ebx = "variable-2"; registers.rbx = "variable-3"; + registers.cl = "variable"; + registers.ch = "variable"; registers.cx = "variable"; registers.ecx = "variable-2"; registers.rcx = "variable-3"; + registers.dl = "variable"; + registers.dh = "variable"; registers.dx = "variable"; registers.edx = "variable-2"; registers.rdx = "variable-3"; diff --git a/libraries/codemirror/mode/gfm/gfm.js b/libraries/codemirror/mode/gfm/gfm.js index 492c9487a..65288d757 100644 --- a/libraries/codemirror/mode/gfm/gfm.js +++ b/libraries/codemirror/mode/gfm/gfm.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/gherkin/gherkin.js b/libraries/codemirror/mode/gherkin/gherkin.js index 1b438b905..196543e50 100644 --- a/libraries/codemirror/mode/gherkin/gherkin.js +++ b/libraries/codemirror/mode/gherkin/gherkin.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE /* Gherkin mode - http://www.cukes.info/ diff --git a/libraries/codemirror/mode/go/go.js b/libraries/codemirror/mode/go/go.js index c005e42dd..8dbdc65d1 100644 --- a/libraries/codemirror/mode/go/go.js +++ b/libraries/codemirror/mode/go/go.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -24,7 +24,7 @@ CodeMirror.defineMode("go", function(config) { "float32":true, "float64":true, "int8":true, "int16":true, "int32":true, "int64":true, "string":true, "uint8":true, "uint16":true, "uint32":true, "uint64":true, "int":true, "uint":true, "uintptr":true, "error": true, - "rune":true + "rune":true, "any":true, "comparable":true }; var atoms = { diff --git a/libraries/codemirror/mode/groovy/groovy.js b/libraries/codemirror/mode/groovy/groovy.js index 2b90d01c4..89d0fe085 100644 --- a/libraries/codemirror/mode/groovy/groovy.js +++ b/libraries/codemirror/mode/groovy/groovy.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -91,9 +91,14 @@ CodeMirror.defineMode("groovy", function(config) { if (!tripleQuoted) { break; } if (stream.match(quote + quote)) { end = true; break; } } - if (quote == '"' && next == "$" && !escaped && stream.eat("{")) { - state.tokenize.push(tokenBaseUntilBrace()); - return "string"; + if (quote == '"' && next == "$" && !escaped) { + if (stream.eat("{")) { + state.tokenize.push(tokenBaseUntilBrace()); + return "string"; + } else if (stream.match(/^\w/, false)) { + state.tokenize.push(tokenVariableDeref); + return "string"; + } } escaped = !escaped && next == "\\"; } @@ -122,6 +127,15 @@ CodeMirror.defineMode("groovy", function(config) { return t; } + function tokenVariableDeref(stream, state) { + var next = stream.match(/^(\.|[\w\$_]+)/) + if (!next) { + state.tokenize.pop() + return state.tokenize[state.tokenize.length-1](stream, state) + } + return next[0] == "." ? null : "variable" + } + function tokenComment(stream, state) { var maybeEnd = false, ch; while (ch = stream.next()) { diff --git a/libraries/codemirror/mode/haml/haml.js b/libraries/codemirror/mode/haml/haml.js index d941d9743..5e5091fe4 100644 --- a/libraries/codemirror/mode/haml/haml.js +++ b/libraries/codemirror/mode/haml/haml.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/handlebars/handlebars.js b/libraries/codemirror/mode/handlebars/handlebars.js index 359871a20..d38c0ebcb 100644 --- a/libraries/codemirror/mode/handlebars/handlebars.js +++ b/libraries/codemirror/mode/handlebars/handlebars.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/haskell-literate/haskell-literate.js b/libraries/codemirror/mode/haskell-literate/haskell-literate.js index 4bb926849..751fda424 100644 --- a/libraries/codemirror/mode/haskell-literate/haskell-literate.js +++ b/libraries/codemirror/mode/haskell-literate/haskell-literate.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function (mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/haskell/haskell.js b/libraries/codemirror/mode/haskell/haskell.js index 2e882dc60..26bf6124e 100644 --- a/libraries/codemirror/mode/haskell/haskell.js +++ b/libraries/codemirror/mode/haskell/haskell.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/haxe/haxe.js b/libraries/codemirror/mode/haxe/haxe.js index 45376852a..c32d3df3c 100644 --- a/libraries/codemirror/mode/haxe/haxe.js +++ b/libraries/codemirror/mode/haxe/haxe.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/htmlembedded/htmlembedded.js b/libraries/codemirror/mode/htmlembedded/htmlembedded.js index 439e63a42..5cceeef48 100644 --- a/libraries/codemirror/mode/htmlembedded/htmlembedded.js +++ b/libraries/codemirror/mode/htmlembedded/htmlembedded.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/htmlmixed/htmlmixed.js b/libraries/codemirror/mode/htmlmixed/htmlmixed.js index 66a158274..3f6d8b7d7 100644 --- a/libraries/codemirror/mode/htmlmixed/htmlmixed.js +++ b/libraries/codemirror/mode/htmlmixed/htmlmixed.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -50,7 +50,7 @@ } function getTagRegexp(tagName, anchored) { - return new RegExp((anchored ? "^" : "") + "<\/\s*" + tagName + "\s*>", "i"); + return new RegExp((anchored ? "^" : "") + "<\/\\s*" + tagName + "\\s*>", "i"); } function addTags(from, to) { diff --git a/libraries/codemirror/mode/http/http.js b/libraries/codemirror/mode/http/http.js index 092353259..aaa138f47 100644 --- a/libraries/codemirror/mode/http/http.js +++ b/libraries/codemirror/mode/http/http.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/idl/idl.js b/libraries/codemirror/mode/idl/idl.js index 37302bb90..7b57672d4 100644 --- a/libraries/codemirror/mode/idl/idl.js +++ b/libraries/codemirror/mode/idl/idl.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/javascript/javascript.js b/libraries/codemirror/mode/javascript/javascript.js index a42f23d07..48a46d65d 100644 --- a/libraries/codemirror/mode/javascript/javascript.js +++ b/libraries/codemirror/mode/javascript/javascript.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -16,6 +16,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { var statementIndent = parserConfig.statementIndent; var jsonldMode = parserConfig.jsonld; var jsonMode = parserConfig.json || jsonldMode; + var trackScope = parserConfig.trackScope !== false var isTS = parserConfig.typescript; var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/; @@ -231,6 +232,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { } function inScope(state, varname) { + if (!trackScope) return false for (var v = state.localVars; v; v = v.next) if (v.name == varname) return true; for (var cx = state.context; cx; cx = cx.prev) { @@ -277,6 +279,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { function register(varname) { var state = cx.state; cx.marked = "def"; + if (!trackScope) return if (state.context) { if (state.lexical.info == "var" && state.context && state.context.block) { // FIXME function decls are also not block scoped @@ -327,6 +330,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { cx.state.context = new Context(cx.state.context, cx.state.localVars, true) cx.state.localVars = null } + pushcontext.lex = pushblockcontext.lex = true function popcontext() { cx.state.localVars = cx.state.context.vars cx.state.context = cx.state.context.prev @@ -376,7 +380,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse); } if (type == "function") return cont(functiondef); - if (type == "for") return cont(pushlex("form"), forspec, statement, poplex); + if (type == "for") return cont(pushlex("form"), pushblockcontext, forspec, statement, popcontext, poplex); if (type == "class" || (isTS && value == "interface")) { cx.marked = "keyword" return cont(pushlex("form", type == "class" ? type : value), className, poplex) @@ -479,7 +483,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { function quasi(type, value) { if (type != "quasi") return pass(); if (value.slice(value.length - 2) != "${") return cont(quasi); - return cont(expression, continueQuasi); + return cont(maybeexpression, continueQuasi); } function continueQuasi(type) { if (type == "}") { @@ -619,6 +623,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (type == "{") return cont(pushlex("}"), typeprops, poplex, afterType) if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType, afterType) if (type == "<") return cont(commasep(typeexpr, ">"), typeexpr) + if (type == "quasi") { return pass(quasiType, afterType); } } function maybeReturnType(type) { if (type == "=>") return cont(typeexpr) @@ -644,6 +649,18 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { return cont() } } + function quasiType(type, value) { + if (type != "quasi") return pass(); + if (value.slice(value.length - 2) != "${") return cont(quasiType); + return cont(typeexpr, continueQuasiType); + } + function continueQuasiType(type) { + if (type == "}") { + cx.marked = "string-2"; + cx.state.tokenize = tokenQuasi; + return cont(quasiType); + } + } function typearg(type, value) { if (type == "variable" && cx.stream.match(/^\s*[?:]/, false) || value == "?") return cont(typearg) if (type == ":") return cont(typeexpr) @@ -783,6 +800,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (value == "@") return cont(expression, classBody) } function classfield(type, value) { + if (value == "!") return cont(classfield) if (value == "?") return cont(classfield) if (type == ":") return cont(typeexpr, maybeAssign) if (value == "=") return cont(expressionNoComma) @@ -883,7 +901,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) { var c = state.cc[i]; if (c == poplex) lexical = lexical.prev; - else if (c != maybeelse) break; + else if (c != maybeelse && c != popcontext) break; } while ((lexical.type == "stat" || lexical.type == "form") && (firstChar == "}" || ((top = state.cc[state.cc.length - 1]) && @@ -920,8 +938,7 @@ CodeMirror.defineMode("javascript", function(config, parserConfig) { expressionAllowed: expressionAllowed, skipExpression: function(state) { - var top = state.cc[state.cc.length - 1] - if (top == expression || top == expressionNoComma) state.cc.pop() + parseJS(state, "atom", "atom", "true", new CodeMirror.StringStream("", 2, null)) } }; }); diff --git a/libraries/codemirror/mode/jinja2/jinja2.js b/libraries/codemirror/mode/jinja2/jinja2.js index 77c9b22ca..ec6f9903c 100644 --- a/libraries/codemirror/mode/jinja2/jinja2.js +++ b/libraries/codemirror/mode/jinja2/jinja2.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -13,18 +13,18 @@ CodeMirror.defineMode("jinja2", function() { var keywords = ["and", "as", "block", "endblock", "by", "cycle", "debug", "else", "elif", - "extends", "filter", "endfilter", "firstof", "for", + "extends", "filter", "endfilter", "firstof", "do", "for", "endfor", "if", "endif", "ifchanged", "endifchanged", - "ifequal", "endifequal", "ifnotequal", + "ifequal", "endifequal", "ifnotequal", "set", "raw", "endraw", "endifnotequal", "in", "include", "load", "not", "now", "or", - "parsed", "regroup", "reversed", "spaceless", - "endspaceless", "ssi", "templatetag", "openblock", - "closeblock", "openvariable", "closevariable", + "parsed", "regroup", "reversed", "spaceless", "call", "endcall", "macro", + "endmacro", "endspaceless", "ssi", "templatetag", "openblock", + "closeblock", "openvariable", "closevariable", "without", "context", "openbrace", "closebrace", "opencomment", "closecomment", "widthratio", "url", "with", "endwith", "get_current_language", "trans", "endtrans", "noop", "blocktrans", "endblocktrans", "get_available_languages", - "get_current_language_bidi", "plural"], + "get_current_language_bidi", "pluralize", "autoescape", "endautoescape"], operator = /^[+\-*&%=<>!?|~^]/, sign = /^[:\[\(\{]/, atom = ["true", "false"], @@ -78,7 +78,24 @@ state.instring = ch; stream.next(); return "string"; - } else if(stream.match(state.intag + "}") || stream.eat("-") && stream.match(state.intag + "}")) { + } + else if (state.inbraces > 0 && ch ==")") { + stream.next() + state.inbraces--; + } + else if (ch == "(") { + stream.next() + state.inbraces++; + } + else if (state.inbrackets > 0 && ch =="]") { + stream.next() + state.inbrackets--; + } + else if (ch == "[") { + stream.next() + state.inbrackets++; + } + else if (!state.lineTag && (stream.match(state.intag + "}") || stream.eat("-") && stream.match(state.intag + "}"))) { state.intag = false; return "tag"; } else if(stream.match(operator)) { @@ -87,6 +104,10 @@ } else if(stream.match(sign)) { state.sign = true; } else { + if (stream.column() == 1 && state.lineTag && stream.match(keywords)) { + //allow nospace after tag before the keyword + return "keyword"; + } if(stream.eat(" ") || stream.sol()) { if(stream.match(keywords)) { return "keyword"; @@ -120,25 +141,51 @@ } else if (ch = stream.eat(/\{|%/)) { //Cache close tag state.intag = ch; + state.inbraces = 0; + state.inbrackets = 0; if(ch == "{") { state.intag = "}"; } stream.eat("-"); return "tag"; } + //Line statements + } else if (stream.eat('#')) { + if (stream.peek() == '#') { + stream.skipToEnd(); + return "comment" + } + else if (!stream.eol()) { + state.intag = true; + state.lineTag = true; + state.inbraces = 0; + state.inbrackets = 0; + return "tag"; + } } stream.next(); }; return { startState: function () { - return {tokenize: tokenBase}; + return { + tokenize: tokenBase, + inbrackets:0, + inbraces:0 + }; }, - token: function (stream, state) { - return state.tokenize(stream, state); + token: function(stream, state) { + var style = state.tokenize(stream, state); + if (stream.eol() && state.lineTag && !state.instring && state.inbraces == 0 && state.inbrackets == 0) { + //Close line statement at the EOL + state.intag = false + state.lineTag = false + } + return style; }, blockCommentStart: "{#", - blockCommentEnd: "#}" + blockCommentEnd: "#}", + lineComment: "##", }; }); diff --git a/libraries/codemirror/mode/jsx/jsx.js b/libraries/codemirror/mode/jsx/jsx.js index 889d3fe5e..1406ef195 100644 --- a/libraries/codemirror/mode/jsx/jsx.js +++ b/libraries/codemirror/mode/jsx/jsx.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -104,9 +104,9 @@ function jsToken(stream, state, cx) { if (stream.peek() == "<" && jsMode.expressionAllowed(stream, cx.state)) { - jsMode.skipExpression(cx.state) state.context = new Context(CodeMirror.startState(xmlMode, jsMode.indent(cx.state, "", "")), xmlMode, 0, state.context) + jsMode.skipExpression(cx.state) return null } diff --git a/libraries/codemirror/mode/julia/julia.js b/libraries/codemirror/mode/julia/julia.js index de9f987d8..0b422849b 100644 --- a/libraries/codemirror/mode/julia/julia.js +++ b/libraries/codemirror/mode/julia/julia.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -12,9 +12,10 @@ "use strict"; CodeMirror.defineMode("julia", function(config, parserConf) { - function wordRegexp(words, end) { + function wordRegexp(words, end, pre) { + if (typeof pre === "undefined") { pre = ""; } if (typeof end === "undefined") { end = "\\b"; } - return new RegExp("^((" + words.join(")|(") + "))" + end); + return new RegExp("^" + pre + "((" + words.join(")|(") + "))" + end); } var octChar = "\\\\[0-7]{1,3}"; @@ -22,13 +23,18 @@ CodeMirror.defineMode("julia", function(config, parserConf) { var sChar = "\\\\[abefnrtv0%?'\"\\\\]"; var uChar = "([^\\u0027\\u005C\\uD800-\\uDFFF]|[\\uD800-\\uDFFF][\\uDC00-\\uDFFF])"; + var asciiOperatorsList = [ + "[<>]:", "[<>=]=", "<<=?", ">>>?=?", "=>", "--?>", "<--[->]?", "\\/\\/", + "\\.{2,3}", "[\\.\\\\%*+\\-<>!\\/^|&]=?", "\\?", "\\$", "~", ":" + ]; var operators = parserConf.operators || wordRegexp([ - "[<>]:", "[<>=]=", "<<=?", ">>>?=?", "=>", "->", "\\/\\/", - "[\\\\%*+\\-<>!=\\/^|&\\u00F7\\u22BB]=?", "\\?", "\\$", "~", ":", - "\\u00D7", "\\u2208", "\\u2209", "\\u220B", "\\u220C", "\\u2218", - "\\u221A", "\\u221B", "\\u2229", "\\u222A", "\\u2260", "\\u2264", - "\\u2265", "\\u2286", "\\u2288", "\\u228A", "\\u22C5", - "\\b(in|isa)\\b(?!\.?\\()"], ""); + "[<>]:", "[<>=]=", "[!=]==", "<<=?", ">>>?=?", "=>?", "--?>", "<--[->]?", "\\/\\/", + "[\\\\%*+\\-<>!\\/^|&\\u00F7\\u22BB]=?", "\\?", "\\$", "~", ":", + "\\u00D7", "\\u2208", "\\u2209", "\\u220B", "\\u220C", "\\u2218", + "\\u221A", "\\u221B", "\\u2229", "\\u222A", "\\u2260", "\\u2264", + "\\u2265", "\\u2286", "\\u2288", "\\u228A", "\\u22C5", + "\\b(in|isa)\\b(?!\.?\\()" + ], ""); var delimiters = parserConf.delimiters || /^[;,()[\]{}]/; var identifiers = parserConf.identifiers || /^[_A-Za-z\u00A1-\u2217\u2219-\uFFFF][\w\u00A1-\u2217\u2219-\uFFFF]*!*/; @@ -57,10 +63,13 @@ CodeMirror.defineMode("julia", function(config, parserConf) { var keywords = wordRegexp(keywordsList); var builtins = wordRegexp(builtinsList); - var macro = /^@[_A-Za-z][\w]*/; + var macro = /^@[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/; var symbol = /^:[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/; var stringPrefixes = /^(`|([_A-Za-z\u00A1-\uFFFF]*"("")?))/; + var macroOperators = wordRegexp(asciiOperatorsList, "", "@"); + var symbolOperators = wordRegexp(asciiOperatorsList, "", ":"); + function inArray(state) { return (state.nestedArrays > 0); } @@ -165,8 +174,7 @@ CodeMirror.defineMode("julia", function(config, parserConf) { } // Handle symbols - if (!leavingExpr && stream.match(symbol) || - stream.match(/:([<>]:|<<=?|>>>?=?|->|\/\/|\.{2,3}|[\.\\%*+\-<>!\/^|&]=?|[~\?\$])/)) { + if (!leavingExpr && (stream.match(symbol) || stream.match(symbolOperators))) { return "builtin"; } @@ -212,7 +220,7 @@ CodeMirror.defineMode("julia", function(config, parserConf) { return state.tokenize(stream, state); } - if (stream.match(macro)) { + if (stream.match(macro) || stream.match(macroOperators)) { return "meta"; } diff --git a/libraries/codemirror/mode/livescript/livescript.js b/libraries/codemirror/mode/livescript/livescript.js index 595e067d1..149b22303 100644 --- a/libraries/codemirror/mode/livescript/livescript.js +++ b/libraries/codemirror/mode/livescript/livescript.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE /** * Link to the project's GitHub page: diff --git a/libraries/codemirror/mode/lua/lua.js b/libraries/codemirror/mode/lua/lua.js index 2fad0180f..7d053524c 100644 --- a/libraries/codemirror/mode/lua/lua.js +++ b/libraries/codemirror/mode/lua/lua.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE // LUA mode. Ported to CodeMirror 2 from Franciszek Wawrzak's // CodeMirror 1 mode. diff --git a/libraries/codemirror/mode/markdown/markdown.js b/libraries/codemirror/mode/markdown/markdown.js index a9e272ea8..6eef54427 100644 --- a/libraries/codemirror/mode/markdown/markdown.js +++ b/libraries/codemirror/mode/markdown/markdown.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/mathematica/mathematica.js b/libraries/codemirror/mode/mathematica/mathematica.js index 72b349210..a8c5f78c0 100644 --- a/libraries/codemirror/mode/mathematica/mathematica.js +++ b/libraries/codemirror/mode/mathematica/mathematica.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE // Mathematica mode copyright (c) 2015 by Calin Barbat // Based on code by Patrick Scheibe (halirutan) diff --git a/libraries/codemirror/mode/mbox/mbox.js b/libraries/codemirror/mode/mbox/mbox.js index 640437ed6..d668f51ec 100644 --- a/libraries/codemirror/mode/mbox/mbox.js +++ b/libraries/codemirror/mode/mbox/mbox.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/meta.js b/libraries/codemirror/mode/meta.js index 45c6e7aa1..3fce2a24d 100644 --- a/libraries/codemirror/mode/meta.js +++ b/libraries/codemirror/mode/meta.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -19,7 +19,7 @@ {name: "Brainfuck", mime: "text/x-brainfuck", mode: "brainfuck", ext: ["b", "bf"]}, {name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h", "ino"]}, {name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], alias: ["cpp"]}, - {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy"]}, + {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy", "cbl"]}, {name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp", "cs"]}, {name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj", "cljc", "cljx"]}, {name: "ClojureScript", mime: "text/x-clojurescript", mode: "clojure", ext: ["cljs"]}, @@ -44,7 +44,7 @@ {name: "edn", mime: "application/edn", mode: "clojure", ext: ["edn"]}, {name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel", ext: ["e"]}, {name: "Elm", mime: "text/x-elm", mode: "elm", ext: ["elm"]}, - {name: "Embedded Javascript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]}, + {name: "Embedded JavaScript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]}, {name: "Embedded Ruby", mime: "application/x-erb", mode: "htmlembedded", ext: ["erb"]}, {name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]}, {name: "Esper", mime: "text/x-esper", mode: "sql"}, @@ -71,12 +71,12 @@ {name: "Java", mime: "text/x-java", mode: "clike", ext: ["java"]}, {name: "Java Server Pages", mime: "application/x-jsp", mode: "htmlembedded", ext: ["jsp"], alias: ["jsp"]}, {name: "JavaScript", mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript", "application/javascript;env=frontend", "application/javascript;env=backend"], - mode: "javascript", ext: ["js"], alias: ["ecmascript", "js", "node"]}, + mode: "javascript", ext: ["js"], alias: ["ecmascript", "js", "node"]}, {name: "JSON", mimes: ["application/json", "application/x-json"], mode: "javascript", ext: ["json", "map"], alias: ["json5"]}, {name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]}, {name: "JSX", mime: "text/jsx", mode: "jsx", ext: ["jsx"]}, {name: "Jinja2", mime: "text/jinja2", mode: "jinja2", ext: ["j2", "jinja", "jinja2"]}, - {name: "Julia", mime: "text/x-julia", mode: "julia", ext: ["jl"]}, + {name: "Julia", mime: "text/x-julia", mode: "julia", ext: ["jl"], alias: ["jl"]}, {name: "Kotlin", mime: "text/x-kotlin", mode: "clike", ext: ["kt"]}, {name: "LESS", mime: "text/x-less", mode: "css", ext: ["less"]}, {name: "LiveScript", mime: "text/x-livescript", mode: "livescript", ext: ["ls"], alias: ["ls"]}, diff --git a/libraries/codemirror/mode/mirc/mirc.js b/libraries/codemirror/mode/mirc/mirc.js index d27b0152e..c6208081d 100644 --- a/libraries/codemirror/mode/mirc/mirc.js +++ b/libraries/codemirror/mode/mirc/mirc.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE //mIRC mode by Ford_Lawnmower :: Based on Velocity mode by Steve O'Hara diff --git a/libraries/codemirror/mode/mllike/mllike.js b/libraries/codemirror/mode/mllike/mllike.js index a1538f720..a21a55578 100644 --- a/libraries/codemirror/mode/mllike/mllike.js +++ b/libraries/codemirror/mode/mllike/mllike.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -60,7 +60,7 @@ CodeMirror.defineMode('mllike', function(_config, parserConfig) { } } if (ch === '(') { - if (stream.eat('*')) { + if (stream.match(/^\*(?!\))/)) { state.commentLevel++; state.tokenize = tokenComment; return state.tokenize(stream, state); diff --git a/libraries/codemirror/mode/modelica/modelica.js b/libraries/codemirror/mode/modelica/modelica.js index 2e9622f03..57133b252 100644 --- a/libraries/codemirror/mode/modelica/modelica.js +++ b/libraries/codemirror/mode/modelica/modelica.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE // Modelica support for CodeMirror, copyright (c) by Lennart Ochel diff --git a/libraries/codemirror/mode/mscgen/mscgen.js b/libraries/codemirror/mode/mscgen/mscgen.js index 8d39341cf..654ed965e 100644 --- a/libraries/codemirror/mode/mscgen/mscgen.js +++ b/libraries/codemirror/mode/mscgen/mscgen.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE // mode(s) for the sequence chart dsl's mscgen, xù and msgenny // For more information on mscgen, see the site of the original author: diff --git a/libraries/codemirror/mode/mumps/mumps.js b/libraries/codemirror/mode/mumps/mumps.js index c53b4bf3a..2f76a52ea 100644 --- a/libraries/codemirror/mode/mumps/mumps.js +++ b/libraries/codemirror/mode/mumps/mumps.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE /* This MUMPS Language script was constructed using vbscript.js as a template. diff --git a/libraries/codemirror/mode/nginx/nginx.js b/libraries/codemirror/mode/nginx/nginx.js index a09f1501f..b6c1d5fcd 100644 --- a/libraries/codemirror/mode/nginx/nginx.js +++ b/libraries/codemirror/mode/nginx/nginx.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/nsis/nsis.js b/libraries/codemirror/mode/nsis/nsis.js index 636940f50..2173916bb 100644 --- a/libraries/codemirror/mode/nsis/nsis.js +++ b/libraries/codemirror/mode/nsis/nsis.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE // Author: Jan T. Sott (http://github.com/idleberg) @@ -24,42 +24,42 @@ CodeMirror.defineSimpleMode("nsis",{ { regex: /`(?:[^\\`]|\\.)*`?/, token: "string" }, // Compile Time Commands - {regex: /^\s*(?:\!(include|addincludedir|addplugindir|appendfile|cd|delfile|echo|error|execute|packhdr|pragma|finalize|getdllversion|gettlbversion|system|tempfile|warning|verbose|define|undef|insertmacro|macro|macroend|makensis|searchparse|searchreplace))\b/, token: "keyword"}, + {regex: /^\s*(?:\!(addincludedir|addplugindir|appendfile|cd|define|delfile|echo|error|execute|finalize|getdllversion|gettlbversion|include|insertmacro|macro|macroend|makensis|packhdr|pragma|searchparse|searchreplace|system|tempfile|undef|uninstfinalize|verbose|warning))\b/i, token: "keyword"}, // Conditional Compilation - {regex: /^\s*(?:\!(if(?:n?def)?|ifmacron?def|macro))\b/, token: "keyword", indent: true}, - {regex: /^\s*(?:\!(else|endif|macroend))\b/, token: "keyword", dedent: true}, + {regex: /^\s*(?:\!(if(?:n?def)?|ifmacron?def|macro))\b/i, token: "keyword", indent: true}, + {regex: /^\s*(?:\!(else|endif|macroend))\b/i, token: "keyword", dedent: true}, // Runtime Commands - {regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetTempFileName|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/, token: "keyword"}, - {regex: /^\s*(?:Function|PageEx|Section(?:Group)?)\b/, token: "keyword", indent: true}, - {regex: /^\s*(?:(Function|PageEx|Section(?:Group)?)End)\b/, token: "keyword", dedent: true}, + {regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetTempFileName|GetWinVer|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Target|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/i, token: "keyword"}, + {regex: /^\s*(?:Function|PageEx|Section(?:Group)?)\b/i, token: "keyword", indent: true}, + {regex: /^\s*(?:(Function|PageEx|Section(?:Group)?)End)\b/i, token: "keyword", dedent: true}, // Command Options - {regex: /\b(?:ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HIDDEN|HKCC|HKCR(32|64)?|HKCU(32|64)?|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM(32|64)?|HKPD|HKU|IDABORT|IDCANCEL|IDD_DIR|IDD_INST|IDD_INSTFILES|IDD_LICENSE|IDD_SELCOM|IDD_UNINST|IDD_VERIFY|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|MB_YESNOCANCEL|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SW_HIDE|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWNORMAL|SYSTEM|TEMPORARY)\b/, token: "atom"}, - {regex: /\b(?:admin|all|auto|both|bottom|bzip2|components|current|custom|directory|false|force|hide|highest|ifdiff|ifnewer|instfiles|lastused|leave|left|license|listonly|lzma|nevershow|none|normal|notset|off|on|right|show|silent|silentlog|textonly|top|true|try|un\.components|un\.custom|un\.directory|un\.instfiles|un\.license|uninstConfirm|user|Win10|Win7|Win8|WinVista|zlib)\b/, token: "builtin"}, + {regex: /\b(?:ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HIDDEN|HKCC|HKCR(32|64)?|HKCU(32|64)?|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM(32|64)?|HKPD|HKU|IDABORT|IDCANCEL|IDD_DIR|IDD_INST|IDD_INSTFILES|IDD_LICENSE|IDD_SELCOM|IDD_UNINST|IDD_VERIFY|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|MB_YESNOCANCEL|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SW_HIDE|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWNORMAL|SYSTEM|TEMPORARY)\b/i, token: "atom"}, + {regex: /\b(?:admin|all|amd64-unicode|auto|both|bottom|bzip2|components|current|custom|directory|false|force|hide|highest|ifdiff|ifnewer|instfiles|lastused|leave|left|license|listonly|lzma|nevershow|none|normal|notset|off|on|right|show|silent|silentlog|textonly|top|true|try|un\.components|un\.custom|un\.directory|un\.instfiles|un\.license|uninstConfirm|user|Win10|Win7|Win8|WinVista|x-86-(ansi|unicode)|zlib)\b/i, token: "builtin"}, // LogicLib.nsh - {regex: /\$\{(?:And(?:If(?:Not)?|Unless)|Break|Case(?:Else)?|Continue|Default|Do(?:Until|While)?|Else(?:If(?:Not)?|Unless)?|End(?:If|Select|Switch)|Exit(?:Do|For|While)|For(?:Each)?|If(?:Cmd|Not(?:Then)?|Then)?|Loop(?:Until|While)?|Or(?:If(?:Not)?|Unless)|Select|Switch|Unless|While)\}/, token: "variable-2", indent: true}, + {regex: /\$\{(?:And(?:If(?:Not)?|Unless)|Break|Case(?:2|3|4|5|Else)?|Continue|Default|Do(?:Until|While)?|Else(?:If(?:Not)?|Unless)?|End(?:If|Select|Switch)|Exit(?:Do|For|While)|For(?:Each)?|If(?:Cmd|Not(?:Then)?|Then)?|Loop(?:Until|While)?|Or(?:If(?:Not)?|Unless)|Select|Switch|Unless|While)\}/i, token: "variable-2", indent: true}, // FileFunc.nsh - {regex: /\$\{(?:BannerTrimPath|DirState|DriveSpace|Get(BaseName|Drives|ExeName|ExePath|FileAttributes|FileExt|FileName|FileVersion|Options|OptionsS|Parameters|Parent|Root|Size|Time)|Locate|RefreshShellIcons)\}/, token: "variable-2", dedent: true}, + {regex: /\$\{(?:BannerTrimPath|DirState|DriveSpace|Get(BaseName|Drives|ExeName|ExePath|FileAttributes|FileExt|FileName|FileVersion|Options|OptionsS|Parameters|Parent|Root|Size|Time)|Locate|RefreshShellIcons)\}/i, token: "variable-2", dedent: true}, // Memento.nsh - {regex: /\$\{(?:Memento(?:Section(?:Done|End|Restore|Save)?|UnselectedSection))\}/, token: "variable-2", dedent: true}, + {regex: /\$\{(?:Memento(?:Section(?:Done|End|Restore|Save)?|UnselectedSection))\}/i, token: "variable-2", dedent: true}, // TextFunc.nsh - {regex: /\$\{(?:Config(?:Read|ReadS|Write|WriteS)|File(?:Join|ReadFromEnd|Recode)|Line(?:Find|Read|Sum)|Text(?:Compare|CompareS)|TrimNewLines)\}/, token: "variable-2", dedent: true}, + {regex: /\$\{(?:Config(?:Read|ReadS|Write|WriteS)|File(?:Join|ReadFromEnd|Recode)|Line(?:Find|Read|Sum)|Text(?:Compare|CompareS)|TrimNewLines)\}/i, token: "variable-2", dedent: true}, // WinVer.nsh - {regex: /\$\{(?:(?:At(?:Least|Most)|Is)(?:ServicePack|Win(?:7|8|10|95|98|200(?:0|3|8(?:R2)?)|ME|NT4|Vista|XP))|Is(?:NT|Server))\}/, token: "variable", dedent: true}, + {regex: /\$\{(?:(?:At(?:Least|Most)|Is)(?:ServicePack|Win(?:7|8|10|95|98|200(?:0|3|8(?:R2)?)|ME|NT4|Vista|XP))|Is(?:NT|Server))\}/i, token: "variable", dedent: true}, // WordFunc.nsh - {regex: /\$\{(?:StrFilterS?|Version(?:Compare|Convert)|Word(?:AddS?|Find(?:(?:2|3)X)?S?|InsertS?|ReplaceS?))\}/, token: "variable-2", dedent: true}, + {regex: /\$\{(?:StrFilterS?|Version(?:Compare|Convert)|Word(?:AddS?|Find(?:(?:2|3)X)?S?|InsertS?|ReplaceS?))\}/i, token: "variable-2", dedent: true}, // x64.nsh - {regex: /\$\{(?:RunningX64)\}/, token: "variable", dedent: true}, - {regex: /\$\{(?:Disable|Enable)X64FSRedirection\}/, token: "variable-2", dedent: true}, + {regex: /\$\{(?:RunningX64)\}/i, token: "variable", dedent: true}, + {regex: /\$\{(?:Disable|Enable)X64FSRedirection\}/i, token: "variable-2", dedent: true}, // Line Comment {regex: /(#|;).*/, token: "comment"}, @@ -71,20 +71,20 @@ CodeMirror.defineSimpleMode("nsis",{ {regex: /[-+\/*=<>!]+/, token: "operator"}, // Variable - {regex: /\$\w+/, token: "variable"}, + {regex: /\$\w[\w\.]*/, token: "variable"}, // Constant - {regex: /\${[\w\.:-]+}/, token: "variable-2"}, + {regex: /\${[\!\w\.:-]+}/, token: "variable-2"}, // Language String - {regex: /\$\([\w\.:-]+\)/, token: "variable-3"} + {regex: /\$\([\!\w\.:-]+\)/, token: "variable-3"} ], comment: [ {regex: /.*?\*\//, token: "comment", next: "start"}, {regex: /.*/, token: "comment"} ], meta: { - electricInput: /^\s*((Function|PageEx|Section|Section(Group)?)End|(\!(endif|macroend))|\$\{(End(If|Unless|While)|Loop(Until)|Next)\})$/, + electricInput: /^\s*((Function|PageEx|Section|Section(Group)?)End|(\!(endif|macroend))|\$\{(End(If|Unless|While)|Loop(Until)|Next)\})$/i, blockCommentStart: "/*", blockCommentEnd: "*/", lineComment: ["#", ";"] diff --git a/libraries/codemirror/mode/ntriples/ntriples.js b/libraries/codemirror/mode/ntriples/ntriples.js index 5dd027286..970238771 100644 --- a/libraries/codemirror/mode/ntriples/ntriples.js +++ b/libraries/codemirror/mode/ntriples/ntriples.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE /********************************************************** * This script provides syntax highlighting support for diff --git a/libraries/codemirror/mode/octave/octave.js b/libraries/codemirror/mode/octave/octave.js index 33a03368f..0ff1f4818 100644 --- a/libraries/codemirror/mode/octave/octave.js +++ b/libraries/codemirror/mode/octave/octave.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/oz/oz.js b/libraries/codemirror/mode/oz/oz.js index 73857e4c7..5d653f1a2 100644 --- a/libraries/codemirror/mode/oz/oz.js +++ b/libraries/codemirror/mode/oz/oz.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/pascal/pascal.js b/libraries/codemirror/mode/pascal/pascal.js index c48698bd7..062ea1189 100644 --- a/libraries/codemirror/mode/pascal/pascal.js +++ b/libraries/codemirror/mode/pascal/pascal.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/pegjs/pegjs.js b/libraries/codemirror/mode/pegjs/pegjs.js index ac011d3c8..c0ed2fcc0 100644 --- a/libraries/codemirror/mode/pegjs/pegjs.js +++ b/libraries/codemirror/mode/pegjs/pegjs.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/perl/perl.js b/libraries/codemirror/mode/perl/perl.js index ffe7877af..93fa73cce 100644 --- a/libraries/codemirror/mode/perl/perl.js +++ b/libraries/codemirror/mode/perl/perl.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE // CodeMirror2 mode/perl/perl.js (text/x-perl) beta 0.10 (2011-11-08) // This is a part of CodeMirror from https://github.com/sabaca/CodeMirror_mode_perl (mail@sabaca.com) @@ -513,9 +513,8 @@ CodeMirror.defineMode("perl",function(){ return null; if(state.chain) return tokenChain(stream,state,state.chain,state.style,state.tail); - if(stream.match(/^\-?[\d\.]/,false)) - if(stream.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/)) - return 'number'; + if(stream.match(/^(\-?((\d[\d_]*)?\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F_]+|0b[01_]+|\d[\d_]*(e[+-]?\d+)?)/)) + return 'number'; if(stream.match(/^<<(?=[_a-zA-Z])/)){ // NOTE: < 0 && stream.eol() && top(state).type == "py") { - if (state.scopes.length > 1) state.scopes.pop(); - state.dedent -= 1; - } + if (state.dedent && stream.eol() && top(state).type == "py" && state.scopes.length > 1) + state.scopes.pop(); return style; } @@ -370,14 +371,16 @@ if (state.tokenize != tokenBase) return state.tokenize.isString ? CodeMirror.Pass : 0; - var scope = top(state), closing = scope.type == textAfter.charAt(0) + var scope = top(state) + var closing = scope.type == textAfter.charAt(0) || + scope.type == "py" && !state.dedent && /^(else:|elif |except |finally:)/.test(textAfter) if (scope.align != null) return scope.align - (closing ? 1 : 0) else return scope.offset - (closing ? hangingIndent : 0) }, - electricInput: /^\s*[\}\]\)]$/, + electricInput: /^\s*([\}\]\)]|else:|elif |except |finally:)$/, closeBrackets: {triples: "'\""}, lineComment: "#", fold: "indent" diff --git a/libraries/codemirror/mode/q/q.js b/libraries/codemirror/mode/q/q.js index c016a6aa6..9b1a9d8ed 100644 --- a/libraries/codemirror/mode/q/q.js +++ b/libraries/codemirror/mode/q/q.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/r/r.js b/libraries/codemirror/mode/r/r.js index c422af9a4..f69f70632 100644 --- a/libraries/codemirror/mode/r/r.js +++ b/libraries/codemirror/mode/r/r.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -54,9 +54,9 @@ CodeMirror.defineMode("r", function(config) { } else if (ch == "`") { stream.match(/[^`]+`/); return "variable-3"; - } else if (ch == "." && stream.match(/.[.\d]+/)) { + } else if (ch == "." && stream.match(/.(?:[.]|\d+)/)) { return "keyword"; - } else if (/[\w\.]/.test(ch) && ch != "_") { + } else if (/[a-zA-Z\.]/.test(ch)) { stream.eatWhile(/[\w\.]/); var word = stream.current(); if (atoms.propertyIsEnumerable(word)) return "atom"; diff --git a/libraries/codemirror/mode/rpm/rpm.js b/libraries/codemirror/mode/rpm/rpm.js index bb9ec9ffa..ae990d339 100644 --- a/libraries/codemirror/mode/rpm/rpm.js +++ b/libraries/codemirror/mode/rpm/rpm.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/rst/rst.js b/libraries/codemirror/mode/rst/rst.js index f14eb270f..76fe0573b 100644 --- a/libraries/codemirror/mode/rst/rst.js +++ b/libraries/codemirror/mode/rst/rst.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/ruby/ruby.js b/libraries/codemirror/mode/ruby/ruby.js index 85bbfc657..b216c196c 100644 --- a/libraries/codemirror/mode/ruby/ruby.js +++ b/libraries/codemirror/mode/ruby/ruby.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -26,7 +26,7 @@ var keywordList = [ "require_relative", "extend", "autoload", "__END__", "__FILE__", "__LINE__", "__dir__" ], keywords = wordObj(keywordList); -var indentWords = wordObj(["def", "class", "case", "for", "while", "until", "module", "then", +var indentWords = wordObj(["def", "class", "case", "for", "while", "until", "module", "catch", "loop", "proc", "begin"]); var dedentWords = wordObj(["end", "until"]); var opening = {"[": "]", "{": "}", "(": ")"}; diff --git a/libraries/codemirror/mode/rust/rust.js b/libraries/codemirror/mode/rust/rust.js index f95f320d0..f702a5010 100644 --- a/libraries/codemirror/mode/rust/rust.js +++ b/libraries/codemirror/mode/rust/rust.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/sas/sas.js b/libraries/codemirror/mode/sas/sas.js index 49b96b66d..47260e037 100755 --- a/libraries/codemirror/mode/sas/sas.js +++ b/libraries/codemirror/mode/sas/sas.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE // SAS mode copyright (c) 2016 Jared Dean, SAS Institute diff --git a/libraries/codemirror/mode/sass/sass.js b/libraries/codemirror/mode/sass/sass.js index d8427bff5..3cfac0a41 100644 --- a/libraries/codemirror/mode/sass/sass.js +++ b/libraries/codemirror/mode/sass/sass.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/scheme/scheme.js b/libraries/codemirror/mode/scheme/scheme.js index 370250d85..598dd2846 100644 --- a/libraries/codemirror/mode/scheme/scheme.js +++ b/libraries/codemirror/mode/scheme/scheme.js @@ -1,8 +1,9 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE /** * Author: Koh Zi Han, based on implementation by Koh Zi Chun + * Improved by: Jakub T. Jankiewicz */ (function(mod) { @@ -17,7 +18,7 @@ CodeMirror.defineMode("scheme", function () { var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", - ATOM = "atom", NUMBER = "number", BRACKET = "bracket"; + SYMBOL = "symbol", ATOM = "atom", NUMBER = "number", BRACKET = "bracket"; var INDENT_WORD_SKIP = 2; function makeKeywords(str) { @@ -67,6 +68,18 @@ CodeMirror.defineMode("scheme", function () { return stream.match(hexMatcher); } + function processEscapedSequence(stream, options) { + var next, escaped = false; + while ((next = stream.next()) != null) { + if (next == options.token && !escaped) { + + options.state.mode = false; + break; + } + escaped = !escaped && next == "\\"; + } + } + return { startState: function () { return { @@ -92,17 +105,19 @@ CodeMirror.defineMode("scheme", function () { switch(state.mode){ case "string": // multi-line string parsing mode - var next, escaped = false; - while ((next = stream.next()) != null) { - if (next == "\"" && !escaped) { - - state.mode = false; - break; - } - escaped = !escaped && next == "\\"; - } + processEscapedSequence(stream, { + token: "\"", + state: state + }); returnType = STRING; // continue on in scheme-string mode break; + case "symbol": // escape symbol + processEscapedSequence(stream, { + token: "|", + state: state + }); + returnType = SYMBOL; // continue on in scheme-symbol mode + break; case "comment": // comment parsing mode var next, maybeEnd = false; while ((next = stream.next()) != null) { @@ -143,6 +158,9 @@ CodeMirror.defineMode("scheme", function () { stream.eatWhile(/[\w_\-!$%&*+\.\/:<=>?@\^~]/); returnType = ATOM; } + } else if (ch == '|') { + state.mode = "symbol"; + returnType = SYMBOL; } else if (ch == '#') { if (stream.eat("|")) { // Multi-line comment state.mode = "comment"; // toggle to comment mode @@ -255,6 +273,7 @@ CodeMirror.defineMode("scheme", function () { return state.indentStack.indent; }, + fold: "brace-paren", closeBrackets: {pairs: "()[]{}\"\""}, lineComment: ";;" }; diff --git a/libraries/codemirror/mode/shell/shell.js b/libraries/codemirror/mode/shell/shell.js index 8271485f5..9ae9118e0 100644 --- a/libraries/codemirror/mode/shell/shell.js +++ b/libraries/codemirror/mode/shell/shell.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/sieve/sieve.js b/libraries/codemirror/mode/sieve/sieve.js index b7236401a..d08fe47a4 100644 --- a/libraries/codemirror/mode/sieve/sieve.js +++ b/libraries/codemirror/mode/sieve/sieve.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/slim/slim.js b/libraries/codemirror/mode/slim/slim.js index b8ccb1381..6da9f97e5 100644 --- a/libraries/codemirror/mode/slim/slim.js +++ b/libraries/codemirror/mode/slim/slim.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE // Slim Highlighting for CodeMirror copyright (c) HicknHack Software Gmbh diff --git a/libraries/codemirror/mode/smalltalk/smalltalk.js b/libraries/codemirror/mode/smalltalk/smalltalk.js index 5039fe2d1..9e8ee938a 100644 --- a/libraries/codemirror/mode/smalltalk/smalltalk.js +++ b/libraries/codemirror/mode/smalltalk/smalltalk.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/smarty/smarty.js b/libraries/codemirror/mode/smarty/smarty.js index 57852feb0..4660b9bc8 100644 --- a/libraries/codemirror/mode/smarty/smarty.js +++ b/libraries/codemirror/mode/smarty/smarty.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE /** * Smarty 2 and 3 mode. diff --git a/libraries/codemirror/mode/solr/solr.js b/libraries/codemirror/mode/solr/solr.js index eda4a7a17..fe995637d 100644 --- a/libraries/codemirror/mode/solr/solr.js +++ b/libraries/codemirror/mode/solr/solr.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/soy/soy.js b/libraries/codemirror/mode/soy/soy.js index 1f8a13c47..3c3aea363 100644 --- a/libraries/codemirror/mode/soy/soy.js +++ b/libraries/codemirror/mode/soy/soy.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -24,6 +24,8 @@ "@inject?": paramData, "@state": paramData, "template": { soyState: "templ-def", variableScope: true}, + "extern": {soyState: "param-def"}, + "export": {soyState: "export"}, "literal": { }, "msg": {}, "fallbackmsg": { noEndTag: true, reduceIndent: true}, @@ -31,6 +33,8 @@ "plural": {}, "let": { soyState: "var-def" }, "if": {}, + "javaimpl": {}, + "jsimpl": {}, "elseif": { noEndTag: true, reduceIndent: true}, "else": { noEndTag: true, reduceIndent: true}, "switch": {}, @@ -46,6 +50,8 @@ "delcall": { soyState: "templ-ref" }, "log": {}, "element": { variableScope: true }, + "velog": {}, + "const": { soyState: "const-def"}, }; var indentingTags = Object.keys(tags).filter(function(tag) { @@ -134,10 +140,10 @@ state.context = new Context(state.context, "list-literal", state.variables); state.lookupVariables = false; return null; - } else if (stream.match(/map\b/)) { + } else if (stream.match(/\bmap(?=\()/)) { state.soyState.push("map-literal"); return "keyword"; - } else if (stream.match(/record\b/)) { + } else if (stream.match(/\brecord(?=\()/)) { state.soyState.push("record-literal"); return "keyword"; } else if (stream.match(/([\w]+)(?=\()/)) { @@ -448,11 +454,11 @@ state.indent -= 2 * config.indentUnit; return null; } - if (stream.match(/\w+(?=\s+as)/)) { + if (stream.match(/\w+(?=\s+as\b)/)) { return "variable"; } if (match = stream.match(/\w+/)) { - return /(from|as)/.test(match[0]) ? "keyword" : "def"; + return /\b(from|as)\b/.test(match[0]) ? "keyword" : "def"; } if (match = stream.match(/^["']/)) { state.soyState.push("string"); @@ -522,6 +528,27 @@ return this.token(stream, state); } return tokenUntil(stream, state, /\{\/literal}/); + case "export": + if (match = stream.match(/\w+/)) { + state.soyState.pop(); + if (match == "const") { + state.soyState.push("const-def") + return "keyword"; + } else if (match == "extern") { + state.soyState.push("param-def") + return "keyword"; + } + } else { + stream.next(); + } + return null; + case "const-def": + if (stream.match(/^\w+/)) { + state.soyState.pop(); + return "def"; + } + stream.next(); + return null; } if (stream.match('{literal}')) { @@ -552,7 +579,8 @@ state.context = new Context(state.context, state.tag, tag.variableScope ? state.variables : null); // Otherwise close the current context. } else if (endTag) { - if (!state.context || state.context.tag != tagName) { + var isBalancedForExtern = tagName == 'extern' && (state.context && state.context.tag == 'export'); + if (!state.context || ((state.context.tag != tagName) && !isBalancedForExtern)) { tagError = true; } else if (state.context) { if (state.context.kind) { @@ -577,7 +605,7 @@ state.indent += 2 * config.indentUnit; state.soyState.push("tag"); return "keyword"; - } else if (!state.context && stream.match(/\bimport\b/)) { + } else if (!state.context && stream.sol() && stream.match(/import\b/)) { state.soyState.push("import"); state.indent += 2 * config.indentUnit; return "keyword"; diff --git a/libraries/codemirror/mode/sparql/sparql.js b/libraries/codemirror/mode/sparql/sparql.js index 73997c667..5e68f5670 100644 --- a/libraries/codemirror/mode/sparql/sparql.js +++ b/libraries/codemirror/mode/sparql/sparql.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -31,7 +31,7 @@ CodeMirror.defineMode("sparql", function(config) { "graph", "by", "asc", "desc", "as", "having", "undef", "values", "group", "minus", "in", "not", "service", "silent", "using", "insert", "delete", "union", "true", "false", "with", - "data", "copy", "to", "move", "add", "create", "drop", "clear", "load"]); + "data", "copy", "to", "move", "add", "create", "drop", "clear", "load", "into"]); var operatorChars = /[*+\-<>=&|\^\/!\?]/; function tokenBase(stream, state) { @@ -60,14 +60,7 @@ CodeMirror.defineMode("sparql", function(config) { stream.skipToEnd(); return "comment"; } - else if (ch === "^") { - ch = stream.peek(); - if (ch === "^") stream.eat("^"); - else stream.eatWhile(operatorChars); - return "operator"; - } else if (operatorChars.test(ch)) { - stream.eatWhile(operatorChars); return "operator"; } else if (ch == ":") { @@ -95,7 +88,7 @@ CodeMirror.defineMode("sparql", function(config) { } function eatPnLocal(stream) { - while (stream.match(/([:\w\d._-]|\\[-\\_~.!$&'()*+,;=/?#@%]|%[a-fA-F0-9][a-fA-F0-9])/)); + stream.match(/(\.(?=[\w_\-\\%])|[:\w_-]|\\[-\\_~.!$&'()*+,;=/?#@%]|%[a-f\d][a-f\d])+/i); } function tokenLiteral(quote) { diff --git a/libraries/codemirror/mode/spreadsheet/spreadsheet.js b/libraries/codemirror/mode/spreadsheet/spreadsheet.js index d87f988d3..6ba3656b4 100644 --- a/libraries/codemirror/mode/spreadsheet/spreadsheet.js +++ b/libraries/codemirror/mode/spreadsheet/spreadsheet.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/sql/sql.js b/libraries/codemirror/mode/sql/sql.js index ead4d6db2..105b22ffb 100644 --- a/libraries/codemirror/mode/sql/sql.js +++ b/libraries/codemirror/mode/sql/sql.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -35,19 +35,19 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { if (support.hexNumber && ((ch == "0" && stream.match(/^[xX][0-9a-fA-F]+/)) - || (ch == "x" || ch == "X") && stream.match(/^'[0-9a-fA-F]+'/))) { + || (ch == "x" || ch == "X") && stream.match(/^'[0-9a-fA-F]*'/))) { // hex - // ref: http://dev.mysql.com/doc/refman/5.5/en/hexadecimal-literals.html + // ref: https://dev.mysql.com/doc/refman/8.0/en/hexadecimal-literals.html return "number"; } else if (support.binaryNumber && - (((ch == "b" || ch == "B") && stream.match(/^'[01]+'/)) + (((ch == "b" || ch == "B") && stream.match(/^'[01]*'/)) || (ch == "0" && stream.match(/^b[01]+/)))) { // bitstring - // ref: http://dev.mysql.com/doc/refman/5.5/en/bit-field-literals.html + // ref: https://dev.mysql.com/doc/refman/8.0/en/bit-value-literals.html return "number"; } else if (ch.charCodeAt(0) > 47 && ch.charCodeAt(0) < 58) { // numbers - // ref: http://dev.mysql.com/doc/refman/5.5/en/number-literals.html + // ref: https://dev.mysql.com/doc/refman/8.0/en/number-literals.html stream.match(/^[0-9]*(\.[0-9]+)?([eE][-+]?[0-9]+)?/); support.decimallessFloat && stream.match(/^\.(?!\.)/); return "number"; @@ -56,14 +56,14 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { return "variable-3"; } else if (ch == "'" || (ch == '"' && support.doubleQuote)) { // strings - // ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html + // ref: https://dev.mysql.com/doc/refman/8.0/en/string-literals.html state.tokenize = tokenLiteral(ch); return state.tokenize(stream, state); } else if ((((support.nCharCast && (ch == "n" || ch == "N")) || (support.charsetCast && ch == "_" && stream.match(/[a-z][a-z0-9]*/i))) && (stream.peek() == "'" || stream.peek() == '"'))) { // charset casting: _utf8'str', N'str', n'str' - // ref: http://dev.mysql.com/doc/refman/5.5/en/string-literals.html + // ref: https://dev.mysql.com/doc/refman/8.0/en/string-literals.html return "keyword"; } else if (support.escapeConstant && (ch == "e" || ch == "E") && (stream.peek() == "'" || (stream.peek() == '"' && support.doubleQuote))) { @@ -95,7 +95,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { if (stream.match(/^\.+/)) return null // .table_name (ODBC) - // // ref: http://dev.mysql.com/doc/refman/5.6/en/identifier-qualifiers.html + // // ref: https://dev.mysql.com/doc/refman/8.0/en/identifier-qualifiers.html if (support.ODBCdotTable && stream.match(/^[\w\d_$#]+/)) return "variable-2"; } else if (operatorChars.test(ch)) { @@ -112,19 +112,19 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { } else if (ch == '{' && (stream.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/) || stream.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/))) { // dates (weird ODBC syntax) - // ref: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-literals.html + // ref: https://dev.mysql.com/doc/refman/8.0/en/date-and-time-literals.html return "number"; } else { stream.eatWhile(/^[_\w\d]/); var word = stream.current().toLowerCase(); // dates (standard SQL syntax) - // ref: http://dev.mysql.com/doc/refman/5.5/en/date-and-time-literals.html + // ref: https://dev.mysql.com/doc/refman/8.0/en/date-and-time-literals.html if (dateSQL.hasOwnProperty(word) && (stream.match(/^( )+'[^']*'/) || stream.match(/^( )+"[^"]*"/))) return "number"; if (atoms.hasOwnProperty(word)) return "atom"; - if (builtin.hasOwnProperty(word)) return "builtin"; + if (builtin.hasOwnProperty(word)) return "type"; if (keywords.hasOwnProperty(word)) return "keyword"; - if (client.hasOwnProperty(word)) return "string-2"; + if (client.hasOwnProperty(word)) return "builtin"; return null; } } @@ -214,7 +214,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { // `identifier` function hookIdentifier(stream) { // MySQL/MariaDB identifiers - // ref: http://dev.mysql.com/doc/refman/5.6/en/identifier-qualifiers.html + // ref: https://dev.mysql.com/doc/refman/8.0/en/identifier-qualifiers.html var ch; while ((ch = stream.next()) != null) { if (ch == "`" && !stream.eat("`")) return "variable-2"; @@ -241,7 +241,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { // variables // @@prefix.varName @varName // varName can be quoted with ` or ' or " - // ref: http://dev.mysql.com/doc/refman/5.5/en/user-variables.html + // ref: https://dev.mysql.com/doc/refman/8.0/en/user-variables.html if (stream.eat("@")) { stream.match('session.'); stream.match('local.'); @@ -266,12 +266,12 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { // short client keyword token function hookClient(stream) { // \N means NULL - // ref: http://dev.mysql.com/doc/refman/5.5/en/null-values.html + // ref: https://dev.mysql.com/doc/refman/8.0/en/null-values.html if (stream.eat("N")) { return "atom"; } // \g, etc - // ref: http://dev.mysql.com/doc/refman/5.5/en/mysql-commands.html + // ref: https://dev.mysql.com/doc/refman/8.0/en/mysql-commands.html return stream.match(/^[a-zA-Z.#!?]/) ? "variable-2" : null; } @@ -287,7 +287,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { var defaultBuiltin = "bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric" - // A generic SQL Mode. It's not a standard, it just try to support what is generally supported + // A generic SQL Mode. It's not a standard, it just tries to support what is generally supported CodeMirror.defineMIME("text/x-sql", { name: "sql", keywords: set(sqlKeywords + "begin"), @@ -332,7 +332,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { CodeMirror.defineMIME("text/x-mariadb", { name: "sql", client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"), - keywords: set(sqlKeywords + "accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"), + keywords: set(sqlKeywords + "accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group group_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"), builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"), atoms: set("false true null unknown"), operatorChars: /^[*+\-%<>!=&|^]/, @@ -452,7 +452,7 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { CodeMirror.defineMIME("text/x-sparksql", { name: "sql", keywords: set("add after all alter analyze and anti archive array as asc at between bucket buckets by cache cascade case cast change clear cluster clustered codegen collection column columns comment commit compact compactions compute concatenate cost create cross cube current current_date current_timestamp database databases data dbproperties defined delete delimited deny desc describe dfs directories distinct distribute drop else end escaped except exchange exists explain export extended external false fields fileformat first following for format formatted from full function functions global grant group grouping having if ignore import in index indexes inner inpath inputformat insert intersect interval into is items join keys last lateral lazy left like limit lines list load local location lock locks logical macro map minus msck natural no not null nulls of on optimize option options or order out outer outputformat over overwrite partition partitioned partitions percent preceding principals purge range recordreader recordwriter recover reduce refresh regexp rename repair replace reset restrict revoke right rlike role roles rollback rollup row rows schema schemas select semi separated serde serdeproperties set sets show skewed sort sorted start statistics stored stratify struct table tables tablesample tblproperties temp temporary terminated then to touch transaction transactions transform true truncate unarchive unbounded uncache union unlock unset use using values view when where window with"), - builtin: set("tinyint smallint int bigint boolean float double string binary timestamp decimal array map struct uniontype delimited serde sequencefile textfile rcfile inputformat outputformat"), + builtin: set("abs acos acosh add_months aggregate and any approx_count_distinct approx_percentile array array_contains array_distinct array_except array_intersect array_join array_max array_min array_position array_remove array_repeat array_sort array_union arrays_overlap arrays_zip ascii asin asinh assert_true atan atan2 atanh avg base64 between bigint bin binary bit_and bit_count bit_get bit_length bit_or bit_xor bool_and bool_or boolean bround btrim cardinality case cast cbrt ceil ceiling char char_length character_length chr coalesce collect_list collect_set concat concat_ws conv corr cos cosh cot count count_if count_min_sketch covar_pop covar_samp crc32 cume_dist current_catalog current_database current_date current_timestamp current_timezone current_user date date_add date_format date_from_unix_date date_part date_sub date_trunc datediff day dayofmonth dayofweek dayofyear decimal decode degrees delimited dense_rank div double e element_at elt encode every exists exp explode explode_outer expm1 extract factorial filter find_in_set first first_value flatten float floor forall format_number format_string from_csv from_json from_unixtime from_utc_timestamp get_json_object getbit greatest grouping grouping_id hash hex hour hypot if ifnull in initcap inline inline_outer input_file_block_length input_file_block_start input_file_name inputformat instr int isnan isnotnull isnull java_method json_array_length json_object_keys json_tuple kurtosis lag last last_day last_value lcase lead least left length levenshtein like ln locate log log10 log1p log2 lower lpad ltrim make_date make_dt_interval make_interval make_timestamp make_ym_interval map map_concat map_entries map_filter map_from_arrays map_from_entries map_keys map_values map_zip_with max max_by md5 mean min min_by minute mod monotonically_increasing_id month months_between named_struct nanvl negative next_day not now nth_value ntile nullif nvl nvl2 octet_length or outputformat overlay parse_url percent_rank percentile percentile_approx pi pmod posexplode posexplode_outer position positive pow power printf quarter radians raise_error rand randn random rank rcfile reflect regexp regexp_extract regexp_extract_all regexp_like regexp_replace repeat replace reverse right rint rlike round row_number rpad rtrim schema_of_csv schema_of_json second sentences sequence sequencefile serde session_window sha sha1 sha2 shiftleft shiftright shiftrightunsigned shuffle sign signum sin sinh size skewness slice smallint some sort_array soundex space spark_partition_id split sqrt stack std stddev stddev_pop stddev_samp str_to_map string struct substr substring substring_index sum tan tanh textfile timestamp timestamp_micros timestamp_millis timestamp_seconds tinyint to_csv to_date to_json to_timestamp to_unix_timestamp to_utc_timestamp transform transform_keys transform_values translate trim trunc try_add try_divide typeof ucase unbase64 unhex uniontype unix_date unix_micros unix_millis unix_seconds unix_timestamp upper uuid var_pop var_samp variance version weekday weekofyear when width_bucket window xpath xpath_boolean xpath_double xpath_float xpath_int xpath_long xpath_number xpath_short xpath_string xxhash64 year zip_with"), atoms: set("false true null"), operatorChars: /^[*\/+\-%<>!=~&|^]/, dateSQL: set("date time timestamp"), @@ -471,6 +471,26 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { dateSQL: set("time"), support: set("decimallessFloat zerolessFloat binaryNumber hexNumber") }); + + // Trino (formerly known as Presto) + CodeMirror.defineMIME("text/x-trino", { + name: "sql", + // https://github.com/trinodb/trino/blob/bc7a4eeedde28684c7ae6f74cefcaf7c6e782174/core/trino-parser/src/main/antlr4/io/trino/sql/parser/SqlBase.g4#L859-L1129 + // https://github.com/trinodb/trino/blob/bc7a4eeedde28684c7ae6f74cefcaf7c6e782174/docs/src/main/sphinx/functions/list.rst + keywords: set("abs absent acos add admin after all all_match alter analyze and any any_match approx_distinct approx_most_frequent approx_percentile approx_set arbitrary array_agg array_distinct array_except array_intersect array_join array_max array_min array_position array_remove array_sort array_union arrays_overlap as asc asin at at_timezone atan atan2 authorization avg bar bernoulli beta_cdf between bing_tile bing_tile_at bing_tile_coordinates bing_tile_polygon bing_tile_quadkey bing_tile_zoom_level bing_tiles_around bit_count bitwise_and bitwise_and_agg bitwise_left_shift bitwise_not bitwise_or bitwise_or_agg bitwise_right_shift bitwise_right_shift_arithmetic bitwise_xor bool_and bool_or both by call cardinality cascade case cast catalogs cbrt ceil ceiling char2hexint checksum chr classify coalesce codepoint column columns combinations comment commit committed concat concat_ws conditional constraint contains contains_sequence convex_hull_agg copartition corr cos cosh cosine_similarity count count_if covar_pop covar_samp crc32 create cross cube cume_dist current current_catalog current_date current_groups current_path current_role current_schema current_time current_timestamp current_timezone current_user data date_add date_diff date_format date_parse date_trunc day day_of_month day_of_week day_of_year deallocate default define definer degrees delete dense_rank deny desc describe descriptor distinct distributed dow doy drop e element_at else empty empty_approx_set encoding end error escape evaluate_classifier_predictions every except excluding execute exists exp explain extract false features fetch filter final first first_value flatten floor following for format format_datetime format_number from from_base from_base32 from_base64 from_base64url from_big_endian_32 from_big_endian_64 from_encoded_polyline from_geojson_geometry from_hex from_ieee754_32 from_ieee754_64 from_iso8601_date from_iso8601_timestamp from_iso8601_timestamp_nanos from_unixtime from_unixtime_nanos from_utf8 full functions geometric_mean geometry_from_hadoop_shape geometry_invalid_reason geometry_nearest_points geometry_to_bing_tiles geometry_union geometry_union_agg grant granted grants graphviz great_circle_distance greatest group grouping groups hamming_distance hash_counts having histogram hmac_md5 hmac_sha1 hmac_sha256 hmac_sha512 hour human_readable_seconds if ignore in including index infinity initial inner input insert intersect intersection_cardinality into inverse_beta_cdf inverse_normal_cdf invoker io is is_finite is_infinite is_json_scalar is_nan isolation jaccard_index join json_array json_array_contains json_array_get json_array_length json_exists json_extract json_extract_scalar json_format json_object json_parse json_query json_size json_value keep key keys kurtosis lag last last_day_of_month last_value lateral lead leading learn_classifier learn_libsvm_classifier learn_libsvm_regressor learn_regressor least left length level levenshtein_distance like limit line_interpolate_point line_interpolate_points line_locate_point listagg ln local localtime localtimestamp log log10 log2 logical lower lpad ltrim luhn_check make_set_digest map_agg map_concat map_entries map_filter map_from_entries map_keys map_union map_values map_zip_with match match_recognize matched matches materialized max max_by md5 measures merge merge_set_digest millisecond min min_by minute mod month multimap_agg multimap_from_entries murmur3 nan natural next nfc nfd nfkc nfkd ngrams no none none_match normal_cdf normalize not now nth_value ntile null nullif nulls numeric_histogram object objectid_timestamp of offset omit on one only option or order ordinality outer output over overflow parse_data_size parse_datetime parse_duration partition partitions passing past path pattern per percent_rank permute pi position pow power preceding prepare privileges properties prune qdigest_agg quarter quotes radians rand random range rank read recursive reduce reduce_agg refresh regexp_count regexp_extract regexp_extract_all regexp_like regexp_position regexp_replace regexp_split regr_intercept regr_slope regress rename render repeat repeatable replace reset respect restrict returning reverse revoke rgb right role roles rollback rollup round row_number rows rpad rtrim running scalar schema schemas second security seek select sequence serializable session set sets sha1 sha256 sha512 show shuffle sign simplify_geometry sin skewness skip slice some soundex spatial_partitioning spatial_partitions split split_part split_to_map split_to_multimap spooky_hash_v2_32 spooky_hash_v2_64 sqrt st_area st_asbinary st_astext st_boundary st_buffer st_centroid st_contains st_convexhull st_coorddim st_crosses st_difference st_dimension st_disjoint st_distance st_endpoint st_envelope st_envelopeaspts st_equals st_exteriorring st_geometries st_geometryfromtext st_geometryn st_geometrytype st_geomfrombinary st_interiorringn st_interiorrings st_intersection st_intersects st_isclosed st_isempty st_isring st_issimple st_isvalid st_length st_linefromtext st_linestring st_multipoint st_numgeometries st_numinteriorring st_numpoints st_overlaps st_point st_pointn st_points st_polygon st_relate st_startpoint st_symdifference st_touches st_union st_within st_x st_xmax st_xmin st_y st_ymax st_ymin start starts_with stats stddev stddev_pop stddev_samp string strpos subset substr substring sum system table tables tablesample tan tanh tdigest_agg text then ties timestamp_objectid timezone_hour timezone_minute to to_base to_base32 to_base64 to_base64url to_big_endian_32 to_big_endian_64 to_char to_date to_encoded_polyline to_geojson_geometry to_geometry to_hex to_ieee754_32 to_ieee754_64 to_iso8601 to_milliseconds to_spherical_geography to_timestamp to_unixtime to_utf8 trailing transaction transform transform_keys transform_values translate trim trim_array true truncate try try_cast type typeof uescape unbounded uncommitted unconditional union unique unknown unmatched unnest update upper url_decode url_encode url_extract_fragment url_extract_host url_extract_parameter url_extract_path url_extract_port url_extract_protocol url_extract_query use user using utf16 utf32 utf8 validate value value_at_quantile values values_at_quantiles var_pop var_samp variance verbose version view week week_of_year when where width_bucket wilson_interval_lower wilson_interval_upper window with with_timezone within without word_stem work wrapper write xxhash64 year year_of_week yow zip zip_with"), + // https://github.com/trinodb/trino/blob/bc7a4eeedde28684c7ae6f74cefcaf7c6e782174/core/trino-main/src/main/java/io/trino/metadata/TypeRegistry.java#L131-L168 + // https://github.com/trinodb/trino/blob/bc7a4eeedde28684c7ae6f74cefcaf7c6e782174/plugin/trino-ml/src/main/java/io/trino/plugin/ml/MLPlugin.java#L35 + // https://github.com/trinodb/trino/blob/bc7a4eeedde28684c7ae6f74cefcaf7c6e782174/plugin/trino-mongodb/src/main/java/io/trino/plugin/mongodb/MongoPlugin.java#L32 + // https://github.com/trinodb/trino/blob/bc7a4eeedde28684c7ae6f74cefcaf7c6e782174/plugin/trino-geospatial/src/main/java/io/trino/plugin/geospatial/GeoPlugin.java#L37 + builtin: set("array bigint bingtile boolean char codepoints color date decimal double function geometry hyperloglog int integer interval ipaddress joniregexp json json2016 jsonpath kdbtree likepattern map model objectid p4hyperloglog precision qdigest re2jregexp real regressor row setdigest smallint sphericalgeography tdigest time timestamp tinyint uuid varbinary varchar zone"), + atoms: set("false true null unknown"), + // https://trino.io/docs/current/functions/list.html#id1 + operatorChars: /^[[\]|<>=!\-+*/%]/, + dateSQL: set("date time timestamp zone"), + // hexNumber is necessary for VARBINARY literals, e.g. X'65683F' + // but it also enables 0xFF hex numbers, which Trino doesn't support. + support: set("ODBCdotTable decimallessFloat zerolessFloat hexNumber") + }); }); /* @@ -489,7 +509,11 @@ CodeMirror.defineMode("sql", function(config, parserConfig) { A list of supported syntaxes which are not common, but are supported by more than 1 DBMS. * ODBCdotTable: .tableName * zerolessFloat: .1 - * doubleQuote + * decimallessFloat: 1. + * hexNumber: X'01AF' X'01af' x'01AF' x'01af' 0x01AF 0x01af + * binaryNumber: b'01' B'01' 0b01 + * doubleQuote: "string" + * escapeConstant: E'' * nCharCast: N'string' * charsetCast: _utf8'string' * commentHash: use # char for comments diff --git a/libraries/codemirror/mode/stex/stex.js b/libraries/codemirror/mode/stex/stex.js index 20c3bc7a1..2b73bc98b 100644 --- a/libraries/codemirror/mode/stex/stex.js +++ b/libraries/codemirror/mode/stex/stex.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE /* * Author: Constantin Jucovschi (c.jucovschi@jacobs-university.de) diff --git a/libraries/codemirror/mode/stylus/stylus.js b/libraries/codemirror/mode/stylus/stylus.js index 5cddff032..dae99e5d2 100644 --- a/libraries/codemirror/mode/stylus/stylus.js +++ b/libraries/codemirror/mode/stylus/stylus.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE // Stylus mode created by Dmitry Kiselyov http://git.io/AaRB @@ -737,12 +737,12 @@ // Note, "url-prefix" should precede "url" in order to match correctly in documentTypesRegexp var documentTypes_ = ["domain", "regexp", "url-prefix", "url"]; var mediaTypes_ = ["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"]; - var mediaFeatures_ = ["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"]; + var mediaFeatures_ = ["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","dynamic-range","video-dynamic-range"]; var propertyKeywords_ = ["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode","font-smoothing","osx-font-smoothing"]; var nonStandardPropertyKeywords_ = ["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"]; var fontProperties_ = ["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"]; var colorKeywords_ = ["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]; - var valueKeywords_ = ["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small","bicubic","optimizespeed","grayscale","row","row-reverse","wrap","wrap-reverse","column-reverse","flex-start","flex-end","space-between","space-around", "unset"]; + var valueKeywords_ = ["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","conic-gradient","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","high","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-play-button","media-slider","media-sliderthumb","media-volume-slider","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeating-conic-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","standard","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small","bicubic","optimizespeed","grayscale","row","row-reverse","wrap","wrap-reverse","column-reverse","flex-start","flex-end","space-between","space-around", "unset"]; var wordOperatorKeywords_ = ["in","and","or","not","is not","is a","is","isnt","defined","if unless"], blockKeywords_ = ["for","if","else","unless", "from", "to"], diff --git a/libraries/codemirror/mode/swift/swift.js b/libraries/codemirror/mode/swift/swift.js index 55e31e270..4edc4507a 100644 --- a/libraries/codemirror/mode/swift/swift.js +++ b/libraries/codemirror/mode/swift/swift.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE // Swift mode created by Michael Kaminsky https://github.com/mkaminsky11 @@ -19,14 +19,14 @@ return set } - var keywords = wordSet(["_","var","let","class","enum","extension","import","protocol","struct","func","typealias","associatedtype", + var keywords = wordSet(["_","var","let","actor","class","enum","extension","import","protocol","struct","func","typealias","associatedtype", "open","public","internal","fileprivate","private","deinit","init","new","override","self","subscript","super", "convenience","dynamic","final","indirect","lazy","required","static","unowned","unowned(safe)","unowned(unsafe)","weak","as","is", "break","case","continue","default","else","fallthrough","for","guard","if","in","repeat","switch","where","while", - "defer","return","inout","mutating","nonmutating","catch","do","rethrows","throw","throws","try","didSet","get","set","willSet", + "defer","return","inout","mutating","nonmutating","isolated","nonisolated","catch","do","rethrows","throw","throws","async","await","try","didSet","get","set","willSet", "assignment","associativity","infix","left","none","operator","postfix","precedence","precedencegroup","prefix","right", "Any","AnyObject","Type","dynamicType","Self","Protocol","__COLUMN__","__FILE__","__FUNCTION__","__LINE__"]) - var definingKeywords = wordSet(["var","let","class","enum","extension","import","protocol","struct","func","typealias","associatedtype","for"]) + var definingKeywords = wordSet(["var","let","actor","class","enum","extension","import","protocol","struct","func","typealias","associatedtype","for"]) var atoms = wordSet(["true","false","nil","self","super","_"]) var types = wordSet(["Array","Bool","Character","Dictionary","Double","Float","Int","Int8","Int16","Int32","Int64","Never","Optional","Set","String", "UInt8","UInt16","UInt32","UInt64","Void"]) @@ -143,14 +143,12 @@ function tokenComment(stream, state) { var ch - while (true) { - stream.match(/^[^/*]+/, true) - ch = stream.next() - if (!ch) break + while (ch = stream.next()) { if (ch === "/" && stream.eat("*")) { state.tokenize.push(tokenComment) } else if (ch === "*" && stream.eat("/")) { state.tokenize.pop() + break } } return "comment" diff --git a/libraries/codemirror/mode/tcl/tcl.js b/libraries/codemirror/mode/tcl/tcl.js index dec0662a6..fd0c51752 100644 --- a/libraries/codemirror/mode/tcl/tcl.js +++ b/libraries/codemirror/mode/tcl/tcl.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE //tcl mode by Ford_Lawnmower :: Based on Velocity mode by Steve O'Hara diff --git a/libraries/codemirror/mode/textile/textile.js b/libraries/codemirror/mode/textile/textile.js index b378fb61f..db01fcf53 100644 --- a/libraries/codemirror/mode/textile/textile.js +++ b/libraries/codemirror/mode/textile/textile.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") { // CommonJS diff --git a/libraries/codemirror/mode/tiddlywiki/tiddlywiki.js b/libraries/codemirror/mode/tiddlywiki/tiddlywiki.js index 6a9ce447b..b96316d5b 100644 --- a/libraries/codemirror/mode/tiddlywiki/tiddlywiki.js +++ b/libraries/codemirror/mode/tiddlywiki/tiddlywiki.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE /*** |''Name''|tiddlywiki.js| diff --git a/libraries/codemirror/mode/tiki/tiki.js b/libraries/codemirror/mode/tiki/tiki.js index 092b85953..da251464d 100644 --- a/libraries/codemirror/mode/tiki/tiki.js +++ b/libraries/codemirror/mode/tiki/tiki.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/toml/toml.js b/libraries/codemirror/mode/toml/toml.js index 891f384b5..ee0c23928 100644 --- a/libraries/codemirror/mode/toml/toml.js +++ b/libraries/codemirror/mode/toml/toml.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/tornado/tornado.js b/libraries/codemirror/mode/tornado/tornado.js index aa589a08c..973770de5 100644 --- a/libraries/codemirror/mode/tornado/tornado.js +++ b/libraries/codemirror/mode/tornado/tornado.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/troff/troff.js b/libraries/codemirror/mode/troff/troff.js index 0c2220d2c..6d720ca3c 100644 --- a/libraries/codemirror/mode/troff/troff.js +++ b/libraries/codemirror/mode/troff/troff.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") diff --git a/libraries/codemirror/mode/ttcn-cfg/ttcn-cfg.js b/libraries/codemirror/mode/ttcn-cfg/ttcn-cfg.js index 9d4b8405a..60bace18e 100644 --- a/libraries/codemirror/mode/ttcn-cfg/ttcn-cfg.js +++ b/libraries/codemirror/mode/ttcn-cfg/ttcn-cfg.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/ttcn/ttcn.js b/libraries/codemirror/mode/ttcn/ttcn.js index 0304e7c53..cd56efe0a 100644 --- a/libraries/codemirror/mode/ttcn/ttcn.js +++ b/libraries/codemirror/mode/ttcn/ttcn.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/turtle/turtle.js b/libraries/codemirror/mode/turtle/turtle.js index 695239661..e73f535a5 100644 --- a/libraries/codemirror/mode/turtle/turtle.js +++ b/libraries/codemirror/mode/turtle/turtle.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/twig/twig.js b/libraries/codemirror/mode/twig/twig.js index a6dd3f1a6..d85f0aed8 100644 --- a/libraries/codemirror/mode/twig/twig.js +++ b/libraries/codemirror/mode/twig/twig.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/vb/vb.js b/libraries/codemirror/mode/vb/vb.js index 6e4b47630..d77fdfb19 100644 --- a/libraries/codemirror/mode/vb/vb.js +++ b/libraries/codemirror/mode/vb/vb.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/vbscript/vbscript.js b/libraries/codemirror/mode/vbscript/vbscript.js index 403394813..49c26e5bb 100644 --- a/libraries/codemirror/mode/vbscript/vbscript.js +++ b/libraries/codemirror/mode/vbscript/vbscript.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE /* For extra ASP classic objects, initialize CodeMirror instance with this option: diff --git a/libraries/codemirror/mode/velocity/velocity.js b/libraries/codemirror/mode/velocity/velocity.js index 1d17c84eb..757639922 100644 --- a/libraries/codemirror/mode/velocity/velocity.js +++ b/libraries/codemirror/mode/velocity/velocity.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -82,6 +82,7 @@ CodeMirror.defineMode("velocity", function() { } // variable? else if (ch == "$") { + stream.eat("!"); stream.eatWhile(/[\w\d\$_\.{}-]/); // is it one of the specials? if (specials && specials.propertyIsEnumerable(stream.current())) { diff --git a/libraries/codemirror/mode/verilog/verilog.js b/libraries/codemirror/mode/verilog/verilog.js index 6c799f298..221328eb4 100644 --- a/libraries/codemirror/mode/verilog/verilog.js +++ b/libraries/codemirror/mode/verilog/verilog.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/vhdl/vhdl.js b/libraries/codemirror/mode/vhdl/vhdl.js index 133e67a26..a7ddfd1e6 100644 --- a/libraries/codemirror/mode/vhdl/vhdl.js +++ b/libraries/codemirror/mode/vhdl/vhdl.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE // Originally written by Alf Nielsen, re-written by Michael Zhou (function(mod) { diff --git a/libraries/codemirror/mode/vue/vue.js b/libraries/codemirror/mode/vue/vue.js index b6e6cc513..a0220bdc7 100644 --- a/libraries/codemirror/mode/vue/vue.js +++ b/libraries/codemirror/mode/vue/vue.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function (mod) { "use strict"; diff --git a/libraries/codemirror/mode/wast/wast.js b/libraries/codemirror/mode/wast/wast.js index 9bddc8878..0a0af853d 100644 --- a/libraries/codemirror/mode/wast/wast.js +++ b/libraries/codemirror/mode/wast/wast.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -18,6 +18,8 @@ var kKeywords = [ "call(_indirect|_ref)?", "current_memory", "\\bdata\\b", + "catch(_all)?", + "delegate", "drop", "elem", "else", @@ -36,13 +38,17 @@ var kKeywords = [ "offset", "param", "result", + "rethrow", "return(_call(_indirect|_ref)?)?", "select", "start", "table(\\.(size|get|set|size|grow|fill|init|copy))?", "then", + "throw", + "try", "type", "unreachable", + "unwind", // Numeric opcodes. "i(32|64)\\.(store(8|16)|(load(8|16)_[su]))", diff --git a/libraries/codemirror/mode/webidl/webidl.js b/libraries/codemirror/mode/webidl/webidl.js index 120de6bea..7fa01da47 100644 --- a/libraries/codemirror/mode/webidl/webidl.js +++ b/libraries/codemirror/mode/webidl/webidl.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/xml/xml.js b/libraries/codemirror/mode/xml/xml.js index 46806ac42..701e151ab 100644 --- a/libraries/codemirror/mode/xml/xml.js +++ b/libraries/codemirror/mode/xml/xml.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -187,6 +187,10 @@ CodeMirror.defineMode("xml", function(editorConf, config_) { }; } + function lower(tagName) { + return tagName && tagName.toLowerCase(); + } + function Context(state, tagName, startOfLine) { this.prev = state.context; this.tagName = tagName || ""; @@ -205,8 +209,8 @@ CodeMirror.defineMode("xml", function(editorConf, config_) { return; } parentTagName = state.context.tagName; - if (!config.contextGrabbers.hasOwnProperty(parentTagName) || - !config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) { + if (!config.contextGrabbers.hasOwnProperty(lower(parentTagName)) || + !config.contextGrabbers[lower(parentTagName)].hasOwnProperty(lower(nextTagName))) { return; } popContext(state); @@ -240,7 +244,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) { if (type == "word") { var tagName = stream.current(); if (state.context && state.context.tagName != tagName && - config.implicitlyClosed.hasOwnProperty(state.context.tagName)) + config.implicitlyClosed.hasOwnProperty(lower(state.context.tagName))) popContext(state); if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) { setStyle = "tag"; @@ -279,7 +283,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) { var tagName = state.tagName, tagStart = state.tagStart; state.tagName = state.tagStart = null; if (type == "selfcloseTag" || - config.autoSelfClosers.hasOwnProperty(tagName)) { + config.autoSelfClosers.hasOwnProperty(lower(tagName))) { maybePopContext(state, tagName); } else { maybePopContext(state, tagName); @@ -359,7 +363,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) { if (context.tagName == tagAfter[2]) { context = context.prev; break; - } else if (config.implicitlyClosed.hasOwnProperty(context.tagName)) { + } else if (config.implicitlyClosed.hasOwnProperty(lower(context.tagName))) { context = context.prev; } else { break; @@ -367,8 +371,8 @@ CodeMirror.defineMode("xml", function(editorConf, config_) { } } else if (tagAfter) { // Opening tag spotted while (context) { - var grabbers = config.contextGrabbers[context.tagName]; - if (grabbers && grabbers.hasOwnProperty(tagAfter[2])) + var grabbers = config.contextGrabbers[lower(context.tagName)]; + if (grabbers && grabbers.hasOwnProperty(lower(tagAfter[2]))) context = context.prev; else break; diff --git a/libraries/codemirror/mode/xquery/xquery.js b/libraries/codemirror/mode/xquery/xquery.js index 395b6a701..e9ae43b51 100644 --- a/libraries/codemirror/mode/xquery/xquery.js +++ b/libraries/codemirror/mode/xquery/xquery.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/yacas/yacas.js b/libraries/codemirror/mode/yacas/yacas.js index b7ac96b71..1e775d99e 100644 --- a/libraries/codemirror/mode/yacas/yacas.js +++ b/libraries/codemirror/mode/yacas/yacas.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE // Yacas mode copyright (c) 2015 by Grzegorz Mazur // Loosely based on mathematica mode by Calin Barbat diff --git a/libraries/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js b/libraries/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js index f9050ad6a..0b30aa243 100644 --- a/libraries/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js +++ b/libraries/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function (mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS @@ -17,51 +17,55 @@ var yamlMode = CodeMirror.getMode(config, "yaml") var innerMode = CodeMirror.getMode(config, parserConfig && parserConfig.base || "gfm") - function curMode(state) { - return state.state == BODY ? innerMode : yamlMode + function localMode(state) { + return state.state == FRONTMATTER ? {mode: yamlMode, state: state.yaml} : {mode: innerMode, state: state.inner} } return { startState: function () { return { state: START, - inner: CodeMirror.startState(yamlMode) + yaml: null, + inner: CodeMirror.startState(innerMode) } }, copyState: function (state) { return { state: state.state, - inner: CodeMirror.copyState(curMode(state), state.inner) + yaml: state.yaml && CodeMirror.copyState(yamlMode, state.yaml), + inner: CodeMirror.copyState(innerMode, state.inner) } }, token: function (stream, state) { if (state.state == START) { if (stream.match('---', false)) { state.state = FRONTMATTER - return yamlMode.token(stream, state.inner) + state.yaml = CodeMirror.startState(yamlMode) + return yamlMode.token(stream, state.yaml) } else { state.state = BODY - state.inner = CodeMirror.startState(innerMode) return innerMode.token(stream, state.inner) } } else if (state.state == FRONTMATTER) { var end = stream.sol() && stream.match(/(---|\.\.\.)/, false) - var style = yamlMode.token(stream, state.inner) + var style = yamlMode.token(stream, state.yaml) if (end) { state.state = BODY - state.inner = CodeMirror.startState(innerMode) + state.yaml = null } return style } else { return innerMode.token(stream, state.inner) } }, - innerMode: function (state) { - return {mode: curMode(state), state: state.inner} + innerMode: localMode, + indent: function(state, a, b) { + var m = localMode(state) + return m.mode.indent ? m.mode.indent(m.state, a, b) : CodeMirror.Pass }, blankLine: function (state) { - var mode = curMode(state) - if (mode.blankLine) return mode.blankLine(state.inner) + var m = localMode(state) + if (m.mode.blankLine) return m.mode.blankLine(m.state) } } }) diff --git a/libraries/codemirror/mode/yaml/yaml.js b/libraries/codemirror/mode/yaml/yaml.js index d46494102..298db55f6 100644 --- a/libraries/codemirror/mode/yaml/yaml.js +++ b/libraries/codemirror/mode/yaml/yaml.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS diff --git a/libraries/codemirror/mode/z80/z80.js b/libraries/codemirror/mode/z80/z80.js index 8cea4ff90..596e57d2e 100644 --- a/libraries/codemirror/mode/z80/z80.js +++ b/libraries/codemirror/mode/z80/z80.js @@ -1,5 +1,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others -// Distributed under an MIT license: https://codemirror.net/LICENSE +// Distributed under an MIT license: https://codemirror.net/5/LICENSE (function(mod) { if (typeof exports == "object" && typeof module == "object") // CommonJS