vhdl_lang.py 文件源码

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

项目:VHDL-Mode 作者: Remillard 项目源码 文件源码
def parse_str(self, gen_str):
        """Attempts to extract the information from a generic interface."""
        # Right now I'm going to punt.  There are so many variations
        # on these that it's difficult to write a RE for it.  Also
        # there are few ways to have to rewrite it.  We will extract
        # a name, and then a type string (which may include defaults)
        gen_pattern = r'\s?(?P<name>.*?)\s?(?::)\s?(?P<type>.*)'
        gp = re.compile(gen_pattern, re.IGNORECASE)
        s = re.search(gp, gen_str)
        if s:
            self.name = s.group('name')
            # Sometimes the type has a trailing space.  Eliminating it.
            self.type = re.sub(r'\s*$', '', s.group('type'))
            self.success = True
        else:
            print('vhdl-mode: Could not parse generic string.')
            self.success = False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号