This repository has been archived by the owner on Oct 2, 2020. It is now read-only.
schlib improvement to handle double-quote text in symbol user fields #324
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.
While working on my little tool to parse symbol library files, I've noticed that there was a little bug to handle user fields (F3 and up) when a double-quote was inserted in the text field, the library parser was handling it as an escape quote. It appears to come from the shlex command parser which has no insight on how to treat this character.
I've tried to solve it using shlex but eventually gave up, I even posted on StackOverflow:
https://stackoverflow.com/questions/60877782/python-shlex-posix-usage-dilemma
Instead, I've found regex pattern matching for user fields containing double-quotes works well, based on this answer:
https://stackoverflow.com/a/16710842/12794913
I've tested this change quite extensively as I've been doing a lot of library clean-up for my company.
I'm open to other implementation, just wanted to give a heads-up on this little annoying bug.
Here is a little code snippet if you want to understand the issue I'm referring to: