This repo contains code to mirror other repos. It also contains the code that is getting mirrored.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

76 行
1.8 KiB

  1. API Reference
  2. =============
  3. Lark
  4. ----
  5. .. autoclass:: lark.Lark
  6. :members: open, parse, save, load
  7. Using Unicode character classes with ``regex``
  8. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  9. Python's builtin ``re`` module has a few persistent known bugs and also won't parse
  10. advanced regex features such as character classes.
  11. With ``pip install lark-parser[regex]``, the ``regex`` module will be
  12. installed alongside lark and can act as a drop-in replacement to ``re``.
  13. Any instance of Lark instantiated with ``regex=True`` will use the ``regex`` module instead of ``re``.
  14. For example, we can use character classes to match PEP-3131 compliant Python identifiers:
  15. ::
  16. from lark import Lark
  17. >>> g = Lark(r"""
  18. ?start: NAME
  19. NAME: ID_START ID_CONTINUE*
  20. ID_START: /[\p{Lu}\p{Ll}\p{Lt}\p{Lm}\p{Lo}\p{Nl}_]+/
  21. ID_CONTINUE: ID_START | /[\p{Mn}\p{Mc}\p{Nd}\p{Pc}·]+/
  22. """, regex=True)
  23. >>> g.parse('வணக்கம்')
  24. 'வணக்கம்'
  25. Tree
  26. ----
  27. .. autoclass:: lark.Tree
  28. :members: pretty, find_pred, find_data, iter_subtrees,
  29. iter_subtrees_topdown
  30. Token
  31. -----
  32. .. autoclass:: lark.Token
  33. Transformer, Visitor & Interpreter
  34. ----------------------------------
  35. See :doc:`visitors`.
  36. ForestVisitor, ForestTransformer, & TreeForestTransformer
  37. -----------------------------------------------------------
  38. See :doc:`forest`.
  39. UnexpectedInput
  40. ---------------
  41. .. autoclass:: lark.exceptions.UnexpectedInput
  42. :members: get_context, match_examples
  43. .. autoclass:: lark.exceptions.UnexpectedToken
  44. .. autoclass:: lark.exceptions.UnexpectedCharacters
  45. .. _parserpuppet:
  46. ParserPuppet
  47. ------------
  48. .. autoclass:: lark.parsers.lalr_puppet.ParserPuppet
  49. :members: choices, feed_token, copy, pretty, resume_parse