Fixes option parsing on C++ libs that match EOL differently#136
Open
ttuggle wants to merge 2 commits intodocopt:masterfrom
Open
Fixes option parsing on C++ libs that match EOL differently#136ttuggle wants to merge 2 commits intodocopt:masterfrom
ttuggle wants to merge 2 commits intodocopt:masterfrom
Conversation
As explained in https://stackoverflow.com/questions/39645660/stdregex-to-match-begin-end-of-string this helps when running on c++ libraries that do not match EOL with $.
Author
|
FYI, this does include the code from #109 |
Author
|
The pull request in #109 fixes problems parsing something like this, which does parse in Python. |
jaredgrubb
reviewed
Mar 25, 2022
| "(?:^|\\n)" // anchored at a linebreak (or start of string) | ||
| "(" | ||
| "[^\\n]*" + name + "[^\\n]*(?=\\n?)" // a line that contains the name | ||
| "(?:\\n[ \\t].*?(?=\\n|$))*" // followed by any number of lines that are indented |
Member
There was a problem hiding this comment.
Is the issue that it won't match just a newline (without spaces)?
| } | ||
|
|
||
| static const std::regex pattern {"(-{1,2})?(.*?)([,= ]|$)"}; | ||
| static const std::regex pattern {"(-{1,2})?(.*?)([,= ]|$|\n)"}; |
Member
There was a problem hiding this comment.
The |$ should match a newline right?
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
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.
The following fragment does not match between docopt.cpp and docopt: