Announcement

Collapse
No announcement yet.

Ignoring lines with special tags (C++)?

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

  • Ignoring lines with special tags (C++)?

    Dear all,

    I had asked this already back in the days of BC2 and in the German forum. I was told to ask again when BC3 is up... so here it comes: ;-)

    I am using BC mostly to compare C++ files. It works perfectly, but I have a minor issue in some cases:

    The sources are under CVS version control. This contains a "URL" tag which is different depending on who checked out the sources. But that's not of importance to me. The line always has a unique identifier "$HeadURL:". So I want to excluse lines that contain this tag. This tag is always in a comment, so I could choose to ingore comments but then (on the other hand) I am loosing important differences (like e.g. function descriptions), too.

    ...so:
    Is there a possibility in BC3 to ingore lines with a special Tag (using a grammer item or alike)? I tried hard... but I could not achive it. :-(

    With regards, Morten.

  • #2
    • Open a file that contains the HeadURL
    • Click on the Text Format button (next to the referee Session Settings button on the toolbar)
    • Click on the Grammar tab
    • Click on "Comment=Text from // to end of line" then click the Clone... button
    • Enter "HeadURL" as the element name
    • Change the "//" in the Text from box to "$HeadURL:" (without the quotes)
    • Click OK, Click OK, Click Yes to reload the file using the new grammar

    • Click the referee Session Settings button
    • Find HeadURL in the list of Grammar elements and uncheck the checkbox to make it not important
    • Check the checkbox next to comments if you really want them to be important.
    • Select "Also update session defaults" from the droplist at the bottom of the Session Settings dialog and click OK to save your changes.
    • Now click the ≈ Ignore Unimportant Differences button on the toolbar
    BC v4.0.7 build 19761
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

    Comment


    • #3
      Originally posted by Michael Bulgrien View Post
      • ...
      Wow, that was really something very helpful, indeed. It gave me the inside into the grammer feature I needed. Thanks!

      Unfortunately the issue is not solved. :-(

      The reason is that the $HeadURL tag is unfortunately inside a comment. So once I active the comment to be important and the $HeadURL to be not the line will again be marked. That's because the comment has changed, too (of course). So it is not a 100% solution yet. Such a line looks like:

      // $HeadURL: [some_text_version_strings_etc] $

      As you see: The comment as well as the embedded string inside the $HeadURL thing changes both. I would really need to say something like "a comment line containing $HeadURL is no of importance". So you can think of it as a specialisation of a comment.

      But again: That was very interesting to read anyways!

      Comment


      • #4
        No problem.

        Just edit the grammar element, put the // back in before the $HeadURL then move the HeadURL grammar element up above the comment grammar elements so that it takes precedence.
        BC v4.0.7 build 19761
        ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

        Comment


        • #5
          Originally posted by Michael Bulgrien View Post
          No problem.

          Just edit the grammar element, put the // back in before the $HeadURL then move the HeadURL grammar element up above the comment grammar elements so that it takes precedence.
          Ok - this worked pretty well until today. ;-)

          Now it looks different and I am again lost. :-(
          We have code where the HeadURL is embedded in a multi-line comment like that:
          /*
          * $HeadURL: [some_text_version_strings_etc] $
          */
          As you see: It's inside a huge comment so I cannot handle it as a single line. Thus your last hint does not work anymore as it cannot takes precedence since the "outer" comment section is taken into account anyways.

          It would be really easy if BC just had a feature like "if a line contains XXX just skip it, no matter where it is embedded no matter what rules will follow". Probably it's worth a feature request?

          Comment


          • #6
            Click Tools\File Formats
            Select the C File Format
            Click the Save As... button and give a new name (e.g. C Source)
            Select the new C Source file format
            Create a HeadURL grammar (or change your existing one) with the following definition:

            Category: Basic
            [x] Regular Expression
            Text Matching: ^.*\$HeadURL:.*$

            Delete the Block Comment Grammar: (Comment=Text from /* to */)

            In your File Formats, you can now switch between the C format you would like to use by checking or unchecking the file formats or changing their order to determine which file format will take presedence. The original C format will allow you to view block comments as comments. The new file format will not recognize block comments as comments. Not ideal, I know, but it is a work-around.

            Originally posted by MortenMacFly View Post
            It would be really easy if BC just had a feature like "if a line contains XXX just skip it, no matter where it is embedded no matter what rules will follow". Probably it's worth a feature request?
            Although I can see your point, I don't know that a grammar which defies/overrides all other grammar rules is the best solution. I would suggest that scooter team expand their current delimited grammar type as follow:

            Text from: ____________________

            [ ] Including: ____________________

            [ ] Excluding: ____________________

            To: ____________________

            This would allow a delimited grammar to be defined based on content. For your issue, for example, you would then be able to change the block comment grammar to exclude block comments containing the HeadURL as follows:

            Text from: /*
            [ ] Including:
            [X] Excluding: $HeadUrl:
            To: */
            BC v4.0.7 build 19761
            ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

            Comment


            • #7
              Originally posted by Michael Bulgrien View Post
              Category: Basic
              It worked seamlessly after I changed that option to "Lines"... don't ask me why. However - thanks a lot!

              Still - if BC devs read this they probably might think of you suggestion as a feature to add... Although I would like to have several items that can be excluded in a list. Because besides "HeadURL" there is also Id, Version and a lot others to ignore.

              How are feature requests handled? Can they be posted in this forum and/or send to a specific email address?! (Need to figure that out...)

              Comment


              • #8
                I'm glad you guys got it figured out.

                Feature requests can be submitted via either the forums or by emailing [email protected]. Both get read by at least one support person. The support emails generally get read faster, but the forums have the advantage that other people can add comments or chime in that they need the same feature, which can bump it's priority.

                Better handling for this case is already in our todo list.
                Zoë P Scooter Software

                Comment


                • #9
                  Originally posted by MortenMacFly View Post
                  ... Although I would like to have several items that can be excluded in a list. Because besides "HeadURL" there is also Id, Version and a lot others to ignore.
                  You could create a regular expression in a single exclude field that excludes multiple items. Thats one of the wonderful things about RegEx.
                  BC v4.0.7 build 19761
                  ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

                  Comment


                  • #10
                    Originally posted by Craig View Post
                    Better handling for this case is already in our todo list.
                    HOOOOOORAY!!!! :-)

                    Originally posted by Michael Bulgrien View Post
                    You could create a regular expression in a single exclude field that excludes multiple items. Thats one of the wonderful things about RegEx.
                    Darn... sure thing. I am not using RegEx's often but I got your point.

                    Comment


                    • #11
                      ...any information when it is planned to implement this? I mean: Is this something for the 3.0.x series or later? I would certainly appreciate this feature a lot. (Sorry for bumping...)

                      Comment


                      • #12
                        Mark block of code to be ignored

                        On a related note to this I would like to be able to put BEGIN and END tags to mark a whole SECTION of code to be ignored.

                        Is it possible to do this?

                        Comment


                        • #13
                          Hello,

                          This is possible.

                          You can either Ignore (temporary) or mark as Unimportant (saved with session or global.)

                          Ignoring multiple lines is as easy as selecting multiple lines (or click, then shift click on the End point), right-click, and select Ignore. If you refresh, you will lose the ignored status.

                          To mark as Unimportant, follow this KB article and use the Delimited grammar element. You can define any particular text as unimportant, which can be general comments, or a "\\BEGINUnimportant" or "\\ENDUnimportant" comment that you add to your code.
                          http://www.scootersoftware.com/suppo..._unimportantv3
                          Aaron P Scooter Software

                          Comment

                          Working...
                          X