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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 return OR(VoidType, _Type) | 281 return OR(VoidType, _Type) |
282 | 282 |
283 def InterfaceType(): | 283 def InterfaceType(): |
284 return ScopedName | 284 return ScopedName |
285 | 285 |
286 def _Type(): | 286 def _Type(): |
287 return OR(AnyArrayType, AnyType, ObjectType, _NullableType) | 287 return OR(AnyArrayType, AnyType, ObjectType, _NullableType) |
288 | 288 |
289 def _NullableType(): | 289 def _NullableType(): |
290 return [OR(_IntegerType, BooleanType, OctetType, FloatType, | 290 return [OR(_IntegerType, BooleanType, OctetType, FloatType, |
291 DoubleType, SequenceType, DOMStringListType, ScopedName), | 291 DoubleType, SequenceType, DOMStringArrayType, ScopedName), |
292 MAYBE(Nullable)] | 292 MAYBE(Nullable)] |
293 | 293 |
294 def Nullable(): | 294 def Nullable(): |
295 return '?' | 295 return '?' |
296 | 296 |
297 def SequenceType(): | 297 def SequenceType(): |
298 return ['sequence', '<', Type, '>'] | 298 return ['sequence', '<', Type, '>'] |
299 | 299 |
300 def AnyType(): | 300 def AnyType(): |
301 return 'any' | 301 return 'any' |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 | 343 |
344 def DoubleType(): | 344 def DoubleType(): |
345 return 'double' | 345 return 'double' |
346 | 346 |
347 def _ScopedNames(): | 347 def _ScopedNames(): |
348 return MANY(ScopedName, separator=',') | 348 return MANY(ScopedName, separator=',') |
349 | 349 |
350 def ScopedName(): | 350 def ScopedName(): |
351 return re.compile(r'[\w\_\:\.\<\>]+') | 351 return re.compile(r'[\w\_\:\.\<\>]+') |
352 | 352 |
353 def DOMStringListType(): | 353 def DOMStringArrayType(): |
354 return 'DOMString[]' | 354 return 'DOMString[]' |
355 | 355 |
356 # Extended Attributes: | 356 # Extended Attributes: |
357 def ExtAttrs(): | 357 def ExtAttrs(): |
358 return ['[', MAYBE(MANY(ExtAttr, ',')), ']'] | 358 return ['[', MAYBE(MANY(ExtAttr, ',')), ']'] |
359 | 359 |
360 def ExtAttr(): | 360 def ExtAttr(): |
361 return [Id, MAYBE(OR(['=', ExtAttrValue], ExtAttrArgList))] | 361 return [Id, MAYBE(OR(['=', ExtAttrValue], ExtAttrArgList))] |
362 | 362 |
363 def ExtAttrValue(): | 363 def ExtAttrValue(): |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 Args: | 433 Args: |
434 content -- text to parse. | 434 content -- text to parse. |
435 defines -- an array of pre-processor defines. | 435 defines -- an array of pre-processor defines. |
436 includePaths -- an array of path strings used by the | 436 includePaths -- an array of path strings used by the |
437 gcc pre-processor. | 437 gcc pre-processor. |
438 """ | 438 """ |
439 if self._syntax == WEBKIT_SYNTAX: | 439 if self._syntax == WEBKIT_SYNTAX: |
440 content = self._pre_process(content, defines, includePaths) | 440 content = self._pre_process(content, defines, includePaths) |
441 | 441 |
442 return self._pegparser.parse(content) | 442 return self._pegparser.parse(content) |
OLD | NEW |