Esempio n. 1
0
    def integer(self, i):
        if i < 0: return (None, -1)

        # sequence of digits, possibly preceded by minus sign
        (v, j) = self.raw(i)
        if j >= 0:
            if  (len(v) > 0 and v.isdigit()) or \
                (len(v) > 1 and v[0] == '-' and v[1:].isdigit()):
                n = int(v)
                return (ast.NumSxp(n), j)

        return (None, -1)
def primoplus(args):
    assert (len(args) == 2)
    v1 = args[0]
    v2 = args[1]
    assert (isinstance(v1, ast.NumSxp) and isinstance(v2, ast.NumSxp))
    return ast.NumSxp(v1.number + v2.number)