| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 # Operation arguments: | 227 # Operation arguments: |
| 228 def _Arguments(): | 228 def _Arguments(): |
| 229 return MAYBE(MANY(Argument, ',')) | 229 return MAYBE(MANY(Argument, ',')) |
| 230 | 230 |
| 231 def Argument(): | 231 def Argument(): |
| 232 return syntax_switch( | 232 return syntax_switch( |
| 233 # Web IDL: | 233 # Web IDL: |
| 234 [MAYBE(ExtAttrs), MAYBE(Optional), MAYBE('in'), | 234 [MAYBE(ExtAttrs), MAYBE(Optional), MAYBE('in'), |
| 235 MAYBE(Optional), Type, MAYBE(AnEllipsis), Id], | 235 MAYBE(Optional), Type, MAYBE(AnEllipsis), Id], |
| 236 # WebKit: | 236 # WebKit: |
| 237 # TODO(antonm): cleanup this mess. | 237 [MAYBE(ExtAttrs), MAYBE(Optional), Type, Id]) |
| 238 [MAYBE(Optional), MAYBE('in'), MAYBE(Optional), | |
| 239 MAYBE(ExtAttrs), MAYBE(Optional), Type, Id]) | |
| 240 | 238 |
| 241 def Optional(): | 239 def Optional(): |
| 242 return 'optional' | 240 return 'optional' |
| 243 | 241 |
| 244 def AnEllipsis(): | 242 def AnEllipsis(): |
| 245 return '...' | 243 return '...' |
| 246 | 244 |
| 247 # Exceptions (Web IDL). | 245 # Exceptions (Web IDL). |
| 248 def ExceptionDef(): | 246 def ExceptionDef(): |
| 249 return ['exception', Id, '{', MAYBE(MANY(_ExceptionMember)), '}', | 247 return ['exception', Id, '{', MAYBE(MANY(_ExceptionMember)), '}', |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 Args: | 410 Args: |
| 413 content -- text to parse. | 411 content -- text to parse. |
| 414 defines -- an array of pre-processor defines. | 412 defines -- an array of pre-processor defines. |
| 415 includePaths -- an array of path strings used by the | 413 includePaths -- an array of path strings used by the |
| 416 gcc pre-processor. | 414 gcc pre-processor. |
| 417 """ | 415 """ |
| 418 if self._syntax == WEBKIT_SYNTAX: | 416 if self._syntax == WEBKIT_SYNTAX: |
| 419 content = self._pre_process(content, defines, includePaths) | 417 content = self._pre_process(content, defines, includePaths) |
| 420 | 418 |
| 421 return self._pegparser.parse(content) | 419 return self._pegparser.parse(content) |
| OLD | NEW |