compiler.py 文件源码

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

项目:querygraph 作者: peter-woyzbun 项目源码 文件源码
def compile(self):
        manipulation_set = pp.Optional(pp.Suppress(pp.Keyword("THEN")) +
                                       pp.Suppress("|") + pp.SkipTo(pp.Suppress(";"), include=True))
        manipulation_set.setParseAction(lambda x: self._add_manipulation_set(x[0]))

        parser = (pp.Keyword("CONNECT") + self.connect_block.parser() +
                  pp.Keyword("RETRIEVE") + self.retrieve_block.parser() +
                  pp.Optional(pp.Keyword("JOIN") + self.join_block.parser()))
        try:
            parser.parseString(self.qgl_str)
        except pp.ParseException, e:
            raise QGLSyntaxError("Couldn't parse query: \n %s" % e)
        self._create_connectors()
        self._create_query_nodes()
        if self.join_block:
            self._create_joins()
        if self.manipulation_set_str:
            self.query_graph.manipulation_set.append_from_str(self.manipulation_set_str)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号