1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 10:18:38 +00:00

Update CodeMirror to version 5.49.0 (#8381)

* Update CodeMirror to version 5.49.0

* Update CodeMirror versions in librejs and VERSIONS
This commit is contained in:
oscar.lofwenhamn
2019-10-15 10:40:42 +02:00
committed by Lauris BH
parent 6fa14ac3c8
commit 1e9b330525
352 changed files with 14625 additions and 2451 deletions

View File

@@ -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: https://codemirror.net/LICENSE
// By the Neo4j Team and contributors.
// https://github.com/neo4j-contrib/CodeMirror
@@ -20,8 +20,12 @@
CodeMirror.defineMode("cypher", function(config) {
var tokenBase = function(stream/*, state*/) {
var ch = stream.next();
if (ch === "\"" || ch === "'") {
stream.match(/.+?["']/);
if (ch ==='"') {
stream.match(/.*?"/);
return "string";
}
if (ch === "'") {
stream.match(/.*?'/);
return "string";
}
if (/[{}\(\),\.;\[\]]/.test(ch)) {
@@ -62,7 +66,7 @@
var curPunc;
var funcs = wordRegexp(["abs", "acos", "allShortestPaths", "asin", "atan", "atan2", "avg", "ceil", "coalesce", "collect", "cos", "cot", "count", "degrees", "e", "endnode", "exp", "extract", "filter", "floor", "haversin", "head", "id", "keys", "labels", "last", "left", "length", "log", "log10", "lower", "ltrim", "max", "min", "node", "nodes", "percentileCont", "percentileDisc", "pi", "radians", "rand", "range", "reduce", "rel", "relationship", "relationships", "replace", "reverse", "right", "round", "rtrim", "shortestPath", "sign", "sin", "size", "split", "sqrt", "startnode", "stdev", "stdevp", "str", "substring", "sum", "tail", "tan", "timestamp", "toFloat", "toInt", "toString", "trim", "type", "upper"]);
var preds = wordRegexp(["all", "and", "any", "contains", "exists", "has", "in", "none", "not", "or", "single", "xor"]);
var keywords = wordRegexp(["as", "asc", "ascending", "assert", "by", "case", "commit", "constraint", "create", "csv", "cypher", "delete", "desc", "descending", "detach", "distinct", "drop", "else", "end", "ends", "explain", "false", "fieldterminator", "foreach", "from", "headers", "in", "index", "is", "join", "limit", "load", "match", "merge", "null", "on", "optional", "order", "periodic", "profile", "remove", "return", "scan", "set", "skip", "start", "starts", "then", "true", "union", "unique", "unwind", "using", "when", "where", "with"]);
var keywords = wordRegexp(["as", "asc", "ascending", "assert", "by", "case", "commit", "constraint", "create", "csv", "cypher", "delete", "desc", "descending", "detach", "distinct", "drop", "else", "end", "ends", "explain", "false", "fieldterminator", "foreach", "from", "headers", "in", "index", "is", "join", "limit", "load", "match", "merge", "null", "on", "optional", "order", "periodic", "profile", "remove", "return", "scan", "set", "skip", "start", "starts", "then", "true", "union", "unique", "unwind", "using", "when", "where", "with", "call", "yield"]);
var operatorChars = /[*+\-<>=&|~%^]/;
return {

View File

@@ -7,6 +7,7 @@
<link rel="stylesheet" href="../../lib/codemirror.css" />
<link rel="stylesheet" href="../../theme/neo.css" />
<script src="../../lib/codemirror.js"></script>
<script src="../../addon/edit/matchbrackets.js"></script>
<script src="cypher.js"></script>
<style>
.CodeMirror {
@@ -15,7 +16,7 @@
}
</style>
<div id=nav>
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
<ul>
<li><a href="../../index.html">Home</a>
@@ -53,7 +54,7 @@ window.onload = function() {
indentWithTabs: true,
smartIndent: true,
lineNumbers: true,
matchBrackets : true,
matchBrackets: true,
autofocus: true,
theme: 'neo'
});

View File

@@ -0,0 +1,37 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
(function() {
var mode = CodeMirror.getMode({tabSize: 4, indentUnit: 2}, "cypher");
function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
MT("unbalancedDoubledQuotedString",
"[string \"a'b\"][variable c]");
MT("unbalancedSingleQuotedString",
"[string 'a\"b'][variable c]");
MT("doubleQuotedString",
"[string \"a\"][variable b]");
MT("singleQuotedString",
"[string 'a'][variable b]");
MT("single attribute (with content)",
"[node {][atom a:][string 'a'][node }]");
MT("multiple attribute, singleQuotedString (with content)",
"[node {][atom a:][string 'a'][node ,][atom b:][string 'b'][node }]");
MT("multiple attribute, doubleQuotedString (with content)",
"[node {][atom a:][string \"a\"][node ,][atom b:][string \"b\"][node }]");
MT("single attribute (without content)",
"[node {][atom a:][string 'a'][node }]");
MT("multiple attribute, singleQuotedString (without content)",
"[node {][atom a:][string ''][node ,][atom b:][string ''][node }]");
MT("multiple attribute, doubleQuotedString (without content)",
"[node {][atom a:][string \"\"][node ,][atom b:][string \"\"][node }]");
})();