8000 Explain named group ordering · matplotlib/matplotlib@6de9813 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6de9813

Browse files
committed
Explain named group ordering
1 parent 10135bf commit 6de9813

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/matplotlib/dviread.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,16 +911,23 @@ def _parse(self, file):
911911
effects, encoding, filename = b'', None, None
912912
words = word_re.finditer(line)
913913

914+
# The named groups are mutually exclusive and are
915+
# referenced below at an estimated order of probability of
916+
# occurrence based on looking at my copy of pdftex.map.
917+
# The font names are probably unquoted:
914918
w = next(words)
915919
texname = w.group('eff2') or w.group('eff1')
916920
w = next(words)
917921
psname = w.group('eff2') or w.group('eff1')
918922

919923
for w in words:
924+
# Any effects are almost always quoted:
920925
eff = w.group('eff1') or w.group('eff2')
921926
if eff:
922927
effects = eff
923928
continue
929+
# Encoding files usually have the .enc suffix
930+
# and almost never need quoting:
924931
enc = (w.group('enc4') or w.group('enc3') or
925932
w.group('enc2') or w.group('enc1'))
926933
if enc:
@@ -931,6 +938,7 @@ def _parse(self, file):
931938
'debug')
932939
encoding = enc
933940
continue
941+
# File names are probably unquoted:
934942
filename = w.group('file2') or w.group('file1')
935943

936944
effects_dict = {}

0 commit comments

Comments
 (0)
0