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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 return re.compile(r'[\w\_\:\.\<\>]+') | 343 return re.compile(r'[\w\_\:\.\<\>]+') |
344 | 344 |
345 # Extended Attributes: | 345 # Extended Attributes: |
346 def ExtAttrs(): | 346 def ExtAttrs(): |
347 return ['[', MAYBE(MANY(ExtAttr, ',')), ']'] | 347 return ['[', MAYBE(MANY(ExtAttr, ',')), ']'] |
348 | 348 |
349 def ExtAttr(): | 349 def ExtAttr(): |
350 return [Id, MAYBE(OR(['=', ExtAttrValue], ExtAttrArgList))] | 350 return [Id, MAYBE(OR(['=', ExtAttrValue], ExtAttrArgList))] |
351 | 351 |
352 def ExtAttrValue(): | 352 def ExtAttrValue(): |
353 return OR(ExtAttrFunctionValue, re.compile(r'[\w&0-9:\-\| ]+')) | 353 return OR(ExtAttrFunctionValue, re.compile(r'[\w&0-9:\-\| ]+'), re.compile
(r'"[^"]+"\|"[^"]+"'), re.compile(r'"[^"]+"')) |
354 | 354 |
355 def ExtAttrFunctionValue(): | 355 def ExtAttrFunctionValue(): |
356 return [Id, ExtAttrArgList] | 356 return [Id, ExtAttrArgList] |
357 | 357 |
358 def ExtAttrArgList(): | 358 def ExtAttrArgList(): |
359 return ['(', MAYBE(MANY(Argument, ',')), ')'] | 359 return ['(', MAYBE(MANY(Argument, ',')), ')'] |
360 | 360 |
361 # Annotations - used in the FremontCut IDL grammar: | 361 # Annotations - used in the FremontCut IDL grammar: |
362 def _Annotations(): | 362 def _Annotations(): |
363 return MANY(Annotation) | 363 return MANY(Annotation) |
(...skipping 58 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 |