Title: [181696] trunk/Tools
Revision
181696
Author
[email protected]
Date
2015-03-18 09:27:07 -0700 (Wed, 18 Mar 2015)

Log Message

prepare-ChangeLog doesn't understand C string literals split across multiple lines with \
https://bugs.webkit.org/show_bug.cgi?id=142815

Reviewed by Darin Adler.

* Scripts/prepare-ChangeLog:
(get_function_line_ranges_for_cpp): If the line ends with a backslash instead of a matching
quotation mark, use new variable $quotation_mark to remember what we are looking for, and
keep consuming the quoted text until the matching quotation mark is reached. Emit the
warning only if a line ends without a backslash before the matching quotation mark was found.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (181695 => 181696)


--- trunk/Tools/ChangeLog	2015-03-18 16:22:04 UTC (rev 181695)
+++ trunk/Tools/ChangeLog	2015-03-18 16:27:07 UTC (rev 181696)
@@ -1,3 +1,16 @@
+2015-03-18  Dan Bernstein  <[email protected]>
+
+        prepare-ChangeLog doesn't understand C string literals split across multiple lines with \
+        https://bugs.webkit.org/show_bug.cgi?id=142815
+
+        Reviewed by Darin Adler.
+
+        * Scripts/prepare-ChangeLog:
+        (get_function_line_ranges_for_cpp): If the line ends with a backslash instead of a matching
+        quotation mark, use new variable $quotation_mark to remember what we are looking for, and
+        keep consuming the quoted text until the matching quotation mark is reached. Emit the
+        warning only if a line ends without a backslash before the matching quotation mark was found.
+
 2015-03-18  Joseph Pecoraro  <[email protected]>
 
         Remove unused "preprocessor" parameter to sub-CodeGenerators

Modified: trunk/Tools/Scripts/prepare-ChangeLog (181695 => 181696)


--- trunk/Tools/Scripts/prepare-ChangeLog	2015-03-18 16:22:04 UTC (rev 181695)
+++ trunk/Tools/Scripts/prepare-ChangeLog	2015-03-18 16:27:07 UTC (rev 181696)
@@ -697,6 +697,7 @@
     my $in_macro = 0;
     my $in_method_declaration = 0;
     my $in_parentheses = 0;
+    my $quotation_mark;
     my $in_braces = 0;
     my $in_toplevel_array_brace = 0;
     my $brace_start = 0;
@@ -723,6 +724,18 @@
     my @all_namespaces;
 
     while (<$file_handle>) {
+        # Handle continued quoted string.
+        if ($quotation_mark) {
+            if (!s-([^\\]|\\.)*$quotation_mark--) {
+                if (!m-\\$-) {
+                    warn "mismatched quotes at line $. in $file_name\n";
+                    undef $quotation_mark;
+                }
+                next;
+            }
+            undef $quotation_mark;
+        }
+
         # Handle continued multi-line comment.
         if ($in_comment) {
             next unless s-.*\*/--;
@@ -753,8 +766,12 @@
                 s-//.*--;
             } else { # ' or "
                 if (!s-$match([^\\]|\\.)*?$match--) {
-                    warn "mismatched quotes at line $. in $file_name\n";
-                    s-$match.*--;
+                    if (!s-$match.*\\$--) {
+                        warn "mismatched quotes at line $. in $file_name\n";
+                        s-$match.*--;
+                    } else {
+                        $quotation_mark = $match;
+                    }
                 }
             }
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to