| 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 return "error"; |
| 52 | } else { |
| 53 | var name = readSym(stream); |
| 54 | if (name == ".") return null; |
| 55 | type = "symbol"; |
| 56 | if (name == "nil" || name == "t" || name.charAt(0) == ":") return "atom"; |
| 57 | if (state.lastType == "open" && (specialForm.test(name) || assumeBody.test(name))) return "keyword"; |
| 58 | if (name.charAt(0) == "&") return "variable-2"; |
| 59 | return "variable"; |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | function inString(stream, state) { |
| 64 | var escaped = false, next; |