aboutsummaryrefslogtreecommitdiff
path: root/checklines.py3
diff options
context:
space:
mode:
Diffstat (limited to 'checklines.py3')
-rwxr-xr-xchecklines.py38
1 files changed, 7 insertions, 1 deletions
diff --git a/checklines.py3 b/checklines.py3
index e38bba1..4551f0d 100755
--- a/checklines.py3
+++ b/checklines.py3
@@ -6,18 +6,22 @@ from unicodedata import name
import re
import sys
+linecount = 0
for line in sys.stdin:
line=line.strip()
if not line or line[0]=="#":
continue
+ linecount += 1
match=re.match(r'\s*(.*):\s*"(.*?)"\s*(\S*)\s*(#.*)?', line)
if not match:
print("({0})".format(line))
continue
(keystrokes, char, num, comments)=match.groups()
nummatch=re.match(r'^U([0-9A-Fa-f]+)$', num)
+ # There's no number for multichar strings
if not nummatch:
- print("Number not parsed: {0}".format(line))
+ if len(char) == 1:
+ print("Number not parsed: {0}".format(line))
continue
x=int(nummatch.group(1),0x10)
c=chr(x)
@@ -30,3 +34,5 @@ for line in sys.stdin:
print("\tNumber gives character: {0} ({1})".format(c, name(c)))
except Exception as e:
print("{0}\n\t{1}".format(line, e))
+
+print("Done. Checked %d lines."%linecount)