| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 [MAYBE(ExtAttrs), 'module', Id, '{', _Definitions, '}', | 84 [MAYBE(ExtAttrs), 'module', Id, '{', _Definitions, '}', |
| 85 MAYBE(';')], | 85 MAYBE(';')], |
| 86 # WebKit: | 86 # WebKit: |
| 87 ['module', MAYBE(ExtAttrs), Id, '{', _Definitions, '}', | 87 ['module', MAYBE(ExtAttrs), Id, '{', _Definitions, '}', |
| 88 MAYBE(';')], | 88 MAYBE(';')], |
| 89 # FremontCut: | 89 # FremontCut: |
| 90 [MAYBE(_Annotations), MAYBE(ExtAttrs), 'module', Id, | 90 [MAYBE(_Annotations), MAYBE(ExtAttrs), 'module', Id, |
| 91 '{', _Definitions, '}', MAYBE(';')]) | 91 '{', _Definitions, '}', MAYBE(';')]) |
| 92 | 92 |
| 93 def CallbackDeclaration(): | 93 def CallbackDeclaration(): |
| 94 return [Callback, Type, '=', Type,'(', ')', ';'] | 94 return [Callback, Type, '=', Type,'(', _Arguments, ')', ';'] |
| 95 | 95 |
| 96 def Callback(): | 96 def Callback(): |
| 97 return ['callback'] | 97 return ['callback'] |
| 98 | 98 |
| 99 def Partial(): | 99 def Partial(): |
| 100 return ['partial'] | 100 return ['partial'] |
| 101 | 101 |
| 102 def Interface(): | 102 def Interface(): |
| 103 return syntax_switch( | 103 return syntax_switch( |
| 104 # Web IDL: | 104 # Web IDL: |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 # Operation arguments: | 236 # Operation arguments: |
| 237 def _Arguments(): | 237 def _Arguments(): |
| 238 return MAYBE(MANY(Argument, ',')) | 238 return MAYBE(MANY(Argument, ',')) |
| 239 | 239 |
| 240 def Argument(): | 240 def Argument(): |
| 241 return syntax_switch( | 241 return syntax_switch( |
| 242 # Web IDL: | 242 # Web IDL: |
| 243 [MAYBE(ExtAttrs), MAYBE(Optional), MAYBE('in'), | 243 [MAYBE(ExtAttrs), MAYBE(Optional), MAYBE('in'), |
| 244 MAYBE(Optional), Type, MAYBE(AnEllipsis), Id], | 244 MAYBE(Optional), Type, MAYBE(AnEllipsis), Id], |
| 245 # WebKit: | 245 # WebKit: |
| 246 [MAYBE(ExtAttrs), MAYBE(Optional), Type, Id]) | 246 [MAYBE(ExtAttrs), MAYBE(Optional), Type, MAYBE(AnEllipsis), Id]) |
| 247 | 247 |
| 248 def Optional(): | 248 def Optional(): |
| 249 return 'optional' | 249 return 'optional' |
| 250 | 250 |
| 251 def AnEllipsis(): | 251 def AnEllipsis(): |
| 252 return '...' | 252 return '...' |
| 253 | 253 |
| 254 # Exceptions (Web IDL). | 254 # Exceptions (Web IDL). |
| 255 def ExceptionDef(): | 255 def ExceptionDef(): |
| 256 return ['exception', Id, '{', MAYBE(MANY(_ExceptionMember)), '}', | 256 return ['exception', Id, '{', MAYBE(MANY(_ExceptionMember)), '}', |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 Args: | 422 Args: |
| 423 content -- text to parse. | 423 content -- text to parse. |
| 424 defines -- an array of pre-processor defines. | 424 defines -- an array of pre-processor defines. |
| 425 includePaths -- an array of path strings used by the | 425 includePaths -- an array of path strings used by the |
| 426 gcc pre-processor. | 426 gcc pre-processor. |
| 427 """ | 427 """ |
| 428 if self._syntax == WEBKIT_SYNTAX: | 428 if self._syntax == WEBKIT_SYNTAX: |
| 429 content = self._pre_process(content, defines, includePaths) | 429 content = self._pre_process(content, defines, includePaths) |
| 430 | 430 |
| 431 return self._pegparser.parse(content) | 431 return self._pegparser.parse(content) |
| OLD | NEW |