|
@@ -90,6 +90,9 @@ def class2qsp(text):
|
|
|
|
|
|
lookupArguments = lookupArguments.split('?')
|
|
|
lookupVar = lookupArguments[0] # #this.height
|
|
|
+ lookupSysVar = '_sys_lookup_'+filenameCleaned + str(match.start())
|
|
|
+ lookupText += lookupSysVar+'='+lookupVar+'\n'
|
|
|
+
|
|
|
lookupValuePairs = lookupArguments[1].split(',') # ['\n 0-40: 1', '\n 41-100:2\n ']
|
|
|
|
|
|
#print(lookupValuePairs)
|
|
@@ -105,7 +108,9 @@ def class2qsp(text):
|
|
|
lowerValue = lookupValuePairRange[1:seperatorPos]
|
|
|
higherValue = lookupValuePairRange[seperatorPos+1:len(lookupValuePairRange)-1]
|
|
|
#print(lowerValue+"-"+higherValue)
|
|
|
- lookupCondition = lookupVar + '>='+lowerValue+' and '+lookupVar+'<='+higherValue
|
|
|
+ lookupCondition = lookupSysVar + '>='+lowerValue+' and '+lookupSysVar+'<='+higherValue
|
|
|
+ else:
|
|
|
+ lookupCondition = lookupSysVar + '='+lookupValuePairRange[1:len(lookupValuePairRange)-1]
|
|
|
|
|
|
#print(lookupCondition)
|
|
|
|
|
@@ -117,6 +122,7 @@ def class2qsp(text):
|
|
|
|
|
|
lookupValuePairCounter += 1
|
|
|
lookupText += '\t\tend\n'
|
|
|
+ lookupText += "killvar '"+lookupSysVar+"'\n"
|
|
|
get_text = lookupText
|
|
|
get_done = True
|
|
|
|
|
@@ -135,8 +141,67 @@ def class2qsp(text):
|
|
|
field_count_get += 1
|
|
|
|
|
|
#SET Arguments
|
|
|
+ set_done = False
|
|
|
set_text = ''
|
|
|
- if field_arguments.find('GET(') < 0:
|
|
|
+ currentPos = field_arguments.find('SET(')
|
|
|
+ if currentPos >= 0:
|
|
|
+ currentPos += len('GET(') - 1
|
|
|
+
|
|
|
+ setArguments = getNestedText(field_arguments[currentPos:],'(',')')
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ currentPosLookup = setArguments.find('LOOKUP(')
|
|
|
+
|
|
|
+ if currentPosLookup >= 0:
|
|
|
+ lookupText = ''
|
|
|
+ currentPosLookup += len('LOOKUP(') - 1
|
|
|
+ lookupArguments = getNestedText(setArguments[currentPosLookup:],'(',')')
|
|
|
+ #print(lookupArguments)
|
|
|
+
|
|
|
+ lookupArguments = lookupArguments.split('?')
|
|
|
+ lookupVar = lookupArguments[0] # #this.height
|
|
|
+
|
|
|
+ lookupValuePairs = lookupArguments[1].split(',') # ['\n 0-40: 1', '\n 41-100:2\n ']
|
|
|
+
|
|
|
+ #print(lookupValuePairs)
|
|
|
+ lookupValuePairCounter = 0
|
|
|
+ for lookupValuePair in lookupValuePairs:
|
|
|
+ if lookupValuePairCounter > 0: lookupText += '\t\telse'
|
|
|
+ lookupCondition = ""
|
|
|
+ lookupValuePairDetails = lookupValuePair.split(':')
|
|
|
+ lookupValuePairRange = lookupValuePairDetails[0].strip()
|
|
|
+ if lookupValuePairRange[0] == "[":
|
|
|
+ seperatorPos = lookupValuePairRange.find('/')
|
|
|
+ if seperatorPos >= 0:
|
|
|
+ lowerValue = lookupValuePairRange[1:seperatorPos]
|
|
|
+ higherValue = lookupValuePairRange[seperatorPos+1:len(lookupValuePairRange)-1]
|
|
|
+ #print(lowerValue+"-"+higherValue)
|
|
|
+ lookupCondition = field_name_prefix + 'ARGS[2]>='+lowerValue+' and '+field_name_prefix+'ARGS[2]<='+higherValue
|
|
|
+ else:
|
|
|
+ lookupCondition = field_name_prefix + 'ARGS[2]='+lookupValuePairRange[1:len(lookupValuePairRange)-1]
|
|
|
+
|
|
|
+ #print(lookupCondition)
|
|
|
+
|
|
|
+ lookupValuePairValue = lookupValuePairDetails[1].strip()
|
|
|
+ lookupVarSuffix = ''
|
|
|
+ if lookupVar[0] == '#':
|
|
|
+ lookupVarSuffix = '#' # for var2qsp
|
|
|
+
|
|
|
+ lookupText += 'if '+lookupCondition+':\n\t\t\t'+lookupVar+'='+lookupValuePairValue+lookupVarSuffix+'\n'
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ lookupValuePairCounter += 1
|
|
|
+ lookupText += '\t\tend\n'
|
|
|
+ lookupText += "killvar '"+lookupSysVar+"'\n"
|
|
|
+ set_text = lookupText
|
|
|
+ set_done = True
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if field_arguments.find('GET(') < 0 and set_done == False:
|
|
|
set_text = '\t\t'+field_name_prefix+class_name+'_'+field_name+'='+field_name_prefix+'ARGS[2]\n'
|
|
|
|
|
|
if set_text != '':
|
|
@@ -265,6 +330,12 @@ def messages2qsp(text):
|
|
|
text = (text[:max(match.start(),0)] + "gs 'util_message','add','Error',"+ match.groups()[0] + text[match.end():])
|
|
|
match = re.search(regex, text, re.IGNORECASE)
|
|
|
|
|
|
+ regex = r"!\s*WARNING\(([^\)]+)\)"
|
|
|
+ match = re.search(regex, text, re.IGNORECASE)
|
|
|
+ while match is not None:
|
|
|
+ text = (text[:max(match.start(),0)] + "gs 'util_message','add','Warning',"+ match.groups()[0] + text[match.end():])
|
|
|
+ match = re.search(regex, text, re.IGNORECASE)
|
|
|
+
|
|
|
return text
|
|
|
|
|
|
def syntaxAdditions2qsp(text):
|