Update the script to recognize the escaped space
This commit is contained in:
parent
d6a5cc665a
commit
a9d4dba749
|
@ -44,13 +44,20 @@ for i in p:
|
||||||
fescape = True
|
fescape = True
|
||||||
elif i.lower() == 'u' and fescape == True:
|
elif i.lower() == 'u' and fescape == True:
|
||||||
funicode = True
|
funicode = True
|
||||||
|
fescape = False
|
||||||
elif i >= '0' and i <= '9' or i.lower() >= 'a' and i.lower() <= 'f':
|
elif i >= '0' and i <= '9' or i.lower() >= 'a' and i.lower() <= 'f':
|
||||||
|
if fescape == True:
|
||||||
|
raise RuntimeError, "Unexpected escape code"
|
||||||
if funicode == True:
|
if funicode == True:
|
||||||
v <<= 4
|
v <<= 4
|
||||||
v += int(i, 16)
|
v += int(i, 16)
|
||||||
else:
|
else:
|
||||||
raise RuntimeError, "Unable to parse Unicode"
|
raise RuntimeError, "Unable to parse Unicode"
|
||||||
elif i == ' ':
|
elif i == ' ':
|
||||||
|
if fescape == True:
|
||||||
|
funicode = True
|
||||||
|
fescape = False
|
||||||
|
v = 0x20
|
||||||
if frange == True and funicode == True:
|
if frange == True and funicode == True:
|
||||||
vend = v
|
vend = v
|
||||||
insert(l, vbegin, vend)
|
insert(l, vbegin, vend)
|
||||||
|
@ -60,13 +67,13 @@ for i in p:
|
||||||
vend = v
|
vend = v
|
||||||
insert(l, vbegin, vend)
|
insert(l, vbegin, vend)
|
||||||
fprocess = True
|
fprocess = True
|
||||||
fescape = False
|
|
||||||
funicode = False
|
funicode = False
|
||||||
frange = False
|
frange = False
|
||||||
elif i == '-':
|
elif i == '-':
|
||||||
|
if fescape == True:
|
||||||
|
raise RuntimeError, "Unexpected escape code"
|
||||||
vbegin = v
|
vbegin = v
|
||||||
v = 0
|
v = 0
|
||||||
fescape = False
|
|
||||||
funicode = False
|
funicode = False
|
||||||
frange = True
|
frange = True
|
||||||
else:
|
else:
|
||||||
|
@ -88,8 +95,6 @@ elif funicode == True:
|
||||||
vbegin = vend = v
|
vbegin = vend = v
|
||||||
insert(l, vbegin, vend)
|
insert(l, vbegin, vend)
|
||||||
|
|
||||||
# somewhat missing 0x0020 in the list of code from Unicode Utilities
|
|
||||||
insert(l, 0x0020, 0x0020)
|
|
||||||
ncode = 0
|
ncode = 0
|
||||||
for i in l:
|
for i in l:
|
||||||
ncode += (i[1] - i[0] + 1)
|
ncode += (i[1] - i[0] + 1)
|
||||||
|
@ -98,6 +103,8 @@ a = int(x[0].split(' ')[0].replace(',', ''))
|
||||||
if a != ncode:
|
if a != ncode:
|
||||||
sys.stderr.write("Unexpected the amount of code points: %d (expected %d)\n" % (ncode, a))
|
sys.stderr.write("Unexpected the amount of code points: %d (expected %d)\n" % (ncode, a))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
# exception; BRAILLE PATTERN BLANK
|
||||||
insert(l, 0x2800, 0x2800)
|
insert(l, 0x2800, 0x2800)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
Loading…
Reference in New Issue