Chromium Code Reviews| 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 val = p[1] | 430 val = p[1] |
| 431 p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'float'), | 431 p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'float'), |
| 432 self.BuildAttribute('VALUE', val)) | 432 self.BuildAttribute('VALUE', val)) |
| 433 | 433 |
| 434 # [30] | 434 # [30] |
| 435 def p_AttributeOrOperation(self, p): | 435 def p_AttributeOrOperation(self, p): |
| 436 """AttributeOrOperation : STRINGIFIER StringifierAttributeOrOperation | 436 """AttributeOrOperation : STRINGIFIER StringifierAttributeOrOperation |
| 437 | Attribute | 437 | Attribute |
| 438 | Operation""" | 438 | Operation""" |
| 439 if len(p) > 2: | 439 if len(p) > 2: |
| 440 p[0] = p[2] | 440 p[0] = self.BuildProduction('Stringifier', p, 1, ListFromConcat(p[2])) |
|
Jens Widell
2014/06/11 15:28:51
Modifying p_AttributeOrOperation() like this is sl
Nils Barth (inactive)
2014/06/12 04:20:27
This is fine; we only override this b/c we want to
| |
| 441 else: | 441 else: |
| 442 p[0] = p[1] | 442 p[0] = p[1] |
| 443 | 443 |
| 444 # [31] | 444 # [31] |
| 445 def p_StringifierAttributeOrOperation(self, p): | 445 def p_StringifierAttributeOrOperation(self, p): |
| 446 """StringifierAttributeOrOperation : Attribute | 446 """StringifierAttributeOrOperation : Attribute |
| 447 | OperationRest | 447 | OperationRest |
| 448 | ';'""" | 448 | ';'""" |
| 449 if p[1] == ';': | 449 if p[1] == ';': |
| 450 p[0] = self.BuildAttribute('STRINGIFIER', Boolean(True)) | 450 p[0] = None |
| 451 else: | 451 else: |
| 452 p[0] = ListFromConcat(self.BuildAttribute('STRINGIFIER', p[1]), p[1]) | 452 p[0] = p[1] |
| 453 | 453 |
| 454 # [32] | 454 # [32] |
| 455 def p_Attribute(self, p): | 455 def p_Attribute(self, p): |
| 456 """Attribute : Inherit ReadOnly ATTRIBUTE Type identifier ';'""" | 456 """Attribute : Inherit ReadOnly ATTRIBUTE Type identifier ';'""" |
| 457 p[0] = self.BuildNamed('Attribute', p, 5, | 457 p[0] = self.BuildNamed('Attribute', p, 5, |
| 458 ListFromConcat(p[1], p[2], p[4])) | 458 ListFromConcat(p[1], p[2], p[4])) |
| 459 | 459 |
| 460 # [33] | 460 # [33] |
| 461 def p_Inherit(self, p): | 461 def p_Inherit(self, p): |
| 462 """Inherit : INHERIT | 462 """Inherit : INHERIT |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1044 | 1044 |
| 1045 print '\n'.join(ast.Tree(accept_props=['PROD'])) | 1045 print '\n'.join(ast.Tree(accept_props=['PROD'])) |
| 1046 if errors: | 1046 if errors: |
| 1047 print '\nFound %d errors.\n' % errors | 1047 print '\nFound %d errors.\n' % errors |
| 1048 | 1048 |
| 1049 return errors | 1049 return errors |
| 1050 | 1050 |
| 1051 | 1051 |
| 1052 if __name__ == '__main__': | 1052 if __name__ == '__main__': |
| 1053 sys.exit(main(sys.argv[1:])) | 1053 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |