fixes

Thu, 03 Jan 2008 19:06:48 +0100

author
David Douard <david.douard@logilab.fr>
date
Thu, 03 Jan 2008 19:06:48 +0100
changeset 19
42af82fdb8bb
parent 18
c691b040e8c9
child 20
de60b63b2275

fixes

hpgl_parser.py file | annotate | diff | comparison | revisions
--- a/hpgl_parser.py	Fri Dec 21 23:51:36 2007 +0100
+++ b/hpgl_parser.py	Thu Jan 03 19:06:48 2008 +0100
@@ -7,13 +7,16 @@
 vextractor = re.compile('(?P<value>[^;\n\r\aA-DF-Za-df-z]*?)(?P<terminator>[;\n\r\a]+)', re.S+re.M) 
 
 class HPGLParser(object):
-    def __init__(self, data):
+    def __init__(self, data=None):
+        self.str_terminator = chr(0x03)
+        self.IN()
+        if data:
+            self.parse(data)
+
+    def parse(self, data):
         self.data = data
         self.idx = 0
-        self.str_terminator = chr(0x03)
-
-        self.IN()
-
+        self.IN()        
         while self.idx<len(data):
             while data[self.idx] in [';','\n','\r', '\a', ' ']:
                 self.idx += 1

mercurial