| 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 # FremontCut: | 83 # FremontCut: |
| 84 [MAYBE(_Annotations), MAYBE(ExtAttrs), 'module', Id, | 84 [MAYBE(_Annotations), MAYBE(ExtAttrs), 'module', Id, |
| 85 '{', _Definitions, '}', MAYBE(';')]) | 85 '{', _Definitions, '}', MAYBE(';')]) |
| 86 | 86 |
| 87 def Interface(): | 87 def Interface(): |
| 88 return syntax_switch( | 88 return syntax_switch( |
| 89 # Web IDL: | 89 # Web IDL: |
| 90 [MAYBE(ExtAttrs), 'interface', Id, MAYBE(_ParentInterfaces), | 90 [MAYBE(ExtAttrs), 'interface', Id, MAYBE(_ParentInterfaces), |
| 91 MAYBE(['{', MAYBE(MANY(_Member)), '}']), ';'], | 91 MAYBE(['{', MAYBE(MANY(_Member)), '}']), ';'], |
| 92 # WebKit: | 92 # WebKit: |
| 93 [OR('interface', 'exception'), MAYBE(ExtAttrs), Id, MAYBE(_ParentInterfa
ces), | 93 [MAYBE(ExtAttrs), OR('interface', 'exception'), MAYBE(ExtAttrs), Id, MAY
BE(_ParentInterfaces), |
| 94 MAYBE(['{', MAYBE(MANY(_Member)), '}']), MAYBE(';')], | 94 MAYBE(['{', MAYBE(MANY(_Member)), '}']), MAYBE(';')], |
| 95 # FremontCut: | 95 # FremontCut: |
| 96 [MAYBE(_Annotations), MAYBE(ExtAttrs), 'interface', | 96 [MAYBE(_Annotations), MAYBE(ExtAttrs), 'interface', |
| 97 Id, MAYBE(_ParentInterfaces), MAYBE(['{', MAYBE(MANY(_Member)), | 97 Id, MAYBE(_ParentInterfaces), MAYBE(['{', MAYBE(MANY(_Member)), |
| 98 '}']), ';']) | 98 '}']), ';']) |
| 99 | 99 |
| 100 def _Member(): | 100 def _Member(): |
| 101 return syntax_switch( | 101 return syntax_switch( |
| 102 # Web IDL: | 102 # Web IDL: |
| 103 OR(Const, Attribute, Operation, ExtAttrs), | 103 OR(Const, Attribute, Operation, ExtAttrs), |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 def _FloatLiteral(): | 164 def _FloatLiteral(): |
| 165 return re.compile(r'[0-9]+\.[0-9]*') | 165 return re.compile(r'[0-9]+\.[0-9]*') |
| 166 | 166 |
| 167 # Attributes: | 167 # Attributes: |
| 168 def Attribute(): | 168 def Attribute(): |
| 169 return syntax_switch( | 169 return syntax_switch( |
| 170 # Web IDL: | 170 # Web IDL: |
| 171 [MAYBE(ExtAttrs), MAYBE(Stringifier), MAYBE(ReadOnly), | 171 [MAYBE(ExtAttrs), MAYBE(Stringifier), MAYBE(ReadOnly), |
| 172 'attribute', Type, Id, MAYBE(_AttrRaises), ';'], | 172 'attribute', Type, Id, MAYBE(_AttrRaises), ';'], |
| 173 # WebKit: | 173 # WebKit: |
| 174 [MAYBE(Stringifier), MAYBE(Static), MAYBE(ReadOnly), 'attribute', | 174 [ |
| 175 MAYBE(ExtAttrs), Type, Id, MAYBE(_AttrRaises), ';'], | 175 MAYBE(Stringifier), |
| 176 MAYBE(ExtAttrs), MAYBE(Static), MAYBE(ReadOnly), 'attribute', MAYBE(Ex
tAttrs), |
| 177 Type, Id, MAYBE(_AttrRaises), ';'], |
| 176 # FremontCut: | 178 # FremontCut: |
| 177 [MAYBE(_Annotations), MAYBE(ExtAttrs), | 179 [MAYBE(_Annotations), MAYBE(ExtAttrs), |
| 178 MAYBE(_AttrGetterSetter), MAYBE(Stringifier), MAYBE(ReadOnly), | 180 MAYBE(_AttrGetterSetter), MAYBE(Stringifier), MAYBE(ReadOnly), |
| 179 'attribute', Type, Id, MAYBE(_AttrRaises), ';']) | 181 'attribute', Type, Id, MAYBE(_AttrRaises), ';']) |
| 180 | 182 |
| 181 def _AttrRaises(): | 183 def _AttrRaises(): |
| 182 return syntax_switch( | 184 return syntax_switch( |
| 183 # Web IDL: | 185 # Web IDL: |
| 184 MANY(OR(GetRaises, SetRaises)), | 186 MANY(OR(GetRaises, SetRaises)), |
| 185 # WebKit: | 187 # WebKit: |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 Args: | 432 Args: |
| 431 content -- text to parse. | 433 content -- text to parse. |
| 432 defines -- an array of pre-processor defines. | 434 defines -- an array of pre-processor defines. |
| 433 includePaths -- an array of path strings used by the | 435 includePaths -- an array of path strings used by the |
| 434 gcc pre-processor. | 436 gcc pre-processor. |
| 435 """ | 437 """ |
| 436 if self._syntax == WEBKIT_SYNTAX: | 438 if self._syntax == WEBKIT_SYNTAX: |
| 437 content = self._pre_process(content, defines, includePaths) | 439 content = self._pre_process(content, defines, includePaths) |
| 438 | 440 |
| 439 return self._pegparser.parse(content) | 441 return self._pegparser.parse(content) |
| OLD | NEW |