MCPcopy Index your code
hub / github.com/python/cpython / parser_body

Method parser_body

Tools/clinic/libclinic/parse_args.py:349–381  ·  view source on GitHub ↗
(
        self,
        *fields: str,
        declarations: str = ''
    )

Source from the content-addressed store, hash-verified

347 self.limited_capi = False
348
349 def parser_body(
350 self,
351 *fields: str,
352 declarations: str = ''
353 ) -> None:
354 lines = [self.parser_prototype]
355 self.parser_body_fields = fields
356
357 preamble = libclinic.normalize_snippet("""
358 {{
359 {return_value_declaration}
360 {parser_declarations}
361 {declarations}
362 {initializers}
363 """) + "\n"
364 finale = libclinic.normalize_snippet("""
365 {modifications}
366 {lock}
367 {return_value} = {c_basename}_impl({impl_arguments});
368 {unlock}
369 {return_conversion}
370 {post_parsing}
371
372 {exit_label}
373 {cleanup}
374 return return_value;
375 }}
376 """)
377 for field in preamble, *fields, finale:
378 lines.append(field)
379 code = libclinic.linear_format("\n".join(lines),
380 parser_declarations=self.declarations)
381 self.parser_definition = code
382
383 def parse_no_args(self) -> None:
384 parser_code: list[str] | None

Callers 7

parse_no_argsMethod · 0.95
parse_one_argMethod · 0.95
parse_option_groupsMethod · 0.95
parse_pos_onlyMethod · 0.95
parse_var_keywordMethod · 0.95
parse_generalMethod · 0.95
handle_new_or_initMethod · 0.95

Calls 2

appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected