[Python-checkins] CVS: python/dist/src/Tools/bgen/bgen scantools.py,1.20,1.21

Jack Jansen jackjansen@users.sourceforge.net
2001年6月26日 14:53:27 -0700


Update of /cvsroot/python/python/dist/src/Tools/bgen/bgen
In directory usw-pr-cvs1:/tmp/cvs-serv25079/Python/Tools/bgen/bgen
Modified Files:
	scantools.py 
Log Message:
Added a Parser_OSX class that can parse new-style (C-only) headers,
such as the Core Foundation ones.
Index: scantools.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/bgen/bgen/scantools.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** scantools.py	2001年02月27日 11:04:20	1.20
--- scantools.py	2001年06月26日 21:53:25	1.21
***************
*** 234,241 ****
 
 	def initpatterns(self):
- #		self.head_pat = "^extern pascal[ \t]+" # XXX Mac specific!
 		self.head_pat = "^EXTERN_API[^_]"
 		self.tail_pat = "[;={}]"
- #		self.type_pat = "pascal[ \t\n]+\(<type>[a-zA-Z0-9_ \t]*[a-zA-Z0-9_]\)[ \t\n]+"
 		self.type_pat = "EXTERN_API" + \
 						"[ \t\n]*([ \t\n]*" + \
--- 234,239 ----
***************
*** 245,250 ****
 		self.args_pat = "(\(<args>\([^(;=)]+\|([^(;=)]*)\)*\))"
 		self.whole_pat = self.type_pat + self.name_pat + self.args_pat
- #		self.sym_pat = "^[ \t]*\(<name>[a-zA-Z0-9_]+\)[ \t]*=" + \
- #		 "[ \t]*\(<defn>[-0-9'\"(][^\t\n,;}]*\),?"
 		self.sym_pat = "^[ \t]*\(<name>[a-zA-Z0-9_]+\)[ \t]*=" + \
 		 "[ \t]*\(<defn>[-0-9_a-zA-Z'\"(][^\t\n,;}]*\),?"
--- 243,246 ----
***************
*** 586,589 ****
--- 582,604 ----
 		 "[ \t]*\(<defn>[-0-9'\"][^\t\n,;}]*\),?"
 		self.asplit_pat = "^\(<type>.*[^a-zA-Z0-9_]\)\(<name>[a-zA-Z0-9_]+\)$"
+ 
+ class Scanner_OSX(Scanner):
+ 	"""Scanner for modern (post UH3.3) Universal Headers """
+ 	def initpatterns(self):
+ 		self.head_pat = "^EXTERN_API_C"
+ 		self.tail_pat = "[;={}]"
+ 		self.type_pat = "EXTERN_API_C" + \
+ 						"[ \t\n]*([ \t\n]*" + \
+ 						"\(<type>[a-zA-Z0-9_* \t]*[a-zA-Z0-9_*]\)" + \
+ 						"[ \t\n]*)[ \t\n]*"
+ 		self.name_pat = "\(<name>[a-zA-Z0-9_]+\)[ \t\n]*"
+ 		self.args_pat = "(\(<args>\([^(;=)]+\|([^(;=)]*)\)*\))"
+ 		self.whole_pat = self.type_pat + self.name_pat + self.args_pat
+ 		self.sym_pat = "^[ \t]*\(<name>[a-zA-Z0-9_]+\)[ \t]*=" + \
+ 		 "[ \t]*\(<defn>[-0-9_a-zA-Z'\"(][^\t\n,;}]*\),?"
+ 		self.asplit_pat = "^\(<type>.*[^a-zA-Z0-9_]\)\(<name>[a-zA-Z0-9_]+\)$"
+ 		self.comment1_pat = "\(<rest>.*\)//.*"
+ 		# note that the next pattern only removes comments that are wholly within one line
+ 		self.comment2_pat = "\(<rest1>.*\)/\*.*\*/\(<rest2>.*\)"
 
 	

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