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

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

Issue 391003003: Mojo: Mojom: Add AST type for struct fields. (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 3feed352e830013e1e480c8ccc8f016035c57e38..3a3bf31e0cb11a494e00ec965b91405d47922c77 100644
--- a/mojo/public/tools/bindings/pylib/mojom/parse/parser.py
+++ b/mojo/public/tools/bindings/pylib/mojom/parse/parser.py
@@ -181,13 +181,15 @@ class Parser(object):
def p_field(self, p):
"""field : typename NAME ordinal default SEMI"""
- p[0] = ('FIELD', p[1], p[2], p[3], p[4])
+ p[0] = ast.StructField(p[2], p[3], p[1], p[4])
- def p_default(self, p):
- """default : EQUALS constant
- | """
- if len(p) > 2:
- p[0] = p[2]
+ def p_default_1(self, p):
+ """default : """
+ p[0] = None
+
+ def p_default_2(self, p):
+ """default : EQUALS constant"""
+ p[0] = p[2]
def p_interface(self, p):
"""interface : attribute_section INTERFACE NAME LBRACE interface_body \
@@ -231,7 +233,7 @@ class Parser(object):
def p_parameter(self, p):
"""parameter : typename NAME ordinal"""
- p[0] = ast.Parameter(p[1], p[2], p[3],
+ p[0] = ast.Parameter(p[2], p[3], p[1],
filename=self.filename, lineno=p.lineno(2))
def p_typename(self, p):
« 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