コード例 #1
0
    def TokenTerm(self):
        g = self.TokenFactor()
        while self.StartOf(6):
            g2 = self.TokenFactor()
            Graph.MakeSequence(g, g2)

        if (self.la.kind == Scanner.CONTEXT_Sym):
            self.Get()
            self.Expect(Scanner.lparen_Sym)
            g2 = self.TokenExpr()
            Graph.SetContextTrans(g2.l)
            Graph.MakeSequence(g, g2)
            self.Expect(Scanner.rparen_Sym)
        return g
コード例 #2
0
    def Term(self):
        rslv = None
        g = None
        if self.StartOf(22):
            if (self.la.kind == Scanner.IF_Sym):
                rslv = Node(Node.rslv, None, self.la.line)
                rslv.pos = self.Resolver()
                g = Graph(rslv)
            g2 = self.Factor()
            if rslv is not None:
                Graph.MakeSequence(g, g2)
            else:
                g = g2
            while self.StartOf(23):
                g2 = self.Factor()
                Graph.MakeSequence(g, g2)

        elif self.StartOf(24):
            g = Graph(Node(Node.eps, None, 0))
        else:
            self.SynErr(67)
        if g is None:  # invalid start of Term
            g = Graph(Node(Node.eps, None, 0))
        return g