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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 def _Definition(): | 67 def _Definition(): |
68 return syntax_switch( | 68 return syntax_switch( |
69 # Web IDL: | 69 # Web IDL: |
70 OR(Module, Interface, ExceptionDef, TypeDef, ImplStmt, | 70 OR(Module, Interface, ExceptionDef, TypeDef, ImplStmt, |
71 ValueTypeDef, Const, Enum), | 71 ValueTypeDef, Const, Enum), |
72 # WebKit: | 72 # WebKit: |
73 OR(Module, Interface, Enum, TypeDef)) | 73 OR(Module, Interface, Enum, TypeDef)) |
74 | 74 |
75 def Enum(): | 75 def Enum(): |
76 def StringLiteral(): | 76 def StringLiteral(): |
77 return re.compile(r'"\w+"') | 77 return re.compile(r'"\w*"') |
78 | 78 |
79 return ['enum', Id, '{', MAYBE(MANY(StringLiteral, ',')), '}', ';'] | 79 return ['enum', Id, '{', MAYBE(MANY(StringLiteral, ',')), '}', ';'] |
80 | 80 |
81 def Module(): | 81 def Module(): |
82 return syntax_switch( | 82 return syntax_switch( |
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, '}', |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 Args: | 438 Args: |
439 content -- text to parse. | 439 content -- text to parse. |
440 defines -- an array of pre-processor defines. | 440 defines -- an array of pre-processor defines. |
441 includePaths -- an array of path strings used by the | 441 includePaths -- an array of path strings used by the |
442 gcc pre-processor. | 442 gcc pre-processor. |
443 """ | 443 """ |
444 if self._syntax == WEBKIT_SYNTAX: | 444 if self._syntax == WEBKIT_SYNTAX: |
445 content = self._pre_process(content, defines, includePaths) | 445 content = self._pre_process(content, defines, includePaths) |
446 | 446 |
447 return self._pegparser.parse(content) | 447 return self._pegparser.parse(content) |
OLD | NEW |