-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Restrict logical navigations to the running match in running semantics #27006
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
base: master
Are you sure you want to change the base?
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRestrict logical FIRST and LAST navigations to the active match when running semantics are enabled by computing a dynamic boundary (patternEndInclusive) and propagating it through navigation methods, and update tests to expect null for out-of-match accesses. Sequence diagram for restricted logical navigation in running semanticssequenceDiagram
participant "resolvePosition()"
participant "findFirstAndForward()"
participant "findLastAndBackwards()"
participant "ArrayView"
"resolvePosition()"->>"findFirstAndForward()": if !last, pass patternEndInclusive
"resolvePosition()"->>"findLastAndBackwards()": if last, pass patternEndInclusive
"findFirstAndForward()"->>"ArrayView": iterate up to patternEndInclusive
"findLastAndBackwards()"->>"ArrayView": iterate down to 0 from patternEndInclusive
"resolvePosition()"->>"adjustPosition()": adjust final position
Class diagram for updated LogicalIndexNavigation methodsclassDiagram
class LogicalIndexNavigation {
+resolvePosition(currentRow, matchedLabels, searchStart, searchEnd)
-findLastAndBackwards(patternEndInclusive, matchedLabels)
-findFirstAndForward(matchedLabels, patternEndInclusive)
}
LogicalIndexNavigation : int logicalOffset
LogicalIndexNavigation : Set<String> labels
LogicalIndexNavigation : boolean last
LogicalIndexNavigation : boolean running
LogicalIndexNavigation : int adjustPosition(relativePosition, patternStart, searchStart, searchEnd)
LogicalIndexNavigation --> ArrayView
ArrayView : int length()
ArrayView : String get(int)
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Description
Before this change, the logical navigation function
FIRST
could return position out of bounds of the current match in therunning
semantics. Now it is restricted to the current match.Additional context and related issues
Fixes: #26981
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(X) Release notes are required, with the following suggested text:
Summary by Sourcery
Restrict logical navigation functions to the current match bounds in running semantics and update tests accordingly.
Bug Fixes:
Tests: