Skip to content

Commit

Permalink
Fix printing plain regexes with escapable chars into the decompiled code
Browse files Browse the repository at this point in the history
  • Loading branch information
p1-mmr committed Dec 12, 2022
1 parent 109174c commit 548c495
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion decompilation/pass2_make_atomic_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ def __init__(self, state : HermesDecompiler):
pattern_string = state.hbc_reader.strings[op2]
flags_string = state.hbc_reader.strings[op3]

pattern_string = pattern_string.encode('unicode_escape').decode('ascii')
pattern_string = pattern_string.translate({
char: repr(char) for char in range(0x20)
})
pattern_string = pattern_string.replace('/', '\\/')

readable_regexp = '/%s/%s' % (
Expand Down

0 comments on commit 548c495

Please sign in to comment.