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

Function _split_specifiers

Scripts/parse_headers.py:122–151  ·  view source on GitHub ↗

Split on top-level commas (respecting parens and quotes).

(s: str)

Source from the content-addressed store, hash-verified

120# ──────────────────────────────────────────────────────────────────────────────
121
122def _split_specifiers(s: str) -> list:
123 """Split on top-level commas (respecting parens and quotes)."""
124 parts = []
125 depth = 0
126 in_quote = False
127 quote_char = None
128 current = []
129 for ch in s:
130 if in_quote:
131 current.append(ch)
132 if ch == quote_char:
133 in_quote = False
134 elif ch in ('"', "'"):
135 in_quote = True
136 quote_char = ch
137 current.append(ch)
138 elif ch == '(':
139 depth += 1
140 current.append(ch)
141 elif ch == ')':
142 depth -= 1
143 current.append(ch)
144 elif ch == ',' and depth == 0:
145 parts.append(''.join(current))
146 current = []
147 else:
148 current.append(ch)
149 if current:
150 parts.append(''.join(current))
151 return parts
152
153def _parse_specifiers(args: str) -> dict:
154 result = {}

Callers 2

_parse_specifiersFunction · 0.85
_parse_bodyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected