Loading python_ast/parse_json.py +3 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,9 @@ import json def print_tree(json_tree, index): print('{' + json_tree[index]['type'], end='') if 'value' in json_tree[index]: print('{' + json_tree[index]['value'].replace('\r','').replace('\n','').replace('\t', '').strip().translate(str.maketrans({"{": r"\{", # \x00 is a null character (https://en.wikipedia.org/wiki/Null_character) # it caused endless loop / SEGFAULT while parsing a tree in bracket notation print('{' + json_tree[index]['value'].replace('\r','').replace('\n','').replace('\t', '').replace('\x00', '').strip().translate(str.maketrans({"{": r"\{", "}": r"\}", "\\": r"\\"})) + '}', end='') Loading Loading
python_ast/parse_json.py +3 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,9 @@ import json def print_tree(json_tree, index): print('{' + json_tree[index]['type'], end='') if 'value' in json_tree[index]: print('{' + json_tree[index]['value'].replace('\r','').replace('\n','').replace('\t', '').strip().translate(str.maketrans({"{": r"\{", # \x00 is a null character (https://en.wikipedia.org/wiki/Null_character) # it caused endless loop / SEGFAULT while parsing a tree in bracket notation print('{' + json_tree[index]['value'].replace('\r','').replace('\n','').replace('\t', '').replace('\x00', '').strip().translate(str.maketrans({"{": r"\{", "}": r"\}", "\\": r"\\"})) + '}', end='') Loading