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

Unified Diff: Source/bindings/scripts/unstable/blink_idl_parser.py

Issue 127903002: Empty reflected attributes and string literals in extended attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: docstring formatting Created 6 years, 11 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
« no previous file with comments | « Source/bindings/scripts/idl_parser.pm ('k') | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/unstable/blink_idl_parser.py
diff --git a/Source/bindings/scripts/unstable/blink_idl_parser.py b/Source/bindings/scripts/unstable/blink_idl_parser.py
index 3418c9f37be371534305e553d81f77861354530d..bf40c68e1b7379d5669807aa54321c2e0921f21c 100644
--- a/Source/bindings/scripts/unstable/blink_idl_parser.py
+++ b/Source/bindings/scripts/unstable/blink_idl_parser.py
@@ -305,6 +305,7 @@ class BlinkIDLParser(IDLParser):
| ExtendedAttributeArgList
| ExtendedAttributeIdent
| ExtendedAttributeIdentList
+ | ExtendedAttributeStringLiteralList
| ExtendedAttributeNamedArgList"""
p[0] = p[1]
@@ -371,6 +372,26 @@ class BlinkIDLParser(IDLParser):
else:
p[0] = p[1]
+ # Blink extension: Add support for compound Extended Attribute values over string literals ("A"|"B")
+ def p_ExtendedAttributeStringLiteralList(self, p):
+ """ExtendedAttributeStringLiteralList : identifier '=' StringLiteralOrList"""
+ value = self.BuildAttribute('VALUE', p[3])
+ p[0] = self.BuildNamed('ExtAttribute', p, 1, value)
+
+ # Blink extension: one or more string literals. The values aren't propagated as literals,
+ # but their by their value only.
+ def p_StringLiteralOrList(self, p):
+ """StringLiteralOrList : StringLiteral '|' StringLiteralOrList
+ | StringLiteral"""
+ def unwrap_string(ls):
+ """Reach in and grab the string literal's "NAME"."""
+ return ls[1].value
+
+ if len(p) > 3:
+ p[0] = unwrap_string(p[1]) + p[2] + p[3]
+ else:
+ p[0] = unwrap_string(p[1])
+
def __dir__(self):
# Remove REMOVED_RULES from listing so yacc doesn't parse them
# FIXME: Upstream
« no previous file with comments | « Source/bindings/scripts/idl_parser.pm ('k') | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698