Pre-processing Scanner-subclass Code

class Scanner(_Scanner):
    def __init__(self, patterns, ignore, input):
        _Scanner.__init__(self, patterns, ignore, input)
        self.preProcess()

    def preProcess(self):
        B_LIT = r'"""[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""'
        A_LIT = r'"[^"\\]*(?:\\.[^"\\]*)*"'
        Token = re.compile(r'(%s|%s|<[^>]*>|\.\s*}|[^\s#]+)' % (B_LIT,
A_LIT))
        self.input = ' '.join([re.sub(r'^\.\s*}$', '}', token)
                             for token in Token.findall(self.input)])

For yappsrt.py--class Scanner needs to be renamed _Scanner.

--
Kindest Regards,
Sean B. Palmer
@prefix : <http://purl.org/net/swn#> .
:Sean :homepage <http://purl.org/net/sbp/> .

Received on Thursday, 15 August 2002 19:05:31 UTC