(stream, state, type)
| 210 | } |
| 211 | |
| 212 | function dedent(stream, state, type) { |
| 213 | type = type || 'py'; |
| 214 | if (state.scopes.length == 1) return; |
| 215 | if (state.scopes[0].type === 'py') { |
| 216 | var _indent = stream.indentation(); |
| 217 | var _indent_index = -1; |
| 218 | for (var i = 0; i < state.scopes.length; ++i) { |
| 219 | if (_indent === state.scopes[i].offset) { |
| 220 | _indent_index = i; |
| 221 | break; |
| 222 | } |
| 223 | } |
| 224 | if (_indent_index === -1) { |
| 225 | return true; |
| 226 | } |
| 227 | while (state.scopes[0].offset !== _indent) { |
| 228 | state.scopes.shift(); |
| 229 | } |
| 230 | return false |
| 231 | } else { |
| 232 | if (type === 'py') { |
| 233 | state.scopes[0].offset = stream.indentation(); |
| 234 | return false; |
| 235 | } else { |
| 236 | if (state.scopes[0].type != type) { |
| 237 | return true; |
| 238 | } |
| 239 | state.scopes.shift(); |
| 240 | return false; |
| 241 | } |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | function tokenLexer(stream, state) { |
| 246 | indentInfo = null; |
no outgoing calls
no test coverage detected