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

Function _parse_till_unescaped_char

pythonx/UltiSnips/snippet/parsing/lexer.py:91–110  ·  view source on GitHub ↗

Returns all chars till a non-escaped char is found. Will also consume the closing char, but and return it as second return value

(stream, chars)

Source from the content-addressed store, hash-verified

89
90
91def _parse_till_unescaped_char(stream, chars):
92 """
93 Returns all chars till a non-escaped char is found.
94
95 Will also consume the closing char, but and return it as second
96 return value
97 """
98 rv = ""
99 while True:
100 escaped = False
101 for char in chars:
102 if EscapeCharToken.starts_here(stream, char):
103 rv += next(stream) + next(stream)
104 escaped = True
105 if not escaped:
106 char = next(stream)
107 if char in chars:
108 break
109 rv += char
110 return rv, char
111
112
113class Token:

Callers 6

_parseMethod · 0.85
_parseMethod · 0.85
_parseMethod · 0.85
_parseMethod · 0.85
_parseMethod · 0.85
_parseMethod · 0.85

Calls 1

starts_hereMethod · 0.45

Tested by

no test coverage detected