Changeset 238577 in webkit


Ignore:
Timestamp:
Nov 27, 2018 2:12:53 PM (5 years ago)
Author:
Keith Rollin
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:
Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r238574 r238577  
     12018-11-27  Keith Rollin  <krollin@apple.com>
     2
     3        Better parsing of comments in generate-message*.py
     4        https://bugs.webkit.org/show_bug.cgi?id=191866
     5        <rdar://problem/46189563>
     6
     7        Reviewed by Chris Dumez.
     8
     9        The script parsing the *.messages.in files would treat a line starting
     10        with '#' as a comment, but not a line starting with '<whitespace>#'.
     11        This means that jamming a '#' right in front of the first character of
     12        a message definition (as opposed to the beginning of a line) will have
     13        no effect and the line will get treated just the same as a
     14        non-commented line. Fix this by trimming all white space from the
     15        beginning and ending of the line before processing it.
     16
     17        * Scripts/webkit/parser.py:
     18        (parse):
     19        * Scripts/webkit/test-messages.in:
     20
    1212018-11-27  Thibault Saunier  <tsaunier@igalia.com>
    222
  • trunk/Source/WebKit/Scripts/webkit/parser.py

    r237110 r238577  
    5151    superclass = []
    5252    for line in file:
     53        line = line.strip()
    5354        match = re.search(r'messages -> (?P<destination>[A-Za-z_0-9]+) \s*(?::\s*(?P<superclass>.*?) \s*)?(?:(?P<attributes>.*?)\s+)?{', line)
    5455        if match:
     
    6263            continue
    6364        if line.startswith('#'):
    64             trimmed = line.rstrip()
    6565            if line.startswith('#if '):
    66                 conditions.append(trimmed[4:])
     66                conditions.append(line[4:])
    6767            elif line.startswith('#endif') and conditions:
    6868                conditions.pop()
    6969            elif line.startswith('#else') or line.startswith('#elif'):
    70                 raise Exception("ERROR: '%s' is not supported in the *.in files" % trimmed)
     70                raise Exception("ERROR: '%s' is not supported in the *.in files" % line)
    7171            continue
    7272        match = re.search(r'([A-Za-z_0-9]+)\((.*?)\)(?:(?:\s+->\s+)\((.*?)\))?(?:\s+(.*))?', line)
  • trunk/Source/WebKit/Scripts/webkit/test-messages.in

    r164171 r238577  
    2323#if ENABLE(WEBKIT2)
    2424#if NESTED_MASTER_CONDITION || MASTER_OR && MASTER_AND
     25
     26
     27# The parser should treat all of these as comments
     28#FakeLoadURLA(String url)
     29# FakeLoadURLB(String url)
     30    #FakeLoadURLC(String url)
     31    # FakeLoadURLD(String url)
    2532
    2633messages -> WebPage {
Note: See TracChangeset for help on using the changeset viewer.