| 187 | } |
| 188 | |
| 189 | function indent(stream, state, type) { |
| 190 | type = type || 'py'; |
| 191 | var indentUnit = 0; |
| 192 | if (type === 'py') { |
| 193 | if (state.scopes[0].type !== 'py') { |
| 194 | state.scopes[0].offset = stream.indentation(); |
| 195 | return; |
| 196 | } |
| 197 | for (var i = 0; i < state.scopes.length; ++i) { |
| 198 | if (state.scopes[i].type === 'py') { |
| 199 | indentUnit = state.scopes[i].offset + conf.indentUnit; |
| 200 | break; |
| 201 | } |
| 202 | } |
| 203 | } else { |
| 204 | indentUnit = stream.column() + stream.current().length; |
| 205 | } |
| 206 | state.scopes.unshift({ |
| 207 | offset: indentUnit, |
| 208 | type: type |
| 209 | }); |
| 210 | } |
| 211 | |
| 212 | function dedent(stream, state, type) { |
| 213 | type = type || 'py'; |