MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / getstrcaps

Function getstrcaps

other_src/lua/src/lpeg.cpp:2063–2084  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2061#define MAXSTRCAPS 10
2062
2063static int getstrcaps (CapState *cs, StrAux *cps, int n) {
2064 int k = n++;
2065 cps[k].isstring = 1;
2066 cps[k].u.s.s = cs->cap->s;
2067 if (!isfullcap(cs->cap++)) {
2068 while (!isclosecap(cs->cap)) {
2069 if (n >= MAXSTRCAPS) /* too many captures? */
2070 cs->cap = nextcap(cs->cap); /* skip it */
2071 else if (captype(cs->cap) == Csimple)
2072 n = getstrcaps(cs, cps, n);
2073 else {
2074 cps[n].isstring = 0;
2075 cps[n].u.cp = cs->cap;
2076 cs->cap = nextcap(cs->cap);
2077 n++;
2078 }
2079 }
2080 cs->cap++; /* skip close */
2081 }
2082 cps[k].u.s.e = closeaddr(cs->cap - 1);
2083 return n;
2084}
2085
2086
2087/*

Callers 1

stringcapFunction · 0.85

Calls 1

nextcapFunction · 0.85

Tested by

no test coverage detected