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

Side by Side Diff: mojo/public/tools/bindings/pylib/mojom/parse/parser.py

Issue 247363003: Update mojom parser to allow array of arrays. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix js unit tests Created 6 years, 8 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
« no previous file with comments | « mojo/public/interfaces/bindings/tests/sample_service.mojom ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Generates a syntax tree from a Mojo IDL file.""" 6 """Generates a syntax tree from a Mojo IDL file."""
7 7
8 8
9 import os.path 9 import os.path
10 import sys 10 import sys
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 p[0] = "handle<" + p[3] + ">" 208 p[0] = "handle<" + p[3] + ">"
209 209
210 def p_specializedhandlename(self, p): 210 def p_specializedhandlename(self, p):
211 """specializedhandlename : DATA_PIPE_CONSUMER 211 """specializedhandlename : DATA_PIPE_CONSUMER
212 | DATA_PIPE_PRODUCER 212 | DATA_PIPE_PRODUCER
213 | MESSAGE_PIPE 213 | MESSAGE_PIPE
214 | SHARED_BUFFER""" 214 | SHARED_BUFFER"""
215 p[0] = p[1] 215 p[0] = p[1]
216 216
217 def p_array(self, p): 217 def p_array(self, p):
218 """array : basictypename LBRACKET RBRACKET""" 218 """array : typename LBRACKET RBRACKET"""
219 p[0] = p[1] + "[]" 219 p[0] = p[1] + "[]"
220 220
221 def p_ordinal(self, p): 221 def p_ordinal(self, p):
222 """ordinal : ORDINAL 222 """ordinal : ORDINAL
223 | """ 223 | """
224 if len(p) > 1: 224 if len(p) > 1:
225 value = int(p[1][1:]) 225 value = int(p[1][1:])
226 if value > _MAX_ORDINAL_VALUE: 226 if value > _MAX_ORDINAL_VALUE:
227 raise ParseError(self.filename, "Ordinal value %d too large:" % value, 227 raise ParseError(self.filename, "Ordinal value %d too large:" % value,
228 lineno=p.lineno(1), 228 lineno=p.lineno(1),
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 print Parse(f.read(), filename) 382 print Parse(f.read(), filename)
383 except ParseError, e: 383 except ParseError, e:
384 print e 384 print e
385 return 1 385 return 1
386 386
387 return 0 387 return 0
388 388
389 389
390 if __name__ == '__main__': 390 if __name__ == '__main__':
391 sys.exit(main(sys.argv)) 391 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « mojo/public/interfaces/bindings/tests/sample_service.mojom ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698