diff --git a/examples/error_reporting_lalr.py b/examples/error_reporting_lalr.py index 0e355af..5e7d967 100644 --- a/examples/error_reporting_lalr.py +++ b/examples/error_reporting_lalr.py @@ -60,14 +60,14 @@ def parse(json_text): def test(): try: - parse('{"key": "value"') - except JsonMissingClosing: - pass + parse('{"example1": "value"') + except JsonMissingClosing as e: + print(e) try: - parse('{"key": ] ') - except JsonMissingOpening: - pass + parse('{"example2": ] ') + except JsonMissingOpening as e: + print(e) if __name__ == '__main__': diff --git a/lark/exceptions.py b/lark/exceptions.py index 7bf1a78..cfb988f 100644 --- a/lark/exceptions.py +++ b/lark/exceptions.py @@ -13,7 +13,7 @@ class LexError(LarkError): pass class UnexpectedInput(LarkError): - def get_context(self, text, span=10): + def get_context(self, text, span=40): pos = self.pos_in_stream start = max(pos - span, 0) end = pos + span