* src/tools/docmaker/sources.py (SourceBlock::__init__): While

looking for markup tags, return immediately as soon a single one is
found.
This commit is contained in:
Werner Lemberg 2008-05-28 21:51:15 +00:00
parent 8f7d17bfe3
commit de0d00556e
2 changed files with 24 additions and 19 deletions

View File

@ -1,3 +1,9 @@
2008-05-28 Werner Lemberg <wl@gnu.org>
* src/tools/docmaker/sources.py (SourceBlock::__init__): While
looking for markup tags, return immediately as soon a single one is
found.
2008-05-28 Werner Lemberg <wl@gnu.org>
* src/truetype/ttinterp.c (Ins_MD): The MD instruction also uses

View File

@ -58,9 +58,9 @@ class SourceBlockFormat:
#
start = r'''
\s* # any number of whitespace
/\*{2,}/ # followed by '/' and at least two asterisks then '/'
\s*$ # eventually followed by whitespace
\s* # any number of whitespace
/\*{2,}/ # followed by '/' and at least two asterisks then '/'
\s*$ # probably followed by whitespace
'''
column = r'''
@ -68,7 +68,7 @@ column = r'''
/\*{1} # followed by '/' and precisely one asterisk
([^*].*) # followed by anything (group 1)
\*{1}/ # followed by one asterisk and a '/'
\s*$ # eventually followed by whitespace
\s*$ # probably followed by whitespace
'''
re_source_block_format1 = SourceBlockFormat( 1, start, column, start )
@ -89,18 +89,18 @@ re_source_block_format1 = SourceBlockFormat( 1, start, column, start )
start = r'''
\s* # any number of whitespace
/\*{2,} # followed by '/' and at least two asterisks
\s*$ # eventually followed by whitespace
\s*$ # probably followed by whitespace
'''
column = r'''
\s* # any number of whitespace
\*{1}(?!/) # followed by precisely one asterisk not followed by `/'
(.*) # then anything (group1)
\s* # any number of whitespace
\*{1}(?!/) # followed by precisely one asterisk not followed by `/'
(.*) # then anything (group1)
'''
end = r'''
\s* # any number of whitespace
\*+/ # followed by at least one asterisk, then '/'
\s* # any number of whitespace
\*+/ # followed by at least one asterisk, then '/'
'''
re_source_block_format2 = SourceBlockFormat( 2, start, column, end )
@ -228,7 +228,7 @@ class SourceBlock:
for tag in re_markup_tags:
if tag.match( l ):
self.content = lines
return
return
def location( self ):
return "(" + self.filename + ":" + repr( self.lineno ) + ")"
@ -282,8 +282,7 @@ class SourceProcessor:
self.format = None
def parse_file( self, filename ):
"""parse a C source file, and adds its blocks to the processor's list"""
"""parse a C source file, and add its blocks to the processor's list"""
self.reset()
self.filename = filename
@ -321,17 +320,17 @@ class SourceProcessor:
self.add_block_lines()
def process_normal_line( self, line ):
"""process a normal line and check if it's the start of a new block"""
"""process a normal line and check whether it is the start of a new block"""
for f in re_source_block_formats:
if f.start.match( line ):
self.add_block_lines()
self.format = f
self.lineno = fileinput.filelineno()
if f.start.match( line ):
self.add_block_lines()
self.format = f
self.lineno = fileinput.filelineno()
self.lines.append( line )
def add_block_lines( self ):
"""add the current accumulated lines, and create a new block"""
"""add the current accumulated lines and create a new block"""
if self.lines != []:
block = SourceBlock( self, self.filename, self.lineno, self.lines )