No announcement yet.

How to ignore string with $ delimiter

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to ignore string with $ delimiter

    I'm comparing two SVN branches of C code and want to ignore the SVN version stamps.

    I tried adding a Delimited grammar using:
    Element name: SVN ID string
    Text from: $Id:
    to: $

    and I tried:
    Text from: \$Id:
    to: \$

    But the lines with the version strings are still flagged. The lines are like this:
    // $Id: sample.c 1234 2009-08-18 17:03:12Z bobdell $

    I think the problem may be that the string is in a comment (I want to make comments important). I tried moving my grammer up above the Comment line in the grammer but that didn't help.

    Am I doing something wrong? Thanks...

  • #2

    The problem is that the comment is detected first, and the lines is considered a comment instead of a SVN ID String. You can click into the text, and the bottom status bar will display what grammar type is detected.

    One solution is to define two grammar elements:
    $Id: to $ (if not a Regular Expression, it does not need \)
    and another, also labeled SVN ID string:
    // $Id: to $

    Does that work for you?
    Aaron P Scooter Software


    • #3
      That should work -- I got it to work by changing the SVN ID string item to a "Lines" type matching "// $Id:" and next 0 lines.

      I also tried editing the "Comment" grammar item to "My Comment" and moving it down the list so that it showed up below "SVN ID string" in the Grammar elements on the Importance tab, but it seemed the comment was still detected first. It seems like a bug that the detection order doesn't follow the order of items in the grammar elements list.



      • #4
        The order of the elements matters if there is an exact tie in definition (keywords above identifiers), but an element definition is greedy and can swallow other elements.

        You should be able to have delimited from \\$ID to $ (disable RegEx), but if your current definition works for you then that should be fine as well.
        Aaron P Scooter Software


        • #5
          Hello Aaron,
          could you please explain this case more detailed or submit a screenshot?
          I don't really get it how i could ignore svn properties tags in the code. Maybe i have other version as commentators here?
          I've attached my screenshot here
          Thanks in advance!


          • #6
            This original forum post deals with multiple Grammar elements in the list, and determining which is picked. Since you only have one grammar element, you are probably running into a different issue defining your element.

            Here is a KB article on the subject, with a Video tutorial link at the top:

            For your example, I would suggest a Basic or Delimited definition, such as Delimited: $Id: to 'ends at end of line.'
            Aaron P Scooter Software