Пример #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)
Пример #3
0
 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'))
Пример #4
0
 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))