-
Notifications
You must be signed in to change notification settings - Fork 11
Lg_add_pattern_list return bug #11
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
Open
jonstewart
wants to merge
12
commits into
strozfriedberg:main
Choose a base branch
from
jonstewart:lg_add_pattern_list-return-bug
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Lg_add_pattern_list return bug #11
jonstewart
wants to merge
12
commits into
strozfriedberg:main
from
jonstewart:lg_add_pattern_list-return-bug
Conversation
This file contains hidden or 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
…d Boost program_options, which disables some warnings in a pragma block, instead of the raw Boost header directly. Suppresses many warnings with clang on my Mac.
…ning because it uncovered a function in need of attention, to be done on a separate.
…ulting in a warning
…re it's useful in C++ to do this to suppress unused argument warnings). But C is also quite happy for main(void) instead of main(int argc, char *arg[]), so let's use that instead in the C example to be rid of a warning.
… (a long) by refactoring this for-loop into a while loop. Initializing i to zero in the initializer of the for-loop, with auto, caused the type to be an int. Initializing it directly from std::string::find_first_of coerces the type to a size_type, and then... this just suits a while loop a bit better.
…omplaining about yynerrs being set to 0, but never being used.
…n units and is not necessary there as Catch2 now supplies stream output for containers.
…old-style C++ iterators, by removing it entirely. It was only used in one place for real, and a for-loop is a slightly simpler and smaller (in executable size for the translation unit) than using std::copy with the iterator. In C++23, there's std::ranges::join_with_view/std::ranges::views::join_with so the lack of this iterator can be replaced by a more modern version in STL with an upgrade to C++23.
…d a null pointer for err. This is still gross and needs some refactoring. lg_add_pattern_list() now apes lg_add_pattern() in returning -1 on error and 0 on success... but this is _not_ how lg_parse_pattern() works, and it leads to some impedance mismatch throughout.
…ing specified. Pass the encodings into addPatternHelper() as const. Rename 'el' to 'encList'.
Contributor
Author
|
NB: this is built on top of the other kill-warnings branch. |
Contributor
|
Can you merge main into this branch & push so we can get the checks to run? |
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.
lg_add_pattern_list()was always returning -1. Now it returns 0 if there are no errors.The actual implementation function
lightgrep_c_api.cppis too long. I've made some minor changes but more is needed. Since it's using the Boost string token library, I'm hesitant to break up little subfunctions that advance the token iterators. An obvious refactoring, though, would be to extract a function for just parsing a line containing one pattern, and that'd probably make the code easier to read and less nested.Other refactoring thoughts, @juliapaluch?