-
Notifications
You must be signed in to change notification settings - Fork 210
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
(feat) Add variable name extractor to expression runner #1173
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Size Change: -3.44 MB (-37.49%) 🎉 Total Size: 5.74 MB
ℹ️ View Unchanged
|
ibacher
force-pushed
the
feat/add-variable-name-extractor
branch
from
October 3, 2024 20:48
fbe889f
to
0d547de
Compare
samuelmale
approved these changes
Oct 3, 2024
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.
LGTM, thanks @ibacher!
Samstar10
pushed a commit
to Samstar10/openmrs-esm-core
that referenced
this pull request
Oct 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Requirements
feat
,fix
, orchore
, among others). See existing PR titles for inspiration.For changes to apps
If applicable
Summary
This adds a companion function to the expression-evaluator, called
extractVariableNames()
which takes either a "pre-compiled" or raw expression and returns a list of any unbound identifiers ("variables") in the expression. This is useful for tracking expression dependencies or just understanding what variables need to be loaded to be passed into an expression.While it uses the same parsing framework, the variable name extractor does not do any real validation of the expression; that is, an expression passing through this function does not guarantee that it will not throw an error when executed. This is because we do not make any attempt to actual evaluate the expression at this point.
See the examples and test cases for a better outline of what this actually does.
Variables are returned in roughly the order they first appear in the expression.
Screenshots
Related Issue
Other