1
0

Better escaping, and such.

This commit is contained in:
Jon Michael Aanes 2017-11-20 13:07:07 +01:00
parent ccca65f4a3
commit daad0a3062
2 changed files with 6 additions and 3 deletions

View File

@ -1,4 +1,6 @@
import re
REG_STATUS_TO_COLOR = { REG_STATUS_TO_COLOR = {
"insert": "green", "insert": "green",
"change": "yellow", "change": "yellow",
@ -22,7 +24,8 @@ class TikzPainter:
self.options = options if options else DEFAULT_OPTIONS self.options = options if options else DEFAULT_OPTIONS
def addText (self, str, *args): def addText (self, str, *args):
self.text.append(str.format(*args)) text = re.sub(r"[^\\]%", "\\%", str.format(*args))
self.text.append(text)
def getRegColor (self, reg_state): def getRegColor (self, reg_state):
return REG_STATUS_TO_COLOR[reg_state] return REG_STATUS_TO_COLOR[reg_state]
@ -122,3 +125,4 @@ class TikzPainter:
def __str__ (self): def __str__ (self):
return 'TikzPainter[]' return 'TikzPainter[]'

View File

@ -20,7 +20,7 @@ def parse_args ():
# Determine args # # Determine args #
registers_init = {} registers_init = {}
for register in REGISTERS: for register in REGISTERS:
registers_init[register[1:]] = Junk.Junk('prev '+register) registers_init[register[1:]] = Junk.Junk('old '+register[1:])
# #
registers_init['rip'] = 0 registers_init['rip'] = 0
registers_init['rsp'] = 0 registers_init['rsp'] = 0
@ -79,4 +79,3 @@ def main ():
if __name__ == "__main__": if __name__ == "__main__":
main() main()