Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(751)

Side by Side Diff: tools/dom/scripts/idlparser.py

Issue 19820007: Fixes for Blink roll. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minors fixes Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 def _Definitions(): 64 def _Definitions():
65 return MAYBE(MANY(_Definition)) 65 return MAYBE(MANY(_Definition))
66 66
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, ImplStmt, CallbackDeclaration))
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, '}',
88 MAYBE(';')], 88 MAYBE(';')],
89 # FremontCut: 89 # FremontCut:
90 [MAYBE(_Annotations), MAYBE(ExtAttrs), 'module', Id, 90 [MAYBE(_Annotations), MAYBE(ExtAttrs), 'module', Id,
91 '{', _Definitions, '}', MAYBE(';')]) 91 '{', _Definitions, '}', MAYBE(';')])
92 92
93 def CallbackDeclaration():
94 return [Callback, Type, '=', Type,'(', ')', ';']
95
93 def Callback(): 96 def Callback():
94 return ['callback'] 97 return ['callback']
95 98
96 def Partial(): 99 def Partial():
97 return ['partial'] 100 return ['partial']
98 101
99 def Interface(): 102 def Interface():
100 return syntax_switch( 103 return syntax_switch(
101 # Web IDL: 104 # Web IDL:
102 [MAYBE(ExtAttrs), MAYBE(Partial), MAYBE(Callback), 'interface', Id, MAYB E(_ParentInterfaces), 105 [MAYBE(ExtAttrs), MAYBE(Partial), MAYBE(Callback), 'interface', Id, MAYB E(_ParentInterfaces),
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 Args: 422 Args:
420 content -- text to parse. 423 content -- text to parse.
421 defines -- an array of pre-processor defines. 424 defines -- an array of pre-processor defines.
422 includePaths -- an array of path strings used by the 425 includePaths -- an array of path strings used by the
423 gcc pre-processor. 426 gcc pre-processor.
424 """ 427 """
425 if self._syntax == WEBKIT_SYNTAX: 428 if self._syntax == WEBKIT_SYNTAX:
426 content = self._pre_process(content, defines, includePaths) 429 content = self._pre_process(content, defines, includePaths)
427 430
428 return self._pegparser.parse(content) 431 return self._pegparser.parse(content)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698