-
Notifications
You must be signed in to change notification settings - Fork 44
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
RegExMatch output variable causes incorrect transformations #118
Comments
Properties with the same name are also erroneously transformed. Input: RegExMatch(haystack, regex, output)
x := task.output Incorrect output: RegExMatch(haystack, regex, &output)
x := task.output[0] |
Unrelated variables and parameter names elsewhere in the script (perhaps hundreds of lines away?) are also transformed. Input: a(s, r) {
RegExMatch(s, r, m)
return m
}
b(m) {
return m
} Incorrect output: a(s, r) {
RegExMatch(s, r, &m)
return m[0]
}
b(m[0]) {
return m[0]
} |
For the maintainers, I will attempt to cleanup and clarify parts about |
Thanks for your note, its helpful so people don't do duplicate work. If you work in a branch on your own repo, you can just tag this issue and then we should see a notification here. Remember to add the associated test cases. You could just use the examples provided by Lexikos |
The current way of updating the names is a simple replacement on a full line. I see it difficult to improve much without some bigger changes. The changes made are:
But sadly:
To fix those it seems better to try to find a better approach than the current full line replacement, instead of creating more workarounds. |
* Update tests related to RegExMatch and #118 * Update renaming of PseudoArrays to be more concrete (#118) * Move failing tests about known issues with RegExMatch --------- Co-authored-by: SafetyCar <[email protected]>
partially completed in 69269b3 |
This will be corrected within Masking pull request coming soon (already tested and corrected). |
I think PR #208 will have some affect on this issue. It is still not the full fix, but progress. More work will be needed to address the global scope of the issue outlined in this thread. Possibly a rewrite of how RegexMatch (and other structures are) is handled in general, rather than multiple band-aids (as @safetycar mentioned). The upcoming PR that will introduce class/function/string masking (and separate handling) may come in handy for this as well. It can be extended to include other structures such as IF, Regex, etc, which may provide alternate fronts of attack. See commit #213 for partial solution to this thread |
Input:
Incorrect output:
There are multiple issues:
uri
with a RegExMatchInfo incorrectly has its input changed fromuri
touri[0]
. On input, the variable still contains a string.uri
still contains a string in theelse
branch, so should not have been transformed.if
branch.I think a simpler, less error-prone approach would be for
uri := uri && uri[0]
to be inserted after the RegExMatch call. Appending&& uri := uri[0]
to the call would also work if the return value is not being stored.The text was updated successfully, but these errors were encountered: