| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 # [11] | 276 # [11] |
| 277 def p_Dictionary(self, p): | 277 def p_Dictionary(self, p): |
| 278 """Dictionary : DICTIONARY identifier Inheritance '{' DictionaryMembers '}'
';'""" | 278 """Dictionary : DICTIONARY identifier Inheritance '{' DictionaryMembers '}'
';'""" |
| 279 p[0] = self.BuildNamed('Dictionary', p, 2, ListFromConcat(p[3], p[5])) | 279 p[0] = self.BuildNamed('Dictionary', p, 2, ListFromConcat(p[3], p[5])) |
| 280 | 280 |
| 281 # [11.1] Error recovery for regular Dictionary | 281 # [11.1] Error recovery for regular Dictionary |
| 282 def p_DictionaryError(self, p): | 282 def p_DictionaryError(self, p): |
| 283 """Dictionary : DICTIONARY error ';'""" | 283 """Dictionary : DICTIONARY error ';'""" |
| 284 p[0] = self.BuildError(p, 'Dictionary') | 284 p[0] = self.BuildError(p, 'Dictionary') |
| 285 | 285 |
| 286 # [11.2] Error recovery for regular Dictionary |
| 287 # (for errors inside dictionary definition) |
| 288 def p_DictionaryError2(self, p): |
| 289 """Dictionary : DICTIONARY identifier Inheritance '{' error""" |
| 290 p[0] = self.BuildError(p, 'Dictionary') |
| 291 |
| 286 # [12] | 292 # [12] |
| 287 def p_DictionaryMembers(self, p): | 293 def p_DictionaryMembers(self, p): |
| 288 """DictionaryMembers : ExtendedAttributeList DictionaryMember DictionaryMemb
ers | 294 """DictionaryMembers : ExtendedAttributeList DictionaryMember DictionaryMemb
ers |
| 289 |""" | 295 |""" |
| 290 if len(p) > 1: | 296 if len(p) > 1: |
| 291 p[2].AddChildren(p[1]) | 297 p[2].AddChildren(p[1]) |
| 292 p[0] = ListFromConcat(p[2], p[3]) | 298 p[0] = ListFromConcat(p[2], p[3]) |
| 293 | 299 |
| 294 # [13] | 300 # [13] |
| 295 def p_DictionaryMember(self, p): | 301 def p_DictionaryMember(self, p): |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 """ArgumentList : error """ | 589 """ArgumentList : error """ |
| 584 p[0] = self.BuildError(p, 'ArgumentList') | 590 p[0] = self.BuildError(p, 'ArgumentList') |
| 585 | 591 |
| 586 # [54] | 592 # [54] |
| 587 def p_Arguments(self, p): | 593 def p_Arguments(self, p): |
| 588 """Arguments : ',' Argument Arguments | 594 """Arguments : ',' Argument Arguments |
| 589 |""" | 595 |""" |
| 590 if len(p) > 1: | 596 if len(p) > 1: |
| 591 p[0] = ListFromConcat(p[2], p[3]) | 597 p[0] = ListFromConcat(p[2], p[3]) |
| 592 | 598 |
| 599 # [54.1] Arguments error recovery |
| 600 def p_ArgumentsError(self, p): |
| 601 """Arguments : ',' error""" |
| 602 p[0] = self.BuildError(p, 'Arguments') |
| 603 |
| 593 # [55] | 604 # [55] |
| 594 def p_Argument(self, p): | 605 def p_Argument(self, p): |
| 595 """Argument : ExtendedAttributeList OptionalOrRequiredArgument""" | 606 """Argument : ExtendedAttributeList OptionalOrRequiredArgument""" |
| 596 p[2].AddChildren(p[1]) | 607 p[2].AddChildren(p[1]) |
| 597 p[0] = p[2] | 608 p[0] = p[2] |
| 598 | 609 |
| 599 # [56] | 610 # [56] |
| 600 def p_OptionalOrRequiredArgument(self, p): | 611 def p_OptionalOrRequiredArgument(self, p): |
| 601 """OptionalOrRequiredArgument : OPTIONAL Type ArgumentName Default | 612 """OptionalOrRequiredArgument : OPTIONAL Type ArgumentName Default |
| 602 | Type Ellipsis ArgumentName""" | 613 | Type Ellipsis ArgumentName""" |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 | 1157 |
| 1147 print '\n'.join(ast.Tree(accept_props=['PROD'])) | 1158 print '\n'.join(ast.Tree(accept_props=['PROD'])) |
| 1148 if errors: | 1159 if errors: |
| 1149 print '\nFound %d errors.\n' % errors | 1160 print '\nFound %d errors.\n' % errors |
| 1150 | 1161 |
| 1151 return errors | 1162 return errors |
| 1152 | 1163 |
| 1153 | 1164 |
| 1154 if __name__ == '__main__': | 1165 if __name__ == '__main__': |
| 1155 sys.exit(main(sys.argv[1:])) | 1166 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |