| 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 10 matching lines...) Expand all Loading... |
| 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | 28 |
| 29 # FIXME: eliminate this file if possible | 29 # FIXME: eliminate this file if possible |
| 30 | 30 |
| 31 import re |
| 31 import v8_types | 32 import v8_types |
| 32 | 33 |
| 33 ACRONYMS = ['CSS', 'HTML', 'IME', 'JS', 'SVG', 'URL', 'WOFF', 'XML', 'XSLT'] | 34 ACRONYMS = ['CSS', 'HTML', 'IME', 'JS', 'SVG', 'URL', 'WOFF', 'XML', 'XSLT'] |
| 34 | 35 |
| 35 | 36 |
| 36 # FIXME: these could be merged as implemented_as_cpp_name | 37 # FIXME: these could be merged as implemented_as_cpp_name |
| 37 def cpp_class_name(interface): | 38 def cpp_class_name(interface): |
| 38 return interface.extended_attributes.get('ImplementedAs', interface.name) | 39 return interface.extended_attributes.get('ImplementedAs', interface.name) |
| 39 | 40 |
| 40 | 41 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 """ | 75 """ |
| 75 for acronym in ACRONYMS: | 76 for acronym in ACRONYMS: |
| 76 if name.startswith(acronym): | 77 if name.startswith(acronym): |
| 77 name.replace(acronym, acronym.lower()) | 78 name.replace(acronym, acronym.lower()) |
| 78 return name | 79 return name |
| 79 return name[0].lower() + name[1:] | 80 return name[0].lower() + name[1:] |
| 80 | 81 |
| 81 | 82 |
| 82 def v8_class_name(interface): | 83 def v8_class_name(interface): |
| 83 return v8_types.v8_type(interface.name) | 84 return v8_types.v8_type(interface.name) |
| 85 |
| 86 |
| 87 def has_extended_attribute_value(extended_attributes, key, value): |
| 88 return key in extended_attributes and value in extended_attribute_values(ext
ended_attributes, key) |
| 89 |
| 90 |
| 91 def extended_attribute_values(extended_attributes, key): |
| 92 if key not in extended_attributes: |
| 93 return None |
| 94 values_string = extended_attributes[key] |
| 95 if not values_string: |
| 96 return [] |
| 97 return re.split('[|&]', values_string) |
| OLD | NEW |