Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Commit

Permalink
Improvement to symbol library user field parsing, when user field tex…
Browse files Browse the repository at this point in the history
…t contains double-quotes (ex: in reference to 'inch' imperial unit)
  • Loading branch information
fdelaroche committed Apr 16, 2020
1 parent 24bd891 commit 37813e1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions schlib/schlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,15 @@ def __init__(self, data, comments, filename, documentation):
for line in data:
checksum_data += line.strip()
line = line.replace('\n', '')
s = shlex.shlex(line)
s.whitespace_split = True
s.commenters = ''
s.quotes = '"'
line = list(s)
if '\\"' in line:
import re
line = re.findall(r'(?:[^\s,"]|"(?:\\.|[^"])*")+', line)
else:
s = shlex.shlex(line)
s.whitespace_split = True
s.commenters = ''
s.quotes = '"'
line = list(s)

if len(line) == 0:
continue
Expand Down

0 comments on commit 37813e1

Please sign in to comment.