Revision: 4729
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4729&view=rev
Author:   mdboom
Date:     2007-12-13 10:42:54 -0800 (Thu, 13 Dec 2007)

Log Message:
-----------
Fix some regular expressions.

Modified Paths:
--------------
    branches/transforms/lib/matplotlib/fontconfig_pattern.py
    branches/transforms/lib/matplotlib/mathtext.py

Modified: branches/transforms/lib/matplotlib/fontconfig_pattern.py
===================================================================
--- branches/transforms/lib/matplotlib/fontconfig_pattern.py    2007-12-13 
18:30:45 UTC (rev 4728)
+++ branches/transforms/lib/matplotlib/fontconfig_pattern.py    2007-12-13 
18:42:54 UTC (rev 4729)
@@ -35,8 +35,8 @@
     See here for a rough specification of these patterns:
     http://www.fontconfig.org/fontconfig-user.html
     """
-    
 
+
     _constants = {
         'thin'           : ('weight', 'light'),
         'extralight'     : ('weight', 'light'),
@@ -63,12 +63,12 @@
         'extraexpanded'  : ('width', 'extra-expanded'),
         'ultraexpanded'  : ('width', 'ultra-expanded')
         }
-    
+
     def __init__(self):
         family      = Regex(r'([^%s]|(\\[%s]))*' %
                             (family_punc, family_punc)) \
                       .setParseAction(self._family)
-        size        = Regex(r'[0-9.]+') \
+        size        = Regex(r"([0-9]+\.?[0-9]*|\.[0-9]+)") \
                       .setParseAction(self._size)
         name        = Regex(r'[a-z]+') \
                       .setParseAction(self._name)
@@ -79,7 +79,7 @@
         families    =(family
                     + ZeroOrMore(
                         Literal(',')
-                      + family)  
+                      + family)
                     ).setParseAction(self._families)
 
         point_sizes =(size
@@ -118,10 +118,10 @@
             self._parser.parseString(pattern)
         except self.ParseException, e:
             raise ValueError("Could not parse font string: '%s'\n%s" % 
(pattern, e))
-            
+
         self._properties = None
         return props
-        
+
     def _family(self, s, loc, tokens):
         return [family_unescape(r'\1', tokens[0])]
 
@@ -141,7 +141,7 @@
     def _point_sizes(self, s, loc, tokens):
         self._properties['size'] = tokens
         return []
-        
+
     def _property(self, s, loc, tokens):
         if len(tokens) == 1:
             if tokens[0] in self._constants:

Modified: branches/transforms/lib/matplotlib/mathtext.py
===================================================================
--- branches/transforms/lib/matplotlib/mathtext.py      2007-12-13 18:30:45 UTC 
(rev 4728)
+++ branches/transforms/lib/matplotlib/mathtext.py      2007-12-13 18:42:54 UTC 
(rev 4729)
@@ -1984,7 +1984,7 @@
         autoDelim = Forward().setParseAction(self.auto_sized_delimiter)
         self._expression = 
Forward().setParseAction(self.finish).setName("finish")
 
-        float        = Regex(r"-?[0-9]*(\.[0-9]+)?")
+        float        = Regex(r"[-+]?([0-9]+\.?[0-9]*|\.[0-9]+)")
 
         lbrace       = Literal('{').suppress()
         rbrace       = Literal('}').suppress()


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to