MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / base

Function base

lib/web/CodeMirror/mode/commonlisp/commonlisp.js:30–62  ·  view source on GitHub ↗
(stream, state)

Source from the content-addressed store, hash-verified

28 }
29
30 function base(stream, state) {
31 if (stream.eatSpace()) {type = "ws"; return null;}
32 if (stream.match(numLiteral)) return "number";
33 var ch = stream.next();
34 if (ch == "\\") ch = stream.next();
35
36 if (ch == '"') return (state.tokenize = inString)(stream, state);
37 else if (ch == "(") { type = "open"; return "bracket"; }
38 else if (ch == ")" || ch == "]") { type = "close"; return "bracket"; }
39 else if (ch == ";") { stream.skipToEnd(); type = "ws"; return "comment"; }
40 else if (/['`,@]/.test(ch)) return null;
41 else if (ch == "|") {
42 if (stream.skipTo("|")) { stream.next(); return "symbol"; }
43 else { stream.skipToEnd(); return "error"; }
44 } else if (ch == "#") {
45 var ch = stream.next();
46 if (ch == "(") { type = "open"; return "bracket"; }
47 else if (/[+\-=\.']/.test(ch)) return null;
48 else if (/\d/.test(ch) && stream.match(/^\d*#/)) return null;
49 else if (ch == "|") return (state.tokenize = inComment)(stream, state);
50 else if (ch == ":") { readSym(stream); return "meta"; }
51 else if (ch == "\\") { stream.next(); readSym(stream); return "string-2" }
52 else return "error";
53 } else {
54 var name = readSym(stream);
55 if (name == ".") return null;
56 type = "symbol";
57 if (name == "nil" || name == "t" || name.charAt(0) == ":") return "atom";
58 if (state.lastType == "open" && (specialForm.test(name) || assumeBody.test(name))) return "keyword";
59 if (name.charAt(0) == "&") return "variable-2";
60 return "variable";
61 }
62 }
63
64 function inString(stream, state) {
65 var escaped = false, next;

Callers

nothing calls this directly

Calls 7

readSymFunction · 0.85
eatSpaceMethod · 0.80
skipToEndMethod · 0.80
nextMethod · 0.65
matchMethod · 0.45
testMethod · 0.45
skipToMethod · 0.45

Tested by

no test coverage detected