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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 FIXME: Not currently used in build. | 31 FIXME: Not currently used in build. |
32 This is a rewrite of the Perl IDL compiler in Python, but is not complete. | 32 This is a rewrite of the Perl IDL compiler in Python, but is not complete. |
33 Once it is complete, we will switch all IDL files over to Python at once. | 33 Once it is complete, we will switch all IDL files over to Python at once. |
34 Until then, please work on the Perl IDL compiler. | 34 Until then, please work on the Perl IDL compiler. |
35 For details, see bug http://crbug.com/239771 | 35 For details, see bug http://crbug.com/239771 |
36 """ | 36 """ |
37 | 37 |
38 # FIXME: eliminate this file if possible | 38 # FIXME: eliminate this file if possible |
39 | 39 |
| 40 import re |
40 import v8_types | 41 import v8_types |
41 | 42 |
42 ACRONYMS = ['CSS', 'HTML', 'IME', 'JS', 'SVG', 'URL', 'WOFF', 'XML', 'XSLT'] | 43 ACRONYMS = ['CSS', 'HTML', 'IME', 'JS', 'SVG', 'URL', 'WOFF', 'XML', 'XSLT'] |
| 44 extended_attribute_value_separator_re = re.compile('[|&]') |
43 | 45 |
44 | 46 |
45 def cpp_implemented_as_name(definition_or_member): | 47 def cpp_implemented_as_name(definition_or_member): |
46 return definition_or_member.extended_attributes.get('ImplementedAs', definit
ion_or_member.name) | 48 return definition_or_member.extended_attributes.get('ImplementedAs', definit
ion_or_member.name) |
47 | 49 |
48 | 50 |
49 def generate_conditional_string(definition_or_member): | 51 def generate_conditional_string(definition_or_member): |
50 if 'Conditional' not in definition_or_member.extended_attributes: | 52 if 'Conditional' not in definition_or_member.extended_attributes: |
51 return '' | 53 return '' |
52 conditional = definition_or_member.extended_attributes['Conditional'] | 54 conditional = definition_or_member.extended_attributes['Conditional'] |
(...skipping 25 matching lines...) Expand all Loading... |
78 """ | 80 """ |
79 for acronym in ACRONYMS: | 81 for acronym in ACRONYMS: |
80 if name.startswith(acronym): | 82 if name.startswith(acronym): |
81 name.replace(acronym, acronym.lower()) | 83 name.replace(acronym, acronym.lower()) |
82 return name | 84 return name |
83 return name[0].lower() + name[1:] | 85 return name[0].lower() + name[1:] |
84 | 86 |
85 | 87 |
86 def v8_class_name(interface): | 88 def v8_class_name(interface): |
87 return v8_types.v8_type(interface.name) | 89 return v8_types.v8_type(interface.name) |
| 90 |
| 91 |
| 92 def has_extended_attribute_value(extended_attributes, key, value): |
| 93 return key in extended_attributes and value in extended_attribute_values(ext
ended_attributes, key) |
| 94 |
| 95 |
| 96 def extended_attribute_values(extended_attributes, key): |
| 97 if key not in extended_attributes: |
| 98 return None |
| 99 values_string = extended_attributes[key] |
| 100 if not values_string: |
| 101 return [] |
| 102 return extended_attribute_value_separator_re.split(values_string) |
OLD | NEW |