def ParseOMS(node): global attr # returns a function or an object if attr: return T.OMSymbol(node.get('cd'), node.get('name')) if not (node.get('cd') in omdicts.keys()): return T.OMError(T.OMSymbol("error", "unsupported_CD"), ParseOMS_E(node)) if not (node.get("name") in omdicts[node.get("cd")].keys()): return T.OMError(T.OMSymbol("error", "unexpected_symbol"), ParseOMS_E(node)) return omdicts[node.get('cd')][node.get('name')]
def ParseOMATTR(node): global attr attr = True omatp = ParseOMATP(node[0]) attr = False sym = ParseOMelement(node[1]) return T.OMAttr(omatp, sym)
def matrix(rows): return T.Matrix(rows)
def matrixrow(elements): return T.MatrixRow(elements)
def complex1_complex_cartesian(values): return T.ComplexCartesian(values[0], values[1])
def nums1_rational(values): return T.Rational(values[0], values[1])
def ParseOME(node): elts = [] elts.append(ParseOMS_E(node[0])) elts.append(ParseOMS_E(node[1])) # First element is error type as a string and second is the symbol on which the error occured return T.OMError(elts[0], elts[1])
def ParseOMS_E(node): return T.OMSymbol(node.get('cd'), node.get('name'))
def oms_relation1_leq(x): return T.Relation(operator.le, x[0], x[1])
def oms_relation1_lt(x): return T.Relation(operator.gt, x[0], x[1])
def oms_relation1_eq(x): return T.Relation(operator.eq, x[0], x[1])