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

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

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 # [16] 317 # [16]
318 def p_Default(self, p): 318 def p_Default(self, p):
319 """Default : '=' DefaultValue 319 """Default : '=' DefaultValue
320 |""" 320 |"""
321 if len(p) > 1: 321 if len(p) > 1:
322 p[0] = self.BuildProduction('Default', p, 2, p[2]) 322 p[0] = self.BuildProduction('Default', p, 2, p[2])
323 323
324 # [17] 324 # [17]
325 def p_DefaultValue(self, p): 325 def p_DefaultValue(self, p):
326 """DefaultValue : ConstValue 326 """DefaultValue : ConstValue
327 | string""" 327 | string
328 if type(p[1]) == str: 328 | '[' ']'"""
329 if len(p) == 3:
330 p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'sequence'),
331 self.BuildAttribute('VALUE', '[]'))
332 elif type(p[1]) == str:
329 p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'DOMString'), 333 p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'DOMString'),
330 self.BuildAttribute('NAME', p[1])) 334 self.BuildAttribute('NAME', p[1]))
331 else: 335 else:
332 p[0] = p[1] 336 p[0] = p[1]
333 337
334 # [] - Not specified 338 # [] - Not specified
335 def p_Exception(self, p): 339 def p_Exception(self, p):
336 """Exception : EXCEPTION identifier Inheritance '{' ExceptionMembers '}' ';' """ 340 """Exception : EXCEPTION identifier Inheritance '{' ExceptionMembers '}' ';' """
337 p[0] = self.BuildNamed('Exception', p, 2, ListFromConcat(p[3], p[5])) 341 p[0] = self.BuildNamed('Exception', p, 2, ListFromConcat(p[3], p[5]))
338 342
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 1198
1195 print '\n'.join(ast.Tree(accept_props=['PROD'])) 1199 print '\n'.join(ast.Tree(accept_props=['PROD']))
1196 if errors: 1200 if errors:
1197 print '\nFound %d errors.\n' % errors 1201 print '\nFound %d errors.\n' % errors
1198 1202
1199 return errors 1203 return errors
1200 1204
1201 1205
1202 if __name__ == '__main__': 1206 if __name__ == '__main__':
1203 sys.exit(main(sys.argv[1:])) 1207 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698