(stream, state)
| 3 | function ret(style, tp) {type = tp; return style;} |
| 4 | |
| 5 | function tokenBase(stream, state) { |
| 6 | var ch = stream.next(); |
| 7 | if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("meta", stream.current());} |
| 8 | else if (ch == "/" && stream.eat("*")) { |
| 9 | state.tokenize = tokenCComment; |
| 10 | return tokenCComment(stream, state); |
| 11 | } |
| 12 | else if (ch == "<" && stream.eat("!")) { |
| 13 | state.tokenize = tokenSGMLComment; |
| 14 | return tokenSGMLComment(stream, state); |
| 15 | } |
| 16 | else if (ch == "=") ret(null, "compare"); |
| 17 | else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare"); |
| 18 | else if (ch == "\"" || ch == "'") { |
| 19 | state.tokenize = tokenString(ch); |
| 20 | return state.tokenize(stream, state); |
| 21 | } |
| 22 | else if (ch == "#") { |
| 23 | stream.eatWhile(/[\w\\\-]/); |
| 24 | return ret("atom", "hash"); |
| 25 | } |
| 26 | else if (ch == "!") { |
| 27 | stream.match(/^\s*\w*/); |
| 28 | return ret("keyword", "important"); |
| 29 | } |
| 30 | else if (/\d/.test(ch)) { |
| 31 | stream.eatWhile(/[\w.%]/); |
| 32 | return ret("number", "unit"); |
| 33 | } |
| 34 | else if (/[,.+>*\/]/.test(ch)) { |
| 35 | return ret(null, "select-op"); |
| 36 | } |
| 37 | else if (/[;{}:\[\]]/.test(ch)) { |
| 38 | return ret(null, ch); |
| 39 | } |
| 40 | else { |
| 41 | stream.eatWhile(/[\w\\\-]/); |
| 42 | return ret("variable", "variable"); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | function tokenCComment(stream, state) { |
| 47 | var maybeEnd = false, ch; |
nothing calls this directly
no test coverage detected