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