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

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

Issue 395203003: Mojo: Mojom: Remove some dead code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
« no previous file with comments | « no previous file | mojo/public/tools/bindings/pylib/mojom/parse/translate.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Generates a syntax tree from a Mojo IDL file.""" 5 """Generates a syntax tree from a Mojo IDL file."""
6 6
7 import imp 7 import imp
8 import os.path 8 import os.path
9 import sys 9 import sys
10 10
(...skipping 19 matching lines...) Expand all
30 30
31 from ..error import Error 31 from ..error import Error
32 import ast 32 import ast
33 from lexer import Lexer 33 from lexer import Lexer
34 34
35 35
36 _MAX_ORDINAL_VALUE = 0xffffffff 36 _MAX_ORDINAL_VALUE = 0xffffffff
37 _MAX_ARRAY_SIZE = 0xffffffff 37 _MAX_ARRAY_SIZE = 0xffffffff
38 38
39 39
40 def _ListFromConcat(*items):
41 """Generate list by concatenating inputs (note: only concatenates lists, not
42 tuples or other iterables)."""
43 itemsout = []
44 for item in items:
45 if item is None:
46 continue
47 if type(item) is not type([]):
48 itemsout.append(item)
49 else:
50 itemsout.extend(item)
51 return itemsout
52
53
54 # Disable lint check for exceptions deriving from Exception: 40 # Disable lint check for exceptions deriving from Exception:
55 # pylint: disable=W0710 41 # pylint: disable=W0710
56 class ParseError(Error): 42 class ParseError(Error):
57 """Class for errors from the parser.""" 43 """Class for errors from the parser."""
58 44
59 def __init__(self, filename, message, lineno=None, snippet=None): 45 def __init__(self, filename, message, lineno=None, snippet=None):
60 Error.__init__(self, filename, message, lineno=lineno, 46 Error.__init__(self, filename, message, lineno=lineno,
61 addenda=([snippet] if snippet else None)) 47 addenda=([snippet] if snippet else None))
62 48
63 49
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 371
386 def Parse(source, filename): 372 def Parse(source, filename):
387 lexer = Lexer(filename) 373 lexer = Lexer(filename)
388 parser = Parser(lexer, source, filename) 374 parser = Parser(lexer, source, filename)
389 375
390 lex.lex(object=lexer) 376 lex.lex(object=lexer)
391 yacc.yacc(module=parser, debug=0, write_tables=0) 377 yacc.yacc(module=parser, debug=0, write_tables=0)
392 378
393 tree = yacc.parse(source) 379 tree = yacc.parse(source)
394 return tree 380 return tree
OLDNEW
« no previous file with comments | « no previous file | mojo/public/tools/bindings/pylib/mojom/parse/translate.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698