OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 import sys | 6 import sys |
7 | 7 |
8 | 8 |
9 class IDLNode(object): | 9 class IDLNode(object): |
10 """Base class for all IDL elements. | 10 """Base class for all IDL elements. |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 if not self.id: | 311 if not self.id: |
312 raise SyntaxError('Could not parse type %s' % (ast)) | 312 raise SyntaxError('Could not parse type %s' % (ast)) |
313 | 313 |
314 def __label_to_type(self, label, ast): | 314 def __label_to_type(self, label, ast): |
315 if label.endswith('Type'): | 315 if label.endswith('Type'): |
316 # Omit 'Type' suffix and lowercase the rest. | 316 # Omit 'Type' suffix and lowercase the rest. |
317 label = '%s%s' % (label[0].lower(), label[1:-4]) | 317 label = '%s%s' % (label[0].lower(), label[1:-4]) |
318 if label == 'longLong': | 318 if label == 'longLong': |
319 # Special case for LongLongType: | 319 # Special case for LongLongType: |
320 label = 'long long' | 320 label = 'long long' |
| 321 if label == 'anyArray': |
| 322 label = 'any[]' |
| 323 |
321 # Add unsigned qualifier. | 324 # Add unsigned qualifier. |
322 if self._has(ast, 'Unsigned'): | 325 if self._has(ast, 'Unsigned'): |
323 label = 'unsigned %s' % label | 326 label = 'unsigned %s' % label |
324 return label | 327 return label |
325 | 328 |
326 | 329 |
327 class IDLTypeDef(IDLNode): | 330 class IDLTypeDef(IDLNode): |
328 """IDLNode for 'typedef [type] [id]' declarations.""" | 331 """IDLNode for 'typedef [type] [id]' declarations.""" |
329 def __init__(self, ast): | 332 def __init__(self, ast): |
330 IDLNode.__init__(self, ast) | 333 IDLNode.__init__(self, ast) |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 """IDLDictNode specialization for one annotation.""" | 454 """IDLDictNode specialization for one annotation.""" |
452 def __init__(self, ast=None): | 455 def __init__(self, ast=None): |
453 IDLDictNode.__init__(self, ast) | 456 IDLDictNode.__init__(self, ast) |
454 self.id = None | 457 self.id = None |
455 if not ast: | 458 if not ast: |
456 return | 459 return |
457 for arg in self._find_all(ast, 'AnnotationArg'): | 460 for arg in self._find_all(ast, 'AnnotationArg'): |
458 name = self._find_first(arg, 'Id') | 461 name = self._find_first(arg, 'Id') |
459 value = self._find_first(arg, 'AnnotationArgValue') | 462 value = self._find_first(arg, 'AnnotationArgValue') |
460 self[name] = value | 463 self[name] = value |
OLD | NEW |