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

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

Issue 268363003: Mojo: Add support for constants to the IDL compiler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: JS export constants Created 6 years, 7 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 9dd6e07bd2e1cf69148159e9e45c320d4f94f5a7..5067de57dfab8f713540a832f8d104a44e2a783f 100644
--- a/mojo/public/tools/bindings/pylib/mojom/parse/parser.py
+++ b/mojo/public/tools/bindings/pylib/mojom/parse/parser.py
@@ -101,7 +101,8 @@ class Parser(object):
def p_definition(self, p):
"""definition : struct
| interface
- | enum"""
+ | enum
+ | const"""
p[0] = p[1]
def p_attribute_section(self, p):
@@ -131,6 +132,7 @@ class Parser(object):
def p_struct_body(self, p):
"""struct_body : field struct_body
| enum struct_body
+ | const struct_body
| """
if len(p) > 1:
p[0] = _ListFromConcat(p[1], p[2])
@@ -154,6 +156,7 @@ class Parser(object):
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])
@@ -243,6 +246,10 @@ class Parser(object):
else:
p[0] = ('ENUM_FIELD', p[1], p[3])
+ def p_const(self, p):
+ """const : CONST typename NAME EQUALS expression SEMI"""
+ p[0] = ('CONST', p[2], p[3], p[5])
+
### Expressions ###
def p_expression_object(self, p):
« no previous file with comments | « mojo/public/tools/bindings/pylib/mojom/parse/lexer.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