[Python-checkins] CVS: python/dist/src/Tools/bgen/bgen scantools.py,1.18,1.19
Jack Jansen
python-dev@python.org
Tue, 12 Dec 2000 14:21:13 -0800
Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen
In directory slayer.i.sourceforge.net:/tmp/cvs-serv12754
Modified Files:
scantools.py
Log Message:
Added support for generating a single module from multiple .h files.
Allow /* */ comments within function prototypes.
Index: scantools.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/scantools.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** scantools.py 2000/07/15 22:27:47 1.18
--- scantools.py 2000/12/12 22:21:11 1.19
***************
*** 252,256 ****
self.comment1_pat = "\(<rest>.*\)//.*"
# note that the next pattern only removes comments that are wholly within one line
! self.comment2_pat = "\(<rest>.*\)/\*.*\*/"
def compilepatterns(self):
--- 252,256 ----
self.comment1_pat = "\(<rest>.*\)//.*"
# note that the next pattern only removes comments that are wholly within one line
! self.comment2_pat = "\(<rest1>.*\)/\*.*\*/\(<rest2>.*\)"
def compilepatterns(self):
***************
*** 329,332 ****
--- 329,342 ----
def setinput(self, scan = sys.stdin):
+ if not type(scan) in (TupleType, ListType):
+ scan = [scan]
+ self.allscaninputs = scan
+ self._nextinput()
+
+ def _nextinput(self):
+ if not self.allscaninputs:
+ return 0
+ scan = self.allscaninputs[0]
+ self.allscaninputs = self.allscaninputs[1:]
self.closescan()
if scan:
***************
*** 340,343 ****
--- 350,354 ----
self.scanmine = mine
self.lineno = 0
+ return 1
def openinput(self, filename):
***************
*** 361,364 ****
--- 372,377 ----
self.line = self.scanfile.readline()
if not self.line:
+ if self._nextinput():
+ return self.getline()
raise EOFError
self.lineno = self.lineno + 1
***************
*** 389,394 ****
if self.comment1.match(line) >= 0:
line = self.comment1.group('rest')
! if self.comment2.match(line) >= 0:
! line = self.comment2.group('rest')
if self.defsfile and self.sym.match(line) >= 0:
self.dosymdef()
--- 402,407 ----
if self.comment1.match(line) >= 0:
line = self.comment1.group('rest')
! while self.comment2.match(line) >= 0:
! line = self.comment2.group('rest1')+self.comment2.group('rest2')
if self.defsfile and self.sym.match(line) >= 0:
self.dosymdef()
***************
*** 413,416 ****
--- 426,433 ----
while self.tail.search(raw) < 0:
line = self.getline()
+ if self.comment1.match(line) >= 0:
+ line = self.comment1.group('rest')
+ while self.comment2.match(line) >= 0:
+ line = self.comment2.group('rest1')+self.comment2.group('rest2')
raw = raw + line
self.processrawspec(raw)