Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: tools/idl_parser/idl_parser.py

Issue 329163002: IDL parser: implement Stringifier production (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: rebased Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/idl_parser/test_parser/interface_web.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 | '-' INFINITY 431 | '-' INFINITY
432 | INFINITY 432 | INFINITY
433 | NAN """ 433 | NAN """
434 if len(p) > 2: 434 if len(p) > 2:
435 val = '-Infinity' 435 val = '-Infinity'
436 else: 436 else:
437 val = p[1] 437 val = p[1]
438 p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'float'), 438 p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'float'),
439 self.BuildAttribute('VALUE', val)) 439 self.BuildAttribute('VALUE', val))
440 440
441 # [31] Removed unsupported: Serializer, Stringifier 441 # [31] Removed unsupported: Serializer
442 def p_AttributeOrOperationOrIterator(self, p): 442 def p_AttributeOrOperationOrIterator(self, p):
443 """AttributeOrOperationOrIterator : StaticMember 443 """AttributeOrOperationOrIterator : Stringifier
444 | StaticMember
444 | Attribute 445 | Attribute
445 | OperationOrIterator""" 446 | OperationOrIterator"""
446 p[0] = p[1] 447 p[0] = p[1]
447 448
448 # [32-37] NOT IMPLEMENTED (Serializer) 449 # [32-37] NOT IMPLEMENTED (Serializer)
449 # [38-39] FIXME: NOT IMPLEMENTED (Stringifier) http://crbug.com/306606 450
451 # [38]
452 def p_Stringifier(self, p):
453 """Stringifier : STRINGIFIER StringifierRest"""
454 p[0] = self.BuildProduction('Stringifier', p, 1, p[2])
455
456 # [39]
457 def p_StringifierRest(self, p):
458 """StringifierRest : AttributeRest
459 | ReturnType OperationRest
460 | ';'"""
461 if len(p) == 3:
462 p[2].AddChildren(p[1])
463 p[0] = p[2]
464 elif p[1] != ';':
465 p[0] = p[1]
450 466
451 # [40] 467 # [40]
452 def p_StaticMember(self, p): 468 def p_StaticMember(self, p):
453 """StaticMember : STATIC StaticMemberRest""" 469 """StaticMember : STATIC StaticMemberRest"""
454 p[2].AddChildren(self.BuildTrue('STATIC')) 470 p[2].AddChildren(self.BuildTrue('STATIC'))
455 p[0] = p[2] 471 p[0] = p[2]
456 472
457 # [41] 473 # [41]
458 def p_StaticMemberRest(self, p): 474 def p_StaticMemberRest(self, p):
459 """StaticMemberRest : AttributeRest 475 """StaticMemberRest : AttributeRest
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 1097
1082 print '\n'.join(ast.Tree(accept_props=['PROD'])) 1098 print '\n'.join(ast.Tree(accept_props=['PROD']))
1083 if errors: 1099 if errors:
1084 print '\nFound %d errors.\n' % errors 1100 print '\nFound %d errors.\n' % errors
1085 1101
1086 return errors 1102 return errors
1087 1103
1088 1104
1089 if __name__ == '__main__': 1105 if __name__ == '__main__':
1090 sys.exit(main(sys.argv[1:])) 1106 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | tools/idl_parser/test_parser/interface_web.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698