| 254 | }; |
| 255 | |
| 256 | var tokenLexer = function(stream, state) { |
| 257 | |
| 258 | if (stream.sol()) { |
| 259 | state.indentCount = 0; |
| 260 | } |
| 261 | |
| 262 | var style = state.tokenizer(stream, state); |
| 263 | var current = stream.current(); |
| 264 | |
| 265 | if (stream.eol() && (current === "}" || current === ",")) { |
| 266 | dedent(state); |
| 267 | } |
| 268 | |
| 269 | if (style !== null) { |
| 270 | var startOfToken = stream.pos - current.length; |
| 271 | var withCurrentIndent = startOfToken + (config.indentUnit * state.indentCount); |
| 272 | |
| 273 | var newScopes = []; |
| 274 | |
| 275 | for (var i = 0; i < state.scopes.length; i++) { |
| 276 | var scope = state.scopes[i]; |
| 277 | |
| 278 | if (scope.offset <= withCurrentIndent) { |
| 279 | newScopes.push(scope); |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | state.scopes = newScopes; |
| 284 | } |
| 285 | |
| 286 | return style; |
| 287 | }; |
| 288 | |
| 289 | return { |
| 290 | startState: function() { |