[Python-checkins] python/nondist/sandbox/ast asdl_c.py,1.3,1.4

jhylton@sourceforge.net jhylton@sourceforge.net
2002年4月09日 20:48:53 -0700


Update of /cvsroot/python/python/nondist/sandbox/ast
In directory usw-pr-cvs1:/tmp/cvs-serv12029
Modified Files:
	asdl_c.py 
Log Message:
Define asdl builtin types here and not in asdl_c.
Index: asdl_c.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/ast/asdl_c.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** asdl_c.py	10 Apr 2002 03:13:58 -0000	1.3
--- asdl_c.py	10 Apr 2002 03:48:50 -0000	1.4
***************
*** 8,13 ****
 MAX_COL = 76
 
- _builtin_types = ("identifier", "string", "int", "bool")
- 
 def get_c_type(name):
 """Return a string for the C name of the type.
--- 8,11 ----
***************
*** 19,23 ****
 if isinstance(name, asdl.Id):
 name = name.value
! if name in _builtin_types:
 return name
 else:
--- 17,21 ----
 if isinstance(name, asdl.Id):
 name = name.value
! if name in asdl.builtin_types:
 return name
 else:
***************
*** 244,247 ****
--- 242,247 ----
 
 mod = asdl.parse(sys.argv[1])
+ if not asdl.check(mod):
+ sys.exit(1)
 f = open("%s-ast.c" % mod.name, "wb")
 print >> f, '#include "Python.h"'

AltStyle によって変換されたページ (->オリジナル) /