MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / pl_code_open

Function pl_code_open

internal/cbm/doclink_perl.c:182–204  ·  view source on GitHub ↗

A code opens at t[i]: push it and return where its content starts. */

Source from the content-addressed store, hash-verified

180
181/* A code opens at t[i]: push it and return where its content starts. */
182static size_t pl_code_open(pl_codes_t *st, const char *t, size_t i, size_t e, bool *pushed) {
183 size_t j = i + SKIP_ONE;
184 while (j < e && t[j] == '<') {
185 j++;
186 }
187 size_t brackets = j - i - SKIP_ONE;
188 size_t content = i + PAIR_LEN;
189 size_t width = SKIP_ONE;
190 if (brackets >= PAIR_LEN && j < e && pl_space(t[j])) {
191 while (j < e && pl_space(t[j])) {
192 j++;
193 }
194 content = j;
195 width = brackets > UINT8_MAX ? UINT8_MAX : brackets;
196 }
197 *pushed = st->depth < PL_CODE_DEPTH;
198 if (*pushed) {
199 st->width[st->depth++] = (uint8_t)width;
200 } else {
201 st->overflow = true;
202 }
203 return content;
204}
205
206/* One lexing step at t[i], i < e (Pod::Simple's treelet tokens).
207 * PL_EV_OPEN a code opened at t[i]; its content starts at *next

Callers 1

pl_code_stepFunction · 0.85

Calls 1

pl_spaceFunction · 0.85

Tested by

no test coverage detected