| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 # Web IDL: | 83 # Web IDL: |
| 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 Callback(): |
| 94 return ['callback'] |
| 95 |
| 96 def Partial(): |
| 97 return ['partial'] |
| 98 |
| 93 def Interface(): | 99 def Interface(): |
| 94 return syntax_switch( | 100 return syntax_switch( |
| 95 # Web IDL: | 101 # Web IDL: |
| 96 [MAYBE(ExtAttrs), 'interface', Id, MAYBE(_ParentInterfaces), | 102 [MAYBE(ExtAttrs), MAYBE(Partial), MAYBE(Callback), 'interface', Id, MAYB
E(_ParentInterfaces), |
| 97 MAYBE(['{', MAYBE(MANY(_Member)), '}']), ';'], | 103 MAYBE(['{', MAYBE(MANY(_Member)), '}']), ';'], |
| 98 # WebKit: | 104 # WebKit: |
| 99 [MAYBE(ExtAttrs), OR('interface', 'exception'), MAYBE(ExtAttrs), Id, MAY
BE(_ParentInterfaces), | 105 [MAYBE(ExtAttrs), MAYBE(Partial), MAYBE(Callback), OR('interface', 'exce
ption'), MAYBE(ExtAttrs), Id, MAYBE(_ParentInterfaces), |
| 100 MAYBE(['{', MAYBE(MANY(_Member)), '}']), MAYBE(';')], | 106 MAYBE(['{', MAYBE(MANY(_Member)), '}']), MAYBE(';')], |
| 101 # FremontCut: | 107 # FremontCut: |
| 102 [MAYBE(_Annotations), MAYBE(ExtAttrs), 'interface', | 108 [MAYBE(_Annotations), MAYBE(ExtAttrs), 'interface', |
| 103 Id, MAYBE(_ParentInterfaces), MAYBE(['{', MAYBE(MANY(_Member)), | 109 Id, MAYBE(_ParentInterfaces), MAYBE(['{', MAYBE(MANY(_Member)), |
| 104 '}']), ';']) | 110 '}']), ';']) |
| 105 | 111 |
| 106 def _Member(): | 112 def _Member(): |
| 107 return syntax_switch( | 113 return syntax_switch( |
| 108 # Web IDL: | 114 # Web IDL: |
| 109 OR(Const, Attribute, Operation, ExtAttrs), | 115 OR(Const, Attribute, Operation, ExtAttrs), |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 def ReadOnly(): | 205 def ReadOnly(): |
| 200 return 'readonly' | 206 return 'readonly' |
| 201 | 207 |
| 202 # Operation: | 208 # Operation: |
| 203 def Operation(): | 209 def Operation(): |
| 204 return syntax_switch( | 210 return syntax_switch( |
| 205 # Web IDL: | 211 # Web IDL: |
| 206 [MAYBE(ExtAttrs), MAYBE(Static), MAYBE(Stringifier), MAYBE(_Specials), | 212 [MAYBE(ExtAttrs), MAYBE(Static), MAYBE(Stringifier), MAYBE(_Specials), |
| 207 ReturnType, MAYBE(Id), '(', _Arguments, ')', ';'], | 213 ReturnType, MAYBE(Id), '(', _Arguments, ')', ';'], |
| 208 # WebKit: | 214 # WebKit: |
| 209 [MAYBE(ExtAttrs), MAYBE(Static), | 215 [MAYBE(ExtAttrs), MAYBE(Static), MAYBE(_AttrGetterSetter), |
| 210 ReturnType, MAYBE(Id), '(', _Arguments, ')', ';'], | 216 ReturnType, MAYBE(Id), '(', _Arguments, ')', ';'], |
| 211 # FremontCut: | 217 # FremontCut: |
| 212 [MAYBE(_Annotations), MAYBE(ExtAttrs), MAYBE(Static), MAYBE(Stringifier)
, | 218 [MAYBE(_Annotations), MAYBE(ExtAttrs), MAYBE(Static), MAYBE(Stringifier)
, |
| 213 MAYBE(_Specials), ReturnType, MAYBE(Id), '(', _Arguments, ')', ';']) | 219 MAYBE(_Specials), ReturnType, MAYBE(Id), '(', _Arguments, ')', ';']) |
| 214 | 220 |
| 215 def Static(): | 221 def Static(): |
| 216 return 'static' | 222 return 'static' |
| 217 | 223 |
| 218 def _Specials(): | 224 def _Specials(): |
| 219 return MANY(Special) | 225 return MANY(Special) |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 Args: | 416 Args: |
| 411 content -- text to parse. | 417 content -- text to parse. |
| 412 defines -- an array of pre-processor defines. | 418 defines -- an array of pre-processor defines. |
| 413 includePaths -- an array of path strings used by the | 419 includePaths -- an array of path strings used by the |
| 414 gcc pre-processor. | 420 gcc pre-processor. |
| 415 """ | 421 """ |
| 416 if self._syntax == WEBKIT_SYNTAX: | 422 if self._syntax == WEBKIT_SYNTAX: |
| 417 content = self._pre_process(content, defines, includePaths) | 423 content = self._pre_process(content, defines, includePaths) |
| 418 | 424 |
| 419 return self._pegparser.parse(content) | 425 return self._pegparser.parse(content) |
| OLD | NEW |