This website works better with JavaScript.
Home
Explore
Help
Sign In
jmg
/
gitmirror
Watch
1
Star
0
Fork
0
Code
Issues
0
Pull Requests
0
Releases
39
Wiki
Activity
Browse Source
Fixed examples for error reporting
tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.6.0
Erez Shinan
6 years ago
parent
d11c67fea0
commit
e7212261b2
2 changed files
with
7 additions
and
7 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+6
-6
examples/error_reporting_lalr.py
+1
-1
lark/exceptions.py
+ 6
- 6
examples/error_reporting_lalr.py
View File
@@ -60,14 +60,14 @@ def parse(json_text):
def test():
try:
parse('{"
key
": "value"')
except JsonMissingClosing:
p
ass
parse('{"
example1
": "value"')
except JsonMissingClosing
as e
:
p
rint(e)
try:
parse('{"
key
": ] ')
except JsonMissingOpening:
p
ass
parse('{"
example2
": ] ')
except JsonMissingOpening
as e
:
p
rint(e)
if __name__ == '__main__':
+ 1
- 1
lark/exceptions.py
View File
@@ -13,7 +13,7 @@ class LexError(LarkError):
pass
class UnexpectedInput(LarkError):
def get_context(self, text, span=
1
0):
def get_context(self, text, span=
4
0):
pos = self.pos_in_stream
start = max(pos - span, 0)
end = pos + span
Write
Preview
Loading…
Cancel
Save