Title: [94010] trunk/Source/WebCore
Revision
94010
Author
[email protected]
Date
2011-08-29 13:32:32 -0700 (Mon, 29 Aug 2011)

Log Message

Add parsing support for extended attributes on IDL constants
https://bugs.webkit.org/show_bug.cgi?id=65046

Reviewed by Brent Fulgham.

With support for extended attributes on constants we can
replace some preprocessor lines from the IDL files with
the corresponding [Conditional=XXX] later.
Using the preprocessor causes much pain on native windows.

CodeGenerator support will be added in separate patches.

* bindings/scripts/IDLParser.pm:
* bindings/scripts/IDLStructure.pm:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (94009 => 94010)


--- trunk/Source/WebCore/ChangeLog	2011-08-29 20:18:46 UTC (rev 94009)
+++ trunk/Source/WebCore/ChangeLog	2011-08-29 20:32:32 UTC (rev 94010)
@@ -1,3 +1,20 @@
+2011-08-29  Patrick Gansterer  <[email protected]>
+
+        Add parsing support for extended attributes on IDL constants
+        https://bugs.webkit.org/show_bug.cgi?id=65046
+
+        Reviewed by Brent Fulgham.
+
+        With support for extended attributes on constants we can
+        replace some preprocessor lines from the IDL files with
+        the corresponding [Conditional=XXX] later.
+        Using the preprocessor causes much pain on native windows.
+
+        CodeGenerator support will be added in separate patches.
+
+        * bindings/scripts/IDLParser.pm:
+        * bindings/scripts/IDLStructure.pm:
+
 2011-08-29  Ryosuke Niwa  <[email protected]>
 
         Cleanup: notifyFormStateChanged, formControlValueMatchesRenderer, and setFormControlValueMatchesRenderer

Modified: trunk/Source/WebCore/bindings/scripts/IDLParser.pm (94009 => 94010)


--- trunk/Source/WebCore/bindings/scripts/IDLParser.pm	2011-08-29 20:18:46 UTC (rev 94009)
+++ trunk/Source/WebCore/bindings/scripts/IDLParser.pm	2011-08-29 20:32:32 UTC (rev 94010)
@@ -330,14 +330,16 @@
                 push(@$arrayRef, $newDataNode);
             } elsif ($line =~ /^\s*const/) {
                 $line =~ /$IDLStructure::constantSelector/;
-                my $constType = (defined($1) ? $1 : die("Parsing error!\nSource:\n$line\n)"));
-                my $constName = (defined($2) ? $2 : die("Parsing error!\nSource:\n$line\n)"));
-                my $constValue = (defined($3) ? $3 : die("Parsing error!\nSource:\n$line\n)"));
+                my $constExtendedAttributes = (defined($1) ? $1 : " "); chop($constExtendedAttributes);
+                my $constType = (defined($2) ? $2 : die("Parsing error!\nSource:\n$line\n)"));
+                my $constName = (defined($3) ? $3 : die("Parsing error!\nSource:\n$line\n)"));
+                my $constValue = (defined($4) ? $4 : die("Parsing error!\nSource:\n$line\n)"));
 
                 my $newDataNode = new domConstant();
                 $newDataNode->name($constName);
                 $newDataNode->type($constType);
                 $newDataNode->value($constValue);
+                $newDataNode->extendedAttributes(parseExtendedAttributes($constExtendedAttributes));
 
                 my $arrayRef = $dataNode->constants;
                 push(@$arrayRef, $newDataNode);

Modified: trunk/Source/WebCore/bindings/scripts/IDLStructure.pm (94009 => 94010)


--- trunk/Source/WebCore/bindings/scripts/IDLStructure.pm	2011-08-29 20:18:46 UTC (rev 94009)
+++ trunk/Source/WebCore/bindings/scripts/IDLStructure.pm	2011-08-29 20:32:32 UTC (rev 94010)
@@ -70,6 +70,7 @@
     name => '$',      # DOM Constant identifier
     type => '$',      # Type of data
     value => '$',      # Constant value
+    extendedAttributes => '$', # Extended attributes
 });
 
 # Helpers
@@ -93,7 +94,7 @@
 # Regular _expression_ based IDL 'syntactical tokenizer' used in the IDLParser
 our $moduleSelector = 'module\s*(' . $idlId . '*)\s*{';
 our $moduleNSSelector = 'module\s*(' . $idlId . '*)\s*\[ns\s*(' . $idlIdNs . '*)\s*(' . $idlIdNs . '*)\]\s*;';
-our $constantSelector = 'const\s*' . $supportedTypes . '\s*(' . $idlType . '*)\s*=\s*(' . $constValue . ')';
+our $constantSelector = 'const\s*(' . $extendedAttributeSyntax . ' )?' . $supportedTypes . '\s*(' . $idlType . '*)\s*=\s*(' . $constValue . ')';
 our $raisesSelector = 'raises\s*\((' . $idlIdNsList . '*)\s*\)';
 our $getterRaisesSelector = '\bgetter\s+raises\s*\((' . $idlIdNsList . '*)\s*\)';
 our $setterRaisesSelector = '\bsetter\s+raises\s*\((' . $idlIdNsList . '*)\s*\)';
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to