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

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

Issue 396783002: Mojo: Mojom: Add AST types for methods, interface bodies, and interfaces. (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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/pylib/mojom/parse/parser.py
diff --git a/mojo/public/tools/bindings/pylib/mojom/parse/parser.py b/mojo/public/tools/bindings/pylib/mojom/parse/parser.py
index 5f4a10070c32ef4ddcccaeff1856de5be2bd0f21..819d5fa59f08cd7cdb7fca4cf6aa41c6dadbc7c5 100644
--- a/mojo/public/tools/bindings/pylib/mojom/parse/parser.py
+++ b/mojo/public/tools/bindings/pylib/mojom/parse/parser.py
@@ -197,25 +197,30 @@ class Parser(object):
def p_interface(self, p):
"""interface : attribute_section INTERFACE NAME LBRACE interface_body \
RBRACE SEMI"""
- p[0] = ('INTERFACE', p[3], p[1], p[5])
+ p[0] = ast.Interface(p[3], p[1], p[5])
- def p_interface_body(self, p):
- """interface_body : method interface_body
- | enum interface_body
- | const interface_body
- | """
- if len(p) > 1:
- p[0] = _ListFromConcat(p[1], p[2])
+ def p_interface_body_1(self, p):
+ """interface_body : """
+ p[0] = ast.InterfaceBody()
+
+ def p_interface_body_2(self, p):
+ """interface_body : interface_body const
+ | interface_body enum
+ | interface_body method"""
+ p[0] = p[1]
+ p[0].Append(p[2])
+
+ def p_response_1(self, p):
+ """response : """
+ p[0] = None
- def p_response(self, p):
- """response : RESPONSE LPAREN parameter_list RPAREN
- | """
- if len(p) > 3:
- p[0] = p[3]
+ def p_response_2(self, p):
+ """response : RESPONSE LPAREN parameter_list RPAREN"""
+ p[0] = p[3]
def p_method(self, p):
"""method : NAME ordinal LPAREN parameter_list RPAREN response SEMI"""
- p[0] = ('METHOD', p[1], p[4], p[2], p[6])
+ p[0] = ast.Method(p[1], p[2], p[4], p[6])
def p_parameter_list_1(self, p):
"""parameter_list : """
« no previous file with comments | « mojo/public/tools/bindings/pylib/mojom/parse/ast.py ('k') | mojo/public/tools/bindings/pylib/mojom/parse/translate.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698