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