| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 return OR(VoidType, _Type) | 277 return OR(VoidType, _Type) |
| 278 | 278 |
| 279 def InterfaceType(): | 279 def InterfaceType(): |
| 280 return ScopedName | 280 return ScopedName |
| 281 | 281 |
| 282 def _Type(): | 282 def _Type(): |
| 283 return OR(AnyType, ObjectType, _NullableType) | 283 return OR(AnyType, ObjectType, _NullableType) |
| 284 | 284 |
| 285 def _NullableType(): | 285 def _NullableType(): |
| 286 return [OR(_IntegerType, BooleanType, OctetType, FloatType, | 286 return [OR(_IntegerType, BooleanType, OctetType, FloatType, |
| 287 DoubleType, SequenceType, ScopedName), | 287 DoubleType, SequenceType, DOMStringListType, ScopedName), |
| 288 MAYBE(Nullable)] | 288 MAYBE(Nullable)] |
| 289 | 289 |
| 290 def Nullable(): | 290 def Nullable(): |
| 291 return '?' | 291 return '?' |
| 292 | 292 |
| 293 def SequenceType(): | 293 def SequenceType(): |
| 294 return ['sequence', '<', Type, '>'] | 294 return ['sequence', '<', Type, '>'] |
| 295 | 295 |
| 296 def AnyType(): | 296 def AnyType(): |
| 297 return 'any' | 297 return 'any' |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 335 |
| 336 def DoubleType(): | 336 def DoubleType(): |
| 337 return 'double' | 337 return 'double' |
| 338 | 338 |
| 339 def _ScopedNames(): | 339 def _ScopedNames(): |
| 340 return MANY(ScopedName, separator=',') | 340 return MANY(ScopedName, separator=',') |
| 341 | 341 |
| 342 def ScopedName(): | 342 def ScopedName(): |
| 343 return re.compile(r'[\w\_\:\.\<\>]+') | 343 return re.compile(r'[\w\_\:\.\<\>]+') |
| 344 | 344 |
| 345 def DOMStringListType(): |
| 346 return 'DOMString[]' |
| 347 |
| 345 # Extended Attributes: | 348 # Extended Attributes: |
| 346 def ExtAttrs(): | 349 def ExtAttrs(): |
| 347 return ['[', MANY(ExtAttr, ','), ']'] | 350 return ['[', MANY(ExtAttr, ','), ']'] |
| 348 | 351 |
| 349 def ExtAttr(): | 352 def ExtAttr(): |
| 350 return [Id, MAYBE(OR(['=', ExtAttrValue], ExtAttrArgList))] | 353 return [Id, MAYBE(OR(['=', ExtAttrValue], ExtAttrArgList))] |
| 351 | 354 |
| 352 def ExtAttrValue(): | 355 def ExtAttrValue(): |
| 353 return OR(ExtAttrFunctionValue, re.compile(r'[\w&0-9:\-\|]+')) | 356 return OR(ExtAttrFunctionValue, re.compile(r'[\w&0-9:\-\|]+')) |
| 354 | 357 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 Args: | 432 Args: |
| 430 content -- text to parse. | 433 content -- text to parse. |
| 431 defines -- an array of pre-processor defines. | 434 defines -- an array of pre-processor defines. |
| 432 includePaths -- an array of path strings used by the | 435 includePaths -- an array of path strings used by the |
| 433 gcc pre-processor. | 436 gcc pre-processor. |
| 434 """ | 437 """ |
| 435 if self._syntax == WEBKIT_SYNTAX: | 438 if self._syntax == WEBKIT_SYNTAX: |
| 436 content = self._pre_process(content, defines, includePaths) | 439 content = self._pre_process(content, defines, includePaths) |
| 437 | 440 |
| 438 return self._pegparser.parse(content) | 441 return self._pegparser.parse(content) |
| OLD | NEW |