Skip to content

Commit

Permalink
restore_pat needed to be executed twice
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Moore committed Nov 21, 2007
1 parent d0422d3 commit d6bf469
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bin/yuidoc_parse.py
Expand Up @@ -115,7 +115,8 @@ def getClassName(self, classString, namespace):

# extract regex literals in case they contain
#regex_pat = re.compile(r'(\/.*?(?<=[^\\])\/)')
regex_pat = re.compile(r'(\/[^\s\/\*][^\n]*?(?<=[^\\])\/)')
#regex_pat = re.compile(r'(\/[^\s\/\*][^\n]*?(?<=[^\\])\/)')
regex_pat = re.compile(r'(\/[^\s\/\*][^\n]*\/)')

# the token we will use to restore the string literals
replaceToken = '~~~%s~~~'
Expand Down Expand Up @@ -159,12 +160,13 @@ def extract(self):

# removes string literals and puts in a placeholder
def insertToken_sub(mo):
# log.info("\n\n%s:\n\n%s\n" %("extracted", unicode(mo.groups())))
# log.info("\n\n%s: %s\n" %("extracted", unicode(mo.groups())))
literals.append(mo.group())
return self.replaceToken % (len(literals) - 1)

# restores string literals
def restore_sub(mo):
# log.info("\n\n%s: %s\n" %("restore", unicode(literals[int(mo.group(1))])))
return literals[int(mo.group(1))]

# guesses name and type
Expand All @@ -191,6 +193,9 @@ def match_sub(match):
# restore string literals
block = self.restore_pat.sub(restore_sub, block)

# twice
block = self.restore_pat.sub(restore_sub, block)

# guess the name and type of the property/method based on the line
# after the comment
if match.group(4):
Expand Down

0 comments on commit d6bf469

Please sign in to comment.