benilla-re systems structs docs

capture_to_close

function · lua · boundary

Address
0x7fcdb0 · 47 bytes, up to 0x7fcdde
Meaning
Returns the index of the innermost capture that is still open
Confidence
verified, proof one
Finding
lua/libs#pattern-matching

Finding: Pattern matching in lua: the libraries

match tries a pattern at a position and answers the end of the match or null. It dispatches on the pattern character: ( and ) to start_capture and end_capture, %b to matchbalance, %f to a frontier test, %1 to %9 to match_capture, $ at the end, and a single-character class followed by *, +, - or ? to max_expand, min_expand or a trial of the rest. A pattern holds at most 32 captures. check_capture validates a %n index and capture_to_close finds the open capture a ) closes.

functionnamedecided by
0x7fc570matchdispatch on the pattern character (0x7fc584), the %b and %f cases (0x7fc59e, 0x7fc5a6)
0x7fcc50max_expandluaI_singlematch loop (0x7fcc71), match on the rest (0x7fcc9a)
0x7fccc0min_expandmatch first (0x7fccd1), then luaI_singlematch (0x7fccef) and match again (0x7fccfe)
0x7fcd20start_capturelimit 32 (0x7fcd2b), too many captures (0x7fcd35), match (0x7fcd5a)
0x7fcd70end_capturecapture_to_close (0x7fcd7a), match (0x7fcd95)
0x7fcdb0capture_to_closescans for a length of -1 (0x7fcdc0), invalid pattern capture (0x7fcdd0)
0x7fcde0match_capturecheck_capture (0x7fcdec), length compare and byte compare
0x7fce20check_captureindex n - 0x31 below the level (0x7fce2c), invalid capture index (0x7fce36)

The derivation is in the doc.

Callers 1

Callees 1

Calls and jumps by a bare address, from tables/calls.tsv.