(stream, state)
| 247 | } |
| 248 | |
| 249 | function tokenLexer(stream, state) { |
| 250 | var style = state.tokenize(stream, state); |
| 251 | var current = stream.current(); |
| 252 | |
| 253 | // Handle '.' connected identifiers |
| 254 | if (current === '.') { |
| 255 | style = state.tokenize(stream, state); |
| 256 | current = stream.current(); |
| 257 | if (style === 'variable') { |
| 258 | return 'variable'; |
| 259 | } else { |
| 260 | return ERRORCLASS; |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | // Handle properties |
| 265 | if (current === '@') { |
| 266 | stream.eat('@'); |
| 267 | return 'keyword'; |
| 268 | } |
| 269 | |
| 270 | // Handle scope changes. |
| 271 | if (current === 'return') { |
| 272 | state.dedent += 1; |
| 273 | } |
| 274 | if (((current === '->' || current === '=>') && |
| 275 | !state.lambda && |
| 276 | state.scopes[0].type == 'coffee' && |
| 277 | stream.peek() === '') |
| 278 | || style === 'indent') { |
| 279 | indent(stream, state); |
| 280 | } |
| 281 | var delimiter_index = '[({'.indexOf(current); |
| 282 | if (delimiter_index !== -1) { |
| 283 | indent(stream, state, '])}'.slice(delimiter_index, delimiter_index+1)); |
| 284 | } |
| 285 | if (indentKeywords.exec(current)){ |
| 286 | indent(stream, state); |
| 287 | } |
| 288 | if (current == 'then'){ |
| 289 | dedent(stream, state); |
| 290 | } |
| 291 | |
| 292 | |
| 293 | if (style === 'dedent') { |
| 294 | if (dedent(stream, state)) { |
| 295 | return ERRORCLASS; |
| 296 | } |
| 297 | } |
| 298 | delimiter_index = '])}'.indexOf(current); |
| 299 | if (delimiter_index !== -1) { |
| 300 | if (dedent(stream, state)) { |
| 301 | return ERRORCLASS; |
| 302 | } |
| 303 | } |
| 304 | if (state.dedent > 0 && stream.eol() && state.scopes[0].type == 'coffee') { |
| 305 | if (state.scopes.length > 1) state.scopes.shift(); |
| 306 | state.dedent -= 1; |
no test coverage detected