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

Unified Diff: mojo/public/bindings/pylib/parse/mojo_parser.py

Issue 164873002: Fix bug with using enums as default values in mojom. We were previously (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 10 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/bindings/pylib/parse/mojo_parser.py
diff --git a/mojo/public/bindings/pylib/parse/mojo_parser.py b/mojo/public/bindings/pylib/parse/mojo_parser.py
index 654814a156cc1293bc9a50370a5e613962af5cf0..4db5cd23a577b5a28ffe79d25380e20587d5f913 100755
--- a/mojo/public/bindings/pylib/parse/mojo_parser.py
+++ b/mojo/public/bindings/pylib/parse/mojo_parser.py
@@ -243,7 +243,7 @@ class Parser(object):
def p_expression(self, p):
"""expression : conditional_expression"""
- p[0] = p[1]
+ p[0] = ('EXPRESSION', p[1])
def p_conditional_expression(self, p):
"""conditional_expression : binary_expression
@@ -251,7 +251,7 @@ class Parser(object):
conditional_expression"""
# Just pass the arguments through. I don't think it's possible to preserve
# the spaces of the original, so just put a single space between them.
- p[0] = ' '.join(p[1:])
+ p[0] = ListFromConcat(*p[1:])
# PLY lets us specify precedence of operators, but since we don't actually
# evaluate them, we don't need that here.
@@ -259,7 +259,7 @@ class Parser(object):
"""binary_expression : unary_expression
| binary_expression binary_operator \
binary_expression"""
- p[0] = ' '.join(p[1:])
+ p[0] = ListFromConcat(*p[1:])
def p_binary_operator(self, p):
"""binary_operator : TIMES
@@ -285,7 +285,7 @@ class Parser(object):
def p_unary_expression(self, p):
"""unary_expression : primary_expression
| unary_operator expression"""
- p[0] = ''.join(p[1:])
+ p[0] = ListFromConcat(*p[1:])
def p_unary_operator(self, p):
"""unary_operator : PLUS
@@ -296,9 +296,13 @@ class Parser(object):
def p_primary_expression(self, p):
"""primary_expression : constant
- | NAME
- | NAME DOT NAME
+ | identifier
| LPAREN expression RPAREN"""
+ p[0] = ListFromConcat(*p[1:])
+
+ def p_identifier(self, p):
+ """identifier : NAME
+ | NAME DOT NAME"""
p[0] = ''.join(p[1:])
def p_constant(self, p):
@@ -311,7 +315,7 @@ class Parser(object):
| WCHAR_CONST
| STRING_LITERAL
| WSTRING_LITERAL"""
- p[0] = ''.join(p[1:])
+ p[0] = ListFromConcat(*p[1:])
def p_error(self, e):
print('error: %s'%e)
« no previous file with comments | « mojo/public/bindings/pylib/generate/mojom_generator.py ('k') | mojo/public/bindings/tests/sample_import2.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698