@@ -251,7 +251,7 @@ def initpatterns(self):
251251 self .asplit_pat = "^\(<type>.*[^a-zA-Z0-9_]\)\(<name>[a-zA-Z0-9_]+\)$"
252252 self .comment1_pat = "\(<rest>.*\)//.*"
253253 # note that the next pattern only removes comments that are wholly within one line
254- self .comment2_pat = "\(<rest >.*\)/\*.*\*/"
254+ self .comment2_pat = "\(<rest1 >.*\)/\*.*\*/\(<rest2>.*\) "
255255
256256 def compilepatterns (self ):
257257 for name in dir (self ):
@@ -328,6 +328,16 @@ def openoutput(self, filename):
328328 return file
329329
330330 def setinput (self , scan = sys .stdin ):
331+ if not type (scan ) in (TupleType , ListType ):
332+ scan = [scan ]
333+ self .allscaninputs = scan
334+ self ._nextinput ()
335+
336+ def _nextinput (self ):
337+ if not self .allscaninputs :
338+ return 0
339+ scan = self .allscaninputs [0 ]
340+ self .allscaninputs = self .allscaninputs [1 :]
331341 self .closescan ()
332342 if scan :
333343 if type (scan ) == StringType :
@@ -339,6 +349,7 @@ def setinput(self, scan = sys.stdin):
339349 self .scanfile = file
340350 self .scanmine = mine
341351 self .lineno = 0
352+ return 1
342353
343354 def openinput (self , filename ):
344355 if not os .path .isabs (filename ):
@@ -360,6 +371,8 @@ def getline(self):
360371 raise Error , "input file not set"
361372 self .line = self .scanfile .readline ()
362373 if not self .line :
374+ if self ._nextinput ():
375+ return self .getline ()
363376 raise EOFError
364377 self .lineno = self .lineno + 1
365378 return self .line
@@ -388,8 +401,8 @@ def scan(self):
388401 except EOFError : break
389402 if self .comment1 .match (line ) >= 0 :
390403 line = self .comment1 .group ('rest' )
391- if self .comment2 .match (line ) >= 0 :
392- line = self .comment2 .group ('rest ' )
404+ while self .comment2 .match (line ) >= 0 :
405+ line = self .comment2 .group ('rest1' ) + self . comment2 . group ( 'rest2 ' )
393406 if self .defsfile and self .sym .match (line ) >= 0 :
394407 self .dosymdef ()
395408 continue
@@ -412,6 +425,10 @@ def dofuncspec(self):
412425 raw = self .line
413426 while self .tail .search (raw ) < 0 :
414427 line = self .getline ()
428+ if self .comment1 .match (line ) >= 0 :
429+ line = self .comment1 .group ('rest' )
430+ while self .comment2 .match (line ) >= 0 :
431+ line = self .comment2 .group ('rest1' )+ self .comment2 .group ('rest2' )
415432 raw = raw + line
416433 self .processrawspec (raw )
417434
0 commit comments