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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
427 if len(p) > 2: | 427 if len(p) > 2: |
428 val = '-Infinity' | 428 val = '-Infinity' |
429 else: | 429 else: |
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 | StaticAttribute | |
437 | Attribute | 438 | Attribute |
438 | Operation""" | 439 | Operation""" |
439 if len(p) > 2: | 440 if len(p) > 2: |
440 p[0] = p[2] | 441 p[0] = p[2] |
441 else: | 442 else: |
442 p[0] = p[1] | 443 p[0] = p[1] |
443 | 444 |
444 # [31] | 445 # [31] |
445 def p_StringifierAttributeOrOperation(self, p): | 446 def p_StringifierAttributeOrOperation(self, p): |
446 """StringifierAttributeOrOperation : Attribute | 447 """StringifierAttributeOrOperation : Attribute |
447 | OperationRest | 448 | OperationRest |
448 | ';'""" | 449 | ';'""" |
449 if p[1] == ';': | 450 if p[1] == ';': |
450 p[0] = self.BuildAttribute('STRINGIFIER', Boolean(True)) | 451 p[0] = self.BuildAttribute('STRINGIFIER', Boolean(True)) |
451 else: | 452 else: |
452 p[0] = ListFromConcat(self.BuildAttribute('STRINGIFIER', p[1]), p[1]) | 453 p[0] = ListFromConcat(self.BuildAttribute('STRINGIFIER', p[1]), p[1]) |
453 | 454 |
455 # [XX] | |
Nils Barth (inactive)
2014/06/16 06:59:40
Some comment like:
# [31.1] FIXME: temporary produ
| |
456 def p_StaticAttribute(self, p): | |
457 """StaticAttribute : STATIC Attribute""" | |
458 p[2].AddChildren(self.BuildTrue('STATIC')) | |
459 p[0] = p[2] | |
460 | |
454 # [32] | 461 # [32] |
455 def p_Attribute(self, p): | 462 def p_Attribute(self, p): |
456 """Attribute : Inherit ReadOnly ATTRIBUTE Type identifier ';'""" | 463 """Attribute : Inherit ReadOnly ATTRIBUTE Type identifier ';'""" |
457 p[0] = self.BuildNamed('Attribute', p, 5, | 464 p[0] = self.BuildNamed('Attribute', p, 5, |
458 ListFromConcat(p[1], p[2], p[4])) | 465 ListFromConcat(p[1], p[2], p[4])) |
459 | 466 |
460 # [33] | 467 # [33] |
461 def p_Inherit(self, p): | 468 def p_Inherit(self, p): |
462 """Inherit : INHERIT | 469 """Inherit : INHERIT |
463 |""" | 470 |""" |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1044 | 1051 |
1045 print '\n'.join(ast.Tree(accept_props=['PROD'])) | 1052 print '\n'.join(ast.Tree(accept_props=['PROD'])) |
1046 if errors: | 1053 if errors: |
1047 print '\nFound %d errors.\n' % errors | 1054 print '\nFound %d errors.\n' % errors |
1048 | 1055 |
1049 return errors | 1056 return errors |
1050 | 1057 |
1051 | 1058 |
1052 if __name__ == '__main__': | 1059 if __name__ == '__main__': |
1053 sys.exit(main(sys.argv[1:])) | 1060 sys.exit(main(sys.argv[1:])) |
OLD | NEW |