| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 def _ExceptionMember(): | 256 def _ExceptionMember(): |
| 257 return OR(Const, ExceptionField, ExtAttrs) | 257 return OR(Const, ExceptionField, ExtAttrs) |
| 258 | 258 |
| 259 def ExceptionField(): | 259 def ExceptionField(): |
| 260 return [Type, Id, ';'] | 260 return [Type, Id, ';'] |
| 261 | 261 |
| 262 # Types: | 262 # Types: |
| 263 def Type(): | 263 def Type(): |
| 264 return _Type | 264 return _Type |
| 265 | 265 |
| 266 def UnionType(): |
| 267 return ['(', Type, 'or', Type, ')'] |
| 268 |
| 266 def ReturnType(): | 269 def ReturnType(): |
| 267 return OR(VoidType, _Type) | 270 return OR(VoidType, _Type, UnionType) |
| 268 | 271 |
| 269 def InterfaceType(): | 272 def InterfaceType(): |
| 270 return ScopedName | 273 return ScopedName |
| 271 | 274 |
| 272 def ArrayModifiers(): | 275 def ArrayModifiers(): |
| 273 return re.compile(r'(\[\])+') | 276 return re.compile(r'(\[\])+') |
| 274 | 277 |
| 275 def _Type(): | 278 def _Type(): |
| 276 return OR( | 279 return OR( |
| 277 [OR(AnyType, ObjectType), MAYBE([ArrayModifiers, MAYBE(Nullable)])], | 280 [OR(AnyType, ObjectType), MAYBE([ArrayModifiers, MAYBE(Nullable)])], |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 Args: | 419 Args: |
| 417 content -- text to parse. | 420 content -- text to parse. |
| 418 defines -- an array of pre-processor defines. | 421 defines -- an array of pre-processor defines. |
| 419 includePaths -- an array of path strings used by the | 422 includePaths -- an array of path strings used by the |
| 420 gcc pre-processor. | 423 gcc pre-processor. |
| 421 """ | 424 """ |
| 422 if self._syntax == WEBKIT_SYNTAX: | 425 if self._syntax == WEBKIT_SYNTAX: |
| 423 content = self._pre_process(content, defines, includePaths) | 426 content = self._pre_process(content, defines, includePaths) |
| 424 | 427 |
| 425 return self._pegparser.parse(content) | 428 return self._pegparser.parse(content) |
| OLD | NEW |