-
Notifications
You must be signed in to change notification settings - Fork 114
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
[HELP WANTED] Maybe(?) fixes(?) regex #1793
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
english
@@ -20,14 +20,15 @@ | |||
src.flags = flags | |||
|
|||
proc/Find(haystack, start = 1, end = 0) | |||
return findtext(text, src, start, end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The runtime replaces this proc with the native proc found in DreamProcNativeRegex.cs
so this doesn't do anything.
proc/Replace(haystack, replacement, start = 1, end = 0) | ||
return replacetext(text, src, replacement, start, end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with this proc
|
||
proc/Replace_char(haystack, replacement, start = 1, end = 0) | ||
set opendream_unimplemented = TRUE | ||
return haystack |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this removed?
state.GetArgument(1, "start").TryGetValueAsInteger(out int start); | ||
state.GetArgument(2, "end").TryGetValueAsInteger(out int end); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It needs to be verified that these are both treated as 0
for non-integer values.
return await RegexFind(state, state.Src, haystack, start, end); | ||
} | ||
|
||
public static async Task<DreamValue> RegexFind(AsyncNativeProc.State state, DreamObject regexInstance, DreamValue haystack, int start, int end) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why async? I don't see anything in here that is asynchronous.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just copied this from RegexReplace, not gonna lie!
int start = bundle.GetArgument(2, "Start").MustGetValueAsInteger(); //1-indexed | ||
int end = bundle.GetArgument(3, "End").MustGetValueAsInteger(); //1-indexed | ||
if(!needleArg.TryGetValueAsString(out var needle)) | ||
return DreamValue.True; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BYOND returns different values for different combinations of invalid arguments. Are those still replicated?
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
I am not sure what this was trying to fix, and it looks like this has been abandoned. I'll be closing this but feel free to reopen if you come back to it. In either case I would like you to open an issue to report what bug you were trying to fix. |
This pr is basically a shot in the dark. I believe that
regex.Find()
was broken when it was a global regex. Also impliments proper regex functionality forfindtext()
andreplacetext()