MCPcopy Create free account
hub / github.com/davidblewett/rure-python / capture_names

Method capture_names

rure/lib.py:105–118  ·  view source on GitHub ↗

An iterator over the names of all possible captures. None indicates an unnamed capture; the first element (capture 0, the whole matched region) is always unnamed.

(self)

Source from the content-addressed store, hash-verified

103 return _native.lib.rure_capture_name_index(self._ptr, name)
104
105 def capture_names(self):
106 """ An iterator over the names of all possible captures.
107 None indicates an unnamed capture; the first element (capture 0,
108 the whole matched region) is always unnamed.
109 """
110 cn_iter = _native.ffi.gc(_native.lib.rure_iter_capture_names_new(self._ptr),
111 _native.lib.rure_iter_capture_names_free)
112 ptr = _native.ffi.new('char **')
113 while _native.lib.rure_iter_capture_names_next(cn_iter, ptr):
114 name = _native.ffi.string(ptr[0])
115 if name:
116 yield name
117 else:
118 yield None
119
120 @accepts_bytes
121 def is_match(self, haystack, start=0):

Callers 2

__init__Method · 0.95

Calls 1

newMethod · 0.45

Tested by 1