]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/Ecc/CodeFragmentCollector.py
BaseTools: use set instead of list for a variable to be used with in
[mirror_edk2.git] / BaseTools / Source / Python / Ecc / CodeFragmentCollector.py
1 ## @file
2 # preprocess source file
3 #
4 # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
5 #
6 # This program and the accompanying materials
7 # are licensed and made available under the terms and conditions of the BSD License
8 # which accompanies this distribution. The full text of the license may be found at
9 # http://opensource.org/licenses/bsd-license.php
10 #
11 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 #
14
15 ##
16 # Import Modules
17 #
18
19 import re
20 import Common.LongFilePathOs as os
21 import sys
22
23 import antlr3
24 from CLexer import CLexer
25 from CParser import CParser
26
27 import FileProfile
28 from CodeFragment import Comment
29 from CodeFragment import PP_Directive
30 from ParserWarning import Warning
31
32
33 ##define T_CHAR_SPACE ' '
34 ##define T_CHAR_NULL '\0'
35 ##define T_CHAR_CR '\r'
36 ##define T_CHAR_TAB '\t'
37 ##define T_CHAR_LF '\n'
38 ##define T_CHAR_SLASH '/'
39 ##define T_CHAR_BACKSLASH '\\'
40 ##define T_CHAR_DOUBLE_QUOTE '\"'
41 ##define T_CHAR_SINGLE_QUOTE '\''
42 ##define T_CHAR_STAR '*'
43 ##define T_CHAR_HASH '#'
44
45 (T_CHAR_SPACE, T_CHAR_NULL, T_CHAR_CR, T_CHAR_TAB, T_CHAR_LF, T_CHAR_SLASH, \
46 T_CHAR_BACKSLASH, T_CHAR_DOUBLE_QUOTE, T_CHAR_SINGLE_QUOTE, T_CHAR_STAR, T_CHAR_HASH) = \
47 (' ', '\0', '\r', '\t', '\n', '/', '\\', '\"', '\'', '*', '#')
48
49 SEPERATOR_TUPLE = ('=', '|', ',', '{', '}')
50
51 (T_COMMENT_TWO_SLASH, T_COMMENT_SLASH_STAR) = (0, 1)
52
53 (T_PP_INCLUDE, T_PP_DEFINE, T_PP_OTHERS) = (0, 1, 2)
54
55 ## The collector for source code fragments.
56 #
57 # PreprocessFile method should be called prior to ParseFile
58 #
59 # GetNext*** procedures mean these procedures will get next token first, then make judgement.
60 # Get*** procedures mean these procedures will make judgement on current token only.
61 #
62 class CodeFragmentCollector:
63 ## The constructor
64 #
65 # @param self The object pointer
66 # @param FileName The file that to be parsed
67 #
68 def __init__(self, FileName):
69 self.Profile = FileProfile.FileProfile(FileName)
70 self.Profile.FileLinesList.append(T_CHAR_LF)
71 self.FileName = FileName
72 self.CurrentLineNumber = 1
73 self.CurrentOffsetWithinLine = 0
74
75 self.__Token = ""
76 self.__SkippedChars = ""
77
78 ## __EndOfFile() method
79 #
80 # Judge current buffer pos is at file end
81 #
82 # @param self The object pointer
83 # @retval True Current File buffer position is at file end
84 # @retval False Current File buffer position is NOT at file end
85 #
86 def __EndOfFile(self):
87 NumberOfLines = len(self.Profile.FileLinesList)
88 SizeOfLastLine = NumberOfLines
89 if NumberOfLines > 0:
90 SizeOfLastLine = len(self.Profile.FileLinesList[-1])
91
92 if self.CurrentLineNumber == NumberOfLines and self.CurrentOffsetWithinLine >= SizeOfLastLine - 1:
93 return True
94 elif self.CurrentLineNumber > NumberOfLines:
95 return True
96 else:
97 return False
98
99 ## __EndOfLine() method
100 #
101 # Judge current buffer pos is at line end
102 #
103 # @param self The object pointer
104 # @retval True Current File buffer position is at line end
105 # @retval False Current File buffer position is NOT at line end
106 #
107 def __EndOfLine(self):
108 SizeOfCurrentLine = len(self.Profile.FileLinesList[self.CurrentLineNumber - 1])
109 if self.CurrentOffsetWithinLine >= SizeOfCurrentLine - 1:
110 return True
111 else:
112 return False
113
114 ## Rewind() method
115 #
116 # Reset file data buffer to the initial state
117 #
118 # @param self The object pointer
119 #
120 def Rewind(self):
121 self.CurrentLineNumber = 1
122 self.CurrentOffsetWithinLine = 0
123
124 ## __UndoOneChar() method
125 #
126 # Go back one char in the file buffer
127 #
128 # @param self The object pointer
129 # @retval True Successfully go back one char
130 # @retval False Not able to go back one char as file beginning reached
131 #
132 def __UndoOneChar(self):
133
134 if self.CurrentLineNumber == 1 and self.CurrentOffsetWithinLine == 0:
135 return False
136 elif self.CurrentOffsetWithinLine == 0:
137 self.CurrentLineNumber -= 1
138 self.CurrentOffsetWithinLine = len(self.__CurrentLine()) - 1
139 else:
140 self.CurrentOffsetWithinLine -= 1
141 return True
142
143 ## __GetOneChar() method
144 #
145 # Move forward one char in the file buffer
146 #
147 # @param self The object pointer
148 #
149 def __GetOneChar(self):
150 if self.CurrentOffsetWithinLine == len(self.Profile.FileLinesList[self.CurrentLineNumber - 1]) - 1:
151 self.CurrentLineNumber += 1
152 self.CurrentOffsetWithinLine = 0
153 else:
154 self.CurrentOffsetWithinLine += 1
155
156 ## __CurrentChar() method
157 #
158 # Get the char pointed to by the file buffer pointer
159 #
160 # @param self The object pointer
161 # @retval Char Current char
162 #
163 def __CurrentChar(self):
164 CurrentChar = self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine]
165 # if CurrentChar > 255:
166 # raise Warning("Non-Ascii char found At Line %d, offset %d" % (self.CurrentLineNumber, self.CurrentOffsetWithinLine), self.FileName, self.CurrentLineNumber)
167 return CurrentChar
168
169 ## __NextChar() method
170 #
171 # Get the one char pass the char pointed to by the file buffer pointer
172 #
173 # @param self The object pointer
174 # @retval Char Next char
175 #
176 def __NextChar(self):
177 if self.CurrentOffsetWithinLine == len(self.Profile.FileLinesList[self.CurrentLineNumber - 1]) - 1:
178 return self.Profile.FileLinesList[self.CurrentLineNumber][0]
179 else:
180 return self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine + 1]
181
182 ## __SetCurrentCharValue() method
183 #
184 # Modify the value of current char
185 #
186 # @param self The object pointer
187 # @param Value The new value of current char
188 #
189 def __SetCurrentCharValue(self, Value):
190 self.Profile.FileLinesList[self.CurrentLineNumber - 1][self.CurrentOffsetWithinLine] = Value
191
192 ## __SetCharValue() method
193 #
194 # Modify the value of current char
195 #
196 # @param self The object pointer
197 # @param Value The new value of current char
198 #
199 def __SetCharValue(self, Line, Offset, Value):
200 self.Profile.FileLinesList[Line - 1][Offset] = Value
201
202 ## __CurrentLine() method
203 #
204 # Get the list that contains current line contents
205 #
206 # @param self The object pointer
207 # @retval List current line contents
208 #
209 def __CurrentLine(self):
210 return self.Profile.FileLinesList[self.CurrentLineNumber - 1]
211
212 ## __InsertComma() method
213 #
214 # Insert ',' to replace PP
215 #
216 # @param self The object pointer
217 # @retval List current line contents
218 #
219 def __InsertComma(self, Line):
220
221
222 if self.Profile.FileLinesList[Line - 1][0] != T_CHAR_HASH:
223 BeforeHashPart = str(self.Profile.FileLinesList[Line - 1]).split(T_CHAR_HASH)[0]
224 if BeforeHashPart.rstrip().endswith(T_CHAR_COMMA) or BeforeHashPart.rstrip().endswith(';'):
225 return
226
227 if Line - 2 >= 0 and str(self.Profile.FileLinesList[Line - 2]).rstrip().endswith(','):
228 return
229
230 if Line - 2 >= 0 and str(self.Profile.FileLinesList[Line - 2]).rstrip().endswith(';'):
231 return
232
233 if str(self.Profile.FileLinesList[Line]).lstrip().startswith(',') or str(self.Profile.FileLinesList[Line]).lstrip().startswith(';'):
234 return
235
236 self.Profile.FileLinesList[Line - 1].insert(self.CurrentOffsetWithinLine, ',')
237
238 ## PreprocessFile() method
239 #
240 # Preprocess file contents, replace comments with spaces.
241 # In the end, rewind the file buffer pointer to the beginning
242 # BUGBUG: No !include statement processing contained in this procedure
243 # !include statement should be expanded at the same FileLinesList[CurrentLineNumber - 1]
244 #
245 # @param self The object pointer
246 #
247 def PreprocessFile(self):
248
249 self.Rewind()
250 InComment = False
251 DoubleSlashComment = False
252 HashComment = False
253 PPExtend = False
254 CommentObj = None
255 PPDirectiveObj = None
256 # HashComment in quoted string " " is ignored.
257 InString = False
258 InCharLiteral = False
259
260 self.Profile.FileLinesList = [list(s) for s in self.Profile.FileLinesListFromFile]
261 while not self.__EndOfFile():
262
263 if not InComment and self.__CurrentChar() == T_CHAR_DOUBLE_QUOTE:
264 InString = not InString
265
266 if not InComment and self.__CurrentChar() == T_CHAR_SINGLE_QUOTE:
267 InCharLiteral = not InCharLiteral
268 # meet new line, then no longer in a comment for // and '#'
269 if self.__CurrentChar() == T_CHAR_LF:
270 if HashComment and PPDirectiveObj is not None:
271 if PPDirectiveObj.Content.rstrip(T_CHAR_CR).endswith(T_CHAR_BACKSLASH):
272 PPDirectiveObj.Content += T_CHAR_LF
273 PPExtend = True
274 else:
275 PPExtend = False
276
277 EndLinePos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine)
278
279 if InComment and DoubleSlashComment:
280 InComment = False
281 DoubleSlashComment = False
282 CommentObj.Content += T_CHAR_LF
283 CommentObj.EndPos = EndLinePos
284 FileProfile.CommentList.append(CommentObj)
285 CommentObj = None
286 if InComment and HashComment and not PPExtend:
287 InComment = False
288 HashComment = False
289 PPDirectiveObj.Content += T_CHAR_LF
290 PPDirectiveObj.EndPos = EndLinePos
291 FileProfile.PPDirectiveList.append(PPDirectiveObj)
292 PPDirectiveObj = None
293
294 if InString or InCharLiteral:
295 CurrentLine = "".join(self.__CurrentLine())
296 if CurrentLine.rstrip(T_CHAR_LF).rstrip(T_CHAR_CR).endswith(T_CHAR_BACKSLASH):
297 SlashIndex = CurrentLine.rindex(T_CHAR_BACKSLASH)
298 self.__SetCharValue(self.CurrentLineNumber, SlashIndex, T_CHAR_SPACE)
299
300 if InComment and not DoubleSlashComment and not HashComment:
301 CommentObj.Content += T_CHAR_LF
302 self.CurrentLineNumber += 1
303 self.CurrentOffsetWithinLine = 0
304 # check for */ comment end
305 elif InComment and not DoubleSlashComment and not HashComment and self.__CurrentChar() == T_CHAR_STAR and self.__NextChar() == T_CHAR_SLASH:
306 CommentObj.Content += self.__CurrentChar()
307 # self.__SetCurrentCharValue(T_CHAR_SPACE)
308 self.__GetOneChar()
309 CommentObj.Content += self.__CurrentChar()
310 # self.__SetCurrentCharValue(T_CHAR_SPACE)
311 CommentObj.EndPos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine)
312 FileProfile.CommentList.append(CommentObj)
313 CommentObj = None
314 self.__GetOneChar()
315 InComment = False
316 # set comments to spaces
317 elif InComment:
318 if HashComment:
319 # // follows hash PP directive
320 if self.__CurrentChar() == T_CHAR_SLASH and self.__NextChar() == T_CHAR_SLASH:
321 InComment = False
322 HashComment = False
323 PPDirectiveObj.EndPos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine - 1)
324 FileProfile.PPDirectiveList.append(PPDirectiveObj)
325 PPDirectiveObj = None
326 continue
327 else:
328 PPDirectiveObj.Content += self.__CurrentChar()
329 if PPExtend:
330 self.__SetCurrentCharValue(T_CHAR_SPACE)
331 else:
332 CommentObj.Content += self.__CurrentChar()
333 # self.__SetCurrentCharValue(T_CHAR_SPACE)
334 self.__GetOneChar()
335 # check for // comment
336 elif self.__CurrentChar() == T_CHAR_SLASH and self.__NextChar() == T_CHAR_SLASH:
337 InComment = True
338 DoubleSlashComment = True
339 CommentObj = Comment('', (self.CurrentLineNumber, self.CurrentOffsetWithinLine), None, T_COMMENT_TWO_SLASH)
340 # check for '#' comment
341 elif self.__CurrentChar() == T_CHAR_HASH and not InString and not InCharLiteral:
342 InComment = True
343 HashComment = True
344 PPDirectiveObj = PP_Directive('', (self.CurrentLineNumber, self.CurrentOffsetWithinLine), None)
345 # check for /* comment start
346 elif self.__CurrentChar() == T_CHAR_SLASH and self.__NextChar() == T_CHAR_STAR:
347 CommentObj = Comment('', (self.CurrentLineNumber, self.CurrentOffsetWithinLine), None, T_COMMENT_SLASH_STAR)
348 CommentObj.Content += self.__CurrentChar()
349 # self.__SetCurrentCharValue( T_CHAR_SPACE)
350 self.__GetOneChar()
351 CommentObj.Content += self.__CurrentChar()
352 # self.__SetCurrentCharValue( T_CHAR_SPACE)
353 self.__GetOneChar()
354 InComment = True
355 else:
356 self.__GetOneChar()
357
358 EndLinePos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine)
359
360 if InComment and DoubleSlashComment:
361 CommentObj.EndPos = EndLinePos
362 FileProfile.CommentList.append(CommentObj)
363 if InComment and HashComment and not PPExtend:
364 PPDirectiveObj.EndPos = EndLinePos
365 FileProfile.PPDirectiveList.append(PPDirectiveObj)
366
367 self.Rewind()
368
369 def PreprocessFileWithClear(self):
370
371 self.Rewind()
372 InComment = False
373 DoubleSlashComment = False
374 HashComment = False
375 PPExtend = False
376 CommentObj = None
377 PPDirectiveObj = None
378 # HashComment in quoted string " " is ignored.
379 InString = False
380 InCharLiteral = False
381
382 self.Profile.FileLinesList = [list(s) for s in self.Profile.FileLinesListFromFile]
383 while not self.__EndOfFile():
384
385 if not InComment and self.__CurrentChar() == T_CHAR_DOUBLE_QUOTE:
386 InString = not InString
387
388 if not InComment and self.__CurrentChar() == T_CHAR_SINGLE_QUOTE:
389 InCharLiteral = not InCharLiteral
390 # meet new line, then no longer in a comment for // and '#'
391 if self.__CurrentChar() == T_CHAR_LF:
392 if HashComment and PPDirectiveObj is not None:
393 if PPDirectiveObj.Content.rstrip(T_CHAR_CR).endswith(T_CHAR_BACKSLASH):
394 PPDirectiveObj.Content += T_CHAR_LF
395 PPExtend = True
396 else:
397 PPExtend = False
398
399 EndLinePos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine)
400
401 if InComment and DoubleSlashComment:
402 InComment = False
403 DoubleSlashComment = False
404 CommentObj.Content += T_CHAR_LF
405 CommentObj.EndPos = EndLinePos
406 FileProfile.CommentList.append(CommentObj)
407 CommentObj = None
408 if InComment and HashComment and not PPExtend:
409 InComment = False
410 HashComment = False
411 PPDirectiveObj.Content += T_CHAR_LF
412 PPDirectiveObj.EndPos = EndLinePos
413 FileProfile.PPDirectiveList.append(PPDirectiveObj)
414 PPDirectiveObj = None
415
416 if InString or InCharLiteral:
417 CurrentLine = "".join(self.__CurrentLine())
418 if CurrentLine.rstrip(T_CHAR_LF).rstrip(T_CHAR_CR).endswith(T_CHAR_BACKSLASH):
419 SlashIndex = CurrentLine.rindex(T_CHAR_BACKSLASH)
420 self.__SetCharValue(self.CurrentLineNumber, SlashIndex, T_CHAR_SPACE)
421
422 if InComment and not DoubleSlashComment and not HashComment:
423 CommentObj.Content += T_CHAR_LF
424 self.CurrentLineNumber += 1
425 self.CurrentOffsetWithinLine = 0
426 # check for */ comment end
427 elif InComment and not DoubleSlashComment and not HashComment and self.__CurrentChar() == T_CHAR_STAR and self.__NextChar() == T_CHAR_SLASH:
428 CommentObj.Content += self.__CurrentChar()
429 self.__SetCurrentCharValue(T_CHAR_SPACE)
430 self.__GetOneChar()
431 CommentObj.Content += self.__CurrentChar()
432 self.__SetCurrentCharValue(T_CHAR_SPACE)
433 CommentObj.EndPos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine)
434 FileProfile.CommentList.append(CommentObj)
435 CommentObj = None
436 self.__GetOneChar()
437 InComment = False
438 # set comments to spaces
439 elif InComment:
440 if HashComment:
441 # // follows hash PP directive
442 if self.__CurrentChar() == T_CHAR_SLASH and self.__NextChar() == T_CHAR_SLASH:
443 InComment = False
444 HashComment = False
445 PPDirectiveObj.EndPos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine - 1)
446 FileProfile.PPDirectiveList.append(PPDirectiveObj)
447 PPDirectiveObj = None
448 continue
449 else:
450 PPDirectiveObj.Content += self.__CurrentChar()
451 # if PPExtend:
452 # self.__SetCurrentCharValue(T_CHAR_SPACE)
453 else:
454 CommentObj.Content += self.__CurrentChar()
455 self.__SetCurrentCharValue(T_CHAR_SPACE)
456 self.__GetOneChar()
457 # check for // comment
458 elif self.__CurrentChar() == T_CHAR_SLASH and self.__NextChar() == T_CHAR_SLASH:
459 InComment = True
460 DoubleSlashComment = True
461 CommentObj = Comment('', (self.CurrentLineNumber, self.CurrentOffsetWithinLine), None, T_COMMENT_TWO_SLASH)
462 # check for '#' comment
463 elif self.__CurrentChar() == T_CHAR_HASH and not InString and not InCharLiteral:
464 InComment = True
465 HashComment = True
466 PPDirectiveObj = PP_Directive('', (self.CurrentLineNumber, self.CurrentOffsetWithinLine), None)
467 # check for /* comment start
468 elif self.__CurrentChar() == T_CHAR_SLASH and self.__NextChar() == T_CHAR_STAR:
469 CommentObj = Comment('', (self.CurrentLineNumber, self.CurrentOffsetWithinLine), None, T_COMMENT_SLASH_STAR)
470 CommentObj.Content += self.__CurrentChar()
471 self.__SetCurrentCharValue( T_CHAR_SPACE)
472 self.__GetOneChar()
473 CommentObj.Content += self.__CurrentChar()
474 self.__SetCurrentCharValue( T_CHAR_SPACE)
475 self.__GetOneChar()
476 InComment = True
477 else:
478 self.__GetOneChar()
479
480 EndLinePos = (self.CurrentLineNumber, self.CurrentOffsetWithinLine)
481
482 if InComment and DoubleSlashComment:
483 CommentObj.EndPos = EndLinePos
484 FileProfile.CommentList.append(CommentObj)
485 if InComment and HashComment and not PPExtend:
486 PPDirectiveObj.EndPos = EndLinePos
487 FileProfile.PPDirectiveList.append(PPDirectiveObj)
488 self.Rewind()
489
490 ## ParseFile() method
491 #
492 # Parse the file profile buffer to extract fd, fv ... information
493 # Exception will be raised if syntax error found
494 #
495 # @param self The object pointer
496 #
497 def ParseFile(self):
498 self.PreprocessFile()
499 # restore from ListOfList to ListOfString
500 self.Profile.FileLinesList = ["".join(list) for list in self.Profile.FileLinesList]
501 FileStringContents = ''
502 for fileLine in self.Profile.FileLinesList:
503 FileStringContents += fileLine
504 cStream = antlr3.StringStream(FileStringContents)
505 lexer = CLexer(cStream)
506 tStream = antlr3.CommonTokenStream(lexer)
507 parser = CParser(tStream)
508 parser.translation_unit()
509
510 def ParseFileWithClearedPPDirective(self):
511 self.PreprocessFileWithClear()
512 # restore from ListOfList to ListOfString
513 self.Profile.FileLinesList = ["".join(list) for list in self.Profile.FileLinesList]
514 FileStringContents = ''
515 for fileLine in self.Profile.FileLinesList:
516 FileStringContents += fileLine
517 cStream = antlr3.StringStream(FileStringContents)
518 lexer = CLexer(cStream)
519 tStream = antlr3.CommonTokenStream(lexer)
520 parser = CParser(tStream)
521 parser.translation_unit()
522
523 def CleanFileProfileBuffer(self):
524 FileProfile.CommentList = []
525 FileProfile.PPDirectiveList = []
526 FileProfile.PredicateExpressionList = []
527 FileProfile.FunctionDefinitionList = []
528 FileProfile.VariableDeclarationList = []
529 FileProfile.EnumerationDefinitionList = []
530 FileProfile.StructUnionDefinitionList = []
531 FileProfile.TypedefDefinitionList = []
532 FileProfile.FunctionCallingList = []
533
534 def PrintFragments(self):
535
536 print '################# ' + self.FileName + '#####################'
537
538 print '/****************************************/'
539 print '/*************** COMMENTS ***************/'
540 print '/****************************************/'
541 for comment in FileProfile.CommentList:
542 print str(comment.StartPos) + comment.Content
543
544 print '/****************************************/'
545 print '/********* PREPROCESS DIRECTIVES ********/'
546 print '/****************************************/'
547 for pp in FileProfile.PPDirectiveList:
548 print str(pp.StartPos) + pp.Content
549
550 print '/****************************************/'
551 print '/********* VARIABLE DECLARATIONS ********/'
552 print '/****************************************/'
553 for var in FileProfile.VariableDeclarationList:
554 print str(var.StartPos) + var.Modifier + ' '+ var.Declarator
555
556 print '/****************************************/'
557 print '/********* FUNCTION DEFINITIONS *********/'
558 print '/****************************************/'
559 for func in FileProfile.FunctionDefinitionList:
560 print str(func.StartPos) + func.Modifier + ' '+ func.Declarator + ' ' + str(func.NamePos)
561
562 print '/****************************************/'
563 print '/************ ENUMERATIONS **************/'
564 print '/****************************************/'
565 for enum in FileProfile.EnumerationDefinitionList:
566 print str(enum.StartPos) + enum.Content
567
568 print '/****************************************/'
569 print '/*********** STRUCTS/UNIONS *************/'
570 print '/****************************************/'
571 for su in FileProfile.StructUnionDefinitionList:
572 print str(su.StartPos) + su.Content
573
574 print '/****************************************/'
575 print '/********* PREDICATE EXPRESSIONS ********/'
576 print '/****************************************/'
577 for predexp in FileProfile.PredicateExpressionList:
578 print str(predexp.StartPos) + predexp.Content
579
580 print '/****************************************/'
581 print '/************** TYPEDEFS ****************/'
582 print '/****************************************/'
583 for typedef in FileProfile.TypedefDefinitionList:
584 print str(typedef.StartPos) + typedef.ToType
585
586 if __name__ == "__main__":
587
588 collector = CodeFragmentCollector(sys.argv[1])
589 collector.PreprocessFile()
590 print "For Test."