MCPcopy Create free account
hub / github.com/TruthHun/BookStack / tokenBase

Function tokenBase

static/editor.md/lib/codemirror/mode/cypher/cypher.js:21–48  ·  view source on GitHub ↗
(stream/*, state*/)

Source from the content-addressed store, hash-verified

19
20 CodeMirror.defineMode("cypher", function(config) {
21 var tokenBase = function(stream/*, state*/) {
22 var ch = stream.next(), curPunc = null;
23 if (ch === "\"" || ch === "'") {
24 stream.match(/.+?["']/);
25 return "string";
26 }
27 if (/[{}\(\),\.;\[\]]/.test(ch)) {
28 curPunc = ch;
29 return "node";
30 } else if (ch === "/" && stream.eat("/")) {
31 stream.skipToEnd();
32 return "comment";
33 } else if (operatorChars.test(ch)) {
34 stream.eatWhile(operatorChars);
35 return null;
36 } else {
37 stream.eatWhile(/[_\w\d]/);
38 if (stream.eat(":")) {
39 stream.eatWhile(/[\w\d_\-]/);
40 return "atom";
41 }
42 var word = stream.current();
43 if (funcs.test(word)) return "builtin";
44 if (preds.test(word)) return "def";
45 if (keywords.test(word)) return "keyword";
46 return "variable";
47 }
48 };
49 var pushContext = function(state, type, col) {
50 return state.context = {
51 prev: state.context,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected