algo.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:bibmanagement 作者: AlexandreRio 项目源码 文件源码
def process(self, string, pos):
        """Expand active characters and macros in string.

        Raises InputError if it encounters an active character or
        macro it doesn't recognize.
        """

        self.__data = string
        self.__off = 0
        self.__pos = pos

        # Process macros
        while True:
            m = tex_cs_re.search(self.__data, self.__off)
            if not m:
                break
            self.__off = m.end()
            macro = m.group(1)
            nval = self._expand(macro)
            if nval is None:
                if macro.startswith('\\'):
                    pos.raise_error('unknown macro `{}\''.format(macro))
                pos.raise_error(
                    'unknown special character `{}\''.format(macro))
            self.__data = self.__data[:m.start()] + nval + \
                          self.__data[self.__off:]
            self.__off = m.start() + len(nval)

        return self.__data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号