MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / _parse_block_body

Function _parse_block_body

Scripts/codegen/build_mjxmacro_snapshot.py:129–145  ·  view source on GitHub ↗

Collect the entries of a block starting at ``start_idx``. Returns the entry lines as raw strings (each looks like ``X ( ... )`` or ``XVEC ( ... )``). Stops at the first non-entry, non-empty line.

(lines: List[str], start_idx: int)

Source from the content-addressed store, hash-verified

127
128
129def _parse_block_body(lines: List[str], start_idx: int) -> List[str]:
130 """Collect the entries of a block starting at ``start_idx``. Returns
131 the entry lines as raw strings (each looks like ``X ( ... )`` or
132 ``XVEC ( ... )``). Stops at the first non-entry, non-empty line."""
133 out: List[str] = []
134 i = start_idx
135 while i < len(lines):
136 line = lines[i]
137 stripped = line.strip()
138 if not stripped:
139 break
140 if _BODY_ENTRY_RE.match(stripped):
141 out.append(stripped.rstrip("\\").rstrip())
142 i += 1
143 continue
144 break
145 return out
146
147
148def _split_csv(tup: str) -> List[str]:

Callers 2

parse_mjxmacroFunction · 0.85

Calls

no outgoing calls

Tested by 1