diff --git a/pyren/mod_db_manager.py b/pyren/mod_db_manager.py index 73ef6be..bbfff64 100644 --- a/pyren/mod_db_manager.py +++ b/pyren/mod_db_manager.py @@ -75,7 +75,7 @@ def find_DBs(): mod_globals.opt_ddt = True #check cache version - verfilename = "./cache/version09r_fix#1.txt" + verfilename = "./cache/version09r_fix#2.txt" if not os.path.isfile(verfilename): #if the cache has old version then we should clear it for root, dirs, files in os.walk("./cache"): diff --git a/pyren/mod_ecu_identification.py b/pyren/mod_ecu_identification.py index 522d0b0..4fe0918 100755 --- a/pyren/mod_ecu_identification.py +++ b/pyren/mod_ecu_identification.py @@ -88,13 +88,33 @@ class ecu_identification: for cmpt in Computation: self.type = cmpt.getAttribute("type") tmp = cmpt.getElementsByTagName("Value").item(0).firstChild.nodeValue - self.computation = tmp.replace(" ","").replace("&","&") + tmp = tmp.replace(" ","").replace("&","&") + + questionMarkCount = tmp.count('?"') + if questionMarkCount: + tmp = self.changeHwNumberComputation(tmp, questionMarkCount) + + self.computation = tmp self.mnemolist = [] Mnemo = cmpt.getElementsByTagName("Mnemo") if Mnemo: for mn in Mnemo: self.mnemolist.append(mn.getAttribute("name")) + + def changeHwNumberComputation(self, comp, counter): + firstPos = 0 + lastPos = 0 + for num in range(counter): + firstPos = comp.find('?"', lastPos + 1) + if(comp[firstPos-1] != ')'): + mnemonicBegin = comp.rfind('(', lastPos ,firstPos) + mnemonicSubstring = comp[mnemonicBegin:firstPos] + if mnemonicSubstring.count('(') > 1: + return comp + comp = comp.replace(mnemonicSubstring, '('+ mnemonicSubstring + ')') + lastPos = firstPos + 2 + return comp class ecu_identifications: diff --git a/pyren/mod_ply.py b/pyren/mod_ply.py index b6cc709..0af3eb5 100755 --- a/pyren/mod_ply.py +++ b/pyren/mod_ply.py @@ -197,7 +197,7 @@ class Calc(Parser): def p_expression_plus(self, p): 'expression : expression PLUS expression' if type(p[1]) is str or type(p[3]) is str: - p[0] = str(p[1]) + str(p[3]) + p[0] = str(p[1]).replace('"', '') + str(p[3]) else: p[0] = p[1] + p[3] p_expression_plus.func_doc='expression : expression PLUS expression'