mirror of
https://github.com/Sei-Lisa/LSL-PyOptimizer
synced 2025-07-01 23:58:20 +00:00
Make Unicode some strings that should be, and improve error reporting in builtins.txt
Also work towards the convention that strings that represent text (possibly translatable) are in double quotes, not single.
This commit is contained in:
parent
a124deb6b3
commit
39261cbfc8
5 changed files with 56 additions and 35 deletions
|
@ -81,15 +81,15 @@ Indet = Infinity * 0
|
|||
|
||||
class ELSLTypeMismatch(Exception):
|
||||
def __init__(self):
|
||||
super(ELSLTypeMismatch, self).__init__("Type mismatch")
|
||||
super(ELSLTypeMismatch, self).__init__(u"Type mismatch")
|
||||
|
||||
class ELSLMathError(Exception):
|
||||
def __init__(self):
|
||||
super(ELSLMathError, self).__init__("Math Error")
|
||||
super(ELSLMathError, self).__init__(u"Math Error")
|
||||
|
||||
class ELSLInvalidType(Exception):
|
||||
def __init__(self):
|
||||
super(ELSLInvalidType, self).__init__("Internal error: Invalid type")
|
||||
super(ELSLInvalidType, self).__init__(u"Internal error: Invalid type")
|
||||
|
||||
class ELSLCantCompute(Exception):
|
||||
pass
|
||||
|
@ -476,7 +476,7 @@ def InternalUTF8toString(s):
|
|||
# python-coverage. It IS executed but not detected.
|
||||
continue
|
||||
if LSO:
|
||||
raise ELSONotSupported("Byte strings not supported")
|
||||
raise ELSONotSupported(u"Byte strings not supported")
|
||||
ret += u'?' * len(partialchar)
|
||||
partialchar = b''
|
||||
# fall through to process current character
|
||||
|
@ -485,14 +485,14 @@ def InternalUTF8toString(s):
|
|||
pending = 1 if o < 0xE0 else 2 if o < 0xF0 else 3
|
||||
elif o >= 0x80:
|
||||
if LSO:
|
||||
raise ELSONotSupported("Byte strings not supported")
|
||||
raise ELSONotSupported(u"Byte strings not supported")
|
||||
ret += u'?'
|
||||
else:
|
||||
ret += c.decode('utf8')
|
||||
|
||||
if partialchar:
|
||||
if LSO:
|
||||
raise ELSONotSupported("Byte strings not supported")
|
||||
raise ELSONotSupported(u"Byte strings not supported")
|
||||
ret += u'?' * len(partialchar)
|
||||
|
||||
return zstr(ret)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue