示例#1
0
 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')
示例#2
0
 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'))
示例#5
0
 def ConvertConstant(self, tree):
     return N.Constant(GetCoords(tree),
                       value=tree.value,
                       type=T.BaseType(tree.type))