def ConvertIdentifiertype(self, tree): """ Returns Type Object """ try: return T.BaseType(base_type=tree.names[0]) except IndexError: # Default type is int in C return T.BaseType(base_type='int')
def ConvertId(self, tree): #TODO(spranesh): Is this assert always true? if tree.name == 'NULL': return N.Constant(GetCoords(tree), value=tree.name, type=T.Pointer(T.BaseType('NULL'))) else: return N.ReferVariable(GetCoords(tree), name=tree.name)
def ConvertStr(self, tree): #TODO(spranesh): Should the value be really str-ed? return N.Constant(self.gc.GC(tree), value=tree.s, type=T.BaseType('string'))
def ConvertNum(self, tree): #TODO(spranesh): Should the value be really str-ed? return N.Constant(self.gc.GC(tree), value=str(tree.n), type=T.BaseType('number'))
def ConvertConstant(self, tree): return N.Constant(GetCoords(tree), value=tree.value, type=T.BaseType(tree.type))