Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """ Parser for PPAPI IDL """ | 6 """ Parser for PPAPI IDL """ |
| 7 | 7 |
| 8 # | 8 # |
| 9 # IDL Parser | 9 # IDL Parser |
| 10 # | 10 # |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 # in turn are children of the file object created from the results of top. | 214 # in turn are children of the file object created from the results of top. |
| 215 def p_top(self, p): | 215 def p_top(self, p): |
| 216 """top : COMMENT COMMENT ext_attr_block top_list""" | 216 """top : COMMENT COMMENT ext_attr_block top_list""" |
| 217 | 217 |
| 218 Copyright = self.BuildComment('Copyright', p, 1) | 218 Copyright = self.BuildComment('Copyright', p, 1) |
| 219 Filedoc = self.BuildComment('Comment', p, 2) | 219 Filedoc = self.BuildComment('Comment', p, 2) |
| 220 | 220 |
| 221 p[0] = ListFromConcat(Copyright, Filedoc, p[3], p[4]) | 221 p[0] = ListFromConcat(Copyright, Filedoc, p[3], p[4]) |
| 222 if self.parse_debug: DumpReduction('top', p) | 222 if self.parse_debug: DumpReduction('top', p) |
| 223 | 223 |
| 224 def p_top_short(self, p): | |
| 225 """top : COMMENT ext_attr_block top_list""" | |
| 226 Copyright = self.BuildComment('Copyright', p, 1) | |
| 227 p[0] = ListFromConcat(Copyright, p[2], p[3]) | |
|
asargent_no_longer_on_chrome
2012/06/07 00:18:08
Unfortunately there are some specific assumptions
benjhayden
2012/06/08 16:41:52
I moved the documentation back into the html file,
| |
| 228 if self.parse_debug: DumpReduction('top', p) | |
| 229 | |
| 224 # Build a list of top level items. | 230 # Build a list of top level items. |
| 225 def p_top_list(self, p): | 231 def p_top_list(self, p): |
| 226 """top_list : callback_decl top_list | 232 """top_list : callback_decl top_list |
| 227 | describe_block top_list | 233 | describe_block top_list |
| 228 | dictionary_block top_list | 234 | dictionary_block top_list |
| 229 | enum_block top_list | 235 | enum_block top_list |
| 230 | inline top_list | 236 | inline top_list |
| 231 | interface_block top_list | 237 | interface_block top_list |
| 232 | label_block top_list | 238 | label_block top_list |
| 233 | namespace top_list | 239 | namespace top_list |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 494 def p_expression_symbol(self, p): | 500 def p_expression_symbol(self, p): |
| 495 "expression : SYMBOL" | 501 "expression : SYMBOL" |
| 496 p[0] = p[1] | 502 p[0] = p[1] |
| 497 if self.parse_debug: DumpReduction('expression_symbol', p) | 503 if self.parse_debug: DumpReduction('expression_symbol', p) |
| 498 | 504 |
| 499 def p_expression_integer(self, p): | 505 def p_expression_integer(self, p): |
| 500 "expression : integer" | 506 "expression : integer" |
| 501 p[0] = p[1] | 507 p[0] = p[1] |
| 502 if self.parse_debug: DumpReduction('expression_integer', p) | 508 if self.parse_debug: DumpReduction('expression_integer', p) |
| 503 | 509 |
| 510 def p_expression_float(self, p): | |
| 511 "expression : FLOAT" | |
| 512 p[0] = p[1] | |
| 513 if self.parse_debug: DumpReduction('expression_float', p) | |
| 514 | |
| 504 # | 515 # |
| 505 # Array List | 516 # Array List |
| 506 # | 517 # |
| 507 # Defined a list of array sizes (if any). | 518 # Defined a list of array sizes (if any). |
| 508 # | 519 # |
| 509 def p_arrays(self, p): | 520 def p_arrays(self, p): |
| 510 """arrays : '[' ']' arrays | 521 """arrays : '[' ']' arrays |
| 511 | '[' integer ']' arrays | 522 | '[' integer ']' arrays |
| 512 | """ | 523 | """ |
| 513 # If there are 3 tokens plus a return slot it is an unsized array | 524 # If there are 3 tokens plus a return slot it is an unsized array |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1117 ast = ParseFiles(filenames) | 1128 ast = ParseFiles(filenames) |
| 1118 errs = ast.GetProperty('ERRORS') | 1129 errs = ast.GetProperty('ERRORS') |
| 1119 if errs: | 1130 if errs: |
| 1120 ErrOut.Log('Found %d error(s).' % errs); | 1131 ErrOut.Log('Found %d error(s).' % errs); |
| 1121 InfoOut.Log("%d files processed." % len(filenames)) | 1132 InfoOut.Log("%d files processed." % len(filenames)) |
| 1122 return errs | 1133 return errs |
| 1123 | 1134 |
| 1124 | 1135 |
| 1125 if __name__ == '__main__': | 1136 if __name__ == '__main__': |
| 1126 sys.exit(Main(sys.argv[1:])) | 1137 sys.exit(Main(sys.argv[1:])) |
| OLD | NEW |