Exemplo n.º 1
0
 def createNumericExpr(self, operator, left, right):
     if operator == MINUS_OPERATOR and right is None:
         return ParsedExpr.ParsedUnaryExpr(left)
     cl = self.opMap[operator]
     if type(cl) is types.TupleType:
         return cl[0](cl[1], left, right)
     return cl(left, right)
Exemplo n.º 2
0
def andExpr2(self, __stack, __ptr):
    """
    from XPath/XPathBase.bgen.frag, line 495
    andExpr: andExpr AND equalityExpr
    """
    __val = ParsedExpr.ParsedAndExpr(__stack[__ptr + 1], __stack[__ptr + 3])
    return __val
Exemplo n.º 3
0
def filterExpr2(self, __stack, __ptr):
    """
    from XPath/XPathBase.bgen.frag, line 460
    filterExpr: primaryExpr predicateList
    """
    __val = ParsedExpr.ParsedFilterExpr(__stack[__ptr + 1], __stack[__ptr + 2])
    return __val
Exemplo n.º 4
0
def unaryExpr2(self, __stack, __ptr):
    """
    from XPath/XPathBase.bgen.frag, line 634
    unaryExpr: '-' unionExpr
    """
    __val = ParsedExpr.ParsedUnaryExpr(__stack[__ptr + 2])
    return __val
Exemplo n.º 5
0
def functionCall1(self, __stack, __ptr):
    """
    from XPath/XPathBase.bgen.frag, line 339
    functionCall: FUNCTION_NAME '(' ')'
    """
    __val = ParsedExpr.ParsedFunctionCallExpr(__stack[__ptr + 1], [])
    return __val
Exemplo n.º 6
0
def unionExpr2(self, __stack, __ptr):
    """
    from XPath/XPathBase.bgen.frag, line 409
    unionExpr: unionExpr '|' pathExpr
    """
    __val = ParsedExpr.ParsedUnionExpr(__stack[__ptr + 1], __stack[__ptr + 3])
    return __val
Exemplo n.º 7
0
def primaryExpr4(self, __stack, __ptr):
    """
    from XPath/XPathBase.bgen.frag, line 322
    primaryExpr: NLITERAL
    """
    __val = ParsedExpr.ParsedNLiteralExpr(__stack[__ptr + 1])
    return __val
Exemplo n.º 8
0
def primaryExpr1(self, __stack, __ptr):
    """
    from XPath/XPathBase.bgen.frag, line 292
    primaryExpr: VARIABLE_REFERENCE
    """
    __val = ParsedExpr.ParsedVariableReferenceExpr(__stack[__ptr + 1])
    return __val
Exemplo n.º 9
0
def orExpr2(self, __stack, __ptr):
    """
    from XPath/XPathBase.bgen.frag, line 477
    orExpr: orExpr OR andExpr
    """
    __val = ParsedExpr.ParsedOrExpr(__stack[__ptr + 1], __stack[__ptr + 3])
    return __val
Exemplo n.º 10
0
def pathExpr4(self, __stack, __ptr):
    """
    from XPath/XPathBase.bgen.frag, line 441
    pathExpr: filterExpr DOUBLE_SLASH relativeLocationPath
    """
    __val = ParsedExpr.ParsedPathExpr(__stack[__ptr + 2], __stack[__ptr + 1],
                                      __stack[__ptr + 3])
    return __val
Exemplo n.º 11
0
def pathExpr3(self, __stack, __ptr):
    """
    from XPath/XPathBase.bgen.frag, line 430
    pathExpr: filterExpr '/' relativeLocationPath
    """
    __val = ParsedExpr.ParsedPathExpr(__stack[__ptr + 2], __stack[__ptr + 1],
                                      __stack[__ptr + 3])
    return __val
Exemplo n.º 12
0
def functionCall2(self, __stack, __ptr):
    """
    from XPath/XPathBase.bgen.frag, line 352
    functionCall: FUNCTION_NAME '(' argumentList ')'
    """
    __val = ParsedExpr.ParsedFunctionCallExpr(__stack[__ptr + 1],
                                              __stack[__ptr + 3])
    return __val
Exemplo n.º 13
0
def additiveExpr3(self, __stack, __ptr):
    """
    from XPath/XPathBase.bgen.frag, line 580
    additiveExpr: additiveExpr '-' multiplicativeExpr
    """
    __val = ParsedExpr.ParsedAdditiveExpr(-1, __stack[__ptr + 1],
                                          __stack[__ptr + 3])
    return __val
Exemplo n.º 14
0
def equalityExpr2(self, __stack, __ptr):
    """
    from XPath/XPathBase.bgen.frag, line 513
    equalityExpr: equalityExpr EQUALITY_OP relationalExpr
    """
    __val = ParsedExpr.ParsedEqualityExpr(__stack[__ptr + 2],
                                          __stack[__ptr + 1],
                                          __stack[__ptr + 3])
    return __val
Exemplo n.º 15
0
def multiplicativeExpr2(self, __stack, __ptr):
    """
    from XPath/XPathBase.bgen.frag, line 598
    multiplicativeExpr: multiplicativeExpr MULTIPLY_OPERATOR unaryExpr
    """
    ops = {
        '*': 0,
        'div': 1,
        'mod': 2,
    }
    __val = ParsedExpr.ParsedMultiplicativeExpr(ops[__stack[__ptr + 2]],
                                                __stack[__ptr + 1],
                                                __stack[__ptr + 3])
    return __val
Exemplo n.º 16
0
def relationalExpr2(self, __stack, __ptr):
    """
    from XPath/XPathBase.bgen.frag, line 531
    relationalExpr: relationalExpr RELATIONAL_OP additiveExpr
    """
    ops = {
        '<': 0,
        '>': 2,
        '<=': 1,
        '>=': 3,
    }
    __val = ParsedExpr.ParsedRelationalExpr(ops[__stack[__ptr + 2]],
                                            __stack[__ptr + 1],
                                            __stack[__ptr + 3])
    return __val
Exemplo n.º 17
0
 def createFunctionCall(self, prefix, localName, args):
     if prefix:
         return ParsedExpr.ParsedFunctionCallExpr(prefix + ':' + localName,
                                                  args)
     else:
         return ParsedExpr.ParsedFunctionCallExpr(localName, args)
Exemplo n.º 18
0
 def createVariableReference(self, prefix, localName):
     if prefix:
         return ParsedExpr.ParsedVariableReferenceExpr('$' + prefix + ':' +
                                                       localName)
     else:
         return ParsedExpr.ParsedVariableReferenceExpr('$' + localName)
Exemplo n.º 19
0
 def createFilterExpr(self, filter, predicates):
     return ParsedExpr.ParsedFilterExpr(filter,
                                        ParsedPredicateList(predicates))
Exemplo n.º 20
0
 def createAbbreviatedPathExpr(self, left, right):
     return ParsedExpr.ParsedPathExpr(XPATH.DOUBLE_SLASH, left, right)
Exemplo n.º 21
0
 def createPathExpr(self, left, right):
     return ParsedExpr.ParsedPathExpr("/", left, right)