def p_dictline(self, p): '''dictline : dictkey dictitem ';' | dictkey list ';' | dictkey prelist ';' | dictkey uniformfield ';' | dictkey fieldvalue ';' | macro | substitution ';' | dictkey codestream ';' | dictkey dictionary''' if len(p) == 4 and self.inHeader and p[1] == "format" and type( p[2]) == str: if p[2] == "binary": if not self.treatBinaryAsASCII: self.binaryMode = True else: self.binaryMode = False elif p[2] == "ascii": self.binaryMode = False else: raise FatalErrorPyFoamException( "Don't know how to parse file format", p[0]["format"]) if len(p) == 4 and type(p[2]) == list: # remove the prefix from long lists (if present) doAgain = True tmp = p[2] while doAgain: doAgain = False for i in range(len(tmp) - 1): if type(tmp[i]) == int and type(tmp[i + 1]) in [list]: if tmp[i] == len(tmp[i + 1]): nix = tmp[:i] + tmp[i + 1:] for i in range(len(tmp)): tmp.pop() tmp.extend(nix) doAgain = True break if len(p) == 4: if isinstance(p[2], (NotAPrelist, )): p[0] = (p[1], (p[2].a, p[2].b)) else: p[0] = (p[1], p[2]) elif len(p) == 3: if p[2] == ';': p[0] = (p[1], '') else: p[0] = (p[1], p[2]) else: p[0] = (self.emptyCnt, p[1]) self.emptyCnt += 1
def __init__(self, descr, data=None): FatalErrorPyFoamException.__init__(self, "Parser Error:", descr) self.descr = descr self.data = data
def __init__(self, txt="Size of the arrays differs"): FatalErrorPyFoamException.__init__(self, txt)
def __str__(self): return FatalErrorPyFoamException.__str__(self)+" in Application-class: "+self.app.__class__.__name__
def __init__(self,descr,data=None): FatalErrorPyFoamException.__init__(self,"Parser Error:",descr) self.descr=descr self.data=data
def __init__(self,app,*text): self.app=app FatalErrorPyFoamException.__init__(self,*text)
def __init__(self,txt="Size of the arrays differs"): FatalErrorPyFoamException.__init__(self,txt)
def pyFoamSIG1HandlerPrintStack(nr, frame): print_("Signal Nr", nr, "sent") raise FatalErrorPyFoamException("Signal nr", nr, "sent")
def __str__(self): return FatalErrorPyFoamException.__str__( self) + " in Application-class: " + self.app.__class__.__name__
def __init__(self, app, *text): self.app = app FatalErrorPyFoamException.__init__(self, *text)