Parse the given text, according to the options provided. Parameters: text (str): Text to be parsed. start (str, optional): Required if Lark was given multiple possible start symbols (using the start option). on_error (function, optional): if provided, wil
(self, text: str, start: Optional[str]=None, on_error: 'Optional[Callable[[UnexpectedInput], bool]]'=None)
| 635 | return self.parser.parse_interactive(text, start=start) |
| 636 | |
| 637 | def parse(self, text: str, start: Optional[str]=None, on_error: 'Optional[Callable[[UnexpectedInput], bool]]'=None) -> 'ParseTree': |
| 638 | """Parse the given text, according to the options provided. |
| 639 | |
| 640 | Parameters: |
| 641 | text (str): Text to be parsed. |
| 642 | start (str, optional): Required if Lark was given multiple possible start symbols (using the start option). |
| 643 | on_error (function, optional): if provided, will be called on UnexpectedToken error. Return true to resume parsing. |
| 644 | LALR only. See examples/advanced/error_handling.py for an example of how to use on_error. |
| 645 | |
| 646 | Returns: |
| 647 | If a transformer is supplied to ``__init__``, returns whatever is the |
| 648 | result of the transformation. Otherwise, returns a Tree instance. |
| 649 | |
| 650 | :raises UnexpectedInput: On a parse error, one of these sub-exceptions will rise: |
| 651 | ``UnexpectedCharacters``, ``UnexpectedToken``, or ``UnexpectedEOF``. |
| 652 | For convenience, these sub-exceptions also inherit from ``ParserError`` and ``LexerError``. |
| 653 | |
| 654 | """ |
| 655 | return self.parser.parse(text, start=start, on_error=on_error) |
| 656 | |
| 657 | |
| 658 | ###} |
no outgoing calls
no test coverage detected