MCPcopy
hub / github.com/SirVer/ultisnips / _parse

Method _parse

pythonx/UltiSnips/snippet/parsing/lexer.py:351–366  ·  view source on GitHub ↗
(self, stream, indent)

Source from the content-addressed store, hash-verified

349 return cls.CHECK.match(stream.peek(4)) is not None
350
351 def _parse(self, stream, indent):
352 for _ in range(3):
353 next(stream) # `!p
354 if stream.peek() in "\t ":
355 next(stream)
356
357 code = _parse_till_unescaped_char(stream, "`")[0]
358
359 # Strip the indent if any
360 if len(indent):
361 lines = code.splitlines()
362 self.code = lines[0] + "\n"
363 self.code += "\n".join([l[len(indent) :] for l in lines[1:]])
364 else:
365 self.code = code
366 self.indent = indent
367
368 def __repr__(self):
369 return f"PythonCodeToken({self.start!r},{self.end!r},{self.code!r})"

Callers

nothing calls this directly

Calls 2

peekMethod · 0.45

Tested by

no test coverage detected