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

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

Issue 1530433002: Remove directories in mojo/public/third_party that just mirrored third_party. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: with fixes Created 5 years 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
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
11 def _GetDirAbove(dirname): 11 def _GetDirAbove(dirname):
12 """Returns the directory "above" this file containing |dirname| (which must 12 """Returns the directory "above" this file containing |dirname| (which must
13 also be "above" this file).""" 13 also be "above" this file)."""
14 path = os.path.abspath(__file__) 14 path = os.path.abspath(__file__)
15 while True: 15 while True:
16 path, tail = os.path.split(path) 16 path, tail = os.path.split(path)
17 assert tail 17 assert tail
18 if tail == dirname: 18 if tail == dirname:
19 return path 19 return path
20 20
21 try: 21 try:
22 imp.find_module("ply") 22 imp.find_module("ply")
23 except ImportError: 23 except ImportError:
24 sys.path.append(os.path.join(_GetDirAbove("public"), "public/third_party")) 24 sys.path.append(os.path.join(_GetDirAbove("mojo"), "third_party"))
25 from ply import lex 25 from ply import lex
26 from ply import yacc 26 from ply import yacc
27 27
28 from ..error import Error 28 from ..error import Error
29 from . import ast 29 from . import ast
30 from .lexer import Lexer 30 from .lexer import Lexer
31 31
32 32
33 _MAX_ORDINAL_VALUE = 0xffffffff 33 _MAX_ORDINAL_VALUE = 0xffffffff
34 _MAX_ARRAY_SIZE = 0xffffffff 34 _MAX_ARRAY_SIZE = 0xffffffff
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 415
416 def Parse(source, filename): 416 def Parse(source, filename):
417 lexer = Lexer(filename) 417 lexer = Lexer(filename)
418 parser = Parser(lexer, source, filename) 418 parser = Parser(lexer, source, filename)
419 419
420 lex.lex(object=lexer) 420 lex.lex(object=lexer)
421 yacc.yacc(module=parser, debug=0, write_tables=0) 421 yacc.yacc(module=parser, debug=0, write_tables=0)
422 422
423 tree = yacc.parse(source) 423 tree = yacc.parse(source)
424 return tree 424 return tree
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698