diff options
author | Anthon van der Neut <anthon@mnt.org> | 2016-11-13 11:54:19 +0100 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2016-11-13 11:54:19 +0100 |
commit | 51dfde5d2dc2d568478387104ba0c6398ffa4b60 (patch) | |
tree | 58f064c690f27d65c5855c242ad1222b157b73b4 /compat.py | |
parent | b96e72c24f8d3a9e2902ba70c653664aad18ec7b (diff) | |
download | ruamel.yaml-51dfde5d2dc2d568478387104ba0c6398ffa4b60.tar.gz |
fix for issue #72, dot allowed in anchor
Diffstat (limited to 'compat.py')
-rw-r--r-- | compat.py | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -120,3 +120,23 @@ def dbg(val=None): def nprint(*args, **kw): if dbg: print(*args, **kw) + +# char checkers following production rules + + +def check_namespace_char(ch): + if u'\x21' <= ch <= u'\x7E': # ! to ~ + return True + if u'\xA0' <= ch <= u'\xD7FF': + return True + if (u'\xE000' <= ch <= u'\xFFFD') and ch != u'\xFEFF': # excl. byte order mark + return True + if u'\x10000' <= ch <= u'\x10FFFF': + return True + return False + + +def check_anchorname_char(ch): + if ch in u',[]{}': + return False + return check_namespace_char(ch) |