(stream, state)
| 32 | var curPunc; |
| 33 | |
| 34 | function tokenBase(stream, state) { |
| 35 | var ch = stream.next(); |
| 36 | if (ch == '"' || ch == "'") { |
| 37 | return startString(ch, stream, state); |
| 38 | } |
| 39 | // Wildcard import w/o trailing semicolon (import smth.*) |
| 40 | if (ch == "." && stream.eat("*")) { |
| 41 | return "word"; |
| 42 | } |
| 43 | if (/[\[\]{}\(\),;\:\.]/.test(ch)) { |
| 44 | curPunc = ch; |
| 45 | return null; |
| 46 | } |
| 47 | if (/\d/.test(ch)) { |
| 48 | if (stream.eat(/eE/)) { |
| 49 | stream.eat(/\+\-/); |
| 50 | stream.eatWhile(/\d/); |
| 51 | } |
| 52 | return "number"; |
| 53 | } |
| 54 | if (ch == "/") { |
| 55 | if (stream.eat("*")) { |
| 56 | state.tokenize.push(tokenComment); |
| 57 | return tokenComment(stream, state); |
| 58 | } |
| 59 | if (stream.eat("/")) { |
| 60 | stream.skipToEnd(); |
| 61 | return "comment"; |
| 62 | } |
| 63 | if (expectExpression(state.lastToken)) { |
| 64 | return startString(ch, stream, state); |
| 65 | } |
| 66 | } |
| 67 | // Commented |
| 68 | if (ch == "-" && stream.eat(">")) { |
| 69 | curPunc = "->"; |
| 70 | return null; |
| 71 | } |
| 72 | if (/[\-+*&%=<>!?|\/~]/.test(ch)) { |
| 73 | stream.eatWhile(/[\-+*&%=<>|~]/); |
| 74 | return "operator"; |
| 75 | } |
| 76 | stream.eatWhile(/[\w\$_]/); |
| 77 | |
| 78 | var cur = stream.current(); |
| 79 | if (atoms.propertyIsEnumerable(cur)) { |
| 80 | return "atom"; |
| 81 | } |
| 82 | if (softKeywords.propertyIsEnumerable(cur)) { |
| 83 | if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; |
| 84 | return "softKeyword"; |
| 85 | } |
| 86 | |
| 87 | if (keywords.propertyIsEnumerable(cur)) { |
| 88 | if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement"; |
| 89 | return "keyword"; |
| 90 | } |
| 91 | return "word"; |
no test coverage detected