| 195 | } |
| 196 | |
| 197 | function indent(stream, state, type) { |
| 198 | type = type || 'py'; |
| 199 | var indentUnit = 0; |
| 200 | if (type === 'py') { |
| 201 | if (state.scopes[0].type !== 'py') { |
| 202 | state.scopes[0].offset = stream.indentation(); |
| 203 | return; |
| 204 | } |
| 205 | for (var i = 0; i < state.scopes.length; ++i) { |
| 206 | if (state.scopes[i].type === 'py') { |
| 207 | indentUnit = state.scopes[i].offset + conf.indentUnit; |
| 208 | break; |
| 209 | } |
| 210 | } |
| 211 | } else { |
| 212 | indentUnit = stream.column() + stream.current().length; |
| 213 | } |
| 214 | state.scopes.unshift({ |
| 215 | offset: indentUnit, |
| 216 | type: type |
| 217 | }); |
| 218 | } |
| 219 | |
| 220 | function dedent(stream, state, type) { |
| 221 | type = type || 'py'; |