Fixed examples for error reporting

This commit is contained in:
Erez Shinan 2018-06-27 17:04:23 +03:00
parent d11c67fea0
commit e7212261b2
2 changed files with 7 additions and 7 deletions

View File

@ -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__':

View File

@ -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