Repository navigation
Fix SymbolixRegexRunner handling of "beginning" - #64946
Conversation
The Runner's Go implementation is loading the `runtext` but ignoring `runtextbeg`. If a non-0 beginning were passed in, the matcher could end up evaluating beginning anchors incorrectly, as it always considers beginning == 0. This fixes that by slicing the input to ensure the matcher is always called with a span representing the full beginning-end length, such that it's beginning==0 assumption is true.
|
Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions Issue DetailsThe Runner's Go implementation is loading the @joperezr, this will likely get cleaned up further with your span changes, assuming the calling Run/Scan loop ends up creating the span and passing that in, ensuring the span is always the full range such that runtextbeg and runtextend can be ignored.
|
|
Great, you found it :) I looked over the changes and looks good to me. |
Yup, that is exactly what my PR is doing: https://github.com/dotnet/runtime/pull/62509/files#diff-76183069218af46fc69f0126ba5d6a921355be2714c67a77b89429a92fd98945R403-R408 |
|
Remind me, if/when look behind asserts are supported, will this need revisiting (as those can look past the beginning)? |
|
I think it will be an orthogonal issue. Lookaround in NonBacktracking will essentially be another (incrementally created) DFA that walks backwards or forwards from the current position, more or less independent of other features (or I expect it to be independent) even supporting the same features inside the lookaround regex itself (e.g. anchors inside a lookback) |
No, they can't. They can look behind startat, but not behind beginning. There's nothing before the beginning. |
The Runner's Go implementation is loading the
runtextbut ignoringruntextbeg. If a non-0 beginning were passed in, the matcher could end up evaluating beginning anchors incorrectly, as it always considers beginning == 0. This fixes that by slicing the input to ensure the matcher is always called with a span representing the full beginning-end length, such that its beginning==0 assumption is true.@joperezr, this will likely get cleaned up further with your span changes, assuming the calling Run/Scan loop ends up creating the span and passing that in, ensuring the span is always the full range such that runtextbeg and runtextend can be ignored.
cc: @olsaarik, @veanes