MCPcopy
hub / github.com/tirth8205/code-review-graph / _r_iter_args

Method _r_iter_args

code_review_graph/parser.py:6715–6738  ·  view source on GitHub ↗

Yield (name_str, value_node) pairs from an R call's arguments.

(call_node)

Source from the content-addressed store, hash-verified

6713
6714 @staticmethod
6715 def _r_iter_args(call_node):
6716 """Yield (name_str, value_node) pairs from an R call's arguments."""
6717 for child in call_node.children:
6718 if child.type != "arguments":
6719 continue
6720 for arg in child.children:
6721 if arg.type != "argument":
6722 continue
6723 has_eq = any(sub.type == "=" for sub in arg.children)
6724 if has_eq:
6725 name = None
6726 value = None
6727 for sub in arg.children:
6728 if sub.type == "identifier" and name is None:
6729 name = sub.text.decode("utf-8", errors="replace")
6730 elif sub.type not in ("=", ","):
6731 value = sub
6732 yield (name, value)
6733 else:
6734 for sub in arg.children:
6735 if sub.type not in (",",):
6736 yield (None, sub)
6737 break
6738 break
6739
6740 @classmethod
6741 def _r_find_named_arg(cls, call_node, arg_name: str):

Callers 3

_extract_importMethod · 0.95
_extract_r_methodsMethod · 0.95
_r_find_named_argMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected