IDL parser: Drop Date and RegExp from keywords
Date and RegExp were IDL type, but they were removed in Oct. 2015.[1]
In current spec, they are not reserved words and can be used as
identifiers.
This CL drops these words from keywords in Blink IDL parser, to
follow the current spec.
[1] https://github.com/heycam/webidl/pull/69
Bug: 839389
Change-Id: I2592573ba0c1875a3e828a54adfc5e040184d3fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1696842
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#676310}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 1a64435b93bcf470d2632e9930af9779ac355d39
diff --git a/idl_lexer.py b/idl_lexer.py
index b7e0674..ba13713 100755
--- a/idl_lexer.py
+++ b/idl_lexer.py
@@ -61,7 +61,6 @@
'callback' : 'CALLBACK',
'const' : 'CONST',
'creator' : 'CREATOR',
- 'Date' : 'DATE',
'deleter' : 'DELETER',
'dictionary' : 'DICTIONARY',
'DOMString' : 'DOMSTRING',
@@ -90,7 +89,6 @@
'partial' : 'PARTIAL',
'Promise' : 'PROMISE',
'readonly' : 'READONLY',
- 'RegExp' : 'REGEXP',
'record' : 'RECORD',
'required' : 'REQUIRED',
'sequence' : 'SEQUENCE',
diff --git a/idl_parser.py b/idl_parser.py
index 17f05c3..8ab0d04 100755
--- a/idl_parser.py
+++ b/idl_parser.py
@@ -877,7 +877,7 @@
if len(p) > 2:
p[0] = ListFromConcat(p[2], p[3])
- # Moved BYTESTRING, DOMSTRING, OBJECT, DATE, REGEXP to PrimitiveType
+ # Moved BYTESTRING, DOMSTRING, OBJECT to PrimitiveType
# Moving all built-in types into PrimitiveType makes it easier to
# differentiate between them and 'identifier', since p[1] would be a string in
# both cases.
@@ -909,7 +909,7 @@
p[0] = p[1]
- # Added StringType, OBJECT, DATE, REGEXP
+ # Added StringType, OBJECT
def p_PrimitiveType(self, p):
"""PrimitiveType : UnsignedIntegerType
| UnrestrictedFloatType
@@ -917,9 +917,7 @@
| BOOLEAN
| BYTE
| OCTET
- | OBJECT
- | DATE
- | REGEXP"""
+ | OBJECT"""
if type(p[1]) == str:
p[0] = self.BuildNamed('PrimitiveType', p, 1)
else:
diff --git a/test_lexer/keywords.in b/test_lexer/keywords.in
index c175d28..3e2b574 100644
--- a/test_lexer/keywords.in
+++ b/test_lexer/keywords.in
@@ -6,7 +6,6 @@
CALLBACK callback
CONST const
CREATOR creator
-DATE Date
DELETER deleter
DICTIONARY dictionary
DOMSTRING DOMString
@@ -33,7 +32,6 @@
PROMISE Promise
READONLY readonly
RECORD record
-REGEXP RegExp
REQUIRED required
SEQUENCE sequence
SETLIKE setlike
diff --git a/test_lexer/values.in b/test_lexer/values.in
index ad28589..a4d96d7 100644
--- a/test_lexer/values.in
+++ b/test_lexer/values.in
@@ -56,3 +56,5 @@
identifier include-hyphen
identifier _leading_underscore
identifier -leading_hyphen
+identifier Date
+identifier RegExp
diff --git a/test_parser/typedef_web.idl b/test_parser/typedef_web.idl
index 177e7ab..13cf203 100644
--- a/test_parser/typedef_web.idl
+++ b/test_parser/typedef_web.idl
@@ -92,13 +92,6 @@
typedef object MyObject;
/** TREE
- *Typedef(MyDate)
- * Type()
- * PrimitiveType(Date)
- */
-typedef Date MyDate;
-
-/** TREE
*Typedef(MyFloat)
* Type()
* PrimitiveType(float)
@@ -180,3 +173,10 @@
* ExtAttribute(Clamp)
*/
typedef ([TreatNullAs=EmptyString] DOMString or [Clamp] long) MyAnnotationInUnion;
+
+/** TREE
+ *Typedef(Date)
+ * Type()
+ * PrimitiveType(double)
+ */
+typedef double Date;