From 4545fc6b450d580e34245ec28b3d36f018c6f3e7 Mon Sep 17 00:00:00 2001 From: skepppy <> Date: Thu, 29 Aug 2024 13:26:29 +0200 Subject: [PATCH 1/2] Rephrase `v_args()` documentation to underline it is only applicable to `Transformer` class definitions. --- lark/visitors.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lark/visitors.py b/lark/visitors.py index 18455d9e..6425162c 100644 --- a/lark/visitors.py +++ b/lark/visitors.py @@ -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 visitor methods of ``Transformer`` classes. - By default, callback methods of transformers/visitors accept one argument - a list of the node's children. + By default, visitor 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. From b4a83f850e49a96c4c8ec18ada86631c2223d6d5 Mon Sep 17 00:00:00 2001 From: Mick Koomen Date: Thu, 29 Aug 2024 16:00:06 +0200 Subject: [PATCH 2/2] Rephrase `v_args()` documentation. --- lark/visitors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lark/visitors.py b/lark/visitors.py index 6425162c..0e051ed9 100644 --- a/lark/visitors.py +++ b/lark/visitors.py @@ -511,9 +511,9 @@ 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 of ``Transformer`` classes. + """A convenience decorator factory for modifying the behavior of user-supplied callback methods of ``Transformer`` classes. - By default, visitor callback methods 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`` class definition, it applies to all the callback methods inside it.