MCPcopy Index your code
hub / github.com/csev/py4e / indent

Function indent

tools/pythonauto/static/codemirrorepl/python.js:197–218  ·  view source on GitHub ↗
(stream, state, type)

Source from the content-addressed store, hash-verified

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';

Callers 1

tokenLexerFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected