| 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 re | 6 import re |
| 7 import subprocess | 7 import subprocess |
| 8 import tempfile | 8 import tempfile |
| 9 | 9 |
| 10 from pegparser import * | 10 from pegparser import * |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 def Type(): | 277 def Type(): |
| 278 return _Type | 278 return _Type |
| 279 | 279 |
| 280 def ReturnType(): | 280 def ReturnType(): |
| 281 return OR(VoidType, _Type) | 281 return OR(VoidType, _Type) |
| 282 | 282 |
| 283 def InterfaceType(): | 283 def InterfaceType(): |
| 284 return ScopedName | 284 return ScopedName |
| 285 | 285 |
| 286 def _Type(): | 286 def _Type(): |
| 287 return OR(AnyType, ObjectType, _NullableType) | 287 return OR(AnyArrayType, AnyType, ObjectType, _NullableType) |
| 288 | 288 |
| 289 def _NullableType(): | 289 def _NullableType(): |
| 290 return [OR(_IntegerType, BooleanType, OctetType, FloatType, | 290 return [OR(_IntegerType, BooleanType, OctetType, FloatType, |
| 291 DoubleType, SequenceType, DOMStringListType, ScopedName), | 291 DoubleType, SequenceType, DOMStringListType, ScopedName), |
| 292 MAYBE(Nullable)] | 292 MAYBE(Nullable)] |
| 293 | 293 |
| 294 def Nullable(): | 294 def Nullable(): |
| 295 return '?' | 295 return '?' |
| 296 | 296 |
| 297 def SequenceType(): | 297 def SequenceType(): |
| 298 return ['sequence', '<', Type, '>'] | 298 return ['sequence', '<', Type, '>'] |
| 299 | 299 |
| 300 def AnyType(): | 300 def AnyType(): |
| 301 return 'any' | 301 return 'any' |
| 302 | 302 |
| 303 def AnyArrayType(): |
| 304 # TODO(sra): Do more general handling of array types. |
| 305 return 'any[]' |
| 306 |
| 303 def ObjectType(): | 307 def ObjectType(): |
| 304 return 'object' | 308 return 'object' |
| 305 | 309 |
| 306 def VoidType(): | 310 def VoidType(): |
| 307 return 'void' | 311 return 'void' |
| 308 | 312 |
| 309 def _IntegerType(): | 313 def _IntegerType(): |
| 310 return [MAYBE(Unsigned), OR(ByteType, IntType, LongLongType, | 314 return [MAYBE(Unsigned), OR(ByteType, IntType, LongLongType, |
| 311 LongType, OctetType, ShortType)] | 315 LongType, OctetType, ShortType)] |
| 312 | 316 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 Args: | 433 Args: |
| 430 content -- text to parse. | 434 content -- text to parse. |
| 431 defines -- an array of pre-processor defines. | 435 defines -- an array of pre-processor defines. |
| 432 includePaths -- an array of path strings used by the | 436 includePaths -- an array of path strings used by the |
| 433 gcc pre-processor. | 437 gcc pre-processor. |
| 434 """ | 438 """ |
| 435 if self._syntax == WEBKIT_SYNTAX: | 439 if self._syntax == WEBKIT_SYNTAX: |
| 436 content = self._pre_process(content, defines, includePaths) | 440 content = self._pre_process(content, defines, includePaths) |
| 437 | 441 |
| 438 return self._pegparser.parse(content) | 442 return self._pegparser.parse(content) |
| OLD | NEW |