Skip to content

fix issue 9979 - regex back-looper bug #1273

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

Merged
merged 5 commits into from
May 26, 2013
Merged

Conversation

Diggsey
Copy link
Contributor

@Diggsey Diggsey commented Apr 23, 2013

Previously this code would match an empty string:
auto r = regex(r"A\b", "g");

string s = "A";
auto m = s.match(r);

writeln(m);

This fixes the off-by-one error in back-looper and gets it to use the regex position rather than the stream position so there are no problems when the two are out of sync (such as at the end of a stream).

@DmitryOlshansky
Copy link
Member

Looking good, thanks for following through with this pull.


String opSlice(size_t start, size_t end){ return _origin[end..start]; }
//index of at End position
@property size_t lastIndex(){ return 0; }
}
@property auto loopBack(){ return BackLooper(this); }
auto loopBack(size_t index){ return BackLooper(this, index); }
}

// Test stream against simple UTF-string stream abstraction (w/o normalization and such)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a remenant of the original project to add stream based regex support that never took off and bitrotten in the meantime.
Since we're using git to great extent there is no need to keep this junk around anymore - just delete it please in an additional commit.
(you as well missed default arguments in here as if to underline my point)

@DmitryOlshansky
Copy link
Member

Just address one nit and we should be ready to go.

@DmitryOlshansky
Copy link
Member

Cool, thanks.

UPDATE: A FreeBSD failure is a usual and totaly unrelated guest.

@alexrp @AndrejMitrovic
Give it a glance and merge? This's a bugfix that we better have in 2.063.

andralex added a commit that referenced this pull request May 26, 2013
fix issue 9979 - regex back-looper bug
@andralex andralex merged commit ebb1457 into dlang:master May 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants