More cosmetic fixes to FirstPass
This commit is contained in:
parent
8b59328410
commit
62a655aeff
|
@ -110,6 +110,11 @@ for name, firstline, lastline in procedures:
|
||||||
# Now we have a clean statement list that we can do transformations on.
|
# Now we have a clean statement list that we can do transformations on.
|
||||||
|
|
||||||
|
|
||||||
|
# Transformation: A7 to SP
|
||||||
|
statements = re.sub(r'(?<!\$)\bA7\b', 'SP', statements)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Transformation: get rid of unused labels
|
# Transformation: get rid of unused labels
|
||||||
def label_if_nonunique(m):
|
def label_if_nonunique(m):
|
||||||
if len(re.findall(r'\b' + m.group()[:-1] + r'\b', statements)) > 1:
|
if len(re.findall(r'\b' + m.group()[:-1] + r'\b', statements)) > 1:
|
||||||
|
@ -152,7 +157,7 @@ for name, firstline, lastline in procedures:
|
||||||
|
|
||||||
# Transformation: change #$70777063 to #'pwpc'
|
# Transformation: change #$70777063 to #'pwpc'
|
||||||
def longliteral(m):
|
def longliteral(m):
|
||||||
chars = bytes.fromhex(m.group(1)).decode('latin-1')
|
chars = bytes.fromhex(m.group(1)).decode('ascii', 'replace')
|
||||||
if all(c.isalnum() or c in ' #' for c in chars):
|
if all(c.isalnum() or c in ' #' for c in chars):
|
||||||
return repr(chars)
|
return repr(chars)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue