Skip to content

Commit

Permalink
Merge pull request #1302 from richardxia/fix-v-args-meta-documentation
Browse files Browse the repository at this point in the history
Improve documentation of `v_args` `meta` option.
  • Loading branch information
erezsh authored Jul 19, 2023
2 parents e4df024 + fc5da22 commit 3d9f4a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lark/visitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ def v_args(inline: bool = False, meta: bool = False, tree: bool = False, wrapper
Parameters:
inline (bool, optional): Children are provided as ``*args`` instead of a list argument (not recommended for very long lists).
meta (bool, optional): Provides two arguments: ``children`` and ``meta`` (instead of just the first)
meta (bool, optional): Provides two arguments: ``meta`` and ``children`` (instead of just the latter)
tree (bool, optional): Provides the entire tree as the argument, instead of the children.
wrapper (function, optional): Provide a function to decorate all methods.
Expand All @@ -532,6 +532,12 @@ class SolveArith(Transformer):
def add(self, left, right):
return left + right
@v_args(meta=True)
def mul(self, meta, children):
logger.info(f'mul at line {meta.line}')
left, right = children
return left * right
class ReverseNotation(Transformer_InPlace):
@v_args(tree=True)
Expand Down

0 comments on commit 3d9f4a2

Please sign in to comment.