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

Function dedent

tools/pythonauto/static/codemirror/python.js:233–264  ·  view source on GitHub ↗
(stream, state, type)

Source from the content-addressed store, hash-verified

231 }
232
233 function dedent(stream, state, type) {
234 type = type || 'py';
235 if (state.scopes.length == 1) return;
236 if (state.scopes[0].type === 'py') {
237 var _indent = stream.indentation();
238 var _indent_index = -1;
239 for (var i = 0; i < state.scopes.length; ++i) {
240 if (_indent === state.scopes[i].offset) {
241 _indent_index = i;
242 break;
243 }
244 }
245 if (_indent_index === -1) {
246 return true;
247 }
248 while (state.scopes[0].offset !== _indent) {
249 state.scopes.shift();
250 }
251 return false;
252 } else {
253 if (type === 'py') {
254 state.scopes[0].offset = stream.indentation();
255 return false;
256 } else {
257 if (state.scopes[0].type != type) {
258 return true;
259 }
260 state.scopes.shift();
261 return false;
262 }
263 }
264 }
265
266 function tokenLexer(stream, state) {
267 indentInfo = null;

Callers 3

tokenBaseFunction · 0.70
tokenLexerFunction · 0.70
SubRipShifterClass · 0.50

Calls 1

shiftMethod · 0.45

Tested by

no test coverage detected