Bug 804632. Allow certain reserved words as argument names in WebIDL. r=khuey
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 05 Nov 2012 14:40:32 -0500
changeset 112343 d56f12af4cd16521030bc708e1963cd531602c5e
parent 112342 287f8cf1f1e163e07e6b0addbfa1e7258ceb8677
child 112344 13a34f4d0d67d4acdc5f9ce52d80592412411d85
push id23812
push useremorley@mozilla.com
push dateTue, 06 Nov 2012 14:01:34 +0000
treeherdermozilla-central@f4aeed115e54 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs804632
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 804632. Allow certain reserved words as argument names in WebIDL. r=khuey
dom/bindings/parser/WebIDL.py
--- a/dom/bindings/parser/WebIDL.py
+++ b/dom/bindings/parser/WebIDL.py
@@ -2729,17 +2729,19 @@ class Tokenizer(object):
         "enum": "ENUM",
         "callback": "CALLBACK",
         "typedef": "TYPEDEF",
         "implements": "IMPLEMENTS",
         "const": "CONST",
         "null": "NULL",
         "true": "TRUE",
         "false": "FALSE",
+        "serializer": "SERIALIZER",
         "stringifier": "STRINGIFIER",
+        "unrestricted": "UNRESTRICTED",
         "attribute": "ATTRIBUTE",
         "readonly": "READONLY",
         "inherit": "INHERIT",
         "static": "STATIC",
         "getter": "GETTER",
         "setter": "SETTER",
         "creator": "CREATOR",
         "deleter": "DELETER",
@@ -3420,17 +3422,17 @@ class Parser(Tokenizer):
     def p_ArgumentsEmpty(self, p):
         """
             Arguments :
         """
         p[0] = []
 
     def p_Argument(self, p):
         """
-            Argument : ExtendedAttributeList Optional Type Ellipsis IDENTIFIER DefaultValue
+            Argument : ExtendedAttributeList Optional Type Ellipsis ArgumentName DefaultValue
         """
         t = p[3]
         assert isinstance(t, IDLType)
         identifier = IDLUnresolvedIdentifier(self.getLocation(p, 5), p[5])
 
         optional = p[2]
         variadic = p[4]
         defaultValue = p[6]
@@ -3443,16 +3445,42 @@ class Parser(Tokenizer):
             if optional:
                 raise WebIDLError("Variadic arguments should not be marked optional.",
                                   [self.getLocation(p, 2)])
             optional = variadic
 
         p[0] = IDLArgument(self.getLocation(p, 5), identifier, t, optional, defaultValue, variadic)
         p[0].addExtendedAttributes(p[1])
 
+    def p_ArgumentName(self, p):
+        """
+            ArgumentName : IDENTIFIER
+                         | ATTRIBUTE
+                         | CALLBACK
+                         | CONST
+                         | CREATOR
+                         | DELETER
+                         | DICTIONARY
+                         | ENUM
+                         | EXCEPTION
+                         | GETTER
+                         | IMPLEMENTS
+                         | INHERIT
+                         | INTERFACE
+                         | LEGACYCALLER
+                         | PARTIAL
+                         | SERIALIZER
+                         | SETTER
+                         | STATIC
+                         | STRINGIFIER
+                         | TYPEDEF
+                         | UNRESTRICTED
+        """
+        p[0] = p[1]
+
     def p_Optional(self, p):
         """
             Optional : OPTIONAL
         """
         p[0] = True
 
     def p_OptionalEmpty(self, p):
         """