-
-
Notifications
You must be signed in to change notification settings - Fork 21
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: implement multiline support (continued) #58
Conversation
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.
considering multi-line stuff can only happen when parsing a config file, I am in favor of moving them out of the ::parseLine func altogether. This adds needless complexity.
I would instead move it to parseFile and parseRawStream
In that case, I'll take another look at this change and see about implementing it the way you're describing. Thanks for the quick feedback! |
d45287c
to
2c50933
Compare
I implemented a simpler version of multi-line support in Functional changes from the previous implementation:
I should also point out that this feature is a breaking change because people may have config lines ending with backslashes where those backslashes are currently treated as normal text. But this was true of the previous implementation as well. I welcome any feedback, and thanks again for considering this pull request! |
I consolidated the logic for getting the full next line (taking backslashes into account) into a helper function that returns |
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.
rest lgtm
Cool! I've addressed those changes you asked for. Thanks! |
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.
rest lgtm
src/config.hpp
Outdated
GETNEXTLINEFAILURE_BACKSLASH, | ||
}; | ||
|
||
static std::expected<std::string, eGetNextLineFailure> getNextLine(std::istream& str, int &rawLineNum, int &lineNum); |
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.
this is not used outside of config.cpp, this can be removed altogether
You don't need to define stuff in a header if it's only used in one source file, it only increases the compilation time |
Alright, I've fixed that now. Thanks for the feedback, I hadn't considered that. I don't write much C++ these days but it's good to get a little practice in. |
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.
thanks!
I saw #51 and thought it was a good idea, so I thought I'd try to get it over the finish line.
I rebased aurelien-brabant's commits onto main as they had fallen behind. I fixed a typo in his code and changed the
RHS
index to usestd::string::at
like you suggested.This appears to be a non-issue. In that case the code is evaluated as
line.substr(0, 0)
.I also added another multiline test for configs that contain a whole empty line in the middle, and I fixed a bug where the
RHS
was assumed to be non-empty.Let me know if you still have concerns about this feature and I'll see if I can address them.