MCPcopy Create free account
hub / github.com/ipython/ipython / get_tokens_unprocessed

Method get_tokens_unprocessed

IPython/lib/lexers.py:477–494  ·  view source on GitHub ↗
(self, text)

Source from the content-addressed store, hash-verified

475 return mode, code, insertion
476
477 def get_tokens_unprocessed(self, text):
478 self.reset()
479 for match in line_re.finditer(text):
480 line = match.group()
481 mode, code, insertion = self.get_mci(line)
482
483 if mode != self.mode:
484 # Yield buffered tokens before transitioning to new mode.
485 for token in self.buffered_tokens():
486 yield token
487 self.mode = mode
488
489 if insertion:
490 self.insertions.append((len(self.buffer), [insertion]))
491 self.buffer += code
492
493 for token in self.buffered_tokens():
494 yield token
495
496class IPyLexer(Lexer):
497 r"""

Callers

nothing calls this directly

Calls 4

resetMethod · 0.95
get_mciMethod · 0.95
buffered_tokensMethod · 0.95
groupMethod · 0.80

Tested by

no test coverage detected