Announcement

Collapse
No announcement yet.

Comments in PHP files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Comments in PHP files

    I'm trying to compare PHP files, and I have a lot of files that are identical except for a change in a copyright line which is in a multi-line comment block like this:

    /**********

    Copyright (C) 2008 by Foo Bar

    **********/

    However, I can't get BC to detect more than the first line of the block as comment.

    I'm using BC 3.07 on Linux with the PHP plugin downloaded from this site.

    Any ideas what can be done?

  • #2
    Since the copyright is in a comment block, and comments are unimportant, why not just ignore unimportant changes?
    BC v4.0.7 build 19761
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

    Comment


    • #3
      P.S. I haven't tried it yet...but I do know that Beyond Compare does not support regular expression finds that extend over multiple lines... so creating a grammar that includes the comment delimiters as well as the Copyright verbiage might be tricky, if not impossible.
      BC v4.0.7 build 19761
      ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

      Comment


      • #4
        Thanks for the tip, the problem is that ignoring unimportant changes doesn't help if BC doesn't recognize the block comment.

        Multi-line shouldn't be a problem, as the "delimited" grammar block ha a checkbox to limit the recognition to one line only, and also it works fine with C/C++.

        Comment


        • #5
          Zaister,

          It looks like the downloadable PHP rule ignores block comments if they are of the form:
          /*
          *
          *
          */

          If they don't have the intermediate * characters, then the middle text won't be ignored.

          To fix this, select Tools > File Formats. Select the PHP format. Go to the Grammar tab. Create a new grammar item. Name it "Comment" and select "Delimited" as the category. Enter the delimiters as /* to */. Delete the Comment entry for "Comment=Text in list: \s*\/\*.*,s+\*[^\$]*,\s+\*\/\s*" so it doesn't override your new grammar.

          This should mark the entire block as a comment. You'll need to make sure to set Comments as unimportant in the Importance tab of Session > Session Settings.
          Chris K Scooter Software

          Comment


          • #6
            Thanks, Chris, that works fine!

            Comment


            • #7
              Why not modifying rules?

              Hi Scooter Software Team,

              Why don't you change these rules in the downloadable file? In the French forum, another guy fell on the same problem. I know it is not a easy problem because PHP may contain HTML, but I think it will be better than to leave the actual grammar.

              By the way, you may also add the # as a comment to eol

              Michel.
              Michel Dessaintes
              Modérateur du Forum Francophone & Traducteur Officiel de BC2/BC3/BC4 en Français

              Comment

              Working...
              X