Title: [238577] trunk/Source/WebKit
Revision
238577
Author
krol...@apple.com
Date
2018-11-27 14:12:53 -0800 (Tue, 27 Nov 2018)

Log Message

Better parsing of comments in generate-message*.py
https://bugs.webkit.org/show_bug.cgi?id=191866
<rdar://problem/46189563>

Reviewed by Chris Dumez.

The script parsing the *.messages.in files would treat a line starting
with '#' as a comment, but not a line starting with '<whitespace>#'.
This means that jamming a '#' right in front of the first character of
a message definition (as opposed to the beginning of a line) will have
no effect and the line will get treated just the same as a
non-commented line. Fix this by trimming all white space from the
beginning and ending of the line before processing it.

* Scripts/webkit/parser.py:
(parse):
* Scripts/webkit/test-messages.in:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (238576 => 238577)


--- trunk/Source/WebKit/ChangeLog	2018-11-27 22:03:19 UTC (rev 238576)
+++ trunk/Source/WebKit/ChangeLog	2018-11-27 22:12:53 UTC (rev 238577)
@@ -1,3 +1,23 @@
+2018-11-27  Keith Rollin  <krol...@apple.com>
+
+        Better parsing of comments in generate-message*.py
+        https://bugs.webkit.org/show_bug.cgi?id=191866
+        <rdar://problem/46189563>
+
+        Reviewed by Chris Dumez.
+
+        The script parsing the *.messages.in files would treat a line starting
+        with '#' as a comment, but not a line starting with '<whitespace>#'.
+        This means that jamming a '#' right in front of the first character of
+        a message definition (as opposed to the beginning of a line) will have
+        no effect and the line will get treated just the same as a
+        non-commented line. Fix this by trimming all white space from the
+        beginning and ending of the line before processing it.
+
+        * Scripts/webkit/parser.py:
+        (parse):
+        * Scripts/webkit/test-messages.in:
+
 2018-11-27  Thibault Saunier  <tsaun...@igalia.com>
 
         [GTK|WPE] Allow disabling WebRTC unified plan SDP through an env var

Modified: trunk/Source/WebKit/Scripts/webkit/parser.py (238576 => 238577)


--- trunk/Source/WebKit/Scripts/webkit/parser.py	2018-11-27 22:03:19 UTC (rev 238576)
+++ trunk/Source/WebKit/Scripts/webkit/parser.py	2018-11-27 22:12:53 UTC (rev 238577)
@@ -50,6 +50,7 @@
     master_condition = None
     superclass = []
     for line in file:
+        line = line.strip()
         match = re.search(r'messages -> (?P<destination>[A-Za-z_0-9]+) \s*(?::\s*(?P<superclass>.*?) \s*)?(?:(?P<attributes>.*?)\s+)?{', line)
         if match:
             receiver_attributes = parse_attributes_string(match.group('attributes'))
@@ -61,13 +62,12 @@
             destination = match.group('destination')
             continue
         if line.startswith('#'):
-            trimmed = line.rstrip()
             if line.startswith('#if '):
-                conditions.append(trimmed[4:])
+                conditions.append(line[4:])
             elif line.startswith('#endif') and conditions:
                 conditions.pop()
             elif line.startswith('#else') or line.startswith('#elif'):
-                raise Exception("ERROR: '%s' is not supported in the *.in files" % trimmed)
+                raise Exception("ERROR: '%s' is not supported in the *.in files" % line)
             continue
         match = re.search(r'([A-Za-z_0-9]+)\((.*?)\)(?:(?:\s+->\s+)\((.*?)\))?(?:\s+(.*))?', line)
         if match:

Modified: trunk/Source/WebKit/Scripts/webkit/test-messages.in (238576 => 238577)


--- trunk/Source/WebKit/Scripts/webkit/test-messages.in	2018-11-27 22:03:19 UTC (rev 238576)
+++ trunk/Source/WebKit/Scripts/webkit/test-messages.in	2018-11-27 22:12:53 UTC (rev 238577)
@@ -23,6 +23,13 @@
 #if ENABLE(WEBKIT2)
 #if NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND
 
+
+# The parser should treat all of these as comments
+#FakeLoadURLA(String url)
+# FakeLoadURLB(String url)
+    #FakeLoadURLC(String url)
+    # FakeLoadURLD(String url)
+
 messages -> WebPage {
     LoadURL(String url)
 #if ENABLE(TOUCH_EVENTS)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to