arelle.formula.XPathParser
¶
See COPYRIGHT.md for copyright information.
Module Contents¶
Classes¶
Functions¶
Data¶
def evaluateStack( self, s ): op = s.pop() if isinstance(op,FunctionDef): f = op args = [] for i in range(f.argcount): args.insert(0, self.evaluateStack( s )) if f.name == “sum”: return sum(args) elif f.name == “concat”: return “”.join(str(arg) for arg in args) elif isinstance(op,VariableRef): v = op if v.name in variables: return variables[v.name] else: return None else: if op in (“+”,”-“,”*”,”div”,”idiv”,”^”): op2 = self.evaluateStack( s ) op1 = self.evaluateStack( s ) if op1 and op2: return self.opn[op]( op1, op2 ) else: return None elif op == “(“: return self.evaluateStack( s ) else: return op |
|
API¶
- arelle.formula.XPathParser._: arelle.typing.TypeGetText¶
None
- arelle.formula.XPathParser.FormulaToken¶
None
- arelle.formula.XPathParser.RecursiveFormulaTokens¶
None
- arelle.formula.XPathParser.ExpressionStack¶
None
- arelle.formula.XPathParser.ixtFunctionNamespaces: set[str]¶
‘set(…)’
- arelle.formula.XPathParser.debug_flag¶
True
- arelle.formula.XPathParser.exprStack: arelle.formula.XPathParser.ExpressionStack¶
[]
- arelle.formula.XPathParser.xmlElement: arelle.ModelObject.ModelObject | None¶
None
- arelle.formula.XPathParser.modelXbrl: arelle.ModelXbrl.ModelXbrl | None¶
None
- arelle.formula.XPathParser.pluginCustomFunctionQNames: set[arelle.ModelValue.QName] | None¶
None
- class arelle.formula.XPathParser.ProgHeader(modelObject: arelle.ModelFormulaObject.ModelFormulaResource, name: str, element: arelle.ModelObject.ModelObject, sourceStr: str, traceType: int)¶
Initialization
- __repr__() str ¶
- arelle.formula.XPathParser.exprStackToksRIndex(toks: pyparsing.ParseResults) int ¶
- arelle.formula.XPathParser.exprStackTokRIndex(tok: arelle.formula.XPathParser.FormulaToken) int ¶
- arelle.formula.XPathParser.pushFirst(sourceStr: str, loc: int, toks: pyparsing.ParseResults) None ¶
- arelle.formula.XPathParser.pushFloat(sourceStr: str, loc: int, toks: pyparsing.ParseResults) float ¶
- arelle.formula.XPathParser.pushInt(sourceStr: str, loc: int, toks: pyparsing.ParseResults) int ¶
- arelle.formula.XPathParser.pushDecimal(sourceStr: str, loc: int, toks: pyparsing.ParseResults) decimal.Decimal ¶
- arelle.formula.XPathParser.pushQuotedString(sourceStr: str, loc: int, toks: pyparsing.ParseResults) str ¶
- class arelle.formula.XPathParser.QNameDef(loc: int, prefix: str | None, namespaceURI: str | None, localName: str, isAttribute: bool = False, axis: str | None = None)¶
Bases:
arelle.ModelValue.QName
Initialization
- __hash__() int ¶
- __repr__() str ¶
- __eq__(other: Any) bool ¶
- __ne__(other: Any) bool ¶
- arelle.formula.XPathParser.defaultNsmap¶
None
- arelle.formula.XPathParser.axesSupported¶
None
- arelle.formula.XPathParser.pushQName(sourceStr: str, loc: int, toks: pyparsing.ParseResults) arelle.formula.XPathParser.QNameDef | None ¶
- arelle.formula.XPathParser.pushAttr(sourceStr: str, loc: int, toks: pyparsing.ParseResults) arelle.formula.XPathParser.QNameDef ¶
- class arelle.formula.XPathParser.OpDef(loc: int, toks: pyparsing.ParseResults)¶
Initialization
- __repr__() str ¶
- __eq__(other: Any) bool ¶
- __ne__(other: Any) bool ¶
- arelle.formula.XPathParser.pushOp(sourceStr: str, loc: int, toks: pyparsing.ParseResults) arelle.formula.XPathParser.OpDef ¶
- class arelle.formula.XPathParser.OperationDef(sourceStr: str, loc: int, name: str | arelle.formula.XPathParser.QNameDef, toks: pyparsing.ParseResults | list[arelle.formula.XPathParser.FormulaToken], skipFirstTok: bool)¶
Initialization
- args: list[arelle.formula.XPathParser.FormulaToken]¶
None
- __repr__() str ¶
- arelle.formula.XPathParser.pushOperation(sourceStr: str, loc: int, toks: pyparsing.ParseResults) arelle.formula.XPathParser.OperationDef ¶
- arelle.formula.XPathParser.pushUnaryOperation(sourceStr: str, loc: int, toks: pyparsing.ParseResults) arelle.formula.XPathParser.OperationDef ¶
- arelle.formula.XPathParser.pushFunction(sourceStr: str, loc: int, toks: pyparsing.ParseResults) arelle.formula.XPathParser.OperationDef ¶
- arelle.formula.XPathParser.pushSequence(sourceStr: str, loc: int, toks: pyparsing.ParseResults) arelle.formula.XPathParser.OperationDef ¶
- arelle.formula.XPathParser.pushPredicate(sourceStr: str, loc: int, toks: pyparsing.ParseResults) arelle.formula.XPathParser.OperationDef ¶
- arelle.formula.XPathParser.pushRootStep(sourceStr: str, loc: int, toks: pyparsing.ParseResults) arelle.formula.XPathParser.OperationDef | None ¶
- class arelle.formula.XPathParser.VariableRef(loc: int, qname: arelle.ModelValue.QName)¶
Initialization
- __repr__() str ¶
- arelle.formula.XPathParser.pushVarRef(sourceStr: str, loc: int, toks: pyparsing.ParseResults) arelle.formula.XPathParser.VariableRef ¶
- class arelle.formula.XPathParser.RangeDecl(loc: int, toks: pyparsing.ParseResults)¶
Initialization
- __repr__() str ¶
- arelle.formula.XPathParser.pushRangeVar(sourceStr: str, loc: int, toks: pyparsing.ParseResults) arelle.formula.XPathParser.RangeDecl ¶
- class arelle.formula.XPathParser.Expr(loc: int, toks: pyparsing.ParseResults)¶
Initialization
- __repr__() str ¶
- arelle.formula.XPathParser.pushExpr(sourceStr: str, loc: int, toks: pyparsing.ParseResults) arelle.formula.XPathParser.Expr ¶
- arelle.formula.XPathParser.variableRef¶
‘Regex(…)’
- arelle.formula.XPathParser.qName¶
‘Regex(…)’
- arelle.formula.XPathParser.ncName¶
‘Word(…)’
- arelle.formula.XPathParser.prefixOp¶
‘Literal(…)’
- arelle.formula.XPathParser.exponentLiteralStr¶
‘[eE]’
- arelle.formula.XPathParser.plusorminusLiteralStr¶
‘[+-]’
- arelle.formula.XPathParser.digitsStr¶
‘\d+’
- arelle.formula.XPathParser.optionalDigitsStr¶
‘\d*’
- arelle.formula.XPathParser.decimalPointStr¶
‘.’
- arelle.formula.XPathParser.nanLiteralStr¶
‘NaN’
- arelle.formula.XPathParser.integerLiteralStr¶
None
- arelle.formula.XPathParser.decimalFractionLiteralStr¶
None
- arelle.formula.XPathParser.infLiteralStr¶
None
- arelle.formula.XPathParser.decimalPoint¶
‘Literal(…)’
- arelle.formula.XPathParser.exponentLiteral¶
‘Regex(…)’
- arelle.formula.XPathParser.plusorminusLiteral¶
None
- arelle.formula.XPathParser.digits¶
‘Word(…)’
- arelle.formula.XPathParser.integerLiteral¶
‘Regex(…)’
- arelle.formula.XPathParser.decimalFractionLiteral¶
‘Regex(…)’
- arelle.formula.XPathParser.infLiteral¶
‘Regex(…)’
- arelle.formula.XPathParser.nanLiteral¶
‘Regex(…)’
- arelle.formula.XPathParser.floatLiteral¶
‘Regex(…)’
- arelle.formula.XPathParser.decimalLiteral¶
‘Regex(…)’
- arelle.formula.XPathParser.lParen¶
‘Literal(…)’
- arelle.formula.XPathParser.rParen¶
‘Literal(…)’
- arelle.formula.XPathParser.lPred¶
‘Literal(…)’
- arelle.formula.XPathParser.rPred¶
‘Literal(…)’
- arelle.formula.XPathParser.expOp¶
‘Literal(…)’
- arelle.formula.XPathParser.commaOp¶
‘Literal(…)’
- arelle.formula.XPathParser.forOp¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.someOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.everyOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.quantifiedOp¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.inOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.returnOp¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.satisfiesOp¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.ifOp¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.thenOp¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.elseOp¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.andOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.orOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.eqValueOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.neValueOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.ltValueOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.leValueOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.gtValueOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.geValueOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.valueCompOp¶
None
- arelle.formula.XPathParser.isNodeOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.precedesNodeOp¶
‘Literal(…)’
- arelle.formula.XPathParser.followsNodeOp¶
‘Literal(…)’
- arelle.formula.XPathParser.nodeCompOp¶
None
- arelle.formula.XPathParser.neGeneralOp¶
‘Literal(…)’
- arelle.formula.XPathParser.leGeneralOp¶
‘Literal(…)’
- arelle.formula.XPathParser.ltGeneralOp¶
‘Literal(…)’
- arelle.formula.XPathParser.geGeneralOp¶
‘Literal(…)’
- arelle.formula.XPathParser.gtGeneralOp¶
‘Literal(…)’
- arelle.formula.XPathParser.eqGeneralOp¶
‘Literal(…)’
- arelle.formula.XPathParser.generalCompOp¶
None
- arelle.formula.XPathParser.comparisonOp¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.toOp¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.plusOp¶
‘Literal(…)’
- arelle.formula.XPathParser.minusOp¶
‘Literal(…)’
- arelle.formula.XPathParser.plusMinusOp¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.multOp¶
‘Literal(…)’
- arelle.formula.XPathParser.divOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.idivOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.modOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.multDivOp¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.unionWordOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.unionSymbOp¶
‘Literal(…)’
- arelle.formula.XPathParser.unionOp¶
None
- arelle.formula.XPathParser.intersectOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.exceptOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.intersectExceptOp¶
None
- arelle.formula.XPathParser.instanceOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.ofOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.treatOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.asOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.castableOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.castOp¶
‘Keyword(…)’
- arelle.formula.XPathParser.unaryOp¶
None
- arelle.formula.XPathParser.occurOptionalOp¶
‘Literal(…)’
- arelle.formula.XPathParser.occurAnyOp¶
None
- arelle.formula.XPathParser.occurAtLeastOnceOp¶
None
- arelle.formula.XPathParser.occurrenceOp¶
None
- arelle.formula.XPathParser.wildOp¶
None
- arelle.formula.XPathParser.typeName¶
None
- arelle.formula.XPathParser.elementName¶
None
- arelle.formula.XPathParser.attributeName¶
None
- arelle.formula.XPathParser.elementDeclaration¶
None
- arelle.formula.XPathParser.schemaElementTest¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.elementNameOrWildcard¶
None
- arelle.formula.XPathParser.elementTest¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.attributeDeclaration¶
None
- arelle.formula.XPathParser.schemaAttributeTest¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.attribNameOrWildcard¶
None
- arelle.formula.XPathParser.attributeTest¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.PITest¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.commentTest¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.textTest¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.documentTest¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.anyKindTest¶
‘set_parse_action(…)’
- arelle.formula.XPathParser.kindTest¶
None
- arelle.formula.XPathParser.wildcard¶
None
- arelle.formula.XPathParser.nameTest¶
None
- arelle.formula.XPathParser.nodeTest¶
None
- arelle.formula.XPathParser.abbrevForwardStep¶
None
- arelle.formula.XPathParser.atomicType¶
None
- arelle.formula.XPathParser.itemType¶
None
- arelle.formula.XPathParser.occurrenceIndicator¶
None
- arelle.formula.XPathParser.sequenceType¶
None
- arelle.formula.XPathParser.singleType¶
None
- arelle.formula.XPathParser.contextItem¶
None
- arelle.formula.XPathParser.pathDescOp¶
‘Literal(…)’
- arelle.formula.XPathParser.pathStepOp¶
‘Literal(…)’
- arelle.formula.XPathParser.pathOp¶
None
- arelle.formula.XPathParser.pathRootOp¶
‘Regex(…)’
- arelle.formula.XPathParser.axisOp¶
‘Literal(…)’
- arelle.formula.XPathParser.forwardAxis¶
None
- arelle.formula.XPathParser.forwardStep¶
None
- arelle.formula.XPathParser.reverseAxis¶
None
- arelle.formula.XPathParser.abbrevReverseStep¶
‘Literal(…)’
- arelle.formula.XPathParser.reverseStep¶
None
- arelle.formula.XPathParser.step¶
None
- arelle.formula.XPathParser.expr¶
‘Forward(…)’
- arelle.formula.XPathParser.atom¶
None
- arelle.formula.XPathParser.stepExpr¶
None
- arelle.formula.XPathParser.relativePathExpr¶
None
- arelle.formula.XPathParser.pathExpr¶
None
- arelle.formula.XPathParser.valueExpr¶
None
- arelle.formula.XPathParser.unaryExpr¶
None
- arelle.formula.XPathParser.castExpr¶
None
- arelle.formula.XPathParser.castableExpr¶
None
- arelle.formula.XPathParser.treatExpr¶
None
- arelle.formula.XPathParser.instanceOfExpr¶
None
- arelle.formula.XPathParser.intersectExceptExpr¶
None
- arelle.formula.XPathParser.unionExpr¶
None
- arelle.formula.XPathParser.multiplicitaveExpr¶
None
- arelle.formula.XPathParser.additiveExpr¶
None
- arelle.formula.XPathParser.rangeExpr¶
None
- arelle.formula.XPathParser.comparisonExpr¶
None
- arelle.formula.XPathParser.andExpr¶
None
- arelle.formula.XPathParser.orExpr¶
None
- arelle.formula.XPathParser.xpathExpr¶
None
- arelle.formula.XPathParser.opn¶
None
def evaluateStack( self, s ): op = s.pop() if isinstance(op,FunctionDef): f = op args = [] for i in range(f.argcount): args.insert(0, self.evaluateStack( s )) if f.name == “sum”: return sum(args) elif f.name == “concat”: return “”.join(str(arg) for arg in args) elif isinstance(op,VariableRef): v = op if v.name in variables: return variables[v.name] else: return None else: if op in (“+”,”-“,”*”,”div”,”idiv”,”^”): op2 = self.evaluateStack( s ) op1 = self.evaluateStack( s ) if op1 and op2: return self.opn[op]( op1, op2 ) else: return None elif op == “(“: return self.evaluateStack( s ) else: return op
- arelle.formula.XPathParser.normalizeExpr(expr: str) str ¶
- arelle.formula.XPathParser.isInitialized¶
False
- arelle.formula.XPathParser.initializeParser(modelManager: arelle.ModelManager.ModelManager) bool ¶
- arelle.formula.XPathParser.exceptionErrorIndication(exception: arelle.formula.XPathContext.XPathException | pyparsing.ParseBaseException) str ¶
- arelle.formula.XPathParser._staticExpressionFunctionContext: xml.dom.minidom.Element | None¶
None
- arelle.formula.XPathParser.staticExpressionFunctionContext() xml.dom.minidom.Element ¶
- arelle.formula.XPathParser.parse(modelObject: arelle.ModelFormulaObject.ModelFormulaResource, xpathExpression: str | None, element: arelle.ModelObject.ModelObject | None, name: str, traceType: int) arelle.formula.XPathParser.ExpressionStack | None ¶
- arelle.formula.XPathParser.variableReferencesSet(exprStack: arelle.formula.XPathParser.ExpressionStack | None, element: arelle.ModelFormulaObject.ModelFormulaResource) set[arelle.ModelValue.QName] ¶
- arelle.formula.XPathParser.variableReferences(exprStack: arelle.formula.XPathParser.RecursiveFormulaTokens, varRefSet: set[arelle.ModelValue.QName], element: arelle.ModelObject.ModelObject, rangeVars: list[arelle.ModelValue.QName] | None = None) None ¶
- arelle.formula.XPathParser.prefixDeclarations(exprStack: arelle.formula.XPathParser.RecursiveFormulaTokens, xmlnsDict: dict[str, str | None], element: arelle.ModelObject.ModelObject) None ¶
- arelle.formula.XPathParser.clearProg(exprStack: arelle.formula.XPathParser.ExpressionStack | None) None ¶
- arelle.formula.XPathParser.clearNamedProg(ownerObject: arelle.ModelFormulaObject.ModelFormulaResource, progName: str) None ¶
- arelle.formula.XPathParser.clearNamedProgs(ownerObject: arelle.ModelFormulaObject.ModelFormulaResource, progsListName: str) None ¶
- arelle.formula.XPathParser.codeModule(code: collections.abc.Iterable[Any]) str ¶
- arelle.formula.XPathParser.parser_unit_test() None ¶