Announcement

Collapse
No announcement yet.

using grammar rules to ignore outside of parentheses

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

  • using grammar rules to ignore outside of parentheses

    I have read many posts about defining unimportant text using Grammar Rules as well as the guide (http://www.scootersoftware.com/suppo...nimportantv3); however, I cannot figure out a way to ignore text outside of a set of parentheses, yet still include the parentheses. For example, the string:

    &AUTO_START_BBRAM(auto_start_data.auto_start_trip_ report_air_start_pres_low_idle_time)

    and I want BC3 to ignore
    &AUTO_START_BBRAM()
    and keep the comparison
    auto_start_data.auto_start_trip_report_air_start_p res_low_idle_time

    If there was someway to do regex backtracking in BC3 I could do this by searching for (&AUTO_START_BBRAM\().*(\)), then within that result, ignoring \1 and \2

    So far, the closest I have gotten is getting BC3 to ignore the &AUTO_START_BBRAM( and still having the closing paren ) being a difference.

    Any help greatly appreciated.

  • #2
    Hello,

    If you define a basic grammar element called "MyGrammar" (or a better, descriptive title
    to:
    &AUTO_START_BBRAM(
    and another grammar element with the same name ("MyGrammar")
    to:
    )

    There will be only one "MyGrammar" in the importance list. Unchecking that marks all of the matching titles unimportant.

    You can also add regular expression statements to help define the two grammars further, such as:
    \)\s*$
    if the ) should only match at the very end of the line with optional whitespace and
    ^\s*&AUTO_START_BBRAM\(
    at the beginning of the line with optional whitespace.
    Aaron P Scooter Software

    Comment


    • #3
      Of course, the other option might be to define a basic grammar as "&AUTO_START_BBRAM" and make it unimportant, then define a second grammar that starts with "(" and ends with ")" and make it important. This will compare everything within the parentheses. Yes, it will include the parentheses too, but if there are a set of parentheses on both sides of the compare, then it might serve the same purpose.
      BC v4.0.7 build 19761
      ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

      Comment


      • #4
        Aaron, your first suggestion resulted in the closing paren still being a difference. I attached a screenshot. I attached a screenshot of the result. Note: I made a small error in my original post; I don't want the ampersand to be ignored.

        I should have specified that the full line of the compare on the left side is below, so your second suggestion wouldn't work.

        ,{ "ATASPTm", "", FORMAT_4D, &AUTO_START_BBRAM(auto_start_data.auto_start_trip_ report_air_start_pres_low_idle_time),INT_DATA, INT_DATA_DISPLAY, STRING_GENERAL_DISP_LEN, FALSE, 6104 , UNITS_NONE , 7 }

        Michael, that won't work because I need the parentheses ignored because the set of () aren't on both sides of the compare.

        With this additional information, do you have any other ideas? Thanks for your feedback.

        Comment


        • #5
          Hello,

          The reason my initial suggestion did not work is it assumed the line would end with a ). Since you have additional 'stuff' behind it, you'll need to mark the ) by itself.

          Does just the grammars:
          )
          and
          &AUTO_START_BBRAM(
          with regular expression disabled work for you? It would be important to note this would mark any ) character as unimportant, regardless of where it appears.
          Aaron P Scooter Software

          Comment


          • #6
            Hi Aaron, I thought that is what you meant in your first reply so that is what I have enabled in the screenshot.

            For some reason, the solo ) is not recognized. What is interesting is if I add the comma ), then that is recognized, but not when it is just the ).

            Comment


            • #7
              Hello,

              Is "Regular Expression" checked or unchecked in the grammar's definition? With just the ), it should be unchecked.

              Would it be possible to email us your current support.zip (Help menu -> Support; Export) and a pair of sample files (can be a text excerpt if it re-creates the issue on your system)?

              Please also include a link back to this forum thread for our reference.
              Last edited by Aaron; 10-Oct-2011, 10:10 AM. Reason: . -> ?
              Aaron P Scooter Software

              Comment

              Working...
              X