File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131from matplotlib .compat import subprocess
3232from matplotlib import rcParams
3333import numpy as np
34+ import re
3435import struct
3536import sys
3637import textwrap
@@ -876,21 +877,8 @@ def _parse(self, file):
876877 line = line .strip ()
877878 if line == b'' or line .startswith (b'%' ):
878879 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 )]
894882 self ._register (words )
895883
896884 def _register (self , words ):
You can’t perform that action at this time.
0 commit comments