projects
/
ton
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Parse binaries and UTF strings with leading whitespace
[ton]
/
don
/
string.py
diff --git
a/don/string.py
b/don/string.py
index
f77eab7
..
0a324cb
100644
(file)
--- a/
don/string.py
+++ b/
don/string.py
@@
-136,6
+136,7
@@
def _binary64_parser(s):
_BINARY_MATCHER = re.compile(r'"([\da-f]*)"b')
_BINARY_MATCHER = re.compile(r'"([\da-f]*)"b')
+@_consume_leading_whitespace
def _binary_parser(s):
match = _BINARY_MATCHER.match(s)
def _binary_parser(s):
match = _BINARY_MATCHER.match(s)
@@
-151,7
+152,8
@@
def _binary_parser(s):
def _make_utf_parser(encoding):
matcher = re.compile(r'"(.*?)"' + encoding)
def _make_utf_parser(encoding):
matcher = re.compile(r'"(.*?)"' + encoding)
- def parser(s):
+ @_consume_leading_whitespace
+ def utf_parser(s):
match = matcher.match(s)
if match:
match = matcher.match(s)
if match:
@@
-163,7
+165,7
@@
def _make_utf_parser(encoding):
return _shared._FAILED_PARSE_RESULT
return _shared._FAILED_PARSE_RESULT
- return parser
+ return
utf_
parser
def _prefix_with_comma(parser):
def wrapped(s):
def _prefix_with_comma(parser):
def wrapped(s):