| 88 | return f(stream, state); |
| 89 | } |
| 90 | function tokenBase(stream, state) { |
| 91 | var beforeParams = state.beforeParams; |
| 92 | state.beforeParams = false; |
| 93 | var ch = stream.next(); |
| 94 | if (/[\[\]{}\(\),\.]/.test(ch)) { |
| 95 | if (ch == "(" && beforeParams) state.inParams = true; |
| 96 | else if (ch == ")") state.inParams = false; |
| 97 | return null; |
| 98 | } |
| 99 | else if (/\d/.test(ch)) { |
| 100 | stream.eatWhile(/[\w\.]/); |
| 101 | return "number"; |
| 102 | } |
| 103 | else if (ch == "\\") { |
| 104 | stream.eat("\\"); |
| 105 | stream.eat(/./); |
| 106 | return "number"; |
| 107 | } |
| 108 | else if (ch == "/" && stream.eat("*")) { |
| 109 | return chain(stream, state, tokenComment); |
| 110 | } |
| 111 | else if (ch == ";" && stream.match(/ *\( *\(/)) { |
| 112 | return chain(stream, state, tokenUnparsed); |
| 113 | } |
| 114 | else if (ch == ";" && !state.inParams) { |
| 115 | stream.skipToEnd(); |
| 116 | return "comment"; |
| 117 | } |
| 118 | else if (ch == '"') { |
| 119 | stream.eat(/"/); |
| 120 | return "keyword"; |
| 121 | } |
| 122 | else if (ch == "$") { |
| 123 | stream.eatWhile(/[$_a-z0-9A-Z\.:]/); |
| 124 | if (specials && specials.propertyIsEnumerable(stream.current().toLowerCase())) { |
| 125 | return "keyword"; |
| 126 | } |
| 127 | else { |
| 128 | state.beforeParams = true; |
| 129 | return "builtin"; |
| 130 | } |
| 131 | } |
| 132 | else if (ch == "%") { |
| 133 | stream.eatWhile(/[^,^\s^\(^\)]/); |
| 134 | state.beforeParams = true; |
| 135 | return "string"; |
| 136 | } |
| 137 | else if (isOperatorChar.test(ch)) { |
| 138 | stream.eatWhile(isOperatorChar); |
| 139 | return "operator"; |
| 140 | } |
| 141 | else { |
| 142 | stream.eatWhile(/[\w\$_{}]/); |
| 143 | var word = stream.current().toLowerCase(); |
| 144 | if (keywords && keywords.propertyIsEnumerable(word)) |
| 145 | return "keyword"; |
| 146 | if (functions && functions.propertyIsEnumerable(word)) { |
| 147 | state.beforeParams = true; |