-
Notifications
You must be signed in to change notification settings - Fork 596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make lines between begin and finish for py, r, dom, run, vision steps run as a single block #167
Comments
The part of the code to be patched would be in this section of tagui_parse.php - |
2 ideas so far from @Aussiroth and @lohvht -
|
This block of code causes issues due to extra backslashes being introduced when trying to add newlines to separate run blocks of code.
|
Problem with incorrect escaping of \n has been fixed, however, trying a code block such as
results in the command prompt on windows sending a python command to open the file Possibly omit run blocks from being condensed into one due to issues like this, as well as typical usage scenario in the command prompt/bash shell to be running one line at a time. |
@Aussiroth nice work!! I'm merging and then committing with some adjustments. Going to keep your 11 commits without squashing in order to not lose the commit details you made as you iterate through to this iteration. As spoken and discussed with @lohvht we will keep run step out of scope for this. Outstanding is the Python indentation, I'll have a look at that. |
Ok above commits make the indentation works now for py and vision blocks! @Aussiroth have a look when you have time to have some sanity checks to see if edge cases are not covered, and you can close the issue if no problem. fyi @lohvht I'll assign myself out of the issue for now. Now cutting edge works for below and for the test py section in positive_test script.
|
I tested a script with a good amount of nested if/for statements and it worked fine, so seems good!
Result here is 5040. |
Cool! Adding on, nested py begin and finish blocks work as well - py_result = 0
if (true)
{
py begin
import math
for i in range (1, 2):
count = {}
inStr = "ordeals"
for i in range(0, len(inStr)):
curr = inStr[i:i+1]
if curr in count:
count[curr] = count[curr] + 1
else:
count[curr] = 1
sol = math.factorial(len(inStr))
divide = 1;
for k in count:
v = count[k]
if v > 1:
divide = divide * math.factorial(v)
print(int(sol//divide))
py finish
}
echo py_result |
At the moment, only code lines within js begin and js finish run as a single block of code. The other steps (py, r, dom, run, vision), the lines are run line by line in their respective targets.
This is problem for some edge cases where subsequent lines of code has to be treated as part of the previous lines, for example in the case of an if statement or consecutive dom steps with if and action statements.
This issue is to evaluate and collapse lines of code for the respective begin and finish steps, so that the lines of code are executed as a single within in the target / process (py, r, dom, run, vision) etc. At the moment js begin and js finish already collapse the consecutive lines, but as part of this change, it can be done in a more robust way instead of regex substitution.
The text was updated successfully, but these errors were encountered: