Skip to content

Commit

Permalink
Merge pull request #1458 from skepppy/fix-vargs-docs-issue-1457
Browse files Browse the repository at this point in the history
Docs: Rephrase v_args() documentation to underline it only applies to Transformer classes
  • Loading branch information
erezsh authored Aug 29, 2024
2 parents acfe33d + b4a83f8 commit 414e40f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lark/visitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,12 +511,12 @@ def _vargs_tree(f, data, children, meta):


def v_args(inline: bool = False, meta: bool = False, tree: bool = False, wrapper: Optional[Callable] = None) -> Callable[[_DECORATED], _DECORATED]:
"""A convenience decorator factory for modifying the behavior of user-supplied visitor methods.
"""A convenience decorator factory for modifying the behavior of user-supplied callback methods of ``Transformer`` classes.
By default, callback methods of transformers/visitors accept one argument - a list of the node's children.
By default, transformer callback methods accept one argument - a list of the node's children.
``v_args`` can modify this behavior. When used on a transformer/visitor class definition,
it applies to all the callback methods inside it.
``v_args`` can modify this behavior. When used on a ``Transformer`` class definition, it applies to
all the callback methods inside it.
``v_args`` can be applied to a single method, or to an entire class. When applied to both,
the options given to the method take precedence.
Expand Down

0 comments on commit 414e40f

Please sign in to comment.