| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 ArrayModifiers(): | 286 def ArrayModifiers(): |
| 287 return re.compile(r'(\[\])+') | 287 return re.compile(r'(\[\])+') |
| 288 | 288 |
| 289 def _Type(): | 289 def _Type(): |
| 290 return [OR(AnyType, ObjectType, _NullableType), MAYBE(ArrayModifiers)] | 290 return OR( |
| 291 [OR(AnyType, ObjectType), MAYBE([ArrayModifiers, MAYBE(Nullable)])], |
| 292 [_NullableNonArrayType(), MAYBE(ArrayModifiers), MAYBE(Nullable)]) |
| 291 | 293 |
| 292 def _NullableType(): | 294 def _NullableNonArrayType(): |
| 293 return [OR(_IntegerType, BooleanType, OctetType, FloatType, | 295 return [OR(_IntegerType, BooleanType, OctetType, FloatType, |
| 294 DoubleType, SequenceType, ScopedName), | 296 DoubleType, SequenceType, ScopedName)] |
| 295 MAYBE(Nullable)] | |
| 296 | 297 |
| 297 def Nullable(): | 298 def Nullable(): |
| 298 return '?' | 299 return '?' |
| 299 | 300 |
| 300 def SequenceType(): | 301 def SequenceType(): |
| 301 return ['sequence', '<', Type, '>'] | 302 return ['sequence', '<', Type, '>'] |
| 302 | 303 |
| 303 def AnyType(): | 304 def AnyType(): |
| 304 return 'any' | 305 return 'any' |
| 305 | 306 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 Args: | 430 Args: |
| 430 content -- text to parse. | 431 content -- text to parse. |
| 431 defines -- an array of pre-processor defines. | 432 defines -- an array of pre-processor defines. |
| 432 includePaths -- an array of path strings used by the | 433 includePaths -- an array of path strings used by the |
| 433 gcc pre-processor. | 434 gcc pre-processor. |
| 434 """ | 435 """ |
| 435 if self._syntax == WEBKIT_SYNTAX: | 436 if self._syntax == WEBKIT_SYNTAX: |
| 436 content = self._pre_process(content, defines, includePaths) | 437 content = self._pre_process(content, defines, includePaths) |
| 437 | 438 |
| 438 return self._pegparser.parse(content) | 439 return self._pegparser.parse(content) |
| OLD | NEW |