Ejemplo n.º 1
0
def processXMLElement(xmlElement, xmlProcessor):
    "Process the xml element."
    if xmlElement.object == None:
        xmlElement.object = IndexValue(xmlElement)
    if xmlElement.object.inSplitWords == None:
        return
    if len(xmlProcessor.functions) < 1:
        print(
            'Warning, "for" element is not in a function in processXMLElement in for.py for:'
        )
        print(xmlElement)
        return
    function = xmlProcessor.functions[-1]
    inValue = evaluate.getEvaluatedExpressionValueBySplitLine(
        xmlElement.object.inSplitWords, xmlElement)
    if inValue.__class__ == list:
        for index, value in enumerate(inValue):
            processChildrenByIndexValue(function, index, xmlElement.object,
                                        value, xmlElement)
        return
    if inValue.__class__ == dict:
        inKeys = inValue.keys()
        inKeys.sort()
        for inKey in inKeys:
            processChildrenByIndexValue(function, inKey, xmlElement.object,
                                        inValue[inKey], xmlElement)
Ejemplo n.º 2
0
def processElementNode(elementNode):
	"Process the xml element."
	functions = elementNode.getXMLProcessor().functions
	if len(functions) < 1:
		print('Warning, there are no functions in processElementNode in statement for:')
		print(elementNode)
		return
	function = functions[-1]
	evaluate.setLocalAttribute(elementNode)
	if elementNode.xmlObject.value == None:
		print('Warning, elementNode.xmlObject.value is None in processElementNode in statement for:')
		print(elementNode)
		return
	localValue = evaluate.getEvaluatedExpressionValueBySplitLine(elementNode, elementNode.xmlObject.value)
	keywords = elementNode.xmlObject.key.split('.')
	if len(keywords) == 0:
		print('Warning, there are no keywords in processElementNode in statement for:')
		print(elementNode)
		return
	firstWord = keywords[0]
	if len(keywords) == 1:
		function.localDictionary[firstWord] = localValue
		return
	attributeName = keywords[-1]
	object = None
	if firstWord == 'self':
		object = function.classObject
	else:
		object = function.localDictionary[firstWord]
	for keywordIndex in xrange(1, len(keywords) - 1):
		object = object._getAccessibleAttribute(keywords[keywordIndex])
	object._setAccessibleAttribute(attributeName, localValue)
Ejemplo n.º 3
0
def processElementNode(elementNode):
    "Process the xml element."
    if elementNode.xmlObject is None:
        elementNode.xmlObject = IndexValue(elementNode)
    if elementNode.xmlObject.inSplitWords is None:
        return
    xmlProcessor = elementNode.getXMLProcessor()
    if len(xmlProcessor.functions) < 1:
        print(
            'Warning, "for" element is not in a function in processElementNode in for.py for:'
        )
        print(elementNode)
        return
    function = xmlProcessor.functions[-1]
    inValue = evaluate.getEvaluatedExpressionValueBySplitLine(
        elementNode, elementNode.xmlObject.inSplitWords)
    if inValue.__class__ == list or inValue.__class__ == str:
        for index, value in enumerate(inValue):
            processChildNodesByIndexValue(elementNode, function, index,
                                          elementNode.xmlObject, value)
        return
    if inValue.__class__ == dict:
        inKeys = inValue.keys()
        inKeys.sort()
        for inKey in inKeys:
            processChildNodesByIndexValue(elementNode, function, inKey,
                                          elementNode.xmlObject,
                                          inValue[inKey])
Ejemplo n.º 4
0
def processElementNode(elementNode):
	"Process the xml element."
	functions = elementNode.getXMLProcessor().functions
	if len(functions) < 1:
		print('Warning, there are no functions in processElementNode in statement for:')
		print(elementNode)
		return
	function = functions[-1]
	evaluate.setLocalAttribute(elementNode)
	if elementNode.xmlObject.value == None:
		print('Warning, elementNode.xmlObject.value is None in processElementNode in statement for:')
		print(elementNode)
		return
	localValue = evaluate.getEvaluatedExpressionValueBySplitLine(elementNode, elementNode.xmlObject.value)
	keywords = elementNode.xmlObject.key.split('.')
	if len(keywords) == 0:
		print('Warning, there are no keywords in processElementNode in statement for:')
		print(elementNode)
		return
	firstWord = keywords[0]
	if len(keywords) == 1:
		function.localDictionary[firstWord] = localValue
		return
	attributeName = keywords[-1]
	object = None
	if firstWord == 'self':
		object = function.classObject
	else:
		object = function.localDictionary[firstWord]
	for keywordIndex in xrange(1, len(keywords) - 1):
		object = object._getAccessibleAttribute(keywords[keywordIndex])
	object._setAccessibleAttribute(attributeName, localValue)
Ejemplo n.º 5
0
def processXMLElement( xmlElement, xmlProcessor ):
	"Process the xml element."
	functions = xmlProcessor.functions
	if len( functions ) < 1:
		return
	function = functions[ - 1 ]
	if xmlElement.object == None:
		xmlElement.object = getLocalAttribute(xmlElement)
	if xmlElement.object.keyTuple[1] != None:
		localValue = evaluate.getEvaluatedExpressionValueBySplitLine( xmlElement.object.keyTuple[1], xmlElement )
		function.localDictionary[ xmlElement.object.keyTuple[0] ] = localValue
Ejemplo n.º 6
0
def processXMLElement(xmlElement):
    "Process the xml element."
    functions = xmlElement.getXMLProcessor().functions
    if len(functions) < 1:
        return
    function = functions[-1]
    if xmlElement.object == None:
        xmlElement.object = getLocalAttribute(xmlElement)
    if xmlElement.object.keyTuple[1] != None:
        localValue = evaluate.getEvaluatedExpressionValueBySplitLine(
            xmlElement.object.keyTuple[1], xmlElement)
        function.localDictionary[xmlElement.object.keyTuple[0]] = localValue
Ejemplo n.º 7
0
def processXMLElement( xmlElement, xmlProcessor ):
	"Process the xml element."
	functions = xmlProcessor.functions
	if len( functions ) < 1:
		return
	function = functions[ - 1 ]
	function.shouldReturn = True
	if xmlElement.object == None:
		if 'return' in xmlElement.attributeDictionary:
			value = xmlElement.attributeDictionary['return']
			xmlElement.object = evaluate.getEvaluatorSplitWords( value )
		else:
			xmlElement.object = []
	if len( xmlElement.object ) > 0:
		function.returnValue = evaluate.getEvaluatedExpressionValueBySplitLine( xmlElement.object, xmlElement )
Ejemplo n.º 8
0
def processXMLElement(xmlElement):
	"Process the xml element."
	functions = xmlElement.getXMLProcessor().functions
	if len(functions) < 1:
		return
	function = functions[-1]
	function.shouldReturn = True
	if xmlElement.object == None:
		if 'return' in xmlElement.attributeDictionary:
			value = xmlElement.attributeDictionary['return']
			xmlElement.object = evaluate.getEvaluatorSplitWords(value)
		else:
			xmlElement.object = []
	if len( xmlElement.object ) > 0:
		function.returnValue = evaluate.getEvaluatedExpressionValueBySplitLine( xmlElement.object, xmlElement )
Ejemplo n.º 9
0
def processXMLElement( xmlElement, xmlProcessor ):
	"Process the xml element."
	if xmlElement.object == None:
		if 'condition' in xmlElement.attributeDictionary:
			value = xmlElement.attributeDictionary['condition']
			xmlElement.object = evaluate.getEvaluatorSplitWords( value )
		else:
			xmlElement.object = []
	if len( xmlElement.object ) < 1:
		return
	if len( xmlProcessor.functions ) < 1:
		return
	function = xmlProcessor.functions[ - 1 ]
	while evaluate.getEvaluatedExpressionValueBySplitLine( xmlElement.object, xmlElement ) > 0:
		function.processChildren(xmlElement)
Ejemplo n.º 10
0
def processElementNode(elementNode):
	"Process the xml element."
	functions = elementNode.getXMLProcessor().functions
	if len(functions) < 1:
		return
	function = functions[-1]
	function.shouldReturn = True
	if elementNode.xmlObject == None:
		if 'return' in elementNode.attributes:
			value = elementNode.attributes['return']
			elementNode.xmlObject = evaluate.getEvaluatorSplitWords(value)
		else:
			elementNode.xmlObject = []
	if len( elementNode.xmlObject ) > 0:
		function.returnValue = evaluate.getEvaluatedExpressionValueBySplitLine(elementNode, elementNode.xmlObject)
Ejemplo n.º 11
0
Archivo: while.py Proyecto: Ademan/Cura
def processElementNode(elementNode):
	"Process the xml element."
	if elementNode.xmlObject == None:
		if 'condition' in elementNode.attributes:
			value = elementNode.attributes['condition']
			elementNode.xmlObject = evaluate.getEvaluatorSplitWords(value)
		else:
			elementNode.xmlObject = []
	if len( elementNode.xmlObject ) < 1:
		return
	xmlProcessor = elementNode.getXMLProcessor()
	if len( xmlProcessor.functions ) < 1:
		return
	function = xmlProcessor.functions[-1]
	while evaluate.getEvaluatedExpressionValueBySplitLine(elementNode, elementNode.xmlObject) > 0:
		function.processChildNodes(elementNode)
Ejemplo n.º 12
0
def processXMLElement(xmlElement, xmlProcessor):
    "Process the xml element."
    if xmlElement.object == None:
        if 'condition' in xmlElement.attributeDictionary:
            value = xmlElement.attributeDictionary['condition']
            xmlElement.object = evaluate.getEvaluatorSplitWords(value)
        else:
            xmlElement.object = []
    if len(xmlElement.object) < 1:
        return
    if len(xmlProcessor.functions) < 1:
        return
    function = xmlProcessor.functions[-1]
    while evaluate.getEvaluatedExpressionValueBySplitLine(
            xmlElement.object, xmlElement) > 0:
        function.processChildren(xmlElement)
Ejemplo n.º 13
0
def processElementNode(elementNode):
    "Process the xml element."
    if elementNode.xmlObject == None:
        if 'condition' in elementNode.attributes:
            value = elementNode.attributes['condition']
            elementNode.xmlObject = evaluate.getEvaluatorSplitWords(value)
        else:
            elementNode.xmlObject = []
    if len(elementNode.xmlObject) < 1:
        return
    xmlProcessor = elementNode.getXMLProcessor()
    if len(xmlProcessor.functions) < 1:
        return
    function = xmlProcessor.functions[-1]
    while evaluate.getEvaluatedExpressionValueBySplitLine(
            elementNode, elementNode.xmlObject) > 0:
        function.processChildNodes(elementNode)
Ejemplo n.º 14
0
def processXMLElement( xmlElement, xmlProcessor ):
	"Process the xml element."
	if xmlElement.object == None:
		xmlElement.object = IndexValue(xmlElement)
	if xmlElement.object.inSplitWords == None:
		return
	if len( xmlProcessor.functions ) < 1:
		print('Warning, "for" element is not in a function in processXMLElement in for.py for:')
		print(xmlElement)
		return
	function = xmlProcessor.functions[ - 1 ]
	inValue = evaluate.getEvaluatedExpressionValueBySplitLine( xmlElement.object.inSplitWords, xmlElement )
	if inValue.__class__ == list or inValue.__class__ == str:
		for index, value in enumerate( inValue ):
			processChildrenByIndexValue( function, index, xmlElement.object, value, xmlElement )
		return
	if inValue.__class__ == dict:
		inKeys = inValue.keys()
		inKeys.sort()
		for inKey in inKeys:
			processChildrenByIndexValue( function, inKey, xmlElement.object, inValue[ inKey ], xmlElement )
Ejemplo n.º 15
0
def processElementNode(elementNode):
	"Process the xml element."
	if elementNode.xmlObject == None:
		elementNode.xmlObject = IndexValue(elementNode)
	if elementNode.xmlObject.inSplitWords == None:
		return
	xmlProcessor = elementNode.getXMLProcessor()
	if len( xmlProcessor.functions ) < 1:
		print('Warning, "for" element is not in a function in processElementNode in for.py for:')
		print(elementNode)
		return
	function = xmlProcessor.functions[-1]
	inValue = evaluate.getEvaluatedExpressionValueBySplitLine(elementNode, elementNode.xmlObject.inSplitWords)
	if inValue.__class__ == list or inValue.__class__ == str:
		for index, value in enumerate( inValue ):
			processChildNodesByIndexValue( elementNode, function, index, elementNode.xmlObject, value )
		return
	if inValue.__class__ == dict:
		inKeys = inValue.keys()
		inKeys.sort()
		for inKey in inKeys:
			processChildNodesByIndexValue( elementNode, function, inKey, elementNode.xmlObject, inValue[ inKey ] )