File tree Expand file tree Collapse file tree 1 file changed +3
-15
lines changed Expand file tree Collapse file tree 1 file changed +3
-15
lines changed Original file line number Diff line number Diff line change 31
31
from matplotlib .compat import subprocess
32
32
from matplotlib import rcParams
33
33
import numpy as np
34
+ import re
34
35
import struct
35
36
import sys
36
37
import textwrap
@@ -876,21 +877,8 @@ def _parse(self, file):
876
877
line = line .strip ()
877
878
if line == b'' or line .startswith (b'%' ):
878
879
continue
879
- words , pos = [], 0
880
- while pos < len (line ):
881
- if line [pos :pos + 1 ] == b'"' : # double quoted word
882
- pos += 1
883
- end = line .index (b'"' , pos )
884
- words .append (line [pos :end ])
885
- pos = end + 1
886
- else : # ordinary word
887
- end = line .find (b' ' , pos + 1 )
888
- if end == - 1 :
889
- end = len (line )
890
- words .append (line [pos :end ])
891
- pos = end
892
- while pos < len (line ) and line [pos :pos + 1 ] == b' ' :
893
- pos += 1
880
+ words = [word .strip (b'"' ) for word in
881
+ re .findall (b'("[^"]*"|[^ ]+)' , line )]
894
882
self ._register (words )
895
883
896
884
def _register (self , words ):
You can’t perform that action at this time.
0 commit comments