Chromium Code Reviews| 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 | 291 [AnyType, MAYBE([ArrayModifiers, MAYBE(Nullable)])], |
|
podivilov
2012/07/06 15:15:28
Why special case for AnyType?
Anton Muhin
2012/07/06 15:16:44
Per WebIDL spec any is not nullable.
podivilov
2012/07/06 15:24:48
This structure is too big to parse. Please keep _N
| |
| 292 def _NullableType(): | 292 [ |
| 293 return [OR(_IntegerType, BooleanType, OctetType, FloatType, | 293 OR( |
| 294 DoubleType, SequenceType, ScopedName), | 294 _IntegerType, BooleanType, OctetType, FloatType, DoubleType, |
| 295 MAYBE(Nullable)] | 295 ObjectType, SequenceType, ScopedName |
|
podivilov
2012/07/06 15:15:28
Why ObjectType became nullable?
Anton Muhin
2012/07/06 15:16:44
I found no references in the spec that it shouldn'
| |
| 296 ), | |
| 297 MAYBE(ArrayModifiers), | |
| 298 MAYBE(Nullable), | |
| 299 ]) | |
| 296 | 300 |
| 297 def Nullable(): | 301 def Nullable(): |
| 298 return '?' | 302 return '?' |
| 299 | 303 |
| 300 def SequenceType(): | 304 def SequenceType(): |
| 301 return ['sequence', '<', Type, '>'] | 305 return ['sequence', '<', Type, '>'] |
| 302 | 306 |
| 303 def AnyType(): | 307 def AnyType(): |
| 304 return 'any' | 308 return 'any' |
| 305 | 309 |
| (...skipping 123 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 |