OLD | NEW |
1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 20 matching lines...) Expand all Loading... |
31 import os | 31 import os |
32 | 32 |
33 from idl_definitions import IdlDefinitions, IdlInterface, IdlException, IdlOpera
tion, IdlCallbackFunction, IdlArgument, IdlAttribute, IdlConstant, IdlEnum, IdlU
nionType | 33 from idl_definitions import IdlDefinitions, IdlInterface, IdlException, IdlOpera
tion, IdlCallbackFunction, IdlArgument, IdlAttribute, IdlConstant, IdlEnum, IdlU
nionType |
34 | 34 |
35 SPECIAL_KEYWORD_LIST = ['GETTER', 'SETTER', 'DELETER'] | 35 SPECIAL_KEYWORD_LIST = ['GETTER', 'SETTER', 'DELETER'] |
36 STANDARD_TYPEDEFS = { | 36 STANDARD_TYPEDEFS = { |
37 # http://www.w3.org/TR/WebIDL/#common-DOMTimeStamp | 37 # http://www.w3.org/TR/WebIDL/#common-DOMTimeStamp |
38 'DOMTimeStamp': 'unsigned long long', | 38 'DOMTimeStamp': 'unsigned long long', |
39 } | 39 } |
40 | 40 |
| 41 |
41 def build_idl_definitions_from_ast(node): | 42 def build_idl_definitions_from_ast(node): |
42 if node is None: | 43 if node is None: |
43 return None | 44 return None |
44 node_class = node.GetClass() | 45 node_class = node.GetClass() |
45 if node_class != 'File': | 46 if node_class != 'File': |
46 raise ValueError('Unrecognized node class: %s' % node_class) | 47 raise ValueError('Unrecognized node class: %s' % node_class) |
47 return file_node_to_idl_definitions(node) | 48 return file_node_to_idl_definitions(node) |
48 | 49 |
49 | 50 |
50 def file_node_to_idl_definitions(node): | 51 def file_node_to_idl_definitions(node): |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 sequence_type = type_node_to_type(sequence_child) | 510 sequence_type = type_node_to_type(sequence_child) |
510 return 'sequence<%s>' % sequence_type | 511 return 'sequence<%s>' % sequence_type |
511 | 512 |
512 | 513 |
513 def union_type_node_to_idl_union_type(node): | 514 def union_type_node_to_idl_union_type(node): |
514 union_member_types = [] | 515 union_member_types = [] |
515 for member_type_node in node.GetChildren(): | 516 for member_type_node in node.GetChildren(): |
516 member_type = type_node_to_type(member_type_node) | 517 member_type = type_node_to_type(member_type_node) |
517 union_member_types.append(member_type) | 518 union_member_types.append(member_type) |
518 return IdlUnionType(union_member_types=union_member_types) | 519 return IdlUnionType(union_member_types=union_member_types) |
OLD | NEW |