You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the get_example_batch function of run_parser.py, there is an error in the substitution algorithm for variable names. In your code, the problem of variable name length inconsistency before and after substitution is handled by accumulating differences, but only if the row is replaced sequentially from left to right. Failure to do so results in substitution misplaced code that produces syntax errors.
Your code in get_example_batch:
for index, pos in enumerate(replace_pos[line]):
code[line] = code[line][:pos[3]+diff] + pos[1] + code[line][pos[4]+diff:]
diff += pos[2]
Bug fixed code in get_example_batch:
for index, pos in enumerate(list(sorted(replace_pos[line], key=lambda x:x[3]))):
code[line] = code[line][:pos[3]+diff] + pos[1] + code[line][pos[4]+diff:]
diff += pos[2]
The text was updated successfully, but these errors were encountered:
In the get_example_batch function of run_parser.py, there is an error in the substitution algorithm for variable names. In your code, the problem of variable name length inconsistency before and after substitution is handled by accumulating differences, but only if the row is replaced sequentially from left to right. Failure to do so results in substitution misplaced code that produces syntax errors.
Your code in get_example_batch:
Bug fixed code in get_example_batch:
The text was updated successfully, but these errors were encountered: