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

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

Issue 683583002: Update mojo sdk to rev e083961bf11fd0c94d40be8853761da529b6d444 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: geolocation Created 6 years, 1 month 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
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 def p_import_list_1(self, p): 81 def p_import_list_1(self, p):
82 """import_list : """ 82 """import_list : """
83 p[0] = ast.ImportList() 83 p[0] = ast.ImportList()
84 84
85 def p_import_list_2(self, p): 85 def p_import_list_2(self, p):
86 """import_list : import_list import""" 86 """import_list : import_list import"""
87 p[0] = p[1] 87 p[0] = p[1]
88 p[0].Append(p[2]) 88 p[0].Append(p[2])
89 89
90 def p_import(self, p): 90 def p_import(self, p):
91 """import : IMPORT STRING_LITERAL""" 91 """import : IMPORT STRING_LITERAL SEMI"""
92 # 'eval' the literal to strip the quotes. 92 # 'eval' the literal to strip the quotes.
93 # TODO(vtl): This eval is dubious. We should unquote/unescape ourselves. 93 # TODO(vtl): This eval is dubious. We should unquote/unescape ourselves.
94 p[0] = ast.Import(eval(p[2])) 94 p[0] = ast.Import(eval(p[2]))
95 95
96 def p_module(self, p): 96 def p_module(self, p):
97 """module : attribute_section MODULE identifier_wrapped """ 97 """module : attribute_section MODULE identifier_wrapped """
98 p[0] = ast.Module(p[3], p[1], filename=self.filename, lineno=p.lineno(2)) 98 p[0] = ast.Module(p[3], p[1], filename=self.filename, lineno=p.lineno(2))
99 99
100 def p_definition_list(self, p): 100 def p_definition_list(self, p):
101 """definition_list : definition definition_list 101 """definition_list : definition definition_list
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 379
380 def Parse(source, filename): 380 def Parse(source, filename):
381 lexer = Lexer(filename) 381 lexer = Lexer(filename)
382 parser = Parser(lexer, source, filename) 382 parser = Parser(lexer, source, filename)
383 383
384 lex.lex(object=lexer) 384 lex.lex(object=lexer)
385 yacc.yacc(module=parser, debug=0, write_tables=0) 385 yacc.yacc(module=parser, debug=0, write_tables=0)
386 386
387 tree = yacc.parse(source) 387 tree = yacc.parse(source)
388 return tree 388 return tree
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698