This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.0 KiB

  1. Transformers & Visitors
  2. =======================
  3. Transformers & Visitors provide a convenient interface to process the
  4. parse-trees that Lark returns.
  5. They are used by inheriting from the correct class (visitor or transformer),
  6. and implementing methods corresponding to the rule you wish to process. Each
  7. method accepts the children as an argument. That can be modified using the
  8. ``v_args`` decorator, which allows to inline the arguments (akin to ``*args``),
  9. or add the tree ``meta`` property as an argument.
  10. See: `visitors.py`_
  11. .. _visitors.py: https://github.com/lark-parser/lark/blob/master/lark/visitors.py
  12. Visitor
  13. -------
  14. .. autoclass:: lark.visitors.VisitorBase
  15. .. autoclass:: lark.visitors.Visitor
  16. .. autoclass:: lark.visitors.Visitor_Recursive
  17. Transformer
  18. -----------
  19. .. autoclass:: lark.visitors.Transformer
  20. :members: __default__, __default_token__
  21. Interpreter
  22. -----------
  23. .. autoclass:: lark.visitors.Interpreter
  24. v_args
  25. ------
  26. .. autofunction:: lark.visitors.v_args
  27. Discard
  28. -------
  29. .. autoclass:: lark.visitors.Discard