cfg.py 文件源码

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

项目:neighborhood_mood_aws 作者: jarrellmark 项目源码 文件源码
def _markproduction(self, prod, tree=None):
        if tree is None: tree = self._tree
        for i in range(len(tree.subtrees())-len(prod.rhs())):
            if tree['color', i] == 'white':
                self._markproduction

            for j, node in enumerate(prod.rhs()):
                widget = tree.subtrees()[i+j]
                if (isinstance(node, Nonterminal) and
                    isinstance(widget, TreeSegmentWidget) and
                    node.symbol == widget.label().text()):
                    pass # matching nonterminal
                elif (isinstance(node, compat.string_types) and
                      isinstance(widget, TextWidget) and
                      node == widget.text()):
                    pass # matching nonterminal
                else: break
            else:
                # Everything matched!
                print('MATCH AT', i)

    #//////////////////////////////////////////////////
    # Grammar
    #//////////////////////////////////////////////////
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号